/* =============================================================================
   UMS — application styles
   Palette: ink navy sidebar, university blue for action, saffron for "you are here".
   ========================================================================== */
:root {
  --ink: #13233f;
  --ink-2: #1b2f52;
  --ink-text: #b9c4da;
  --blue: #2b4cc4;
  --blue-600: #2240a8;
  --blue-50: #eef2fd;
  --gold: #e2a93b;
  --gold-50: #fdf5e4;
  --green: #1f8a5b;
  --green-50: #e7f5ee;
  --red: #c2413b;
  --red-50: #fbecea;
  --violet: #6b4fc8;
  --violet-50: #f1edfc;
  --slate: #5b6476;
  --slate-50: #f0f2f5;

  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --line: #e3e6ec;
  --text: #1b2333;
  --muted: #687185;

  --radius-lg: 12px;
  --radius: 8px;
  --radius-sm: 6px;
  --sidebar-w: 264px;

  --bs-body-font-family: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-primary: var(--blue);
  --bs-primary-rgb: 43, 76, 196;
  --bs-link-color: var(--blue);
  --bs-link-color-rgb: 43, 76, 196;
  --bs-link-hover-color: var(--blue-600);
  --bs-border-color: var(--line);
  --bs-secondary-color: var(--muted);
}

[data-bs-theme="dark"] {
  --ink: #0d1628;
  --ink-2: #16233d;
  --bg: #0f1726;
  --surface: #162036;
  --surface-2: #1a2640;
  --line: #273553;
  --text: #e4e9f3;
  --muted: #95a1b8;
  --blue: #6f8cf0;
  --blue-600: #8aa2f4;
  --blue-50: #1d2b52;
  --gold-50: #3a2f17;
  --green-50: #14342a;
  --red-50: #3d1d1d;
  --violet-50: #2a2250;
  --slate-50: #222d44;
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-border-color: var(--line);
  --bs-primary-rgb: 111, 140, 240;
  --bs-tertiary-bg: var(--surface-2);
}

