/* ==========================================================================
   E-Teacher Diary — stylesheet (light + dark themes)
   ========================================================================== */
:root, [data-bs-theme="light"] {
  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-700: #3730a3;
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --accent: #0ea5a4;
  --accent-50: #e6f7f6;

  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --surface-3: #f1f3f9;
  --border: #e6e8f0;
  --border-strong: #d3d7e3;
  --text: #1a2033;
  --text-muted: #626b80;
  --text-faint: #98a0b3;
  --sidebar-bg: #ffffff;
  --sidebar-text: #4a5268;
  --sidebar-icon: #8a92a8;
  --topbar-bg: rgba(255, 255, 255, .82);

  --success: #12805c;  --success-bg: #e3f6ee;
  --info: #2563eb;     --info-bg: #e8f0fe;
  --warning: #b45309;  --warning-bg: #fef3e2;
  --danger: #d92d20;   --danger-bg: #fdecec;
  --review: #7c3aed;   --review-bg: #f1ebff;
  --neutral: #525b70;  --neutral-bg: #eef0f5;

  --shadow-sm: 0 1px 2px rgba(17, 24, 39, .04), 0 1px 3px rgba(17, 24, 39, .04);
  --shadow: 0 4px 14px rgba(17, 24, 39, .06);
  --shadow-lg: 0 18px 40px rgba(17, 24, 39, .14);
  --ring: 0 0 0 4px rgba(79, 70, 229, .16);

  --bs-body-bg: #ffffff;
  --bs-body-color: var(--text);
  --bs-border-color: var(--border);
  --bs-secondary-bg: var(--surface-2);
  --bs-tertiary-bg: var(--surface-3);
}
[data-bs-theme="dark"] {
  --primary: #818cf8;
  --primary-600: #6366f1;
  --primary-700: #4f46e5;
  --primary-50: rgba(129, 140, 248, .12);
  --primary-100: rgba(129, 140, 248, .2);
  --accent: #2dd4bf;
  --accent-50: rgba(45, 212, 191, .12);

  --bg: #0d1117;
  --surface: #151b26;
  --surface-2: #1a2130;
  --surface-3: #202839;
  --border: #283246;
  --border-strong: #354057;
  --text: #e6e9f2;
  --text-muted: #a3abc0;
  --text-faint: #6f7a93;
  --sidebar-bg: #121823;
  --sidebar-text: #b6bdd0;
  --sidebar-icon: #7a849c;
  --topbar-bg: rgba(18, 24, 35, .82);

  --success: #34d399;  --success-bg: rgba(52, 211, 153, .12);
  --info: #60a5fa;     --info-bg: rgba(96, 165, 250, .12);
  --warning: #fbbf24;  --warning-bg: rgba(251, 191, 36, .12);
  --danger: #f87171;   --danger-bg: rgba(248, 113, 113, .12);
  --review: #c4b5fd;   --review-bg: rgba(196, 181, 253, .12);
  --neutral: #a3abc0;  --neutral-bg: rgba(163, 171, 192, .12);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 6px 18px rgba(0, 0, 0, .35);
  --shadow-lg: 0 20px 45px rgba(0, 0, 0, .5);
  --ring: 0 0 0 4px rgba(129, 140, 248, .25);

  --bs-body-bg: var(--surface);
  --bs-body-color: var(--text);
  --bs-border-color: var(--border);
}
:root {
  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 14px;
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 74px;
  --topbar-h: 64px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --bs-body-font-family: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  --bs-primary: var(--primary);
  --bs-primary-rgb: 79, 70, 229;
  --bs-link-color: var(--primary);
  --bs-link-color-rgb: 79, 70, 229;
  --bs-link-hover-color: var(--primary-600);
}

