/* ============================================================================
   StudentAttendance.razor.css — Scoped styles
   Design tokens aligned with TemisDataGrid.razor.css
   ============================================================================ */

/* ═══ Design tokens ═══════════════════════════════════════════════════════ */
:root {
    --att-present-bg:   #dcfce7;
    --att-present-fg:   #15803d;
    --att-present-bd:   #86efac;
    --att-half-bg:      #fef3c7;
    --att-half-fg:      #b45309;
    --att-half-bd:      #fcd34d;
    --att-absent-bg:    #fee2e2;
    --att-absent-fg:    #dc2626;
    --att-absent-bd:    #fca5a5;
    --att-unmarked-bg:  #f3f4f6;
    --att-unmarked-fg:  #9ca3af;
    --att-unmarked-bd:  #e5e7eb;
    --att-rate-good:    #16a34a;
    --att-rate-warn:    #b45309;
    --att-rate-poor:    #dc2626;
    --att-border:       #e5e7eb;
    --att-surface:      #f8fafc;
    --att-radius:       8px;
    --att-min-panel:    260px;
}


/* ═══ Welcome bar ════════════════════════════════════════════ */
.att-welcome-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    padding: 0.9rem 1.25rem;
    background: #f8f9fa;
    border-left: 3px solid #004fb9;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    border-left: 3px solid #004fb9;
    margin-bottom: 0;
}

.att-welcome-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.att-welcome-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #004fb9;
    margin: 0;
    white-space: nowrap;
}

.att-welcome-subtitle {
    font-size: 0.82rem;
    color: #6b7280;
    margin: 0;
}

.att-welcome-right {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-shrink: 0;
}

.att-welcome-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.att-welcome-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.att-welcome-class-tag {
    display: inline-block;
    margin: 0 0 6px 0;
    padding: 3px 12px;
    background: #00838f;
    color: white;
    border-radius: 12px;
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.2px;
}

/* ═══ Context bar ════════════════════════════════════════════════════════ */
.att-context-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 7px 16px;
    background: white;
    border-bottom: 1px solid var(--att-border);
    font-size: 13px;
}

.att-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.att-select {
    padding: 6px 30px 6px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: inherit;
    color: #1a1a2e;
    background: white;
    cursor: pointer;
    appearance: auto;
    min-width: 200px;
    transition: border-color .15s;
}

    .att-select:hover,
    .att-select:focus {
        border-color: #00838f;
        outline: none;
    }

.att-ctx-label {
    font-weight: 600;
    color: #111827;
}