html { font-size: 15px; }
body { background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { text-decoration: none; }
.text-muted { color: var(--muted) !important; }
::selection { background: var(--gold); color: #1b1300; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---- Shell ---------------------------------------------------------------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: var(--ink); color: var(--ink-text);
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; z-index: 1040;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 20px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand:hover { color: #fff; }
.brand-logo { width: 40px; height: 40px; border-radius: 10px; background: #fff; object-fit: contain; padding: 3px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 10px; background: var(--gold); color: var(--ink);
  display: grid; place-items: center; font-weight: 800; font-size: .82rem; letter-spacing: .02em;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: 1.05rem; font-weight: 800; }
.brand-text small { color: var(--ink-text); font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.side-nav { flex: 1; overflow-y: auto; padding: 12px 10px 20px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.side-nav ul { list-style: none; margin: 0; padding: 0; }
.side-nav .nav-link {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 12px; border-radius: var(--radius);
  color: var(--ink-text); font-weight: 500; font-size: .93rem; background: none; border: 0; text-align: left; position: relative;
}
.side-nav .nav-link > .bi:first-child { font-size: 1.05rem; width: 20px; text-align: center; opacity: .85; }
.side-nav .nav-link:hover { color: #fff; background: rgba(255,255,255,.05); }
.side-nav .nav-link.active { color: #fff; background: var(--ink-2); }
.side-nav .nav-link.active::before {
  content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold);
}
.side-nav .caret { margin-left: auto; font-size: .75rem; transition: transform .2s; }
.side-nav .nav-toggle[aria-expanded="true"] .caret { transform: rotate(180deg); }
.side-nav .nav-group.open > .nav-toggle { color: #fff; }
.side-nav .sub { padding: 2px 0 6px 31px; }
.side-nav .sub .nav-link { padding: 7px 12px; font-size: .88rem; font-weight: 500; }
.side-nav .sub .nav-link.active { color: var(--gold); background: transparent; }
.side-nav .sub .nav-link.active::before { left: -13px; top: 10px; bottom: 10px; }

.side-foot { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.06); }
.side-user { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.side-user strong { color: #fff; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user small { font-size: .76rem; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: 14px; height: 64px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.top-search { flex: 1; max-width: 480px; position: relative; display: flex; align-items: center; }
.top-search .bi { position: absolute; left: 13px; color: var(--muted); }
.top-search input {
  width: 100%; height: 40px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  padding: 0 44px 0 38px; color: var(--text); font-size: .92rem;
}
.top-search input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-50); }
.top-search kbd { position: absolute; right: 12px; background: var(--slate-50); color: var(--muted); border: 1px solid var(--line); font-size: .72rem; padding: 1px 6px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.term-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: .84rem; font-weight: 600;
  background: var(--gold-50); color: #8a5a00; margin-right: 6px; white-space: nowrap;
}
[data-bs-theme="dark"] .term-chip { color: var(--gold); }
.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px; border: 0; background: none; color: var(--muted); font-size: 1.15rem;
}
.icon-btn:hover { background: var(--surface); color: var(--text); }
.dot-count {
  position: absolute; top: 3px; right: 3px; min-width: 17px; height: 17px; border-radius: 9px; background: var(--red); color: #fff;
  font-size: .66rem; font-weight: 700; display: grid; place-items: center; padding: 0 4px;
}
.user-btn { display: flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--muted); padding: 4px; border-radius: 999px; }
.user-btn:hover { background: var(--surface); }

.content { padding: 28px; flex: 1; width: 100%; max-width: 1600px; }
.foot { padding: 16px 28px; color: var(--muted); font-size: .82rem; border-top: 1px solid var(--line); }

.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .25s ease; }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(9,15,30,.45); z-index: 1030; }
  .topbar { padding: 0 16px; }
  .content { padding: 20px 16px; }
  .term-chip { display: none; }
  .top-search kbd { display: none; }
}

/* ---- Page header ---------------------------------------------------------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -.015em; margin: 0; }
.page-sub { color: var(--muted); margin: 4px 0 0; max-width: 70ch; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.crumbs { font-size: .83rem; color: var(--muted); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--blue); }
.crumbs .bi { font-size: .65rem; }

/* ---- Panels --------------------------------------------------------------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); margin-bottom: 22px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head h2, .panel-head h3 { font-size: 1.02rem; font-weight: 700; margin: 0; }
.panel-head .hint { color: var(--muted); font-size: .85rem; font-weight: 400; }
.panel-body { padding: 20px; }
.panel-foot { padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.panel.flush .table { margin: 0; }

/* ---- Stat strip ----------------------------------------------------------- */
.stat-strip {
  display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-lg); margin-bottom: 22px; overflow: hidden;
}
.stat { display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px; color: var(--text); border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; }
a.stat:hover { background: var(--surface-2); color: var(--text); }
.stat-icon { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 10px; display: grid; place-items: center; font-size: 1.1rem; }
.stat-body { display: flex; flex-direction: column; min-width: 0; }
.stat-value { font-size: 1.55rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: .86rem; font-weight: 500; }
.stat-sub { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.tone-blue .stat-icon { background: var(--blue-50); color: var(--blue); }
.tone-gold .stat-icon { background: var(--gold-50); color: #b07a12; }
.tone-green .stat-icon { background: var(--green-50); color: var(--green); }
.tone-red .stat-icon { background: var(--red-50); color: var(--red); }
.tone-violet .stat-icon { background: var(--violet-50); color: var(--violet); }
.tone-slate .stat-icon { background: var(--slate-50); color: var(--slate); }
@media (max-width: 1199.98px) { .stat-strip { grid-template-columns: repeat(min(var(--cols, 4), 3), minmax(0, 1fr)); } .stat { border-top: 1px solid var(--line); } }
@media (max-width: 767.98px) { .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .stat-strip { grid-template-columns: 1fr; } .stat { border-left: 0; } }

/* ---- Tables --------------------------------------------------------------- */
.table { --bs-table-bg: transparent; --bs-table-color: var(--text); margin-bottom: 0; font-size: .92rem; }
.table > thead th {
  font-size: .8rem; font-weight: 700; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line);
  padding: 10px 14px; white-space: nowrap;
}
.table > tbody td { padding: 11px 14px; vertical-align: middle; border-color: var(--line); }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: var(--surface-2); }
.table tfoot td, .table tfoot th { background: var(--surface-2); font-weight: 700; padding: 11px 14px; }
.table .num, .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.table-sm > tbody td { padding: 7px 12px; }
.cell-main { font-weight: 600; color: var(--text); }
.cell-sub { display: block; color: var(--muted); font-size: .82rem; }
.link-strong { font-weight: 600; color: var(--text); }
.link-strong:hover { color: var(--blue); }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions .btn { padding: 3px 9px; }
.pager-info { color: var(--muted); font-size: .86rem; }

