﻿/* ============================================================
   Timetable Generator v2 â€” Complete Styles
   Accent: lime-green #65a30d
   ============================================================ */

/* ---- Keyframes ---- */
@keyframes tgv2-pop-in {
    0%   { opacity: 0; transform: scale(0.82) translateY(-6px); }
    65%  { transform: scale(1.04) translateY(1px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes tgv2-pop-out {
    from { opacity: 1; transform: scale(1) translateY(0); }
    to   { opacity: 0; transform: scale(0.82) translateY(-6px); }
}
@keyframes tgv2-slide-out-left {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(-22px); }
}
@keyframes tgv2-slide-in-right {
    from { opacity: 0; transform: translateX(22px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes tgv2-shake {
    0%,100% { transform: translateX(0); }
    20%     { transform: translateX(-6px); }
    40%     { transform: translateX(6px); }
    60%     { transform: translateX(-5px); }
    80%     { transform: translateX(5px); }
}
@keyframes tgv2-tag-in {
    from { opacity: 0; transform: scale(0.7); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes tgv2-tag-out {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(0.7); }
}

/* ============================================================
   Overlay
   ============================================================ */
.tgv2-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .52);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 8px;
}
.tgv2-overlay.is-open { display: flex; }

/* ============================================================
   Modal
   ============================================================ */
.tgv2-modal {
    position: relative;
    background: #fff;
    border-radius: 16px;
    width: min(480px, 100%);
    max-height: 92vh;
    overflow: hidden;
    box-shadow: 0 24px 72px rgba(0, 0, 0, .22);
    display: flex;
    flex-direction: column;
    transition: width 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}
.tgv2-modal.tgv2-modal--wide {
    width: min(1160px, calc(100vw - 16px)) !important;
    max-width: none;
}

.tgv2-body {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
}

/* ---- Close button ---- */
.tgv2-close {
    position: absolute;
    top: 12px;
    right: 14px;
    z-index: 10;
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: #9ca3af;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s, color 0.15s;
}
.tgv2-close:hover { background: #f3f4f6; color: #111827; }

/* ============================================================
   Welcome screen
   ============================================================ */
.tgv2-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 3rem 2.2rem 2.8rem;
    gap: 1rem;
}
.tgv2-welcome__icon {
    width: 68px;
    height: 68px;
    background: #f7fee7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 6px rgba(13, 148, 136, .08);
}
.tgv2-welcome__icon svg {
    width: 32px;
    height: 32px;
    stroke: #65a30d;
}
.tgv2-welcome__title {
    font-size: 1.55rem;
    font-weight: 800;
    color: #111827;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    justify-content: center;
}
.tgv2-welcome__badge {
    display: inline-flex;
    align-items: center;
    background: #65a30d;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 20px;
    letter-spacing: 0.06em;
    vertical-align: middle;
}
.tgv2-welcome__sub {
    color: #6b7280;
    font-size: 0.95rem;
    max-width: 360px;
    margin: 0;
    line-height: 1.65;
}
.tgv2-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #65a30d;
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    padding: 15px 30px;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: background 0.18s, transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 6px 20px rgba(13, 148, 136, .3);
}
.tgv2-cta-btn:hover  { background: #4d7c0f; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(101,163,13,.38); }
.tgv2-cta-btn:active { transform: translateY(0); }

/* ── School type selection cards ─────────────────────────────────────── */
.tgv2-school-type-cards {
    display: flex;
    gap: 14px;
    width: 100%;
    max-width: 480px;
    margin-top: 0.5rem;
}
.tgv2-school-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 16px 18px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 14px;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.17s, box-shadow 0.17s, transform 0.15s;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.tgv2-school-card:hover {
    border-color: #65a30d;
    box-shadow: 0 6px 20px rgba(101,163,13,.18);
    transform: translateY(-2px);
}
.tgv2-school-card:active { transform: translateY(0); }
.tgv2-school-card--disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}
.tgv2-school-card__icon {
    width: 44px;
    height: 44px;
    background: #f7fee7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.tgv2-school-card__icon svg {
    width: 22px;
    height: 22px;
    stroke: #65a30d;
}
.tgv2-school-card__title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    justify-content: center;
}
.tgv2-school-card__desc {
    font-size: 0.78rem;
    color: #6b7280;
    line-height: 1.5;
}
.tgv2-school-card__coming-soon {
    display: inline-block;
    background: #f3f4f6;
    color: #9ca3af;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 20px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    vertical-align: middle;
}

/* ============================================================
   Name screen
   ============================================================ */
.tgv2-name-screen {
    padding: 2.5rem 2.2rem 2.2rem;
    max-width: 420px;
    margin: 0 auto;
}
.tgv2-name-screen__title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #111827;
    margin: 0 0 0.35rem;
}
.tgv2-name-screen__sub {
    font-size: 0.88rem;
    color: #6b7280;
    margin: 0 0 1.6rem;
}

/* ============================================================
   Shared: badge, labels, inputs, buttons
   ============================================================ */
.tgv2-step__badge {
    display: inline-flex;
    align-items: center;
    background: #f7fee7;
    color: #65a30d;
    border: 1px solid #d9f99d;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
}
.tgv2-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: #374151;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.tgv2-field { margin-bottom: 1.2rem; }
.tgv2-inp {
    width: 100%;
    border: 1.5px solid #d1d5db;
    border-radius: 9px;
    padding: 10px 12px;
    font-size: 0.95rem;
    color: #111827;
    outline: none;
    box-sizing: border-box;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.tgv2-inp:focus { border-color: #65a30d; box-shadow: 0 0 0 3px rgba(101,163,13,.14); }
.tgv2-inp--error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239,68,68,.12);
    animation: tgv2-shake 0.38s ease;
}
.tgv2-inp--flex { flex: 1 1 0; min-width: 80px; width: auto; }

.tgv2-row-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 1.5rem;
}
.tgv2-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    border-radius: 9px;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 10px 20px;
    cursor: pointer;
    transition: background 0.15s, transform 0.12s, box-shadow 0.12s;
    white-space: nowrap;
}
.tgv2-btn--primary { background: #65a30d; color: #fff; }
.tgv2-btn--primary:hover { background: #4d7c0f; }
.tgv2-btn--primary:disabled { background: #d1d5db; color: #9ca3af; cursor: not-allowed; transform: none !important; }
.tgv2-btn--ghost  { background: transparent; color: #374151; border: 1.5px solid #d1d5db; }
.tgv2-btn--ghost:hover { background: #f3f4f6; }
.tgv2-btn--sm { font-size: 0.82rem; padding: 7px 14px; }

/* ============================================================
   Wizard: two-column layout with independent scrollbars
   ============================================================ */
/*
 * Height chain for wizard screens:
 *   .tgv2-modal:has(.tgv2-wizard)  height:92vh, flex-column, overflow:hidden
 *     .tgv2-body                   flex:1 1 auto â†’ fills the 92vh
 *       (has wizard) overflow:hidden, display:flex, flex-direction:column
 *         .tgv2-wizard             flex:1 1 0, min-height:0 â†’ fills body
 *           __left/__right         min-height:0, overflow-y:auto â†’ scroll independently
 *
 * For non-wizard screens (welcome, name, etc.):
 *   modal has no explicit height â†’ sizes to content (capped at max-height:92vh)
 */
.tgv2-modal:has(.tgv2-wizard) {
    height: 92vh;
}
.tgv2-body:has(.tgv2-wizard) {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.tgv2-wizard {
    display: flex;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
}
.tgv2-wizard__left {
    flex: 1 1 75%;
    padding: 1.4rem 1.1rem 1.1rem;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid #f0f2f4;
    min-height: 0;
}
.tgv2-wizard__right {
    flex: 0 0 25%;
    background: #f8fafb;
    border-radius: 0 16px 16px 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 0.9rem 1rem;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ---- Step content ---- */
.tgv2-step { }
.tgv2-step__title {
    font-size: 1.12rem;
    font-weight: 800;
    color: #111827;
    margin: 0 0 0.3rem;
}
.tgv2-step__sub {
    font-size: 0.87rem;
    color: #6b7280;
    margin: 0 0 1.4rem;
    line-height: 1.55;
}
.tgv2-step__footer {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.6rem;
    padding-top: 1rem;
    border-top: 1px solid #f0f2f4;
}

/* Sticky top navigation bar injected at the top of each wizard step */
/* When the top bar is injected, the left panel becomes a flex column:
   [bar â€” fixed height] + [scroller â€” takes remaining height, scrolls internally] */
.tgv2-wizard__left.has-step-top-bar {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}
.tgv2-step-top-bar {
    flex-shrink: 0;
    padding: 9px 1.1rem;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 2px 6px rgba(0,0,0,0.07);
    display: flex;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
    z-index: 20;
}
.tgv2-step-scroller {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
    padding: 1.4rem 1.1rem 1.1rem;
}

/* ============================================================
   Grade chips
   ============================================================ */
.tgv2-grade-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 0.5rem;
}
.tgv2-grade-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1.5px solid #d1d5db;
    background: #fff;
    color: #374151;
    border-radius: 9px;
    padding: 8px 13px;
    font-size: 0.86rem;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.12s, box-shadow 0.12s;
}
.tgv2-grade-chip:hover:not(.is-selected) {
    border-color: #65a30d;
    color: #65a30d;
    background: #f7fee7;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(101,163,13,.15);
}
.tgv2-grade-chip.is-selected {
    border-color: #65a30d;
    background: #65a30d;
    color: #fff;
    box-shadow: 0 3px 10px rgba(101,163,13,.25);
}
.tgv2-grade-chip:active { transform: scale(0.95); }

/* Animated checkmark inside chip */
.tgv2-grade-chip__check {
    display: inline-flex;
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    transform: scale(0);
    opacity: 0;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.15s;
}
.tgv2-grade-chip.is-selected .tgv2-grade-chip__check {
    transform: scale(1);
    opacity: 1;
}
.tgv2-grade-chip__check svg { width: 100%; height: 100%; stroke: #fff; }
.tgv2-grade-chip__lbl { line-height: 1; }

/* ============================================================
   Animation helpers
   ============================================================ */
.tgv2-anim-enter {
    opacity: 0;
    transform: translateY(-10px) scale(0.92);
}
.tgv2-anim-enter-active {
    animation: tgv2-pop-in 0.32s cubic-bezier(0.34, 1.28, 0.64, 1) forwards;
}
.tgv2-anim-leave {
    animation: tgv2-pop-out 0.22s ease forwards;
}
.tgv2--shake { animation: tgv2-shake 0.4s ease; }

/* ============================================================
   Tree panel (right column)
   ============================================================ */
.tgv2-tree-panel { flex: 1; display: flex; flex-direction: column; }
.tgv2-tree-panel__hdr {
    font-size: 0.7rem;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 10px;
}
.tgv2-tree { flex: 1; }
.tgv2-tree__empty {
    font-size: 0.84rem;
    color: #9ca3af;
    text-align: center;
    margin-top: 2.5rem;
    padding: 0 1rem;
    line-height: 1.6;
}

/* Root node */
.tgv2-tree__root {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #fff;
    border-radius: 9px;
    border: 1px solid #e5e7eb;
    margin-bottom: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.tgv2-tree__root-ico {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
.tgv2-tree__root-ico svg { width: 100%; height: 100%; fill: #65a30d; }
.tgv2-tree__root-lbl {
    font-size: 0.86rem;
    font-weight: 700;
    color: #111827;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Grade nodes */
.tgv2-tree__grades {
    padding-left: 10px;
    margin-left: 8px;
    border-left: 2px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.tgv2-tree__grade-hdr {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 8px;
    border-radius: 7px;
    cursor: default;
    transition: background 0.12s;
}
.tgv2-tree__grade-hdr:hover { background: rgba(0,0,0,.04); }
.tgv2-tree__grade-lbl {
    font-size: 0.84rem;
    font-weight: 600;
    color: #374151;
}

/* Classes folder nested inside grade */
.tgv2-tree__grade-children {
    padding-left: 16px;
    margin-left: 10px;
    border-left: 2px solid #e5e7eb;
    margin-bottom: 3px;
}
.tgv2-tree__cls-hdr {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 6px;
}
.tgv2-tree__cls-lbl {
    font-size: 0.81rem;
    font-weight: 600;
    color: #6b7280;
}

/* Class items list */
.tgv2-tree__class-list {
    padding-left: 16px;
    margin-left: 10px;
    border-left: 2px dashed #e2e6ea;
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-bottom: 3px;
}
.tgv2-tree__class-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 0.81rem;
    color: #374151;
    transition: background 0.1s;
}
.tgv2-tree__class-item:hover { background: rgba(0,0,0,.04); }

/* Folder & file icons */
.tgv2-tree__folder-ico {
    width: 15px; height: 15px;
    flex-shrink: 0;
    display: flex; align-items: center;
}
.tgv2-tree__folder-ico svg    { width: 100%; height: 100%; fill: #f59e0b; }
.tgv2-tree__folder-ico--sm    { width: 13px; height: 13px; }
.tgv2-tree__folder-ico--sm svg { fill: #fbbf24; }
.tgv2-tree__file-ico {
    width: 13px; height: 13px;
    flex-shrink: 0;
    display: flex; align-items: center;
}
.tgv2-tree__file-ico svg { width: 100%; height: 100%; fill: #6b7280; }

/* ============================================================
   Classes step
   ============================================================ */
.tgv2-inp-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.tgv2-examples-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.tgv2-xchip {
    border: 1px solid #d1d5db;
    background: #f9fafb;
    color: #374151;
    border-radius: 7px;
    padding: 5px 10px;
    font-size: 0.79rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.tgv2-xchip:hover {
    border-color: #65a30d;
    background: #f7fee7;
    color: #65a30d;
}
.tgv2-grade-checks-wrap { margin-top: 1rem; }
.tgv2-grade-checks-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 7px 16px;
    margin-top: 8px;
}
.tgv2-check-lbl {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.86rem;
    color: #374151;
    user-select: none;
}
.tgv2-check {
    accent-color: #65a30d;
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    cursor: pointer;
}

/* ---- Added-class tags ---- */
.tgv2-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 1rem;
    min-height: 28px;
}
.tgv2-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f7fee7;
    border: 1px solid #d9f99d;
    color: #4d7c0f;
    border-radius: 20px;
    padding: 4px 6px 4px 11px;
    font-size: 0.82rem;
    font-weight: 600;
}
.tgv2-tag--new { animation: tgv2-tag-in 0.26s cubic-bezier(0.34,1.3,0.64,1) forwards; }
.tgv2-tag--out { animation: tgv2-tag-out 0.2s ease forwards; }
.tgv2-tag__rm {
    background: none;
    border: none;
    cursor: pointer;
    color: #4d7c0f;
    font-size: 1rem;
    line-height: 1;
    padding: 0 4px;
    opacity: 0.65;
    transition: opacity 0.12s;
    display: flex;
    align-items: center;
}
.tgv2-tag__rm:hover { opacity: 1; }

/* ============================================================
   Subjects step â€” matrix
   ============================================================ */
.tgv2-subj-matrix-wrap {
    overflow-x: auto;
    margin-bottom: 0.5rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    background: #fafafa;
}
.tgv2-subj-matrix {
    display: flex;
    min-width: max-content;
    gap: 0;
}
.tgv2-subj-col {
    display: flex;
    flex-direction: column;
    min-width: 116px;
    border-right: 1px solid #e5e7eb;
    padding: 10px 10px 8px;
}
.tgv2-subj-col:last-child { border-right: none; }

.tgv2-subj-col__hdr {
    margin-bottom: 4px;
}
.tgv2-subj-grade-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: #111827;
}
.tgv2-subj-col__divider {
    height: 1px;
    background: #e5e7eb;
    margin: 6px 0;
}
.tgv2-subj-col__classes {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.tgv2-subj-cls-lbl {
    font-size: 0.82rem;
}
.tgv2-subj-col__empty {
    font-size: 0.76rem;
    color: #9ca3af;
    font-style: italic;
    margin: 0;
}

/* added subjects tag list */
.tgv2-subj-list { margin-top: 1rem; }

/* ============================================================
   Tree â€” class item with row wrapper + subject list
   ============================================================ */
.tgv2-tree__class-item-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 0.81rem;
    color: #374151;
    transition: background 0.1s;
}
.tgv2-tree__class-item-row:hover { background: rgba(0,0,0,.04); }

/* override the old .tgv2-tree__class-item direct display rule */
.tgv2-tree__class-item {
    display: block;
}

.tgv2-tree__subject-list {
    padding-left: 22px;
    margin-left: 8px;
    border-left: 2px dashed #d1fae5;
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-bottom: 2px;
}
.tgv2-tree__subject-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 0.78rem;
    color: #4d7c0f;
    transition: background 0.1s;
}
.tgv2-tree__subject-item:hover { background: rgba(101,163,13,.06); }
.tgv2-tree__subj-ico {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
.tgv2-tree__subj-ico svg { width: 100%; height: 100%; fill: #65a30d; }

.tgv2-tree__subject-item { flex-wrap: nowrap; }
.tgv2-tree__subj-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tgv2-tree__ppc-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    padding: 0 5px;
    height: 18px;
    background: #65a30d;
    color: #fff;
    border-radius: 9px;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
    letter-spacing: 0.01em;
}

/* ============================================================
   Step 4: Periods Per Cycle
   ============================================================ */
.tgv2-inp--select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 18px;
    padding-right: 36px;
    cursor: pointer;
}
.tgv2-ppc-table {
    margin-top: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}
.tgv2-ppc-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid #f3f4f6;
    background: #fff;
}
.tgv2-ppc-row:last-child { border-bottom: none; }
.tgv2-ppc-row:nth-child(even) { background: #f9fafb; }
.tgv2-ppc-grade-name {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
}
.tgv2-ppc-inp-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
}
.tgv2-ppc-inp {
    width: 68px;
    padding: 5px 8px;
    font-size: 0.85rem;
    text-align: center;
}
.tgv2-ppc-unit {
    font-size: 0.75rem;
    color: #9ca3af;
    white-space: nowrap;
}

/* saved summary */
.tgv2-ppc-saved { margin-top: 14px; }
.tgv2-ppc-saved-wrap { background: #f7fee7; border: 1px solid #d9f99d; border-radius: 10px; padding: 10px 14px; }
.tgv2-ppc-saved-hdr { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #65a30d; margin: 0 0 8px; }
.tgv2-ppc-saved-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.tgv2-ppc-saved-row:last-child { margin-bottom: 0; }
.tgv2-ppc-saved-subj { font-size: 0.82rem; font-weight: 600; color: #374151; min-width: 80px; padding-top: 2px; }
.tgv2-ppc-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.tgv2-ppc-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: #fff;
    border: 1px solid #bef264;
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 0.75rem;
    color: #4d7c0f;
}
.tgv2-ppc-pill strong { color: #65a30d; font-weight: 700; }

.tgv2-ppc-pill strong { color: #65a30d; font-weight: 700; }

/* ============================================================
   Step 5: Teachers â€” collapsible right-panel boxes
   ============================================================ */
.tgv2-collapse {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}
.tgv2-collapse__hdr {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    background: #f9fafb;
    border: none;
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 600;
    color: #374151;
    text-align: left;
    transition: background 0.15s;
}
.tgv2-collapse__hdr:hover { background: #f7fee7; }
.tgv2-collapse.is-open .tgv2-collapse__hdr { background: #f7fee7; color: #65a30d; }
.tgv2-collapse__chevron {
    margin-left: auto;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    transition: transform 0.2s;
}
.tgv2-collapse__chevron svg { width: 100%; height: 100%; }
.tgv2-collapse.is-open .tgv2-collapse__chevron { transform: rotate(180deg); }
.tgv2-collapse__body { padding: 10px 14px; background: #fff; }
.tgv2-collapse__body[hidden] { display: none; }

/* ============================================================
   Step 5: Teachers â€” teacher tree (right panel)
   ============================================================ */
.tgv2-teacher-tree { display: flex; flex-direction: column; gap: 6px; }

/* ---- Teacher branch tree ---- */

/* Root: one teacher */
.tgv2-ttree__teacher {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

/* Teacher header row â€” styled like .tgv2-tree__root */
.tgv2-ttree__teacher-hdr {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    background: #f7fee7;
    border-bottom: 1px solid #d1fae5;
}
.tgv2-ttree__person-ico {
    width: 16px; height: 16px; flex-shrink: 0;
    display: flex; align-items: center;
}
.tgv2-ttree__person-ico svg { width: 100%; height: 100%; fill: #65a30d; }
.tgv2-ttree__teacher-name {
    font-size: 0.84rem; font-weight: 700; color: #4d7c0f; flex: 1;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Grade branch â€” vertical connector line */
.tgv2-ttree__grade-branch {
    padding: 6px 0 4px 12px;
    margin-left: 20px;
    border-left: 2px solid #d1fae5;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

/* One grade leaf */
.tgv2-ttree__grade-leaf {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border-radius: 6px;
    position: relative;
    transition: background .1s;
}
/* Horizontal connector from branch line to leaf */
.tgv2-ttree__grade-leaf::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    width: 10px;
    height: 2px;
    background: #d1fae5;
}
.tgv2-ttree__grade-leaf:hover { background: #f7fee7; }
.tgv2-ttree__leaf-ico {
    width: 13px; height: 13px; flex-shrink: 0;
    display: flex; align-items: center;
}
.tgv2-ttree__leaf-ico svg { width: 100%; height: 100%; fill: #f59e0b; }
.tgv2-ttree__leaf-lbl { font-size: 0.79rem; font-weight: 600; color: #374151; }

/* ============================================================
   Groups right panel (IG / EG steps)
   ============================================================ */
.tgv2-grppnl-list { display: flex; flex-direction: column; gap: 6px; padding: 2px 0; }
.tgv2-grppnl-item {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 7px 10px;
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px;
}
.tgv2-grppnl-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tgv2-grppnl-name  { font-size: 0.82rem; font-weight: 700; color: #4d7c0f; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tgv2-grppnl-meta  { font-size: 0.74rem; color: #6b7280; }
.tgv2-grppnl-subs  { font-size: 0.73rem; color: #65a30d; font-weight: 600; }
.tgv2-grppnl-rm    { flex-shrink: 0; background: none; border: none; font-size: 1.05rem; line-height: 1; color: #9ca3af; cursor: pointer; padding: 0 2px; margin-top: 1px; }
.tgv2-grppnl-rm:hover { color: #ef4444; }

/* ============================================================
   Step 5: Teachers â€” left panel form
   ============================================================ */
.tgv2-step--teachers { overflow-y: auto; }
.tgv2-tchr-name-row {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
}
.tgv2-field--sm { flex: 0 0 90px; }
.tgv2-field--grow { flex: 1; }
.tgv2-tchr-matrix-wrap { margin-top: 10px; }
.tgv2-tchr-matrix {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 8px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}
.tgv2-tchr-grade-col { flex: 0 0 auto; min-width: 140px; }
.tgv2-tchr-grade-hdr {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 4px;
}
.tgv2-tchr-grade-all { display: flex; align-items: center; gap: 5px; cursor: pointer; font-size: 0.8rem; font-weight: 700; color: #374151; }
.tgv2-tchr-grade-all input { accent-color: #65a30d; }
.tgv2-tchr-ppc-hdr { font-size: 0.7rem; font-weight: 400; color: #9ca3af; font-style: normal; }
.tgv2-tchr-subj-hdr { font-size: 0.68rem; font-weight: 600; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.05em; }
.tgv2-tchr-cls-list { display: flex; flex-direction: column; gap: 2px; }
.tgv2-tchr-cb-row {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 5px;
    font-size: 0.8rem;
    color: #374151;
    transition: background 0.1s;
}
.tgv2-tchr-cb-row:hover { background: #e0fdf4; }
.tgv2-tchr-cb-row input { accent-color: #65a30d; }
.tgv2-tchr-cls-name { flex: 1; }
.tgv2-tchr-ppc { font-size: 0.72rem; color: #65a30d; font-weight: 700; }
.tgv2-tchr-total-bar {
    margin-top: 10px;
    padding: 8px 12px;
    background: #f7fee7;
    border: 1px solid #d9f99d;
    border-radius: 8px;
    font-size: 0.83rem;
    color: #4d7c0f;
}
.tgv2-tchr-total-bar strong { font-size: 1rem; color: #65a30d; }
.tgv2-step__footer--inline { margin-top: 12px; }

/* Teacher card list at the bottom */
.tgv2-tchr-list { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 0; }
.tgv2-tchr-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}
.tgv2-tchr-card__hdr {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    background: #f9fafb;
}
.tgv2-tchr-card__name { flex: 1; font-size: 0.83rem; font-weight: 600; color: #374151; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tgv2-tchr-card__total { font-size: 0.75rem; color: #65a30d; font-weight: 700; }
.tgv2-btn--danger { background: #ef4444; color: #fff; }
.tgv2-btn--danger:hover { background: #dc2626; }
.tgv2-btn--success { background: #10b981; color: #fff; }
.tgv2-btn--success:hover { background: #059669; }
.tgv2-btn--success:disabled { background: #d1d5db; color: #9ca3af; cursor: not-allowed; }

.tgv2-ppc-pill strong { color: #65a30d; font-weight: 700; }

/* ============================================================
   Step 5: Internal Grouping
   ============================================================ */
.tgv2-step--groups { overflow-y: auto; }

.tgv2-grp-info-note {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 9px;
    padding: 10px 14px;
    margin: 10px 0 14px;
    font-size: 0.8rem;
    color: #1d4ed8;
    line-height: 1.5;
}
.tgv2-grp-info-ico {
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 1px;
    font-style: normal;
}

/* Grade block (new cluster layout) */
.tgv2-grp-body { display: flex; flex-direction: column; gap: 18px; }
.tgv2-grp-grade-block {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}
.tgv2-grp-grade-title {
    padding: 7px 14px;
    background: #f7fee7;
    border-bottom: 1px solid #d9f99d;
    font-size: 0.82rem;
    font-weight: 700;
    color: #4d7c0f;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}
.tgv2-grp-cluster {
    border-bottom: 1px solid #f3f4f6;
    background: #fff;
}
.tgv2-grp-cluster:last-child { border-bottom: none; }
.tgv2-grp-cluster-hdr {
    padding: 6px 14px;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.78rem;
    font-weight: 700;
    color: #374151;
}
.tgv2-grp-cluster-detail {
    font-weight: 400;
    font-style: normal;
    color: #6b7280;
    font-size: 0.75rem;
}
.tgv2-grp-cluster-body {
    padding: 2px 0 4px;
}
.tgv2-grp-subj-row {
    padding: 8px 14px;
    border-bottom: 1px solid #f3f4f6;
}
.tgv2-grp-subj-row:last-child { border-bottom: none; }
.tgv2-grp-subj-row-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}
.tgv2-grp-subj-name {
    font-size: 0.84rem;
    font-weight: 600;
    color: #1f2937;
}
.tgv2-grp-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}
.tgv2-grp-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.82rem;
    color: #374151;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.15s, background 0.15s;
}
.tgv2-grp-chip input { display: none; }
.tgv2-grp-chip:has(input:checked) {
    border-color: #65a30d;
    background: #f7fee7;
    color: #4d7c0f;
    font-weight: 600;
}
.tgv2-grp-chip.is-grouped {
    border-color: #d9f99d;
    background: #ecfccb;
    color: #4d7c0f;
    opacity: 0.7;
    cursor: default;
}
.tgv2-grp-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 6px;
}
.tgv2-grp-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #ecfccb;
    border: 1px solid #bef264;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.78rem;
    color: #4d7c0f;
    font-weight: 600;
}
.tgv2-grp-rm {
    background: none;
    border: none;
    cursor: pointer;
    color: #65a30d;
    font-size: 1rem;
    line-height: 1;
    padding: 0 2px;
    opacity: 0.6;
    transition: opacity 0.1s;
}
.tgv2-grp-rm:hover { opacity: 1; }

/* Tree inline IG label */
.tgv2-tree__grp-inline {
    font-size: 0.72rem;
    font-weight: 600;
    color: #1d4ed8;
    opacity: 0.85;
}

/* ============================================================
   Step 6: External Grouping
   ============================================================ */
/* Tabs */
.tgv2-extgrp-tabs {
    display: flex; gap: 0; margin: 10px 0 0;
    border-bottom: 2px solid #e5e7eb;
}
.tgv2-extgrp-tab {
    padding: 6px 16px; border: none; background: none; cursor: pointer;
    font-size: 0.82rem; font-weight: 600; color: #6b7280;
    border-bottom: 2px solid transparent; margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}
.tgv2-extgrp-tab.is-active { color: #4d7c0f; border-bottom-color: #4d7c0f; }
.tgv2-extgrp-tab:hover:not(.is-active) { color: #374151; }
.tgv2-extgrp-tabpane { padding-top: 12px; }

/* Filtered tab â€” collapsible grade accordion */
.tgv2-extgrp-body { display: flex; flex-direction: column; gap: 10px; }
.tgv2-extgrp-grade-acc { border: 1px solid #e5e7eb; border-radius: 10px; overflow: hidden; }
.tgv2-extgrp-grade-toggle {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; padding: 8px 14px; background: #f7fee7;
    border: none; border-bottom: 1px solid #d9f99d;
    font-size: 0.82rem; font-weight: 700; color: #4d7c0f;
    cursor: pointer; text-align: left; gap: 8px;
    text-transform: uppercase; letter-spacing: 0.07em;
}
.tgv2-extgrp-grade-toggle:hover { background: #ecfccb; }
.tgv2-extgrp-grade-toggle-lbl { flex: 1; display: flex; align-items: center; gap: 6px; }
.tgv2-extgrp-grade-content { background: #fff; }
/* Chevron shared by accordion toggle */
.tgv2-extgrp-chevron {
    width: 16px; height: 16px; flex-shrink: 0;
    transform: rotate(-90deg); transition: transform 0.2s;
}
.tgv2-extgrp-chevron.is-open { transform: rotate(0deg); }
/* Count badge inside grade accordion toggle (IG + EG) */
.tgv2-grp-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #65a30d;
    color: #fff;
    border-radius: 9px;
    font-size: 0.66rem;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
}

/* Cluster body inside filtered accordion */
.tgv2-extgrp-cluster-body { padding: 8px 14px 10px; background: #fff; }
.tgv2-extgrp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tgv2-extgrp-chip {
    display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
    padding: 4px 10px; border: 1.5px solid #d1d5db; border-radius: 8px;
    background: #fff; font-size: 0.8rem; font-weight: 500; color: #374151;
    transition: border-color 0.15s, background 0.15s, opacity 0.15s;
}
.tgv2-extgrp-chip input { display: none; }
.tgv2-extgrp-chip:has(input:checked) {
    border-color: #f59e0b; background: #fffbeb; color: #92400e; font-weight: 600;
}
.tgv2-extgrp-chip.is-grouped {
    border-color: #bef264; background: #f7fee7; color: #4d7c0f; cursor: default; opacity: 0.8;
}
/* Unfiltered tab: incompatible period count = disabled */
.tgv2-extgrp-chip.is-incompatible { opacity: 0.3; cursor: not-allowed; }

.tgv2-extgrp-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.tgv2-extgrp-tag-cls { font-style: italic; font-weight: 400; color: #6b7280; font-size: 0.75rem; }

/* Unfiltered tab */
.tgv2-extgrp-grade-sel { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tgv2-extgrp-grade-pill, .tgv2-extgrp-cls-pill {
    padding: 4px 13px; border: 1.5px solid #d1d5db; border-radius: 20px;
    background: #fff; font-size: 0.8rem; font-weight: 600; color: #374151;
    cursor: pointer; transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.tgv2-extgrp-grade-pill.is-active, .tgv2-extgrp-cls-pill.is-active {
    border-color: #4d7c0f; background: #f7fee7; color: #4d7c0f;
}
.tgv2-extgrp-grade-pill:hover:not(.is-active), .tgv2-extgrp-cls-pill:hover:not(.is-active) {
    border-color: #9ca3af; background: #f9fafb;
}
.tgv2-extgrp-cls-sel { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tgv2-extgrp-unf-subj-panel { margin-top: 4px; }
.tgv2-extgrp-unf-hint { font-size: 0.76rem; color: #6b7280; margin-bottom: 8px; }
.tgv2-extgrp-unf-empty { font-size: 0.8rem; color: #9ca3af; margin: 8px 0; }
.tgv2-extgrp-periods {
    font-size: 0.7rem; font-style: normal; font-weight: 500;
    color: #9ca3af; margin-left: 2px;
}

/* ============================================================
   Step 5 teachers â€“ grade checkbox display
   ============================================================ */
.tgv2-tchr-grade-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.tgv2-tchr-grade-lbl { margin: 0; }
.tgv2-tchr-card__grades-inline {
    font-size: 0.75rem; color: #65a30d; font-weight: 600;
    white-space: nowrap; margin-right: 6px; flex-shrink: 0;
}

/* ============================================================
   Step 6: School Setup
   ============================================================ */
.tgv2-sch-hint { font-size: 0.75rem; color: #9ca3af; font-weight: 400; }
.tgv2-sch-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tgv2-sch-chip {
    padding: 5px 14px; border: 1.5px solid #d1d5db; border-radius: 8px;
    background: #fff; font-size: 0.82rem; font-weight: 600; color: #374151;
    cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.tgv2-sch-chip.is-active { border-color: #65a30d; background: #f7fee7; color: #4d7c0f; }
.tgv2-sch-chip:hover:not(.is-active) { border-color: #9ca3af; }
.tgv2-sch-segments { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.tgv2-sch-seg-row {
    display: flex; align-items: center; gap: 10px;
    background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; padding: 8px 12px;
}
.tgv2-sch-seg-lbl { flex: 1; font-size: 0.82rem; color: #374151; }
.tgv2-sch-seg-inp {
    width: 64px; padding: 4px 8px; border: 1.5px solid #d1d5db; border-radius: 6px;
    font-size: 0.85rem; font-weight: 600; text-align: center;
}
.tgv2-sch-seg-inp:focus { outline: none; border-color: #65a30d; }
.tgv2-sch-break-row {
    display: flex; align-items: center; gap: 8px; padding: 6px 12px;
    background: #fffbeb; border: 1px dashed #fcd34d; border-radius: 8px;
    font-size: 0.8rem; color: #92400e; font-weight: 600;
}
.tgv2-sch-break-ico { font-size: 1rem; }
/* Right panel â€” school setup */
.tgv2-sch-right-panel { padding: 14px; }
.tgv2-sch-summary {
    border-radius: 10px; padding: 14px;
    display: flex; flex-direction: column; gap: 10px;
    border: 1.5px solid #bef264; background: #f7fee7;
}
.tgv2-sch-summary--under { border-color: #fca5a5; background: #fef2f2; }
.tgv2-sch-summary__row { display: flex; justify-content: space-between; align-items: center; font-size: 0.82rem; }
.tgv2-sch-summary__lbl { color: #374151; display: flex; align-items: center; gap: 6px; }
.tgv2-sch-summary__val { font-size: 1.1rem; font-weight: 700; color: #4d7c0f; }
.tgv2-sch-summary--under .tgv2-sch-summary__val { color: #dc2626; }
.tgv2-sch-tip-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; border-radius: 50%; border: 1px solid #9ca3af;
    background: #fff; color: #6b7280; font-size: 0.65rem; cursor: pointer; line-height: 1;
}
.tgv2-sch-tip-box {
    background: #1f2937; color: #f9fafb; border-radius: 8px; padding: 8px 10px;
    font-size: 0.76rem; line-height: 1.5;
}
.tgv2-sch-summary__warn { font-size: 0.76rem; color: #65a30d; font-weight: 600; margin: 0; }
.tgv2-sch-summary__deficit {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    font-size: 0.76rem;
    color: #991b1b;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 7px;
    padding: 8px 10px;
    margin: 6px 0 0;
    font-weight: 500;
    line-height: 1.45;
}
.tgv2-sch-summary__deficit-icon {
    font-size: 0.95rem;
    flex-shrink: 0;
    margin-top: 1px;
    color: #dc2626;
}
.tgv2-sch-summary__surplus {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    font-size: 0.76rem;
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 7px;
    padding: 8px 10px;
    margin: 6px 0 0;
    font-weight: 500;
    line-height: 1.45;
}
.tgv2-sch-summary__surplus-icon {
    font-size: 0.95rem;
    flex-shrink: 0;
    margin-top: 1px;
    color: #d97706;
}
/* Surplus confirm dialog */
.tgv2-surplus-overlay {
    position: fixed; inset: 0; z-index: 99999;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    animation: tgv2-fchk-fade-in 0.18s ease;
}
.tgv2-surplus-dialog {
    background: #fff; border-radius: 16px;
    width: 100%; max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    padding: 28px 28px 24px;
    display: flex; flex-direction: column; align-items: center; text-align: center;
    animation: tgv2-fchk-fade-in 0.18s ease;
}
.tgv2-surplus-icon {
    width: 56px; height: 56px;
    background: #fffbeb; border: 2px solid #fcd34d; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem; color: #d97706; margin-bottom: 14px; flex-shrink: 0;
}
.tgv2-surplus-title {
    font-size: 1rem; font-weight: 700; color: #111827; margin: 0 0 10px;
}
.tgv2-surplus-msg {
    font-size: 0.85rem; color: #4b5563; line-height: 1.55; margin: 0 0 22px;
}
.tgv2-surplus-actions {
    display: flex; gap: 10px; justify-content: center; width: 100%; flex-wrap: wrap;
}

/* ============================================================
   Class removal — scope + confirm modals
   ============================================================ */
.tgv2-cls-rm-overlay {
    position: fixed; inset: 0; z-index: 99999;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    opacity: 0; transition: opacity 0.18s ease;
}
.tgv2-cls-rm-overlay.is-visible { opacity: 1; }
.tgv2-cls-rm-dialog {
    background: #fff; border-radius: 16px;
    width: 100%; max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    padding: 26px 24px 22px;
    display: flex; flex-direction: column; align-items: center; text-align: center;
    transform: scale(0.96); transition: transform 0.18s ease;
}
.tgv2-cls-rm-overlay.is-visible .tgv2-cls-rm-dialog { transform: scale(1); }
.tgv2-cls-rm-icon {
    width: 52px; height: 52px;
    background: #f0fdf4; border: 2px solid #86efac; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.35rem; margin-bottom: 14px; flex-shrink: 0;
}
.tgv2-cls-rm-icon--warn {
    background: #fef2f2; border-color: #fca5a5;
}
.tgv2-cls-rm-title {
    font-size: 1rem; font-weight: 700; color: #111827; margin: 0 0 9px;
}
.tgv2-cls-rm-msg {
    font-size: 0.84rem; color: #4b5563; line-height: 1.5; margin: 0 0 12px; width: 100%;
}
.tgv2-cls-rm-grades {
    width: 100%; text-align: left;
    background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px;
    padding: 10px 13px; margin-bottom: 18px;
}
.tgv2-cls-rm-grade-label {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.85rem; color: #374151; padding: 3px 0; cursor: pointer;
}
.tgv2-cls-rm-all-label {
    border-bottom: 1px solid #e5e7eb; padding-bottom: 8px; margin-bottom: 5px;
}
.tgv2-cls-rm-list {
    width: 100%; text-align: left; font-size: 0.83rem; color: #374151;
    line-height: 1.7; margin: 0 0 12px; padding-left: 18px;
}
.tgv2-cls-rm-actions {
    display: flex; gap: 10px; justify-content: center; width: 100%; flex-wrap: wrap;
}

/* ============================================================
   Step 7: Subject Assignment
   ============================================================ */
.tgv2-asgn-grades { display: flex; flex-direction: column; gap: 10px; }
.tgv2-asgn-grade-card { border: 1px solid #e5e7eb; border-radius: 10px; overflow: hidden; }
.tgv2-asgn-grade-hdr {
    display: flex; align-items: center; gap: 7px; width: 100%;
    padding: 8px 14px; background: #f7fee7; border-bottom: 1px solid #d9f99d;
    font-size: 0.85rem; font-weight: 700; color: #4d7c0f;
    cursor: pointer; border: none; text-align: left;
}
.tgv2-asgn-grade-hdr:hover { background: #ecfccb; }
.tgv2-asgn-chevron {
    width: 16px; height: 16px; margin-left: auto; flex-shrink: 0;
    transition: transform 0.18s ease; transform: rotate(-90deg);
}
.tgv2-asgn-chevron.is-open { transform: rotate(0deg); }
.tgv2-asgn-grade-body { padding: 0; }
.tgv2-asgn-class-section { border-bottom: 1px solid #f3f4f6; }
.tgv2-asgn-class-section:last-child { border-bottom: none; }
.tgv2-asgn-class-hdr {
    padding: 6px 14px; font-size: 0.72rem; font-weight: 700; color: #6b7280;
    text-transform: uppercase; letter-spacing: 0.05em; background: #fafafa;
}
.tgv2-asgn-subj-row {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 14px; border-top: 1px solid #f3f4f6;
}
.tgv2-asgn-subj-name { flex: 1; font-size: 0.82rem; color: #374151; min-width: 0; }
.tgv2-asgn-ppc { font-size: 0.75rem; color: #9ca3af; white-space: nowrap; }
.tgv2-asgn-select {
    font-size: 0.78rem; padding: 4px 6px; border: 1.5px solid #d1d5db; border-radius: 6px;
    color: #374151; background: #fff; min-width: 140px; max-width: 180px;
}
.tgv2-asgn-select:focus { outline: none; border-color: #65a30d; }
.tgv2-asgn-select.is-assigned {
    border-color: #65a30d; background: #f7fee7; color: #4d7c0f; font-weight: 600;
}
.tgv2-asgn-no-tchr { font-size: 0.74rem; color: #f59e0b; font-style: italic; }
/* Right panel â€” assignment */
.tgv2-asgn-right-panel { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.tgv2-asgn-cycle-note { font-size: 0.78rem; color: #6b7280; margin: 0; }
.tgv2-asgn-tchr-list { display: flex; flex-direction: column; gap: 10px; }
.tgv2-asgn-tchr-row { display: flex; flex-direction: column; gap: 3px; }
.tgv2-asgn-tchr-row--over .tgv2-asgn-tchr-bar { background: #ef4444; }
.tgv2-asgn-tchr-name { font-size: 0.8rem; font-weight: 600; color: #374151; }
.tgv2-asgn-tchr-bar-wrap { height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; }
.tgv2-asgn-tchr-bar { height: 100%; background: #65a30d; border-radius: 3px; transition: width 0.3s; }
.tgv2-asgn-tchr-counts { display: flex; gap: 10px; font-size: 0.72rem; }
.tgv2-asgn-tchr-free { color: #9ca3af; }

/* ============================================================
   Step 9 â€“ Assignment table (spreadsheet layout)
   ============================================================ */
.tgv2-asgn-grade-section { border: 1px solid #e5e7eb; border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
.tgv2-asgn-group-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.tgv2-asgn-group-label { font-size: 0.78rem; color: #6b7280; font-weight: 600; }
.tgv2-asgn-group-btn {
    padding: 3px 12px; border-radius: 12px; border: 1.5px solid #e5e7eb;
    background: #fff; font-size: 0.78rem; font-weight: 600; color: #6b7280; cursor: pointer;
}
.tgv2-asgn-group-btn.is-active { background: #4d7c0f; border-color: #4d7c0f; color: #fff; }
.tgv2-asgn-group-btn:hover:not(.is-active) { background: #f7fee7; border-color: #d9f99d; color: #4d7c0f; }
.tgv2-asgn-grade-toggle {
    display: flex; align-items: center; gap: 8px; width: 100%;
    padding: 8px 12px; background: #f7fee7; border: none; border-bottom: 1px solid #d9f99d;
    font-size: 0.85rem; font-weight: 700; color: #4d7c0f; cursor: pointer; text-align: left;
}
.tgv2-asgn-grade-toggle:hover { background: #ecfccb; }
.tgv2-asgn-edit-row { display: flex; justify-content: flex-end; padding: 6px 10px; border-bottom: 1px solid #f3f4f6; background: #fafafa; }
.tgv2-asgn-edit-btn {
    padding: 4px 10px; background: #fff; border: 1.5px solid #d1d5db; border-radius: 6px;
    font-size: 0.75rem; font-weight: 600; color: #374151; cursor: pointer; white-space: nowrap;
}
.tgv2-asgn-edit-btn:hover { background: #f7fee7; border-color: #d9f99d; color: #4d7c0f; }
.tgv2-asgn-chevron { width: 16px; height: 16px; margin-left: auto; flex-shrink: 0; transform: rotate(-90deg); transition: transform 0.2s; }
.tgv2-asgn-chevron.is-open { transform: rotate(0deg); }
.tgv2-asgn-grade-body { padding: 0; }
.tgv2-asgn-table-wrap { overflow-x: auto; }
.tgv2-asgn-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.tgv2-asgn-th {
    padding: 6px 10px; background: #f9fafb; border-bottom: 1.5px solid #e5e7eb;
    font-size: 0.72rem; font-weight: 700; color: #6b7280;
    text-transform: uppercase; letter-spacing: 0.04em; text-align: left; white-space: nowrap;
}
.tgv2-asgn-th--wide { min-width: 140px; }
.tgv2-asgn-tr { border-bottom: 1px solid #f3f4f6; }
.tgv2-asgn-tr:last-child { border-bottom: none; }
.tgv2-asgn-tr { background: #fff; }
.tgv2-asgn-tr--assigned { background: #f0fdf4; }
.tgv2-asgn-tr--ig .tgv2-asgn-td--subj { font-weight: 600; }
.tgv2-asgn-td { padding: 7px 10px; vertical-align: middle; }
.tgv2-asgn-td--subj { color: #111827; font-weight: 500; }
.tgv2-asgn-td--cls { color: #6b7280; white-space: nowrap; }
.tgv2-asgn-td--badges { white-space: nowrap; }
.tgv2-asgn-td--ppc { color: #9ca3af; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tgv2-asgn-td--teacher { min-width: 140px; }

/* IG / EG badge pills */
.tgv2-asgn-badge {
    display: inline-block; padding: 1px 6px; border-radius: 4px;
    font-size: 0.65rem; font-weight: 800; letter-spacing: 0.04em; vertical-align: middle;
    cursor: help;
}
.tgv2-asgn-badge--ig { background: #ecfccb; color: #4d7c0f; border: 1px solid #bef264; }
.tgv2-asgn-badge--eg { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; margin-left: 3px; }
.tgv2-asgn-badge--ig-eg {
    background: linear-gradient(90deg, #ecfccb 50%, #fef3c7 50%);
    color: #374151; border: 1px solid #bef264; margin-left: 3px;
    font-size: 0.62rem;
}
.tgv2-asgn-badge--conflict {
    background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5;
    margin-left: 3px; animation: tgv2-pulse-warn 2s ease-in-out infinite;
}
@keyframes tgv2-pulse-warn {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.55; }
}

/* Legend inline text in step description */
.tgv2-asgn-legend {
    display: inline-block; padding: 1px 5px; border-radius: 4px;
    font-size: 0.7rem; font-weight: 800; vertical-align: middle;
}
.tgv2-asgn-legend--ig { background: #ecfccb; color: #4d7c0f; border: 1px solid #bef264; }
.tgv2-asgn-legend--eg { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

/* Teacher dropdown */
.tgv2-asgn-select {
    width: 100%; font-size: 0.78rem; padding: 5px 6px;
    border: 1.5px solid #d1d5db; border-radius: 6px; color: #374151; background: #fff;
}
.tgv2-asgn-select:focus { outline: none; border-color: #65a30d; }
.tgv2-asgn-select.is-assigned {
    border-color: #65a30d; background: #f7fee7; color: #4d7c0f; font-weight: 600;
}
.tgv2-asgn-no-tchr { font-size: 0.74rem; color: #f59e0b; font-style: italic; }

/* ---- Edit subjects modal ---- */
.tgv2-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 9999;
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.tgv2-modal {
    background: #fff; border-radius: 12px; width: 100%; max-width: 560px;
    max-height: 80vh; display: flex; flex-direction: column; box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}
.tgv2-modal-hdr {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid #e5e7eb; flex-shrink: 0;
}
.tgv2-modal-title { font-size: 0.95rem; font-weight: 700; color: #111827; margin: 0; }
.tgv2-modal-close {
    width: 28px; height: 28px; border-radius: 6px; border: none; background: transparent;
    font-size: 1.2rem; color: #6b7280; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.tgv2-modal-close:hover { background: #f3f4f6; color: #111827; }
.tgv2-modal-body { flex: 1; overflow-y: auto; padding: 16px 20px; }
.tgv2-modal-footer {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 12px 20px; border-top: 1px solid #e5e7eb; flex-shrink: 0;
}
.tgv2-esubj-cls-section { margin-bottom: 16px; }
.tgv2-esubj-cls-hdr { font-size: 0.8rem; font-weight: 700; color: #374151; margin-bottom: 8px; }
.tgv2-esubj-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tgv2-esubj-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 6px 4px 10px; background: #f7fee7; border: 1.5px solid #d9f99d;
    border-radius: 20px; font-size: 0.78rem; font-weight: 600; color: #4d7c0f; transition: opacity 0.15s;
}
.tgv2-esubj-chip.is-removed { opacity: 0.5; text-decoration: line-through; background: #fef2f2; border-color: #fca5a5; color: #b91c1c; }
.tgv2-esubj-remove {
    width: 16px; height: 16px; border-radius: 50%; border: none; background: #ecfccb;
    color: #4d7c0f; font-size: 0.65rem; font-weight: 800; cursor: pointer;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.tgv2-esubj-remove:hover { background: #4d7c0f; color: #fff; }
.tgv2-esubj-chip.is-removed .tgv2-esubj-remove { background: #fecaca; color: #b91c1c; }
.tgv2-esubj-chip.is-removed .tgv2-esubj-remove:hover { background: #dc2626; color: #fff; }

/* Right panel â€“ assignment workload */
.tgv2-asgn-right-panel { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.tgv2-asgn-cycle-note { font-size: 0.78rem; color: #6b7280; margin: 0; }
.tgv2-asgn-tchr-list { display: flex; flex-direction: column; gap: 10px; }
.tgv2-asgn-tchr-row { display: flex; flex-direction: column; gap: 3px; }
.tgv2-asgn-tchr-row--over .tgv2-asgn-tchr-bar { background: #ef4444; }
.tgv2-asgn-tchr-name { font-size: 0.8rem; font-weight: 600; color: #374151; }
.tgv2-asgn-tchr-bar-wrap { height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; }
.tgv2-asgn-tchr-bar { height: 100%; background: #65a30d; border-radius: 3px; transition: width 0.3s; }
.tgv2-asgn-tchr-counts { display: flex; gap: 10px; font-size: 0.72rem; }
.tgv2-asgn-tchr-free { color: #9ca3af; }

/* "Proceed to Generate" button */
.tgv2-btn--success {
    background: #059669; color: #fff; border: none;
    padding: 10px 20px; border-radius: 8px; font-size: 0.88rem; font-weight: 700;
    cursor: pointer; transition: background 0.15s;
}
.tgv2-btn--success:hover { background: #047857; }

/* ============================================================
   Warning dialog (low free-periods alert)
   ============================================================ */
.tgv2-warn-overlay {
    position: fixed; inset: 0; z-index: 99999;
    background: rgba(0,0,0,0.45);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.tgv2-warn-dialog {
    background: #fff; border-radius: 14px; padding: 28px 24px 20px;
    max-width: 360px; width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    text-align: center;
}
.tgv2-warn-ico {
    font-size: 2rem; line-height: 1; color: #f59e0b;
}
.tgv2-warn-msg {
    font-size: 0.9rem; color: #374151; line-height: 1.55; margin: 0;
}
.tgv2-warn-sub {
    font-size: 0.82rem; color: #6b7280; line-height: 1.5; margin: 0;
}
.tgv2-warn-msg strong { color: #dc2626; }
.tgv2-warn-hint {
    font-size: 0.78rem; color: #6b7280; line-height: 1.5; margin: 0;
    background: #f3f4f6; border-radius: 6px; padding: 8px 10px; width: 100%; text-align: left;
}
.tgv2-warn-conflict-list {
    font-size: 0.82rem; color: #374151; line-height: 1.6; margin: 0;
    padding-left: 18px; text-align: left; width: 100%;
}
.tgv2-warn-conflict-list li { margin-bottom: 8px; }
.tgv2-warn-slots { font-size: 0.75rem; color: #dc2626; font-weight: 600; }
.tgv2-warn-dialog--wide { max-width: 480px; align-items: flex-start; text-align: left; }
.tgv2-warn-dialog--wide .tgv2-warn-ico { align-self: center; }
.tgv2-warn-actions {
    display: flex; gap: 10px; margin-top: 4px;
}

/* ============================================================
   Final Check Modal  (.tgv2-fchk-*)
   ============================================================ */
.tgv2-fchk-overlay {
    position: fixed; inset: 0; z-index: 99999;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 24px 16px;
    overflow-y: auto;
}
.tgv2-fchk-dialog {
    background: #fff; border-radius: 16px;
    width: 100%; max-width: 600px;
    height: 92vh;
    max-height: 760px;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    overflow: clip;
    flex-shrink: 0;
    animation: tgv2-fchk-fade-in 0.2s ease;
}
.tgv2-fchk-full {
    position: fixed; inset: 0; z-index: 100000;
    background: rgba(0,0,0,0.6);
    padding: 24px 16px;
    overflow-y: auto;
    display: flex; justify-content: center; align-items: flex-start;
}
.tgv2-fchk-full-card {
    width: 100%; max-width: 760px;
    background: #fff; border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
    padding: 18px 20px 20px;
}
.tgv2-fchk-full-hdr {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding-bottom: 10px; border-bottom: 1px solid #e5e7eb; margin-bottom: 12px;
}
.tgv2-fchk-full-title {
    font-size: 1rem; font-weight: 700; color: #111827;
}
.tgv2-fchk-full-close {
    border: none; background: #f3f4f6; color: #111827;
    font-size: 0.85rem; font-weight: 700; padding: 6px 10px;
    border-radius: 8px; cursor: pointer;
}
.tgv2-fchk-full-close:hover { background: #e5e7eb; }
@keyframes tgv2-fchk-fade-in {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
.tgv2-fchk-hdr {
    flex-shrink: 0;
    padding: 24px 24px 20px;
    display: flex; flex-direction: column; align-items: center;
    text-align: center; gap: 10px;
}
.tgv2-fchk-hdr--pass { background: linear-gradient(135deg, #a3e635, #65a30d); color: #fff; }
.tgv2-fchk-hdr--fail { background: linear-gradient(135deg, #dc2626, #b91c1c); color: #fff; }
.tgv2-fchk-hdr--warn { background: linear-gradient(135deg, #a8e000, #65a30d); color: #fff; }
.tgv2-fchk-hdr-ico   { font-size: 2.4rem; line-height: 1; }
.tgv2-fchk-hdr-title { font-size: 1.1rem; font-weight: 700; line-height: 1.3; }
.tgv2-fchk-hdr-sub   { font-size: 0.82rem; opacity: 0.88; line-height: 1.4; }

/* Animated checkmark (all-clear only) */
.tgv2-fchk-check {
    width: 56px; height: 56px;
    animation: tgv2-fchk-pop 0.45s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes tgv2-fchk-pop {
    0%   { transform: scale(0) rotate(-15deg); opacity: 0; }
    70%  { transform: scale(1.15) rotate(3deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}
.tgv2-fchk-tick {
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    animation: tgv2-fchk-draw 0.4s 0.3s ease forwards;
}
@keyframes tgv2-fchk-draw {
    to { stroke-dashoffset: 0; }
}

/* Body */
.tgv2-fchk-body {
    flex: 1 1 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 16px 20px;
    display: flex; flex-direction: column; gap: 12px;
}
.tgv2-fchk-scrollbox {
    max-height: 45vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #f9fafb;
    padding: 8px;
}
.tgv2-fchk-scrollbox .tgv2-fchk-section {
    margin: 8px 0;
}
.tgv2-fchk-all-ok {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 10px;
    color: #15803d; font-weight: 600; font-size: 0.9rem;
    padding: 13px 18px; margin: 0;
    text-align: center;
}

/* Sections */
.tgv2-fchk-section { border-radius: 8px; overflow: hidden; border: 1px solid; }
.tgv2-fchk-section--block { border-color: #fecaca; }
.tgv2-fchk-section--warn  { border-color: #d9f99d; }
.tgv2-fchk-section--note  { border-color: #bfdbfe; }

.tgv2-fchk-sec-hdr {
    display: flex; align-items: center; gap: 7px;
    padding: 7px 12px;
    font-size: 0.78rem; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase;
}
.tgv2-fchk-section--block .tgv2-fchk-sec-hdr { background: #fee2e2; color: #991b1b; }
.tgv2-fchk-section--warn  .tgv2-fchk-sec-hdr { background: #ecfccb; color: #4d7c0f; }
.tgv2-fchk-section--note  .tgv2-fchk-sec-hdr { background: #eff6ff; color: #1e40af; }
.tgv2-fchk-sec-ico { font-size: 1rem; }

/* Items */
.tgv2-fchk-list {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-direction: column;
}
.tgv2-fchk-item {
    display: flex; flex-direction: column; gap: 3px;
    padding: 10px 14px;
    border-top: 1px solid;
}
.tgv2-fchk-section--block .tgv2-fchk-item { border-color: #fecaca; background: #fff5f5; }
.tgv2-fchk-section--warn  .tgv2-fchk-item { border-color: #d9f99d; background: #fffbf5; }
.tgv2-fchk-section--note  .tgv2-fchk-item { border-color: #bfdbfe; background: #f8faff; }
.tgv2-fchk-item-title  { font-size: 0.85rem; font-weight: 600; color: #111827; line-height: 1.3; }
.tgv2-fchk-item-detail { font-size: 0.78rem; color: #4b5563; line-height: 1.45; }
.tgv2-fchk-item-fix    { font-size: 0.75rem; color: #6b7280; font-style: italic; line-height: 1.4; }

/* Actions */
.tgv2-fchk-actions {
    flex-shrink: 0;
    display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}
.tgv2-fchk-btn-go {
    padding: 9px 20px; font-size: 0.87rem; font-weight: 700;
    border-radius: 8px; border: none; cursor: pointer;
    background: #16a34a; color: #fff;
    transition: background 0.15s;
}
.tgv2-fchk-btn-go:hover { background: #15803d; }
.tgv2-fchk-btn-warn {
    padding: 9px 20px; font-size: 0.87rem; font-weight: 700;
    border-radius: 8px; border: none; cursor: pointer;
    background: #65a30d; color: #fff;
    transition: background 0.15s;
}
.tgv2-fchk-btn-warn:hover { background: #4d7c0f; }
.tgv2-fchk-btn-save {
    padding: 9px 20px; font-size: 0.87rem; font-weight: 700;
    border-radius: 8px; border: 2px solid #2563eb; cursor: pointer;
    background: #fff; color: #2563eb;
    transition: background 0.15s, color 0.15s;
}
.tgv2-fchk-btn-save:hover { background: #eff6ff; }
.tgv2-fchk-btn-save--done {
    border-color: #16a34a; color: #16a34a;
    background: #f0fdf4; cursor: default;
}
.tgv2-fchk-save-prompt {
    flex-basis: 100%; margin: 0 0 2px;
    font-size: 0.86rem; font-weight: 600; color: #374151; text-align: left;
}

/* Save-before-proceed card (all-clear pass state) */
.tgv2-fchk-sp-card {
    width: 100%;
    display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.tgv2-fchk-sp-question {
    margin: 0;
    font-size: 0.92rem; font-weight: 600; color: #1f2937;
    text-align: center; line-height: 1.4;
}
.tgv2-fchk-sp-btns {
    display: flex; flex-direction: column; gap: 8px; width: 100%;
}
.tgv2-fchk-sp-btn-save {
    width: 100%; padding: 12px 16px; border-radius: 10px;
    background: #65a30d; color: #fff; border: none;
    font-size: 0.9rem; font-weight: 700; cursor: pointer; letter-spacing: 0.01em;
    transition: background 0.15s, box-shadow 0.15s;
    box-shadow: 0 2px 8px rgba(101,163,13,0.25);
}
.tgv2-fchk-sp-btn-save:hover  { background: #4d7c0f; box-shadow: 0 3px 12px rgba(101,163,13,0.35); }
.tgv2-fchk-sp-btn-save:disabled { opacity: 0.65; cursor: default; box-shadow: none; }
.tgv2-fchk-sp-btn-skip {
    width: 100%; padding: 11px 16px; border-radius: 10px;
    background: #fff; color: #374151; border: 1.5px solid #d1d5db;
    font-size: 0.88rem; font-weight: 600; cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.tgv2-fchk-sp-btn-skip:hover { background: #f9fafb; border-color: #9ca3af; }
.tgv2-fchk-sp-cancel-link {
    background: none; border: none; color: #9ca3af;
    font-size: 0.78rem; cursor: pointer; padding: 2px 6px;
    text-decoration: underline; text-underline-offset: 2px;
    transition: color 0.15s;
}
.tgv2-fchk-sp-cancel-link:hover { color: #6b7280; }

/* ── All-clear pass state overrides ── */
.tgv2-fchk-overlay--pass {
    align-items: center;
}
.tgv2-fchk-dialog--pass {
    height: auto;
    max-height: none;
    max-width: 420px;
}
.tgv2-fchk-dialog--pass .tgv2-fchk-hdr {
    padding: 36px 32px 30px;
    gap: 14px;
}
.tgv2-fchk-dialog--pass .tgv2-fchk-check {
    width: 76px; height: 76px;
    filter: drop-shadow( 0 4px 16px rgba(0,0,0,0.2) );
}
.tgv2-fchk-dialog--pass .tgv2-fchk-hdr-title {
    font-size: 1.45rem;
    letter-spacing: -0.01em;
}
.tgv2-fchk-dialog--pass .tgv2-fchk-hdr-sub {
    font-size: 0.9rem; opacity: 0.9;
    max-width: 260px; line-height: 1.5;
}
.tgv2-fchk-dialog--pass .tgv2-fchk-body {
    flex: 0 0 auto;
    padding: 18px 24px 6px;
}
.tgv2-fchk-dialog--pass .tgv2-fchk-actions {
    justify-content: center;
    border-top: none;
    background: transparent;
    padding: 16px 24px 28px;
    gap: 12px;
}
.tgv2-fchk-dialog--pass .tgv2-fchk-btn-save,
.tgv2-fchk-dialog--pass .tgv2-fchk-btn-go {
    padding: 11px 24px;
    font-size: 0.9rem;
    border-radius: 10px;
}

/* ============================================================
   Visiting teacher tag (Step 7 card + Step 10 shared cards)
   ============================================================ */
.tgv2-tchr-visiting-tag {
    display: inline-block; padding: 1px 7px; border-radius: 20px;
    background: #ede9fe; color: #6d28d9; border: 1px solid #c4b5fd;
    font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em;
    flex-shrink: 0;
}
.tgv2-tchr-card--visiting { border-color: #c4b5fd; background: #faf5ff; }

/* ============================================================
   Step 10: Shared Subjects
   ============================================================ */
.tgv2-shared-form {
    background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 10px;
    padding: 14px 16px; display: flex; flex-direction: column; gap: 10px;
    margin-bottom: 16px;
}
.tgv2-shared-form__row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.tgv2-shared-form__actions {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding-top: 4px; border-top: 1px solid #e5e7eb; margin-top: 2px;
}
.tgv2-shared-info { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.tgv2-shared-info-chip {
    padding: 3px 10px; border-radius: 20px;
    background: #eff6ff; border: 1px solid #bfdbfe;
    font-size: 0.76rem; color: #1e40af;
}
.tgv2-shared-info-chip strong { color: #1d4ed8; }

.tgv2-shared-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.tgv2-shared-empty { font-size: 0.82rem; color: #9ca3af; margin: 0; }
.tgv2-shared-card {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 14px; border: 1px solid #ddd6fe; border-radius: 10px;
    background: #faf5ff;
}
.tgv2-shared-card__body {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1; min-width: 0;
}
.tgv2-shared-card__subject {
    font-weight: 700; font-size: 0.85rem; color: #374151;
}
.tgv2-shared-card__meta { font-size: 0.76rem; color: #6b7280; }
.tgv2-shared-card__visitor { display: flex; align-items: center; gap: 5px; font-size: 0.82rem; color: #374151; }
.tgv2-shared-card__arrow { color: #9ca3af; font-size: 1rem; }
.tgv2-shared-card__host { display: flex; align-items: center; gap: 5px; font-size: 0.82rem; color: #374151; }
.tgv2-shared-card__host-lbl { font-size: 0.72rem; color: #9ca3af; }
.tgv2-shared-card__link-note {
    font-size: 0.7rem; color: #7c3aed; font-style: italic; white-space: nowrap;
}

/* ============================================================
   Step top-bar: Save progress button
   ============================================================ */
.tgv2-step-save-btn { margin-left: auto; font-size: 0.76rem; white-space: nowrap; }
.tgv2-step-save-btn.is-saved { color: #4d7c0f; border-color: #4d7c0f; }
.tgv2-step-save-btn--locked { opacity: 0.45; cursor: not-allowed; }

/* Save button wrapper + speech bubble */
.tgv2-save-btn-wrap {
    position: relative;
    margin-left: auto;
    display: flex;
    align-items: center;
}
.tgv2-save-login-bubble {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: #1e293b;
    color: #f8fafc;
    font-size: 0.76rem;
    line-height: 1.45;
    padding: 7px 11px;
    border-radius: 8px;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.22);
    pointer-events: none;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.18s, transform 0.18s;
    z-index: 100;
}
.tgv2-save-login-bubble::before {
    content: '';
    position: absolute;
    bottom: 100%; right: 14px;
    border: 6px solid transparent;
    border-bottom-color: #1e293b;
}
.tgv2-save-login-bubble a {
    color: #86efac;
    text-decoration: underline;
    pointer-events: auto;
    cursor: pointer;
}
/* Show bubble on hover of the wrapper */
.tgv2-save-btn-wrap:hover .tgv2-save-login-bubble {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* ============================================================
   Welcome screen: draft / in-progress setup
   ============================================================ */
.tgv2-welcome__draft {
    width: 100%; max-width: 420px; margin: 0 auto;
    border: 2px solid #fde68a; border-radius: 12px; overflow: hidden; background: #fffbeb;
}
.tgv2-welcome__draft-hdr {
    background: #fef3c7; padding: 8px 14px; font-size: 0.78rem;
    font-weight: 700; color: #92400e; margin: 0; border-bottom: 1px solid #fde68a;
}
.tgv2-welcome__draft-row {
    display: flex; align-items: center; gap: 10px; justify-content: space-between;
    padding: 10px 14px; flex-wrap: wrap;
}
.tgv2-welcome__draft-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.tgv2-welcome__draft-name { font-weight: 700; font-size: 0.84rem; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tgv2-welcome__draft-meta { font-size: 0.72rem; color: #9ca3af; }
.tgv2-welcome__draft-btns { display: flex; gap: 6px; flex-shrink: 0; }

/* ============================================================
   Welcome screen: saved timetables list
   ============================================================ */
.tgv2-welcome__saved {
    width: 100%; max-width: 420px; margin: 0 auto;
    border: 1px solid #e5e7eb; border-radius: 12px; overflow: hidden;
}
.tgv2-welcome__saved-hdr {
    background: #f9fafb; padding: 9px 14px; font-size: 0.78rem;
    font-weight: 700; color: #374151; margin: 0; border-bottom: 1px solid #e5e7eb;
}
.tgv2-welcome__saved-row {
    display: flex; align-items: center; gap: 10px; justify-content: space-between;
    padding: 9px 14px; border-bottom: 1px solid #f3f4f6;
}
.tgv2-welcome__saved-row:last-child { border-bottom: none; }
.tgv2-welcome__saved-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.tgv2-welcome__saved-name { font-weight: 600; font-size: 0.84rem; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tgv2-welcome__saved-date { font-size: 0.72rem; color: #9ca3af; }
.tgv2-welcome__saved-delete { color: #9ca3af; padding: 2px 6px; }
.tgv2-welcome__saved-delete:hover { color: #ef4444; }
.tgv2-welcome__saved--guest .tgv2-welcome__saved-guest-note { font-size: 0.78rem; color: #6b7280; margin: 4px 0 0; }
.tgv2-welcome__saved--guest .tgv2-welcome__saved-guest-note a { color: #4f46e5; text-decoration: underline; }
.tgv2-welcome__login-hint { font-size: 0.8rem; color: #9ca3af; margin: 0; text-align: center; }
.tgv2-welcome__login-hint a { color: #4f46e5; text-decoration: underline; }

/* ============================================================
   Data View â€” full-screen overlay
   ============================================================ */
.tgv2-dataview-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.55);
    z-index: 99999; display: none; align-items: flex-start; justify-content: center;
    overflow-y: auto; padding: 24px 12px;
}
.tgv2-dataview-overlay.is-open { display: flex; }

.tgv2-dataview-modal {
    background: #fff; border-radius: 16px; width: 100%; max-width: 1060px;
    min-height: 400px; display: flex; flex-direction: column;
    box-shadow: 0 24px 60px rgba(0,0,0,0.22);
    overflow: hidden;
}

/* Header bar */
.tgv2-dataview-header {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
    gap: 10px; padding: 14px 20px; background: #f9fafb;
    border-bottom: 1.5px solid #e5e7eb; position: sticky; top: 0; z-index: 10;
}
.tgv2-dataview-header__left { display: flex; align-items: center; gap: 12px; }
.tgv2-dataview-header__right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tgv2-dataview-title { font-size: 1rem; font-weight: 700; color: #111827; margin: 0; }

.tgv2-dv-close {
    background: none; border: none; font-size: 1.5rem; line-height: 1;
    cursor: pointer; color: #6b7280; padding: 2px 6px; border-radius: 6px;
}
.tgv2-dv-close:hover { background: #f3f4f6; color: #111827; }

/* Toggle group (Teacher / Grade) */
.tgv2-dv-toggle-group {
    display: flex; border: 1.5px solid #e5e7eb; border-radius: 8px; overflow: hidden;
}
.tgv2-dv-toggle {
    background: #fff; border: none; border-right: 1px solid #e5e7eb;
    padding: 6px 14px; font-size: 0.8rem; font-weight: 600; cursor: pointer;
    color: #374151; transition: background 0.15s, color 0.15s;
}
.tgv2-dv-toggle:last-child { border-right: none; }
.tgv2-dv-toggle:hover { background: #f3f4f6; }
.tgv2-dv-toggle.is-active { background: #65a30d; color: #fff; }

/* Action group */
.tgv2-dv-action-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.tgv2-dv-check { font-size: 0.78rem; font-weight: 600; padding: 4px 10px; border-radius: 20px; }
.tgv2-dv-check--pass { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.tgv2-dv-check--fail { background: #f7fee7; color: #65a30d; border: 1px solid #d9f99d; }

.tgv2-dv-btn {
    border: none; border-radius: 8px; padding: 7px 14px;
    font-size: 0.8rem; font-weight: 700; cursor: pointer; transition: opacity 0.15s;
}
.tgv2-dv-btn:hover { opacity: 0.88; }
.tgv2-dv-btn--save { background: #65a30d; color: #fff; }
.tgv2-dv-btn--saved { background: #15803d; color: #fff; }
.tgv2-dv-btn--dl   { background: #374151; color: #fff; position: relative; }

.tgv2-dv-download-wrap { position: relative; }
.tgv2-dv-download-menu {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 20;
    background: #fff; border: 1.5px solid #e5e7eb; border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.13); min-width: 210px; overflow: hidden;
}
.tgv2-dv-dl-opt {
    display: block; width: 100%; background: none; border: none; border-bottom: 1px solid #f3f4f6;
    padding: 10px 16px; text-align: left; font-size: 0.82rem; color: #374151;
    cursor: pointer; transition: background 0.12s;
}
.tgv2-dv-dl-opt:last-child { border-bottom: none; }
.tgv2-dv-dl-opt:hover { background: #f9fafb; }
.tgv2-dv-dl-sep { border: none; border-top: 1px solid #e5e7eb; margin: 4px 0; }

/* Issues bar */
.tgv2-dv-issues-bar {
    padding: 9px 20px; background: #f7fee7; border-bottom: 1px solid #d9f99d;
    font-size: 0.79rem; color: #92400e; display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.tgv2-dv-issue-chip {
    background: #ecfccb; border: 1px solid #bef264; border-radius: 20px;
    padding: 2px 10px; font-size: 0.75rem; color: #4d7c0f;
}

/* Body */
.tgv2-dataview-body { padding: 20px; flex: 1; overflow-y: auto; }

/* ============================================================
   TIMETABLE VIEW SCREEN
   ============================================================ */

/* Overlay */
.tgv2-tt-overlay {
    display: none; position: fixed; inset: 0; z-index: 100001;
    background: #f1f5f9;
}
.tgv2-tt-overlay.is-open { display: flex; flex-direction: column; }

/* Modal fills the overlay */
.tgv2-tt-modal {
    display: flex; flex-direction: column;
    width: 100%; height: 100%;
}

/* ---- Topbar ---- */
.tgv2-tt-topbar {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
}

/* Nav row */
.tgv2-tt-tbar-nav {
    display: flex; align-items: center; gap: 14px;
    padding: 10px 18px; border-bottom: 1px solid #f1f5f9;
}
.tgv2-tt-nav-btn {
    background: none; border: 1px solid #d1d5db;
    border-radius: 8px; padding: 5px 14px;
    font-size: 0.82rem; font-weight: 600; color: #374151;
    cursor: pointer; white-space: nowrap;
    transition: background .15s, border-color .15s;
}
.tgv2-tt-nav-btn:hover { background: #f3f4f6; border-color: #9ca3af; }
.tgv2-tt-tbar-title {
    font-size: 0.95rem; font-weight: 700; color: #111827;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    max-width: 260px;
}
/* View toggle sits in the nav row; spacer pushes utils to the right */
.tgv2-tt-tbar-nav .tgv2-tt-view-toggle { flex-shrink: 0; }
.tgv2-tt-tbar-utils { margin-left: auto; }
.tgv2-tt-tbar-utils {
    display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.tgv2-tt-tbar-sep { width: 1px; height: 22px; background: #e5e7eb; }

/* Zoom */
.tgv2-tt-zoom {
    display: flex; align-items: center; gap: 1px;
    border: 1px solid #d1d5db; border-radius: 8px; overflow: hidden;
}
.tgv2-tt-zoom-btn {
    background: #f9fafb; border: none; padding: 4px 10px;
    font-size: 1rem; line-height: 1; cursor: pointer; color: #374151;
    transition: background .15s;
}
.tgv2-tt-zoom-btn:hover { background: #f3f4f6; }
.tgv2-tt-zoom-lbl {
    padding: 4px 8px; font-size: 0.78rem; font-weight: 600;
    color: #374151; min-width: 42px; text-align: center;
    border-left: 1px solid #e5e7eb; border-right: 1px solid #e5e7eb;
    background: #fff;
}

/* Util buttons (PDF / Excel / Report) */
.tgv2-tt-util-btn {
    padding: 5px 13px; border-radius: 8px; font-size: 0.79rem; font-weight: 600;
    border: 1px solid #d1d5db; cursor: pointer; transition: opacity .15s, background .15s;
}
.tgv2-tt-util-btn--pdf    { background: #4d7c0f; color: #fff; border-color: #3a5f0a; box-shadow: 0 1px 4px rgba(77,124,15,.35); }
.tgv2-tt-util-btn--pdf:hover { opacity: 1 !important; background: #3a5f0a; border-color: #2e4b08; }
.tgv2-tt-util-btn--excel  { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.tgv2-tt-util-btn--report { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.tgv2-tt-util-btn--debug  { background: #fdf4ff; color: #7e22ce; border-color: #e9d5ff; }
.tgv2-tt-util-btn:hover { opacity: .82; }
.tgv2-tt-util-btn--locked {
    opacity: 0.45;
    cursor: default;
    filter: grayscale(0.4);
}
.tgv2-tt-util-btn--locked::after {
    content: ' 🔒';
}

/* ---- Preview watermark (non-paid timetable view) ---- */
.tgv2-tt-preview-wm {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 8;
    overflow: hidden;
    container-type: inline-size;
}
.tgv2-tt-preview-wm::after {
    content: 'PREVIEW';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-35deg);
    font-size: clamp(1.2rem, 8cqw, 3rem);
    font-weight: 900;
    letter-spacing: 0.18em;
    color: rgba(185, 28, 28, 0.18);
    white-space: nowrap;
    pointer-events: none;
    text-transform: uppercase;
    user-select: none;
}

/* ---- Subscribe banner (non-paid timetable view) ---- */
.tgv2-tt-sub-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 16px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.82rem;
    color: #374151;
    flex-shrink: 0;
}
.tgv2-tt-sub-banner__body {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}
.tgv2-tt-sub-banner__btn {
    flex-shrink: 0;
    background: linear-gradient(135deg, #845ec2, #d65db1);
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 6px 16px;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.12s;
    white-space: nowrap;
}
.tgv2-tt-sub-banner__btn:hover { opacity: 0.88; transform: translateY(-1px); }

/* ---- Final check save button locked ---- */
.tgv2-fchk-btn-save--locked {
    opacity: 0.45;
    cursor: not-allowed;
    border-color: #d1d5db;
    color: #9ca3af;
}

/* Controls row */
.tgv2-tt-tbar-controls {
    display: flex; align-items: center; flex-wrap: wrap;
    gap: 6px; padding: 8px 18px;
}
.tgv2-tt-ctrl {
    display: flex; align-items: center; gap: 8px;
}
.tgv2-tt-ctrl-lbl {
    font-size: 0.72rem; font-weight: 700; letter-spacing: .04em;
    color: #6b7280; text-transform: uppercase; white-space: nowrap;
}
.tgv2-tt-ctrl-sep { width: 1px; height: 28px; background: #e5e7eb; margin: 0 4px; }

/* View toggle */
.tgv2-tt-view-toggle {
    display: flex; border: 1px solid #d1d5db; border-radius: 8px; overflow: hidden;
}
.tgv2-tt-view-btn {
    padding: 5px 16px; border: none; background: #f9fafb;
    font-size: 0.82rem; font-weight: 600; color: #374151;
    cursor: pointer; border-right: 1px solid #d1d5db;
    transition: background .15s, color .15s;
}
.tgv2-tt-view-btn:last-child { border-right: none; }
.tgv2-tt-view-btn:hover { background: #f3f4f6; }
.tgv2-tt-view-btn.is-active { background: #65a30d; color: #fff; }

/* Control buttons (Auto Fill / Reset / Colors) */
.tgv2-tt-ctrl-btns { display: flex; gap: 6px; }
.tgv2-tt-ctrl-btn {
    display: flex; align-items: center; gap: 5px;
    padding: 5px 13px; border-radius: 8px;
    font-size: 0.81rem; font-weight: 600;
    border: 1px solid #d1d5db; cursor: pointer;
    transition: background .15s, border-color .15s;
}
.tgv2-tt-ctrl-btn--fill     { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.tgv2-tt-ctrl-btn--fill:hover { background: #dcfce7; border-color: #86efac; }
.tgv2-tt-ctrl-btn--fill.is-loading {
    cursor: not-allowed; opacity: 0.8; pointer-events: none;
    background: #dcfce7; border-color: #86efac;
}
@keyframes tgv2-spin { to { transform: rotate(360deg); } }
.tgv2-af-spinner {
    display: inline-block; flex-shrink: 0;
    width: 11px; height: 11px;
    border: 2px solid #bbf7d0; border-top-color: #15803d;
    border-radius: 50%;
    animation: tgv2-spin 0.65s linear infinite;
}
.tgv2-tt-ctrl-btn--reset    { background: #f7fee7; color: #65a30d; border-color: #d9f99d; }
.tgv2-tt-ctrl-btn--reset:hover { background: #ecfccb; border-color: #bef264; }
.tgv2-tt-ctrl-btn--color    { background: #faf5ff; color: #7c3aed; border-color: #e9d5ff; }
.tgv2-tt-ctrl-btn--color:hover { background: #f3e8ff; border-color: #d8b4fe; }
.tgv2-tt-ctrl-btn--rm-color { background: #f9fafb; color: #6b7280; border-color: #d1d5db; }
.tgv2-tt-ctrl-btn--rm-color:hover { background: #f3f4f6; }
.tgv2-tt-ctrl-btn.is-active { background: #f7fee7; color: #4d7c0f; border: 2px solid #65a30d; }
.tgv2-tt-ctrl-btn.is-active:hover { background: #ecfccb; }

/* ---- Fill banner ---- */
.tgv2-tt-fill-banner {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 10px 18px;
    background: #f7fee7; border-bottom: 1px solid #d9f99d;
    font-size: 0.82rem; color: #92400e;
    flex-shrink: 0;
}
.tgv2-tt-fill-icon { font-size: 1rem; flex-shrink: 0; }
.tgv2-tt-fill-banner > span { flex: 1; min-width: 180px; }
.tgv2-tt-fill-btn {
    background: #65a30d; color: #fff; border: none;
    padding: 6px 16px; border-radius: 8px;
    font-size: 0.81rem; font-weight: 700; cursor: pointer;
    white-space: nowrap; flex-shrink: 0;
    transition: opacity .15s;
}
.tgv2-tt-fill-btn:hover { opacity: .85; }

/* ---- Global events toolbar button ---- */
.tgv2-tt-ctrl-btn--events {
    background: #f0fdf4; color: #65a30d; border-color: #d9f99d;
}
.tgv2-tt-ctrl-btn--events:hover { background: #ecfccb; }

/* ============================================================
   Timetable editor topbar — phone responsive
   ============================================================ */
@media (max-width: 640px) {

    /* Clip any overflow so nothing causes horizontal scroll */
    .tgv2-tt-topbar { overflow-x: hidden; }

    /* ---- Nav row: 3-row stacked layout ----
       Row 1 (order 0): [← Back] ........... [Teachers | Classes]
       Row 2 (order 3): [         Title          ]
       Row 3 (order 4): [↙  Preview / Download   ]
    */
    .tgv2-tt-tbar-nav {
        flex-wrap: wrap;
        gap: 6px;
        padding: 8px 10px;
    }
    /* ViewToggle pushed to right end of row 1 */
    .tgv2-tt-tbar-nav .tgv2-tt-view-toggle {
        margin-left: auto;
    }
    /* Title on its own centred row */
    .tgv2-tt-tbar-title {
        order: 3;
        width: 100%;
        max-width: unset;
        text-align: center;
        font-size: 0.85rem;
    }
    /* Utils (Download button) — own row, left-aligned to sit under the toggle */
    .tgv2-tt-tbar-utils {
        order: 4;
        width: 100%;
        margin-left: 0 !important;
        justify-content: flex-start;
    }
    .tgv2-tt-util-btn--pdf {
        font-size: 0.76rem;
        padding: 5px 16px;
        width: auto;
    }

    /* ---- Controls row: each section stacks vertically ---- */
    .tgv2-tt-tbar-controls {
        flex-direction: column;
        align-items: stretch;
        padding: 8px 10px;
        gap: 6px;
    }
    .tgv2-tt-ctrl {
        width: 100%;
        gap: 6px;
    }
    .tgv2-tt-ctrl-lbl {
        min-width: 88px;
        flex-shrink: 0;
    }
    .tgv2-tt-ctrl-btns {
        flex: 1;
        flex-wrap: wrap;
        gap: 4px;
    }
    .tgv2-tt-ctrl-sel {
        flex: 1;
        max-width: unset;
    }
    /* Hide vertical separators — not needed in stacked layout */
    .tgv2-tt-ctrl-sep { display: none; }

    /* ---- Section cards: fill body width so summary is always visible ---- */
    /* (fit-content + center-aligned would push the left edge off-screen)   */
    .tgv2-tt-sections { align-items: stretch; }
    .tgv2-tt-section  { width: 100%; min-width: unset; }
    /* Grid still scrolls horizontally inside the full-width card */
    .tgv2-tt-grid-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ====================================================
   GLOBAL EVENTS DIALOG
   ==================================================== */
.tgv2-tt-ev-dialog {
    position: fixed; inset: 0; z-index: 10001;
    background: rgba(15,23,42,.45);
    backdrop-filter: blur(3px);
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.tgv2-tt-ev-dialog[hidden] { display: none; }

.tgv2-tt-ev-dialog-box {
    background: #fff;
    border-radius: 18px;
    width: 500px; max-width: 100%; max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0,0,0,.28), 0 4px 16px rgba(0,0,0,.12);
    display: flex; flex-direction: column;
    animation: tgv2-dlg-in .18s ease;
}
@keyframes tgv2-dlg-in {
    from { opacity: 0; transform: translateY(10px) scale(.97); }
    to   { opacity: 1; transform: none; }
}

/* Header */
.tgv2-ev-dlg-hdr {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px 16px;
    border-bottom: 1px solid #f1f5f9;
    position: sticky; top: 0; background: #fff; z-index: 1;
    border-radius: 18px 18px 0 0;
}
.tgv2-ev-dlg-hdr-left {
    display: flex; align-items: center; gap: 12px;
}
.tgv2-ev-dlg-icon {
    width: 40px; height: 40px; border-radius: 10px;
    background: linear-gradient(135deg, #65a30d 0%, #14b8a6 100%);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0;
}
.tgv2-ev-dlg-title {
    font-size: 1rem; font-weight: 700; color: #0f172a; line-height: 1.2;
}
.tgv2-ev-dlg-sub {
    font-size: 0.74rem; color: #64748b; margin-top: 2px;
}
.tgv2-ev-dlg-close {
    width: 32px; height: 32px; border-radius: 8px;
    background: #f1f5f9; border: none; cursor: pointer;
    color: #64748b; font-size: 1.1rem; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s, color .15s;
}
.tgv2-ev-dlg-close:hover { background: #e2e8f0; color: #0f172a; }

/* Body */
.tgv2-ev-dlg-body {
    padding: 20px 22px;
    display: flex; flex-direction: column; gap: 0;
}
.tgv2-ev-dlg-section { padding: 0 0 18px; }
.tgv2-ev-dlg-section-lbl {
    font-size: 0.68rem; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: #94a3b8; margin-bottom: 10px;
}
.tgv2-ev-dlg-divider {
    height: 1px; background: #f1f5f9; margin-bottom: 18px;
}

/* Event list */
.tgv2-ev-list {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-direction: column; gap: 8px;
}
.tgv2-ev-item {
    display: flex; align-items: center; gap: 12px;
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px;
    padding: 10px 12px;
}
.tgv2-ev-item-icon {
    width: 32px; height: 32px; border-radius: 8px;
    background: #ecfccb; display: flex; align-items: center;
    justify-content: center; font-size: 0.9rem; flex-shrink: 0;
}
.tgv2-ev-item-info { flex: 1; min-width: 0; }
.tgv2-ev-item-name {
    font-size: 0.85rem; font-weight: 600; color: #0f172a;
    display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tgv2-ev-item-meta {
    font-size: 0.72rem; color: #64748b; display: block; margin-top: 2px;
}
.tgv2-ev-item-rm {
    width: 28px; height: 28px; border-radius: 6px; flex-shrink: 0;
    background: none; border: 1px solid #e2e8f0; cursor: pointer;
    color: #9ca3af; font-size: 0.8rem; display: flex;
    align-items: center; justify-content: center;
    transition: background .14s, color .14s, border-color .14s;
}
.tgv2-ev-item-rm:hover { background: #fee2e2; border-color: #fca5a5; color: #dc2626; }
.tgv2-ev-empty {
    font-size: 0.8rem; color: #94a3b8; font-style: italic;
    text-align: center; padding: 12px 0; margin: 0;
}

/* Add form */
.tgv2-ev-dlg-form {
    display: flex; flex-direction: column; gap: 12px;
}
.tgv2-ev-dlg-field { display: flex; flex-direction: column; gap: 5px; }
.tgv2-ev-dlg-row   { display: flex; gap: 12px; }
.tgv2-ev-dlg-row > .tgv2-ev-dlg-field { flex: 1; }
.tgv2-ev-dlg-lbl {
    font-size: 0.78rem; font-weight: 600; color: #374151;
}
.tgv2-ev-dlg-opt {
    font-weight: 400; color: #9ca3af;
}
.tgv2-ev-dlg-inp,
.tgv2-ev-dlg-sel {
    padding: 8px 12px;
    border: 1.5px solid #e2e8f0; border-radius: 9px;
    font-size: 0.84rem; background: #fff; color: #0f172a;
    transition: border-color .15s, box-shadow .15s;
    width: 100%; box-sizing: border-box;
}
.tgv2-ev-dlg-inp:focus,
.tgv2-ev-dlg-sel:focus {
    outline: none; border-color: #65a30d;
    box-shadow: 0 0 0 3px rgba(101,163,13,.14);
}
.tgv2-ev-dlg-inp-group {
    display: flex; align-items: center; gap: 0;
}
.tgv2-ev-dlg-inp-group .tgv2-ev-dlg-num {
    flex: 1; padding: 8px 12px;
    border: 1.5px solid #e2e8f0; border-right: none;
    border-radius: 9px 0 0 9px;
    font-size: 0.84rem; color: #0f172a;
    transition: border-color .15s, box-shadow .15s;
}
.tgv2-ev-dlg-inp-group .tgv2-ev-dlg-num:focus {
    outline: none; border-color: #65a30d;
    box-shadow: 0 0 0 3px rgba(101,163,13,.14);
}
.tgv2-ev-dlg-unit {
    padding: 8px 10px; background: #f1f5f9;
    border: 1.5px solid #e2e8f0; border-radius: 0 9px 9px 0;
    font-size: 0.78rem; color: #64748b; white-space: nowrap;
}
.tgv2-ev-dlg-add-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 20px; border-radius: 10px; border: none; cursor: pointer;
    background: linear-gradient(135deg, #65a30d 0%, #4d7c0f 100%);
    color: #fff; font-size: 0.87rem; font-weight: 700;
    letter-spacing: .01em;
    box-shadow: 0 2px 8px rgba(101,163,13,.35);
    transition: opacity .15s, box-shadow .15s;
}
.tgv2-ev-dlg-add-btn:hover { opacity: .88; box-shadow: 0 4px 14px rgba(101,163,13,.4); }

/* ====================================================
   SCHOOL SETUP â€” TIMES CARD
   ==================================================== */
.tgv2-sch-times-card {
    background: #f8fafc; border: 1px solid #e2e8f0;
    border-radius: 12px; padding: 14px 16px;
    margin-top: 18px;
}
.tgv2-sch-times-head {
    display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px;
}
.tgv2-sch-times-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; }
.tgv2-sch-times-title {
    font-size: 0.88rem; font-weight: 700; color: #0f172a;
}
.tgv2-sch-times-opt {
    font-size: 0.72rem; font-weight: 500; color: #9ca3af; margin-left: 4px;
}
.tgv2-sch-times-sub {
    font-size: 0.75rem; color: #64748b; margin-top: 2px;
}
.tgv2-sch-times-fields { display: flex; flex-direction: column; gap: 8px; }
.tgv2-sch-field-row {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.82rem;
}
.tgv2-sch-field-lbl {
    color: #374151; font-weight: 500; min-width: 130px; white-space: nowrap;
}
.tgv2-sch-time-inp, .tgv2-sch-sel {
    padding: 5px 8px; border: 1px solid #d1d5db;
    border-radius: 8px; font-size: 0.82rem;
}
.tgv2-sch-num-inp {
    width: 72px; padding: 5px 8px;
    border: 1px solid #d1d5db; border-radius: 8px; font-size: 0.82rem;
    text-align: center;
}
.tgv2-sch-unit { font-size: 0.75rem; color: #9ca3af; }
.tgv2-sch-ov-wrap { margin-top: 14px; }
.tgv2-sch-ov-toggle {
    display: flex; align-items: center; gap: 6px;
    background: none; border: none; cursor: pointer;
    font-size: 0.82rem; font-weight: 600; color: #475569;
    padding: 6px 0; width: 100%; text-align: left;
    transition: color 0.15s;
}
.tgv2-sch-ov-toggle:hover { color: #0f172a; }
.tgv2-sch-ov-chevron {
    width: 16px; height: 16px; flex-shrink: 0;
    transition: transform 0.2s; transform: rotate(-90deg);
}
.tgv2-sch-ov-chevron.is-open { transform: rotate(0deg); }
.tgv2-sch-ov-section { margin-top: 8px; }
.tgv2-sch-ov-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.tgv2-sch-ov-card {
    display: flex; align-items: center; gap: 10px;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;
    padding: 7px 12px; font-size: 0.78rem;
}
.tgv2-sch-ov-day { font-weight: 700; color: #0f172a; white-space: nowrap; }
.tgv2-sch-ov-detail { flex: 1; color: #64748b; }
.tgv2-sch-ov-rm {
    background: none; border: none; cursor: pointer;
    color: #9ca3af; font-size: 1rem; padding: 0 2px; line-height: 1;
}
.tgv2-sch-ov-rm:hover { color: #dc2626; }
.tgv2-sch-ov-empty { font-size: 0.75rem; color: #9ca3af; font-style: italic; margin: 0 0 6px; }
.tgv2-sch-ov-form {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
    padding: 12px 14px; margin-top: 8px;
    display: flex; flex-direction: column; gap: 8px;
}
.tgv2-sch-ov-form-actions {
    display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px;
}

/* ====================================================
   DEV BUTTON
   ==================================================== */
.tgv2-dev-btn {
    display: none !important;
}
.tgv2-dev-row {
    display: none !important;
}

/* ---- Body / sections ---- */
.tgv2-tt-body {
    flex: 1; overflow-y: auto; padding: 20px; position: relative;
}
.tgv2-tt-sections {
    display: flex; flex-direction: column; gap: 28px;
    align-items: center;
}

/* ---- Section card ---- */
.tgv2-tt-section {
    background: #fff; border: 1px solid #e2e8f0;
    border-radius: 14px; overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    margin-bottom: 0;
    width: fit-content; min-width: 360px;
}
.tgv2-tt-section--free {
    border-color: #bfdbfe; background: #eff6ff;
}
.tgv2-tt-section--free .tgv2-tt-sec-hdr {
    background: #dbeafe; border-bottom-color: #bfdbfe;
}
.tgv2-tt-section--free .tgv2-tt-sum-hdr {
    background: #bfdbfe; color: #1d4ed8;
}

/* Section header */
.tgv2-tt-sec-hdr {
    display: flex; justify-content: center; align-items: center;
    padding: 14px 20px; background: #f8fafc;
    border-bottom: 1px solid #e2e8f0; text-align: center;
}
.tgv2-tt-sec-name {
    font-size: 1.5rem; font-weight: 700; color: #0f172a; text-align: center;
}
.tgv2-tt-sec-sub {
    font-size: 0.78rem; color: #64748b;
}

/* Section body: grid full width, summary below */
.tgv2-tt-sec-body {
    display: flex; flex-direction: column;
}
.tgv2-tt-grid-wrap {
    flex: 1; min-width: 0; overflow-x: auto;
}

/* ---- Timetable table (mirrors old-flow aesthetics, teal accent) ---- */
.tgv2-tt-scroll {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 10px rgba(0,0,0,.07);
    scrollbar-width: none; -ms-overflow-style: none;
}
.tgv2-tt-scroll::-webkit-scrollbar { display: none; }

.tgv2-tt-tbl {
    border-collapse: collapse;
    font-size: 0.83rem;
    background: #fff;
    min-width: 500px;
}
.tgv2-tt-col-day    { width: 52px; min-width: 52px; }
.tgv2-tt-col-period { min-width: 100px; }
.tgv2-tt-col-break  { width: 52px; }
.tgv2-tt-col-event  { min-width: 80px; }
.tgv2-tt-col-cap    { width: 32px; min-width: 32px; }

.tgv2-tt-th-cap {
    background: #D1D5DB;
    border-bottom: 2px solid #9ca3af !important;
    padding: 0 !important;
    width: 32px; min-width: 32px;
    position: relative; overflow: visible;
}
.tgv2-th-tick--cap-end { left: 0; transform: translateX(-50%); }
.tgv2-tt-td-cap {
    background: #D1D5DB;
    border-left: none;
    padding: 0;
    width: 32px;
}

.tgv2-tt-tbl thead th {
    background: #EBEBED;
    color: #1d1d1f;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 7px 10px 20px;
    text-align: center;
    border-bottom: 2px solid #d1d1d6;
    white-space: nowrap;
    position: relative;
}
.tgv2-tt-th-day {
    background: #f5f5f7;
    color: #1d1d1f;
    width: 52px;
    text-align: center;
    padding: 7px 6px 20px;
}
.tgv2-tt-th-period {
    text-transform: none !important;
    letter-spacing: 0 !important;
    min-width: 100px;
}
.tgv2-tt-th-break {
    background: #DCDCDC;
    color: #555;
    text-align: center !important;
    width: 52px;
    font-size: 0.55rem !important;
    border-bottom: 2px solid #b0b0b8 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    padding: 7px 4px 20px !important;
}
.tgv2-tt-th-event {
    background: #DCDCDC;
    color: #555;
    text-transform: none !important;
    min-width: 80px;
    padding: 7px 8px 20px;
    border-bottom: 2px solid #b0b0b8 !important;
    font-size: 0.68rem !important;
}
.tgv2-th-ev-lbl { display: block; font-size: 0.72rem; }

/* Time ticks in headers */
.tgv2-th-tick {
    display: block;
    position: absolute;
    bottom: 3px;
    left: 0;
    transform: translateX(-50%);
    font-size: 0.62rem;
    font-weight: 500;
    color: #6b7280;
    letter-spacing: 0;
    text-transform: none;
    line-height: 1;
    white-space: nowrap;
    z-index: 2;
}
.tgv2-th-tick--end { left: auto; right: 0; transform: translateX(50%); }
.tgv2-th-pnum { display: block; }

/* Body rows */
.tgv2-tt-tbl tbody tr { height: 44px; }
.tgv2-tt-tbl tbody tr:last-child td { border-bottom: none; }

/* Day stub */
.tgv2-tt-td-day {
    font-weight: 700;
    font-size: 0.72rem;
    color: #1d1d1f;
    white-space: nowrap;
    padding: 4px 6px;
    border-bottom: 1.5px solid #c8c8cc;
    background: #f5f5f7;
    text-align: center;
    vertical-align: middle;
}
/* Break data cell */
.tgv2-tt-td-break {
    background: #DCDCDC;
    border-bottom: 1px solid #aeaeb2;
    border-left: 1px solid #aeaeb2;
    padding: 6px 2px;
    vertical-align: top;
}
/* Event data cell */
.tgv2-tt-td-event {
    background: #DCDCDC;
    border-bottom: 1px solid #aeaeb2;
    border-left: 1px solid #aeaeb2;
    padding: 6px 4px;
    vertical-align: top;
}
/* Empty period cell */
.tgv2-tt-td-empty {
    padding: 4px 6px;
    border-bottom: 1.5px solid #c8c8cc;
    border-left: 1.5px solid #c8c8cc;
    min-width: 100px;
    vertical-align: top;
    background: #fff;
    cursor: default;
    position: relative;
}
.tgv2-tt-td-empty:hover { background: #fff; }
.tgv2-tt-plus {
    display: block;
    text-align: center;
    color: #cbd5e1;
    font-size: 1.2rem;
    line-height: 2.2;
    pointer-events: none;
    transition: color .15s;
}
.tgv2-tt-td-empty:hover .tgv2-tt-plus { color: #65a30d; }

/* Clickable cells (teacher view only, before autofill) */
.tgv2-tt-td-clickable { cursor: pointer; }
.tgv2-tt-td-clickable:hover { background: #f7fee7; }
.tgv2-tt-td-clickable:hover .tgv2-tt-plus { color: #65a30d; }
.tgv2-tt-td-clickable:hover .tgv2-tt-free-lbl { color: #65a30d; }

/* Filled period cell â€” same border as empty, background set by inline style when colors active */
.tgv2-tt-td-filled {
    padding: 4px 6px;
    border-bottom: 1.5px solid #c8c8cc;
    border-left: 1.5px solid #c8c8cc;
    min-width: 100px;
    vertical-align: top;
    position: relative;
    background: transparent;
}
/* No colored accent borders â€” background color on the full cell (set via inline style) conveys type */

/* Inner cell â€” transparent, no box */
.tgv2-cell {
    display: flex; flex-direction: column; gap: 1px;
    font-size: 0.72rem; line-height: 1.3; position: relative;
    padding: 2px 20px 2px 0;
    background: transparent; border: none;
    min-height: 32px;
}
.tgv2-cell--own {}
.tgv2-cell--learner {}
.tgv2-cell--shared-in {}
.tgv2-cell--shared-out {}
.tgv2-cell--free {}
.tgv2-cell-top     { font-size: 0.64rem; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: .04em; }
.tgv2-cell-subject { font-size: 0.8rem; font-weight: 700; color: #0f172a; }
.tgv2-cell-meta    { font-size: 0.64rem; color: #64748b; }
.tgv2-cell-group   { font-size: 0.62rem; color: #65a30d; font-style: italic; }
.tgv2-cell-main    { font-size: 0.78rem; font-weight: 500; color: #475569; }

/* Shared-in cell: shrink "Admin Period" so both words fit on one line */
.tgv2-cell--shared-in .tgv2-cell-main { font-size: 0.6rem; white-space: nowrap; }

/* Receiving-teacher cell elements (shared-in redesign) */
.tgv2-cell-divider   { height: 1px; background: #374151; opacity: 0.35; margin: 6px 0 1px; }
.tgv2-cell-recv-lbl  { font-size: 0.58rem; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: .04em; }
.tgv2-cell-recv-val  { font-size: 0.65rem; font-weight: 600; color: #374151; }
.tgv2-cell-recv-meta { font-size: 0.63rem; color: #64748b; }

/* Learner timetable cell elements */
.tgv2-cell-lrn-subject { font-size: 0.8rem; font-weight: 700; color: #0f172a; }
.tgv2-cell-lrn-teacher { font-size: 0.66rem; color: #475569; }
/* EG (external group) on learner timetable */
.tgv2-cell-eg-name { font-size: 0.75rem; font-weight: 700; color: #0f172a; }
.tgv2-cell-eg-row  { display: flex; flex-direction: column; gap: 0; margin-top: 1px; }
.tgv2-cell-eg-subj { font-size: 0.7rem; font-weight: 600; color: #1e293b; }
.tgv2-cell-eg-tchr { font-size: 0.58rem; color: #64748b; font-style: italic; }

/* Free / Admin Period label in empty teacher cells (replaces "+") */
.tgv2-tt-free-lbl {
    display: block; text-align: center; color: #d1d5db;
    font-size: 0.6rem; font-style: italic; line-height: 1.3;
    padding: 6px 2px; pointer-events: none; transition: color .15s;
}
.tgv2-tt-td-clickable:hover .tgv2-tt-free-lbl { color: #65a30d; }

/* Teachers Off timetable: names in cells */
.tgv2-offtt-names { display: flex; flex-direction: column; gap: 1px; }
.tgv2-offtt-name  { font-size: 0.7rem; font-weight: 500; color: #374151; line-height: 1.3; }

/* Random color popup */
.tgv2-color-popup {
    position: absolute; inset: 0; z-index: 10010;
    background: rgba(0,0,0,.4);
    display: flex; align-items: center; justify-content: center;
    border-radius: 16px;
}
.tgv2-color-popup-box {
    background: #fff; border-radius: 14px; padding: 20px;
    width: 220px; display: flex; flex-direction: column; gap: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,.22);
}
.tgv2-color-popup-title {
    font-size: 0.82rem; font-weight: 700; color: #0f172a;
    text-align: center; padding-bottom: 8px; border-bottom: 1px solid #f1f5f9;
}
.tgv2-color-popup-btn {
    padding: 9px 14px; border-radius: 8px; border: 1.5px solid #e2e8f0;
    background: #f8fafc; font-size: 0.83rem; font-weight: 600;
    cursor: pointer; color: #0f172a; transition: background .12s, border-color .12s, color .12s;
}
.tgv2-color-popup-btn:hover { background: #f7fee7; border-color: #65a30d; color: #65a30d; }
.tgv2-color-popup-btn--both { background: #65a30d; color: #fff; border-color: #65a30d; }
.tgv2-color-popup-btn--both:hover { background: #4d7c0f; }
.tgv2-color-popup-cancel {
    background: none; border: none; cursor: pointer;
    font-size: 0.75rem; color: #94a3b8; text-align: center; padding: 4px;
}
.tgv2-color-popup-cancel:hover { color: #64748b; }

/* ===== CELL STYLE POPUP (click a filled cell) ===== */
.tgv2-cs-popup {
    position: fixed; z-index: 10010;
    width: 228px;
    background: #fff; border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 8px 32px rgba(0,0,0,.18), 0 2px 8px rgba(0,0,0,.08);
    padding: 12px 14px; display: flex; flex-direction: column; gap: 8px;
    overflow-y: auto; max-height: calc(100vh - 24px);
}
.tgv2-cs-header {
    display: flex; align-items: center; justify-content: space-between; gap: 6px;
    padding-bottom: 6px; border-bottom: 1px solid #f1f5f9;
}
.tgv2-cs-title {
    font-size: 0.74rem; font-weight: 700; color: #0f172a;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tgv2-cs-close {
    background: none; border: none; cursor: pointer;
    color: #94a3b8; font-size: 0.8rem; line-height: 1; padding: 2px 4px; flex-shrink: 0;
}
.tgv2-cs-close:hover { color: #475569; }
.tgv2-cs-section-lbl {
    font-size: 0.65rem; font-weight: 700; color: #64748b;
    text-transform: uppercase; letter-spacing: .05em; margin-top: 2px;
}
.tgv2-cs-swatches {
    display: flex; flex-wrap: wrap; gap: 5px;
}
.tgv2-cs-swatch {
    width: 20px; height: 20px; border-radius: 5px; cursor: pointer;
    transition: transform .1s, box-shadow .1s;
}
.tgv2-cs-swatch:hover { transform: scale(1.15); }
.tgv2-cs-swatch.is-sel { box-shadow: 0 0 0 2px #65a30d; }
.tgv2-cs-picker-row {
    display: flex; align-items: center; gap: 8px;
}
.tgv2-cs-picker-lbl { font-size: 0.68rem; color: #64748b; }
.tgv2-cs-color-wheel { width: 32px; height: 22px; border: none; padding: 0; cursor: pointer; border-radius: 4px; }
.tgv2-cs-font-grid {
    display: flex; flex-wrap: wrap; gap: 4px;
}
.tgv2-cs-font-card {
    display: flex; flex-direction: column; align-items: center; gap: 1px;
    padding: 4px 7px; border-radius: 6px; border: 1.5px solid #e2e8f0;
    background: #f8fafc; cursor: pointer; font-size: 0.65rem; color: #374151;
    transition: border-color .1s, background .1s;
}
.tgv2-cs-font-card:hover { border-color: #65a30d; background: #f7fee7; }
.tgv2-cs-font-card.is-sel { border-color: #65a30d; background: #ecfccb; color: #65a30d; }
.tgv2-cs-font-aa { font-size: 0.82rem; color: #0f172a; }
.tgv2-cs-split-lbl {
    font-size: 0.67rem; color: #64748b; display: flex; align-items: center; gap: 5px; cursor: pointer;
}
.tgv2-cs-actions {
    display: flex; gap: 6px; padding-top: 4px; border-top: 1px solid #f1f5f9; margin-top: 2px;
}
.tgv2-cs-apply-btn, .tgv2-cs-reset-btn {
    flex: 1; padding: 6px 0; border-radius: 7px; font-size: 0.75rem; font-weight: 600;
    cursor: pointer; border: 1.5px solid transparent; transition: background .12s;
}
.tgv2-cs-apply-btn { background: #65a30d; color: #fff; border-color: #65a30d; }
.tgv2-cs-apply-btn:hover { background: #4d7c0f; }
.tgv2-cs-reset-btn { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.tgv2-cs-reset-btn:hover { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }
/* Cursor hint on filled cells */
.tgv2-tt-td-filled { cursor: pointer; }
.tgv2-tt-td-filled:hover { filter: brightness(0.97); }

/* Group: name italic label in teacher cells for EG subjects */
.tgv2-cell-grp {
    font-size: 0.6rem; font-style: italic; color: #64748b; line-height: 1.2;
    display: block; margin-top: 1px;
}
/* Remove button â€” only visible on hover of the td */
.tgv2-cell-rm {
    position: absolute; top: 0; right: 0;
    width: 16px; height: 16px; border-radius: 3px;
    background: none; border: none; cursor: pointer;
    color: #cbd5e1; font-size: 0.68rem; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity .12s, background .12s, color .12s;
}
.tgv2-tt-td-filled:hover .tgv2-cell-rm { opacity: 1; }
.tgv2-cell-rm:hover { background: #fee2e2; color: #dc2626; opacity: 1; }

/* ===== CELL PICKER POPOVER â€” two-stage ===== */
.tgv2-cell-picker {
    position: absolute; z-index: 10002;
    width: 242px;
    background: #fff; border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 8px 32px rgba(0,0,0,.18), 0 2px 8px rgba(0,0,0,.08);
    overflow: hidden;
}

/* Stage-1 title */
.tgv2-picker-title {
    font-size: 0.65rem; font-weight: 700; letter-spacing: .07em;
    text-transform: uppercase; color: #94a3b8;
    padding: 8px 14px 6px;
    border-bottom: 1px solid #f1f5f9;
}

/* Category buttons */
.tgv2-picker-cat {
    display: flex; align-items: center; gap: 10px;
    width: 100%; text-align: left; padding: 10px 14px;
    background: none; border: none; border-bottom: 1px solid #f8fafc;
    cursor: pointer; transition: background .12s;
}
.tgv2-picker-cat:hover:not(:disabled) { background: #f8fafc; }
.tgv2-picker-cat:disabled { opacity: .38; cursor: default; }
.tgv2-picker-cat-icon { font-size: 1.15rem; flex-shrink: 0; line-height: 1; }
.tgv2-picker-cat-body { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.tgv2-picker-cat-lbl  { font-size: 0.83rem; font-weight: 600; color: #0f172a; }
.tgv2-picker-cat-sub  { font-size: 0.69rem; color: #64748b; }
.tgv2-picker-cat-arr  { font-size: 1.1rem; color: #cbd5e1; }
/* Accent colours on cat labels */
.tgv2-picker-cat--own .tgv2-picker-cat-lbl    { color: #059669; }
.tgv2-picker-cat--shared .tgv2-picker-cat-lbl { color: #3b82f6; }
.tgv2-picker-cat--free .tgv2-picker-cat-lbl   { color: #475569; }

/* Stage-2 back bar */
.tgv2-picker-back-bar {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px 6px 8px;
    border-bottom: 1px solid #f1f5f9;
    background: #f8fafc;
}
.tgv2-picker-back {
    background: none; border: none; cursor: pointer;
    font-size: 0.76rem; color: #64748b; padding: 2px 4px;
    border-radius: 4px; transition: background .1s, color .1s;
}
.tgv2-picker-back:hover { background: #e2e8f0; color: #0f172a; }
.tgv2-picker-back-title {
    font-size: 0.75rem; font-weight: 700; flex: 1;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tgv2-picker-back-title--own    { color: #059669; }
.tgv2-picker-back-title--shared { color: #3b82f6; }

/* Sub-list scrollable */
.tgv2-picker-sublist { max-height: 260px; overflow-y: auto; }
.tgv2-picker-sub-item {
    display: flex; flex-direction: row; align-items: center; gap: 6px;
    width: 100%; text-align: left; padding: 8px 14px;
    background: none; border: none; border-bottom: 1px solid #f8fafc;
    cursor: pointer; transition: background .12s;
}
.tgv2-picker-sub-item:hover { background: #f8fafc; }
.tgv2-picker-sub-name  { font-size: 0.82rem; font-weight: 600; color: #0f172a; flex: 1; }
.tgv2-picker-sub-meta  { font-size: 0.68rem; color: #64748b; }
.tgv2-picker-sub-badge {
    font-size: 0.66rem; font-weight: 700; color: #fff;
    background: #65a30d; border-radius: 10px;
    padding: 1px 6px; white-space: nowrap; flex-shrink: 0;
}
/* IG/EG inline badges inside cells */
.tgv2-cell-badge {
    display: inline-block;
    font-size: 0.54rem; font-weight: 800; letter-spacing: .05em;
    text-transform: uppercase; line-height: 1; border-radius: 3px;
    padding: 1px 4px; vertical-align: middle; margin-left: 3px;
}
.tgv2-cell-badge--ig { background: #dcfce7; color: #166534; }
.tgv2-cell-badge--eg { background: #fef9c3; color: #854d0e; }


.tgv2-picker-sub-grp {
    font-size: 0.63rem; font-weight: 600; border-radius: 4px;
    padding: 1px 5px; width: 100%; display: block; margin-top: 1px;
}
.tgv2-picker-sub-grp--ig { background: #dcfce7; color: #166534; }
.tgv2-picker-sub-grp--eg { background: #fef9c3; color: #854d0e; }
/* Make sub-item stack vertically for own/shared (name + meta row) */
.tgv2-picker-sub-item { flex-wrap: wrap; }
.tgv2-picker-sub-name  { width: 100%; }
.tgv2-picker-sub-meta  { flex: 1; }

/* Override time in cell */
.tgv2-td-ov {
    display: block;
    font-size: 0.62rem;
    color: #78716c;
    margin-bottom: 2px;
    line-height: 1;
}

/* ============================================================
   Autofill User Result Modal  (#tgv2-af-user-report)
   z-index 100002 — sits above the timetable view overlay (100001) and dev report (99999)
   ============================================================ */
#tgv2-af-user-report {
    position: fixed; inset: 0; z-index: 100002;
    display: flex; align-items: center; justify-content: center;
}
.tgv2-afur-backdrop {
    position: absolute; inset: 0; background: rgba(0,0,0,.45);
}
.tgv2-afur-dialog {
    position: relative; z-index: 1;
    width: 92vw; max-width: 720px;
    height: 88vh; max-height: 760px;
    background: #fff; border-radius: 16px;
    box-shadow: 0 20px 56px rgba(0,0,0,.24);
    display: flex; flex-direction: column; overflow: clip; flex-shrink: 0;
}
.tgv2-afur-hdr {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; background: #4d7c0f; color: #fff; flex-shrink: 0;
    border-bottom: 3px solid #65a30d;
}
.tgv2-afur-title { font-size: 1rem; font-weight: 700; letter-spacing: .01em; }
.tgv2-afur-close {
    background: rgba(255,255,255,.18); border: none; color: #fff;
    width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
    font-size: 0.85rem; line-height: 1; display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.tgv2-afur-close:hover { background: rgba(255,255,255,.32); }

.tgv2-afur-body {
    flex: 1 1 0; min-height: 0; overflow-y: auto;
    padding: 20px; display: flex; flex-direction: column; gap: 18px;
}
.tgv2-afur-summary {
    font-size: 0.84rem; color: #374151; margin: 0;
    padding: 12px 16px; background: #f7fee7;
    border: 1px solid #d9f99d; border-left: 4px solid #65a30d; border-radius: 8px;
}
.tgv2-afur-summary strong { color: #3f6212; }

.tgv2-afur-section { display: flex; flex-direction: column; gap: 10px; }
.tgv2-afur-section-title {
    font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
    color: #4d7c0f; border-bottom: 1px solid #d9f99d; padding-bottom: 5px;
}

/* Teacher block */
.tgv2-afur-teacher {
    padding: 12px 14px; border: 1px solid #d9f99d; border-radius: 10px;
    background: #f7fee7; display: flex; flex-direction: column; gap: 7px;
}
.tgv2-afur-teacher-hdr {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.tgv2-afur-teacher-name { font-size: 0.84rem; font-weight: 700; color: #111827; }

/* Load badge */
.tgv2-afur-load {
    font-size: 0.68rem; font-weight: 700; padding: 2px 9px; border-radius: 20px;
    white-space: nowrap; flex-shrink: 0;
}
.tgv2-afur-load--high { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.tgv2-afur-load--med  { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.tgv2-afur-load--ok   { background: #ecfdf5; color: #065f46; border: 1px solid #6ee7b7; }

/* Missing-period pills */
.tgv2-afur-pills { display: flex; flex-wrap: wrap; gap: 5px; }
.tgv2-afur-pill {
    font-size: 0.72rem; font-weight: 600; color: #374151;
    background: #fff; border: 1px solid #d1d5db; border-radius: 6px;
    padding: 2px 8px; display: inline-flex; align-items: center; gap: 3px;
}
.tgv2-afur-pill-cls { color: #6b7280; font-weight: 400; }

/* Cause list */
/* Phase breakdown strip */
.tgv2-afur-phases {
    display: flex; flex-direction: column; gap: 4px;
    margin: 0 0 12px;
}
.tgv2-afur-phase-row {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 12px; border-radius: 8px;
    font-size: 0.8rem; line-height: 1.3;
}
.tgv2-afur-phase--ok   { background: #f0fdf4; border: 1px solid #bbf7d0; }
.tgv2-afur-phase--fail { background: #fff7ed; border: 1px solid #fed7aa; }
.tgv2-afur-phase-ico   { font-size: 0.9rem; flex-shrink: 0; }
.tgv2-afur-phase--ok .tgv2-afur-phase-ico   { color: #16a34a; }
.tgv2-afur-phase--fail .tgv2-afur-phase-ico { color: #ea580c; }
.tgv2-afur-phase-name   { font-weight: 700; color: #111827; white-space: nowrap; }
.tgv2-afur-phase-detail { color: #374151; }

.tgv2-afur-causes {
    margin: 0; padding: 0 0 0 16px;
    font-size: 0.74rem; color: #6b7280;
    display: flex; flex-direction: column; gap: 2px;
}
.tgv2-afur-causes li { list-style: disc; }

/* Ungrouped other list */
.tgv2-afur-other-list {
    margin: 0; padding: 0 0 0 16px;
    font-size: 0.78rem; color: #374151;
}
.tgv2-afur-other-list li { margin-bottom: 3px; }

/* Tip section */
.tgv2-afur-section--tip {
    background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px;
    padding: 10px 14px;
}
.tgv2-afur-section--tip .tgv2-afur-section-title { border-color: #86efac; color: #166534; }
.tgv2-afur-section--tip p { font-size: 0.78rem; color: #166534; margin: 0; }

/* ============================================================
   Autofill Dev Report Modal  (#tgv2-af-report)
   ============================================================ */
#tgv2-af-report { position: fixed; inset: 0; z-index: 99999; display: flex; align-items: center; justify-content: center; }
.tgv2-af-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.tgv2-af-modal {
    position: relative; z-index: 1; width: 92vw; max-width: 1200px; max-height: 88vh;
    background: #fff; border-radius: 14px; box-shadow: 0 24px 64px rgba(0,0,0,.28);
    display: flex; flex-direction: column; overflow: hidden;
}
.tgv2-af-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px; background: #0f172a; color: #f8fafc; flex-shrink: 0;
}
.tgv2-af-title { font-size: 1rem; font-weight: 700; letter-spacing: .01em; }
.tgv2-af-header-btns { display: flex; gap: 8px; }
.tgv2-af-btn {
    padding: 6px 14px; font-size: 0.78rem; font-weight: 600; border-radius: 7px;
    border: none; cursor: pointer; background: #334155; color: #f1f5f9;
    transition: background .15s;
}
.tgv2-af-btn:hover { background: #475569; }
.tgv2-af-btn--close { background: #7f1d1d; color: #fee2e2; }
.tgv2-af-btn--close:hover { background: #991b1b; }

.tgv2-af-body { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 18px; }

.tgv2-af-unresolved {
    padding: 10px 14px; border-radius: 8px; font-size: 0.82rem;
    background: #fef3c7; border: 1px solid #fcd34d; color: #78350f;
}
.tgv2-af-unresolved ul { margin: 6px 0 0 16px; padding: 0; }
.tgv2-af-unresolved li { margin-bottom: 3px; }
.tgv2-af-unresolved--ok { background: #f0fdf4; border-color: #86efac; color: #166534; }

.tgv2-af-section-title {
    font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
    color: #64748b; border-bottom: 1px solid #e2e8f0; padding-bottom: 5px;
}

/* Teacher placement table */
.tgv2-af-table-wrap { overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 8px; }
.tgv2-af-table { border-collapse: collapse; font-size: 0.68rem; white-space: nowrap; width: 100%; }
.tgv2-af-table th {
    background: #f8fafc; color: #475569; font-weight: 700; padding: 5px 8px;
    border-bottom: 2px solid #e2e8f0; text-align: center; position: sticky; top: 0;
}
.tgv2-af-table td { padding: 4px 7px; border-bottom: 1px solid #f1f5f9; text-align: center; vertical-align: top; }
.tgv2-af-table tbody tr:hover td { background: #f8fafc; }
.tgv2-af-tname { text-align: left !important; font-weight: 600; color: #1e293b; white-space: nowrap; }
.tgv2-af-cell-empty { color: #cbd5e1; font-size: 0.65rem; }
.tgv2-af-cell-free  { display: inline-block; padding: 1px 5px; background: #e0f2fe; color: #0369a1; border-radius: 4px; font-size: 0.65rem; font-weight: 700; }
.tgv2-af-cell-si    { display: inline-block; padding: 1px 5px; background: #dcfce7; color: #166534; border-radius: 4px; font-size: 0.65rem; }
.tgv2-af-cell-so    { display: inline-block; padding: 1px 5px; background: #fef9c3; color: #854d0e; border-radius: 4px; font-size: 0.65rem; }
.tgv2-af-cell-own   { display: inline-block; font-size: 0.65rem; color: #1e293b; }
.tgv2-af-cell-own small { color: #64748b; }

/* Step log */
.tgv2-af-log-wrap { border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; }
.tgv2-af-log-table { border-collapse: collapse; width: 100%; font-size: 0.75rem; }
.tgv2-af-log-table td { padding: 5px 10px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.tgv2-af-log-ok   td { background: #fff; color: #1e293b; }
.tgv2-af-log-warn td { background: #fffbeb; color: #78350f; }
.tgv2-af-log-fail td { background: #fef2f2; color: #7f1d1d; }
.tgv2-af-log-icon  { width: 24px; text-align: center; font-weight: 700; }
.tgv2-af-log-phase { width: 220px; font-weight: 600; white-space: nowrap; }
.tgv2-af-log-msg   { }
.tgv2-af-log-detail {
    margin: 4px 0 0; padding: 5px 8px; background: rgba(0,0,0,.05);
    border-radius: 5px; font-size: 0.7rem; white-space: pre-wrap; word-break: break-word;
}

/* ---- Summary mini table (below grid) ---- */
.tgv2-tt-sum-bar {
    margin-top: 10px;
    border-top: 1px solid #e2e8f0;
    overflow-x: auto;
    background: #fff;
    display: flex;
    justify-content: center;
}
.tgv2-tt-sum-mini {
    border-collapse: collapse;
    font-size: 0.69rem;
    color: #111;
    width: auto;
}
.tgv2-tt-sum-mini thead th {
    background: #f5f5f5;
    color: #111;
    font-weight: 700;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 5px 16px;
    text-align: center;
    border-bottom: 1px solid #d1d5db;
    white-space: nowrap;
}
.tgv2-tt-sum-mini tbody td {
    padding: 5px 16px 8px;
    border-bottom: 1px solid #f1f5f9;
    color: #111;
    white-space: nowrap;
    text-align: center;
}
.tgv2-tt-sum-total td {
    border-top: 1.5px solid #d1d5db;
    border-bottom: 1px solid #f1f5f9;
    font-weight: 700;
    background: #f8fafc;
}
.tgv2-tt-sum-free td {
    border-bottom: none;
    color: #64748b;
    font-style: italic;
}
.tgv2-tt-sum-empty {
    font-size: 0.72rem; color: #9ca3af; font-style: italic;
    padding: 8px 12px; margin: 0;
}
.tgv2-dv-empty { color: #9ca3af; font-size: 0.85rem; font-style: italic; }

/* Teacher cards */
.tgv2-dv-teacher-list { display: flex; flex-direction: column; gap: 18px; }
.tgv2-dv-teacher-card {
    border: 1.5px solid #e5e7eb; border-radius: 12px; overflow: hidden;
}
.tgv2-dv-teacher-card--visiting { border-color: #c4b5fd; }
.tgv2-dv-teacher-card__hdr {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 10px 16px; background: #f9fafb; border-bottom: 1px solid #e5e7eb;
}
.tgv2-dv-teacher-name { font-weight: 700; font-size: 0.9rem; color: #111827; flex: 1; }
.tgv2-dv-teacher-meta { font-size: 0.76rem; color: #6b7280; }
.tgv2-dv-no-subjects { font-size: 0.8rem; color: #9ca3af; margin: 10px 16px; }

/* Grade cards */
.tgv2-dv-grade-list { display: flex; flex-direction: column; gap: 24px; }
.tgv2-dv-grade-block { border: 1.5px solid #e5e7eb; border-radius: 12px; overflow: hidden; }
.tgv2-dv-grade-hdr {
    padding: 10px 16px; background: #65a30d; color: #fff;
    font-weight: 700; font-size: 0.9rem;
}
.tgv2-dv-class-block { border-top: 1px solid #e5e7eb; }
.tgv2-dv-class-hdr { padding: 7px 16px; background: #f7fee7; font-size: 0.82rem; color: #134e4a; border-bottom: 1px solid #ecfccb; }

/* Shared table styles */
.tgv2-dv-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.tgv2-dv-table th {
    padding: 7px 12px; text-align: left; font-size: 0.75rem; font-weight: 700;
    background: #f9fafb; color: #6b7280; border-bottom: 1.5px solid #e5e7eb;
    white-space: nowrap;
}
.tgv2-dv-table td { padding: 7px 12px; border-bottom: 1px solid #f3f4f6; color: #374151; }
.tgv2-dv-table tr:last-child td { border-bottom: none; }
.tgv2-dv-table tr:hover td { background: #f9fafb; }
.tgv2-dv-periods { text-align: center; font-weight: 600; }
.tgv2-dv-group { white-space: nowrap; }
.tgv2-dv-posid { font-family: monospace; font-size: 0.78rem; color: #6b7280; }
.tgv2-dv-host  { font-size: 0.78rem; color: #6b7280; }

/* Section header row (Free Periods) */
.tgv2-dv-section-hdr td {
    background: #f7fee7; color: #4d7c0f; font-weight: 700; font-size: 0.76rem;
    padding: 5px 12px; border-top: 1.5px solid #ecfccb;
}
/* Free period rows */
.tgv2-dv-free-row td { background: #fafafa; }
.tgv2-dv-free-row--shared td { background: #faf5ff; }
.tgv2-dv-free-label { font-size: 0.8rem; color: #374151; }

/* Badges */
.tgv2-dv-badge {
    display: inline-block; padding: 1px 8px; border-radius: 20px;
    font-size: 0.7rem; font-weight: 700; background: #ecfccb; color: #4d7c0f; border: 1px solid #d9f99d;
    margin-right: 3px;
}
.tgv2-dv-badge--shared { background: #ede9fe; color: #6d28d9; border-color: #c4b5fd; }

/* teal button variant for Step 10 footer */
.tgv2-btn--teal {
    background: #65a30d; color: #fff; border: none; border-radius: 8px;
    padding: 8px 16px; font-size: 0.82rem; font-weight: 700; cursor: pointer;
    transition: opacity 0.15s;
}
.tgv2-btn--teal:hover { opacity: 0.88; }

/* ============================================================
   Responsive â€” small screens stack columns
   ============================================================ */
@media (max-width: 640px) {
    .tgv2-overlay.is-open { align-items: flex-end; padding: 0; }
    .tgv2-modal { border-radius: 18px 18px 0 0; max-height: 96vh; }
    .tgv2-modal:has(.tgv2-wizard) { height: 96vh; }
    .tgv2-modal.tgv2-modal--wide { width: 100vw !important; }
    .tgv2-wizard { flex-direction: column; overflow-y: auto; overflow-x: hidden; }
    .tgv2-wizard__left { flex: 0 0 auto; overflow-y: visible; border-right: none; border-bottom: 1px solid #f0f2f4; }
    /* On stacked (mobile) layout the left panel has no fixed height, so the flex scroller
       must revert to auto height; the outer wizard scroll handles vertical overflow. */
    .tgv2-wizard__left.has-step-top-bar { overflow: visible; }
    .tgv2-wizard__left.has-step-top-bar .tgv2-step-top-bar { position: sticky; top: 0; z-index: 25; }
    .tgv2-wizard__left.has-step-top-bar .tgv2-step-scroller { flex: 0 0 auto; overflow-y: visible; }
    .tgv2-wizard__right { flex: 0 0 180px; overflow-y: visible; border-radius: 0; }
    .tgv2-subj-matrix-wrap { border-radius: 8px; }
}


/* ============================================================
   FEATURE ADDITIONS â€” toolbar selects, structural, PDF dialog,
   event days, hide-times
   ============================================================ */

/* Toolbar select (Groups display + Show only filter) */
.tgv2-tt-ctrl-sel {
    font-size: 0.72rem;
    color: #0f172a;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 6px;
    padding: 4px 6px;
    cursor: pointer;
    outline: none;
    max-width: 160px;
}
.tgv2-tt-ctrl-sel:focus { border-color: #65a30d; }

/* Structural cell hover */
[data-struct] { cursor: pointer; }
[data-struct]:hover { filter: brightness(0.93); transition: filter 0.1s; }

/* Scope row inside struct popup */
.tgv2-cs-scope-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* Inactive event cell — single / diagonal to mark days that skip this global event */
.tgv2-tt-td-event--inactive {
    position: relative;
    background: #e8e8e8;
    overflow: hidden;
}
/* Pattern overlay — real element so it renders identically in browser and PDF capture */
.tgv2-ev-na-ovl {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(-45deg, #e8e8e8 0, #e8e8e8 5px, #d0d0d0 5px, #d0d0d0 9px);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.tgv2-ev-na-lbl {
    font-size: 0.58rem;
    font-weight: 700;
    color: rgba(0,0,0,0.30);
    letter-spacing: .07em;
    text-transform: uppercase;
    user-select: none;
}

/* Day-specific times row — thin row above any day that skips one or more global events */
.tgv2-tt-tr-daytimes,
.tgv2-tt-tr-daytimes td {
    background: #f1f5f9;
    border-top: 1px solid #cbd5e1;
    border-bottom: none !important;
    padding: 0 !important;
    height: 12px !important;
    max-height: 12px !important;
    vertical-align: bottom;
    line-height: 1;
}
.tgv2-tt-tr-daytimes .tgv2-tt-td-day {
    font-size: 0;         /* hide "Day N" label in this thin row */
}
/* Tick stays position:absolute like the header; td must be position:relative to anchor it */
.tgv2-tt-td-daytimes {
    position: relative;
    overflow: visible;
}
.tgv2-tt-td-daytimes .tgv2-th-tick {
    font-size: 0.6em;
    color: #64748b;
    bottom: 1px;         /* keep same left/transform as the header tick */
}
/* Inactive column in the times row: plain muted colour, no diagonal */
.tgv2-tt-td-daytimes--inactive {
    background: #dde3ea !important;
}

/* PDF format dialog overlay */
.tgv2-pdf-dlg {
    position: fixed;
    inset: 0;
    z-index: 10030;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
}
.tgv2-pdf-dlg[hidden] { display: none; }
.tgv2-pdf-dlg-box {
    background: #fff;
    border-radius: 14px;
    width: 420px;
    max-width: 94vw;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
    overflow: hidden;
    position: relative;
}
.tgv2-pdf-dlg-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #f1f5f9;
}
.tgv2-pdf-dlg-title { font-size: 0.9rem; font-weight: 700; color: #0f172a; }
.tgv2-pdf-dlg-hdr-actions {
    display: flex;
    gap: 6px;
    margin-left: auto;
    margin-right: 10px;
}
.tgv2-pdf-hdr-btn {
    padding: 5px 12px;
    border-radius: 7px;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.tgv2-pdf-hdr-btn:hover { background: #e2e8f0; color: #0f172a; }
.tgv2-pdf-hdr-btn--export {
    background: #65a30d;
    color: #fff;
    border-color: #65a30d;
}
.tgv2-pdf-hdr-btn--export:hover { background: #4d7c0f; border-color: #4d7c0f; color: #fff; }
.tgv2-pdf-dlg-close {
    background: none; border: none; cursor: pointer;
    font-size: 1.1rem; color: #94a3b8; line-height: 1;
}
.tgv2-pdf-dlg-close:hover { color: #0f172a; }
.tgv2-pdf-dlg-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.tgv2-pdf-dlg-desc { font-size: 0.78rem; color: #64748b; margin: 0; }
.tgv2-pdf-fmt-row { display: flex; gap: 12px; }
.tgv2-pdf-fmt-card {
    flex: 1;
    padding: 14px 10px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: border-color 0.12s, background 0.12s;
}
.tgv2-pdf-fmt-card:hover { border-color: #65a30d; background: #f7fee7; }
.tgv2-pdf-fmt-card.is-sel { border-color: #65a30d; background: #ecfccb; }
.tgv2-pdf-fmt-icon { border: 1.5px solid #94a3b8; background: #fff; }
.tgv2-pdf-fmt-icon--a4 { width: 46px; height: 32px; }
.tgv2-pdf-fmt-icon--a5 { width: 32px; height: 46px; }
.tgv2-pdf-fmt-name { font-size: 0.76rem; font-weight: 700; color: #0f172a; }
.tgv2-pdf-fmt-desc { font-size: 0.65rem; color: #64748b; text-align: center; }
.tgv2-pdf-gen-btn {
    padding: 9px 0;
    background: #65a30d;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}
.tgv2-pdf-gen-btn:hover { background: #4d7c0f; }
.tgv2-pdf-gen-soon { font-size: 0.7rem; opacity: 0.75; text-align: center; }

/* PDF dialog — Phase 2 wrapper */
.tgv2-pdf-ph2 {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.tgv2-pdf-dlg-box { transition: width 0.2s; }
.tgv2-pdf-dlg-box--wide { width: 680px; }

/* Progress */
.tgv2-pdf-progress-wrap { padding: 18px 18px 10px; }
.tgv2-pdf-progress-bar-track {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}
.tgv2-pdf-progress-bar {
    height: 100%;
    width: 0%;
    background: #65a30d;
    border-radius: 3px;
    transition: width 0.25s;
}
.tgv2-pdf-progress-lbl { font-size: 0.72rem; color: #64748b; margin: 5px 0 0; }

/* Tab bar */
.tgv2-pdf-tab-bar {
    display: flex;
    border-bottom: 2px solid #e2e8f0;
    padding: 0 14px;
    gap: 0;
}
.tgv2-pdf-tab {
    padding: 8px 14px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color 0.12s, border-color 0.12s;
}
.tgv2-pdf-tab:hover { color: #0f172a; }
.tgv2-pdf-tab.is-active { color: #65a30d; border-bottom-color: #65a30d; }

/* Preview grid — single-page pager */
.tgv2-pdf-preview-grid {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.tgv2-pdf-prev-single {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.tgv2-pdf-prev-single-hdr {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px 8px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
    gap: 8px;
}
.tgv2-pdf-prev-lbl {
    font-size: 0.82rem;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tgv2-pdf-prev-page-num {
    font-size: 0.7rem;
    color: #94a3b8;
    white-space: nowrap;
    flex-shrink: 0;
}
.tgv2-pdf-prev-img-wrap {
    border: 1.5px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    background: #f8fafc;
}
.tgv2-pdf-prev-img-wrap--single {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid #f1f5f9;
}
.tgv2-pdf-prev-img {
    display: block;
    width: 100%;
    height: auto;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}
.tgv2-pdf-prev-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    flex-shrink: 0;
}
.tgv2-pdf-prev-nav-btn {
    background: #f1f5f9;
    border: none;
    border-radius: 7px;
    padding: 8px 22px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: background 0.12s;
}
.tgv2-pdf-prev-nav-btn:hover:not(:disabled) { background: #e2e8f0; }
.tgv2-pdf-prev-nav-btn:disabled { opacity: 0.35; cursor: default; }
.tgv2-pdf-prev-empty {
    font-size: 0.78rem;
    color: #94a3b8;
    text-align: center;
    padding: 24px 0;
    align-self: center;
}

/* Phase 2 bottom actions */
.tgv2-pdf-ph2-actions {
    display: flex;
    gap: 8px;
    padding: 12px 18px 18px;
    border-top: 1px solid #f1f5f9;
}
.tgv2-pdf-gen-btn--back {
    background: #f1f5f9;
    color: #475569;
    flex: 0 0 auto;
    padding: 9px 14px;
}
.tgv2-pdf-gen-btn--back:hover { background: #e2e8f0; }
.tgv2-pdf-dl-btn {
    flex: 1;
    padding: 9px 0;
    background: #1d4ed8;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.12s;
}
.tgv2-pdf-dl-btn:hover { background: #1e40af; }
.tgv2-pdf-dl-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* PDF Export — Generation loading phase */
@keyframes tgv2-float-up {
    0%   { transform: translateY(0)      rotate(-5deg); opacity: 0; }
    15%  { opacity: 1; }
    85%  { opacity: 1; }
    100% { transform: translateY(-200px) rotate( 5deg); opacity: 0; }
}
.tgv2-pdf-gen-ph {
    position: relative;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 14px;
}
.tgv2-pdf-gen-hdr {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
}
.tgv2-pdf-gen-nav-btn {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 6px;
    color: rgba(255,255,255,0.85);
    font-size: 0.78rem;
    padding: 5px 11px;
    cursor: pointer;
    transition: background 0.15s;
}
.tgv2-pdf-gen-nav-btn:hover { background: rgba(255,255,255,0.22); }
.tgv2-pdf-gen-nav-btn--close { font-size: 1.1rem; padding: 5px 10px; }
.tgv2-pdf-gen-bg { position: absolute; inset: 0; pointer-events: none; }
.tgv2-pdf-float-icon {
    position: absolute;
    color: rgba(255,255,255,0.13);
    animation: tgv2-float-up linear infinite;
    pointer-events: none;
}
.tgv2-pdf-gen-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 40px 32px;
    color: #fff;
}
.tgv2-pdf-gen-icon { display: block; margin: 0 auto 18px; }
.tgv2-pdf-gen-title { font-size: 1.2rem; font-weight: 700; margin: 0 0 22px; color: #fff; }
.tgv2-pdf-gen-track { background: rgba(255,255,255,0.2) !important; width: 260px; margin: 0 auto; }
.tgv2-pdf-gen-ph .tgv2-pdf-progress-bar { background: #84cc16; }
.tgv2-pdf-gen-lbl { color: rgba(255,255,255,0.65) !important; }

/* PDF Export — Ready phase (done popup overlaid on gen backdrop) */
@keyframes tgv2-fade-in  { from { opacity: 0; }                          to { opacity: 1; } }
@keyframes tgv2-pop-in   { from { transform: scale(0.85); opacity: 0; }  to { transform: scale(1); opacity: 1; } }
.tgv2-pdf-ready-ph[hidden] { display: none !important; }
.tgv2-pdf-viewer-ph[hidden]    { display: none !important; }
.tgv2-pdf-exporting-ph[hidden] { display: none !important; }
.tgv2-pdf-gen-ph[hidden]       { display: none !important; }
.tgv2-pdf-ready-ph {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.45);
    border-radius: 14px;
    animation: tgv2-fade-in 0.18s ease-out;
}
.tgv2-pdf-done-card {
    background: #fff;
    border-radius: 18px;
    padding: 28px 28px 24px;
    text-align: center;
    box-shadow: 0 24px 64px rgba(0,0,0,0.38);
    position: relative;
    max-width: 320px;
    width: 90%;
    animation: tgv2-pop-in 0.22s cubic-bezier(0.34,1.56,0.64,1);
}
.tgv2-pdf-done-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    padding: 2px 5px;
}
.tgv2-pdf-done-close:hover { color: #0f172a; }
.tgv2-pdf-done-check {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #dcfce7;
    color: #16a34a;
    font-size: 1.5rem;
    line-height: 50px;
    margin: 0 auto 10px;
}
.tgv2-pdf-done-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 16px;
}

/* PDF Export — Ready phase action buttons */
.tgv2-pdf-action-row { display: flex; gap: 12px; margin-top: 2px; }
.tgv2-pdf-action-btn {
    flex: 1;
    padding: 16px 12px;
    border-radius: 12px;
    border: 2px solid;
    background: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.12s;
    line-height: 1.1;
}
.tgv2-pdf-action-icon { font-size: 1.5rem; }
.tgv2-pdf-action-label { font-size: 0.9rem; font-weight: 700; }
.tgv2-pdf-action-sub { font-size: 0.67rem; opacity: 0.7; font-weight: 400; }
.tgv2-pdf-action-btn--preview { border-color: #94a3b8; color: #475569; }
.tgv2-pdf-action-btn--preview:hover { border-color: #0f172a; color: #0f172a; background: #f8fafc; }
.tgv2-pdf-action-btn--export { border-color: #65a30d; color: #65a30d; }
.tgv2-pdf-action-btn--export:hover { background: #65a30d; color: #fff; }

/* PDF Export — Viewer phase (full-screen scrollable) */
.tgv2-pdf-dlg-box--viewer {
    width: 92vw;
    max-width: 1100px;
    height: 90vh;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.tgv2-pdf-viewer-ph {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.tgv2-pdf-viewer-hdr {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}
.tgv2-pdf-viewer-back {
    background: none;
    border: 1.5px solid #e2e8f0;
    border-radius: 7px;
    padding: 6px 12px;
    font-size: 0.78rem;
    color: #475569;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}
.tgv2-pdf-viewer-back:hover { background: #f1f5f9; }
.tgv2-pdf-viewer-ph .tgv2-pdf-tab-bar { flex: 1; border: none; padding: 0; justify-content: center; }
.tgv2-pdf-viewer-ph .tgv2-pdf-preview-grid {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* PDF Export — Exporting phase */
.tgv2-pdf-exporting-ph .tgv2-pdf-progress-wrap { padding: 22px 18px 10px; }

/* PDF Export — Format picker overlay (z-index above done popup) */
.tgv2-pdf-fmt-picker[hidden] { display: none !important; }
.tgv2-pdf-fmt-picker {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.55);
    border-radius: 14px;
    animation: tgv2-fade-in 0.15s ease-out;
}
.tgv2-pdf-fmt-picker-card {
    background: #fff;
    border-radius: 16px;
    padding: 24px 24px 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    max-width: 300px;
    width: 90%;
    animation: tgv2-pop-in 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
.tgv2-pdf-fmt-picker-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 16px;
}
.tgv2-pdf-fmt-cancel-btn {
    margin-top: 14px;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 0.78rem;
    cursor: pointer;
    padding: 4px 10px;
}
.tgv2-pdf-fmt-cancel-btn:hover { color: #475569; }

/* PDF Export — Viewer Download button */
.tgv2-pdf-viewer-dl-btn {
    background: #65a30d;
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 6px 13px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.12s;
}
.tgv2-pdf-viewer-dl-btn:hover { background: #4d7c0f; }

/* Event dialog â€” active day checkboxes */
.tgv2-ev-day-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}
.tgv2-ev-day-lbl {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: #475569;
    cursor: pointer;
    padding: 3px 7px;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    background: #f8fafc;
}
.tgv2-ev-day-lbl input[type=checkbox] { accent-color: #65a30d; }

/* School setup â€” disable times checkbox */
.tgv2-sch-times-head {
    align-items: center;
    gap: 10px;
}
.tgv2-sch-hide-times-lbl {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.74rem;
    color: #475569;
    cursor: pointer;
    white-space: nowrap;
    margin-left: auto;
}
.tgv2-sch-hide-times-lbl input[type=checkbox] { accent-color: #65a30d; }

/* ============================================================
   Responsive - small screens stack columns
   ============================================================ */
@media (max-width: 640px) {

    /* ---- Overlay: anchor modal to bottom like a sheet ---- */
    .tgv2-overlay {
        padding: 0;
        align-items: flex-end;
    }

    /* ---- Modal base: full-width bottom sheet ---- */
    .tgv2-modal {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 20px 20px 0 0;
        max-height: 96vh;
    }

    /* ---- Wide modal (timetable step): true full-screen ---- */
    .tgv2-modal.tgv2-modal--wide {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 0 !important;
        height: 100vh !important;
        max-height: 100vh !important;
    }

    /* ---- Wizard modal height ---- */
    .tgv2-modal:has(.tgv2-wizard) {
        height: 96vh;
    }

    /* ---- Body: scrolls the whole wizard on mobile ---- */
    .tgv2-body:has(.tgv2-wizard) {
        overflow-y: auto;
        overflow-x: hidden;
        display: block;
    }

    /* ---- Wizard: stack left + right vertically ---- */
    .tgv2-wizard {
        flex-direction: column;
        overflow: visible;
        min-height: 0;
    }

    /* ---- Left panel: natural height, no internal scroll ---- */
    .tgv2-wizard__left {
        flex: 0 0 auto;
        overflow-y: visible;
        overflow-x: hidden;
        border-right: none;
        border-bottom: 1px solid #f0f2f4;
        min-height: calc(96vh + 220px);
    }

    /* Left panel with sticky top bar: disable internal height-capping */
    .tgv2-wizard__left.has-step-top-bar {
        overflow: visible;
        height: auto;
        padding: 0;
    }

    /* Step scroller: let content flow naturally so parent body scrolls */
    .tgv2-step-scroller {
        flex: none;
        height: auto;
        overflow-y: visible;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Sticky top bar stays sticky relative to viewport on mobile */
    .tgv2-step-top-bar {
        position: sticky;
        top: 0;
        z-index: 30;
        flex-wrap: wrap;
        gap: 6px;
    }

    /* ---- Right panel: compact summary strip at the top ---- */
    .tgv2-wizard__right {
        order: -1;
        flex: 0 0 auto;
        border-radius: 0;
        max-height: 200px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0.8rem;
        border-top: none;
        border-bottom: 2px solid #e5e7eb;
    }

    /* ---- Welcome screen ---- */
    .tgv2-welcome {
        padding: 2rem 1.2rem 1.8rem;
    }
    .tgv2-welcome__title {
        font-size: 1.25rem;
    }
    .tgv2-cta-btn {
        width: 100%;
        justify-content: center;
        font-size: 1rem;
        padding: 14px 20px;
    }

    /* ---- Name screen ---- */
    .tgv2-name-screen {
        padding: 1.6rem 1.1rem 1.4rem;
    }

    /* ---- Larger touch targets for all buttons ---- */
    .tgv2-btn {
        padding: 11px 18px;
        font-size: 0.88rem;
        min-height: 44px;
    }
    .tgv2-btn--sm {
        padding: 9px 14px;
        font-size: 0.82rem;
        min-height: 38px;
    }

    /* ---- Step footer: wrap on small screens ---- */
    .tgv2-step__footer {
        flex-wrap: wrap;
        gap: 8px;
    }
    .tgv2-row-actions {
        flex-wrap: wrap;
        justify-content: stretch;
    }
    .tgv2-row-actions .tgv2-btn {
        flex: 1 1 auto;
    }

    /* ---- Grade chips ---- */
    .tgv2-grade-grid {
        gap: 6px;
    }

    /* ---- Classes step: input row stacks ---- */
    .tgv2-inp-row {
        flex-wrap: wrap;
    }
    .tgv2-inp-row .tgv2-inp--flex {
        flex: 1 1 100%;
    }

    /* ---- Teacher name row: stack fields ---- */
    .tgv2-tchr-name-row {
        flex-wrap: wrap;
    }
    .tgv2-field--sm {
        flex: 0 0 100%;
    }

    /* ---- Teacher matrix: horizontal scroll ---- */
    .tgv2-tchr-matrix {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        padding-bottom: 6px;
    }
    .tgv2-tchr-grade-col {
        flex: 0 0 auto;
        min-width: 130px;
    }

    /* ---- Subject matrix: reduce min-width ---- */
    .tgv2-subj-col {
        min-width: 100px;
    }

    /* ---- PPC table: compact inputs ---- */
    .tgv2-ppc-inp {
        width: 54px;
        font-size: 0.82rem;
    }

    /* ================================================
       TIMETABLE STEP (wide-modal) - topbar & controls
       ================================================ */

    /* Nav row: scrollable strip */
    .tgv2-tt-tbar-nav {
        padding: 8px 10px;
        gap: 8px;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    .tgv2-tt-tbar-nav::-webkit-scrollbar { display: none; }

    .tgv2-tt-tbar-title {
        font-size: 0.85rem;
        max-width: 140px;
    }

    /* Util buttons: compact */
    .tgv2-tt-util-btn {
        padding: 5px 9px;
        font-size: 0.74rem;
        white-space: nowrap;
    }

    /* Controls row: scrollable */
    .tgv2-tt-tbar-controls {
        padding: 6px 10px;
        overflow-x: auto;
        flex-wrap: nowrap;
        gap: 6px;
        -webkit-overflow-scrolling: touch;
    }
    .tgv2-tt-tbar-controls::-webkit-scrollbar { display: none; }

    /* View toggle, control and nav buttons: compact */
    .tgv2-tt-view-btn {
        padding: 5px 10px;
        font-size: 0.76rem;
    }
    .tgv2-tt-ctrl-btn {
        padding: 5px 9px;
        font-size: 0.76rem;
        white-space: nowrap;
    }
    .tgv2-tt-nav-btn {
        padding: 5px 10px;
        font-size: 0.76rem;
        white-space: nowrap;
    }
    .tgv2-tt-zoom-btn {
        padding: 5px 8px;
    }

    /* ---- Cell picker: bottom sheet on mobile ---- */
    .tgv2-cell-picker {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        border-radius: 16px 16px 0 0 !important;
        max-height: 65vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        box-shadow: 0 -4px 32px rgba(0,0,0,.18);
    }
    .tgv2-picker-sublist {
        max-height: none;
    }
    .tgv2-picker-cat,
    .tgv2-picker-sub-item {
        padding: 13px 16px;
        min-height: 48px;
    }

    /* ---- AF Report modal: full screen ---- */
    .tgv2-af-modal {
        width: 100vw;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }
    .tgv2-af-body {
        padding: 12px 14px;
    }

    /* ---- Detail view tables: horizontal scroll ---- */
    .tgv2-dv-teacher-card,
    .tgv2-dv-grade-block {
        overflow-x: auto;
    }
    .tgv2-dv-table {
        font-size: 0.75rem;
    }
    .tgv2-dv-table th,
    .tgv2-dv-table td {
        padding: 6px 8px;
    }

    /* ---- Summary mini table: horizontal scroll, centred ---- */
    .tgv2-tt-sum-bar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* ---- Collapse boxes: larger tap area ---- */
    .tgv2-collapse__hdr {
        padding: 12px 14px;
        min-height: 44px;
    }

    /* ---- Group chips: larger tap area ---- */
    .tgv2-grp-chip {
        padding: 8px 12px;
        font-size: 0.84rem;
    }

    /* ---- Close button: larger tap area ---- */
    .tgv2-close {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }

    /* ---- Final Check modal: full-screen on mobile ---- */
    .tgv2-fchk-overlay {
        padding: 0;
        align-items: flex-end;
    }
    .tgv2-fchk-dialog {
        border-radius: 16px 16px 0 0;
        width: 100%;
        max-width: 100%;
        height: 92vh;
        max-height: 92vh;
    }
    .tgv2-fchk-hdr {
        padding: 16px 16px 14px;
    }
    .tgv2-fchk-actions {
        padding: 12px 16px;
        flex-wrap: wrap;
    }
    .tgv2-fchk-btn-go,
    .tgv2-fchk-btn-warn,
    .tgv2-fchk-btn-save {
        flex: 1 1 auto;
        text-align: center;
        min-height: 44px;
    }

}

