/*
  modern.css — PALM's modern look (with /js/modern.js), opt-in per page.

  A page adopts it with <body class="ui-modern"> and its content wrapper marked
  .ui-main; every rule below is scoped to body.ui-modern, so pages without the class
  are not touched. Nothing here changes ids, scripts or the page's own markup logic:
  it restyles the shared building blocks (Bootstrap, .kpi-card[data-tone], .period-card,
  .list-group, modals, forms) and adds a few optional ones (.ui-hero, .ui-quick).

  Light and dark themes: html[data-theme="dark"] (set by modern.js, also sets
  Bootstrap's data-bs-theme). Respects prefers-reduced-motion.
*/

/* ---------------- tokens ---------------- */
html {
  --ui-bg: #f4f6fb;
  --ui-surface: #ffffff;
  --ui-surface-2: #f8fafc;
  --ui-border: rgba(15, 23, 42, 0.08);
  --ui-text: #0f172a;
  --ui-muted: #64748b;
  --ui-primary: #4f46e5;
  --ui-primary-2: #7c3aed;
  --ui-primary-soft: rgba(79, 70, 229, 0.10);
  --ui-ring: rgba(79, 70, 229, 0.28);
  --ui-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 30px -14px rgba(15, 23, 42, 0.18);
  --ui-shadow-hover: 0 2px 4px rgba(15, 23, 42, 0.05), 0 18px 40px -16px rgba(15, 23, 42, 0.28);
  --ui-radius: 18px;
  --ui-radius-sm: 12px;
  --ui-good: #059669;  --ui-good-soft: rgba(16, 185, 129, 0.12);
  --ui-mid: #b45309;   --ui-mid-soft: rgba(245, 158, 11, 0.16);
  --ui-low: #be123c;   --ui-low-soft: rgba(244, 63, 94, 0.12);
  --ui-font: "Inter", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", sans-serif;
}
html[data-theme="dark"] {
  --ui-bg: #0b1020;
  --ui-surface: #121a2e;
  --ui-surface-2: #182238;
  --ui-border: rgba(148, 163, 184, 0.14);
  --ui-text: #e2e8f0;
  --ui-muted: #94a3b8;
  --ui-primary: #818cf8;
  --ui-primary-2: #a78bfa;
  --ui-primary-soft: rgba(129, 140, 248, 0.14);
  --ui-ring: rgba(129, 140, 248, 0.35);
  --ui-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -16px rgba(0, 0, 0, 0.6);
  --ui-shadow-hover: 0 2px 6px rgba(0, 0, 0, 0.35), 0 20px 44px -18px rgba(0, 0, 0, 0.7);
  --ui-good: #34d399;  --ui-good-soft: rgba(52, 211, 153, 0.14);
  --ui-mid: #fbbf24;   --ui-mid-soft: rgba(251, 191, 36, 0.14);
  --ui-low: #fb7185;   --ui-low-soft: rgba(251, 113, 133, 0.14);
}