html { font-size: 14.5px; }
body { background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; }
h1, h2, h3, h4, h5 { color: var(--text); font-weight: 650; letter-spacing: -.01em; }
a { text-decoration: none; color: var(--primary); }
a:hover { color: var(--primary-600); }
:focus-visible { outline: none; box-shadow: var(--ring) !important; border-radius: 6px; }
.text-muted { color: var(--text-muted) !important; }
.text-dark { color: var(--text) !important; }
.small-caps { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); font-weight: 600; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 2000; background: var(--primary); color: #fff; padding: 8px 14px; border-radius: var(--radius); }
.skip-link:focus { left: 8px; }
::selection { background: var(--primary-100); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* page-load bar */
.loadbar { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 3000; background: linear-gradient(90deg, var(--primary), var(--accent)); box-shadow: 0 0 10px var(--primary); transition: width .3s var(--ease), opacity .3s; opacity: 0; }
.loadbar.on { opacity: 1; width: 75%; transition: width 6s cubic-bezier(.1, .7, .2, 1); }

/* ---------- Sidebar ----------------------------------------------------------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--sidebar-bg); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 1040; transition: width .22s var(--ease), transform .22s var(--ease);
}
.sidebar-brand { height: var(--topbar-h); display: flex; align-items: center; gap: 11px; padding: 0 18px; flex: none; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, var(--primary), #8b5cf6); display: grid; place-items: center; color: #fff; font-size: 1.05rem; flex: none; overflow: hidden; box-shadow: 0 6px 14px rgba(79, 70, 229, .3); }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; background: #fff; padding: 3px; }
.brand-text { line-height: 1.2; overflow: hidden; white-space: nowrap; }
.brand-text strong { color: var(--text); font-size: .92rem; display: block; overflow: hidden; text-overflow: ellipsis; max-width: 175px; }
.brand-text span { font-size: .72rem; color: var(--text-faint); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 6px 12px 18px; }
.nav-section { margin-top: 10px; }
.nav-section-title { width: 100%; display: flex; align-items: center; justify-content: space-between; background: none; border: 0; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); padding: 8px 10px 6px; font-weight: 650; white-space: nowrap; border-radius: 6px; }
.nav-section-title:hover { color: var(--text-muted); }
.nav-section-title .bi { font-size: .7rem; transition: transform .2s var(--ease); }
.nav-section.collapsed .nav-section-title .bi { transform: rotate(-90deg); }
.nav-items { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .25s var(--ease); }
.nav-items > div { overflow: hidden; }
.nav-section.collapsed .nav-items { grid-template-rows: 0fr; }
.nav-link-x {
  display: flex; align-items: center; gap: 11px; padding: 8px 11px; color: var(--sidebar-text); border-radius: 10px;
  font-size: .875rem; font-weight: 500; white-space: nowrap; position: relative; margin-bottom: 1px; transition: background .15s, color .15s;
}
.nav-link-x .bi { font-size: 1.05rem; width: 20px; text-align: center; color: var(--sidebar-icon); flex: none; transition: color .15s, transform .15s; }
.nav-link-x:hover { background: var(--surface-3); color: var(--text); }
.nav-link-x:hover .bi { color: var(--primary); transform: translateX(1px); }
.nav-link-x.active { background: var(--primary-50); color: var(--primary); font-weight: 600; }
.nav-link-x.active .bi { color: var(--primary); }
.nav-link-x.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
.nav-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: .66rem; border-radius: 20px; padding: 1px 7px; line-height: 1.5; font-weight: 600; }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: var(--surface-2); font-size: .8rem; }
.sidebar-user .meta { min-width: 0; line-height: 1.25; }
.sidebar-user .meta strong { display: block; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user .meta span { color: var(--text-faint); font-size: .72rem; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; transition: margin-left .22s var(--ease); }
.topbar {
  height: var(--topbar-h); background: var(--topbar-bg); backdrop-filter: saturate(160%) blur(10px); -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; padding: 0 22px; position: sticky; top: 0; z-index: 1030;
}
.btn-icon { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text-muted); position: relative; transition: background .15s, color .15s, transform .1s; }
.btn-icon:hover { background: var(--surface-3); color: var(--text); }
.btn-icon:active { transform: scale(.94); }
.dot { position: absolute; top: 5px; right: 4px; min-width: 17px; height: 17px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .6rem; display: grid; place-items: center; padding: 0 4px; font-weight: 700; border: 2px solid var(--surface); }
.search-trigger { display: flex; align-items: center; gap: 10px; min-width: 260px; height: 38px; padding: 0 10px 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text-faint); font-size: .85rem; transition: border-color .15s, box-shadow .15s; }
.search-trigger:hover { border-color: var(--border-strong); color: var(--text-muted); }
.search-trigger kbd, .kbd { margin-left: auto; font-size: .68rem; background: var(--surface); color: var(--text-muted); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; font-family: inherit; box-shadow: 0 1px 0 var(--border); }
.session-pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 10px; padding: 2px 4px 2px 12px; background: var(--surface); height: 38px; }
.session-pill select { border: 0; background-color: transparent; font-weight: 600; color: var(--text); padding-top: 0; padding-bottom: 0; font-size: .85rem; box-shadow: none !important; }
.avatar { border-radius: 50%; background: linear-gradient(135deg, var(--primary-100), var(--accent-50)); color: var(--primary); display: inline-grid; place-items: center; font-weight: 650; flex: none; object-fit: cover; width: 34px; height: 34px; font-size: .78rem; }
.user-btn { display: flex; align-items: center; gap: 9px; padding: 3px 8px 3px 4px; border-radius: 12px; border: 1px solid transparent; background: transparent; transition: background .15s; }
.user-btn:hover { background: var(--surface-3); }
.content { padding: 24px 28px 32px; flex: 1; max-width: 1520px; width: 100%; animation: fadeUp .35s var(--ease) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-head h1 { font-size: 1.45rem; margin: 0; font-weight: 700; letter-spacing: -.02em; }
.page-head .lead-sm { color: var(--text-muted); margin: 4px 0 0; font-size: .88rem; }
.breadcrumb { font-size: .78rem; margin: 0 0 6px; --bs-breadcrumb-divider-color: var(--text-faint); --bs-breadcrumb-item-active-color: var(--text-faint); }
.breadcrumb a { color: var(--text-muted); }
.footer { padding: 14px 28px; font-size: .75rem; color: var(--text-faint); }
.section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); font-weight: 650; margin: 6px 0 12px; }

body.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .main { margin-left: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .brand-text, body.sidebar-collapsed .nav-section-title, body.sidebar-collapsed .nav-link-x span,
body.sidebar-collapsed .nav-badge, body.sidebar-collapsed .sidebar-user .meta { display: none; }
body.sidebar-collapsed .nav-link-x { justify-content: center; }
body.sidebar-collapsed .nav-section.collapsed .nav-items { grid-template-rows: 1fr; }
body.sidebar-collapsed .sidebar-brand { padding: 0 18px; }
.sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; box-shadow: var(--shadow-lg); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(13, 17, 23, .45); backdrop-filter: blur(2px); z-index: 1035; }
  .main, body.sidebar-collapsed .main { margin-left: 0; }
  body.sidebar-collapsed .brand-text, body.sidebar-collapsed .nav-section-title, body.sidebar-collapsed .nav-link-x span, body.sidebar-collapsed .sidebar-user .meta { display: initial; }
  .content { padding: 16px 16px 26px; }
  .topbar { padding: 0 12px; }
  .search-trigger { min-width: 0; width: 38px; padding: 0; justify-content: center; }
  .search-trigger span, .search-trigger kbd { display: none; }
}

/* ---------- Cards ---------------------------------------------------------------- */
.card-x { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-x + .card-x { margin-top: 18px; }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; min-height: 54px; }
.card-head h2, .card-head h3 { font-size: .98rem; margin: 0; font-weight: 650; }
.card-head .sub { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }
.card-head.border-top { border-top: 1px solid var(--border); }
.card-body-x { padding: 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.stat { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; height: 100%; box-shadow: var(--shadow-sm); display: block; color: inherit; transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s; overflow: hidden; }
a.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); color: inherit; }
.stat .label { font-size: .8rem; color: var(--text-muted); display: flex; align-items: center; gap: 10px; font-weight: 500; }
.stat .value { font-size: 1.75rem; font-weight: 700; color: var(--text); line-height: 1.1; margin-top: 12px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .value small { font-size: .85rem; color: var(--text-faint); font-weight: 500; }
.stat .hint { font-size: .76rem; color: var(--text-faint); margin-top: 5px; }
.stat-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-size: 1rem; flex: none; }
.tone-navy { background: var(--primary-50); color: var(--primary); }
.tone-teal { background: var(--accent-50); color: var(--accent); }
.tone-success { background: var(--success-bg); color: var(--success); }
.tone-warning { background: var(--warning-bg); color: var(--warning); }
.tone-danger { background: var(--danger-bg); color: var(--danger); }
.tone-review { background: var(--review-bg); color: var(--review); }

