:root {
    --brand: #4f46e5;
    --brand-dark: #4338ca;
    --brand-light: #e0e7ff;
    --bg: #f0f2f5;
    --text: #222;
    --muted: #666;
    --border: #e0e0ff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; }

.impersonation-banner {
    background: #fb923c;
    color: #431407;
    text-align: center;
    padding: 8px 16px;
    font-size: 0.85rem;
}

.impersonation-banner a {
    color: #431407;
    font-weight: 700;
    text-decoration: underline;
    margin-left: 10px;
}
a:hover { color: var(--brand-dark); }

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    row-gap: 8px;
    background: white;
    padding: 14px 28px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.site-header .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--brand);
    font-size: 1.1rem;
    white-space: nowrap;
}

.site-header .brand .logo { font-size: 1.6rem; }

.site-header nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 20px;
    font-size: 0.9rem;
}

.site-header nav a { color: var(--muted); white-space: nowrap; }
.site-header nav a:hover { color: var(--brand); }

.site-header .user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.85rem;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .site-header { padding: 12px 16px; }
    .site-header .brand { font-size: 1rem; }
    .site-header .brand .logo { font-size: 1.4rem; }
}

.page {
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 20px 60px;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.8rem;
    margin-bottom: 16px;
}

.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--brand); }
.breadcrumb-sep { color: #ccc; }
.breadcrumb-current { color: var(--text); font-weight: 600; }

.card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    padding: 28px;
    margin-bottom: 20px;
}

.badge {
    display: inline-block;
    background: var(--brand-light);
    color: var(--brand);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: 0.04em;
}

