/*
 * TOT timetable screens (admin week grid, teacher today/week, family timetable).
 * Plain CSS copy of the approved prototype look (/workspace/hol-hub/tot/prototype:
 * zinc neutrals, 16px cards, pills, segmented controls, colour-coded calendar
 * blocks). The timetable uses the prototype's neutral indigo brand colour.
 */
:root {
    --tt-brand: #4f46e5;
    --tt-brand-soft: color-mix(in oklab, var(--tt-brand) 9%, white);
    --tt-border: #e4e4e7;
    --tt-border-soft: #f4f4f5;
    --tt-text: #18181b;
    --tt-muted: #71717a;
    --tt-card: #ffffff;
    --tt-bg: #fafafa;
    --tt-hour: 56px;
}
.dark {
    --tt-brand-soft: color-mix(in oklab, var(--tt-brand) 14%, #18181b);
    --tt-border: #27272a;
    --tt-border-soft: #27272a;
    --tt-text: #f4f4f5;
    --tt-muted: #a1a1aa;
    --tt-card: #18181b;
    --tt-bg: #09090b;
}

.tt-page { margin: 0; min-height: 100vh; background: var(--tt-bg); color: var(--tt-text); font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
.tt-muted { color: var(--tt-muted); }
.tt-small { font-size: 12px; }
.tt-h1 { margin: 0 0 .25rem; font-size: 24px; font-weight: 600; letter-spacing: -.01em; }
.tt-h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.tt-stack > * + * { margin-top: 1rem; }

/* Cards */
.tt-card { border: 1px solid var(--tt-border); border-radius: 16px; background: var(--tt-card); box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .04); }
.dark .tt-card { box-shadow: none; }
.tt-card-h { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1.1rem 1.25rem .6rem; }
.tt-card-b { padding: 0 1.25rem 1.1rem; }
.tt-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; }
.tt-kpi { padding: 1rem; }
.tt-kpi-v { margin-top: .25rem; font-size: 20px; font-weight: 600; }

