:root {
    --bg: #eef1f7;
    --bg-glow: #dbe4ff;
    --surface: #ffffff;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e4e9f2;
    --brand: #2563eb;
    --brand-2: #38bdf8;
    --brand-dark: #1d4ed8;
    --brand-soft: #dbeafe;
    --sidebar: #0b1220;
    --sidebar-2: #111827;
    --sidebar-text: #94a3b8;
    --good: #059669;
    --good-bg: #ecfdf5;
    --num: #0369a1;
    --num-bg: #e0f2fe;
    --den: #c2410c;
    --den-bg: #ffedd5;
    --practice: #2563eb;
    --practice-bg: #dbeafe;
    --radius: 16px;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 28px rgba(15, 23, 42, 0.05);
    --font: "Manrope", "Segoe UI", system-ui, sans-serif;
}

html, body {
    min-height: 100%;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
}

body.app-body {
    background:
        radial-gradient(900px 320px at 85% -10%, var(--bg-glow), transparent 55%),
        var(--bg);
}

.app-shell {
    display: grid;
    grid-template-columns: 248px 1fr;
    min-height: 100vh;
}

.app-sidebar {
    background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
    color: var(--sidebar-text);
    width: 248px;
    display: flex;
    flex-direction: column;
    border: 0;
}

@media (min-width: 992px) {
    .app-sidebar.offcanvas-lg {
        position: sticky;
        top: 0;
        height: 100vh;
        visibility: visible !important;
        transform: none !important;
        z-index: 1030;
    }
}

.sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.15rem 1.1rem 0.85rem;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    text-decoration: none;
    color: #fff;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.sidebar-brand-text strong {
    font-weight: 800;
    font-size: 1.05rem;
}

.sidebar-brand-text small {
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0.5rem 0.75rem;
    flex: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.62rem 0.8rem;
    border-radius: 12px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
    transition: 0.15s ease;
}