.badge.locked { background: #f1f1f1; color: #999; }
.badge.completed { background: #dcfce7; color: #16a34a; }
.badge.in_progress { background: #fef9c3; color: #a16207; }
.badge.not_started { background: #f1f1f1; color: #888; }
.badge.complete { background: #dcfce7; color: #16a34a; }
.badge.incomplete { background: #fee2e2; color: #dc2626; }
.badge.thumbs_up { background: #dcfce7; color: #16a34a; }
.badge.neutral { background: #fef9c3; color: #a16207; }
.badge.thumbs_down { background: #fee2e2; color: #dc2626; }
.badge.absent { background: #e5e7eb; color: #374151; }

button, .btn {
    display: inline-block;
    padding: 12px 22px;
    background: var(--brand);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s;
}

button:hover, .btn:hover { background: var(--brand-dark); color: white; }

select, input[type="text"], input[type="file"] {
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 0.9rem;
    color: var(--text);
    background: white;
    outline: none;
}

select:focus, input:focus { border-color: var(--brand); }

.progress-bar {
    background: #eee;
    border-radius: 8px;
    height: 8px;
    overflow: hidden;
    margin: 8px 0 4px;
}

.progress-bar-fill {
    background: var(--brand);
    height: 100%;
}

.lesson-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f1f1f1;
}

.lesson-row:last-child { border-bottom: none; }

.lesson-row-main, .lesson-row-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.lesson-row-main { flex: 1; }
.lesson-row-actions { flex-shrink: 0; }

.lesson-row.current-week {
    background: var(--brand-light);
    margin: 0 -28px;
    padding-left: 28px;
    padding-right: 28px;
    border-radius: 8px;
}

.link-button {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    color: var(--text);
    font: inherit;
    cursor: pointer;
    text-align: left;
}

.link-button:hover { background: none; color: var(--brand); text-decoration: underline; }

.lesson-table {
    width: 100%;
    border-collapse: collapse;
}

.lesson-table th {
    text-align: left;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 6px 10px;
    border-bottom: 2px solid #eee;
    white-space: nowrap;
}

.lesson-table td {
    padding: 10px;
    border-bottom: 1px solid #f1f1f1;
    vertical-align: middle;
}

.lesson-table tbody tr:last-child td { border-bottom: none; }
.lesson-table-empty { color: #ccc; }

.btn-small {
    display: inline-block;
    padding: 5px 12px;
    font-size: 0.75rem;
    border-radius: 8px;
    background: var(--brand-light);
    color: var(--brand);
    text-decoration: none;
    white-space: nowrap;
}

.btn-small:hover { background: var(--brand); color: white; }

.attendance-row {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 12px 0; border-bottom: 1px solid #f1f1f1;
}
.attendance-row:last-child { border-bottom: none; }
.attendance-student-name { flex: 0 0 140px; font-weight: 600; }
.attendance-options { display: flex; gap: 6px; flex-wrap: wrap; }
.attendance-option { display: inline-flex; cursor: pointer; }
.attendance-option input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.attendance-option span {
    padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border);
    font-size: 0.8rem; color: #666; background: white; white-space: nowrap; user-select: none;
}
.attendance-option.opt-thumbs_up input:checked + span { background: #16a34a; color: white; border-color: #16a34a; }
.attendance-option.opt-neutral input:checked + span { background: #a16207; color: white; border-color: #a16207; }
.attendance-option.opt-thumbs_down input:checked + span { background: #dc2626; color: white; border-color: #dc2626; }
.attendance-option.opt-absent input:checked + span { background: #374151; color: white; border-color: #374151; }
.attendance-note {
    flex: 1; min-width: 160px; padding: 7px 10px; border: 2px solid var(--border);
    border-radius: 8px; font-size: 0.82rem; color: var(--text); font-family: inherit;
}
.attendance-note:focus { border-color: var(--brand); outline: none; }

.attendance-grid-wrap { overflow-x: auto; }
.attendance-grid-table { border-collapse: collapse; width: 100%; }
.attendance-grid-table th, .attendance-grid-table td {
    padding: 8px 12px; text-align: center; font-size: 0.82rem;
    border-bottom: 1px solid #f1f1f1; white-space: nowrap;
}
.attendance-grid-table th { color: #999; font-weight: 600; font-size: 0.78rem; }
.attendance-grid-table .sticky-col {
    position: sticky; left: 0; background: white; text-align: left; z-index: 1;
}
.attendance-cell { font-size: 1rem; display: inline-block; padding: 2px 6px; border-radius: 6px; }
.attendance-cell-empty { color: #e5e7eb; }
.attendance-cell-has-note { background: #fef9c3; box-shadow: 0 0 0 1px #fde68a; cursor: help; position: relative; }

/* Custom tooltip via data-note — instant on hover, unlike the browser's
   native title-attribute tooltip which imposes its own ~1.5s delay. */
.attendance-cell-has-note::after {
    content: attr(data-note);
    position: absolute;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    line-height: 1.4;
    white-space: normal;
    width: max-content;
    max-width: 200px;
    text-align: left;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.08s ease;
    pointer-events: none;
    z-index: 20;
}
.attendance-cell-has-note:hover::after { opacity: 1; visibility: visible; }

.unit-teaser {
    opacity: 0.55;
    filter: grayscale(1);
}

.flash {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.flash.success { background: #dcfce7; color: #16a34a; }
.flash.warning { background: #fef9c3; color: #a16207; }
.flash.error { background: #fee2e2; color: #dc2626; }

table.roster-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

table.roster-table th, table.roster-table td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid #f1f1f1;
}

table.roster-table select { font-size: 0.8rem; padding: 6px 8px; }

.calendar-scroll { flex: 1; min-width: 260px; }

.calendar-header, .calendar-body { display: flex; }

.calendar-gutter { width: 36px; flex-shrink: 0; }

.calendar-day-label {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    padding-bottom: 8px;
    border-bottom: 2px solid #eee;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.calendar-day-label:hover { color: var(--brand); border-bottom-color: var(--brand); }

.calendar-hour-mark {
    position: absolute;
    right: 8px;
    font-size: 0.7rem;
    color: var(--muted);
    transform: translateY(-50%);
}

.calendar-day-col {
    flex: 1;
    min-width: 0;
    position: relative;
    border-left: 1px solid #f1f1f1;
}

.calendar-hour-line {
    position: absolute;
    left: 0;
    right: 0;
    border-top: 1px solid #f5f5f5;
}

.cal-block {
    position: absolute;
    left: 2px;
    right: 2px;
    overflow: hidden;
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 0.7rem;
    line-height: 1.25;
    background: var(--brand-light);
    color: var(--brand);
    text-decoration: none;
    display: block;
    border: 1px solid rgba(79, 70, 229, 0.15);
    z-index: 2;
}

.cal-block:hover { border-color: var(--brand); color: var(--brand); }

.cal-block-crowded { padding: 3px 4px; font-size: 0.62rem; line-height: 1.15; }

.cal-block-unassigned { background: #fee2e2; color: #dc2626; border-color: rgba(220, 38, 38, 0.15); }
.cal-block-online { background: #dcfce7; color: #16a34a; border-color: rgba(22, 163, 74, 0.15); }

.cal-block-title,
.cal-block-time,
.cal-block-instructor {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-block-title { font-weight: 700; }
.cal-block-time, .cal-block-instructor { opacity: 0.85; }
.cal-block-pacing { opacity: 0.75; font-style: italic; }

.cal-unavailable-stripe {
    position: absolute;
    left: 0; right: 0;
    pointer-events: none;
    z-index: 1;
    background-color: rgba(220, 38, 38, 0.06);
    background-image: repeating-linear-gradient(
        135deg,
        rgba(220, 38, 38, 0.14), rgba(220, 38, 38, 0.14) 6px,
        transparent 6px, transparent 14px
    );
}

.instructor-sidebar { width: 190px; flex-shrink: 0; }

.instructor-card {
    cursor: grab;
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 10px; margin-bottom: 6px;
    background: var(--brand-light); border: 1px solid rgba(79, 70, 229, 0.15);
    border-radius: 6px; font-size: 0.8rem;
}
.instructor-card.dragging { opacity: 0.4; }
.instructor-card-name { text-decoration: underline; text-decoration-color: transparent; }
.instructor-card:hover .instructor-card-name { text-decoration-color: currentColor; }
.instructor-card.instructor-card-availability-active {
    background: var(--brand); border-color: var(--brand-dark); color: #fff;
}
.instructor-card.instructor-card-availability-active .instructor-card-load {
    background: rgba(255, 255, 255, 0.25); color: #fff;
}
.instructor-card.instructor-card-availability-active .instructor-card-load-active { background: #fff; color: var(--brand); }
.instructor-card-loads { display: flex; gap: 3px; }
.instructor-card-load {
    background: #d1d5db; color: #4b5563; border-radius: 10px;
    font-size: 0.65rem; padding: 1px 6px; min-width: 1.1em; text-align: center;
}
.instructor-card-load-active { background: var(--brand); color: #fff; }
.instructor-card-filter-btn {
    background: #fff; color: var(--brand); border-radius: 10px;
    font-size: 0.75rem; padding: 2px 7px; text-decoration: none;
    border: 1px solid rgba(79, 70, 229, 0.25); flex-shrink: 0;
}
.instructor-card-filter-btn:hover { background: var(--brand); color: #fff; }
.instructor-card.instructor-card-availability-active .instructor-card-filter-btn {
    background: rgba(255, 255, 255, 0.25); color: #fff; border-color: rgba(255, 255, 255, 0.4);
}

.cal-block-drop-ok { outline: 2px dashed #16a34a; outline-offset: 1px; }
.cal-block-drop-conflict { outline: 2px dashed #dc2626; outline-offset: 1px; }
.cal-block-drop-blocked { outline: 3px solid #7f1d1d; outline-offset: 1px; cursor: not-allowed; }
.cal-block-drop-warn { outline: 2px dashed #d97706; outline-offset: 1px; }

.badge-flag {
    background: #fee2e2; color: #dc2626; border-radius: 4px;
    font-size: 0.7rem; padding: 2px 6px; margin-right: 6px; white-space: nowrap;
}


[id^="class-"]:target {
    animation: target-flash 4s ease;
    border-radius: 10px;
}

@keyframes target-flash {
    0% { background: #fb923c; }
    20% { background: #fb923c; }
    100% { background: transparent; }
}

/* undo_toast.js -- marks an item pending while its grace period counts down */
.pending-delete { opacity: 0.35; pointer-events: none; }