/* dashboard hero */
.hero { position: relative; overflow: hidden; border-radius: 18px; padding: 24px 26px; margin-bottom: 20px; color: #fff;
  background: radial-gradient(900px 300px at 100% 0%, rgba(255,255,255,.18), transparent 60%), linear-gradient(120deg, #4f46e5 0%, #6d28d9 55%, #0ea5a4 130%); box-shadow: 0 14px 34px rgba(79, 70, 229, .28); }
.hero::after { content: ""; position: absolute; right: -60px; bottom: -80px; width: 260px; height: 260px; border-radius: 50%; background: rgba(255,255,255,.08); }
.hero h1 { color: #fff; font-size: 1.55rem; margin: 0 0 4px; font-weight: 700; }
.hero p { color: rgba(255,255,255,.82); margin: 0; }
.hero .btn-hero { background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.28); backdrop-filter: blur(4px); }
.hero .btn-hero:hover { background: rgba(255,255,255,.26); color: #fff; }
.hero .btn-hero-solid { background: #fff; color: var(--primary-700); border: 0; font-weight: 600; }
.hero .btn-hero-solid:hover { background: #eef2ff; color: var(--primary-700); }
.hero-ring { position: relative; width: 104px; height: 104px; border-radius: 50%; flex: none; z-index: 1;
  background: conic-gradient(#fff calc(var(--p) * 1%), rgba(255,255,255,.22) 0); display: grid; place-items: center; }
.hero-ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: rgba(60, 40, 170, .55); backdrop-filter: blur(4px); }
.hero-ring span { position: relative; text-align: center; line-height: 1.05; font-weight: 700; font-size: 1.35rem; }
.hero-ring small { display: block; font-size: .64rem; font-weight: 500; opacity: .85; }
.hero .hero-stats { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 16px; position: relative; z-index: 1; }
.hero .hero-stats div { font-size: .78rem; color: rgba(255,255,255,.78); }
.hero .hero-stats strong { display: block; color: #fff; font-size: 1.2rem; font-weight: 700; }

/* ---------- Badges, chips, meters ---------------------------------------------------- */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 600; padding: 2px 9px; border-radius: 20px; white-space: nowrap; line-height: 1.6; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill-success { background: var(--success-bg); color: var(--success); }
.pill-info { background: var(--info-bg); color: var(--info); }
.pill-warning { background: var(--warning-bg); color: var(--warning); }
.pill-danger { background: var(--danger-bg); color: var(--danger); }
.pill-review { background: var(--review-bg); color: var(--review); }
.pill-neutral { background: var(--neutral-bg); color: var(--neutral); }
.chip { display: inline-block; font-size: .76rem; padding: 2px 9px; margin: 0 4px 4px 0; border: 1px solid var(--border); border-radius: 20px; background: var(--surface-2); color: var(--text); font-weight: 500; }
.chip-accent { border-color: transparent; background: var(--primary-50); color: var(--primary); }
.meter { height: 7px; background: var(--surface-3); border-radius: 10px; overflow: hidden; min-width: 70px; flex: 1; }
.meter-fill { height: 100%; border-radius: 10px; width: 0; transition: width .9s var(--ease); }
.meter-success { background: linear-gradient(90deg, #10b981, #12805c); } .meter-info { background: linear-gradient(90deg, #818cf8, var(--primary)); }
.meter-warning { background: linear-gradient(90deg, #fbbf24, #f59e0b); } .meter-neutral { background: var(--border-strong); }

/* ---------- Tables ------------------------------------------------------------------------ */
.table-x { width: 100%; margin: 0; font-size: .87rem; color: var(--text); }
.table-x th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 650; background: var(--surface-2); border-bottom: 1px solid var(--border); padding: 10px 14px; white-space: nowrap; text-align: left; position: sticky; top: 0; z-index: 1; }
.table-x td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-x tbody tr { transition: background .12s; }
.table-x tbody tr:last-child td { border-bottom: 0; }
.table-x tbody tr:hover td { background: var(--surface-2); }
.table-x .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-x tfoot td { font-weight: 650; background: var(--surface-2); border-top: 1px solid var(--border-strong); }
.table-report td.wrap { white-space: normal; min-width: 220px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sort-link { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.sort-link:hover { color: var(--primary); }
.sort-ic { font-size: .64rem; opacity: .4; }
.sort-ic.on { opacity: 1; color: var(--primary); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; align-items: center; flex-wrap: nowrap; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.toolbar .form-select, .toolbar .form-control { width: auto; min-width: 150px; }
.toolbar-filters { align-items: flex-end; }
.toolbar-filters .form-label { font-size: .74rem; margin-bottom: 3px; color: var(--text-muted); font-weight: 500; }
.toolbar .search { position: relative; flex: 1 1 240px; max-width: 380px; }
.toolbar .search .bi { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-faint); font-size: .85rem; }
.toolbar .search .form-control { padding-left: 32px; width: 100%; }
.pager-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--border); font-size: .8rem; color: var(--text-muted); }
.pager-bar .form-select { width: auto; }
.pagination { --bs-pagination-color: var(--text-muted); --bs-pagination-bg: var(--surface); --bs-pagination-border-color: var(--border); --bs-pagination-hover-bg: var(--surface-3); --bs-pagination-hover-color: var(--text); --bs-pagination-active-bg: var(--primary); --bs-pagination-active-border-color: var(--primary); --bs-pagination-disabled-bg: var(--surface); --bs-pagination-border-radius: 8px; gap: 3px; }
.pagination .page-link { border-radius: 8px !important; min-width: 32px; text-align: center; }

/* ---------- Buttons & forms ------------------------------------------------------------------ */
.btn { border-radius: 10px; font-weight: 550; font-size: .86rem; padding: .48rem .95rem; transition: transform .1s, box-shadow .15s, background .15s, border-color .15s, color .15s; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn-sm { padding: .3rem .68rem; font-size: .8rem; border-radius: 8px; }
.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary-600); --bs-btn-hover-border-color: var(--primary-600); --bs-btn-active-bg: var(--primary-700); --bs-btn-disabled-bg: var(--primary); --bs-btn-disabled-border-color: var(--primary); box-shadow: 0 4px 12px rgba(79, 70, 229, .22); }
.btn-primary:hover { box-shadow: 0 6px 16px rgba(79, 70, 229, .3); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(14, 165, 164, .25); }
.btn-accent:hover, .btn-accent:focus { background: #0b8c8b; color: #fff; }
.btn-light-x { background: var(--surface); border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow-sm); }
.btn-light-x:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.btn-ghost { background: transparent; border: 1px solid transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger-soft { background: var(--danger-bg); color: var(--danger); border: 1px solid transparent; }
.btn-danger-soft:hover { background: var(--danger); color: #fff; }
.btn-group > .btn-light-x + .btn-light-x { margin-left: -1px; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-light-x.is-loading::after, .btn-ghost.is-loading::after { border-color: var(--border-strong); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }
.form-control, .form-select { border-radius: 10px; border-color: var(--border); font-size: .875rem; background-color: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s; }
.form-control:hover, .form-select:hover { border-color: var(--border-strong); }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: var(--ring); background-color: var(--surface); color: var(--text); }
.form-control:disabled, .form-select:disabled { background-color: var(--surface-2); color: var(--text-muted); }
.form-control::placeholder { color: var(--text-faint); }
.form-check-input { border-color: var(--border-strong); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-label { font-weight: 550; font-size: .82rem; color: var(--text); margin-bottom: 5px; }
.form-text { font-size: .76rem; color: var(--text-faint); }
.req::after { content: " *"; color: var(--danger); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.filters .form-control, .filters .form-select { min-width: 140px; }
.filters .form-label { font-size: .74rem; margin-bottom: 3px; color: var(--text-muted); }
.form-actions { display: flex; gap: 8px; margin-top: 18px; }
.nav-tabs { --bs-nav-tabs-border-color: var(--border); --bs-nav-tabs-link-active-bg: transparent; --bs-nav-tabs-link-active-color: var(--primary); --bs-nav-tabs-link-active-border-color: transparent; border-bottom: 1px solid var(--border); gap: 4px; }
.nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--text-muted); font-weight: 550; font-size: .875rem; padding: 9px 14px; }
.nav-tabs .nav-link:hover { color: var(--text); border-bottom-color: var(--border-strong); }
.nav-tabs .nav-link.active { color: var(--primary); border-bottom-color: var(--primary); background: transparent; }
.dropdown-menu { --bs-dropdown-bg: var(--surface); --bs-dropdown-border-color: var(--border); --bs-dropdown-link-color: var(--text); --bs-dropdown-link-hover-bg: var(--surface-3); --bs-dropdown-link-active-bg: var(--primary); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; animation: pop .14s var(--ease); }
.dropdown-item { border-radius: 8px; font-size: .86rem; padding: 7px 10px; display: flex; align-items: center; gap: 8px; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-content { border-radius: 16px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-lg); }

/* ---------- Alerts, toasts & empty states ------------------------------------------------------------ */
.flash { border-radius: 12px; border: 1px solid; padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px; font-size: .875rem; }
.flash > .bi { margin-top: 2px; }
.flash .btn-close { margin-left: auto; font-size: .65rem; }
.flash-success { background: var(--success-bg); border-color: transparent; color: var(--success); }
.flash-error { background: var(--danger-bg); border-color: transparent; color: var(--danger); }
.flash-warning { background: var(--warning-bg); border-color: transparent; color: var(--warning); }
.flash-info { background: var(--info-bg); border-color: transparent; color: var(--info); }
.flash ul { margin: 4px 0 0; padding-left: 18px; }
.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 2500; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 40px)); }
.toast-x { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow-lg); font-size: .87rem; animation: toastIn .35s var(--ease) both; position: relative; overflow: hidden; }
.toast-x .ti { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.toast-x.success .ti { background: var(--success-bg); color: var(--success); }
.toast-x.info .ti { background: var(--info-bg); color: var(--info); }
.toast-x .close { margin-left: auto; background: none; border: 0; color: var(--text-faint); padding: 0 2px; }
.toast-x::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; background: var(--primary); animation: toastTimer 5s linear forwards; }
.toast-x.hide { animation: toastOut .3s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }
@keyframes toastTimer { from { width: 100%; } to { width: 0; } }
.empty { text-align: center; padding: 44px 20px; color: var(--text-muted); }
.empty .bi { font-size: 1.6rem; color: var(--primary); display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 12px; border-radius: 16px; background: var(--primary-50); }
.empty h3 { font-size: .95rem; color: var(--text); font-weight: 600; }

/* ---------- Key-value, lists ---------------------------------------------------------------------------- */
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 6px 14px; font-size: .875rem; }
.kv dt { color: var(--text-muted); font-weight: 500; }
.kv dd { margin: 0; white-space: pre-line; }
.kv-row { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: .875rem; }
.kv-row:last-child { border-bottom: 0; }
.kv-label { width: 170px; flex: none; color: var(--text-muted); }
@media (max-width: 575.98px) { .kv { grid-template-columns: 1fr; } .kv-label { width: 120px; } }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 11px 18px; border-bottom: 1px solid var(--border); font-size: .875rem; transition: background .12s; }
.list-plain li:hover { background: var(--surface-2); }
.list-plain li:last-child { border-bottom: 0; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; font-size: .84rem; }
.timeline li::before { content: ""; position: absolute; left: 2px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); }
.timeline li::after { content: ""; position: absolute; left: 6px; top: 17px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.code { font-family: Consolas, "Cascadia Mono", monospace; font-size: .8rem; background: var(--surface-3); padding: 1px 6px; border-radius: 6px; color: var(--text); }
.code-sm { font-family: Consolas, monospace; font-size: .7rem; color: var(--text-faint); }

/* ---------- Profile ---------------------------------------------------------------------------------- */
.profile-head { display: flex; gap: 22px; padding: 0; align-items: stretch; flex-wrap: wrap; margin-bottom: 18px; overflow: hidden; }
.profile-head::before { content: ""; flex-basis: 100%; height: 76px; background: linear-gradient(120deg, var(--primary), #8b5cf6 60%, var(--accent)); }
.profile-photo { text-align: center; margin: -52px 0 16px 22px; position: relative; }
.profile-photo .avatar { border: 4px solid var(--surface); box-shadow: var(--shadow); }
.profile-main { flex: 1; min-width: 220px; padding-top: 10px; }
.profile-main h2 { font-size: 1.25rem; font-weight: 700; }
.profile-facts { display: grid; grid-template-columns: repeat(2, minmax(140px, auto)); gap: 10px 30px; margin: 0; font-size: .84rem; padding: 12px 22px 16px 0; }
.profile-facts dt { color: var(--text-faint); font-weight: 500; font-size: .74rem; }
.profile-facts dd { margin: 0; font-weight: 550; }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.mini-stats > div { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--surface-2); }
.mini-stats .n { display: block; font-size: 1.3rem; font-weight: 700; color: var(--text); }
.mini-stats .l { display: block; font-size: .72rem; color: var(--text-muted); }
@media (max-width: 767.98px) { .mini-stats { grid-template-columns: repeat(2, 1fr); } .profile-facts { padding-left: 22px; } }

/* ---------- Roles & permissions --------------------------------------------------------------------------- */
.perm-group { border-bottom: 1px solid var(--border); }
.perm-group:last-child { border-bottom: 0; }
.perm-group-head { display: flex; justify-content: space-between; align-items: center; padding: 11px 18px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: .85rem; }
.perm-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 18px; font-size: .86rem; cursor: pointer; margin: 0; border-radius: 10px; transition: background .12s; }
.perm-item:hover { background: var(--primary-50); }
.perm-item .form-check-input { margin-top: 3px; flex: none; }
.perm-item.locked { cursor: default; opacity: .65; }
.perm-item.locked:hover { background: transparent; }

/* ---------- Reports & quick links ---------------------------------------------------------------------------- */
.report-card { display: flex; gap: 13px; align-items: flex-start; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); color: var(--text); height: 100%; box-shadow: var(--shadow-sm); transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s; }
a.report-card:hover { transform: translateY(-2px); border-color: var(--primary-100); box-shadow: var(--shadow); color: var(--text); }
a.report-card:hover .report-ic { background: var(--primary); color: #fff; }
.report-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; flex: none; font-size: 1.05rem; transition: background .2s, color .2s; }
.report-meta { padding: 9px 14px; font-size: .78rem; color: var(--text-muted); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.logo-preview { height: 130px; border: 2px dashed var(--border-strong); border-radius: 14px; display: grid; place-items: center; background: var(--surface-2); }
.logo-preview img { max-height: 104px; max-width: 90%; }

/* ---------- Command palette -------------------------------------------------------------------------------- */
.cmdk .modal-dialog { max-width: 620px; margin-top: 9vh; }
.cmdk .modal-content { overflow: hidden; }
.cmdk-input { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.cmdk-input .bi { color: var(--text-faint); font-size: 1.1rem; }
.cmdk-input input { border: 0; outline: 0; background: transparent; flex: 1; font-size: 1rem; color: var(--text); }
.cmdk-list { max-height: 420px; overflow-y: auto; padding: 8px; }
.cmdk-group { font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); font-weight: 650; padding: 10px 10px 4px; }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; color: var(--text); cursor: pointer; }
.cmdk-item .ic { width: 32px; height: 32px; border-radius: 9px; background: var(--surface-3); color: var(--text-muted); display: grid; place-items: center; flex: none; }
.cmdk-item small { display: block; color: var(--text-faint); font-size: .75rem; }
.cmdk-item.on, .cmdk-item:hover { background: var(--primary-50); color: var(--text); }
.cmdk-item.on .ic { background: var(--primary); color: #fff; }
.cmdk-empty { padding: 30px; text-align: center; color: var(--text-faint); font-size: .875rem; }
.cmdk-foot { display: flex; gap: 14px; padding: 9px 16px; border-top: 1px solid var(--border); font-size: .74rem; color: var(--text-faint); background: var(--surface-2); }

/* ---------- Timetable grid ----------------------------------------------------------------------------------- */
.tt-grid { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .8rem; }
.tt-grid th, .tt-grid td { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px; vertical-align: top; }
.tt-grid thead th { position: sticky; top: 0; background: var(--surface-2); z-index: 2; text-align: center; font-weight: 650; color: var(--text); }
.tt-grid thead th .t { display: block; font-weight: 400; color: var(--text-faint); font-size: .7rem; }
.tt-grid th.rowhead { position: sticky; left: 0; background: var(--surface-2); z-index: 1; text-align: left; white-space: nowrap; min-width: 92px; }
.tt-grid td { min-width: 100px; height: 58px; background: var(--surface); }
.tt-grid td.off { background: repeating-linear-gradient(135deg, var(--surface-2), var(--surface-2) 5px, var(--surface-3) 5px, var(--surface-3) 10px); }
.tt-grid td.recess { background: var(--warning-bg); text-align: center; color: var(--warning); font-weight: 600; vertical-align: middle; }
.tt-cell { border-radius: 9px; padding: 5px 8px; background: var(--primary-50); border-left: 3px solid var(--primary); margin-bottom: 3px; transition: transform .12s, box-shadow .12s; }
.tt-cell:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.tt-cell.par { background: var(--review-bg); border-left-color: var(--review); }
.tt-cell.notch { background: var(--warning-bg); border-left-color: var(--warning); }
.tt-cell .s { font-weight: 650; color: var(--text); display: block; }
.tt-cell .t { color: var(--text-muted); font-size: .72rem; }
.tt-edit { display: block; color: var(--text-faint); font-size: .72rem; }
.tt-edit:hover { color: var(--primary); }
.day-cards { display: none; }
@media (max-width: 767.98px) { .tt-desktop { display: none; } .day-cards { display: block; } }
.day-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
.day-card h3 { font-size: .9rem; padding: 10px 12px; margin: 0; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.day-card ul { list-style: none; margin: 0; padding: 0; }
.day-card li { display: flex; gap: 12px; padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: .85rem; }
.day-card li:last-child { border-bottom: 0; }
.day-card .p { width: 50px; flex: none; color: var(--primary); font-weight: 650; }

/* ---------- Diary ---------------------------------------------------------------------------------------------- */
.period-card { display: flex; gap: 14px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; transition: background .12s; }
.period-card:hover { background: var(--surface-2); }
.period-card:last-child { border-bottom: 0; }
.period-badge { width: 56px; height: 52px; border-radius: 13px; background: linear-gradient(135deg, var(--primary-50), var(--accent-50)); color: var(--primary); display: grid; place-items: center; text-align: center; flex: none; line-height: 1.1; }
.period-badge strong { font-size: 1rem; display: block; }
.period-badge span { font-size: .62rem; color: var(--text-muted); }
.period-card .info { flex: 1; min-width: 200px; }
.period-card .info .title { font-weight: 650; color: var(--text); }
.period-card .info .meta { font-size: .8rem; color: var(--text-muted); }
.period-card.muted { opacity: .55; }
.topic-list { border: 1px solid var(--border); border-radius: 12px; max-height: 440px; overflow-y: auto; }
.topic-item { padding: 10px 14px; border-bottom: 1px solid var(--border); transition: background .12s; }
.topic-item:hover { background: var(--surface-2); }
.topic-item:last-child { border-bottom: 0; }
.topic-item.is-selected { background: var(--primary-50); }
.topic-item .unit { font-size: .72rem; color: var(--text-faint); }
.topic-extra { display: none; margin-top: 8px; padding-left: 26px; animation: fadeUp .2s var(--ease); }
.topic-item.is-selected .topic-extra { display: block; }
.subtopics { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: .82rem; }
.choice { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin: 0; cursor: pointer; transition: border-color .15s, background .15s; }
.choice:hover { border-color: var(--border-strong); }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-50); }
.choice .form-check-input { margin: 0; }

.wizard-steps { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.wizard-steps a, .wizard-steps span { display: inline-flex; align-items: center; gap: 8px; padding: 7px 13px; font-size: .82rem; color: var(--text-muted); border: 1px solid var(--border); border-radius: 30px; background: var(--surface); }
.wizard-steps a:hover { border-color: var(--border-strong); color: var(--text); }
.wizard-steps .done { color: var(--success); border-color: transparent; background: var(--success-bg); }
.wizard-steps .current { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 4px 12px rgba(79, 70, 229, .25); }
.wizard-steps .n { width: 20px; height: 20px; border-radius: 50%; background: rgba(0,0,0,.06); display: grid; place-items: center; font-size: .7rem; font-weight: 700; }
.wizard-steps .current .n { background: rgba(255,255,255,.25); }

.chart-box { position: relative; height: 250px; }

/* ---------- Sign-in ------------------------------------------------------------------------------------------- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); }
.auth-side { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px; color: #fff;
  background: radial-gradient(700px 400px at 20% 10%, rgba(255,255,255,.18), transparent 60%), linear-gradient(140deg, #4338ca 0%, #6d28d9 55%, #0d9488 120%); }
.auth-side::before, .auth-side::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.08); }
.auth-side::before { width: 420px; height: 420px; right: -140px; top: -120px; }
.auth-side::after { width: 300px; height: 300px; left: -100px; bottom: -110px; }
.auth-side .brand { position: relative; text-align: center; }
.auth-side .brand .logo { width: 96px; height: 96px; border-radius: 26px; background: rgba(255,255,255,.95); display: grid; place-items: center; margin: 0 auto 18px; box-shadow: 0 18px 40px rgba(0,0,0,.2); overflow: hidden; font-size: 2.3rem; color: var(--primary-700); }
.auth-side .brand .logo img { max-width: 80%; max-height: 80%; }
.auth-side h1 { color: #fff; font-size: 1.7rem; font-weight: 700; margin: 0; }
.auth-side p { color: rgba(255,255,255,.8); margin: 6px 0 0; }
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 20px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 30px; animation: fadeUp .4s var(--ease) both; }
.auth-card h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 4px; }
.auth-foot { margin-top: 18px; font-size: .75rem; color: var(--text-faint); text-align: center; }
.input-icon { position: relative; }
.input-icon .bi { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }
.input-icon .form-control { padding-left: 36px; height: 44px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--text-faint); padding: 6px 8px; }
.auth-brand-mobile { display: none; text-align: center; margin-bottom: 18px; }
@media (max-width: 991.98px) { .auth-page { grid-template-columns: 1fr; } .auth-side { display: none; } .auth-brand-mobile { display: block; } }

/* ---------- Print -------------------------------------------------------------------------------------------- */
@media print {
  .sidebar, .topbar, .footer, .no-print, .page-head .btn, .page-head .btn-group, .page-head .dropdown, .filters, .toolbar, .pager-bar, .toast-stack, .hero .btn { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0; max-width: none; animation: none; }
  body { background: #fff; font-size: 11px; }
  .card-x { border: 0; box-shadow: none; }
  .tt-grid td { height: auto; min-width: 0; }
  .tt-desktop { display: block !important; }
  .day-cards { display: none !important; }
  .table-wrap { overflow: visible; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
