/* ==========================================================================
   JNV Timetable — shared design system
   Built on Bootstrap 5.3. Every page uses these tokens and components.
   ========================================================================== */

:root {
    --tt-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --tt-primary: #059669;
    --tt-primary-hover: #047857;
    --tt-primary-soft: #ecfdf5;
    --tt-primary-rgb: 5, 150, 105;

    --tt-success: #059669;
    --tt-success-soft: #ecfdf5;
    --tt-warning: #d97706;
    --tt-warning-soft: #fffbeb;
    --tt-danger: #dc2626;
    --tt-danger-soft: #fef2f2;
    --tt-info: #0284c7;
    --tt-info-soft: #f0f9ff;

    --tt-bg: #f4f6fb;
    --tt-surface: #ffffff;
    --tt-surface-2: #f8fafc;
    --tt-border: #e5e7eb;
    --tt-border-strong: #d1d5db;
    --tt-text: #111827;
    --tt-text-2: #374151;
    --tt-muted: #6b7280;

    --tt-sidebar-bg: #052e22;
    --tt-sidebar-text: #9fc5b6;
    --tt-sidebar-hover: rgba(167, 243, 208, .08);
    --tt-sidebar-active: rgba(16, 185, 129, .22);
    --tt-sidebar-width: 260px;
    --tt-sidebar-collapsed: 76px;
    --tt-topbar-height: 64px;

    --tt-radius-sm: 8px;
    --tt-radius: 12px;
    --tt-radius-lg: 16px;
    --tt-shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
    --tt-shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .04);
    --tt-shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
    --tt-focus: 0 0 0 .2rem rgba(var(--tt-primary-rgb), .18);

    /* Bootstrap bridge */
    --bs-body-font-family: var(--tt-font);
    --bs-body-color: var(--tt-text);
    --bs-body-bg: var(--tt-bg);
    --bs-border-color: var(--tt-border);
    --bs-primary: var(--tt-primary);
    --bs-primary-rgb: var(--tt-primary-rgb);
    --bs-link-color: var(--tt-primary);
    --bs-link-color-rgb: var(--tt-primary-rgb);
    --bs-link-hover-color: var(--tt-primary-hover);
    --bs-border-radius: var(--tt-radius-sm);
    --bs-secondary-color: var(--tt-muted);
}

/* ---------- Base ---------- */
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--tt-font);
    background: var(--tt-bg);
    color: var(--tt-text);
    font-size: .9375rem;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6 { color: var(--tt-text); font-weight: 650; letter-spacing: -.01em; }
