/* ============================================================
   Shule Management — design system
   ============================================================ */
:root {
    --bg: #f2f5f6;
    --surface: #ffffff;
    --surface-2: #f8fafb;
    --ink: #10221f;
    --ink-2: #294440;
    --muted: #647a76;
    --line: #e2e9e8;
    --line-strong: #cfdad8;
    --brand: #0b5d51;
    --brand-2: #0f7a6a;
    --brand-soft: #e6f2ef;
    --accent: #e08e0b;
    --accent-soft: #fdf3e0;
    --danger: #c0392b;
    --danger-soft: #fbecea;
    --success: #1a7f5a;
    --success-soft: #e5f5ee;
    --info: #2563a8;
    --info-soft: #e8f0fb;
    --warning: #b7791f;
    --warning-soft: #fdf4e3;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(16, 34, 31, .05), 0 8px 24px rgba(16, 34, 31, .05);
    --shadow-lg: 0 20px 50px rgba(9, 32, 28, .18);
    --sidebar-w: 272px;
    --font: "Segoe UI", "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-2); }
h1, h2, h3, h4, h5 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0 0 10px; }
small { font-size: 12px; }
svg { flex-shrink: 0; }
::selection { background: var(--brand); color: #fff; }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c3d0ce; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #082723 0%, #0a332d 55%, #0b3b34 100%);
    color: #b9d1cc;
    position: fixed;
    inset: 0 auto 0 0;
    display: flex;
    flex-direction: column;
    z-index: 60;
    transition: transform .25s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 18px 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,.07);
}
.brand-mark {
    width: 40px; height: 40px; border-radius: 11px;
    background: linear-gradient(135deg, #f0b429, #e08e0b);
    color: #3a2400; font-weight: 800; font-size: 19px;
    display: grid; place-items: center; flex-shrink: 0;
}
.brand-logo { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { color: #fff; font-size: 14px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text span { font-size: 10.5px; color: #7fa39c; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-close { display: none; margin-left: auto; color: #b9d1cc !important; }
.sidebar-search {
    margin: 14px 14px 6px; position: relative; display: flex; align-items: center;
    background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08);
    border-radius: 9px; padding: 0 10px;
}
.sidebar-search svg { width: 15px; height: 15px; color: #7fa39c; }
.sidebar-search input {
    background: none; border: 0; outline: 0; color: #e7f3f0; font-size: 12.5px;
    padding: 9px 8px; width: 100%; font-family: inherit;
}
.sidebar-search input::placeholder { color: #6d928b; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 10px 16px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-color: transparent; }
.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; border-radius: 9px; color: #a9c6c0; font-size: 13px;
    margin: 1px 0; transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.active { background: rgba(240,180,41,.14); color: #ffd97a; font-weight: 600; }
.nav-link.active .nav-dot { background: #f0b429; box-shadow: 0 0 0 3px rgba(240,180,41,.18); }
.nav-link.top { margin: 2px 0 6px; font-size: 13.5px; font-weight: 550; }
.nav-link.top.active { background: rgba(255,255,255,.1); color: #fff; }
.nav-link.top svg { width: 17px; height: 17px; }
.nav-group { margin: 1px 0; }
.nav-toggle {
    display: flex; align-items: center; gap: 10px; width: 100%;
    background: none; border: 0; color: #c3d8d4; font-family: inherit;
    font-size: 13px; font-weight: 550; padding: 9px 12px; border-radius: 9px;
    cursor: pointer; text-align: left;
}
.nav-toggle:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-toggle svg:first-child { width: 17px; height: 17px; }
.nav-chevron { width: 14px; height: 14px; margin-left: auto; transition: transform .2s; opacity: .6; }
.nav-group.open .nav-chevron { transform: rotate(180deg); }
.nav-group.active > .nav-toggle { color: #ffd97a; }
.nav-items { display: none; padding: 2px 0 8px 14px; border-left: 1px solid rgba(255,255,255,.08); margin-left: 20px; }
.nav-group.open .nav-items { display: block; }
.nav-items .nav-link { font-size: 12.5px; padding: 6px 10px; }
.nav-dot { width: 4px; height: 4px; border-radius: 50%; background: rgba(255,255,255,.25); flex-shrink: 0; }
.nav-items .nav-link.active { background: rgba(240,180,41,.1); }
.sidebar-foot {
    display: flex; align-items: center; gap: 8px; padding: 12px 14px;
    border-top: 1px solid rgba(255,255,255,.07); background: rgba(0,0,0,.12);
}
.sidebar-user { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: inherit; }
.sidebar-user:hover { color: #fff; }
.sidebar-user-text { display: flex; flex-direction: column; min-width: 0; }
.sidebar-user-text strong { color: #fff; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-text small { color: #8fb0a9; font-size: 11px; }
.avatar {
    width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center;
    background: #d9ece8; color: var(--brand); font-weight: 700; font-size: 12px; flex-shrink: 0;
    overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar .avatar { background: rgba(255,255,255,.12); color: #e9f6f3; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.avatar.sm { width: 28px; height: 28px; font-size: 10px; }

.sidebar-overlay {
    display: none; position: fixed; inset: 0; background: rgba(5,20,18,.45);
    z-index: 55; opacity: 0; transition: opacity .2s;
}
.main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
    height: 68px; background: rgba(255,255,255,.9); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px;
    padding: 0 26px; position: sticky; top: 0; z-index: 40;
}
.menu-btn { display: none; }
.topbar-title { display: flex; flex-direction: column; min-width: 0; }
.topbar-context { font-size: 11px; color: var(--muted); letter-spacing: .02em; }
.topbar-title h1 { font-size: 19px; font-weight: 650; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.term-pill {
    display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600;
    background: var(--brand-soft); color: var(--brand); padding: 6px 10px; border-radius: 100px;
    margin-right: 4px; white-space: nowrap;
}
.term-pill svg { width: 13px; height: 13px; }
.topbar-user { display: flex; align-items: center; gap: 9px; padding-left: 10px; border-left: 1px solid var(--line); margin-left: 4px; }
.topbar-user-text { display: flex; flex-direction: column; line-height: 1.2; }
.topbar-user-text strong { font-size: 12.5px; }
.topbar-user-text small { font-size: 11px; color: var(--muted); }

.icon-btn {
    width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 9px;
    border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer;
    transition: background .15s, color .15s; font-family: inherit;
}
.icon-btn:hover { background: var(--surface-2); color: var(--brand); border-color: var(--line); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); border-color: #f3d3ce; }
.ghost-light { color: #b9d1cc; }
.ghost-light:hover { background: rgba(255,255,255,.08); color: #fff; border-color: transparent; }
.content { padding: 24px 26px 40px; max-width: 1560px; width: 100%; margin: 0 auto; flex: 1; }
.footer {
    display: flex; justify-content: space-between; gap: 12px; padding: 14px 26px;
    font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line);
}

/* ---------- dropdown ---------- */
.dropdown {
    position: absolute; top: 56px; right: 70px; width: 320px; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg);
    display: none; z-index: 70; overflow: hidden;
}
.dropdown.open { display: block; animation: pop .15s ease; }
.dropdown-head { padding: 12px 16px; font-weight: 650; border-bottom: 1px solid var(--line); font-size: 13px; }
.dropdown-body { padding: 6px; max-height: 320px; overflow: auto; }
.notif-item { display: flex; gap: 10px; padding: 10px; border-radius: 8px; }
.notif-item:hover { background: var(--surface-2); }
.notif-item strong { display: block; font-size: 12.5px; }
.notif-item small { color: var(--muted); font-size: 11.5px; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-2); margin-top: 6px; flex-shrink: 0; }
.notif-dot.amber { background: var(--accent); }

/* ---------- page head ---------- */
.page-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h2 { font-size: 22px; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 4px; max-width: 820px; }
.page-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- cards ---------- */
.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); overflow: hidden;
}
.card + .card { margin-top: 18px; }
.card-head {
    display: flex; align-items: center; gap: 12px; padding: 15px 18px;
    border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.card-head h3 { font-size: 14.5px; font-weight: 650; }
.card-head .sub { font-size: 12px; color: var(--muted); }
.card-head .card-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-2-1 { grid-template-columns: 2fr 1fr; }
.grid-1-2 { grid-template-columns: 1fr 2fr; }
.split { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }

/* ---------- stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-grid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 16px; display: flex; gap: 12px; align-items: flex-start; box-shadow: var(--shadow);
    position: relative; overflow: hidden;
}
.stat::after {
    content: ""; position: absolute; inset: 0 0 auto auto; width: 90px; height: 90px;
    background: radial-gradient(circle at top right, rgba(15,122,106,.08), transparent 70%);
    pointer-events: none;
}
.stat-icon {
    width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
    background: var(--brand-soft); color: var(--brand); flex-shrink: 0;
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-icon.amber { background: var(--accent-soft); color: var(--warning); }
.stat-icon.blue { background: var(--info-soft); color: var(--info); }
.stat-icon.red { background: var(--danger-soft); color: var(--danger); }
.stat-icon.green { background: var(--success-soft); color: var(--success); }
.stat-icon.purple { background: #f1eafe; color: #7c3aed; }
.stat-label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat-value { font-size: 23px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; line-height: 1.15; }
.stat-hint { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.stat-hint .up { color: var(--success); font-weight: 600; }
.stat-hint .down { color: var(--danger); font-weight: 600; }

/* ---------- tables ---------- */
.table-wrap { overflow: auto; width: 100%; }
table.data { width: 100%; border-collapse: collapse; font-size: 12.8px; }
table.data thead th {
    text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
    color: var(--muted); background: var(--surface-2); padding: 10px 14px; font-weight: 650;
    border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
table.data tbody td { padding: 11px 14px; border-bottom: 1px solid #edf2f1; vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #f9fbfb; }
table.data tbody tr.selected { background: var(--brand-soft); }
table.data.compact tbody td { padding: 7px 10px; }
table.data.compact thead th { padding: 8px 10px; }
table.data a.cell-link { font-weight: 600; }
.t-right { text-align: right !important; }
.t-center { text-align: center !important; }
.t-nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; font-family: "Cascadia Mono", Consolas, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 11.5px; }
.strong { font-weight: 650; }
.name-cell { display: flex; align-items: center; gap: 9px; }
.name-cell .meta { display: flex; flex-direction: column; line-height: 1.25; }
.name-cell .meta small { color: var(--muted); font-size: 11px; }
.actions { display: flex; gap: 2px; align-items: center; justify-content: flex-end; }
.actions .icon-btn { width: 29px; height: 29px; }
.actions .icon-btn svg { width: 15px; height: 15px; }

.empty-state { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty-state .empty-icon { width: 54px; height: 54px; border-radius: 16px; background: var(--surface-2); display: grid; place-items: center; margin: 0 auto 12px; color: #9fb3ae; }
.empty-state h4 { color: var(--ink); font-size: 14px; margin-bottom: 4px; }
.empty-state p { font-size: 12.5px; max-width: 420px; margin: 0 auto; }

.pagination { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pager { display: flex; gap: 4px; margin-left: auto; }
.pager a, .pager span {
    min-width: 30px; height: 30px; display: inline-grid; place-items: center; border-radius: 7px;
    border: 1px solid var(--line); background: var(--surface); font-size: 12px; color: var(--ink-2); padding: 0 8px;
}
.pager a:hover { border-color: var(--brand); color: var(--brand); }
.pager .active { background: var(--brand); color: #fff; border-color: var(--brand); }
.pager .disabled { opacity: .45; }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 8px 14px; border-radius: 9px; font-size: 12.8px; font-weight: 600;
    border: 1px solid transparent; cursor: pointer; font-family: inherit; line-height: 1.3;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s; white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(11,93,81,.25); }
.btn-primary:hover { background: #0a4e44; color: #fff; }
.btn-accent { background: var(--accent); color: #332100; }
.btn-accent:hover { background: #c97e08; color: #332100; }
.btn-outline { border-color: var(--line-strong); background: var(--surface); color: var(--ink-2); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a93226; color: #fff; }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn-danger-soft:hover { background: #f7dcd7; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 11.8px; border-radius: 7px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 6px; }
.btn-lg { padding: 11px 18px; font-size: 14px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 11.5px; font-weight: 650; color: var(--ink-2); letter-spacing: .01em; }
.field > label .req { color: var(--danger); }
.field .hint { font-size: 11px; color: var(--muted); }
.field .error { font-size: 11px; color: var(--danger); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
input[type=time], input[type=search], input[type=tel], input[type=url], select, textarea {
    width: 100%; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 8px;
    font-family: inherit; font-size: 12.8px; color: var(--ink); background: var(--surface);
    outline: none; transition: border-color .15s, box-shadow .15s; min-height: 36px;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(15,122,106,.12); }
input::placeholder, textarea::placeholder { color: #9aadaa; }
select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23647a76' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
textarea { min-height: 84px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; cursor: pointer; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 12.5px; }
.switch input { opacity: 0; position: absolute; }
.switch .track { width: 38px; height: 21px; background: #cfdad8; border-radius: 20px; position: relative; transition: background .2s; flex-shrink: 0; }
.switch .track::after { content: ""; position: absolute; width: 15px; height: 15px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--brand-2); }
.switch input:checked + .track::after { transform: translateX(17px); }
.input-group { display: flex; }
.input-group input { border-radius: 8px 0 0 8px; }
.input-group .btn { border-radius: 0 8px 8px 0; }
.form-actions { display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding-top: 6px; }

.filters {
    display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap;
    padding: 13px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.filters .field { min-width: 150px; }
.filters .field.wide { min-width: 230px; flex: 1; }
.filters .spacer { flex: 1; }
.search-box { position: relative; display: flex; align-items: center; }
.search-box svg { position: absolute; left: 10px; width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.search-box input { padding-left: 32px; }

/* ---------- badges / chips ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 4px; font-size: 10.8px; font-weight: 650;
    padding: 3px 8px; border-radius: 100px; letter-spacing: .015em; white-space: nowrap;
    background: #eef2f2; color: #50605d;
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-neutral { background: #eef2f2; color: #556662; }
.badge-purple { background: #f1eafe; color: #7c3aed; }
.badge-dot::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 100px;
    background: var(--surface); border: 1px solid var(--line); font-size: 11.8px; font-weight: 550; color: var(--ink-2);
}
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip .count { background: rgba(0,0,0,.08); padding: 1px 6px; border-radius: 100px; font-size: 10.5px; }
a.chip:hover { border-color: var(--brand); color: var(--brand); }
a.chip.active:hover { color: #fff; }

/* ---------- alerts ---------- */
.alert {
    display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: 10px;
    font-size: 12.8px; margin-bottom: 16px; border: 1px solid transparent; position: relative;
}
.alert svg { width: 17px; height: 17px; margin-top: 1px; }
.alert-close { margin-left: auto; background: none; border: 0; cursor: pointer; color: inherit; opacity: .6; padding: 0; display: grid; place-items: center; }
.alert-close:hover { opacity: 1; }
.alert-close svg { width: 15px; height: 15px; margin: 0; }
.alert-success { background: var(--success-soft); color: #145c42; border-color: #c8e9da; }
.alert-danger { background: var(--danger-soft); color: #8f2b20; border-color: #f3d0ca; }
.alert-warning { background: var(--warning-soft); color: #7a5414; border-color: #f3e0ba; }
.alert-info { background: var(--info-soft); color: #1d4f85; border-color: #d3e2f5; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab {
    padding: 10px 15px; font-size: 12.8px; font-weight: 600; color: var(--muted);
    border-bottom: 2px solid transparent; white-space: nowrap; cursor: pointer; background: none;
    border-top: 0; border-left: 0; border-right: 0; font-family: inherit;
}
.tab:hover { color: var(--brand); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab .count { font-size: 10.5px; background: var(--brand-soft); color: var(--brand); border-radius: 100px; padding: 1px 6px; margin-left: 4px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- progress ---------- */
.progress { height: 7px; border-radius: 100px; background: #e6eceb; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 100px; background: var(--brand-2); transition: width .3s; }
.progress.warn > span { background: var(--accent); }
.progress.danger > span { background: var(--danger); }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .progress { flex: 1; }

/* ---------- modal / drawer ---------- */
.modal-root { display: none; position: fixed; inset: 0; z-index: 90; }
.modal-root.open { display: block; }
.modal-overlay { position: absolute; inset: 0; background: rgba(6, 24, 21, .5); backdrop-filter: blur(2px); animation: fade .15s ease; }
.modal {
    position: relative; background: var(--surface); border-radius: 14px; width: 92%; max-width: 680px;
    margin: 6vh auto 0; max-height: 88vh; display: flex; flex-direction: column;
    box-shadow: var(--shadow-lg); animation: pop .18s ease; z-index: 1;
}
.modal.modal-sm { max-width: 460px; }
.modal.modal-lg { max-width: 940px; }
.modal.modal-xl { max-width: 1180px; }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 15.5px; }
.modal-head .sub { font-size: 12px; color: var(--muted); }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 14px 14px; flex-wrap: wrap; }
.drawer {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 94vw); background: var(--surface);
    box-shadow: -20px 0 60px rgba(9,32,28,.2); z-index: 91; display: none; flex-direction: column;
    animation: slideIn .22s ease;
}
.drawer.open { display: flex; }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { font-size: 15.5px; }
.drawer-head .icon-btn { margin-left: auto; }
.drawer-body { padding: 20px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 13px 20px; border-top: 1px solid var(--line); background: var(--surface-2); display: flex; gap: 8px; justify-content: flex-end; }

@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98) } to { opacity: 1; transform: none } }
@keyframes slideIn { from { transform: translateX(24px); opacity: .6 } to { transform: none; opacity: 1 } }

/* ---------- toast ---------- */
.toast-stack { position: fixed; bottom: 20px; right: 20px; z-index: 120; display: flex; flex-direction: column; gap: 8px; }
.toast {
    display: flex; align-items: center; gap: 9px; background: #0d2f2a; color: #eaf6f3;
    padding: 11px 15px; border-radius: 10px; font-size: 12.5px; box-shadow: var(--shadow-lg);
    animation: pop .2s ease; max-width: 380px;
}
.toast svg { width: 16px; height: 16px; color: #6ee7b7; }

/* ---------- misc ---------- */
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin: 22px 0 10px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.list-clean { list-style: none; margin: 0; padding: 0; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 7px 12px; font-size: 12.8px; }
.kv dt { color: var(--muted); font-size: 11.5px; }
.kv dd { margin: 0; font-weight: 550; }
.bullet-list { margin: 0; padding-left: 18px; font-size: 12.8px; }
.bullet-list li { margin-bottom: 6px; }
.bullet-list li::marker { color: var(--brand-2); }

.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -8px; border: 2px solid #fff; }
.avatar-stack .avatar:first-child { margin-left: 0; }

.chart { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 12px; font-size: 11.5px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

.info-banner {
    display: flex; gap: 10px; align-items: flex-start; background: var(--brand-soft);
    border: 1px solid #cfe6e1; color: #0c4a40; border-radius: 10px; padding: 11px 14px;
    font-size: 12.3px; margin-bottom: 16px;
}
.info-banner svg { width: 16px; height: 16px; margin-top: 1px; }
.info-banner.warn { background: var(--warning-soft); border-color: #f1dfb8; color: #7a5414; }
.info-banner.danger { background: var(--danger-soft); border-color: #f2d1cc; color: #8f2b20; }

.hero {
    background: linear-gradient(120deg, #0a332d 0%, #0b5d51 55%, #127a68 100%);
    border-radius: 16px; color: #eaf6f3; padding: 24px 26px; position: relative; overflow: hidden;
    margin-bottom: 20px;
}
.hero::after {
    content: ""; position: absolute; width: 320px; height: 320px; border-radius: 50%;
    background: radial-gradient(circle, rgba(240,180,41,.22), transparent 65%); top: -120px; right: -60px;
}
.hero h2 { color: #fff; font-size: 22px; }
.hero p { color: #bfe0d9; font-size: 13px; margin: 6px 0 0; max-width: 720px; }
.hero .hero-meta { display: flex; gap: 22px; margin-top: 18px; flex-wrap: wrap; }
.hero .hero-meta div { display: flex; flex-direction: column; }
.hero .hero-meta strong { font-size: 20px; color: #fff; }
.hero .hero-meta small { font-size: 11px; color: #a6cdc5; text-transform: uppercase; letter-spacing: .05em; }
.hero .hero-actions { margin-top: 18px; display: flex; gap: 8px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero .btn-outline { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.25); color: #fff; }
.hero .btn-outline:hover { background: rgba(255,255,255,.18); color: #fff; }
.hero .btn-accent { background: #f0b429; color: #3a2400; }

/* photo uploader */
.photo-upload { position: relative; width: 84px; height: 84px; border-radius: 14px; overflow: hidden; background: var(--surface-2); border: 1px dashed var(--line-strong); display: grid; place-items: center; color: var(--muted); cursor: pointer; flex-shrink: 0; }
.photo-upload img { width: 100%; height: 100%; object-fit: cover; }
.photo-upload .photo-overlay { position: absolute; inset: auto 0 0 0; background: rgba(8,39,35,.72); color: #fff; font-size: 10px; text-align: center; padding: 4px 2px; opacity: 0; transition: opacity .15s; }
.photo-upload:hover .photo-overlay { opacity: 1; }

/* attendance grid */
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 6px; }
.att-cell { text-align: center; font-size: 10.5px; padding: 4px 2px; border-radius: 5px; font-weight: 700; }
.att-cell.present { background: var(--success-soft); color: var(--success); }
.att-cell.absent { background: var(--danger-soft); color: var(--danger); }
.att-cell.none { background: #f1f4f4; color: #adbdb9; }

/* timetable */
.tt-grid { border-collapse: separate; border-spacing: 3px; width: 100%; font-size: 11.5px; }
.tt-grid th { background: var(--surface-2); padding: 7px 6px; border-radius: 6px; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.tt-grid td { padding: 0; vertical-align: top; min-width: 100px; }
.tt-slot {
    background: #f7faf9; border: 1px solid #e3ebe9; border-radius: 7px; min-height: 46px;
    padding: 5px 6px; font-size: 10.8px; line-height: 1.3; position: relative; cursor: pointer;
}
.tt-slot .subj { font-weight: 700; display: block; color: var(--ink); }
.tt-slot .who { color: var(--muted); font-size: 10px; }
.tt-slot.filled { background: var(--brand-soft); border-color: #cfe6e1; }
.tt-slot.pinned::after { content: "●"; position: absolute; top: 3px; right: 5px; font-size: 7px; color: var(--accent); }
.tt-slot.double { border-left: 3px solid var(--brand-2); }
.tt-slot.break { background: #f3f4f6; color: #9aa6a4; display: grid; place-items: center; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
.tt-unplaced { background: var(--warning-soft); border: 1px dashed #e3c98f; border-radius: 7px; padding: 6px 8px; font-size: 11px; margin-bottom: 5px; }

/* receipts / documents */
.doc { background: #fff; border: 1px solid var(--line); padding: 30px; font-size: 12.5px; }
.doc-head { text-align: center; border-bottom: 2px solid var(--ink); padding-bottom: 12px; margin-bottom: 16px; }
.doc-head h2 { font-size: 18px; text-transform: uppercase; letter-spacing: .05em; }
.doc-meta { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); }

/* login */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; background: #f5f8f7; }
.auth-side {
    background: linear-gradient(150deg, #082723 0%, #0b5d51 58%, #14836f 100%);
    color: #d8ece7; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
    position: relative; overflow: hidden;
}
.auth-side::before { content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%; border: 1px solid rgba(255,255,255,.09); top: -180px; right: -140px; }
.auth-side::after { content: ""; position: absolute; width: 380px; height: 380px; border-radius: 50%; background: radial-gradient(circle, rgba(240,180,41,.16), transparent 65%); bottom: -120px; left: -80px; }
.auth-brand { display: flex; align-items: center; gap: 13px; position: relative; z-index: 1; }
.auth-brand .brand-mark { width: 46px; height: 46px; font-size: 22px; }
.auth-brand strong { color: #fff; font-size: 17px; display: block; }
.auth-brand span { font-size: 11px; color: #9ec5bd; text-transform: uppercase; letter-spacing: .1em; }
.auth-side h1 { color: #fff; font-size: 34px; line-height: 1.18; margin: 0 0 14px; max-width: 480px; letter-spacing: -.02em; }
.auth-side p { color: #b6d6cf; font-size: 13.5px; max-width: 430px; line-height: 1.7; }
.auth-points { display: grid; gap: 12px; margin-top: 26px; position: relative; z-index: 1; }
.auth-point { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: #cfe8e2; }
.auth-point svg { width: 17px; height: 17px; color: #f0b429; margin-top: 1px; }
.auth-foot { font-size: 11px; color: #7fa99f; position: relative; z-index: 1; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 24px; margin-bottom: 6px; }
.auth-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.auth-card .field { margin-bottom: 14px; }
.demo-box { margin-top: 22px; padding: 13px; border-radius: 10px; background: var(--surface); border: 1px dashed var(--line-strong); font-size: 11.5px; color: var(--muted); }
.demo-box strong { color: var(--ink); font-size: 11.5px; }
.demo-cred { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; font-family: Consolas, monospace; }
.demo-cred button { background: none; border: 0; color: var(--brand); cursor: pointer; font-size: 10.5px; font-weight: 600; }

/* detail sheet */
.detail-hero { display: flex; gap: 14px; align-items: center; padding-bottom: 16px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.detail-hero h3 { font-size: 17px; }
.detail-hero .meta { color: var(--muted); font-size: 12px; }

/* print */
@media print {
    .sidebar, .topbar, .footer, .page-actions, .filters, .tabs, .no-print, .toast-stack { display: none !important; }
    .main { margin: 0; }
    .content { padding: 0; max-width: none; }
    body { background: #fff; font-size: 11px; }
    .card { box-shadow: none; border: 1px solid #ddd; }
    .print-only { display: block !important; }
}
.print-only { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
    .grid-4, .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-5, .stat-grid.five { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
    .split, .grid-2-1, .grid-1-2, .grid-3 { grid-template-columns: 1fr; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: none; }
    .sidebar.open + .sidebar-overlay, .sidebar-overlay.show { display: block; opacity: 1; }
    .main { margin-left: 0; }
    .menu-btn { display: inline-grid; }
    .sidebar-close { display: inline-grid; }
    .topbar-user-text { display: none; }
    .term-pill { display: none; }
}
@media (max-width: 760px) {
    .content { padding: 16px 14px 30px; }
    .topbar { padding: 0 14px; height: 60px; }
    .topbar-title h1 { font-size: 16px; }
    .topbar-context { display: none; }
    .stat-grid, .grid-4, .grid-5, .stat-grid.five, .grid-2 { grid-template-columns: 1fr; }
    .form-grid, .form-grid.three { grid-template-columns: 1fr; }
    .form-grid .span-2, .form-grid .span-3 { grid-column: auto; }
    .page-head { gap: 10px; }
    .page-actions { width: 100%; }
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-side { display: none; }
    .kv { grid-template-columns: 110px 1fr; }
    .dropdown { right: 10px; width: calc(100vw - 20px); }
    .footer { flex-direction: column; gap: 4px; }
}