.att-ctx-sep { color: #d1d5db; }
.att-ctx-muted { color: #6b7280; }

/* Date nav */
.att-date-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.att-date-btn {
    border: 1px solid var(--att-border);
    border-radius: 5px;
    padding: 3px 9px;
    cursor: pointer;
    background: white;
    font-size: 13px;
    transition: all .15s;
}

.att-date-btn:hover:not(:disabled) {
    border-color: #00838f;
    color: #00838f;
}

.att-date-btn:disabled { opacity: .35; cursor: default; }

.att-date-label {
    min-width: 132px;
    text-align: center;
    font-size: 13px;
    color: #374151;
    white-space: nowrap;
}

.att-date-label.is-today { font-weight: 700; color: #1e40af; }

.att-btn-toggle-contacts {
    background: transparent;
    border: 1px solid var(--att-border, #2a3a52);
    color: var(--att-text-muted, #94A3B8);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.15s;
}

    .att-btn-toggle-contacts:hover {
        border-color: var(--att-teal, #00838F);
        color: var(--att-text, #E2E8F0);
    }

    .att-btn-toggle-contacts.is-active {
        background: var(--att-teal, #00838F);
        color: white;
        border-color: var(--att-teal, #00838F);
    }

/* ═══ Date picker module ════════════════════════════════════════════════ */
.att-dp {
    background: #f8fafc;
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.att-dp-tw {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

.att-dp-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.att-dp-label {
    font-size: 9px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.att-dp-select {
    padding: 5px 22px 5px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    font-size: 12px;
    background: #fff;
    color: #1a1a2e;
    appearance: auto;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.15s;
}

    .att-dp-select:hover, .att-dp-select:focus {
        border-color: #00838f;
        outline: none;
    }

/* Today reset link */
.att-dp-today-row {
    display: flex;
    justify-content: flex-end;
    margin: -4px 0 4px;
    min-height: 18px;
}

.att-dp-today-btn {
    font-size: 11px;
    color: #00838f;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

    .att-dp-today-btn:hover {
        background: #e6fffa;
    }

/* Day cards */
.att-dp-day-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
}

.att-dp-day {
    padding: 6px 2px;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    text-align: center;
    cursor: pointer;
    min-height: 54px;
    transition: all 0.12s;
    font-family: inherit;
}

    .att-dp-day:hover:not(:disabled):not(.att-dp-day--active) {
        border-color: #00838f;
    }

.att-dp-day--active {
    background: #E1F5EE;
    border: 2px solid #0F6E56;
    padding: 5px 1px;
}

.att-dp-day--today:not(.att-dp-day--active) {
    border-color: #185FA5;
    background: #E6F1FB;
}

.att-dp-day:disabled {
    background: #f1f5f9;
    cursor: not-allowed;
    opacity: 0.85;
}

.att-dp-day-name {
    font-size: 10px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    line-height: 1.1;
}

.att-dp-day--active .att-dp-day-name {
    color: #0F6E56;
}

.att-dp-day-num {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.2;
    margin-top: 2px;
}

.att-dp-day:disabled .att-dp-day-num {
    color: #94a3b8;
}

.att-dp-day-tag {
    font-size: 8px;
    font-weight: 600;
    line-height: 1;
    margin-top: 2px;
    min-height: 8px;
}

.att-dp-day-tag--holiday {
    color: #854f0b;
}

.att-dp-day-tag--today {
    color: #185FA5;
}

/* Edge banners */
.att-dp-banner {
    font-size: 11px;
    padding: 6px 8px;
    border-radius: 5px;
    display: flex;
    gap: 6px;
    align-items: flex-start;
    line-height: 1.3;
    margin-top: 8px;
}

.att-dp-banner--holiday {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    color: #854f0b;
}

.att-dp-banner--break {
    background: #E6F1FB;
    border: 1px solid #93C5FD;
    color: #1e40af;
}

.att-dp-banner--blocked {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}

/* Welcome bar — read-only date display replaces date arrows */
.att-welcome-date-readonly {
    padding: 5px 2px;
    min-width: 160px;
    cursor: default;
}

.att-welcome-date-value {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    line-height: 1.2;
}

.att-welcome-date-context {
    font-size: 11px;
    color: #6b7280;
    margin-top: 1px;
}

/* Inline nav buttons flanking the student avatar */
.att-mp-identity-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    width: 100%;
    padding: 0 4px;
}

.att-mp-nav-btn-inline {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--att-border);
    background: white;
    cursor: pointer;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
    padding: 0;
    font-family: inherit;
    transition: all .15s;
}

    .att-mp-nav-btn-inline:hover:not(:disabled) {
        border-color: #00838f;
        color: #00838f;
        background: #f0fafa;
    }

    .att-mp-nav-btn-inline:disabled {
        opacity: 0.25;
        cursor: default;
    }

/* Term pill */
.att-term-pill-wrap { position: relative; }

.att-term-pill {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--att-present-bg);
    color: var(--att-present-fg);
    font-weight: 700;
    cursor: default;
    border: 1px solid var(--att-present-bd);
    user-select: none;
    white-space: nowrap;
}

.att-term-tooltip {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    width: 268px;
    background: white;
    border: 1px solid var(--att-border);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,.12);
    padding: 10px;
    z-index: 9999;
    font-size: 12px;
}

.att-term-pill-wrap:hover .att-term-tooltip { display: block; }

.att-term-tooltip-title {
    font-weight: 700;
    color: #374151;
    margin-bottom: 8px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.att-term-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 6px;
    border-radius: 4px;
    margin-bottom: 2px;
    background: var(--att-surface);
    border: 1px solid transparent;
}

.att-term-row.is-current {
    background: var(--att-present-bg);
    border-color: var(--att-present-bd);
    font-weight: 600;
}

/* ═══ Progress bar ═══════════════════════════════════════════════════════ */
.att-progress-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 16px;
    border-bottom: 1px solid #f1f5f9;
    background: #fafafa;
}

.att-progress-track {
    flex: 1;
    height: 5px;
    background: var(--att-border);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    min-width: 60px;
}

.att-progress-seg {
    height: 100%;
    transition: width .3s;
}

.att-progress-seg.is-present { background: var(--att-rate-good); }
.att-progress-seg.is-half    { background: var(--att-rate-warn); }
.att-progress-seg.is-absent  { background: var(--att-rate-poor); }

.att-progress-stats {
    font-size: 11px;
    color: #6b7280;
    white-space: nowrap;
    flex-shrink: 0;
    display: flex;
    gap: 4px;
    align-items: center;
}

.att-stat-present { color: var(--att-rate-good); font-weight: 600; }
.att-stat-half    { color: var(--att-rate-warn); font-weight: 600; }
.att-stat-absent  { color: var(--att-rate-poor); font-weight: 600; }
.att-rate-good    { color: var(--att-rate-good) !important; font-weight: 700; }
.att-rate-warn    { color: var(--att-rate-warn) !important; font-weight: 700; }
.att-rate-poor    { color: var(--att-rate-poor) !important; font-weight: 700; }

/* ═══ Body layout ════════════════════════════════════════════════════════ */
.att-body {
    display: flex;
    flex-direction: row;
    height: calc(100vh - 105px);
    overflow: hidden;
}

.att-col-name {
    width: 180px;
    min-width: 180px;
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Desktop: roster grows, marking panel fixed */
.att-roster-panel {
    flex: 1;
    min-width: var(--att-min-panel);
    display: flex;
    flex-direction: column;
    background: white;
    overflow: hidden;
}

/* The tg-panel inside loses its border-radius in split layout */
.att-roster-panel .tg-panel {
    border-radius: 0;
    border: none;
    box-shadow: none;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.att-roster-panel .tg-table-wrap {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    min-height: 0;
}

/* ═══ Toolbar ════════════════════════════════════════════════════════════ */
.att-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.att-btn-all-present {
    padding: 6px 12px;
    border-radius: 7px;
    border: 1.5px solid var(--att-present-bd);
    background: var(--att-present-bg);
    color: var(--att-present-fg);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: all .15s;
}

.att-btn-all-present:hover {
    background: #bbf7d0;
    border-color: var(--att-present-fg);
}

.att-btn-export {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 7px;
    border: none;
    background: #1d6f42;
    color: white;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: all .15s;
}

.att-btn-export:hover:not(:disabled) { background: #165a36; }
.att-btn-export:disabled { opacity: .5; cursor: not-allowed; }

/* ═══ Draggable divider ══════════════════════════════════════════════════ */
.att-divider {
    width: 7px;
    flex-shrink: 0;
    cursor: col-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--att-surface);
    border-left: 1px solid var(--att-border);
    border-right: 1px solid var(--att-border);
    user-select: none;
    transition: background .15s;
}

.att-divider:hover { background: #dbeafe; }

.att-divider-handle {
    width: 3px;
    height: 36px;
    background: #cbd5e1;
    border-radius: 2px;
    pointer-events: none;
}

/* ═══ Marking panel (desktop) ════════════════════════════════════════════ */
.att-marking-panel {
    /* Width set by JS from localStorage, default 300px */
    width: 300px;
    min-width: var(--att-min-panel);
    flex-shrink: 0;
    background: white;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-left: 1px solid var(--att-border);
}

/* ═══ Marking panel — shared internals ═══════════════════════════════════ */
.att-marking-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 8px;
    color: #9ca3af;
    font-size: 13px;
}

.att-marking-empty span:first-child { font-size: 28px; }

/* Identity */
.att-mp-identity {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 16px 10px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
    text-align: center;
}

.att-mp-identity--compact {
    flex-direction: row;
    text-align: left;
    gap: 10px;
    padding: 10px 14px;
}

.att-mp-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #dbeafe;
    color: #1e40af;
    font-weight: 800;
    font-size: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.att-mp-identity--compact .att-mp-avatar {
    width: 38px;
    height: 38px;
    font-size: 14px;
    margin-bottom: 0;
}

.att-mp-identity:not(.att-mp-identity--compact) .att-mp-avatar {
    margin-bottom: 8px;
}

.att-mp-name-block { flex: 1; min-width: 0; }

.att-mp-name {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.att-mp-meta {
    font-size: 11px;
    color: #6b7280;
    margin-top: 2px;
}

.att-rate-inline { font-weight: 700; }

.att-absence-required-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0 8px;
    padding: 8px 10px;
    background: var(--att-absent-bg);
    border: 1px solid var(--att-absent-bd);
    border-radius: 6px;
    color: var(--att-absent-fg);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
}

.att-absence-required-icon {
    font-size: 14px;
    flex-shrink: 0;
}

/* Save button when a reason is missing — visibly muted but still clickable */
.att-absence-save--needs-reason {
    opacity: 0.55;
    cursor: pointer; /* override the disabled-look */
}

.att-absence-save:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mark buttons */
.att-mp-mark-section {
    padding: 12px 14px 8px;
    flex-shrink: 0;
}

.att-mp-section-label {
    font-size: 10px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: .8px;
    font-weight: 600;
    margin-bottom: 7px;
}

.att-mp-section-label--absent { color: var(--att-absent-fg); }

.att-mp-mark-buttons {
    display: flex;
    gap: 8px;
}

.att-mark-btn {
    flex: 1;
    padding: 13px 4px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all .12s;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.att-mark-btn--present {
    border: 2px solid var(--att-present-bd);
    background: var(--att-present-bg);
    color: var(--att-present-fg);
}

.att-mark-btn--present.is-active {
    background: var(--att-present-fg);
    border-color: var(--att-present-fg);
    color: white;
    box-shadow: 0 2px 8px rgba(22,163,74,.35);
    transform: scale(1.04);
}

.att-mark-btn--half {
    border: 2px solid var(--att-half-bd);
    background: var(--att-half-bg);
    color: var(--att-half-fg);
}

.att-mark-btn--half.is-active {
    background: var(--att-half-fg);
    border-color: var(--att-half-fg);
    color: white;
    box-shadow: 0 2px 8px rgba(180,83,9,.35);
    transform: scale(1.04);
}

.att-mark-btn--absent {
    border: 2px solid var(--att-absent-bd);
    background: var(--att-absent-bg);
    color: var(--att-absent-fg);
}

.att-mark-btn--absent.is-active {
    background: var(--att-absent-fg);
    border-color: var(--att-absent-fg);
    color: white;
    box-shadow: 0 2px 8px rgba(220,38,38,.35);
    transform: scale(1.04);
}

.att-mark-icon { font-size: 18px; }

.att-mp-hint {
    font-size: 10px;
    color: #9ca3af;
    text-align: center;
    margin-top: 5px;
}

/* Absence section */
.att-mp-absence {
    padding: 0 14px 10px;
    flex-shrink: 0;
}

.att-absence-select,
.att-absence-notes {
    width: 100%;
    padding: 5px 7px;
    border: 1px solid var(--att-absent-bd);
    border-radius: 5px;
    font-size: 12px;
    font-family: inherit;
    outline: none;
    background: white;
    box-sizing: border-box;
}

.att-absence-notes {
    resize: none;
    margin-top: 5px;
}

.att-absence-save {
    margin-top: 7px;
    width: 100%;
    padding: 6px;
    border-radius: 6px;
    border: 1px solid var(--att-absent-bd);
    background: var(--att-absent-bg);
    color: var(--att-absent-fg);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all .15s;
}

.att-absence-save:hover {
    background: #fecaca;
}

/* History heatmap */
.att-mp-history {
    padding: 10px 14px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.att-mp-heatmap {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.att-heatmap-cell {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 7px;
    font-weight: 800;
    cursor: default;
}

.att-heatmap-cell--p { background: var(--att-present-bg); border: 1px solid var(--att-present-bd); color: var(--att-present-fg); }
.att-heatmap-cell--h { background: var(--att-half-bg);    border: 1px solid var(--att-half-bd);    color: var(--att-half-fg); }
.att-heatmap-cell--a { background: var(--att-absent-bg);  border: 1px solid var(--att-absent-bd);  color: var(--att-absent-fg); }

.att-mp-rate { font-size: 11px; color: #6b7280; }

/* ═══ Mobile / tablet stacked layout ════════════════════════════════════ */
.att-body--stacked {
    flex-direction: column;
}

.att-marking-compact {
    background: white;
    border-bottom: 2px solid var(--att-border);
    flex-shrink: 0;
}

/* Compact mark buttons */
.att-body--stacked .att-mark-btn {
    padding: 10px 4px;
    font-size: 12px;
}

.att-body--stacked .att-mark-icon { font-size: 16px; }

.att-roster-mobile {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.att-roster-mobile .tg-panel {
    border-radius: 0;
    border: none;
    box-shadow: none;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.att-roster-mobile .tg-table-wrap {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    min-height: 0;
}

/* ═══ Status pills ═══════════════════════════════════════════════════════ */
.att-status-pill {
    display: inline-block;
    font-size: 11px;
    padding: 2px 10px;
    border-radius: 12px;
    font-weight: 700;
    white-space: nowrap;
    border: 1px solid transparent;
}

    .att-status-pill.is-pending {
        border-style: dashed;
        border-width: 1.5px;
        background: #fff8f8;
        font-style: italic;
    }

.att-status-pill.is-present { background: var(--att-present-bg); color: var(--att-present-fg); border-color: var(--att-present-bd); }
.att-status-pill.is-half    { background: var(--att-half-bg);    color: var(--att-half-fg);    border-color: var(--att-half-bd); }
.att-status-pill.is-absent  { background: var(--att-absent-bg);  color: var(--att-absent-fg);  border-color: var(--att-absent-bd); }
.att-status-pill.is-unmarked{ background: var(--att-unmarked-bg);color: var(--att-unmarked-fg);border-color: var(--att-unmarked-bd); }

/* ═══ Quick mark buttons (in grid) ══════════════════════════════════════ */
.att-quick-mark {
    display: flex;
    gap: 3px;
    justify-content: center;
}

.att-qm-btn {
    width: 32px;
    height: 24px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all .1s;
}

.att-qm-btn--present { border: 1.5px solid var(--att-present-bd); background: var(--att-present-bg); color: var(--att-present-fg); }
.att-qm-btn--half    { border: 1.5px solid var(--att-half-bd);    background: var(--att-half-bg);    color: var(--att-half-fg); }
.att-qm-btn--absent  { border: 1.5px solid var(--att-absent-bd);  background: var(--att-absent-bg);  color: var(--att-absent-fg); }

.att-qm-btn--present.is-active { background: var(--att-present-fg); color: white; border-color: var(--att-present-fg); }
.att-qm-btn--half.is-active    { background: var(--att-half-fg);    color: white; border-color: var(--att-half-fg); }
.att-qm-btn--absent.is-active  { background: var(--att-absent-fg);  color: white; border-color: var(--att-absent-fg); }

    /* ── Pending Absent — quick-mark button (grid) ── */
    .att-qm-btn--absent.is-active.is-pending {
        background: var(--att-absent-bg);
        color: var(--att-absent-fg);
        border-style: dashed;
        border-color: var(--att-absent-fg);
    }

/* ── Pending Absent — big mark button (panel) ── */
.att-mark-btn--absent.is-active.is-pending {
    background: var(--att-absent-bg);
    color: var(--att-absent-fg);
    border-style: dashed;
    border-color: var(--att-absent-fg);
    box-shadow: none; /* override the active glow */
    font-style: italic;
}

/* Rate cell in grid */
.att-rate-cell { font-weight: 700; font-size: 12px; }

/* ═══ Export modal ═══════════════════════════════════════════════════════ */
.att-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.att-modal {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 680px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.att-modal-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--att-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.att-modal-title   { font-size: 15px; font-weight: 700; color: #111827; }
.att-modal-subtitle{ font-size: 12px; color: #6b7280; margin-top: 1px; }

.att-modal-close {
    border: none;
    background: var(--att-surface);
    border-radius: 6px;
    padding: 5px 10px;
    cursor: pointer;
    color: #374151;
    font-size: 13px;
    font-family: inherit;
    transition: all .15s;
}

.att-modal-close:hover { background: #f1f5f9; }

/* Modal tabs */
.att-modal-tabs {
    display: flex;
    border-bottom: 2px solid var(--att-border);
    flex-shrink: 0;
    background: var(--att-surface);
}

.att-modal-tab {
    padding: 10px 18px;
    border: none;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: #6b7280;
    font-weight: 400;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    transition: all .15s;
    margin-bottom: -2px;
}

.att-modal-tab.is-active {
    background: white;
    border-bottom-color: #1d6f42;
    color: #1d6f42;
    font-weight: 700;
}

.att-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
}

/* Export summary cards */
.att-export-summary {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.att-export-summary-item {
    flex: 1;
    padding: 10px 6px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid transparent;
}

.att-export-summary-item.is-present { background: var(--att-present-bg); border-color: var(--att-present-bd); }
.att-export-summary-item.is-half    { background: var(--att-half-bg);    border-color: var(--att-half-bd); }
.att-export-summary-item.is-absent  { background: var(--att-absent-bg);  border-color: var(--att-absent-bd); }
.att-export-summary-item.is-unmarked{ background: var(--att-unmarked-bg);border-color: var(--att-unmarked-bd); }

.att-export-count { font-size: 22px; font-weight: 800; }
.att-export-label { font-size: 11px; font-weight: 600; }

.att-export-summary-item.is-present .att-export-count,
.att-export-summary-item.is-present .att-export-label { color: var(--att-present-fg); }
.att-export-summary-item.is-half    .att-export-count,
.att-export-summary-item.is-half    .att-export-label { color: var(--att-half-fg); }
.att-export-summary-item.is-absent  .att-export-count,
.att-export-summary-item.is-absent  .att-export-label { color: var(--att-absent-fg); }
.att-export-summary-item.is-unmarked .att-export-count,
.att-export-summary-item.is-unmarked .att-export-label { color: var(--att-unmarked-fg); }

.att-export-info {
    margin-bottom: 12px;
    font-size: 12px;
    color: #6b7280;
    padding: 10px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
}

/* Preview table */
.att-export-preview {
    border: 1px solid var(--att-border);
    border-radius: 8px;
    overflow: hidden;
    font-size: 12px;
}

.att-preview-table {
    width: 100%;
    border-collapse: collapse;
}

.att-preview-table thead th {
    padding: 7px 10px;
    background: var(--att-surface);
    font-weight: 700;
    color: #374151;
    text-align: left;
    border-bottom: 1px solid var(--att-border);
}

.att-preview-table tbody td {
    padding: 6px 10px;
    border-bottom: 1px solid #f1f5f9;
}

.att-preview-row.att-row-present { background: #f0fdf4; }
.att-preview-row.att-row-half    { background: #fffbeb; }
.att-preview-row.att-row-absent  { background: #fff5f5; }

.att-preview-more {
    padding: 6px 10px;
    background: var(--att-surface);
    font-size: 11px;
    color: #9ca3af;
}

.att-col-center { text-align: center !important; }
.att-muted      { color: #9ca3af; font-style: italic; }
.att-bold       { font-weight: 700; }
.att-present-text { color: var(--att-present-fg); font-weight: 600; }
.att-half-text    { color: var(--att-half-fg);    font-weight: 600; }
.att-absent-text  { color: var(--att-absent-fg);  font-weight: 600; }

/* Modal footer */
.att-modal-footer {
    padding: 12px 18px;
    border-top: 1px solid var(--att-border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

.att-btn-cancel {
    padding: 8px 16px;
    border-radius: 7px;
    border: 1px solid var(--att-border);
    background: white;
    color: #374151;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    transition: all .15s;
}

.att-btn-cancel:hover { background: var(--att-surface); }

.att-btn-export-confirm {
    padding: 8px 20px;
    border-radius: 7px;
    border: none;
    background: #1d6f42;
    color: white;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all .15s;
}

.att-btn-export-confirm:hover:not(:disabled) { background: #165a36; }
.att-btn-export-confirm:disabled { opacity: .5; cursor: not-allowed; }

/* ═══ Dashboard ════════════════════════════════════════════════════════════ */
.att-dash {
    padding: 16px 20px;
    background: white;
    min-height: calc(100vh - 105px);
}

.att-dash-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.att-dash-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #004fb9;
    margin: 0 0 2px;
}

.att-dash-subtitle {
    font-size: 0.82rem;
    color: #6b7280;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.att-dash-tag {
    font-size: 11px;
    padding: 2px 8px;
    background: #fef3c7;
    color: #854f0b;
    border: 1px solid #fcd34d;
    border-radius: 10px;
    font-weight: 600;
}

.att-dash-controls {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.att-dash-today-btn {
    height: 30px;
    padding: 0 10px;
    border: 1px solid #cbd5e1;
    background: white;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #00838f;
    font-family: inherit;
    transition: all .15s;
}

    .att-dash-today-btn:hover {
        background: #e6fffa;
        border-color: #00838f;
    }

/* Stats */
.att-dash-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.att-dash-stat {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 14px;
}

.att-dash-stat-label {
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 3px;
}

.att-dash-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.2;
}

.att-dash-stat-suffix {
    font-size: 13px;
    color: #6b7280;
    font-weight: 400;
    margin-left: 2px;
}

/* Matrix */
.att-dash-matrix-wrap {
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
}

.att-dash-matrix {
    min-width: 640px;
}

.att-dash-matrix-row {
    display: grid;
    grid-template-columns: 180px repeat(5, 1fr);
    gap: 4px;
    padding: 4px;
    align-items: stretch;
}

    .att-dash-matrix-row + .att-dash-matrix-row {
        border-top: 1px solid #f1f5f9;
    }

.att-dash-matrix-header {
    background: #f8fafc;
    border-radius: 6px 6px 0 0;
}

.att-dash-cell {
    border: none;
    border-radius: 5px;
    height: 36px; 
    padding: 3px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    transition: box-shadow .1s; 
}

    .att-dash-cell:not(:disabled):hover {
        box-shadow: 0 2px 6px rgba(0,0,0,0.18);
        position: relative;
        z-index: 2;
    }

.att-dash-cell-tick {
    font-size: 13px; 
    line-height: 1;
}

.att-dash-cell-class {
    padding: 8px 12px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    color: #1a2332;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.att-dash-day-header {
    text-align: center;
    padding: 8px 4px;
    border-radius: 5px;
}

    .att-dash-day-header.is-today {
        background: #E6F1FB;
        border: 2px solid #185FA5;
        padding: 6px 2px;
    }

    .att-dash-day-header.is-holiday {
        background: #fef9e7;
        color: #854f0b;
    }

.att-dash-day-name {
    font-size: 10px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.att-dash-day-num {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a2e;
    margin-top: 2px;
}

.att-dash-day-header.is-today .att-dash-day-name,
.att-dash-day-header.is-today .att-dash-day-num {
    color: #185FA5;
}

.att-dash-day-hint {
    font-size: 9px;
    color: #6b7280;
    margin-top: 2px;
    font-weight: 600;
}

    .att-dash-cell:disabled {
        cursor: default;
    }

.att-dash-cell-label {
    display: block;
}

/* Cell states — past */
.att-dash-cell--ok {
    background: var(--att-present-bg);
    color: var(--att-present-fg);
    border: 1px solid var(--att-present-bd);
}

.att-dash-cell--partial {
    background: var(--att-half-bg);
    color: var(--att-half-fg);
    border: 1px solid var(--att-half-bd);
}

.att-dash-cell--missing {
    background: var(--att-absent-bg);
    color: var(--att-absent-fg);
    border: 1px solid var(--att-absent-bd);
}

/* Cell states — today (blue ring, no red) */
.att-dash-cell--today-ok {
    background: var(--att-present-bg);
    color: var(--att-present-fg);
    border: 2px solid #185FA5;
}

.att-dash-cell--today-partial {
    background: var(--att-half-bg);
    color: var(--att-half-fg);
    border: 2px solid #185FA5;
}

.att-dash-cell--today-pending {
    background: #f8fafc;
    color: #6b7280;
    border: 2px solid #185FA5;
}

/* Cell states — future / holiday */
.att-dash-cell--future {
    background: #f8fafc;
    color: #cbd5e1;
    border: 1px dashed #e2e8f0;
}

.att-dash-cell--holiday {
    background: #fef9e7;
    color: #854f0b;
    border: 1px solid #fde68a;
    font-size: 10px;
    font-weight: 600;
}

/* Empty / loading */
.att-dash-loading,
.att-dash-empty {
    padding: 32px;
    text-align: center;
    color: #6b7280;
    font-size: 13px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px dashed #e2e8f0;
}

/* Legend */
.att-dash-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 12px;
    padding: 8px 4px;
    font-size: 11px;
    color: #6b7280;
}

.att-dash-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.att-dash-legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    display: inline-block;
}

    .att-dash-legend-swatch.is-ok {
        background: var(--att-present-bg);
        border: 1px solid var(--att-present-bd);
    }

    .att-dash-legend-swatch.is-partial {
        background: var(--att-half-bg);
        border: 1px solid var(--att-half-bd);
    }

    .att-dash-legend-swatch.is-missing {
        background: var(--att-absent-bg);
        border: 1px solid var(--att-absent-bd);
    }

    .att-dash-legend-swatch.is-today {
        background: #f8fafc;
        border: 2px solid #185FA5;
    }

.att-dash-legend-hint {
    margin-left: auto;
    font-style: italic;
    color: #9ca3af;
}

.att-stream-prompt {
    padding: 24px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    text-align: center;
}

    .att-stream-prompt h3 {
        margin: 0 0 8px;
        color: #1a2332;
    }

    .att-stream-prompt p {
        margin: 0 0 12px;
        color: #475569;
    }

.att-stream-prompt-list {
    display: inline-block;
    text-align: left;
    margin: 0;
    padding-left: 20px;
    color: #1a2332;
}

/* Mobile */
@media (max-width: 900px) {
    .att-dash {
        padding: 12px;
    }

    .att-dash-stats {
        grid-template-columns: 1fr;
    }

    .att-dash-controls {
        width: 100%;
    }
}

/* Clickable row label — only on data rows, not the header */
.att-dash-row-label {
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    transition: background 120ms ease;
    color: inherit;
}

    .att-dash-row-label:hover,
    .att-dash-row-label:focus-visible {
        background: rgba(0, 131, 143, 0.08);
        outline: none;
    }

.att-dash-row-label-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.att-dash-row-label-arrow {
    flex: 0 0 auto;
    color: #94a3b8;
    font-size: 14px;
    opacity: 0;
    transform: translateX(-2px);
    transition: opacity 120ms ease, transform 120ms ease, color 120ms ease;
}

.att-dash-row-label:hover .att-dash-row-label-arrow,
.att-dash-row-label:focus-visible .att-dash-row-label-arrow {
    opacity: 1;
    transform: translateX(0);
    color: #00838f;
}

/* ═══ Spinner ════════════════════════════════════════════════════════════ */
.att-spinner-sm {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: white;
    border-radius: 50%;
    animation: att-spin .7s linear infinite;
    display: inline-block;
}

@keyframes att-spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════════════════════
   Mobile / narrow viewport overrides
   Breakpoint at 900px to match IsMobile detection in the .razor.cs
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {

    /* ── Welcome bar — stack vertically ─────────────────────────────────── */
    .att-welcome-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }

    .att-welcome-title {
        white-space: normal; /* let the title wrap if it has to */
        font-size: 1rem;
    }

    .att-welcome-subtitle {
        font-size: 0.78rem;
    }

    .att-welcome-right {
        flex-wrap: wrap;
        gap: 8px;
        align-items: stretch;
        width: 100%;
    }

    .att-welcome-field {
        flex: 1 1 100%; /* one field per row on phone */
        min-width: 0;
    }

        .att-welcome-field .att-select {
            width: 100%;
            min-width: 0; /* override desktop's min-width: 200px */
        }

    .att-date-nav {
        width: 100%;
        justify-content: space-between;
    }

    .att-date-label {
        flex: 1;
        min-width: 0;
    }

    /* ── Body — let the page flow naturally on mobile ────────────────────── */
    .att-body {
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    .att-roster-mobile,
    .att-roster-mobile .tg-panel,
    .att-roster-mobile .tg-table-wrap {
        height: auto;
        max-height: none;
        overflow-y: visible;
    }

    /* ── Progress bar — allow wrap if stats are long ─────────────────────── */
    .att-progress-bar {
        flex-wrap: wrap;
        padding: 6px 12px;
    }

    /* ── Toolbar — tighter on phones ─────────────────────────────────────── */
    .att-toolbar {
        padding: 8px;
        gap: 6px;
    }

    /* ── Modal — fits on phones, tabs scroll horizontally if needed ──────── */
    .att-modal {
        max-height: 92vh;
        margin: 8px;
    }

    .att-modal-tabs {
        overflow-x: auto;
    }

    .att-modal-tab {
        white-space: nowrap;
        padding: 10px 14px;
        font-size: 12px;
    }

}