a { text-decoration: none; }
.text-muted { color: var(--tt-muted) !important; }
.fw-semibold { font-weight: 600 !important; }
.small-caps { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; color: var(--tt-muted); }
::selection { background: rgba(var(--tt-primary-rgb), .18); }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 1040;
    width: var(--tt-sidebar-width);
    background: var(--tt-sidebar-bg);
    color: var(--tt-sidebar-text);
    display: flex; flex-direction: column;
    transition: width .2s ease, transform .25s ease;
}
.sidebar-brand {
    height: var(--tt-topbar-height);
    display: flex; align-items: center; gap: .75rem;
    padding: 0 1.25rem;
    color: #fff; font-weight: 700; font-size: 1.05rem; letter-spacing: .01em;
    border-bottom: 1px solid rgba(148, 163, 184, .12);
    white-space: nowrap; overflow: hidden;
}
.sidebar-brand:hover { color: #fff; }
.sidebar-brand img { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; flex-shrink: 0; background: #fff; }
.sidebar-brand small { display: block; font-size: .7rem; font-weight: 500; color: var(--tt-sidebar-text); letter-spacing: .02em; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 1rem .75rem; scrollbar-width: thin; }
.sidebar-heading {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .09em; font-weight: 600;
    color: #64748b; padding: .9rem .75rem .4rem; white-space: nowrap;
}
.sidebar-link {
    display: flex; align-items: center; gap: .8rem;
    padding: .6rem .75rem; margin-bottom: 2px;
    border-radius: 10px;
    color: var(--tt-sidebar-text); font-weight: 500; font-size: .9rem;
    white-space: nowrap; transition: background .15s, color .15s;
}
.sidebar-link i { width: 20px; text-align: center; font-size: 1rem; flex-shrink: 0; opacity: .9; }
.sidebar-link:hover { background: var(--tt-sidebar-hover); color: #e2e8f0; }
.sidebar-link.active { background: var(--tt-sidebar-active); color: #fff; }
.sidebar-link.active i { color: #6ee7b7; }

.sidebar-footer { padding: .9rem; border-top: 1px solid rgba(148, 163, 184, .12); }
.sidebar-user { display: flex; align-items: center; gap: .7rem; color: #e2e8f0; white-space: nowrap; overflow: hidden; }
.sidebar-user .meta { line-height: 1.25; min-width: 0; }
.sidebar-user .meta strong { display: block; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .meta span { font-size: .72rem; color: var(--tt-sidebar-text); }

.app-main {
    flex: 1; min-width: 0;
    margin-left: var(--tt-sidebar-width);
    display: flex; flex-direction: column;
    transition: margin-left .2s ease;
}

.app-topbar {
    position: sticky; top: 0; z-index: 1030;
    height: var(--tt-topbar-height);
    display: flex; align-items: center; gap: 1rem;
    padding: 0 1.5rem;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--tt-border);
}
.topbar-title { font-size: 1rem; font-weight: 600; margin: 0; color: var(--tt-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
    width: 38px; height: 38px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px; border: 1px solid var(--tt-border);
    background: var(--tt-surface); color: var(--tt-text-2);
    transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--tt-surface-2); border-color: var(--tt-border-strong); color: var(--tt-text); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--tt-focus); }

.user-menu-btn {
    display: inline-flex; align-items: center; gap: .55rem;
    padding: .3rem .6rem .3rem .3rem; border-radius: 999px;
    border: 1px solid var(--tt-border); background: var(--tt-surface); color: var(--tt-text);
    font-weight: 500; font-size: .875rem;
}
.user-menu-btn:hover { background: var(--tt-surface-2); }
.user-menu-btn::after { display: none; }

.avatar {
    width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: .8rem; color: #fff;
    background: linear-gradient(135deg, #10b981, #0d9488);
}
.avatar-lg { width: 44px; height: 44px; font-size: 1rem; }
.avatar-soft { background: var(--tt-primary-soft); color: var(--tt-primary); }

.app-content { flex: 1; padding: 1.75rem 1.5rem 2.5rem; width: 100%; max-width: 1600px; margin: 0 auto; }
.app-footer { padding: 1rem 1.5rem; font-size: .8rem; color: var(--tt-muted); border-top: 1px solid var(--tt-border); background: var(--tt-surface); display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; }
.app-footer a, .auth-powered a, .error-powered a { color: var(--tt-primary); font-weight: 600; text-decoration: none; }
.app-footer a:hover, .auth-powered a:hover, .error-powered a:hover { text-decoration: underline; }
.auth-powered, .error-powered { margin: 2rem 0 0; font-size: .78rem; color: var(--tt-muted); text-align: center; }

/* Collapsed sidebar (desktop) */
@media (min-width: 992px) {
    body.sidebar-collapsed .app-sidebar { width: var(--tt-sidebar-collapsed); }
    body.sidebar-collapsed .app-main { margin-left: var(--tt-sidebar-collapsed); }
    body.sidebar-collapsed .sidebar-brand { padding: 0 1.25rem; }
    body.sidebar-collapsed .sidebar-brand .brand-text,
    body.sidebar-collapsed .sidebar-link span,
    body.sidebar-collapsed .sidebar-heading,
    body.sidebar-collapsed .sidebar-user .meta { display: none; }
    body.sidebar-collapsed .sidebar-link { justify-content: center; padding: .7rem; }
    body.sidebar-collapsed .sidebar-user { justify-content: center; }
}

/* Off-canvas sidebar (mobile/tablet) */
.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); box-shadow: var(--tt-shadow-lg); }
    .app-main { margin-left: 0; }
    body.sidebar-open .app-sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-backdrop {
        display: block; position: fixed; inset: 0; z-index: 1035;
        background: rgba(15, 23, 42, .45);
    }
    body.sidebar-open { overflow: hidden; }
}
@media (max-width: 575.98px) {
    .app-topbar { padding: 0 1rem; gap: .6rem; }
    .app-content { padding: 1.25rem 1rem 2rem; }
    .user-menu-btn .user-name { display: none; }
    .user-menu-btn { padding: .25rem; }
}

/* ---------- Page header ---------- */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.5rem; margin: 0; }
.page-header .page-subtitle { margin: .25rem 0 0; color: var(--tt-muted); font-size: .9rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.breadcrumb { --bs-breadcrumb-divider: "›"; font-size: .8rem; margin-bottom: .35rem; }
.breadcrumb-item a { color: var(--tt-muted); }
.breadcrumb-item a:hover { color: var(--tt-primary); }
.breadcrumb-item.active { color: var(--tt-text-2); }

/* ---------- Cards ---------- */
.card {
    --bs-card-border-color: var(--tt-border);
    --bs-card-border-radius: var(--tt-radius);
    --bs-card-inner-border-radius: calc(var(--tt-radius) - 1px);
    --bs-card-cap-bg: transparent;
    border: 1px solid var(--tt-border);
    border-radius: var(--tt-radius);
    box-shadow: var(--tt-shadow-sm);
    background: var(--tt-surface);
}
.card-header {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap;
    padding: 1rem 1.25rem; background: transparent; border-bottom: 1px solid var(--tt-border);
}
.card-title { font-size: 1rem; font-weight: 600; margin: 0; display: flex; align-items: center; gap: .55rem; }
.card-title .title-icon {
    width: 30px; height: 30px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--tt-primary-soft); color: var(--tt-primary); font-size: .85rem;
}
.card-subtitle { color: var(--tt-muted); font-size: .82rem; margin: .15rem 0 0; }
.card-body { padding: 1.25rem; }
.card-footer { background: var(--tt-surface-2); border-top: 1px solid var(--tt-border); padding: .85rem 1.25rem; }
.card-footer:empty { display: none; }
@media (min-width: 992px) { .sticky-lg-form { position: sticky; top: calc(var(--tt-topbar-height) + 1.25rem); } }

/* ---------- Stat cards ---------- */
.stat-card {
    position: relative; display: flex; align-items: center; gap: 1rem;
    padding: 1.1rem 1.2rem; height: 100%;
    background: var(--tt-surface); border: 1px solid var(--tt-border);
    border-radius: var(--tt-radius); box-shadow: var(--tt-shadow-sm);
    color: inherit; transition: transform .15s, box-shadow .15s, border-color .15s;
}
a.stat-card:hover { transform: translateY(-2px); box-shadow: var(--tt-shadow); border-color: var(--tt-border-strong); color: inherit; }
.stat-icon {
    width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem;
    background: var(--stat-soft, var(--tt-primary-soft)); color: var(--stat-color, var(--tt-primary));
}
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.stat-label { color: var(--tt-muted); font-size: .82rem; font-weight: 500; }
.tone-indigo { --stat-color: #4f46e5; --stat-soft: #eef2ff; }
.tone-green { --stat-color: #059669; --stat-soft: #d1fae5; }
.tone-sky { --stat-color: #0284c7; --stat-soft: #e0f2fe; }
.tone-emerald { --stat-color: #059669; --stat-soft: #d1fae5; }
.tone-amber { --stat-color: #d97706; --stat-soft: #fef3c7; }
.tone-rose { --stat-color: #e11d48; --stat-soft: #ffe4e6; }
.tone-violet { --stat-color: #7c3aed; --stat-soft: #ede9fe; }

/* ---------- Buttons ---------- */
.btn {
    --bs-btn-font-weight: 500;
    --bs-btn-padding-x: .95rem;
    --bs-btn-padding-y: .5rem;
    --bs-btn-font-size: .875rem;
    --bs-btn-border-radius: var(--tt-radius-sm);
    --bs-btn-focus-box-shadow: var(--tt-focus);
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    white-space: nowrap;
}
.btn-sm { --bs-btn-padding-x: .65rem; --bs-btn-padding-y: .32rem; --bs-btn-font-size: .8rem; --bs-btn-border-radius: 7px; }
.btn-lg { --bs-btn-padding-x: 1.25rem; --bs-btn-padding-y: .7rem; --bs-btn-font-size: .95rem; }
.btn-primary {
    --bs-btn-bg: var(--tt-primary); --bs-btn-border-color: var(--tt-primary);
    --bs-btn-hover-bg: var(--tt-primary-hover); --bs-btn-hover-border-color: var(--tt-primary-hover);
    --bs-btn-active-bg: #065f46; --bs-btn-active-border-color: #065f46;
    --bs-btn-disabled-bg: var(--tt-primary); --bs-btn-disabled-border-color: var(--tt-primary);
    box-shadow: 0 1px 2px rgba(var(--tt-primary-rgb), .25);
}
.btn-outline-primary {
    --bs-btn-color: var(--tt-primary); --bs-btn-border-color: rgba(var(--tt-primary-rgb), .35);
    --bs-btn-hover-bg: var(--tt-primary-soft); --bs-btn-hover-color: var(--tt-primary-hover); --bs-btn-hover-border-color: rgba(var(--tt-primary-rgb), .5);
    --bs-btn-active-bg: #d1fae5; --bs-btn-active-color: var(--tt-primary-hover); --bs-btn-active-border-color: rgba(var(--tt-primary-rgb), .5);
}
.btn-light {
    --bs-btn-bg: var(--tt-surface); --bs-btn-border-color: var(--tt-border); --bs-btn-color: var(--tt-text-2);
    --bs-btn-hover-bg: var(--tt-surface-2); --bs-btn-hover-border-color: var(--tt-border-strong); --bs-btn-hover-color: var(--tt-text);
    --bs-btn-active-bg: #f1f5f9; --bs-btn-active-border-color: var(--tt-border-strong);
}
.btn-success { --bs-btn-bg: var(--tt-success); --bs-btn-border-color: var(--tt-success); --bs-btn-hover-bg: #047857; --bs-btn-hover-border-color: #047857; }
.btn-danger { --bs-btn-bg: var(--tt-danger); --bs-btn-border-color: var(--tt-danger); --bs-btn-hover-bg: #b91c1c; --bs-btn-hover-border-color: #b91c1c; }
.btn-soft-danger {
    --bs-btn-color: var(--tt-danger); --bs-btn-bg: transparent; --bs-btn-border-color: transparent;
    --bs-btn-hover-bg: var(--tt-danger-soft); --bs-btn-hover-color: #b91c1c; --bs-btn-hover-border-color: transparent;
    --bs-btn-active-bg: #fee2e2; --bs-btn-active-color: #b91c1c;
}
.btn-soft {
    --bs-btn-color: var(--tt-text-2); --bs-btn-bg: transparent; --bs-btn-border-color: transparent;
    --bs-btn-hover-bg: #f1f5f9; --bs-btn-hover-color: var(--tt-text); --bs-btn-hover-border-color: transparent;
    --bs-btn-active-bg: #e2e8f0;
}
.btn-icon { width: 32px; height: 32px; padding: 0; }
.btn .spinner-border { width: 1rem; height: 1rem; border-width: .15em; }
.btn.is-loading { pointer-events: none; opacity: .8; }

/* ---------- Forms ---------- */
.form-label { font-weight: 550; font-size: .84rem; color: var(--tt-text-2); margin-bottom: .35rem; }
.form-label .req { color: var(--tt-danger); margin-left: 2px; }
.form-control, .form-select {
    border-color: var(--tt-border-strong); border-radius: var(--tt-radius-sm);
    padding: .55rem .8rem; font-size: .9rem; color: var(--tt-text);
    min-height: 40px; box-shadow: var(--tt-shadow-sm);
    transition: border-color .15s, box-shadow .15s;
}
.form-select { padding-right: 2.25rem; }
.form-control-sm, .form-select-sm { min-height: 34px; padding-top: .35rem; padding-bottom: .35rem; font-size: .84rem; }
.form-control:focus, .form-select:focus { border-color: rgba(var(--tt-primary-rgb), .6); box-shadow: var(--tt-focus); }
.form-control::placeholder { color: #9ca3af; }
.form-control:disabled, .form-select:disabled { background-color: #f3f4f6; color: var(--tt-muted); }
.form-text { font-size: .78rem; color: var(--tt-muted); }
.invalid-feedback { font-size: .8rem; }
.form-check-input:checked { background-color: var(--tt-primary); border-color: var(--tt-primary); }
.form-check-input:focus { box-shadow: var(--tt-focus); border-color: rgba(var(--tt-primary-rgb), .6); }
.input-group-text { background: var(--tt-surface-2); border-color: var(--tt-border-strong); color: var(--tt-muted); }
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: #9ca3af; pointer-events: none; font-size: .9rem; }
.input-icon > .form-control { padding-left: 2.3rem; }
.form-actions { display: flex; gap: .5rem; flex-wrap: wrap; padding-top: .5rem; }
.form-section-title { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--tt-muted); margin: 0 0 .75rem; }

/* ---------- Toolbar / search ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; padding: .9rem 1.25rem; border-bottom: 1px solid var(--tt-border); background: var(--tt-surface-2); }
.toolbar .input-icon { flex: 1 1 240px; max-width: 420px; }
.toolbar .form-select { flex: 0 1 220px; width: auto; }
.result-count { font-size: .8rem; color: var(--tt-muted); margin-left: auto; }

/* ---------- Tables ---------- */
.table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: #fafbfc;
    --bs-table-hover-bg: #f8fafc;
    --bs-table-border-color: var(--tt-border);
    margin-bottom: 0; font-size: .875rem; color: var(--tt-text-2);
}
.table > :not(caption) > * > * { padding: .75rem 1rem; vertical-align: middle; }
.table > thead > tr > th {
    background: var(--tt-surface-2); color: var(--tt-muted);
    font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
    border-bottom: 1px solid var(--tt-border); white-space: nowrap;
}
.table > tbody > tr:last-child > * { border-bottom: 0; }
.table td.actions, .table th.actions { text-align: right; white-space: nowrap; width: 1%; }
.table .cell-primary { color: var(--tt-text); font-weight: 600; }
.table .row-index { color: var(--tt-muted); font-variant-numeric: tabular-nums; width: 56px; }
.table-modal > :not(caption) > * > * { padding: .6rem .8rem; }
.entity { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.entity .meta { min-width: 0; line-height: 1.3; }
.entity .meta strong { display: block; color: var(--tt-text); font-weight: 600; }
.entity .meta span { font-size: .8rem; color: var(--tt-muted); }

/* ---------- Badges / chips ---------- */
.badge { font-weight: 600; font-size: .72rem; padding: .35em .65em; border-radius: 999px; letter-spacing: .01em; }
.badge-soft { background: var(--tt-primary-soft); color: var(--tt-primary); }
.badge-soft-success { background: var(--tt-success-soft); color: var(--tt-success); }
.badge-soft-warning { background: var(--tt-warning-soft); color: #b45309; }
.badge-soft-danger { background: var(--tt-danger-soft); color: var(--tt-danger); }
.badge-soft-muted { background: #f1f5f9; color: #475569; }
.badge-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #f1f5f9; color: #334155; border-radius: 6px; font-weight: 600; }
.chip {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .3rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 500;
    background: var(--tt-surface); border: 1px solid var(--tt-border); color: var(--tt-text-2);
}
.chip i { color: var(--tt-primary); }

/* ---------- Progress ---------- */
.progress { --bs-progress-height: 6px; --bs-progress-bg: #eef0f4; --bs-progress-border-radius: 999px; --bs-progress-bar-bg: var(--tt-primary); }
.progress-thin { --bs-progress-height: 4px; }
.load-bar { display: flex; align-items: center; gap: .6rem; min-width: 140px; }
.load-bar .progress { flex: 1; }
.load-bar span { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--tt-text); min-width: 24px; text-align: right; }

/* ---------- Alerts & toasts ---------- */
.alert { border-radius: var(--tt-radius); border: 1px solid transparent; font-size: .875rem; display: flex; gap: .75rem; align-items: flex-start; padding: .85rem 1rem; }
.alert > i { font-size: 1rem; margin-top: .15rem; }
.alert ul { padding-left: 1.1rem; }
.alert-success { background: var(--tt-success-soft); border-color: #a7f3d0; color: #065f46; }
.alert-danger { background: var(--tt-danger-soft); border-color: #fecaca; color: #991b1b; }
.alert-warning { background: var(--tt-warning-soft); border-color: #fde68a; color: #92400e; }
.alert-info { background: var(--tt-info-soft); border-color: #bae6fd; color: #075985; }
.toast-stack { position: fixed; top: calc(var(--tt-topbar-height) + .75rem); right: 1rem; z-index: 1090; display: flex; flex-direction: column; gap: .6rem; max-width: calc(100vw - 2rem); }
.app-toast {
    display: flex; align-items: flex-start; gap: .75rem; width: 360px; max-width: 100%;
    padding: .85rem 1rem; border-radius: var(--tt-radius);
    background: var(--tt-surface); border: 1px solid var(--tt-border); box-shadow: var(--tt-shadow-lg);
    font-size: .875rem; color: var(--tt-text-2);
    animation: toast-in .25s ease-out;
}
.app-toast .toast-icon { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: .8rem; }
.app-toast.success .toast-icon { background: var(--tt-success-soft); color: var(--tt-success); }
.app-toast.warning .toast-icon { background: var(--tt-warning-soft); color: var(--tt-warning); }
.app-toast.danger .toast-icon { background: var(--tt-danger-soft); color: var(--tt-danger); }
.app-toast .toast-body { flex: 1; padding: .2rem 0 0; }
.app-toast .btn-close { font-size: .65rem; margin-top: .35rem; }
.app-toast.hiding { animation: toast-out .2s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--tt-muted); }
.empty-state .empty-icon {
    width: 56px; height: 56px; margin: 0 auto 1rem; border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    background: var(--tt-primary-soft); color: var(--tt-primary); font-size: 1.35rem;
}
.empty-state h3 { font-size: 1rem; margin-bottom: .35rem; }
.empty-state p { font-size: .875rem; max-width: 420px; margin: 0 auto 1rem; }

/* ---------- Pagination ---------- */
.pagination { --bs-pagination-border-radius: 8px; --bs-pagination-font-size: .84rem; --bs-pagination-color: var(--tt-text-2); --bs-pagination-border-color: var(--tt-border); --bs-pagination-hover-bg: var(--tt-surface-2); --bs-pagination-focus-box-shadow: var(--tt-focus); --bs-pagination-active-bg: var(--tt-primary); --bs-pagination-active-border-color: var(--tt-primary); gap: .25rem; margin: 0; flex-wrap: wrap; }
.pagination .page-link { border-radius: 8px !important; min-width: 34px; text-align: center; }
.pager-wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.pager-wrap nav > div:first-child { display: none !important; } /* hide duplicate mobile pager text from Laravel's bootstrap-5 view */
.pager-wrap nav > div:last-child { display: flex !important; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; width: 100%; }
.pager-wrap nav p { margin: 0; font-size: .8rem; color: var(--tt-muted); }

/* ---------- Modals & dropdowns ---------- */
.modal-content { border: 0; border-radius: var(--tt-radius-lg); box-shadow: var(--tt-shadow-lg); }
.modal-header { padding: 1.1rem 1.35rem; border-bottom: 1px solid var(--tt-border); }
.modal-title { font-size: 1.05rem; font-weight: 650; }
.modal-body { padding: 1.35rem; }
.modal-footer { padding: .9rem 1.35rem; border-top: 1px solid var(--tt-border); background: var(--tt-surface-2); border-radius: 0 0 var(--tt-radius-lg) var(--tt-radius-lg); }
.modal-backdrop.show { opacity: .45; }
.confirm-icon { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--tt-danger-soft); color: var(--tt-danger); font-size: 1.2rem; margin-bottom: 1rem; }
.dropdown-menu { border: 1px solid var(--tt-border); border-radius: var(--tt-radius); box-shadow: var(--tt-shadow-lg); padding: .4rem; font-size: .875rem; }
.dropdown-item { border-radius: 8px; padding: .5rem .75rem; display: flex; align-items: center; gap: .6rem; }
.dropdown-item i { width: 16px; text-align: center; color: var(--tt-muted); }
.dropdown-item:active { background: var(--tt-primary); }
.dropdown-item:active i { color: #fff; }
.dropdown-header { padding: .5rem .75rem; }

/* ---------- Dashboard ---------- */
.list-row { display: flex; align-items: center; gap: .9rem; padding: .75rem 1.25rem; border-bottom: 1px solid var(--tt-border); }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.coverage-ring {
    --pct: 0;
    width: 120px; height: 120px; border-radius: 50%; flex-shrink: 0;
    background: conic-gradient(var(--tt-primary) calc(var(--pct) * 1%), #eef0f4 0);
    display: flex; align-items: center; justify-content: center;
}
.coverage-ring::before { content: ""; position: absolute; }
.coverage-ring > div { width: 92px; height: 92px; border-radius: 50%; background: var(--tt-surface); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.coverage-ring strong { font-size: 1.5rem; line-height: 1; }
.coverage-ring span { font-size: .7rem; color: var(--tt-muted); margin-top: .2rem; }
.quick-action { display: flex; align-items: center; gap: .8rem; padding: .85rem 1rem; border: 1px solid var(--tt-border); border-radius: var(--tt-radius); color: var(--tt-text); font-weight: 500; transition: border-color .15s, background .15s; }
.quick-action:hover { border-color: rgba(var(--tt-primary-rgb), .4); background: var(--tt-primary-soft); color: var(--tt-text); }
.quick-action i.qa-icon { width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--tt-primary-soft); color: var(--tt-primary); }
.quick-action .fa-arrow-right { margin-left: auto; color: var(--tt-muted); font-size: .8rem; }
.welcome-banner {
    border-radius: var(--tt-radius-lg); padding: 1.5rem 1.75rem; color: #fff;
    background: radial-gradient(circle at 85% 20%, rgba(255,255,255,.18), transparent 40%), linear-gradient(120deg, #065f46, #059669 55%, #14b8a6);
    box-shadow: 0 10px 30px rgba(5, 150, 105, .25);
}
.welcome-banner h2 { color: #fff; font-size: 1.35rem; margin: 0 0 .25rem; }
.welcome-banner p { margin: 0; opacity: .88; }
.welcome-banner .btn-light { --bs-btn-color: #065f46; --bs-btn-border-color: transparent; }
.timeline-item { display: flex; gap: .9rem; padding: .7rem 0; }
.timeline-time { width: 92px; flex-shrink: 0; font-size: .78rem; color: var(--tt-muted); font-variant-numeric: tabular-nums; padding-top: .1rem; }

/* ---------- Timetable grid ---------- */
.tt-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.tt-grid-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 0 0 var(--tt-radius) var(--tt-radius); }
.tt-grid { width: 100%; border-collapse: separate; border-spacing: 0; }
.tt-grid thead th:not(.tt-day), .tt-grid td { min-width: 128px; }
.tt-grid th, .tt-grid td { border-right: 1px solid var(--tt-border); border-bottom: 1px solid var(--tt-border); padding: 6px; vertical-align: top; }
.tt-grid tr > *:last-child { border-right: 0; }
.tt-grid tbody tr:last-child > * { border-bottom: 0; }
.tt-grid thead th { background: var(--tt-surface-2); text-align: center; padding: .7rem .4rem; position: sticky; top: 0; z-index: 2; }
.tt-grid thead th .p-no { display: block; font-size: .78rem; font-weight: 700; color: var(--tt-text); }
.tt-grid thead th .p-time { display: block; font-size: .7rem; font-weight: 500; color: var(--tt-muted); white-space: nowrap; }
.tt-grid .tt-day {
    min-width: 112px;
    position: sticky; left: 0; z-index: 1; width: 112px;
    background: var(--tt-surface); text-align: left; vertical-align: middle;
    font-weight: 600; font-size: .85rem; color: var(--tt-text); padding-left: 1rem;
    box-shadow: 1px 0 0 var(--tt-border);
}
.tt-grid thead .tt-day { background: var(--tt-surface-2); z-index: 3; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--tt-muted); }
.tt-grid tr.is-today .tt-day { color: var(--tt-primary); }
.tt-grid tr.is-today .tt-day::after { content: "Today"; display: block; font-size: .65rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--tt-primary); opacity: .8; }

.tt-slot {
    --slot-hue: 230;
    display: flex; flex-direction: column; justify-content: center; gap: 2px;
    width: 100%; min-height: 64px; padding: .5rem .6rem;
    border-radius: 9px; border: 1px solid hsl(var(--slot-hue) 60% 88%);
    border-left: 3px solid hsl(var(--slot-hue) 60% 52%);
    background: hsl(var(--slot-hue) 80% 97%);
    text-align: left; font: inherit; color: inherit;
    transition: transform .12s, box-shadow .12s, border-color .12s;
}
.tt-slot .s-name { font-weight: 600; font-size: .8rem; color: hsl(var(--slot-hue) 45% 26%); line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tt-slot .s-teacher { font-size: .72rem; color: var(--tt-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-slot .s-teacher.missing { color: var(--tt-warning); font-weight: 500; }
button.tt-slot { cursor: pointer; }
button.tt-slot:hover { transform: translateY(-1px); box-shadow: var(--tt-shadow); border-color: hsl(var(--slot-hue) 60% 75%); }
button.tt-slot:focus-visible { outline: none; box-shadow: var(--tt-focus); }
.tt-slot.empty {
    align-items: center; text-align: center;
    border: 1.5px dashed var(--tt-border-strong); background: transparent;
    color: #9ca3af; font-size: .75rem; font-weight: 500;
}
button.tt-slot.empty:hover { border-color: var(--tt-primary); color: var(--tt-primary); background: var(--tt-primary-soft); box-shadow: none; }
div.tt-slot.empty { cursor: default; }

.tt-legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: .78rem; color: var(--tt-muted); }
.tt-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.tt-legend .sw { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.tt-print-title { display: none; }

.slot-summary { display: flex; align-items: center; gap: .75rem; padding: .75rem .9rem; border-radius: var(--tt-radius-sm); background: var(--tt-surface-2); border: 1px solid var(--tt-border); margin-bottom: 1.1rem; }
.slot-summary .si { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--tt-primary-soft); color: var(--tt-primary); }

/* ---------- Auth (guest) ---------- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr; background: var(--tt-surface); }
@media (min-width: 992px) { .auth-shell { grid-template-columns: 1.05fr 1fr; } }
.auth-aside {
    display: none; position: relative; overflow: hidden; color: #fff; padding: 3rem;
    background: radial-gradient(circle at 20% 15%, rgba(255,255,255,.14), transparent 35%), radial-gradient(circle at 80% 85%, rgba(20,184,166,.45), transparent 45%), linear-gradient(145deg, #022c22, #064e3b 45%, #059669);
}
@media (min-width: 992px) { .auth-aside { display: flex; flex-direction: column; justify-content: space-between; } }
.auth-aside .brand { display: flex; align-items: center; gap: .75rem; font-weight: 700; font-size: 1.1rem; color: #fff; }
.auth-aside .brand img { width: 44px; height: 44px; border-radius: 12px; background: #fff; }
.auth-aside h2 { color: #fff; font-size: 2rem; line-height: 1.2; font-weight: 700; max-width: 460px; }
.auth-aside p { color: rgba(255,255,255,.78); max-width: 440px; }
.auth-feature { display: flex; gap: .8rem; align-items: center; margin-top: 1rem; color: rgba(255,255,255,.9); font-size: .92rem; }
.auth-feature i { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,.12); }
.auth-mock { margin-top: 2rem; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; max-width: 420px; opacity: .9; }
.auth-mock span { height: 30px; border-radius: 6px; background: rgba(255,255,255,.1); }
.auth-mock span.f { background: rgba(255,255,255,.28); }
.auth-mock span.g { background: rgba(167,243,208,.45); }
.auth-mock span.y { background: rgba(253,230,138,.45); }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.25rem; }
.auth-card { width: 100%; max-width: 410px; }
.auth-card .mobile-brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 2rem; font-weight: 700; color: var(--tt-text); }
.auth-card .mobile-brand img { width: 40px; height: 40px; border-radius: 10px; }
@media (min-width: 992px) { .auth-card .mobile-brand { display: none; } }
.auth-card h1 { font-size: 1.6rem; margin-bottom: .35rem; }
.auth-card .lead-text { color: var(--tt-muted); margin-bottom: 1.75rem; }
.auth-card .form-control { min-height: 44px; }
.password-field { position: relative; }
.password-field .form-control { padding-right: 2.75rem; }
.password-toggle { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--tt-muted); width: 34px; height: 34px; border-radius: 8px; }
.password-toggle:hover { color: var(--tt-text); background: #f1f5f9; }
.password-field .form-control.is-invalid ~ .password-toggle { right: 2rem; }

/* ---------- Error pages ---------- */
.error-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; text-align: center; }
.error-code { font-size: 5rem; font-weight: 800; line-height: 1; letter-spacing: -.04em; background: linear-gradient(135deg, #059669, #14b8a6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.error-shell h1 { font-size: 1.4rem; margin: 1rem 0 .5rem; }
.error-shell p { color: var(--tt-muted); max-width: 420px; margin: 0 auto 1.5rem; }

/* ---------- Utilities ---------- */
.gap-row { row-gap: 1.25rem; }
.text-primary { color: var(--tt-primary) !important; }
.bg-primary-soft { background: var(--tt-primary-soft) !important; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.tabular { font-variant-numeric: tabular-nums; white-space: nowrap; }
.min-w-0 { min-width: 0; }
[x-cloak], .js-hidden { display: none !important; }

/* ---------- Print ---------- */
@media print {
    @page { size: A4 landscape; margin: 10mm; }
    body { background: #fff; font-size: 11px; }
    .app-sidebar, .app-topbar, .app-footer, .page-actions, .no-print, .toast-stack, .breadcrumb, .sidebar-backdrop { display: none !important; }
    .app-main { margin: 0 !important; }
    .app-content { padding: 0; max-width: none; }
    .card { border: 0; box-shadow: none; }
    .card-header { padding: 0 0 .5rem; border: 0; }
    .tt-grid-wrap { overflow: visible; }
    .tt-grid thead th:not(.tt-day), .tt-grid td { min-width: 0; }
    .tt-grid th, .tt-grid td { border: 1px solid #94a3b8 !important; padding: 3px; }
    .tt-grid thead th, .tt-grid .tt-day { position: static; box-shadow: none; }
    .tt-slot { min-height: 0; border: 0 !important; background: none !important; padding: 2px; }
    .tt-slot.empty { visibility: hidden; }
    .tt-print-title { display: block; text-align: center; margin-bottom: 8px; }
    .tt-print-title h2 { font-size: 16px; margin: 0; }
    .tt-print-title p { margin: 0; font-size: 11px; color: #475569; }
}

/* ---------- Searchable dropdowns (Select2, bootstrap-5 theme) ---------- */
.select2-container--bootstrap-5 .select2-selection {
    min-height: 40px; border-color: var(--tt-border-strong); border-radius: var(--tt-radius-sm);
    font-size: .9rem; color: var(--tt-text); box-shadow: var(--tt-shadow-sm);
    padding: .45rem 2.25rem .45rem .8rem;
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered { color: var(--tt-text); line-height: 1.5; padding: 0; }
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__placeholder { color: #9ca3af; }
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection { border-color: rgba(var(--tt-primary-rgb), .6); box-shadow: var(--tt-focus); }
.select2-container--bootstrap-5.select2-container--disabled .select2-selection { background-color: #f3f4f6; cursor: not-allowed; }
.select2-container--bootstrap-5 .select2-selection__clear { margin-right: .25rem; }
.select2-container--bootstrap-5 .select2-dropdown {
    border-color: var(--tt-border); border-radius: var(--tt-radius); box-shadow: var(--tt-shadow-lg);
    overflow: hidden; font-size: .9rem; z-index: 1060;
}
.select2-container--bootstrap-5 .select2-dropdown .select2-search .select2-search__field {
    border-color: var(--tt-border-strong); border-radius: var(--tt-radius-sm); padding: .45rem .75rem; min-height: 36px;
}
.select2-container--bootstrap-5 .select2-dropdown .select2-search .select2-search__field:focus { border-color: rgba(var(--tt-primary-rgb), .6); box-shadow: var(--tt-focus); }
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option { padding: .5rem .75rem; border-radius: 6px; margin: 0 .35rem; }
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options { padding: .25rem 0 .35rem; }
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--highlighted { background: var(--tt-primary-soft); color: var(--tt-primary-hover); }
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--selected,
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option[aria-selected=true]:not(.select2-results__option--highlighted) { background: var(--tt-primary); color: #fff; }
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--disabled { color: #9ca3af; }
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__message { color: var(--tt-muted); }
.s2-option { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.s2-pill { flex-shrink: 0; font-size: .7rem; font-weight: 600; padding: .15rem .5rem; border-radius: 999px; background: #f1f5f9; color: #475569; }
.s2-pill-busy { background: var(--tt-warning-soft); color: #b45309; }
.select2-results__option--selected .s2-pill { background: rgba(255, 255, 255, .2); color: #fff; }
/* Validation state for enhanced selects */
.form-select.is-invalid + .select2-container--bootstrap-5 .select2-selection { border-color: var(--tt-danger); }
.form-select.is-invalid ~ .invalid-feedback { display: block; }
/* Toolbar sizing */
.toolbar .select2-container { flex: 0 1 240px; width: 240px !important; }