/* ---- Filters -------------------------------------------------------------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.filters .f { display: flex; flex-direction: column; gap: 4px; min-width: 150px; flex: 1 1 160px; max-width: 260px; }
.filters .f.grow { max-width: none; flex: 2 1 220px; }
.filters label { font-size: .8rem; font-weight: 600; color: var(--muted); }
.filters .f-actions { display: flex; gap: 8px; margin-left: auto; }

/* ---- Forms ---------------------------------------------------------------- */
.form-control, .form-select { border-radius: var(--radius-sm); border-color: var(--line); background-color: var(--surface); font-size: .93rem; }
.form-control:focus, .form-select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-50); }
.form-label { font-weight: 600; font-size: .86rem; margin-bottom: 5px; }
.form-label .req { color: var(--red); margin-left: 2px; }
.form-text { color: var(--muted); }
.form-section { padding: 20px; border-bottom: 1px solid var(--line); }
.form-section:last-child { border-bottom: 0; }
.form-section h3 { font-size: .98rem; font-weight: 700; margin: 0 0 4px; }
.form-section > p { color: var(--muted); font-size: .86rem; margin: 0 0 16px; }
.btn { border-radius: var(--radius-sm); font-weight: 600; font-size: .9rem; display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
.btn-primary { --bs-btn-bg: var(--blue); --bs-btn-border-color: var(--blue); --bs-btn-hover-bg: var(--blue-600); --bs-btn-hover-border-color: var(--blue-600); --bs-btn-active-bg: var(--blue-600); }
.btn-outline-primary { --bs-btn-color: var(--blue); --bs-btn-border-color: var(--blue); --bs-btn-hover-bg: var(--blue); --bs-btn-hover-border-color: var(--blue); }
.btn-light { --bs-btn-bg: var(--surface); --bs-btn-border-color: var(--line); --bs-btn-color: var(--text); --bs-btn-hover-bg: var(--surface-2); --bs-btn-hover-border-color: var(--line); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #2a1c00; }
.btn-gold:hover { background: #d39a2c; border-color: #d39a2c; color: #2a1c00; }
.ts-wrapper.form-select { padding: 0; }
.ts-control { border-radius: var(--radius-sm) !important; border-color: var(--line) !important; min-height: 38px; background: var(--surface) !important; color: var(--text); }
.ts-dropdown { border-color: var(--line); background: var(--surface); color: var(--text); }
.ts-dropdown .active { background: var(--blue-50); color: var(--text); }
.ts-control input { color: var(--text) !important; }

/* ---- Pills, grades, avatars ---------------------------------------------- */
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.pill-green { background: var(--green-50); color: var(--green); }
.pill-red { background: var(--red-50); color: var(--red); }
.pill-gold { background: var(--gold-50); color: #9a6a0c; }
.pill-blue { background: var(--blue-50); color: var(--blue); }
.pill-violet { background: var(--violet-50); color: var(--violet); }
.pill-slate { background: var(--slate-50); color: var(--slate); }
[data-bs-theme="dark"] .pill-gold { color: var(--gold); }
[data-bs-theme="dark"] .pill-slate { color: var(--muted); }
.grade { display: inline-grid; place-items: center; min-width: 30px; height: 26px; padding: 0 6px; border-radius: 6px; font-weight: 800; font-size: .85rem; }
.grade-a { background: var(--green-50); color: var(--green); }
.grade-b { background: var(--blue-50); color: var(--blue); }
.grade-c { background: var(--gold-50); color: #9a6a0c; }
.grade-d { background: #fdebdc; color: #b4551c; }
.grade-f { background: var(--red-50); color: var(--red); }
[data-bs-theme="dark"] .grade-d { background: #3d2717; color: #f0a46f; }
.avatar {
  --hue: 220; width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%; display: inline-grid; place-items: center; object-fit: cover;
  background: hsl(var(--hue) 55% 92%); color: hsl(var(--hue) 45% 32%); font-weight: 700; font-size: .82rem;
}
[data-bs-theme="dark"] .avatar:not(img) { background: hsl(var(--hue) 30% 26%); color: hsl(var(--hue) 70% 85%); }
.avatar.sm { width: 32px; height: 32px; flex-basis: 32px; font-size: .74rem; }
.avatar.lg { width: 88px; height: 88px; flex-basis: 88px; font-size: 1.6rem; }
.person { display: flex; align-items: center; gap: 11px; min-width: 0; }
.person > div { min-width: 0; }

/* ---- Empty states --------------------------------------------------------- */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state > .bi { font-size: 2.4rem; color: var(--line); display: block; margin-bottom: 10px; }
[data-bs-theme="dark"] .empty-state > .bi { color: #3a4a6c; }
.empty-state h2 { font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty-state p { max-width: 46ch; margin: 0 auto 16px; }

/* ---- Tabs ----------------------------------------------------------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 12px; overflow-x: auto; }
.tabs a, .tabs button {
  padding: 13px 14px; color: var(--muted); font-weight: 600; font-size: .9rem; border: 0; background: none; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs a.active, .tabs button.active { color: var(--blue); border-bottom-color: var(--blue); }
.tabs .count { background: var(--slate-50); color: var(--muted); border-radius: 999px; padding: 1px 7px; font-size: .74rem; margin-left: 4px; }

/* ---- Profile header ------------------------------------------------------- */
.profile-card { display: grid; grid-template-columns: auto 1fr auto; gap: 22px; align-items: center; padding: 22px; }
.profile-card h2 { font-size: 1.4rem; font-weight: 800; margin: 0; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: .9rem; margin-top: 6px; }
.profile-meta span { display: inline-flex; align-items: center; gap: 6px; }
.profile-figures { display: flex; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.profile-figures div { padding: 10px 18px; text-align: center; border-left: 1px solid var(--line); }
.profile-figures div:first-child { border-left: 0; }
.profile-figures strong { display: block; font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.profile-figures small { color: var(--muted); font-size: .78rem; }
@media (max-width: 767.98px) { .profile-card { grid-template-columns: 1fr; text-align: left; } }
.dl { display: grid; grid-template-columns: minmax(130px, 38%) 1fr; gap: 0; margin: 0; }
.dl dt { color: var(--muted); font-weight: 500; font-size: .87rem; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.dl dd { margin: 0; padding: 9px 0; border-bottom: 1px dashed var(--line); font-weight: 500; }

/* ---- Term block (transcript-like on screen) ------------------------------ */
.term-block { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }
.term-block-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding: 11px 16px; background: var(--blue-50); font-weight: 700; }
.term-block-head .figs { display: flex; gap: 16px; font-size: .88rem; }

/* ---- Charts --------------------------------------------------------------- */
.chart-box { position: relative; height: 300px; }
.chart-box.sm { height: 220px; }
.legend-list { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.legend-list li { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.legend-list li:last-child { border-bottom: 0; }
.legend-list .sw { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 10px; }
.legend-list .v { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- Lists ---------------------------------------------------------------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); align-items: center; }
.feed li:last-child { border-bottom: 0; }
.feed .feed-main { flex: 1; min-width: 0; }
.feed .feed-title { font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed .feed-meta { color: var(--muted); font-size: .82rem; }
.date-tile { width: 46px; flex: 0 0 46px; text-align: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; line-height: 1.1; }
.date-tile b { display: block; font-size: 1.05rem; padding: 4px 0 2px; }
.date-tile small { display: block; background: var(--gold-50); color: #9a6a0c; font-size: .68rem; font-weight: 700; padding: 2px 0; }
.progress { height: 8px; border-radius: 6px; background: var(--slate-50); }
.progress-bar { background: var(--blue); }

/* ---- Marks / attendance grids -------------------------------------------- */
.grid-input { width: 82px; text-align: right; font-variant-numeric: tabular-nums; }
.grid-input.is-invalid { border-color: var(--red); background: var(--red-50); }
.att-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.att-toggle input { display: none; }
.att-toggle label { padding: 5px 11px; font-size: .82rem; font-weight: 700; cursor: pointer; color: var(--muted); border-left: 1px solid var(--line); }
.att-toggle label:first-of-type { border-left: 0; }
.att-toggle input:checked + label.p { background: var(--green-50); color: var(--green); }
.att-toggle input:checked + label.a { background: var(--red-50); color: var(--red); }
.att-toggle input:checked + label.l { background: var(--gold-50); color: #9a6a0c; }
.att-toggle input:checked + label.e { background: var(--violet-50); color: var(--violet); }
.sticky-actions { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 12px 20px; display: flex; gap: 10px; align-items: center; justify-content: flex-end; border-radius: 0 0 var(--radius-lg) var(--radius-lg); z-index: 5; }

/* ---- Timetable grid ------------------------------------------------------- */
.tt { display: grid; grid-template-columns: 70px repeat(var(--days, 6), minmax(140px, 1fr)); min-width: 900px; }
.tt-head { padding: 10px; font-weight: 700; font-size: .85rem; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--surface-2); text-align: center; }
.tt-time { font-size: .76rem; color: var(--muted); text-align: right; padding: 4px 8px 0 0; border-right: 1px solid var(--line); }
.tt-col { position: relative; border-left: 1px solid var(--line); }
.tt-slot { border-bottom: 1px dashed var(--line); }
.tt-item {
  position: absolute; left: 4px; right: 4px; border-radius: 7px; padding: 6px 8px; font-size: .78rem; overflow: hidden;
  background: hsl(var(--hue, 220) 70% 95%); border-left: 3px solid hsl(var(--hue, 220) 60% 45%); color: hsl(var(--hue, 220) 45% 22%);
}
[data-bs-theme="dark"] .tt-item { background: hsl(var(--hue, 220) 30% 22%); color: hsl(var(--hue, 220) 70% 88%); }
.tt-item strong { display: block; font-size: .82rem; }
.tt-item .tt-del { position: absolute; top: 3px; right: 4px; opacity: 0; }
.tt-item:hover .tt-del { opacity: 1; }

/* ---- Notices -------------------------------------------------------------- */
.notice-card { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.notice-card:last-child { border-bottom: 0; }
.notice-card h3 { font-size: 1.02rem; font-weight: 700; margin: 0 0 4px; }
.notice-card .body { color: var(--text); margin-top: 8px; white-space: pre-line; max-width: 80ch; }
.notice-card.urgent { border-left: 3px solid var(--red); }
.notice-card.important { border-left: 3px solid var(--gold); }

/* ---- Auth pages ----------------------------------------------------------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--surface); }
.auth-side {
  background: var(--ink); color: #dfe6f5; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
}
.auth-side::after {
  content: ''; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%;
  border: 56px solid rgba(226,169,59,.12);
}
.auth-side h1 { font-family: 'Source Serif 4', Georgia, serif; font-size: 2.6rem; line-height: 1.12; color: #fff; font-weight: 700; max-width: 16ch; }
.auth-side p { color: var(--ink-text); max-width: 44ch; font-size: 1.02rem; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-form form { width: 100%; max-width: 380px; }
.auth-form h2 { font-weight: 800; font-size: 1.5rem; margin-bottom: 4px; }
@media (max-width: 899.98px) { .auth { grid-template-columns: 1fr; } .auth-side { padding: 28px 24px; } .auth-side h1 { font-size: 1.8rem; } .auth-side::after { display: none; } }

/* ---- Misc ----------------------------------------------------------------- */
.flash { border-radius: var(--radius); border: 0; }
.alert-success { background: var(--green-50); color: var(--green); }
.alert-danger { background: var(--red-50); color: var(--red); }
.alert-warning { background: var(--gold-50); color: #855a06; }
.alert-info { background: var(--blue-50); color: var(--blue); }
[data-bs-theme="dark"] .alert-warning { color: var(--gold); }
.modal-content { border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface); }
.modal-header, .modal-footer { border-color: var(--line); }
.modal-title { font-weight: 700; font-size: 1.1rem; }
.dropdown-menu { border-color: var(--line); border-radius: var(--radius); background: var(--surface); }
.pagination { --bs-pagination-color: var(--text); --bs-pagination-bg: var(--surface); --bs-pagination-border-color: var(--line); --bs-pagination-active-bg: var(--blue); --bs-pagination-active-border-color: var(--blue); --bs-pagination-hover-bg: var(--surface-2); --bs-pagination-disabled-bg: var(--surface); }
.section-title { font-size: 1.05rem; font-weight: 700; margin: 0 0 12px; }
.kv-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: .92rem; }
.kv-row:last-child { border-bottom: 0; }
.kv-row span:first-child { color: var(--muted); }
.big-figure { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.perm-group { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.perm-group h4 { font-size: .92rem; font-weight: 700; margin: 0 0 8px; display: flex; justify-content: space-between; }
.search-group h3 { font-size: .9rem; font-weight: 700; color: var(--muted); padding: 14px 20px 6px; margin: 0; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: .82rem; background: var(--surface); color: var(--text); }
@media print { .sidebar, .topbar, .foot, .page-actions, .filters, .no-print { display: none !important; } .content { padding: 0; } .panel { border: 0; } }

/* ---- SVG charts ----------------------------------------------------------- */
.chart-wrap { position: relative; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--muted); stroke-width: 1; opacity: .5; }
.chart .tick { fill: var(--muted); font-size: 11px; font-family: 'Figtree', sans-serif; }
.chart path:hover, .chart circle:hover { opacity: .85; }
.chart .pt { fill: var(--surface); stroke-width: 2; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .84rem; color: var(--muted); margin-bottom: 8px; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.donut-wrap { display: grid; grid-template-columns: 170px 1fr; gap: 20px; align-items: center; }
.donut { width: 170px; height: 170px; }
.donut-track { stroke: var(--slate-50); }
.donut-value { font-size: 26px; font-weight: 800; fill: var(--text); font-family: 'Figtree', sans-serif; }
.donut-label { font-size: 11px; fill: var(--muted); font-family: 'Figtree', sans-serif; }
@media (max-width: 575.98px) { .donut-wrap { grid-template-columns: 1fr; justify-items: center; } .donut-wrap .legend-list { width: 100%; } }
.hbars { list-style: none; margin: 0; padding: 0; }
.hbars li { padding: 7px 0; }
.hb-top { display: flex; justify-content: space-between; gap: 10px; font-size: .9rem; margin-bottom: 5px; }
.hb-top strong { font-variant-numeric: tabular-nums; }
.hb-track { height: 8px; border-radius: 6px; background: var(--slate-50); overflow: hidden; }
.hb-fill { height: 100%; border-radius: 6px; background: var(--blue); }
h1, h2, h3, h4, h5, h6 { color: var(--text); }
.dropdown-item.btn { justify-content: flex-start; font-weight: 400; border-radius: 0; width: 100%; padding: .4rem 1rem; }
.attention .feed li { padding: 11px 20px; }
.att-n { min-width: 42px; height: 30px; border-radius: 8px; display: inline-grid; place-items: center; font-weight: 800; font-size: .88rem; font-variant-numeric: tabular-nums; padding: 0 8px; }
.attention .feed-main:hover { color: var(--blue) !important; }
.cal td { padding: 6px; }
.cal .pill { font-size: .7rem; padding: 2px 6px; border-radius: 5px; text-align: left; }
.btn-light { background: var(--surface); color: var(--text); border-color: var(--line); background-image: none; }
.btn-light:hover { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.btn-primary, .btn-outline-primary { background-image: none; }
@media (max-width: 575.98px) {
  .chart-wrap { overflow-x: auto; }
  .chart-wrap > .chart { min-width: 560px; }
  .page-head h1 { font-size: 1.35rem; }
  .profile-figures { width: 100%; }
  .profile-figures div { flex: 1; padding: 8px; }
}
.panel-body { container-type: inline-size; }
@container (max-width: 440px) {
  .donut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .donut-wrap .legend-list { width: 100%; }
}

/* ---- Language switch ------------------------------------------------------ */
.lang-switch { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; white-space: nowrap; }
.top-lang { height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); color: var(--text); font-weight: 600; font-size: .9rem; }
.top-lang:hover { background: var(--hover, rgba(0,0,0,.04)); color: var(--text); }
.top-lang span { font-family: 'IBM Plex Sans Arabic', 'Figtree', sans-serif; }
@media (max-width: 575.98px) { .top-lang span { display: none; } .top-lang { padding: 0 10px; } }
.auth-form { position: relative; }
.auth-lang { position: absolute; top: 18px; inset-inline-end: 18px; }