.sidebar-link i { font-size: 1.1rem; opacity: 0.9; }

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.sidebar-link.active {
    background: linear-gradient(90deg, #1d4ed8, #2563eb);
    color: #fff;
    box-shadow: 0 8px 18px -10px rgba(37, 99, 235, 0.9);
}

.sidebar-foot {
    padding: 1rem 1.2rem 1.3rem;
    font-size: 0.78rem;
}

.btn-deploy {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    margin-bottom: 0.85rem;
    padding: 0.65rem 0.8rem;
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 12px;
    background: rgba(14, 165, 233, 0.12);
    color: #7dd3fc;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-deploy:hover {
    background: rgba(14, 165, 233, 0.22);
    border-color: rgba(56, 189, 248, 0.55);
    color: #bae6fd;
}

.btn-deploy:disabled {
    opacity: 0.55;
    cursor: wait;
}

.btn-deploy.is-ok {
    border-color: rgba(52, 211, 153, 0.45);
    background: rgba(16, 185, 129, 0.14);
    color: #6ee7b7;
}

.btn-deploy.is-err {
    border-color: rgba(248, 113, 113, 0.45);
    background: rgba(239, 68, 68, 0.14);
    color: #fca5a5;
}

.deploy-toast {
    position: fixed;
    right: 1.1rem;
    bottom: 1.1rem;
    z-index: 1080;
    max-width: min(420px, calc(100vw - 2rem));
    padding: 0.85rem 1rem;
    border-radius: 14px;
    background: #0f172a;
    color: #f8fafc;
    font-size: 0.88rem;
    font-weight: 600;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.28);
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.deploy-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.deploy-toast.ok { border-left: 3px solid #34d399; }
.deploy-toast.err { border-left: 3px solid #f87171; }

.sidebar-hint { color: #64748b; font-weight: 600; }
.sidebar-hint.muted { color: #475569; font-weight: 500; }

.app-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.4rem;
    background: rgba(238, 241, 247, 0.82);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.topbar-title {
    font-weight: 800;
    font-size: 1.05rem;
}

.topbar-spacer { flex: 1; }

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 999px;
    padding: 4px 10px 4px 4px;
    font-weight: 650;
    font-size: 0.88rem;
}

.user-chip:hover { border-color: #bfdbfe; }

.user-avatar,
.profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(145deg, #1d4ed8, #38bdf8);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    font-size: 1.6rem;
}

.app-content {
    flex: 1;
    padding: 1.35rem 1.4rem 2.2rem;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: linear-gradient(145deg, #2563eb, #38bdf8);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    box-shadow: 0 8px 16px -8px rgba(37, 99, 235, 0.8);
}

.brand-mark-lg { width: 44px; height: 44px; font-size: 1.2rem; border-radius: 14px; }

.page-head, .hero-panel {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-title, .hero-title {
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0 0 0.2rem;
}

.page-title { font-size: 1.55rem; }
.hero-title { font-size: 1.85rem; }
.page-sub, .hero-sub { color: var(--muted); }

.hero-kicker {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brand);
    margin-bottom: 0.2rem;
}

.hero-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }

.surface-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.15rem 1.2rem;
}

.surface-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.surface-title {
    font-size: 1.05rem;
    font-weight: 800;
    margin: 0;
}

.surface-sub { color: var(--muted); font-size: 0.85rem; }

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 0.85rem;
    height: 100%;
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.tone-blue .stat-icon { background: #dbeafe; color: #1d4ed8; }
.tone-green .stat-icon { background: #d1fae5; color: #047857; }
.tone-amber .stat-icon { background: #ffedd5; color: #c2410c; }
.tone-rose .stat-icon { background: #ffe4e6; color: #e11d48; }
.tone-violet .stat-icon { background: #ede9fe; color: #6d28d9; }

.stat-label {
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 650;
    margin-bottom: 0.1rem;
}

.stat-value {
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.stat-unit {
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 700;
    margin-left: 3px;
}

.color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    vertical-align: middle;
    flex-shrink: 0;
}
.color-dot.lg { width: 12px; height: 12px; margin-right: 0; }

.badge-week {
    font-weight: 700;
    padding: 0.45em 0.8em;
    border-radius: 999px;
    font-size: 0.78rem;
}

.badge-num { background: var(--num-bg); color: var(--num); }
.badge-den { background: var(--den-bg); color: var(--den); }

.legend-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.875rem;
    color: var(--muted);
}

.legend-item { display: inline-flex; align-items: center; gap: 0.4rem; }
.legend-box {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    display: inline-block;
}
.legend-num { background: var(--num-bg); border: 1px solid var(--num); }
.legend-den { background: var(--den-bg); border: 1px solid var(--den); }
.legend-both { background: #f1f5f9; border: 1px solid #94a3b8; }

.progress-list { display: flex; flex-direction: column; gap: 0.85rem; }
.progress-row {
    display: grid;
    grid-template-columns: 12px 1fr auto;
    gap: 0.85rem;
    align-items: center;
}
.progress-row-top {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.3rem;
}
.progress-name { font-weight: 700; }
.progress-nums { color: var(--muted); font-size: 0.85rem; }
.progress-nums b { color: var(--ink); }
.progress-pct { font-weight: 800; width: 3rem; text-align: right; color: var(--muted); font-size: 0.85rem; }
.progress.slim { height: 8px; border-radius: 99px; background: #eef2f7; overflow: hidden; }
.progress.slim .progress-bar { border-radius: 99px; }
.overall-bar {
    width: min(220px, 40vw);
    height: 8px;
    background: #eef2f7;
    border-radius: 99px;
    overflow: hidden;
}
.overall-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #38bdf8);
}

.btn {
    border-radius: 12px;
    font-weight: 700;
}
.btn-primary {
    background: linear-gradient(180deg, #3b82f6, var(--brand-dark));
    border-color: var(--brand-dark);
    box-shadow: 0 10px 18px -10px rgba(29, 78, 216, 0.7);
}
.btn-primary:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
}
.btn-ghost {
    background: #fff;
    border: 1px solid var(--line);
    color: var(--ink);
}
.btn-ghost:hover { border-color: #bfdbfe; background: #f8fafc; }

.form-control, .form-select {
    border-radius: 12px;
    border-color: var(--line);
    padding: 0.65rem 0.9rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-soft);
}
.form-label { font-weight: 650; font-size: 0.82rem; color: #334155; }
.modal-content { border: 0; border-radius: 18px; }
.modal-header, .modal-footer { border-color: var(--line); }
.alert { border-radius: 12px; border: 0; }

.empty-state {
    background: #fff;
    border: 1px dashed #cbd5e1;
    border-radius: var(--radius);
    padding: 2.2rem 1rem;
    text-align: center;
    color: var(--muted);
}

.stack-list { display: flex; flex-direction: column; gap: 10px; }

.entity-card {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 1rem 1.05rem;
    box-shadow: var(--shadow);
    height: 100%;
}

.entity-color {
    width: 8px;
    align-self: stretch;
    border-radius: 99px;
}

.entity-avatar, .entity-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    flex-shrink: 0;
}

.entity-icon { background: #dbeafe; color: #1d4ed8; font-size: 1.1rem; }
.entity-body { min-width: 0; flex: 1; }
.entity-title { font-weight: 800; }
.entity-meta { color: var(--muted); font-size: 0.82rem; }
.entity-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* ===== Schedule ===== */
.schedule-table {
    font-size: 0.82rem;
    min-width: 980px;
}

.schedule-table th {
    background: #f8fafc;
    font-weight: 700;
    white-space: nowrap;
}

.schedule-table thead th.is-today {
    background: #eff6ff;
    color: var(--brand);
}

.today-dot {
    display: block;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--brand);
}

.col-shift { width: 78px; background: #0b1220 !important; color: #fff; }
.col-pair { width: 44px; }
.day-sat { background: #fafafa; }
.schedule-cell.is-today { background: #f8fbff; }

.shift-pill {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 800;
}

.pair-num {
    display: inline-flex;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #f1f5f9;
    font-weight: 800;
}

.schedule-cell {
    vertical-align: top;
    min-width: 140px;
    padding: 0.4rem !important;
}

.slot-half {
    min-height: 2.3rem;
    padding: 0.2rem;
    border-radius: 8px;
    margin-bottom: 4px;
}

.slot-num { background: var(--num-bg); }
.slot-den { background: var(--den-bg); }
.slot-empty { color: #94a3b8; font-size: 0.75rem; }

.slot-item {
    position: relative;
    background: #fff;
    border: 1px solid var(--line);
    border-left: 4px solid var(--slot-c, #94a3b8);
    border-radius: 10px;
    padding: 0.4rem 1.15rem 0.4rem 0.5rem;
    margin-bottom: 0.3rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.slot-group {
    font-weight: 800;
    font-size: 0.78rem;
    letter-spacing: 0.01em;
}
.slot-subj {
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.25;
    margin-top: 3px;
    padding-top: 4px;
    border-top: 1px dashed var(--line);
}
.slot-room { font-size: 0.68rem; color: #64748b; margin-top: 2px; }

.slot-item.is-substituted {
    background: #fff7ed;
    border-color: #fdba74;
    opacity: 0.95;
}
.slot-item.is-substituted .slot-subj {
    text-decoration: line-through;
    color: #94a3b8;
}
.slot-sub-badge {
    display: inline-block;
    margin-top: 4px;
    padding: 1px 6px;
    border-radius: 999px;
    background: #ffedd5;
    color: #c2410c;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.slot-sub-name {
    margin-top: 2px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #9a3412;
}

.slot-actions {
    position: absolute;
    top: 0;
    right: 2px;
    display: flex;
    gap: 0;
}
.slot-btn {
    border: 0;
    background: transparent;
    color: #94a3b8;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1;
    padding: 2px 3px;
}
.slot-btn:hover { color: #ea580c; }
.slot-del-btn:hover { color: #dc2626; }

/* ===== Hours ===== */
.hours-scroll {
    overflow: auto;
    max-height: calc(100vh - 220px);
}

.day-picker-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 2px 2px 8px;
}

.day-picker {
    display: flex;
    gap: 8px;
    min-width: max-content;
}

.day-chip {
    width: 58px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 14px;
    padding: 9px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    transition: 0.15s ease;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.day-chip:hover { border-color: #93c5fd; transform: translateY(-1px); }
.day-chip.active {
    border-color: transparent;
    background: linear-gradient(180deg, #3b82f6, #1d4ed8);
    color: #fff;
    box-shadow: 0 10px 18px -8px rgba(29, 78, 216, 0.55);
}
.day-chip.today:not(.active) { border-color: var(--brand); }
.day-chip.num:not(.active) { background: #f0f9ff; }
.day-chip.den:not(.active) { background: #fff7ed; }
.day-chip.practice:not(.active) { background: var(--practice-bg); }

.dc-dow { font-size: 0.68rem; text-transform: lowercase; opacity: 0.8; font-weight: 700; }
.dc-day { font-size: 1.2rem; font-weight: 800; line-height: 1.1; }
.dc-mark { font-size: 0.65rem; font-weight: 700; opacity: 0.85; }

.day-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 0.95rem 1.15rem;
    box-shadow: var(--shadow);
}

.day-hero-hint { color: var(--muted); font-size: 0.8rem; }

.subject-day-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.subject-day-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px 16px;
    box-shadow: var(--shadow);
}

.subject-day-card .entity-color {
    width: 6px;
    min-height: 42px;
}

.sdc-left {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.sdc-title { font-weight: 750; line-height: 1.3; }
.sdc-subj { font-size: 0.82rem; color: var(--muted); margin-top: 3px; line-height: 1.3; }
.sdc-sub { font-size: 0.78rem; color: var(--brand, #2563eb); font-weight: 700; margin-top: 3px; }
.sdc-meta { font-size: 0.78rem; color: var(--muted); margin-top: 4px; }

.sdc-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.sdc-now {
    min-width: 44px;
    text-align: right;
    font-weight: 800;
    font-size: 1.05rem;
    color: #047857;
}

.subject-day-card:not(.has-h) .sdc-now { color: #94a3b8; }

.sdc-actions { display: flex; gap: 6px; }
.sdc-actions .btn { min-width: 40px; font-weight: 800; }

/* ===== Bells ===== */
.surface-card.is-live {
    border-color: #93c5fd;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08), var(--shadow);
}

.live-pill {
    background: #dcfce7;
    color: #166534;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 0.25rem 0.6rem;
    border-radius: 99px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.shift-heading {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0.4rem 0 0.7rem;
}

.bell-timeline { display: flex; flex-direction: column; margin-bottom: 1.1rem; }

.bell-row {
    display: grid;
    grid-template-columns: 64px 18px 1fr;
    gap: 0.65rem;
    align-items: start;
    padding: 0.55rem 0.5rem;
    border-radius: 12px;
}

.bell-row.is-now {
    background: #eff6ff;
}

.bell-time { text-align: right; }
.bell-time strong { display: block; font-size: 0.95rem; }
.bell-time span { color: var(--muted); font-size: 0.78rem; }

.bell-rail {
    position: relative;
    display: flex;
    justify-content: center;
    min-height: 100%;
}

.bell-rail::after {
    content: "";
    position: absolute;
    top: 14px;
    bottom: -18px;
    width: 2px;
    background: #e2e8f0;
}

.bell-timeline .bell-row:last-child .bell-rail::after { display: none; }

.bell-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #cbd5e1;
    margin-top: 6px;
    z-index: 1;
}

.bell-row.is-now .bell-dot {
    background: var(--brand);
    box-shadow: 0 0 0 4px #dbeafe;
}

.bell-label { font-weight: 800; }
.bell-break { font-size: 0.8rem; color: var(--muted); }

/* ===== Auth ===== */
.auth-body {
    min-height: 100vh;
    background: var(--bg);
    font-family: var(--font);
}

.auth-split {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
}

.auth-visual {
    position: relative;
    overflow: hidden;
    background: radial-gradient(1200px 600px at -10% 110%, #1d4ed8 0%, transparent 50%),
        linear-gradient(160deg, #0b1220 0%, #111827 55%, #0f172a 100%);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 3rem;
}

.auth-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(8px);
    opacity: 0.45;
}

.auth-orb-1 {
    width: 280px;
    height: 280px;
    background: #2563eb;
    top: -80px;
    right: -60px;
}

.auth-orb-2 {
    width: 220px;
    height: 220px;
    background: #0ea5e9;
    bottom: -70px;
    left: 12%;
}

.auth-visual-inner { position: relative; z-index: 1; max-width: 460px; }
.auth-brand-name { font-weight: 800; font-size: 1.25rem; }
.auth-visual-title {
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin: 0 0 1rem;
}
.auth-visual-lead { color: #94a3b8; font-size: 1.02rem; margin-bottom: 1.5rem; }
.auth-points { list-style: none; padding: 0; margin: 0; color: #cbd5e1; }
.auth-points li { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.45rem; font-weight: 600; }
.auth-points i { color: #38bdf8; }

.auth-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    background:
        radial-gradient(700px 280px at 100% 0%, #dbeafe 0%, transparent 50%),
        #f8fafc;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
    padding: 2rem 1.7rem 1.7rem;
}

.auth-card-title { font-weight: 800; font-size: 1.45rem; margin-bottom: 0.2rem; }
.auth-card-sub { color: var(--muted); margin-bottom: 1.4rem; }

.input-icon { position: relative; }
.input-icon i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}
.input-icon .form-control { padding-left: 2.2rem; }

.table > :not(caption) > * > * { background-color: transparent; }

@media (max-width: 991.98px) {
    .app-shell { grid-template-columns: 1fr; }
    .auth-split { grid-template-columns: 1fr; }
    .auth-visual { min-height: auto; padding: 1.6rem 1.4rem 1.3rem; }
    .auth-visual-title { font-size: 1.45rem; }
    .auth-visual-lead, .auth-points { display: none; }
}

/* ===== Journal ===== */
.journal-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 0.9rem 1rem;
    box-shadow: var(--shadow);
}
@media (max-width: 576px) {
    .journal-filters { grid-template-columns: 1fr; }
}

a.journal-class-card {
    text-decoration: none;
    color: inherit;
}
a.journal-class-card:hover {
    border-color: #93c5fd;
}

.journal-wrap {
    overflow: auto;
    max-height: calc(100vh - 280px);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.journal-table {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8rem;
    min-width: 100%;
}

.journal-table th,
.journal-table td {
    border-bottom: 1px solid var(--line);
    border-right: 1px solid #f1f5f9;
    padding: 0;
    vertical-align: middle;
    background: #fff;
}

.journal-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f8fafc;
    font-weight: 700;
    white-space: nowrap;
}

.journal-table .j-num,
.journal-table .j-name {
    position: sticky;
    z-index: 2;
    background: #fff;
}

.journal-table thead .j-num,
.journal-table thead .j-name { z-index: 4; background: #f8fafc; }

.journal-table .j-num {
    left: 0;
    width: 40px;
    min-width: 40px;
    text-align: center;
    color: var(--muted);
    font-weight: 700;
}

.journal-table .j-name {
    left: 40px;
    min-width: 196px;
    max-width: 220px;
    padding: 0.45rem 0.7rem;
    font-weight: 700;
    text-align: left;
    box-shadow: 6px 0 8px -8px rgba(15, 23, 42, 0.18);
}

.journal-table .j-date {
    width: 52px;
    min-width: 52px;
    text-align: center;
}
.journal-table .j-date.is-today { background: #eff6ff; }
.journal-table td.is-today { background: #f8fbff; }

.j-date-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    border: 0;
    background: transparent;
    padding: 0.45rem 0.2rem;
    font: inherit;
    color: inherit;
    cursor: pointer;
}
.j-date-btn:hover:not(:disabled) { color: var(--brand); }
.j-date-btn:disabled { opacity: 0.45; cursor: default; }
.j-dow { font-size: 0.65rem; text-transform: lowercase; color: var(--muted); font-weight: 700; }
.j-day { font-weight: 800; }

.journal-table .j-sum {
    position: sticky;
    z-index: 2;
    min-width: 58px;
    text-align: center;
    font-weight: 800;
    background: #f8fafc;
    padding: 0.35rem 0.4rem;
}
.journal-table thead .j-sum { z-index: 4; }
.journal-table .j-sum[data-col="pct"] { right: 116px; }
.journal-table .j-sum[data-col="avg"] { right: 58px; }
.journal-table .j-sum-last,
.journal-table .j-sum[data-col="grade"] { right: 0; box-shadow: -6px 0 8px -8px rgba(15, 23, 42, 0.18); }

.j-cell {
    width: 52px;
    height: 42px;
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #94a3b8;
    cursor: pointer;
}
.j-cell:hover:not(:disabled) { background: #f1f5f9; }
.j-cell:disabled { opacity: 0.35; cursor: default; }
.j-cell.present { color: #047857; background: #ecfdf5; }
.j-cell.absent { color: #be123c; background: #fff1f2; }
.j-cell.sick { color: #c2410c; background: #fff7ed; }
.j-cell.excused { color: #1d4ed8; background: #eff6ff; }
.j-cell.late { color: #a16207; background: #fefce8; }
.j-cell.escaped { color: #9f1239; background: #fff1f2; }
.j-cell.has-score { font-size: 0.92rem; }

.j-key {
    display: inline-flex;
    width: 26px;
    height: 26px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 800;
    border: 0;
}
.j-key.present { background: #d1fae5; color: #047857; }
.j-key.absent { background: #ffe4e6; color: #be123c; }
.j-key.sick { background: #ffedd5; color: #c2410c; }
.j-key.excused { background: #dbeafe; color: #1d4ed8; }
.j-key.late { background: #fef9c3; color: #a16207; }
.j-key.escaped { background: #fecdd3; color: #9f1239; }

.grade-5 { color: #047857; }
.grade-4 { color: #1d4ed8; }
.grade-3 { color: #c2410c; }
.grade-2 { color: #be123c; }

.journal-pop {
    display: none;
    position: fixed;
    z-index: 1080;
    width: 260px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
    padding: 0.75rem;
}
.journal-pop.is-open { display: block; }
.journal-pop .jp-att {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 0.7rem;
}
.journal-pop .jp-att .j-key {
    flex: 1 1 calc(33.333% - 4px);
    height: 34px;
    cursor: pointer;
}
.journal-pop .jp-att .j-key.is-on {
    outline: 2px solid currentColor;
}

.journal-mobile-list { display: flex; flex-direction: column; gap: 8px; }
.journal-student {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px 12px;
    box-shadow: var(--shadow);
}
.journal-student .js-name {
    flex: 1 1 100%;
    min-width: 0;
    font-weight: 700;
    font-size: 0.88rem;
    line-height: 1.25;
}
.journal-student .js-meta {
    flex: 1 1 100%;
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 650;
    margin-top: -4px;
}
.journal-student .js-att { display: flex; flex-wrap: wrap; gap: 4px; }
.journal-student .js-score {
    width: 64px;
    margin-left: auto;
    padding: 0.35rem 0.4rem;
    text-align: center;
    font-weight: 800;
}

@media (max-width: 576px) {
    .app-content { padding: 1rem 0.9rem 1.5rem; }
    .app-topbar { padding: 0.7rem 0.9rem; }
    .subject-day-card, .entity-card {
        flex-direction: column;
        align-items: stretch;
    }
    .sdc-right, .entity-actions { justify-content: space-between; }
    .hero-title { font-size: 1.45rem; }
}