/* Toolbar, buttons, segmented control, inputs */
.tt-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.tt-toolbar .tt-grow { flex: 1; }
.tt-btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; height: 34px; padding: 0 .8rem; border-radius: 12px; border: 1px solid var(--tt-border); background: var(--tt-card); color: var(--tt-text); font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap; cursor: pointer; }
.tt-btn:hover { filter: brightness(.97); }
.tt-btn-sm { height: 30px; padding: 0 .6rem; border-radius: 10px; font-size: 12.5px; }
.tt-btn-primary { border-color: transparent; background: var(--tt-brand); color: #fff; box-shadow: 0 1px 2px color-mix(in oklab, var(--tt-brand) 30%, transparent); }
.tt-btn-primary:hover { filter: brightness(1.08); }
.tt-seg { display: inline-flex; padding: 3px; border-radius: 12px; background: #f4f4f5; }
.dark .tt-seg { background: #27272a; }
.tt-seg > * { padding: .3rem .75rem; border: 0; border-radius: 9px; background: transparent; color: var(--tt-muted); font-size: 13px; font-weight: 500; text-decoration: none; cursor: pointer; }
.tt-seg > .on { background: var(--tt-card); color: var(--tt-text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.tt-select { height: 34px; padding: 0 2rem 0 .7rem; border: 1px solid var(--tt-border); border-radius: 12px; background-color: var(--tt-card); color: var(--tt-text); font-size: 13px; }
.tt-week-label { font-size: 14px; font-weight: 600; }

/* Pills */
.tt-pill { display: inline-flex; align-items: center; gap: .35rem; padding: .1rem .5rem; border-radius: 999px; font-size: 11.5px; font-weight: 500; white-space: nowrap; box-shadow: inset 0 0 0 1px currentColor; box-shadow: inset 0 0 0 1px color-mix(in oklab, currentColor 18%, transparent); }
.tt-pill::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.tt-p-green { background: #ecfdf5; color: #047857; }
.tt-p-amber { background: #fffbeb; color: #b45309; }
.tt-p-red { background: #fff1f2; color: #be123c; }
.tt-p-blue { background: #f0f9ff; color: #0369a1; }
.tt-p-gray { background: #f4f4f5; color: #52525b; }
.dark .tt-p-green { background: rgb(16 185 129 / .1); color: #6ee7b7; }
.dark .tt-p-amber { background: rgb(245 158 11 / .1); color: #fcd34d; }
.dark .tt-p-red { background: rgb(244 63 94 / .1); color: #fda4af; }
.dark .tt-p-blue { background: rgb(14 165 233 / .1); color: #7dd3fc; }
.dark .tt-p-gray { background: #27272a; color: #d4d4d8; }

/* Alerts */
.tt-alert { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; padding: .8rem 1rem; border-radius: 16px; border: 1px solid #fecdd3; background: #fff1f2; color: #881337; font-size: 13.5px; }
.tt-alert-amber { border-color: #fde68a; background: #fffbeb; color: #78350f; }
.dark .tt-alert { border-color: rgb(244 63 94 / .2); background: rgb(244 63 94 / .1); color: #fecdd3; }
.dark .tt-alert-amber { border-color: rgb(245 158 11 / .2); background: rgb(245 158 11 / .1); color: #fde68a; }

/* Week / day grid */
.tt-cal { overflow-x: auto; }
.tt-cal-inner { min-width: 760px; }
.tt-cal-day1 .tt-cal-inner { min-width: 0; }
.tt-cal-head, .tt-cal-body { display: grid; grid-template-columns: 64px repeat(var(--tt-days, 7), minmax(110px, 1fr)); }
.tt-cal-head { border-bottom: 1px solid var(--tt-border); }
.tt-cal-dh { padding: .6rem .75rem; border-left: 1px solid var(--tt-border-soft); }
.tt-cal-dn { font-size: 11px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--tt-muted); }
.tt-cal-dd { margin-top: 2px; font-size: 18px; font-weight: 600; }
.tt-cal-today .tt-cal-dn, .tt-cal-today .tt-cal-dd { color: var(--tt-brand); }
.tt-cal-today .tt-cal-dd span { display: inline-flex; width: 32px; height: 32px; align-items: center; justify-content: center; border-radius: 999px; background: var(--tt-brand); color: #fff; font-size: 16px; }
.tt-cal-scroll { max-height: 640px; overflow-y: auto; }
.tt-cal-body { position: relative; }
.tt-cal-hours { position: relative; }
.tt-cal-hl { position: absolute; right: .5rem; transform: translateY(-.5rem); font-size: 11px; color: var(--tt-muted); }
.tt-cal-col { position: relative; border-left: 1px solid var(--tt-border-soft); }
.tt-cal-col.tt-cal-today { background: color-mix(in oklab, var(--tt-brand) 3%, transparent); }
.tt-cal-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--tt-border-soft); }
.tt-cal-now { position: absolute; left: 0; right: 0; z-index: 10; display: flex; align-items: center; pointer-events: none; }
.tt-cal-now::before { content: ""; width: 10px; height: 10px; margin-left: -5px; border-radius: 999px; background: #f43f5e; }
.tt-cal-now::after { content: ""; flex: 1; height: 2px; background: #f43f5e; }
.tt-ev { position: absolute; overflow: hidden; display: block; padding: .2rem .5rem; border-radius: 8px; border-left: 3px solid; text-align: left; text-decoration: none; transition: transform .12s, box-shadow .12s; }
.tt-ev:hover { z-index: 5; transform: translateY(-1px); box-shadow: 0 6px 16px -6px rgb(0 0 0 / .25); }
.tt-ev-t { overflow: hidden; font-size: 12px; font-weight: 600; line-height: 1.25; white-space: nowrap; text-overflow: ellipsis; }
.tt-ev-s { overflow: hidden; font-size: 11px; opacity: .75; white-space: nowrap; text-overflow: ellipsis; }
.tt-ev-off { opacity: .55; text-decoration: line-through; }

/* Colour kinds (prototype: brand = academic, emerald = Quran, sky, fuchsia, amber, rose = clash) */
.tt-k-brand { border-color: var(--tt-brand); background: var(--tt-brand-soft); color: #1e1b4b; }
.tt-k-emerald { border-color: #10b981; background: #ecfdf5; color: #064e3b; }
.tt-k-sky { border-color: #0ea5e9; background: #f0f9ff; color: #0c4a6e; }
.tt-k-fuchsia { border-color: #d946ef; background: #fdf4ff; color: #701a75; }
.tt-k-amber { border-color: #f59e0b; background: #fffbeb; color: #78350f; }
.tt-k-rose { border-color: #f43f5e; background: #fff1f2; color: #881337; }
.tt-k-gray { border-color: #a1a1aa; background: #f4f4f5; color: #3f3f46; }
.dark .tt-k-brand { color: #e0e7ff; }
.dark .tt-k-emerald { background: rgb(16 185 129 / .15); color: #d1fae5; }
.dark .tt-k-sky { background: rgb(14 165 233 / .15); color: #e0f2fe; }
.dark .tt-k-fuchsia { background: rgb(217 70 239 / .15); color: #fae8ff; }
.dark .tt-k-amber { background: rgb(245 158 11 / .15); color: #fef3c7; }
.dark .tt-k-rose { background: rgb(244 63 94 / .15); color: #ffe4e6; }
.dark .tt-k-gray { background: #27272a; color: #e4e4e7; }
.tt-legend { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1rem; font-size: 12px; color: var(--tt-muted); }
.tt-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.tt-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; border-left: 3px solid; }

/* Session list rows (today / family timetable) */
.tt-day { margin-bottom: 1.25rem; }
.tt-day-h { margin: 0 0 .5rem; font-size: 13px; font-weight: 600; color: var(--tt-muted); }
.tt-row { display: flex; align-items: center; gap: 1rem; padding: .9rem 1rem; border: 1px solid var(--tt-border); border-radius: 16px; background: var(--tt-card); }
.tt-row + .tt-row { margin-top: .5rem; }
.tt-row-next { box-shadow: 0 0 0 2px color-mix(in oklab, var(--tt-brand) 35%, transparent); }
.tt-row-time { width: 92px; flex-shrink: 0; }
.tt-row-time b { display: block; font-size: 14px; }
.tt-row-bar { width: 4px; height: 40px; flex-shrink: 0; border-radius: 999px; border-left: 4px solid; }
.tt-row-main { min-width: 0; flex: 1; }
.tt-row-title { overflow: hidden; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.tt-row-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .4rem; }
.tt-empty { padding: .8rem 1rem; border: 1px dashed var(--tt-border); border-radius: 16px; font-size: 13px; color: var(--tt-muted); }
.tt-layout { display: grid; gap: 1.25rem; }
@media (min-width: 1024px) { .tt-layout { grid-template-columns: minmax(0, 1fr) 320px; } }

.tt-soon { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 1rem; }
.tt-soon-card { max-width: 32rem; padding: 2rem; text-align: center; }

@media (max-width: 640px) {
    .tt-row { flex-wrap: wrap; }
    .tt-row-actions { width: 100%; justify-content: flex-start; }
}

/* Family timetable: day label beside the day's classes (prototype student-timetable) */
@media (min-width: 768px) {
    .tt-day-grid { display: grid; grid-template-columns: 120px 1fr; gap: .75rem; }
    .tt-day-grid .tt-day-h { padding-top: .9rem; }
}
.tt-day-today { color: var(--tt-brand); }

/* Admin timetable: filters, side panel, request/leave lists */
.tt-filters { display: flex; flex-wrap: wrap; gap: .5rem; }
.tt-panel { padding: 1.1rem 1.25rem; }
.tt-panel dl { display: grid; grid-template-columns: 110px 1fr; gap: .35rem .75rem; margin: .75rem 0 0; font-size: 13px; }
.tt-panel dt { color: var(--tt-muted); }
.tt-panel dd { margin: 0; overflow-wrap: anywhere; }
.tt-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1rem; }
.tt-list-item { padding: .55rem 0; border-top: 1px solid var(--tt-border-soft); font-size: 13px; }
.tt-list-item:first-child { border-top: 0; }

/* Keep the calendar inside its column and all controls usable by keyboard. */
.tt-layout > *, .tt-day-grid > * { min-width: 0; }
.tt-btn:focus-visible, .tt-cal-dh:focus-visible, .tt-ev:focus-visible { outline: 2px solid var(--tt-brand); outline-offset: 2px; }
.tt-cal-dh { text-align: left; }
.tt-select { max-width: 100%; }

.tt-next-card { overflow: hidden; }
.tt-next-hero { display: grid; gap: .65rem; padding: 1.25rem; background: linear-gradient(135deg, var(--tt-brand), color-mix(in oklab, var(--tt-brand) 70%, #18181b)); color: white; }
.tt-next-hero .tt-h2 { font-size: 18px; }
.tt-next-hero .tt-btn { width: 100%; background: white; color: #312e81; }
.tt-next-footer { padding: 1rem 1.25rem; color: var(--tt-muted); }

/* Home dashboards (parent, student, admin today list) */
.tt-home-hero { margin-bottom: 1.25rem; }
.tt-kids { display: flex; gap: .75rem; overflow-x: auto; margin: 0 0 1.25rem; padding-bottom: .35rem; scroll-snap-type: x mandatory; }
.tt-kid { min-width: 230px; flex: 1 0 230px; scroll-snap-align: start; padding: 1rem; }
.tt-kid-top { display: flex; align-items: center; gap: .75rem; }
.tt-kid-stats { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .9rem; }
.tt-stat { border-radius: 12px; background: var(--tt-bg); padding: .55rem .7rem; }
.tt-stat-v { margin-top: .15rem; font-size: 13px; font-weight: 600; }
.tt-avatar { display: inline-flex; width: 44px; height: 44px; flex-shrink: 0; align-items: center; justify-content: center; border-radius: 999px; font-size: 13px; font-weight: 600; }
.tt-av-sm { width: 32px; height: 32px; font-size: 11px; }
.tt-av-violet { background: #ede9fe; color: #6d28d9; }
.tt-av-amber { background: #fef3c7; color: #92400e; }
.tt-av-fuchsia { background: #fae8ff; color: #a21caf; }
.tt-av-sky { background: #e0f2fe; color: #0369a1; }
.tt-av-emerald { background: #d1fae5; color: #047857; }
.dark .tt-av-violet { background: rgb(139 92 246 / .18); color: #ddd6fe; }
.dark .tt-av-amber { background: rgb(245 158 11 / .18); color: #fde68a; }
.dark .tt-av-fuchsia { background: rgb(217 70 239 / .18); color: #f5d0fe; }
.dark .tt-av-sky { background: rgb(14 165 233 / .18); color: #bae6fd; }
.dark .tt-av-emerald { background: rgb(16 185 129 / .18); color: #a7f3d0; }
.tt-split { display: grid; gap: 1.25rem; }
.tt-next-row { display: flex; align-items: center; gap: .75rem; padding: .75rem 0; border-top: 1px solid var(--tt-border-soft); }
.tt-next-row:first-child { border-top: 0; }
.tt-next-when { min-width: 4.5rem; text-align: right; }
.tt-next-when b { display: block; font-size: 14px; }
.tt-strong { font-weight: 600; }
.tt-badge { display: inline-flex; align-items: center; padding: .1rem .5rem; border-radius: 999px; background: #fff1f2; color: #be123c; font-size: 12px; font-weight: 600; }
.dark .tt-badge { background: rgb(244 63 94 / .15); color: #fda4af; }
@media (min-width: 1024px) {
    .tt-kids { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); overflow: visible; }
    .tt-kid { min-width: 0; }
    .tt-split { grid-template-columns: minmax(0, 1.4fr) minmax(240px, .8fr); }
}
@media (max-width: 640px) {
    .tt-next-row { flex-wrap: wrap; }
    .tt-next-row .tt-row-actions, .tt-next-row .tt-pill { margin-left: 0; }
    .tt-h1, .fi-header-heading { font-size: 1.35rem; }
}