/* ---------------- page ---------------- */
body.ui-modern {
  font-family: var(--ui-font);
  color: var(--ui-text);
  background:
    radial-gradient(1100px 520px at 8% -8%, rgba(99, 102, 241, 0.13), transparent 60%),
    radial-gradient(900px 480px at 105% 4%, rgba(14, 165, 233, 0.10), transparent 60%),
    var(--ui-bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
html[data-theme="dark"] body.ui-modern {
  background:
    radial-gradient(1100px 520px at 8% -8%, rgba(99, 102, 241, 0.20), transparent 60%),
    radial-gradient(900px 480px at 105% 4%, rgba(14, 165, 233, 0.12), transparent 60%),
    var(--ui-bg);
  background-attachment: fixed;
}
body.ui-modern .ui-main { max-width: 1320px; margin-inline: auto; }
body.ui-modern .text-muted { color: var(--ui-muted) !important; }

/* ---------------- hero ---------------- */
body.ui-modern .ui-hero {
  position: relative;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 1.5rem;
  padding: 1.4rem 1.6rem;
  margin-bottom: 1.4rem;
  border-radius: calc(var(--ui-radius) + 4px);
  background:
    radial-gradient(600px 220px at 0% 0%, rgba(255, 255, 255, 0.18), transparent 70%),
    linear-gradient(120deg, #4338ca 0%, #6d28d9 55%, #0ea5e9 130%);
  color: #fff;
  box-shadow: 0 18px 40px -20px rgba(67, 56, 202, 0.65);
  overflow: hidden;
}
body.ui-modern .ui-hero::after {          /* soft light circles */
  content: ""; position: absolute; inset: auto -60px -90px auto; width: 260px; height: 260px;
  border-radius: 50%; background: rgba(255, 255, 255, 0.08); pointer-events: none;
}
[dir="rtl"] body.ui-modern .ui-hero::after, body.ui-modern.rtl .ui-hero::after { inset: auto auto -90px -60px; }
body.ui-modern .ui-hero-title { font-size: clamp(1.25rem, 1.2vw + 1rem, 1.75rem); font-weight: 800; margin: 0; letter-spacing: -0.01em; }
body.ui-modern .ui-main .ui-hero .ui-hero-title { color: #fff; }   /* over the generic .ui-main heading colour */
body.ui-modern .ui-hero-sub { margin-top: 0.3rem; opacity: 0.85; font-size: 0.92rem; display: flex; flex-wrap: wrap; gap: 0.4rem 0.8rem; align-items: center; }
body.ui-modern .ui-chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.2rem 0.65rem; border-radius: 999px;
  background: rgba(255, 255, 255, 0.16); border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 0.78rem; font-weight: 600;
}
body.ui-modern .ui-quick { display: flex; flex-wrap: wrap; gap: 0.5rem; position: relative; z-index: 1; }
body.ui-modern .ui-quick a {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.55rem 0.9rem; border-radius: 14px;
  color: #fff; text-decoration: none; font-weight: 600; font-size: 0.88rem;
  background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(6px);
  transition: background 0.2s ease, transform 0.15s ease;
}
body.ui-modern .ui-quick a:hover { background: rgba(255, 255, 255, 0.26); transform: translateY(-2px); }
body.ui-modern .ui-quick a:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
body.ui-modern .ui-quick i { font-size: 1rem; }

/* ---------------- KPI cards ---------------- */
body.ui-modern .kpi-card[data-tone] {
  --tone: var(--ui-primary); --tone-2: var(--ui-primary-2);
  position: relative; overflow: hidden;
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--ui-shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
body.ui-modern .kpi-card[data-tone="indigo"]  { --tone: #6366f1; --tone-2: #8b5cf6; }
body.ui-modern .kpi-card[data-tone="sky"]     { --tone: #0ea5e9; --tone-2: #22d3ee; }
body.ui-modern .kpi-card[data-tone="emerald"] { --tone: #10b981; --tone-2: #34d399; }
body.ui-modern .kpi-card[data-tone="amber"]   { --tone: #f59e0b; --tone-2: #fb923c; }
body.ui-modern .kpi-card[data-tone]::after {          /* tone glow in the corner */
  content: ""; position: absolute; width: 140px; height: 140px; border-radius: 50%;
  inset-block-start: -60px; inset-inline-end: -50px;
  background: radial-gradient(circle, color-mix(in srgb, var(--tone) 22%, transparent), transparent 70%);
  pointer-events: none;
}
body.ui-modern .kpi-card[data-tone]:hover { transform: translateY(-3px); box-shadow: var(--ui-shadow-hover); border-color: color-mix(in srgb, var(--tone) 35%, var(--ui-border)); }
body.ui-modern .kpi-card[data-tone] .kpi-label { color: var(--ui-muted); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 0.55rem; }
body.ui-modern .kpi-card[data-tone] .kpi-label { padding-inline-end: 3.3rem; }   /* never under the icon */
body.ui-modern .kpi-card[data-tone] .kpi-value {
  color: var(--ui-text); font-size: clamp(1.6rem, 1.2vw + 1.2rem, 2.1rem); font-weight: 800;
  letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums;
}
body.ui-modern .kpi-card[data-tone] .kpi-icon {
  position: absolute; top: 1rem; right: 1rem; left: auto; transform: none;
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 13px; font-size: 1.15rem; opacity: 1; color: #fff;
  background: linear-gradient(135deg, var(--tone), var(--tone-2));
  box-shadow: 0 8px 18px -8px color-mix(in srgb, var(--tone) 70%, transparent);
  z-index: 1;
}
[dir="rtl"] body.ui-modern .kpi-card[data-tone] .kpi-icon, body.ui-modern.rtl .kpi-card[data-tone] .kpi-icon { left: 1rem; right: auto; }
/* loading: a shimmering placeholder instead of the spinner */
body.ui-modern .kpi-card[data-tone] .kpi-value .spinner-border { display: none; }
body.ui-modern .kpi-card[data-tone] .kpi-value:has(.spinner-border)::before {
  content: ""; display: block; width: 64px; height: 1.6rem; border-radius: 8px;
  background: linear-gradient(90deg, var(--ui-surface-2) 25%, var(--ui-border) 50%, var(--ui-surface-2) 75%);
  background-size: 200% 100%; animation: ui-shimmer 1.2s linear infinite;
}
@keyframes ui-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------------- section cards (period tables, modules) ---------------- */
body.ui-modern .period-card {
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  box-shadow: var(--ui-shadow);
  overflow: hidden;
  margin-bottom: 1.25rem;
}
body.ui-modern .period-header {
  display: flex; align-items: center; gap: 0.65rem;
  background: transparent; color: var(--ui-text);
  padding: 1rem 1.25rem; font-size: 1rem; font-weight: 700;
  border-bottom: 1px solid var(--ui-border);
}
body.ui-modern .period-header > i:first-child {
  width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 10px;
  background: var(--ui-primary-soft); color: var(--ui-primary); font-size: 1rem; margin: 0;
}

/* tables */
body.ui-modern .ui-main .table-responsive { border: 0; border-radius: 0; margin: 0; }
body.ui-modern .ui-main .table {
  --bs-table-bg: transparent; --bs-table-hover-bg: var(--ui-primary-soft); --bs-table-color: var(--ui-text);
  --bs-table-hover-color: var(--ui-text);
  margin: 0; color: var(--ui-text); font-size: 0.92rem;
}
body.ui-modern .ui-main .table thead th {
  background: var(--ui-surface-2); color: var(--ui-muted);
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  border: 0; border-bottom: 1px solid var(--ui-border); padding: 0.8rem 1rem; white-space: nowrap;
}
body.ui-modern .ui-main .table tbody td {
  border-color: var(--ui-border); padding: 0.85rem 1rem; vertical-align: middle; font-variant-numeric: tabular-nums;
}
body.ui-modern .ui-main .table tbody tr:last-child td { border-bottom: 0; }
body.ui-modern .ui-main .table-hover > tbody > tr:hover > * { background: var(--ui-primary-soft); }

/* badges: soft pills */
body.ui-modern .ui-main .badge { border-radius: 999px; font-weight: 700; padding: 0.38em 0.75em; letter-spacing: 0.01em; }
body.ui-modern .ui-main .badge-good { background: var(--ui-good-soft); color: var(--ui-good); }
body.ui-modern .ui-main .badge-mid  { background: var(--ui-mid-soft);  color: var(--ui-mid); }
body.ui-modern .ui-main .badge-low  { background: var(--ui-low-soft);  color: var(--ui-low); }
body.ui-modern .ui-main .badge-type { background: var(--ui-primary-soft); color: var(--ui-primary); }

/* lists (e.g. "My modules"): each item a small card */
body.ui-modern .ui-main .list-group { gap: 0.65rem; border-radius: 0; }
body.ui-modern .ui-main .list-group-item {
  border: 1px solid var(--ui-border) !important; border-radius: var(--ui-radius-sm) !important;
  background: var(--ui-surface); color: var(--ui-text);
  padding: 0.95rem 1.05rem; transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
body.ui-modern .ui-main .list-group-item:hover {
  border-color: color-mix(in srgb, var(--ui-primary) 40%, var(--ui-border)) !important;
  box-shadow: var(--ui-shadow); transform: translateY(-1px);
}

/* progress lines (chapters covered vs expected): a visible track whatever the text length */
body.ui-modern .ui-main .pg-row { flex-wrap: wrap; row-gap: 0.25rem; }
body.ui-modern .ui-main .pg-track { min-width: 110px; background: var(--ui-border) !important; overflow: visible; }
body.ui-modern .ui-main .pg-mark { background: var(--ui-text) !important; border-radius: 2px; }

/* empty / loading states */
body.ui-modern .empty-state { color: var(--ui-muted); padding: 3rem 1rem; text-align: center; }
body.ui-modern .empty-state i { font-size: 2.6rem; opacity: 0.5; }

/* ---------------- common page content (Bootstrap) inside .ui-main ---------------- */
body.ui-modern .ui-main h1, body.ui-modern .ui-main h2, body.ui-modern .ui-main h3,
body.ui-modern .ui-main h4, body.ui-modern .ui-main h5 { color: var(--ui-text); letter-spacing: -0.01em; }
body.ui-modern .ui-main .card {
  background: var(--ui-surface); color: var(--ui-text);
  border: 1px solid var(--ui-border); border-radius: var(--ui-radius); box-shadow: var(--ui-shadow);
  overflow: hidden;
}
body.ui-modern .ui-main .card-header {
  background: transparent; color: var(--ui-text); font-weight: 700;
  border-bottom: 1px solid var(--ui-border); padding: 0.95rem 1.2rem;
}
body.ui-modern .ui-main .card-footer { background: var(--ui-surface-2); border-top: 1px solid var(--ui-border); }
body.ui-modern .ui-main .card-body { color: var(--ui-text); }
/* a table standing alone (not in a card): same surface */
body.ui-modern .ui-main .table-container,
body.ui-modern .ui-main > .table-responsive {
  background: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: var(--ui-radius);
  box-shadow: var(--ui-shadow); overflow: auto;
}
body.ui-modern .ui-main .nav-tabs { border-bottom-color: var(--ui-border); gap: 0.25rem; }
body.ui-modern .ui-main .nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--ui-muted); font-weight: 600; border-radius: 0; }
body.ui-modern .ui-main .nav-tabs .nav-link:hover { color: var(--ui-text); }
body.ui-modern .ui-main .nav-tabs .nav-link.active { background: transparent; color: var(--ui-primary); border-bottom-color: var(--ui-primary); }
body.ui-modern .ui-main .nav-pills .nav-link { border-radius: 999px; font-weight: 600; color: var(--ui-muted); }
body.ui-modern .ui-main .nav-pills .nav-link.active { background: linear-gradient(135deg, var(--ui-primary), var(--ui-primary-2)); color: #fff; }
body.ui-modern .ui-main .alert { border-radius: var(--ui-radius-sm); border-width: 1px; }
body.ui-modern .ui-main .form-label, body.ui-modern .modal .form-label { font-weight: 600; color: var(--ui-muted); font-size: 0.85rem; }
body.ui-modern .ui-main .pagination .page-link { border-radius: 10px; margin: 0 2px; border-color: var(--ui-border); color: var(--ui-text); background: var(--ui-surface); }
body.ui-modern .ui-main .pagination .page-item.active .page-link { background: var(--ui-primary); border-color: var(--ui-primary); color: #fff; }
body.ui-modern .dropdown-menu { border-radius: var(--ui-radius-sm); border-color: var(--ui-border); box-shadow: var(--ui-shadow); }
body.ui-modern .ui-main .btn-success { border: 0; background: linear-gradient(135deg, #10b981, #059669); }
body.ui-modern .ui-main .btn-danger { border: 0; background: linear-gradient(135deg, #f43f5e, #e11d48); }
body.ui-modern .ui-main .btn-warning { border: 0; }
body.ui-modern .ui-main .btn-secondary { border: 0; }

/* ---------------- buttons, forms, modals ---------------- */
body.ui-modern .ui-main .btn, body.ui-modern .modal .btn { border-radius: var(--ui-radius-sm); font-weight: 600; }
body.ui-modern .ui-main .btn-primary, body.ui-modern .modal .btn-primary {
  border: 0; background: linear-gradient(135deg, var(--ui-primary), var(--ui-primary-2));
  box-shadow: 0 8px 18px -10px var(--ui-primary);
}
body.ui-modern .ui-main .btn-primary:hover, body.ui-modern .modal .btn-primary:hover { filter: brightness(1.07); }
body.ui-modern .ui-main .btn-outline-primary { --bs-btn-color: var(--ui-primary); --bs-btn-border-color: color-mix(in srgb, var(--ui-primary) 45%, transparent); --bs-btn-hover-bg: var(--ui-primary); --bs-btn-hover-border-color: var(--ui-primary); }
body.ui-modern .ui-main .btn-outline-secondary { --bs-btn-color: var(--ui-muted); --bs-btn-border-color: var(--ui-border); --bs-btn-hover-bg: var(--ui-surface-2); --bs-btn-hover-color: var(--ui-text); --bs-btn-hover-border-color: var(--ui-border); }
body.ui-modern .form-control, body.ui-modern .form-select {
  border-radius: var(--ui-radius-sm); border-color: var(--ui-border); background-color: var(--ui-surface); color: var(--ui-text);
}
body.ui-modern .form-control:focus, body.ui-modern .form-select:focus { border-color: var(--ui-primary); box-shadow: 0 0 0 4px var(--ui-ring); }
body.ui-modern .modal-content { border: 1px solid var(--ui-border); border-radius: calc(var(--ui-radius) + 4px); background: var(--ui-surface); color: var(--ui-text); box-shadow: 0 30px 80px -30px rgba(15, 23, 42, 0.5); }
body.ui-modern .modal-header, body.ui-modern .modal-footer { border-color: var(--ui-border); }
body.ui-modern .modal-header { padding: 1.1rem 1.4rem; }
body.ui-modern .modal-title { font-weight: 700; }
body.ui-modern .modal-backdrop.show { opacity: 0.45; backdrop-filter: blur(3px); }

/* ---------------- the page's own colour variables, mapped to the theme ---------------- */
body.ui-modern {
  --card-bg: var(--ui-surface);
  --border-color: var(--ui-border);
  --bg: var(--ui-bg);
}

/* ---------------- .header-bar (student dashboard, teacher timetable): same look as the top bar ---------------- */
body.ui-modern .header-bar {
  background: linear-gradient(120deg, #1e293b 0%, #2c3e50 45%, #3b82f6 100%);
  border-bottom: 0;
  box-shadow: 0 6px 24px -14px rgba(15, 23, 42, 0.7);
}
body.ui-modern .header-bar .btn {
  border-radius: 12px; font-weight: 600; color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22); background: rgba(255, 255, 255, 0.10);
}
body.ui-modern .header-bar .btn:hover { background: rgba(255, 255, 255, 0.24); color: #fff; }
body.ui-modern .header-bar .btn-outline-warning { color: #fde68a; border-color: rgba(253, 230, 138, 0.45); }
body.ui-modern .header-bar .btn-outline-warning:hover { background: #dc3545; border-color: #dc3545; color: #fff; }
body.ui-modern .header-bar .header-title { flex-shrink: 0; }
body.ui-modern .header-bar .ui-has-shortcut,
body.ui-modern .header-bar .badge-container:has(> .ui-has-shortcut) { display: none !important; }   /* in the hero instead */            /* the title keeps its room beside many buttons */
body.ui-modern .header-bar .header-title h4,
body.ui-modern .header-bar .class-info { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
@media (max-width: 576px) {
  body.ui-modern .header-bar { gap: 0.4rem; }
  body.ui-modern .header-bar .header-logo { display: none; }            /* the university seal: room for the title */
  body.ui-modern .header-bar .header-brand { min-width: 0; flex: 1 1 auto; }
  body.ui-modern .header-bar .header-title { flex-shrink: 1; min-width: 0; }   /* phones: shortened with … */
  /* the buttons: one row that scrolls sideways (the title keeps its room) */
  body.ui-modern .header-bar .header-actions {
    flex-wrap: nowrap; flex: 0 1 auto; min-width: 0; gap: 0.35rem;
    overflow-x: auto; scrollbar-width: none; padding-block: 8px 2px;   /* room for a badge on a button */
  }
  body.ui-modern .header-bar .header-actions::-webkit-scrollbar { display: none; }
  body.ui-modern .header-bar .header-actions > * { flex-shrink: 0; }
  /* buttons with an icon show the icon only (their text stays for screen readers via the title) */
  body.ui-modern .header-bar .header-actions .btn:has(> i) { font-size: 0 !important; gap: 0; padding-inline: 0.55rem !important; }   /* beats pages' #id sizes */
  body.ui-modern .header-bar .header-actions .btn:has(> i) > i { font-size: 1rem; }
}

/* ---------------- weekly timetable (.timetable grid on desktop, day cards on phones) ---------------- */
body.ui-modern .timetable {
  width: 100%; margin: 0 0 2rem;
  background: var(--ui-surface); border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius); box-shadow: var(--ui-shadow);
  gap: 0;
}
body.ui-modern .timetable .header {
  background: var(--ui-surface-2); color: var(--ui-muted);
  border: 0; border-bottom: 1px solid var(--ui-border); border-inline-end: 1px solid var(--ui-border);
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 0.85rem 0.5rem; display: flex; align-items: center; justify-content: center; text-align: center;
}
body.ui-modern .timetable .cell {
  border: 0; border-bottom: 1px solid var(--ui-border); border-inline-end: 1px solid var(--ui-border);
  padding: 0.6rem 0.5rem; font-size: 0.86rem; color: var(--ui-text); line-height: 1.45; background: transparent;
  transition: background-color 0.2s ease;
}
/* a session: tinted, with an accent bar */
body.ui-modern .timetable .cell:has(strong) {
  background: var(--ui-primary-soft);
  box-shadow: inset 3px 0 0 var(--ui-primary);
}
[dir="rtl"] body.ui-modern .timetable .cell:has(strong), body.ui-modern.rtl .timetable .cell:has(strong) { box-shadow: inset -3px 0 0 var(--ui-primary); }
body.ui-modern .timetable .cell strong { color: var(--ui-primary); font-weight: 700; }
body.ui-modern .timetable .cell:hover { background-color: var(--ui-primary-soft); }
/* now / next / make-up */
body.ui-modern .timetable .highlight-current {
  background: var(--ui-good-soft) !important; border: 0 !important; border-bottom: 1px solid var(--ui-border) !important;
  box-shadow: inset 0 0 0 2px var(--ui-good) !important; animation: none;
}
body.ui-modern .timetable .highlight-next {
  background: var(--ui-mid-soft) !important; border: 0 !important; border-bottom: 1px solid var(--ui-border) !important;
  box-shadow: inset 0 0 0 2px #f59e0b !important; animation: none;
}
body.ui-modern .timetable .makeup-session {
  background: rgba(14, 165, 233, 0.12) !important; border: 0 !important; border-bottom: 1px solid var(--ui-border) !important;
  box-shadow: inset 0 0 0 2px #0ea5e9 !important; animation: none;
}
body.ui-modern .timetable .highlight-current strong { color: var(--ui-good); }
body.ui-modern .timetable .highlight-next strong { color: var(--ui-mid); }

@media (max-width: 768px) {
  body.ui-modern .timetable { background: transparent; border: 0; box-shadow: none; border-radius: 0; }
  body.ui-modern .day-section {
    margin: 0 0 0.7rem; background: var(--ui-surface); border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius-sm); box-shadow: var(--ui-shadow); overflow: hidden;
  }
  body.ui-modern .day-header {
    display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
    background: transparent; color: var(--ui-text); font-weight: 700; padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--ui-border);
  }
  body.ui-modern .day-header::after {               /* open: points down */
    content: ""; display: inline-block; flex-shrink: 0; width: 8px; height: 8px; margin-inline: 0.35rem;
    border-right: 2px solid var(--ui-muted); border-bottom: 2px solid var(--ui-muted);
    transform: translateY(-2px) rotate(45deg); transition: transform 0.2s ease;
  }
  body.ui-modern .day-header:has(+ .collapse:not(.show))::after { transform: rotate(-45deg); }   /* closed: points forward */
  [dir="rtl"] body.ui-modern .day-header:has(+ .collapse:not(.show))::after,
  body.ui-modern.rtl .day-header:has(+ .collapse:not(.show))::after { transform: rotate(135deg); }
  body.ui-modern .session { border-top: 1px solid var(--ui-border); padding: 0.7rem 1rem; }
  body.ui-modern .session:first-child { border-top: 0; }
  body.ui-modern .session:has(strong) { box-shadow: inset 3px 0 0 var(--ui-primary); }
[dir="rtl"] body.ui-modern .session:has(strong), body.ui-modern.rtl .session:has(strong) { box-shadow: inset -3px 0 0 var(--ui-primary); }
  body.ui-modern .session strong { color: var(--ui-text); font-size: 0.98rem; }
  body.ui-modern .session small { color: var(--ui-muted); }
  body.ui-modern .session .time-label {
    display: inline-block; color: var(--ui-muted); font-size: 0.78rem; font-weight: 600;
    background: var(--ui-surface-2); border-radius: 999px; padding: 0.1rem 0.55rem; margin-bottom: 0.35rem;
  }
  body.ui-modern .session .time-label.bold { color: var(--ui-primary); background: var(--ui-primary-soft); }
}

/* several sessions in one slot (teacher timetable): each .session-entry is a small card */
body.ui-modern .timetable .session-entry {
  background: transparent; border: 0; border-radius: 10px; padding: 0.35rem 0.4rem; color: var(--ui-text);
}
body.ui-modern .timetable .session-entry strong { color: var(--ui-primary); }
body.ui-modern .timetable .session-entry small { color: var(--ui-muted); }
body.ui-modern .timetable .session-entry.makeup-badge { background: rgba(14, 165, 233, 0.12); box-shadow: inset 0 0 0 1px #0ea5e9; }
body.ui-modern .timetable .session-divider { border-color: var(--ui-border); opacity: 1; }
body.ui-modern .timetable .session-entry.highlight-current,
body.ui-modern .timetable .session-entry.highlight-next { padding: 0.6rem; border-radius: 12px; }
@media (max-width: 768px) {
  body.ui-modern .session .session-entry {
    background: var(--ui-surface-2); border: 0; border-inline-start: 3px solid var(--ui-primary); border-radius: 10px;
  }
  body.ui-modern .session:has(.session-entry) { box-shadow: none; }      /* the entries carry the accent bar */
}

/* the wish-form banner (wish-banner.js) on modern pages: aligned and themed */
body.ui-modern #wishBanner {
  max-width: 1320px; width: calc(100% - 2rem); margin: 1rem auto 0 !important;
  background: var(--ui-surface) !important; color: var(--ui-text);
  border-radius: var(--ui-radius-sm) !important; box-shadow: var(--ui-shadow) !important;
  border-top: 1px solid var(--ui-border); border-bottom: 1px solid var(--ui-border); border-inline-end: 1px solid var(--ui-border);
}
body.ui-modern #wishBanner div[style*="color:#4b5563"] { color: var(--ui-muted) !important; }

/* ---------------- "Now / Next" card (in the hero) ---------------- */
body.ui-modern .ui-now {
  position: relative; z-index: 1; min-width: min(100%, 300px); max-width: 420px;
  padding: 0.9rem 1rem; border-radius: 16px;
  background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.24); backdrop-filter: blur(6px);
}
body.ui-modern .ui-now-tag {
  display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.72rem; font-weight: 800;
  letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.92;
}
body.ui-modern .ui-now-tag .dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.25); }
body.ui-modern .ui-now[data-state="next"] .ui-now-tag .dot { background: #fbbf24; box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.25); }
body.ui-modern .ui-now[data-state="none"] .ui-now-tag .dot { background: rgba(255, 255, 255, 0.6); box-shadow: none; }
body.ui-modern .ui-now-title { font-size: 1.05rem; font-weight: 800; margin-top: 0.25rem; line-height: 1.25; }
body.ui-modern .ui-now-meta { font-size: 0.84rem; opacity: 0.88; margin-top: 0.2rem; }
body.ui-modern .ui-now-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.7rem; }
body.ui-modern .ui-now-actions:empty { display: none; }
body.ui-modern .ui-now-actions button {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.4rem 0.8rem; border-radius: 12px;
  font-weight: 700; font-size: 0.84rem; border: 0; color: #312e81; background: #fff;
  box-shadow: 0 6px 16px -8px rgba(0, 0, 0, 0.45); transition: transform 0.15s ease;
}
body.ui-modern .ui-now-actions button:hover { transform: translateY(-1px); }
body.ui-modern .ui-now-actions button.ghost { background: rgba(255, 255, 255, 0.16); color: #fff; box-shadow: none; border: 1px solid rgba(255, 255, 255, 0.3); }
@media (prefers-reduced-motion: no-preference) {
  body.ui-modern .ui-now[data-state="now"] .ui-now-tag .dot { animation: ui-ping 1.6s ease-in-out infinite; }
  @keyframes ui-ping { 50% { box-shadow: 0 0 0 7px rgba(74, 222, 128, 0); } }
}
body.ui-modern .ui-quick button {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.55rem 0.9rem; border-radius: 14px; color: #fff; font-weight: 600; font-size: 0.88rem;
  background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.24);
  transition: background 0.2s ease, transform 0.15s ease;
}
body.ui-modern .ui-quick button:hover { background: rgba(255, 255, 255, 0.26); transform: translateY(-2px); }
body.ui-modern .ui-quick button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (max-width: 768px) {
  body.ui-modern .ui-quick button { flex: 1 1 calc(50% - 0.5rem); justify-content: center; }
  body.ui-modern .ui-now { max-width: none; width: 100%; }
}

/* ---------------- theme button (in the top bar) ---------------- */
body.ui-modern .ui-theme-btn { display: inline-flex !important; }   /* stays visible on phones */
body.ui-modern .ui-theme-btn i { font-size: 1rem; }

/* ---------------- dark: page parts that hard-code white ---------------- */
html[data-theme="dark"] body.ui-modern .mobile-menu { background: var(--ui-surface); color: var(--ui-text); }
html[data-theme="dark"] body.ui-modern .mobile-menu-item { color: var(--ui-text); }
html[data-theme="dark"] body.ui-modern .mobile-menu-footer, html[data-theme="dark"] body.ui-modern .mobile-menu-divider { border-color: var(--ui-border); background: transparent; }
html[data-theme="dark"] body.ui-modern .alert-light { background: var(--ui-surface-2); color: var(--ui-text); border-color: var(--ui-border); }

/* ---------------- phones: table rows become cards (page keeps its own layout) ---------------- */
@media (max-width: 768px) {
  body.ui-modern .ui-hero { padding: 1.1rem 1.15rem; }
  body.ui-modern .ui-quick a { flex: 1 1 calc(50% - 0.5rem); justify-content: center; }
  body.ui-modern .ui-main .table tbody tr {
    background: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm);
    box-shadow: none; margin: 0.65rem 0.75rem;
  }
  body.ui-modern .ui-main .table tbody td { border-color: var(--ui-border); }
  body.ui-modern .ui-main .table tbody td::before { color: var(--ui-muted); }
  body.ui-modern .kpi-card[data-tone] .kpi-icon { width: 36px; height: 36px; border-radius: 11px; font-size: 1rem; }
  body.ui-modern .kpi-card[data-tone] .kpi-label { padding-inline-end: 2.7rem; }
}

/* ---------------- standalone pages (no top bar: password recovery, help, privacy) ---------------- */
body.ui-modern .ui-main .auth-container,
body.ui-modern .ui-main .privacy-card {
  background: var(--ui-surface);
  color: var(--ui-text);
  border: 1px solid var(--ui-border);
  border-radius: calc(var(--ui-radius) + 4px);
  box-shadow: var(--ui-shadow);
}
body.ui-modern .ui-main .auth-container { max-width: 420px; }
body.ui-modern .ui-main .auth-container h2,
body.ui-modern .ui-main .privacy-card h1 { font-weight: 800; letter-spacing: -0.02em; }
body.ui-modern .ui-main .auth-container .logo img { max-width: 96px; }
body.ui-modern .ui-main .privacy-card .placeholder { background: var(--ui-mid-soft); border-color: transparent; color: var(--ui-text); }
body.ui-modern > header.header {
  background:
    radial-gradient(600px 220px at 0% 0%, rgba(255, 255, 255, 0.18), transparent 70%),
    linear-gradient(120deg, #4338ca 0%, #6d28d9 55%, #0ea5e9 130%);
  color: #fff;
  padding: 1.6rem 1rem;
}
body.ui-modern > footer { color: var(--ui-muted); }
body.ui-modern.bg-light { background-color: var(--ui-bg) !important; }
@media (max-width: 576px) {
  body.ui-modern .ui-main .auth-container { box-shadow: none; }
}

/* ---------------- entrance (cards only: never on containers holding modals) ---------------- */
@media (prefers-reduced-motion: no-preference) {
  body.ui-modern .ui-hero, body.ui-modern .kpi-card[data-tone], body.ui-modern .period-card {
    animation: ui-rise 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
  }
  body.ui-modern .row > :nth-child(2) > .kpi-card[data-tone] { animation-delay: 0.05s; }
  body.ui-modern .row > :nth-child(3) > .kpi-card[data-tone] { animation-delay: 0.10s; }
  body.ui-modern .row > :nth-child(4) > .kpi-card[data-tone] { animation-delay: 0.15s; }
  @keyframes ui-rise { from { opacity: 0; transform: translateY(10px); } }
}
@media (prefers-reduced-motion: reduce) {
  body.ui-modern .kpi-card[data-tone], body.ui-modern .ui-main .list-group-item, body.ui-modern .ui-quick a { transition: none; }
  body.ui-modern .kpi-card[data-tone] .kpi-value:has(.spinner-border)::before { animation: none; }
}
