/* ============================================================
   School Visits System — macOS Tahoe-style component system
   Light appearance, vibrancy sidebar, capsule controls,
   system-blue accent, large-radius panels.
   ============================================================ */

@font-face {
  font-family: "Plex Arabic";
  src: url("fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Plex Arabic";
  src: url("fonts/ibm-plex-sans-arabic-arabic-500-normal.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Plex Arabic";
  src: url("fonts/ibm-plex-sans-arabic-arabic-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Plex Arabic";
  src: url("fonts/ibm-plex-sans-arabic-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Plex Arabic";
  src: url("fonts/ibm-plex-sans-arabic-latin-500-normal.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Plex Arabic";
  src: url("fonts/ibm-plex-sans-arabic-latin-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  /* macOS light appearance tokens */
  --window-bg: #f2f2f7;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --ink: #1d1d1f;
  --ink-2: #3a3a3c;
  --muted: #86868b;
  --separator: rgba(60, 60, 67, 0.12);
  --separator-strong: rgba(60, 60, 67, 0.22);

  --accent: #0a7aff;                 /* system blue */
  --accent-hover: #0066e0;
  --accent-tint: rgba(10, 122, 255, 0.10);
  --accent-tint-2: rgba(10, 122, 255, 0.16);

  --green: #28a745; --green-sys: #34c759;
  --green-tint: rgba(52, 199, 89, 0.13);
  --orange-sys: #ff9500;
  --orange-tint: rgba(255, 149, 0, 0.14);
  --red-sys: #ff3b30; --red-ink: #d70015;
  --red-tint: rgba(255, 59, 48, 0.10);

  --sidebar-bg: rgba(246, 246, 248, 0.86);
  --content-max: 1180px;

  --r-control: 999px;                /* Tahoe capsule controls */
  --r-field: 9px;
  --r-panel: 14px;
  --side-gap: 8pt;                   /* the sidebar's gutter on every side */
  --side-w: 228px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Plex Arabic", "Segoe UI", Tahoma, sans-serif;
  --shadow-control: 0 0.5px 2px rgba(0, 0, 0, 0.10), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
  --shadow-panel: 0 1px 1.5px rgba(0, 0, 0, 0.03), 0 8px 24px rgba(20, 24, 40, 0.05);
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}
html[lang="ar"] body, body.rtl { --font: "Plex Arabic", -apple-system, "Segoe UI", Tahoma, sans-serif; }

/* ============ accent color themes ============ */
html[data-accent="teal"] {
  --accent: #0d9488; --accent-hover: #0b7c72;
  --accent-tint: rgba(13, 148, 136, 0.10); --accent-tint-2: rgba(13, 148, 136, 0.16);
}
html[data-accent="purple"] {
  --accent: #7c5cd6; --accent-hover: #6847c4;
  --accent-tint: rgba(124, 92, 214, 0.10); --accent-tint-2: rgba(124, 92, 214, 0.16);
}
html[data-accent="rose"] {
  --accent: #d6336c; --accent-hover: #bb2a5d;
  --accent-tint: rgba(214, 51, 108, 0.10); --accent-tint-2: rgba(214, 51, 108, 0.16);
}

/* ============ dark mode ============ */
html[data-theme="dark"] {
  --window-bg: #1c1c1e;
  --surface: #2c2c2e;
  --surface-2: #3a3a3c;
  --ink: #f7f7fa;
  --ink-2: #e4e4e9;
  --muted: #a8a8b0;
  --separator: rgba(255, 255, 255, 0.13);
  --separator-strong: rgba(255, 255, 255, 0.24);
  --sidebar-bg: rgba(24, 24, 26, 0.92);
  --shadow-panel: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.3);
  --green-tint: rgba(52, 199, 89, 0.16);
  --orange-tint: rgba(255, 149, 0, 0.18);
  --red-tint: rgba(255, 69, 58, 0.16);
  --green: #32d74b; --red-ink: #ff6961;
  color-scheme: dark;
}
html[data-theme="dark"] .sidebar nav a:hover,
html[data-theme="dark"] .side-footer a:hover { background: rgba(255, 255, 255, 0.08); }
html[data-theme="dark"] .sidebar nav a.active { background: rgba(255, 255, 255, 0.14); }
html[data-theme="dark"] .rolebadge,
html[data-theme="dark"] .rolechip.teacher { background: rgba(255, 255, 255, 0.10); }
html[data-theme="dark"] .btn { background: var(--surface-2); color: var(--ink); }
html[data-theme="dark"] .btn:hover { background: #48484c; }
html[data-theme="dark"] .btn.primary { background: var(--accent); color: #fff; }
html[data-theme="dark"] .btn.primary:hover { background: var(--accent-hover); }
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea {
  background: var(--surface-2); box-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.18);
}
html[data-theme="dark"] .searchbox,
html[data-theme="dark"] .composer-clear,
html[data-theme="dark"] label.radio:hover { background: rgba(255, 255, 255, 0.08); }
html[data-theme="dark"] .searchbox:focus-within { background: var(--surface-2); }
html[data-theme="dark"] .table tr:hover td { background: rgba(255, 255, 255, 0.045); }
html[data-theme="dark"] .kpi .num { color: var(--ink); }
html[data-theme="dark"] .pct.mid, html[data-theme="dark"] .prio.medium,
html[data-theme="dark"] .warn-ink { color: #ffb340; }
html[data-theme="dark"] .trend-col.flat { background: rgba(255, 255, 255, 0.07); }
html[data-theme="dark"] .proc { background: var(--surface-2); }
html[data-theme="dark"] .msg.assistant .bubble { background: rgba(255, 255, 255, 0.08); }
html[data-theme="dark"] .flash { background: rgba(52, 199, 89, 0.15); color: #6fe08a; border-color: rgba(52, 199, 89, 0.3); }
html[data-theme="dark"] .auth-wrap { background: linear-gradient(160deg, #16222e 0%, #191a1e 55%, #14231f 100%); }
html[data-theme="dark"] .auth-card { background: rgba(38, 38, 42, 0.85); border-color: rgba(255, 255, 255, 0.12); }
html[data-theme="dark"] .delta-chip.flat { background: rgba(255, 255, 255, 0.10); }
html[data-theme="dark"] .drag-ghost { background: var(--surface-2); }
html[data-theme="dark"] .ai-head .spark { background: #fff; color: #101214; }
html[data-theme="dark"] .ai-actions .btn, html[data-theme="dark"] #ai-send,
html[data-theme="dark"] #ai-plan-btn, html[data-theme="dark"] .composer #ai-send {
  background: #f2f2f7; color: #101214;
}
html[data-theme="dark"] .ai-actions .btn:hover, html[data-theme="dark"] #ai-send:hover,
html[data-theme="dark"] #ai-plan-btn:hover { background: #d9d9de; }
/* the dark ministry marks become white silhouettes on dark surfaces */
html[data-theme="dark"] .rpt-tarbiya, html[data-theme="dark"] .rpt-slogan,
html[data-theme="dark"] .auth-slogan { filter: brightness(0) invert(1); }
/* dedicated logo variant per theme: gamma-lifted file for dark surfaces */
.theme-dark-img { display: none; }
html[data-theme="dark"] .theme-dark-img { display: block; }
html[data-theme="dark"] .theme-light-img { display: none; }
@media print {
  .theme-dark-img { display: none !important; }
  .theme-light-img { display: block !important; }
}

* { box-sizing: border-box; scrollbar-width: none; }
*::-webkit-scrollbar { width: 0; height: 0; display: none; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); font-size: 13.75px; line-height: 1.6;
  color: var(--ink);
  background: linear-gradient(180deg, #f8f8fa 0%, #f1f1f5 60%, #eef0f3 100%) fixed;
  -webkit-font-smoothing: antialiased;
}
html[data-theme="dark"] body {
  background: linear-gradient(180deg, #1b1b1e 0%, #17171a 60%, #151518 100%) fixed;
}

h1 { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 1.1rem; }
h2 { font-size: 0.98rem; font-weight: 650; letter-spacing: -0.008em; margin: 0 0 0.8rem; }
h3 { font-size: 0.85rem; font-weight: 650; margin: 0.9rem 0 0.35rem; color: var(--ink-2); }
p { margin: 0.3rem 0; }
ul, ol { margin: 0.3rem 0; padding-inline-start: 1.3rem; }
li { margin-bottom: 0.25rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ============ sidebar (vibrancy) ============ */
.sidebar {
  /* a panel that floats clear of the window rather than a slab bolted to the edge:
     an 8pt gutter on every side, so the rounded corners have something to sit against */
  position: fixed; top: var(--side-gap); bottom: var(--side-gap);
  width: var(--side-w); overflow-y: auto;
  background: var(--sidebar-bg);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--separator);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-panel);
  color: var(--ink); display: flex; flex-direction: column; z-index: 50;
}
.rtl .sidebar { right: var(--side-gap); }
.ltr .sidebar { left: var(--side-gap); }

.sidebar .brand { padding: 22px 18px 12px; }
.menu-btn { display: none; }
.sidebar .brand img { max-width: 48px; max-height: 48px; border-radius: 10px; margin-bottom: 8px; }
.sidebar .brand h2 { margin: 0; font-size: 1rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.35; }
.sidebar .brand .brand-en { color: var(--ink-2); font-size: 0.76rem; font-weight: 500; margin-top: 1px; }
.sidebar .brand .year { color: var(--muted); font-size: 0.78rem; font-weight: 500; margin-top: 1px; }

.sidebar nav { display: flex; flex-direction: column; padding: 2px 10px; flex: 1; gap: 1px; }
.navlabel {
  font-size: 0.68rem; font-weight: 600; color: var(--muted);
  padding: 14px 10px 4px; user-select: none;
}
.sidebar nav a {
  display: flex; align-items: center; gap: 8px;
  color: var(--ink); padding: 5px 9px; border-radius: 7px;
  font-size: 0.83rem; font-weight: 450; line-height: 1.45;
  transition: background 0.12s var(--ease);
}
.sidebar nav a:hover { background: rgba(0, 0, 0, 0.055); text-decoration: none; }
.sidebar nav a.active { background: rgba(0, 0, 0, 0.095); font-weight: 550; }
.sidebar nav a svg { width: 16px; height: 16px; flex: none; color: var(--accent); }
.sidebar nav a.cta {
  margin: 8px 0 4px; background: var(--accent); color: #fff; font-weight: 500;
  justify-content: center; padding: 6px 12px; border-radius: 6px;
}
.sidebar nav a.cta:hover { background: var(--accent-hover); }
.sidebar nav a.cta svg { color: #fff; }

.side-footer {
  border-top: 1px solid var(--separator); padding: 12px 18px 16px;
  font-size: 0.82rem; display: flex; flex-direction: column; gap: 7px;
}
.side-footer a { color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.side-footer a:hover { color: var(--accent); text-decoration: none; }
.side-footer a svg { width: 15px; height: 15px; }
.userchip { font-weight: 600; }
.theme-row { display: flex; align-items: center; gap: 7px; padding: 2px 0; }
.theme-toggle {
  border: none; cursor: pointer; width: 44px; height: 22px; border-radius: 99px;
  background: rgba(120, 120, 128, 0.22); position: relative; padding: 0;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; color: var(--muted); line-height: 1; padding-inline: 5px;
}
.theme-toggle::after {
  content: ""; position: absolute; top: 2px; inset-inline-start: 2px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.18s var(--ease);
}
html[data-theme="dark"] .theme-toggle { background: var(--accent); }
html[data-theme="dark"] .theme-toggle::after { transform: translateX(-22px); }
html[dir="ltr"][data-theme="dark"] .theme-toggle::after { transform: translateX(22px); }
.accent-dot {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid transparent;
  cursor: pointer; padding: 0; flex: none;
}
.accent-dot.on { border-color: var(--ink); }
.rolebadge {
  background: rgba(0, 0, 0, 0.06); border-radius: 99px; padding: 1px 9px;
  font-size: 0.68rem; font-weight: 500; margin-inline-start: 6px; color: var(--muted);
}

/* ============ main ============ */
main.with-side { padding: 22px 30px 64px; max-width: 1010px; }
.rtl main.with-side { margin-right: calc(var(--side-w) + var(--side-gap) * 2); }
.ltr main.with-side { margin-left: calc(var(--side-w) + var(--side-gap) * 2); }
main.full { padding: 0; }

.topbar { display: flex; justify-content: flex-end; margin-bottom: 18px; }
.searchbox {
  display: flex; flex-direction: row-reverse; /* icon on the leading side */
  align-items: center; width: 300px; max-width: 100%; height: 30px;
  background: rgba(118, 118, 128, 0.10);
  border-radius: 9px; padding: 0 2px; height: 32px;
  transition: background 0.15s, box-shadow 0.15s;
}
.searchbox:focus-within {
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--accent), 0 0 0 3.5px rgba(10, 122, 255, 0.18);
}
.searchbox input {
  border: none; background: transparent; outline: none; box-shadow: none;
  padding: 0 2px; flex: 1; min-width: 0; font-family: var(--font); font-size: 0.85rem;
}
.searchbox input::placeholder { color: var(--muted); }
.searchbox input:focus { box-shadow: none; }
.searchbox button {
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  width: 28px; height: 30px; flex: none; display: grid; place-items: center; padding: 0;
}
.searchbox button:hover { color: var(--accent); }
.searchbox button svg { width: 14px; height: 14px; }

/* ============ panels ============ */
.card {
  background: var(--surface); border: 1px solid var(--separator);
  border-radius: var(--r-panel); box-shadow: var(--shadow-panel);
  padding: 18px 22px; margin-bottom: 16px;
  overflow-x: auto;   /* wide tables scroll inside the panel, never spill out */
}
.card.center { text-align: center; }
.pagehead { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 10px; margin-bottom: 4px; }
.pagehead h1 { margin-bottom: 0.6rem; }

/* stat strip */
.kpis {
  display: flex; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--separator);
  border-radius: var(--r-panel); box-shadow: var(--shadow-panel);
  margin-bottom: 16px; overflow: hidden;
}
.kpi {
  flex: 1 1 130px; padding: 12px 18px 11px; min-width: 120px;
  border-inline-end: 1px solid var(--separator);
  display: flex; flex-direction: column-reverse; justify-content: space-between; gap: 3px;
}
.kpi .badge { vertical-align: 1px; }
.kpi:last-child { border-inline-end: none; }
.kpi > div:not(.num) { font-size: 0.72rem; color: var(--muted); font-weight: 500; line-height: 1.4; }
.kpi .num { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi .num.small { font-size: 1.05rem; }
.kpi.warn .num { color: var(--red-ink); }
.kpi.good .num { color: var(--green); }
.kpi.mid .num { color: #b25000; }
.kpi.good { background: var(--green-tint); }
.kpi.mid { background: var(--orange-tint); }
.kpi.warn { background: var(--red-tint); }

.badge {
  background: var(--accent-tint); color: var(--accent); border-radius: 99px;
  padding: 1px 9px; font-size: 0.7rem; font-weight: 600; vertical-align: 2px;
}

/* ============ buttons — macOS System Settings spec ============
   Gray-fill rounded-rect buttons (radius 6px), like the "Label"
   buttons in grouped settings lists; primary = blue fill. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 25px; padding: 0 11px; border-radius: 6px; cursor: pointer;
  font-family: var(--font); font-size: 12.5px; font-weight: 450; line-height: 1;
  white-space: nowrap; user-select: none;
  background: rgba(120, 120, 128, 0.14); color: var(--ink); border: none;
  transition: background 0.1s var(--ease);
  text-decoration: none; vertical-align: middle;
}
.btn:hover { background: rgba(120, 120, 128, 0.20); text-decoration: none; }
.btn:active { background: rgba(120, 120, 128, 0.28); }
.btn.primary { background: var(--accent); color: #fff; font-weight: 500; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.primary:active { background: #005bc8; }
.btn.danger { color: var(--red-ink); }
.btn.danger:hover { background: var(--red-tint); }
.btn.sm { height: 22px; padding: 0 9px; font-size: 12px; }
.btn.big { height: 32px; padding: 0 26px; font-size: 14px; }
.btn.wide { width: 100%; }
.btn:focus-visible, input:focus-visible, select:focus-visible {
  outline: none; box-shadow: 0 0 0 3.5px rgba(10, 122, 255, 0.35);
}

/* ============ forms ============ */
label { display: flex; flex-direction: column; gap: 5px; font-size: 0.8rem; font-weight: 550; color: var(--ink-2); }
input, select, textarea {
  font-family: var(--font); font-size: 0.87rem; padding: 5px 10px;
  border-radius: 6px; border: none;
  background: var(--surface); outline: none; color: var(--ink);
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.16), 0 1px 2px rgba(0, 0, 0, 0.07);
  transition: box-shadow 0.12s;
}
input:focus, select:focus, textarea:focus {
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.16), 0 0 0 3.5px rgba(10, 122, 255, 0.28);
}
input:disabled { background: transparent; box-shadow: none; color: var(--muted); text-align: end; }
textarea { resize: vertical; }
label > input, label > select, label > textarea { width: 100%; min-width: 0; }
label.radio > input { width: auto; flex: none; }
select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='14' viewBox='0 0 10 14'><path d='M2 5.2 5 2l3 3.2M2 8.8 5 12l3-3.2' fill='none' stroke='%2386868b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 9px center; padding-right: 26px;
}
.rtl select { background-position: left 9px center; padding-right: 11px; padding-left: 26px; }
select[multiple] { background-image: none; padding: 7px 11px; }
input[type=radio] { accent-color: var(--accent); }
input[type=checkbox] {
  appearance: auto; -webkit-appearance: auto; accent-color: var(--accent);
  width: 15px !important; min-width: 0 !important; height: 15px; padding: 0; flex: none;
  background: none; box-shadow: none; border-radius: 4px;
}

/* read-only info blocks: aligned multi-column grid */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px 32px; }
.info-grid > div { font-size: 0.9rem; line-height: 1.55; }
.info-grid b { color: var(--muted); font-weight: 500; margin-inline-end: 4px; }

/* grouped settings list: one column of rows, label leading, control trailing.
   Rows always span the full panel, so every card shares one container width. */
.grid2, .grid3 { display: flex; flex-direction: column; gap: 0; }
.grid2 > label, .grid3 > label {
  flex-direction: row; align-items: center; justify-content: space-between; gap: 20px;
  padding: 8px 0; min-height: 40px; border-bottom: 1px solid var(--separator);
  font-size: 0.92rem; font-weight: 400; color: var(--ink);
}
.grid2 > label:last-of-type, .grid3 > label:last-of-type { border-bottom: none; }
.grid2 > label > input, .grid3 > label > input,
.grid2 > label > select, .grid3 > label > select {
  width: auto; flex: 0 1 280px; max-width: 300px; min-width: 140px;
}
/* auth card keeps simple stacked fields (login / setup) */
.auth-card:not(.wide-card) form > label { flex-direction: column; align-items: stretch; gap: 6px; }
.auth-card:not(.wide-card) form > label > input { width: 100%; max-width: none; flex: none; }
/* multi-line fields fall back to stacked layout */
.grid2 > label:has(textarea), .grid3 > label:has(textarea) {
  flex-direction: column; align-items: stretch; gap: 6px; padding: 10px 0;
}
.grid2 > label > textarea, .grid3 > label > textarea { width: 100%; }
.grid2 > div, .grid3 > div { padding-top: 14px; }
.grid2 > div.span2, .grid3 > div.span3 {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.grid2 > h3, .grid3 > h3 { margin: 18px 0 2px; }
.span2 { grid-column: auto; }
.span3 { grid-column: auto; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.cols3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.filters input, .filters select { min-width: 140px; }

/* analysis filter bar: dropdown multi-selects on one row */
.an-filters { align-items: end; gap: 12px; }
.an-filters > label { flex: 1 1 170px; min-width: 160px; font-size: 0.8rem; }
.an-filters input[type=date] { width: 100%; min-width: 0; }
.an-filters > label:has(input[type=date]) { flex: 0 1 150px; }
.an-filter-actions { display: flex; gap: 8px; align-self: end; padding-bottom: 1px; }

/* checkbox dropdown (multi-select) */
.msel { position: relative; }
.msel > summary {
  list-style: none; cursor: pointer; user-select: none;
  background: var(--surface); border-radius: 6px; padding: 7px 30px 7px 11px;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.16), 0 1px 2px rgba(0, 0, 0, 0.07);
  font-size: 0.88rem; font-weight: 400; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='14' viewBox='0 0 10 14'><path d='M2 5.2 5 2l3 3.2M2 8.8 5 12l3-3.2' fill='none' stroke='%2386868b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 9px center;
}
.rtl .msel > summary { padding: 7px 11px 7px 30px; background-position: left 9px center; }
.msel > summary::-webkit-details-marker { display: none; }
.msel[open] > summary { box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.16), 0 0 0 3.5px var(--accent-tint-2); }
.msel-pop {
  position: absolute; top: calc(100% + 6px); inset-inline-start: 0; z-index: 60;
  min-width: 100%; max-height: 260px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--separator);
  border-radius: 10px; box-shadow: 0 10px 34px rgba(0, 0, 0, 0.16);
  padding: 6px;
}
.msel-pop label.radio { padding: 6px 10px; white-space: nowrap; }
.msel-pop input[type=checkbox] { accent-color: var(--accent); width: auto; flex: none; }
html[data-theme="dark"] .msel > summary { background-color: var(--surface-2); }
form.inline { display: inline-flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
form.inline input:not([type=hidden]) { width: 190px; min-width: 0; }
.table td:has(form.inline) { vertical-align: middle; white-space: nowrap; }

/* lookup management rows (إدارة النظام) */
.lk-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--separator);
}
.lk-row:last-child { border-bottom: none; }
.lk-row.lk-add { padding-top: 0; }
.lk-row.lk-add input[name=name] { flex: 1; min-width: 0; }
.lk-edit { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.lk-edit input[name=name] { flex: 1; min-width: 0; }
.lk-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.lk-row .prio { flex: none; }

/* user management rows */
.usr-row { padding: 12px 0; border-bottom: 1px solid var(--separator); }
.usr-row:last-child { border-bottom: none; }
.usr-id { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.usr-id b { font-size: 0.95rem; }
.rolechip { border-radius: 99px; padding: 2px 11px; font-size: 0.72rem; font-weight: 650; }
.rolechip.admin { background: var(--accent-tint); color: var(--accent); }
.rolechip.user { background: rgba(88, 86, 214, 0.12); color: #5856d6; }
.rolechip.teacher { background: rgba(120, 120, 128, 0.12); color: var(--ink-2); }
.usr-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.usr-edit { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1; min-width: 0; }
.usr-edit input[name=full_name] { flex: 1 1 170px; min-width: 140px; }
.usr-edit input[name=password] { flex: 0 1 160px; min-width: 120px; }
.usr-edit select { max-width: 210px; }
.usr-edit .ctl { display: contents; }
.usr-edit .ctl[hidden] { display: none; }
.usr-actions { display: flex; gap: 6px; flex: none; }

/* drag & drop team assignment */
.t-draggable { cursor: grab; touch-action: none; }
.t-draggable.dragging { opacity: 0.4; }
.drag-ghost {
  position: fixed; z-index: 999; pointer-events: none;
  background: var(--surface); border: 1px solid var(--accent); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18); padding: 6px 12px; opacity: 0.95;
}
.drag-grip { color: var(--muted); font-size: 0.8rem; letter-spacing: -2px; user-select: none; flex: none; }
.drop-zone.drop-over { outline: 2px dashed var(--accent); outline-offset: -6px; background: var(--accent-tint); }
.drop-hint { border: 1.5px dashed var(--separator-strong); border-radius: var(--r-field); padding: 14px; text-align: center; }

/* ============ tables ============ */
.table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.table th {
  color: var(--muted); padding: 5px 12px 7px; text-align: start;
  font-weight: 550; font-size: 0.73rem;
  border-bottom: 1px solid var(--separator-strong);
}
.table td { padding: 7px 10px; border-bottom: 1px solid var(--separator); vertical-align: middle; line-height: 1.45; }
.table td a { white-space: nowrap; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--accent-tint); }
.actions { white-space: nowrap; }
td.actions { white-space: nowrap; }
td.actions .btn { margin-inline-end: 3px; margin-bottom: 2px; }
td.actions form.inline { display: inline-flex; gap: 3px; }
.pagehead .no-print, .quicklinks, .formfooter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.pct { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 0.85rem; }
.pct.ok { color: var(--green); }
.pct.mid { color: #b25000; }
.pct.low { color: var(--red-ink); }

.trend.improved { color: var(--green); font-weight: 650; }
.trend.declined { color: var(--red-ink); font-weight: 650; }
.trend.stable { color: var(--muted); font-weight: 500; }

.prio { border-radius: 99px; padding: 2px 11px; font-size: 0.73rem; font-weight: 650; white-space: nowrap; }
.prio.high { background: var(--red-tint); color: var(--red-ink); }
.prio.medium { background: var(--orange-tint); color: #b25000; }
.prio.low { background: var(--green-tint); color: var(--green); }

/* ============ criteria form ============ */
fieldset.crit { border: none; border-top: 1px solid var(--separator); margin: 0; padding: 14px 0 16px; }
fieldset.crit:first-of-type { border-top: none; padding-top: 4px; }
fieldset.crit legend {
  font-weight: 650; color: var(--ink); font-size: 0.94rem;
  padding: 14px 0 2px; float: inline-start; width: 100%;
}
.crit-item { margin: 10px 0 13px; }
.crit-label { font-weight: 550; margin-bottom: 6px; font-size: 0.85rem; color: var(--ink-2); }
.crit-options { display: flex; flex-direction: column; gap: 2px; }
label.radio {
  flex-direction: row; align-items: baseline; gap: 9px; font-weight: 400;
  color: var(--ink); cursor: pointer; padding: 5px 10px; border-radius: 8px;
  font-size: 0.87rem; transition: background 0.1s;
}
label.radio:hover { background: rgba(0, 0, 0, 0.045); }
label.radio:has(input:checked) { background: var(--accent-tint); font-weight: 500; }
.crit-extra { margin-top: 10px; max-width: 480px; }
.formfooter { display: flex; gap: 10px; justify-content: center; padding: 6px 0 30px; }

/* ============ misc ============ */
.flash {
  background: var(--green-tint); border: 1px solid rgba(52, 199, 89, 0.35);
  color: #1d7a35; border-radius: var(--r-field); padding: 9px 16px;
  margin-bottom: 16px; font-size: 0.86rem; font-weight: 500;
}

/* ---- toasts ---- */
#toasts {
  position: fixed; bottom: 22px; inset-inline-start: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 400;
  pointer-events: none; width: max-content; max-width: 92vw;
}
.toast {
  background: var(--rv-black); color: #fff; border-radius: 10px;
  padding: 9px 18px; font-size: 0.86rem; font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  opacity: 0; transform: translateY(10px); transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
  max-width: 92vw;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: #1d8348; }
.toast.error { background: #c0392b; }
html[data-theme="dark"] .toast { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6); }

/* ---- top loading bar ---- */
#pageload {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 500;
  background: transparent; pointer-events: none;
}
#pageload.on::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 40%;
  background: var(--accent); border-radius: 0 3px 3px 0;
  animation: plslide 1.1s ease-in-out infinite;
}
@keyframes plslide {
  0% { left: -40%; width: 40%; }
  50% { left: 30%; width: 45%; }
  100% { left: 100%; width: 40%; }
}

/* ---- inline button spinner ---- */
.spinner {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff;
  display: inline-block; margin-inline-end: 7px; vertical-align: -2px;
  animation: spin 0.7s linear infinite;
}
.btn:not(.primary) .spinner, .composer-clear .spinner {
  border-color: rgba(0, 0, 0, 0.2); border-top-color: var(--ink);
}
@keyframes spin { to { transform: rotate(360deg); } }
.muted { color: var(--muted); }
.small { font-size: 0.78rem; }
.pre { white-space: pre-wrap; }
.insights li { margin-bottom: 7px; max-width: 72ch; }
.quicklinks { display: flex; gap: 8px; flex-wrap: wrap; }
.mini { font-size: 0.8rem; margin-bottom: 3px; color: var(--ink-2); }
.mini b { color: var(--ink); }

/* ============ automatic analysis (compare) ============ */
.an-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.an-head h2 { margin: 0; }
.delta-chip {
  border-radius: 99px; padding: 4px 16px; font-weight: 700; font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}
.delta-chip.good { background: var(--green-tint); color: var(--green); }
.delta-chip.bad { background: var(--red-tint); color: var(--red-ink); }
.delta-chip.flat { background: rgba(120, 120, 128, 0.12); color: var(--ink-2); }

.trend-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 12px; }
.trend-cols.two { grid-template-columns: 1fr 1fr; }
.trend-col { border-radius: 12px; padding: 12px 14px; }
.trend-col h4 { margin: 0 0 6px; font-size: 0.82rem; font-weight: 700; }
.trend-col.up { background: var(--green-tint); }
.trend-col.up h4 { color: var(--green); }
.trend-col.flat { background: rgba(120, 120, 128, 0.08); }
.trend-col.flat h4 { color: var(--ink-2); }
.trend-col.down { background: var(--red-tint); }
.trend-col.down h4 { color: var(--red-ink); }
.trend-col ul { margin: 0; padding-inline-start: 1.1rem; font-size: 0.85rem; }
.trend-col li { margin-bottom: 3px; }
.trend-col li b { font-variant-numeric: tabular-nums; }
.trend-col .none { color: var(--muted); font-size: 0.85rem; margin: 2px 0; }

.an-sec { margin: 18px 0 8px; font-size: 0.95rem; color: var(--ink); }
.proc-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.proc { border: 1px solid var(--separator); border-radius: 12px; padding: 12px 14px; background: var(--surface-2); }
.proc-head { font-weight: 700; font-size: 0.88rem; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.proc ul { margin: 0; padding-inline-start: 1.1rem; font-size: 0.85rem; }
.proc li { margin-bottom: 3px; }
.an-recs { max-width: 76ch; }
@media (max-width: 980px) { .trend-cols, .trend-cols.two, .proc-list { grid-template-columns: 1fr; } }

/* ============ AI surfaces — Rovo-style system ============
   Four flat colors in hard-edged blocks (never gradients/tints),
   rich black for AI actions, animated 4-color border ONLY while generating. */
:root {
  --rv-blue: #0c66e4; --rv-purple: #6e5dc6; --rv-saffron: #f5a300; --rv-lime: #82b536;
  --rv-black: #101214; --rv-black-2: #22272b;
}
@property --rv-angle { syntax: "<angle>"; initial-value: 0deg; inherits: false; }

.ai-card { background: var(--surface); border: 1px solid var(--separator); position: relative; }
/* static identity: thin 4-block mosaic strip, flat hard stops */
.ai-card::before {
  content: ""; position: absolute; top: 0; inset-inline: 16px; height: 3px;
  border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg,
    var(--rv-blue) 0 25%, var(--rv-purple) 25% 50%,
    var(--rv-saffron) 50% 75%, var(--rv-lime) 75% 100%);
}
/* generative border: animated hard-stop mosaic, active generation only */
.ai-card.generating { border-color: transparent; }
.ai-card.generating::after {
  content: ""; position: absolute; inset: -1px; border-radius: var(--r-panel);
  padding: 2px; pointer-events: none;
  background: conic-gradient(from var(--rv-angle),
    var(--rv-blue) 0 90deg, var(--rv-purple) 90deg 180deg,
    var(--rv-saffron) 180deg 270deg, var(--rv-lime) 270deg 360deg);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: rv-spin 2.2s linear infinite;
}
@keyframes rv-spin { to { --rv-angle: 360deg; } }

.ai-head { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.ai-head h2 { margin: 0; color: var(--ink); }
.ai-head .spark {
  background: var(--rv-black); color: #fff; width: 23px; height: 23px; flex: none;
  border-radius: 6px; display: grid; place-items: center; font-size: 0.78rem;
}
/* AI action buttons: rich black (Rovo bold) — same control height as every .btn */
.ai-actions .btn, #ai-send {
  background: var(--rv-black); color: #fff; font-weight: 550;
  height: 26px; line-height: 1; padding: 0 12px;
}
.ai-actions .btn.sm { height: 22px; padding: 0 9px; }
#ai-plan-btn { background: var(--rv-black); color: #fff; font-weight: 550; }
#ai-plan-btn:hover { background: var(--rv-black-2); }
.ai-actions .btn:hover, #ai-send:hover { background: var(--rv-black-2); }
.ai-actions .btn:active, #ai-send:active { background: #2c333a; }
.ai-model {
  font-size: 0.68rem; color: var(--muted); background: rgba(120, 120, 128, 0.10);
  border-radius: 99px; padding: 1px 9px; margin-inline-start: auto; white-space: nowrap;
}
.ai-body { font-size: 0.9rem; }
.ai-body h4 { margin: 12px 0 4px; font-size: 0.9rem; font-weight: 700; color: var(--accent); }
.ai-body h4:first-child { margin-top: 0; }
.ai-body ul { margin: 2px 0 8px; padding-inline-start: 1.2rem; }
.ai-body li { margin-bottom: 4px; }
.ai-body p { margin: 4px 0; }
.ai-err { color: var(--red-ink); font-weight: 500; }
.ai-sum { font-weight: 600; font-size: 0.95rem; margin: 0 0 6px; }
.ai-split { align-items: start; }
.ai-actions { margin-top: 10px; display: flex; gap: 8px; }
.ai-loading { display: inline-flex; gap: 5px; padding: 8px 2px; }
.ai-loading span {
  width: 7px; height: 7px; border-radius: 2px;
  animation: ai-b 1.2s infinite ease-in-out;
}
.ai-loading span:nth-child(1) { background: var(--rv-blue); }
.ai-loading span:nth-child(2) { background: var(--rv-purple); animation-delay: 0.15s; }
.ai-loading span:nth-child(3) { background: var(--rv-saffron); animation-delay: 0.3s; }
@keyframes ai-b { 0%, 70%, 100% { opacity: 0.25; } 35% { opacity: 1; } }

/* ============ assistant chat ============ */
.chat { display: flex; flex-direction: column; gap: 10px; min-height: 180px; }
.composer { display: flex; gap: 8px; margin-top: 16px; align-items: stretch; }
.composer-form { display: flex; gap: 8px; flex: 1; min-width: 0; }
.composer-form input {
  flex: 1; min-width: 0; height: 40px; padding: 0 14px; font-size: 0.92rem; border-radius: 10px;
}
.composer .btn { height: 40px; padding: 0 20px; font-size: 0.9rem; border-radius: 10px; }
.composer #ai-send { background: var(--rv-black); color: #fff; font-weight: 550; height: 40px; padding: 0 20px; }
.composer #ai-send:hover { background: var(--rv-black-2); }
.composer-clear { background: rgba(120, 120, 128, 0.14); color: var(--ink); font-weight: 450; }
@media (max-width: 640px) {
  .composer { flex-wrap: wrap; }
  .composer-form { flex-wrap: wrap; flex-basis: 100%; }
  .composer-form input { flex: 1 1 100%; }
  .composer-form .btn, .composer #ai-send { flex: 1; }
  .composer-clear { width: 100%; }
}
.msg { display: flex; }
.msg.user { justify-content: flex-end; }
.msg .bubble {
  max-width: 76ch; padding: 9px 14px; border-radius: 14px; font-size: 0.9rem; line-height: 1.65;
}
.msg.user .bubble { background: var(--accent); color: #fff; border-end-end-radius: 4px; }
.msg.assistant .bubble { background: rgba(120, 120, 128, 0.10); border-end-start-radius: 4px; }

/* ============ auth ============ */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #dbe9ff 0%, #eef2f7 45%, #dff0ea 100%);
}
.auth-card {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.9); border-radius: 22px;
  box-shadow: 0 20px 60px rgba(30, 60, 100, 0.16);
  padding: 40px 38px; width: 100%; max-width: 400px; text-align: center;
}
.auth-card.wide-card { max-width: 720px; text-align: start; }
.auth-card.wide-card h1 { text-align: center; }
.auth-card h1 { margin: 0 0 4px; font-size: 1.25rem; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; text-align: start; }
.auth-card.wide-card form { display: grid; }
.auth-logo { max-width: 72px; max-height: 72px; border-radius: 16px; margin-bottom: 10px; }
.auth-outer {
  display: flex; flex-direction: column; align-items: center; gap: 26px;
  width: 100%; max-width: 440px; padding: 24px 0;
}
.auth-outer .auth-card { width: 100%; max-width: none; }
.auth-marks {
  display: flex; align-items: center; justify-content: center; gap: 30px;
  flex-wrap: wrap; padding: 0 8px;
}
.am-moe { height: 92px; width: auto; }
.am-tarbiya { height: 54px; width: auto; }
.am-slogan { height: 34px; width: auto; }
html[data-theme="dark"] .am-ink { filter: brightness(0) invert(1); }
.auth-en { color: var(--ink-2); font-weight: 600; font-size: 0.95rem; margin-top: 2px; margin-bottom: 4px; }
.langlink { display: inline-block; margin-top: 18px; font-size: 0.82rem; color: var(--muted); }

/* ============ official report letterhead ============ */
.rpt-brand {
  display: flex; align-items: center; justify-content: space-between; gap: 32px;
  padding: 16px 22px 22px; margin-bottom: 22px;
  border-bottom: 2px solid var(--separator-strong);
}
.rpt-moe { height: 104px; width: auto; flex: none; }
.rpt-names { flex: 1; min-width: 0; text-align: center; }
.rpt-ar { font-weight: 750; font-size: 1.25rem; letter-spacing: -0.01em; }
.rpt-en { color: var(--ink-2); font-weight: 550; font-size: 0.92rem; }
.rpt-sub { color: var(--muted); font-size: 0.78rem; margin-top: 2px; }
.rpt-marks { display: flex; flex-direction: row; align-items: center; gap: 26px; flex: none; }
.rpt-tarbiya { height: 66px; width: auto; }
.rpt-slogan { height: 42px; width: auto; }
.print-only { display: none; }
@media print {
  .print-only { display: block; }
  .rpt-brand { border-bottom-color: #999; }
  .rpt-moe { height: 60px; }
}
@media (max-width: 640px) {
  .rpt-brand { flex-direction: column; gap: 8px; }
}

/* ============ reports ============ */
.report-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; justify-content: space-between; }
.report-logo { max-height: 56px; border-radius: 10px; }
.report-logo.big { max-height: 96px; }
.report-cover { padding: 52px 24px; }
.report-cover h1 { margin-bottom: 0.4rem; }
.report-cover h2 { font-size: 1.15rem; color: var(--ink-2); font-weight: 500; }
.print-only-block { display: none; }
.exec h3 { margin-top: 1.4rem; }

/* ============ responsive ============ */
@media (max-width: 980px) {
  /* sidebar becomes a compact sticky header with a hamburger menu */
  .sidebar {
    position: sticky; top: 0; width: auto; height: auto; overflow: visible;
    border: none; border-bottom: 1px solid var(--separator);
    border-radius: 0; box-shadow: none;
  }
  .sidebar .brand {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 10px 16px;
  }
  .sidebar .brand h2 { font-size: 0.92rem; }
  .sidebar .brand .brand-en { font-size: 0.7rem; }
  .sidebar .brand .year { display: none; }
  .menu-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; flex: none; border: none; border-radius: 9px;
    background: rgba(120, 120, 128, 0.14); color: var(--ink); cursor: pointer;
  }
  .menu-btn svg { width: 20px; height: 20px; }
  .sidebar nav, .sidebar .side-footer { display: none; }
  .sidebar.nav-open nav { display: flex; flex-direction: column; padding: 4px 12px 8px; }
  .sidebar.nav-open .side-footer { display: flex; }
  .sidebar.nav-open { max-height: 88vh; overflow-y: auto; }
  .navlabel { display: block; }
  .sidebar.nav-open .navlabel { padding-top: 10px; }
  .rtl main.with-side, .ltr main.with-side { margin: 0; padding: 16px; }
  .cols2, .cols3 { grid-template-columns: 1fr; }
  .span2, .span3 { grid-column: auto; }
  .searchbox { flex: 1; }
  .searchbox input { min-width: 0; flex: 1; }
  .kpi { border-inline-end: none; border-bottom: 1px solid var(--separator); }
  .kpi:last-child { border-bottom: none; }
  /* wide tables scroll sideways inside their card instead of being cut off */
  .card:has(> .table), .card:has(> form > .table) { overflow-x: auto; }
  .card > .table, .card > form > .table { min-width: 560px; }
}

@media (max-width: 640px) {
  body { font-size: 14px; }
  h1 { font-size: 1.35rem; }
  .rtl main.with-side, .ltr main.with-side { padding: 12px; }
  .card { padding: 14px 16px; }
  .sidebar .brand { padding: 14px 16px 8px; }
  .sidebar nav a { font-size: 0.82rem; padding: 6px 9px; }
  .side-footer { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; }
  .pagehead { flex-direction: column; align-items: stretch; }
  /* settings rows stack on phones */
  .grid2 > label, .grid3 > label, .auth-card form > label {
    flex-direction: column; align-items: stretch; gap: 5px; min-height: 0; padding: 9px 0;
  }
  .grid2 > label > input, .grid3 > label > input, .auth-card form > label > input,
  .grid2 > label > select, .grid3 > label > select { flex: none; max-width: none; width: 100%; }
  input:disabled { text-align: start; }
  .filters { flex-direction: column; align-items: stretch; }
  .filters input, .filters select { min-width: 0; width: 100%; }
  /* flex-basis widths would become heights in the stacked column */
  .filters > label, .an-filters > label, .an-filters > label:has(input[type=date]) { flex: none; min-width: 0; }
  .an-filter-actions { align-self: stretch; }
  .an-filter-actions .btn { flex: 1; }
  form.inline input:not([type=hidden]) { width: 130px; }
  .kpi { flex-basis: 100%; }
  .table { font-size: 0.8rem; }
  .btn.big { width: 100%; }
}

/* ============ print: exact A4 fit ============ */
@page { size: A4; margin: 12mm 12mm 14mm; }
@media print {
  /* documents always print light, whatever the screen theme */
  html, html[data-theme="dark"] {
    --window-bg: #fff; --surface: #fff; --surface-2: #fafafa;
    --ink: #1d1d1f; --ink-2: #3a3a3c; --muted: #6e6e73;
    --separator: rgba(60, 60, 67, 0.14); --separator-strong: rgba(60, 60, 67, 0.26);
    --green: #28a745; --red-ink: #d70015;
    color-scheme: light;
  }
  html[data-theme="dark"] .rpt-tarbiya, html[data-theme="dark"] .rpt-slogan { filter: none; }
  html, body { width: 186mm; }   /* A4 210mm minus margins */
  body {
    background: #fff !important; font-size: 10.5px; line-height: 1.45;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .sidebar, .topbar, .no-print, .flash { display: none !important; }
  .rtl main.with-side, .ltr main.with-side { margin: 0; padding: 0; max-width: 186mm; }
  h1 { font-size: 15px; margin-bottom: 8px; }
  h2 { font-size: 12px; margin-bottom: 6px; }
  h3 { font-size: 11px; }

  .card, .kpis {
    box-shadow: none; border: 1px solid #ccc; background: #fff;
    backdrop-filter: none; border-radius: 6px;
    padding: 8px 12px; margin-bottom: 8px;
    break-inside: auto;              /* long tables may flow across pages */
  }
  .kpis, .kpi, .trend-col, .proc, .rpt-brand, .ai-card, .report-cover, .chat .msg { break-inside: avoid; }
  .kpi { padding: 6px 10px; min-width: 90px; }
  .kpi .num { font-size: 15px; }
  .kpi > div:not(.num) { font-size: 8.5px; }

  .table { font-size: 9.5px; }
  .table th { padding: 3px 6px; font-size: 8.5px; }
  .table td { padding: 3px 6px; }
  .table tr { break-inside: avoid; }

  canvas { max-width: 100% !important; height: auto !important; }
  .cols2, .cols3 { gap: 8px; }
  .grid2 > label, .grid3 > label { min-height: 0; padding: 3px 0; }
  .info-grid { gap: 4px 18px; }
  .info-grid > div { font-size: 9.5px; }
  .mini { font-size: 8.5px; }

  /* letterhead compact */
  .rpt-brand { padding: 0 0 6px; margin-bottom: 10px; border-bottom-color: #999; }
  .rpt-moe { height: 17mm; }
  .rpt-tarbiya { height: 11mm; }
  .rpt-slogan { height: 7mm; }
  .rpt-ar { font-size: 13px; }
  .rpt-en { font-size: 10px; }
  .report-cover { padding: 12px; }

  /* keep semantic tints visible on paper */
  .kpi.good, .kpi.mid, .kpi.warn, .trend-col, .prio, .badge, .delta-chip,
  .ai-card::before, .msg .bubble {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .ai-actions { display: none !important; }   /* AI buttons are screen-only */
  .print-only { display: block; }
  .print-only-block { display: flex; }
  a { color: inherit; text-decoration: none; }
  .pagehead { margin-bottom: 2px; }
}

/* page header with trailing action button */
.page-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:4px}
.page-head h1{margin:0}


/* ============ teacher support plan (official form) ============ */
.sp-doc { padding: 22px 26px; }
.sp-title { text-align: center; font-size: 1.05rem; margin: 4px 0 14px; }
.sp-title .sp-en { display: block; font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.sp-part2 { margin-top: 26px; }
.sp-en { font-size: 0.72rem; color: var(--muted); font-weight: 450; margin-top: 2px; }
.sp-head th { width: 17%; background: var(--surface-2); }
.sp-head td { width: 33%; }
.sp-grid th { background: var(--surface-2); text-align: center; vertical-align: top; }
.sp-grid td { vertical-align: top; line-height: 1.55; }
.sp-report td { height: 34px; }
.sp-doc .table, .sp-doc .table th, .sp-doc .table td { border: 1px solid var(--separator-strong); }
.sp-doc .table { border-collapse: collapse; width: 100%; }
.sp-doc .table th, .sp-doc .table td { padding: 7px 9px; }
@media print {
  .sp-doc { padding: 0; box-shadow: none; border: none; }
  .sp-grid, .sp-head { font-size: 9.2pt; }
  .sp-part2 { break-before: auto; }
  .sp-title { margin-top: 6mm; }
}

/* support plan edit mode */
.sp-editing [contenteditable="true"] { outline: 1px dashed var(--accent); outline-offset: 2px; border-radius: 4px; min-height: 1em; }
.sp-editing [contenteditable="true"]:focus { outline-style: solid; background: var(--accent-tint); }
.sp-rowctl { width: 34px; border: none !important; background: none !important; vertical-align: middle; }
@media print { .sp-rowctl { display: none !important; } }

/* inline field validation */
.field-error { color: var(--red-ink); font-size: 0.78rem; font-weight: 550; margin-top: 4px; }
input.invalid { box-shadow: 0 0 0 1.5px var(--red-sys) !important; }

/* AI quota card */
.quota-row { margin: 12px 0; }
.quota-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 5px; }
.quota-track { height: 8px; border-radius: 99px; background: rgba(120, 120, 128, 0.16); overflow: hidden; }
.quota-fill { height: 100%; border-radius: 99px; transition: width 0.5s var(--ease); }
.quota-fill.ok { background: var(--green-sys); }
.quota-fill.mid { background: var(--orange-sys); }
.quota-fill.low { background: var(--red-sys); }

/* ============ AI cards: stronger Rovo presence ============ */
.ai-card {
  border: 1px solid rgba(110, 93, 198, 0.26);
  background:
    linear-gradient(180deg, rgba(12, 102, 228, 0.045) 0%, rgba(110, 93, 198, 0.025) 34%, var(--surface) 78%);
  box-shadow: var(--shadow-panel), 0 6px 22px rgba(12, 102, 228, 0.07);
  padding-top: 22px;
}
.ai-card::before {
  inset-inline: 0; height: 5px; border-radius: var(--r-panel) var(--r-panel) 0 0;
}
.ai-head { gap: 11px; margin-bottom: 12px; }
.ai-head .spark {
  width: 30px; height: 30px; border-radius: 9px; font-size: 0.95rem;
  box-shadow: 0 3px 10px rgba(16, 18, 20, 0.28);
}
.ai-head h2 { font-size: 1.02rem; letter-spacing: -0.01em; }
html[data-theme="dark"] .ai-card {
  border-color: rgba(110, 93, 198, 0.45);
  background:
    linear-gradient(180deg, rgba(12, 102, 228, 0.14) 0%, rgba(110, 93, 198, 0.07) 34%, var(--surface) 78%);
  box-shadow: var(--shadow-panel), 0 6px 24px rgba(12, 102, 228, 0.16);
}
html[data-theme="dark"] .ai-head .spark { box-shadow: 0 3px 12px rgba(255, 255, 255, 0.14); }
@media print {
  .ai-card { background: #fff; box-shadow: none; border-color: #bbb; padding-top: 14px; }
}

/* manage rows: name column grows, translation hint sits under the input */
.lk-name { flex: 1; min-width: 140px; display: flex; flex-direction: column; gap: 2px; }
.lk-name input { width: 100%; min-width: 0; }
.lk-hint {
  font-size: 0.72rem; color: var(--muted); padding-inline-start: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lk-row .prio { margin-inline-start: auto; }
@media (max-width: 640px) {
  .lk-row { flex-wrap: wrap; }
  .lk-edit { flex-basis: 100%; }
  .lk-actions { margin-inline-start: auto; }
}

/* needs-improvement list on the dashboard */
.ni-list { display: flex; flex-direction: column; }
.ni-row {
  display: flex; align-items: center; gap: 14px; padding: 9px 2px;
  border-bottom: 1px solid var(--separator); color: var(--ink);
}
.ni-row:last-child { border-bottom: none; }
.ni-row:hover { text-decoration: none; background: rgba(120, 120, 128, 0.06); border-radius: 8px; }
.ni-name { flex: 1; min-width: 0; font-weight: 500; }
.ni-track { flex: 2; height: 8px; border-radius: 99px; background: rgba(120, 120, 128, 0.16); overflow: hidden; }
.ni-fill { display: block; height: 100%; border-radius: 99px; }
.ni-fill.mid { background: var(--orange-sys); }
.ni-fill.low { background: var(--red-sys); }
.ni-pct { flex: none; min-width: 52px; text-align: end; }
.warn-ink { color: #b25000; }
.red-ink { color: var(--red-ink); }
@media (max-width: 640px) { .ni-track { flex: 1.2; } }

/* visits log table: middle-aligned compact rows, no cut-off actions */
.card:has(> .table), .card:has(> form > .table) { overflow-x: auto; }
.vlog th, .vlog td { vertical-align: middle; }
.vlog td:nth-child(1) { color: var(--muted); }
.vlog td:nth-child(3), .vlog td:nth-child(4), .vlog td:nth-child(5), .vlog td:nth-child(8) { white-space: nowrap; }
.vlog td.actions { white-space: nowrap; }
.vlog .actions .btn { padding-inline: 9px; }

/* shared report banner + expired page */
.share-banner {
  display: flex; align-items: center; gap: 14px; padding: 12px 18px; margin-bottom: 16px;
  background: var(--accent-tint); border: 1px solid var(--accent-tint-2); border-radius: var(--r-panel);
}
.share-banner > div { flex: 1; min-width: 0; }
.share-ico { font-size: 1.3rem; }
.err-page { text-align: center; padding: 80px 20px; max-width: 520px; margin: 0 auto; }
.err-page .err-code { font-size: 3rem; margin-bottom: 8px; }

/* compact icon buttons (visits log actions) */
.btn.icon {
  width: 29px; height: 27px; padding: 0; display: inline-grid; place-items: center;
  vertical-align: middle;
}
.btn.icon svg { width: 15px; height: 15px; }
.btn.icon.danger { color: var(--red-ink); }
.vlog td.actions { white-space: nowrap; }

/* ============ tables must fit the screen ============ */
/* names and other linked text may wrap like normal text; only button-links stay on one line */
.table td a { white-space: normal; }
.table td a.btn { white-space: nowrap; }
/* visits log: let type/class wrap again; keep only date + percent + actions rigid */
.vlog td:nth-child(4), .vlog td:nth-child(5) { white-space: normal; }
.vlog td:nth-child(3), .vlog td:nth-child(8) { white-space: nowrap; }
/* compact tables a notch on mid-size screens */
@media (max-width: 1560px) {
  .table { font-size: 0.82rem; }
  .table th { padding: 4px 8px; }
  .table td { padding: 6px 8px; }
}

.ok-ink { color: var(--green); }


/* clickable KPI tiles */
.lg-click { cursor: pointer; transition: background 0.12s var(--ease), transform 0.12s var(--ease); }
.lg-click:hover { background: var(--accent-tint); transform: translateY(-1px); }

/* send-to-teacher panel */
.share-choices { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 8px; }
.share-link { width: 100%; font-size: 0.8rem; color: var(--muted); }

.nowrap { white-space: nowrap; }


/* ============ sidebar always fits the screen (desktop) ============ */
@media (min-width: 981px) {
  .sidebar { overflow-y: hidden; }
  .sidebar .brand { padding: 16px 18px 8px; }
  .sidebar .brand .year { display: none; }
  .sidebar nav { flex: 1 1 auto; min-height: 0; padding-top: 0; }
  .sidebar nav a { padding: 4px 12px; line-height: 1.35; }
  .sidebar nav a.cta { margin: 4px 0 6px; padding: 6px 12px; }
  .navlabel { padding: 9px 10px 2px; }
  /* footer: name + role on one line, theme row, then language + logout side by side */
  .side-footer { flex-direction: row; flex-wrap: wrap; align-items: center;
                 gap: 6px 14px; padding: 10px 18px 12px; }
  .side-footer .userchip { flex: 1 1 100%; display: flex; align-items: center; gap: 8px;
                           white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side-footer > a { flex: none; }
}
/* short screens: tighten further so nothing is ever cut */
@media (min-width: 981px) and (max-height: 760px) {
  .sidebar .brand { padding: 10px 18px 4px; }
  .sidebar .brand .brand-en { display: none; }
  .sidebar nav a { padding: 2px 12px; font-size: 0.8rem; }
  .sidebar nav a svg { width: 14px; height: 14px; }
  .sidebar nav a.cta { margin: 2px 0 4px; padding: 4px 12px; }
  .navlabel { padding: 5px 10px 1px; font-size: 0.64rem; }
  .side-footer { padding: 6px 18px 8px; gap: 4px 12px; }
}
@media (min-width: 981px) and (max-height: 620px) {
  .navlabel { display: none; }
  .sidebar nav a { padding: 1px 12px; }
}
@media (min-width: 981px) {
  .side-footer .userchip { overflow: visible; white-space: normal; flex-wrap: wrap; row-gap: 2px; }
  .side-footer .userchip .rolebadge { flex: none; }
}

/* branch switcher in the sidebar (super admin) */
.branch-switch { width: 100%; margin-top: 6px; font-size: 0.8rem; padding: 4px 8px; }

/* visit scheduler */
.sched-grid th, .sched-grid td { text-align: center; }
.sched-grid td:first-child, .sched-grid th:first-child { text-align: start; white-space: nowrap; }
.slot { padding: 4px 6px !important; }
.slot.free { background: rgba(52, 199, 89, 0.08); }
.slot.taken { background: var(--red-tint); }
.slot-who { font-size: 0.72rem; color: var(--red-ink); white-space: nowrap; }
.slot-add { display: inline-block; width: 22px; height: 22px; line-height: 20px; border-radius: 6px;
            color: var(--accent); background: rgba(120, 120, 128, 0.12); font-weight: 600; }
.slot-add:hover { background: var(--accent-tint); text-decoration: none; }
.sched-thumb { max-height: 260px; max-width: 100%; border-radius: 10px; border: 1px solid var(--separator); }
.tbl-scroll { overflow-x: auto; }
/* ---- teacher weekly timetable: tiles ---- */
.sched-top{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.sched-top .tsel{min-width:200px;padding:6px 10px;border-radius:8px}
.week-bar{display:flex;align-items:center;gap:10px;margin-bottom:12px;flex-wrap:wrap}
.week-bar .mode-toggle{margin-inline-start:auto}
.edit-row{margin-bottom:14px}
.sched-wrap{overflow-x:auto}
.sched{min-width:660px;display:flex;flex-direction:column;gap:10px}
.srow{display:grid;grid-template-columns:104px repeat(8,1fr);gap:10px;align-items:stretch}
.srow.head .stile.hd{background:none;min-height:0;padding:0;color:var(--muted);font-size:.72rem;font-weight:600}
.slabel{display:flex;flex-direction:column;justify-content:center;font-weight:600;font-size:.82rem}
.slabel span{font-weight:400;font-size:.7rem;color:var(--muted)}
.stile{min-height:62px;border-radius:10px;background:rgba(120,120,128,.16);
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;padding:4px;
  text-align:center;transition:background .15s ease}
.stile.has{background:#34c77b;color:#06331e;cursor:pointer}
.stile.booked{background:#ff8080;color:#4a0d0d;cursor:pointer}
.stile b{font-size:.86rem}
.stile span{font-size:.7rem;opacity:.85}
.stile em{font-size:.66rem;font-style:normal;opacity:.9}
.stile.free[onclick]{cursor:pointer}
.stile.free[onclick]:hover{background:rgba(0,122,255,.18)}
.legend{display:flex;gap:16px;margin-top:14px;font-size:.78rem;color:var(--muted);flex-wrap:wrap}
.legend span{display:flex;align-items:center;gap:6px}
.legend .sw{width:14px;height:14px;border-radius:4px;background:rgba(120,120,128,.16);display:inline-block}
.legend .sw.has{background:#34c77b}
.legend .sw.bk{background:#ff8080}
@media print{.sched{min-width:0}}

/* ---- lesson plan review record ---- */
.table td.mark { text-align: center; font-size: 1.1rem; line-height: 1; }
.table td.rowhead { background: rgba(120, 120, 128, 0.10); }
.table td.rowhead .muted { margin-inline-start: 8px; }

/* add a teacher straight into a team (Teams page) */
.team-add { display: flex; gap: 6px; margin-top: 10px; padding-top: 10px;
            border-top: 1px solid var(--separator); flex-wrap: wrap; }
.team-add input { flex: 1 1 120px; min-width: 0; padding: 6px 10px; border-radius: 8px; font-size: 0.85rem; }
.team-add button { flex: 0 0 auto; }

/* Teams page: a department card can carry several leaders */
.dept-leaders { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.dept-leaders select { padding: 4px 8px; border-radius: 8px; font-size: 0.78rem; }
.lead-chip { display: inline-flex; align-items: center; gap: 4px; }
.lead-chip .chip-x { border: 0; background: none; cursor: pointer; font-size: 1rem;
                     line-height: 1; padding: 0 2px; color: inherit; opacity: 0.6; }
.lead-chip .chip-x:hover { opacity: 1; }

/* Teams page: the destination dropdown must never squeeze the teacher's name out of the
   row. Its options now carry the department AND its leaders, which is far wider than the
   old leader-name-only list, so the closed control is pinned to a fixed width. */
.lk-actions { max-width: 48%; }
.lk-actions select { width: 150px; max-width: 100%; }
.lk-row > div a { word-break: normal; overflow-wrap: anywhere; }
@media (max-width: 1100px) { .lk-actions select { width: 118px; } }
@media (max-width: 760px)  { .lk-actions { max-width: 100%; } .lk-actions select { width: 100%; } }

/* Teams page: pencil that opens the full edit form on the Teachers page */
.row-edit { flex: none; text-decoration: none; opacity: 0.55; font-size: 0.95rem;
            padding: 2px 4px; border-radius: 6px; }
.row-edit:hover { opacity: 1; background: var(--accent-tint); text-decoration: none; }

/* Users admin: per-account feature grant (دليل اللجان المدرسية) */
.usr-edit .perm{display:flex;align-items:center;gap:6px;white-space:nowrap;font-weight:normal}
.usr-edit .perm input{width:auto;margin:0}

/* دليل اللجان المدرسية — the one tab that is not part of the visit workflow, so it carries
   the guide's own gold identity instead of the system-blue used by every other tab. */
.sidebar nav a.nav-committees { color: #6d5423; background: rgba(167, 138, 83, 0.13); font-weight: 520; }
.sidebar nav a.nav-committees svg { color: #a78a53; }
.sidebar nav a.nav-committees:hover { background: rgba(167, 138, 83, 0.22); }
.sidebar nav a.nav-committees.active { background: rgba(167, 138, 83, 0.30); font-weight: 600; }
html[data-theme="dark"] .sidebar nav a.nav-committees { color: #e4cf9e; background: rgba(199, 166, 102, 0.16); }
html[data-theme="dark"] .sidebar nav a.nav-committees svg { color: #d8bd7c; }
html[data-theme="dark"] .sidebar nav a.nav-committees:hover { background: rgba(199, 166, 102, 0.26); }
html[data-theme="dark"] .sidebar nav a.nav-committees.active { background: rgba(199, 166, 102, 0.34); }

/* ===== دليل اللجان المدرسية =============================================== */
.cm-setup{display:grid;grid-template-columns:2fr 1fr 1.6fr auto;gap:14px;align-items:end}
.cm-layout{display:grid;grid-template-columns:270px minmax(0,1fr);gap:16px;margin-top:16px;align-items:start}
.cm-main{display:flex;flex-direction:column;gap:16px;min-width:0}

.cm-rail{position:sticky;top:14px;padding:12px}
.cm-rail-search{display:block;margin-bottom:8px}
.cm-rail-search input{width:100%}
#cm-list{display:flex;flex-direction:column;gap:2px}
.cm-item{display:flex;align-items:center;gap:9px;padding:7px 9px;border-radius:8px;
         color:var(--ink);text-decoration:none;border:1px solid transparent;font-size:0.82rem}
.cm-item:hover{background:rgba(0,0,0,0.055);text-decoration:none}
.cm-item.active{background:var(--accent-tint);border-color:var(--accent-tint-2);font-weight:560}
.cm-item-t{flex:1;min-width:0;line-height:1.4}
.cm-num{font-variant-numeric:tabular-nums;font-size:0.74rem;color:var(--muted);font-weight:600;flex:none}
.cm-item.active .cm-num{color:var(--accent)}
.cm-num.big{font-size:1.5rem;color:var(--accent);font-weight:700}
.cm-count{flex:none;font-size:0.7rem;min-width:18px;height:18px;line-height:18px;text-align:center;
          border-radius:9px;background:var(--green-tint);color:var(--green);font-weight:650}
.cm-none{color:var(--muted);font-size:0.82rem;padding:8px 9px;margin:0}

.cm-title{display:flex;gap:14px;align-items:flex-start}
.cm-title h2{margin:0 0 4px}
.cm-goal{margin:0;color:var(--ink-2)}
.cm-h{font-size:0.88rem;margin:18px 0 8px;color:var(--ink)}
.cm-h:first-child{margin-top:0}
.cm-tasks{margin:0;padding-inline-start:20px;color:var(--ink-2)}
.cm-tasks li{margin-bottom:5px}
.cm-table td{vertical-align:top}
.cm-role{font-weight:560;width:24%}
.cm-role input{width:100%}
.cm-duty{color:var(--muted);width:34%}
.cm-pick{width:30%}
.cm-actions{display:flex;gap:8px;align-items:center;margin-top:12px}
.cm-hint{color:var(--muted);font-size:0.78rem;margin:8px 0 0}
.cm-meta{display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:18px}
.cm-meta p{margin:0;color:var(--ink-2)}

/* member combobox: type to filter, or type a name that is not on staff */
.cmb{position:relative}
.cmb-input{width:100%}
.cmb-pop{position:absolute;z-index:40;inset-inline-start:0;top:calc(100% + 4px);width:min(330px,88vw);
         max-height:260px;overflow:auto;background:var(--surface);border:1px solid var(--separator-strong);
         border-radius:10px;box-shadow:var(--shadow-panel);padding:4px}
.cmb-opt{display:flex;flex-direction:column;gap:1px;padding:6px 9px;border-radius:7px;cursor:pointer}
.cmb-opt:hover,.cmb-opt.on{background:var(--accent-tint)}
.cmb-n{font-size:0.83rem;color:var(--ink)}
.cmb-m{font-size:0.72rem;color:var(--muted)}
.cmb-empty{padding:8px 9px;color:var(--muted);font-size:0.78rem}

html[data-theme="dark"] .cm-item:hover{background:rgba(255,255,255,0.08)}

@media (max-width:900px){
  .cm-setup{grid-template-columns:1fr}
  .cm-layout{grid-template-columns:1fr}
  .cm-rail{position:static}
}

/* Mixed-script content: staff names stay Arabic even in the English UI, and the catalogue
   is Arabic or English depending on the reader. "plaintext" lets each paragraph take its
   direction from its own first strong character, so punctuation and list numbers land on
   the correct side either way. */
.bidi, .cmb-input, .cmb-n, .cm-role input { unicode-bidi: plaintext; text-align: start; }
.cm-tasks { unicode-bidi: plaintext; }
.cm-tasks li { text-align: start; }

/* the member popup hangs from the field's start edge and never spills out; its two lines
   wrap instead of being clipped, because a role+department label is longer than a name */
.cmb-pop { inset-inline-start: 0; inset-inline-end: auto; min-width: 100%; max-width: min(360px, 80vw); }
.cmb-opt { text-align: start; }
.cmb-n, .cmb-m { overflow-wrap: anywhere; white-space: normal; unicode-bidi: plaintext; }
.cmb-m { line-height: 1.35; }

/* Long English nav labels used to push the footer over the last menu items. The nav now
   shrinks AND scrolls on its own, so the footer stays pinned to the bottom and nothing
   overlaps, at any window height. */
.sidebar { overflow: hidden; }
.sidebar nav { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.side-footer { flex: none; }
.userchip { overflow-wrap: anywhere; }

/* a seat that holds several people stacks its name boxes */
.cm-pick .cm-member { margin-bottom: 5px; }
.cm-pick .cm-member:last-of-type { margin-bottom: 0; }
.cm-many { font-size: 0.68rem; font-weight: 600; color: var(--accent); background: var(--accent-tint);
           border-radius: 99px; padding: 1px 7px; margin-inline-start: 6px; white-space: nowrap; }
.cm-more { background: none; border: 1px dashed var(--separator-strong); color: var(--muted);
           border-radius: 7px; padding: 3px 9px; font-size: 0.76rem; cursor: pointer; margin-top: 5px; }
.cm-more:hover { color: var(--accent); border-color: var(--accent); }
.cm-sup { margin: 6px 0 0; color: var(--muted); font-size: 0.8rem; }
.cm-group { font-size: 0.68rem; font-weight: 600; color: var(--muted); padding: 12px 9px 4px;
            text-transform: uppercase; letter-spacing: 0.02em; }
.cm-group:first-child { padding-top: 2px; }
.cm-dutybox { width: 100%; min-height: 48px; resize: vertical; line-height: 1.5;
              font-size: 0.8rem; color: var(--ink-2); background: var(--surface-2); }
.cm-dutybox:focus { background: var(--surface); color: var(--ink); }
.cm-info { margin: 14px 0 4px; border: 1px solid var(--separator); border-radius: 10px; background: var(--surface-2); }
.cm-info > summary { cursor: pointer; padding: 8px 12px; font-size: 0.82rem; font-weight: 560; color: var(--ink-2); }
.cm-info > summary:hover { color: var(--accent); }
.cm-info[open] > summary { border-bottom: 1px solid var(--separator); }
.cm-info .cm-setup { padding: 14px 12px 4px; grid-template-columns: 1.6fr 1fr 1.6fr auto; }
.cm-info .cm-hint { padding: 0 12px 12px; margin: 0; }
.cm-info input:disabled { background: var(--window-bg); color: var(--muted); }
@media (max-width: 900px) { .cm-info .cm-setup { grid-template-columns: 1fr; } }
/* the deck's own illustrations, shown with the team they belong to */
.cm-slides { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.cm-slides a { display: block; border: 1px solid var(--separator); border-radius: 10px;
               overflow: hidden; background: var(--surface-2); line-height: 0;
               transition: border-color 0.12s var(--ease); }
.cm-slides a:hover { border-color: var(--accent); }
.cm-slides img { width: 100%; height: auto; display: block; }


/* ===== weekly visit schedule =============================================
   Uses the tile grid the school already knows (.sched/.srow/.slabel/.stile from
   the timetable). Only the booking-specific bits are added here. */
.stile.bk { color: #fff; font-weight: 560; text-shadow: 0 1px 2px rgba(0,0,0,.35); cursor: pointer; }
.stile.pick { cursor: pointer; }
.stile.pick:hover { outline: 2px solid var(--accent); outline-offset: 1px; }
.stile .tname { font-size: .72rem; line-height: 1.2; unicode-bidi: plaintext;
                overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.stile .tcls { font-size: .66rem; opacity: .9; }
.stile .tcount { font-size: 1rem; font-weight: 700; }
.legend .sw.bkc { background: #3E7BB6; }
.legend .sw.mix { background: linear-gradient(135deg, #3E7BB6 0 50%, #C0693A 50% 100%); }

/* booking modal */
.cm-dlg { border: none; border-radius: 14px; padding: 0; max-width: 460px; width: calc(100% - 32px);
          box-shadow: var(--shadow-panel); background: var(--surface); color: var(--ink); }
.cm-dlg::backdrop { background: rgba(0,0,0,.42); }
.cm-dlg .dlg-body { padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 12px; }
.cm-dlg .dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cm-dlg .dlg-head h2 { margin: 0; font-size: 1rem; }
.cm-dlg .dlg-x { border: none; background: none; font-size: 1.5rem; line-height: 1; cursor: pointer;
                 color: var(--muted); padding: 0 4px; }
.cm-dlg .dlg-x:hover { color: var(--ink); }
.cm-dlg .dlg-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.cm-dlg select, .cm-dlg input { width: 100%; }
.tf-color input[type=color] { width: 54px; height: 32px; padding: 2px; cursor: pointer; }


/* ===== committee cards ===================================================
   Hierarchy: the number medallion identifies, the name leads, the purpose
   supports, the member count is metadata and sits quietly at the foot. The
   team colour is the card's single accent - a tinted medallion, a hairline
   along the top edge and a soft wash behind it. Neutral surface otherwise,
   no side stripes, no gradient text, no glass. --team is set per card. */
.cm-ovsearch { display: block; max-width: 420px; margin: 16px 0 10px; }
.cm-ovsearch input { width: 100%; }

#cm-list.cm-cards, .cm-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 16px; align-items: stretch;
}
.cm-cards-head {
  grid-column: 1 / -1; font-size: 0.68rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.02em; padding: 18px 2px 0;
}
.cm-cards-head:first-child { padding-top: 2px; }

.cm-card {
  --team: var(--accent);
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; align-items: stretch;
  padding: 18px 18px 14px; min-height: 148px;
  background: var(--surface); border: 1px solid var(--separator); border-radius: 14px;
  box-shadow: var(--shadow-panel); color: var(--ink); text-decoration: none;
  transition: border-color 0.14s var(--ease), transform 0.14s var(--ease),
              box-shadow 0.14s var(--ease);
}
.cm-card-art {
  height: 126px; margin: -18px -18px 14px; padding: 14px 18px;
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; align-items: center; justify-content: space-between;
  color: color-mix(in srgb, var(--team) 78%, #18202d);
  background: radial-gradient(ellipse at 77% 48%, color-mix(in srgb, var(--team) 24%, white), transparent 40%),
              linear-gradient(115deg, color-mix(in srgb, var(--team) 12%, white), color-mix(in srgb, var(--team) 4%, white));
}
.cm-card-art::before, .cm-card-art::after { content: ""; position: absolute; border: 1px solid color-mix(in srgb, var(--team) 22%, transparent); border-radius: 50%; z-index: -1; }
.cm-card-art::before { width: 165px; height: 165px; inset-inline-end: -35px; top: -74px; }
.cm-card-art::after { width: 125px; height: 125px; inset-inline-end: -14px; top: -54px; opacity: .62; }
.cm-art-caption { align-self: flex-start; display: flex; flex-direction: column; gap: 8px; position: relative; z-index: 1; }
.cm-art-caption span { font-size: .61rem; line-height: 1.35; font-weight: 750; letter-spacing: .14em; opacity: .78; }
.cm-art-caption bdi { font-size: 1.1rem; font-weight: 750; letter-spacing: .04em; }
.cm-art-icon { width: 118px; height: 86px; overflow: visible; position: relative; z-index: 1; flex: none; }
.cm-art-icon path, .cm-art-icon circle, .cm-art-icon rect, .cm-art-icon line { fill: color-mix(in srgb, var(--team) 12%, white); stroke: var(--team); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.cm-art-icon circle { fill: color-mix(in srgb, var(--team) 8%, white); }
.cm-art-orbit { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--team); opacity: .55; inset-inline-end: 32%; top: 20px; box-shadow: -71px 73px 0 -1px var(--team); }
.cm-card-content { display: block; }
.cm-card .cm-num.big { margin-bottom: 9px; }
.cm-card-foot { position: relative; }
.cm-card::after { display: none; }
html[data-theme="dark"] .cm-card-art { background: radial-gradient(ellipse at 77% 48%, color-mix(in srgb, var(--team) 28%, #292a30), transparent 40%), linear-gradient(115deg, color-mix(in srgb, var(--team) 23%, #292a30), color-mix(in srgb, var(--team) 12%, #292a30)); }
html[data-theme="dark"] .cm-card-art { color: color-mix(in srgb, var(--team) 38%, #f2f4f8); }
html[data-theme="dark"] .cm-art-icon path,
html[data-theme="dark"] .cm-art-icon circle,
html[data-theme="dark"] .cm-art-icon rect,
html[data-theme="dark"] .cm-art-icon line {
  fill: color-mix(in srgb, var(--team) 22%, #20222a);
  stroke: color-mix(in srgb, var(--team) 45%, #f2f4f8);
}
.cm-card::before {                      /* hairline of the team colour along the top */
  content: ""; position: absolute; inset-inline: 0; top: 0; height: 2px; z-index: -1;
  background: linear-gradient(90deg, transparent, var(--team) 20%, var(--team) 80%, transparent);
}
.cm-card::after {                       /* soft wash behind the medallion */
  content: ""; position: absolute; inset-inline-start: -48px; top: -70px; z-index: -1;
  width: 200px; height: 160px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, var(--team), transparent); opacity: 0.1;
}
.cm-card:hover {
  text-decoration: none; border-color: var(--team); transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0,0,0,.05), 0 8px 24px rgba(0,0,0,.08);
}

.cm-card .cm-num.big {
  align-self: flex-start; margin-bottom: 10px;
  width: 34px; height: 34px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--team); color: #fff;                 /* every team colour clears 4.5:1 */
  font-size: 0.84rem; font-weight: 700; font-variant-numeric: tabular-nums;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.16);
}
.cm-card-t { margin: 0; font-size: 0.95rem; font-weight: 650; line-height: 1.45; }
.cm-card-g {
  margin: 5px 0 0; color: var(--muted); font-size: 0.8rem; line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.cm-card-foot {
  margin-top: auto; padding-top: 12px; font-size: 0.74rem; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.cm-card-foot .cm-empty { color: var(--separator-strong); }

/* the team's own page carries the same medallion */
.cm-title { --team: var(--accent); justify-content: space-between; }
.cm-title .cm-num.big.team {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--team); color: #fff; font-size: 0.84rem; font-weight: 700;
  font-variant-numeric: tabular-nums; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.16);
}

/* a colour chip on each rail row, so the identity carries into the list */
.cm-item { --team: var(--accent); }
.cm-item .cm-num { position: relative; padding-inline-start: 9px; }
.cm-item .cm-num::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 50%; transform: translateY(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: var(--team);
}

html[data-theme="dark"] .cm-card::after { opacity: 0.17; }
.cm-dlg .dlg-sub { margin: 2px 0 0; font-size: .8rem; color: var(--ink-2); }
.cm-dlg .dlg-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cm-dlg .dlg-list li { display: flex; align-items: center; gap: 8px; font-size: .82rem;
                       background: var(--surface-2); border-radius: 8px; padding: 6px 9px;
                       unicode-bidi: plaintext; }
.cm-dlg .dlg-dot { width: 12px; height: 12px; border-radius: 3px; flex: none; }

/* the team header carries one quiet action; "back" sits above the card, where it belongs */
/* This is the only way out of a team page, so it reads as a control rather than as a
   line of grey text sitting on the background. */
.cm-back { display: inline-flex; align-items: center; gap: 7px; font-size: 0.8rem;
           font-weight: 600; color: var(--ink); text-decoration: none;
           padding: 7px 14px; border-radius: 999px; align-self: flex-start;
           background: var(--surface); border: 1px solid var(--line);
           box-shadow: 0 1px 2px rgba(0,0,0,.05);
           transition: background .12s var(--ease), border-color .12s var(--ease),
                       color .12s var(--ease), transform .12s var(--ease); }
.cm-back:hover { color: var(--accent); text-decoration: none;
                 border-color: color-mix(in srgb, var(--accent) 45%, transparent);
                 background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.cm-back:active { transform: translateY(1px); }
.cm-back-i { font-size: 1rem; line-height: 1; }
.cm-edit-btn { flex: none; align-self: flex-start; background: none; border: none; cursor: pointer;
               font: inherit; font-size: 0.78rem; color: var(--muted); padding: 4px 8px;
               border-radius: 7px; transition: background 0.12s var(--ease), color 0.12s var(--ease); }
.cm-edit-btn:hover { color: var(--accent); background: var(--accent-tint); }
.cm-edit-btn[aria-expanded="true"] { color: var(--accent); background: var(--accent-tint); }
/* the tile carries teacher, class and who booked - three short lines inside 62px */
.stile .twho { font-size: .62rem; opacity: .85; line-height: 1.15; unicode-bidi: plaintext;
               overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.stile .tname.two { font-size: .64rem; line-height: 1.15; -webkit-line-clamp: 1; }
.stile .tname.two small { display: block; font-size: .58rem; opacity: .85; }
.stile.bk { gap: 0; padding: 3px 4px; }

/* the detail view is a single column now: the card overview is the navigation,
   so the old side rail is gone and the team gets the full width */
.cm-detail { display: block; margin-top: 4px; }
.cm-detail .cm-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ===== team map ==========================================================
   The deck draws each team as a composed picture, not a chart: two alternating
   tile tones, curved movement, shapes bleeding off a corner. This builds the
   same feeling from the team's own data. --team is the identity colour. */
.cm-map { position: relative; width: 100%; aspect-ratio: 16 / 10; min-height: 380px;
          --team: var(--accent); overflow: hidden; border-radius: 16px;
          box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--team) 14%, transparent);
          background:
            /* two off-centre washes give the plate a light source */
            radial-gradient(70% 60% at 22% 18%,
                            color-mix(in srgb, var(--team) 10%, transparent) 0%, transparent 70%),
            radial-gradient(85% 70% at 82% 88%,
                            color-mix(in srgb, var(--team) 8%, transparent) 0%, transparent 72%),
            /* a faint grain, so the surface is not a flat fill */
            radial-gradient(circle at 50% 50%,
                            color-mix(in srgb, var(--team) 20%, transparent) 0.6px, transparent 0.7px)
              0 0 / 22px 22px,
            var(--surface-2); }

/* the corner decoration, blurred so it has no edge of its own */
.cm-map-blob { position: absolute; inset-inline-end: -90px; bottom: -110px; width: 300px;
               height: 260px; border-radius: 48% 52% 60% 40% / 55% 45% 55% 45%;
               background: color-mix(in srgb, var(--team) 16%, transparent);
               filter: blur(38px); opacity: .75; pointer-events: none; }
.cm-map-blob::after { content: ""; position: absolute; inset-inline-start: 150px; top: -230px;
                      width: 170px; height: 150px;
                      border-radius: 58% 42% 44% 56% / 48% 56% 44% 52%;
                      background: color-mix(in srgb, var(--team) 13%, transparent);
                      filter: blur(30px); }

.cm-map-links { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.cm-orbit { fill: none; stroke: color-mix(in srgb, var(--team) 22%, transparent);
            stroke-width: 0.18; stroke-dasharray: 1.4 2.2; }
.cm-orbit-2 { stroke-dasharray: 0.8 3; opacity: 0.7; }
.cm-link { fill: none; stroke: url(#cmFade); stroke-width: 0.45; stroke-linecap: round; }
.cm-link-dot { fill: var(--team); opacity: 0.5; }

.cm-map-hub, .cm-node {
  position: absolute; transform: translate(50%, -50%);   /* RTL-safe centring */
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 2px;
}
html[dir="ltr"] .cm-map-hub, html[dir="ltr"] .cm-node { transform: translate(-50%, -50%); }

.cm-map-hub {
  inset-inline-start: 50%; top: 50%; width: 148px; height: 148px; padding: 12px;
  border-radius: 50%; background: var(--surface); color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--team) 35%, transparent);
  box-shadow: 0 0 0 10px color-mix(in srgb, var(--team) 7%, transparent),
              0 6px 22px rgba(0,0,0,.09);
}
.cm-map-hub-n { font-size: 0.74rem; font-weight: 700; color: var(--team);
                font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.cm-map-hub-t { font-size: 0.84rem; font-weight: 650; line-height: 1.4; }

/* nodes alternate filled / outlined - the deck's two-tone rhythm */
.cm-node {
  width: 142px; padding: 14px 20px;
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  background: var(--team); color: #fff;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,.16));
}
.cm-node.alt {
  background: var(--surface);
  color: color-mix(in srgb, var(--team) 78%, var(--ink));
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--team) 42%, transparent);
}
.cm-node.lead {
  width: 158px; padding: 17px 22px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.4);
  filter: drop-shadow(0 3px 10px color-mix(in srgb, var(--team) 45%, transparent));
}
.cm-node-role { font-size: 0.64rem; line-height: 1.35; opacity: 0.9;
                 display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
                 overflow: hidden; }   /* a long responsibility is clipped, not spilled */
.cm-node.alt .cm-node-role { opacity: 0.75; }
.cm-node-who { font-size: 0.73rem; font-weight: 650; line-height: 1.35; }
.cm-node.lead .cm-node-who { font-size: 0.78rem; }

/* Each committee gets its own map language while all roles keep the same radial layout. */
.cm-map.map-leadership { background-image: radial-gradient(ellipse at 50% 50%, color-mix(in srgb, var(--team) 13%, transparent), transparent 43%), radial-gradient(circle, color-mix(in srgb, var(--team) 28%, transparent) 1px, transparent 1.5px); background-size: auto, 26px 26px; }
.cm-map.map-leadership .cm-node { clip-path: none; border-radius: 13px 13px 13px 3px; }
.cm-map.map-planning { background-image: linear-gradient(color-mix(in srgb, var(--team) 7%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--team) 7%, transparent) 1px, transparent 1px), radial-gradient(ellipse at 50% 50%, color-mix(in srgb, var(--team) 10%, transparent), transparent 54%); background-size: 28px 28px, 28px 28px, auto; }
.cm-map.map-planning .cm-node { clip-path: none; border-radius: 8px; }
.cm-map.map-planning .cm-map-hub { border-radius: 22px; }
.cm-map.map-data { background-image: repeating-linear-gradient(0deg, transparent 0 23px, color-mix(in srgb, var(--team) 6%, transparent) 24px 25px), repeating-linear-gradient(90deg, transparent 0 23px, color-mix(in srgb, var(--team) 6%, transparent) 24px 25px), radial-gradient(ellipse at center, color-mix(in srgb, var(--team) 10%, transparent), transparent 58%); }
.cm-map.map-data .cm-node { clip-path: none; border-radius: 5px; }
.cm-map.map-data .cm-map-hub { border-radius: 24px; }
.cm-map.map-academic { background-image: repeating-linear-gradient(0deg, transparent 0 31px, color-mix(in srgb, var(--team) 9%, transparent) 32px 33px), linear-gradient(90deg, color-mix(in srgb, var(--team) 5%, transparent), transparent 40%); }
.cm-map.map-academic .cm-node { clip-path: none; border-radius: 12px; }
.cm-map.map-care { background-image: radial-gradient(ellipse at 17% 20%, color-mix(in srgb, var(--team) 13%, transparent), transparent 24%), radial-gradient(ellipse at 85% 78%, color-mix(in srgb, var(--team) 13%, transparent), transparent 28%), radial-gradient(circle, color-mix(in srgb, var(--team) 20%, transparent) 1px, transparent 1.5px); background-size: auto, auto, 34px 34px; }
.cm-map.map-care .cm-node { clip-path: polygon(12% 0, 88% 0, 100% 22%, 96% 82%, 78% 100%, 14% 96%, 0 76%, 4% 20%); }
.cm-map.map-wellbeing { background-image: radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--team) 13%, transparent), transparent 45%), radial-gradient(ellipse at 100% 100%, color-mix(in srgb, var(--team) 11%, transparent), transparent 36%); }
.cm-map.map-wellbeing .cm-node { clip-path: none; border-radius: 999px; }
.cm-map.map-safety { background-image: repeating-linear-gradient(135deg, transparent 0 22px, color-mix(in srgb, var(--team) 5%, transparent) 23px 24px), radial-gradient(ellipse at center, color-mix(in srgb, var(--team) 8%, transparent), transparent 62%); }
.cm-map.map-safety .cm-node { clip-path: polygon(16% 0, 84% 0, 100% 14%, 94% 78%, 50% 100%, 6% 78%, 0 14%); }
.cm-map.map-training { background-image: linear-gradient(145deg, color-mix(in srgb, var(--team) 10%, transparent) 0 1px, transparent 1px 28px), radial-gradient(ellipse at 80% 20%, color-mix(in srgb, var(--team) 12%, transparent), transparent 40%); }
.cm-map.map-training .cm-node { clip-path: none; border-radius: 4px 14px 4px 14px; }
.cm-map.map-media { background-image: repeating-radial-gradient(ellipse at 50% 50%, transparent 0 18px, color-mix(in srgb, var(--team) 8%, transparent) 19px 20px, transparent 21px 34px); }
.cm-map.map-media .cm-node { clip-path: none; border-radius: 14px; }
.cm-map.map-talent { background-image: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--team) 12%, transparent) 0 1px, transparent 1.5px), radial-gradient(ellipse at 50% 50%, transparent 0 45%, color-mix(in srgb, var(--team) 7%, transparent) 45.2% 45.5%, transparent 46%); background-size: 24px 24px, auto; }
.cm-map.map-talent .cm-node { clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.cm-map.map-broadcast { background-image: repeating-radial-gradient(ellipse at 50% 50%, transparent 0 28px, color-mix(in srgb, var(--team) 9%, transparent) 29px 30px, transparent 31px 49px); }
.cm-map.map-broadcast .cm-node { clip-path: none; border-radius: 999px 999px 12px 12px; }
.cm-map.map-innovation { background-image: linear-gradient(45deg, transparent 49.5%, color-mix(in srgb, var(--team) 9%, transparent) 50%, transparent 50.5%), linear-gradient(-45deg, transparent 49.5%, color-mix(in srgb, var(--team) 7%, transparent) 50%, transparent 50.5%), radial-gradient(ellipse at center, color-mix(in srgb, var(--team) 10%, transparent), transparent 64%); background-size: 34px 34px, 34px 34px, auto; }
.cm-map.map-innovation .cm-node { clip-path: polygon(12% 0, 88% 0, 100% 20%, 100% 80%, 88% 100%, 12% 100%, 0 80%, 0 20%); }
.cm-map.map-finance { background-image: repeating-linear-gradient(0deg, transparent 0 25px, color-mix(in srgb, var(--team) 8%, transparent) 26px 27px), linear-gradient(90deg, color-mix(in srgb, var(--team) 8%, transparent) 0 2px, transparent 2px 38px); background-size: auto, 38px 100%; }
.cm-map.map-finance .cm-node { clip-path: none; border-radius: 6px; }
.cm-map.map-inclusion { background-image: radial-gradient(circle at 18% 22%, color-mix(in srgb, var(--team) 13%, transparent) 0 8%, transparent 8.5%), radial-gradient(circle at 84% 76%, color-mix(in srgb, var(--team) 13%, transparent) 0 12%, transparent 12.5%), radial-gradient(circle at 75% 18%, color-mix(in srgb, var(--team) 9%, transparent) 0 4%, transparent 4.5%); }
.cm-map.map-inclusion .cm-node { clip-path: none; border-radius: 12px 12px 12px 2px; }
/* Keep every team map on a quiet, blank canvas; retain only the people and their roles. */
.cm-map { background: var(--surface-2) !important; box-shadow: inset 0 0 0 1px var(--separator); }
.cm-map::before, .cm-map::after, .cm-map-blob,
.cm-map-links, .cm-orbit, .cm-link, .cm-link-dot { display: none !important; }
.cm-map.map-eco .cm-node { clip-path: none; border-radius: 18px 4px 18px 4px; }
.cm-map.map-ai .cm-node { clip-path: polygon(10% 0, 90% 0, 100% 18%, 100% 82%, 90% 100%, 10% 100%, 0 82%, 0 18%); }
.cm-map.map-protection .cm-node { clip-path: polygon(15% 0, 85% 0, 100% 16%, 94% 78%, 50% 100%, 6% 78%, 0 16%); }
.cm-map.map-order .cm-node { clip-path: none; border-radius: 5px; }
.cm-map.map-partnership .cm-node { clip-path: none; border-radius: 999px; }
.cm-map-art { width: 88px; height: 62px; flex: none; margin: 0 auto 1px; overflow: visible; position: relative; z-index: 1; filter: drop-shadow(0 3px 4px color-mix(in srgb, var(--team) 18%, transparent)); }
.cm-map-hub { width: 190px; height: 190px; padding: 14px; gap: 2px; }
.cm-map-hub-t { display: block; width: 100%; max-height: none; overflow: visible; white-space: normal; overflow-wrap: anywhere; font-size: .8rem; line-height: 1.32; }
.cm-scene-disc { fill: color-mix(in srgb, var(--team) 13%, var(--surface)); stroke: color-mix(in srgb, var(--team) 25%, transparent); stroke-width: 1; }
.cm-scene-halo { fill: none; stroke: color-mix(in srgb, var(--team) 26%, transparent); stroke-width: .8; stroke-dasharray: 1.8 2.6; }
.cm-scene-spark { fill: color-mix(in srgb, var(--team) 68%, #f6b942); stroke: none; }
.cm-scene-ray { fill: none; stroke: color-mix(in srgb, var(--team) 48%, transparent); stroke-width: 1.5; stroke-linecap: round; }
.cm-scene-icon path, .cm-scene-icon circle, .cm-scene-icon rect, .cm-scene-icon line { fill: color-mix(in srgb, var(--team) 18%, var(--surface)); stroke: color-mix(in srgb, var(--team) 90%, #27324a); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.cm-scene-icon circle { fill: color-mix(in srgb, var(--team) 24%, var(--surface)); }
.cm-map-hub-n, .cm-map-hub-t { position: relative; z-index: 1; }
.cm-node-who { max-width: 100%; overflow-wrap: anywhere; }

html[data-theme="dark"] .cm-map-hub { background: var(--surface); }
html[data-theme="dark"] .cm-node.alt { background: var(--surface); }

@media (max-width: 820px) {
  /* a wheel does not survive a phone: fall back to a plain list */
  .cm-map { aspect-ratio: auto; min-height: 0; display: flex; flex-direction: column;
            gap: 8px; padding: 12px; }
  .cm-map-links, .cm-map-blob { display: none; }
  .cm-map-art { width: 54px; height: 40px; margin: 0; }
  .cm-map-hub, .cm-node { position: static; transform: none; width: auto; height: auto; }
  .cm-map-hub { border-radius: 12px; flex-direction: row; gap: 8px; justify-content: flex-start;
                box-shadow: none; padding: 10px 12px; }
  /* the doubled .cm-map outranks any .cm-map.map-* motif rule, whatever its order */
  .cm-map.cm-map .cm-node,
  .cm-map.cm-map .cm-node.lead { clip-path: none; border-radius: 10px; flex-direction: row;
             justify-content: space-between; gap: 10px; padding: 10px 12px; text-align: start;
             filter: none; width: auto; }
}


/* ===== team calendar =====================================================
   The team's own meetings and deadlines. Deliberately NOT the visit timetable:
   a month grid reads at a glance, and the list under it is what people act on.
   --team is the team's identity colour, so each team's calendar is its own. */
.cm-sechead { display: flex; align-items: center; justify-content: space-between;
              gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.cm-sechead .cm-h { margin: 0; }
.cm-badge-lead { font-size: 0.72rem; font-weight: 650; padding: 3px 10px; border-radius: 999px;
                 color: var(--accent);
                 background: color-mix(in srgb, var(--accent) 12%, transparent); }

.cm-calnav { display: flex; align-items: center; gap: 8px; }
.cm-calmonth { font-weight: 650; min-width: 9ch; text-align: center; }

.cm-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
           --team: var(--accent); }
.cm-gh { font-size: 0.7rem; font-weight: 650; color: var(--muted);
         text-align: center; padding: 4px 0; }
.cm-day { min-height: 76px; padding: 5px 6px; border-radius: 9px;
          background: var(--surface-2); display: flex; flex-direction: column; gap: 3px;
          border: 1px solid transparent; }
.cm-day.out { opacity: .42; }
.cm-day.today { border-color: color-mix(in srgb, var(--team) 55%, transparent);
                background: color-mix(in srgb, var(--team) 7%, var(--surface-2)); }
.cm-daynum { font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.cm-day.today .cm-daynum { color: var(--team); font-weight: 700; }
.cm-ev { font-size: 0.68rem; line-height: 1.3; padding: 2px 6px; border-radius: 6px;
         background: var(--team); color: #fff;
         overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cm-h4 { font-size: 0.86rem; font-weight: 650; margin: 18px 0 8px; }
.cm-evlist { list-style: none; margin: 0; padding: 0; --team: var(--accent); }
.cm-evlist li { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px;
                padding: 9px 0; border-top: 1px solid var(--line); }
.cm-evlist li:first-child { border-top: 0; }
.cm-evdate { font-variant-numeric: tabular-nums; font-weight: 650; color: var(--team); }
.cm-evtime, .cm-evplace, .cm-evnote { font-size: 0.78rem; color: var(--muted); }
.cm-evtitle { font-weight: 600; }
.cm-evnote { flex-basis: 100%; }
.cm-evdel { margin-inline-start: auto; }

.cm-evform { display: grid; gap: 10px 12px; margin-top: 16px; padding-top: 14px;
             border-top: 1px solid var(--line);
             grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; }
.cm-evform label { display: flex; flex-direction: column; gap: 4px;
                   font-size: 0.78rem; color: var(--muted); }
.cm-evform .cm-evnotes { grid-column: 1 / -1; }
.cm-evform button { justify-self: start; }

/* a member's own duty sits under her name, not in a column of its own */
.cm-member .cm-dutybox { margin-top: 6px; width: 100%; }
.cm-seatduty { font-size: 0.74rem; color: var(--muted); margin: 8px 0 0; }
.cm-dutytext { white-space: pre-line; }

@media (max-width: 720px) {
  .cm-day { min-height: 52px; }
  .cm-ev { font-size: 0; padding: 0; height: 6px; border-radius: 3px; }   /* dots on a phone */
}


/* ===== team artwork =====================================================
   The school's own picture for a team. It carries the card on its own, so the
   card gives it nothing but a frame. */
.cm-artcard { padding: 0; overflow: hidden; }
.cm-art { display: block; width: 100%; height: auto; }


/* ===== committee member picker ===========================================
   One seat, one responsibility, and the people who hold it. The chosen names are
   chips above the search box so a seat with eight members still reads as a list. */
.cm-edit-table td { vertical-align: top; }
.cm-edit-table .cm-role { width: 26%; }
.cm-edit-table .cm-duty { width: 37%; }
.cm-edit-table .cm-pick { width: 37%; }
.cm-roletitle { width: 100%; }
.cm-duty .cm-dutybox { width: 100%; }

.cm-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 7px; }
.cm-chips:empty { display: none; }
.cm-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
           padding: 3px 6px 3px 10px; border-radius: 999px; font-size: 0.78rem;
           background: color-mix(in srgb, var(--accent) 11%, transparent);
           color: color-mix(in srgb, var(--accent) 72%, var(--ink)); }
html[dir="rtl"] .cm-chip { padding: 3px 10px 3px 6px; }
.cm-chip-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-chip-x { border: 0; cursor: pointer; line-height: 1; font-size: 0.95rem;
             width: 18px; height: 18px; border-radius: 50%; flex: none;
             background: color-mix(in srgb, var(--accent) 18%, transparent);
             color: inherit; }
.cm-chip-x:hover { background: color-mix(in srgb, var(--accent) 34%, transparent); }

.cmb-opt { display: grid; grid-template-columns: 16px 1fr auto; align-items: baseline; gap: 8px; }
.cmb-tick { color: var(--accent); font-weight: 700; }
.cmb-opt.picked { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.cmb-addnew { cursor: pointer; }

@media (max-width: 760px) {
  /* a three-column editor does not fit a phone: each cell becomes its own block */
  .cm-edit-table, .cm-edit-table tbody, .cm-edit-table tr, .cm-edit-table td { display: block; width: auto; }
  /* the desktop column widths are two classes deep, so they need naming again here */
  .cm-edit-table .cm-role,
  .cm-edit-table .cm-duty,
  .cm-edit-table .cm-pick { width: auto; }
  .cm-edit-table thead { display: none; }
  .cm-edit-table tr { border-top: 1px solid var(--line); padding: 10px 0; }
  .cm-edit-table td { padding: 4px 0; }
}


/* ===== calendar entry dialog ============================================
   The month grid is the control: a day opens this with its own date filled in. */
.cm-day.pickable { cursor: pointer; }
.cm-day.pickable:hover,
.cm-day.pickable:focus-visible { outline: none;
  background: color-mix(in srgb, var(--team) 13%, var(--surface-2));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--team) 45%, transparent); }
.cm-day.pickable::after { content: "+"; position: absolute; inset-inline-end: 6px; top: 3px;
  font-size: 0.8rem; line-height: 1; color: var(--team); opacity: 0; }
.cm-day { position: relative; }
.cm-day.pickable:hover::after, .cm-day.pickable:focus-visible::after { opacity: .75; }

.cm-modal { width: min(560px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 14px;
            background: var(--surface); color: var(--ink);
            box-shadow: 0 18px 50px rgba(0,0,0,.26); }
.cm-modal::backdrop { background: rgba(14, 18, 27, .42); }
.cm-modal .cm-evform { margin: 0; padding: 16px 18px 18px; border-top: 0; }
.cm-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
                 grid-column: 1 / -1; padding-bottom: 2px; }
.cm-modal-head h4 { margin: 0; font-size: 0.98rem; font-weight: 650; }
.cm-modal-x { border: 0; background: none; cursor: pointer; font-size: 1.3rem; line-height: 1;
              color: var(--muted); padding: 0 4px; }
.cm-modal-x:hover { color: var(--ink); }
.cm-modal-foot { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px;
                 padding-top: 4px; }
.cm-modal .cm-evform button { justify-self: auto; }


/* ===== responsibility composer ==========================================
   Name the work, say who holds it, add it. The two fields carry one sentence
   between them, so they get equal width and one shared baseline. */
.cm-compose { display: grid; gap: 12px 16px; margin-bottom: 8px;
              padding: 16px; border-radius: 12px; background: var(--surface-2);
              border: 1px solid color-mix(in srgb, var(--accent) 12%, transparent);
              grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
              align-items: start; }
.cm-compose > label { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cm-compose > label > span { font-size: 0.74rem; font-weight: 650; color: var(--muted);
                             letter-spacing: .01em; }
.cm-compose textarea { width: 100%; min-height: 62px; resize: vertical; }

/* the picker has to fill its column; left to itself it collapses to its placeholder */
.cm-compose .cm-pick { display: block; width: 100%; }
.cm-compose .cm-pick .cmb { width: 100%; }
.cm-compose .cm-pick .cmb-input { width: 100%; }
.cm-compose .cm-chips { margin-bottom: 6px; }

/* the button shares the fields' baseline rather than inventing a third one */
.cm-compose #cm-addresp { align-self: start; margin-top: 23px; min-height: 38px;
                          padding-inline: 18px; white-space: nowrap; }
.cm-compose-hint { font-size: 0.76rem; color: var(--muted); margin: 0 0 18px; }

@media (max-width: 760px) {
  .cm-compose { grid-template-columns: 1fr; }
  .cm-compose #cm-addresp { justify-self: stretch; margin-top: 2px; }
}


/* ===== a fuller map =====================================================
   Every responsibility is a node, so a busy team needs smaller ones rather
   than a "+N" that hides most of its work. */
.cm-map.full { aspect-ratio: 16 / 11; }
.cm-map.full .cm-node { width: 128px; padding: 12px 17px; }
.cm-map.full .cm-node.lead { width: 142px; padding: 14px 19px; }

.cm-map.dense { aspect-ratio: 16 / 12; min-height: 460px; }
.cm-map.dense .cm-node { width: 112px; padding: 10px 15px; }
.cm-map.dense .cm-node.lead { width: 126px; padding: 12px 17px; }
.cm-map.dense .cm-node-role { font-size: 0.6rem; }
.cm-map.dense .cm-node-who { font-size: 0.68rem; }
.cm-map.dense .cm-map-hub { width: 190px; height: 190px; }
.cm-map.dense .cm-map-art { width: 88px; height: 62px; }

@media (max-width: 820px) {
  /* the phone list wins over the ring's sizing, whichever ring it was */
  .cm-map.cm-map.full, .cm-map.cm-map.dense { aspect-ratio: auto; min-height: 0; }
  .cm-map.cm-map.full .cm-node, .cm-map.cm-map.dense .cm-node,
  .cm-map.cm-map.full .cm-node.lead, .cm-map.cm-map.dense .cm-node.lead {
    width: auto; padding: 10px 12px; }
  .cm-map.cm-map.dense .cm-map-hub { width: auto; height: auto; }
}

/* ============ the account's own page ============
   Dark mode and the accent colour used to sit at the foot of the nav, where they were
   permanent furniture for a choice made once. They now live on Profile.aspx, and the
   user chip in the sidebar is the way in. */
.side-footer a.userchip {
  /* no display here on purpose: the narrow-screen rule above makes the chip a flex row,
     and a display of my own would win on specificity and flatten it */
  color: var(--ink); border-radius: 7px;
  padding: 3px 6px; margin: -3px -6px;
  transition: background 0.12s var(--ease);
}
.side-footer a.userchip:hover { background: rgba(0, 0, 0, 0.055); text-decoration: none; }
html[data-theme="dark"] .side-footer a.userchip:hover { background: rgba(255, 255, 255, 0.12); }

.pf-facts { margin: 0; display: grid; gap: 10px 22px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.pf-facts > div { min-width: 0; }
.pf-facts dt { font-size: 0.74rem; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.pf-facts dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

.pf-pref {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 13px 0; border-top: 1px solid var(--separator);
}
.pf-pref:first-of-type { border-top: none; }
.pf-pref-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pf-pref .theme-row { flex: none; }

@media (max-width: 480px) {
  .pf-pref { align-items: flex-start; flex-direction: column; gap: 10px; }
}


/* ===== responsibilities table ===========================================
   A row holds a two-line responsibility and one or two short names. The control
   for adding another name is wanted for a second at a time, so it is chip-sized
   rather than a field as wide as a name - which is what made the column ragged. */
.cm-edit-table { border-collapse: collapse; }
.cm-edit-table td { padding: 10px 12px; border-top: 1px solid var(--line);
                    vertical-align: top; }
.cm-edit-table tbody tr:first-child td { border-top: 0; }
.cm-edit-table tbody tr:hover { background: color-mix(in srgb, var(--ink) 3%, transparent); }
.cm-edit-table thead th { padding-bottom: 9px; }
.cm-edit-table .cm-role { width: 52%; font-weight: 600; line-height: 1.5; padding-top: 14px; }
.cm-edit-table .cm-pick { width: 48%; }
.cm-edit-table .cm-roletitle { width: 100%; }

/* chips, the add control and delete share one line and one left edge */
.cm-edit-table .cm-pick { white-space: normal; }
.cm-edit-table .cm-pick .cm-chips { display: inline-flex; flex-wrap: wrap; gap: 6px;
                                    vertical-align: middle; margin: 0; }
.cm-edit-table .cm-pick .cm-chips:not(:empty) { margin-inline-end: 6px; }

/* the field is hidden until the "+" is pressed */
.cm-edit-table .cm-pick .cmb { display: none; width: 164px; vertical-align: middle; }
.cm-edit-table .cm-pick .cmb.open { display: inline-block; }
.cm-edit-table .cm-pick .cmb-input { width: 100%; padding-block: 5px; font-size: 0.8rem; }
.cm-edit-table .cm-pick .cmb.open + .cm-addmember { display: none; }

.cm-addmember { width: 26px; height: 26px; border-radius: 999px; border: 1px dashed var(--line);
                background: none; color: var(--muted); cursor: pointer; line-height: 1;
                font-size: 0.95rem; vertical-align: middle; padding: 0; }
.cm-addmember:hover { border-style: solid; border-color: var(--accent); color: var(--accent);
                      background: color-mix(in srgb, var(--accent) 8%, transparent); }

/* delete sits at the row's far edge, quiet until the row is hovered */
.cm-del { float: inline-end; width: 26px; height: 26px; border: 0; border-radius: 999px;
          background: none; color: var(--muted); cursor: pointer; line-height: 1;
          font-size: 1.05rem; padding: 0; opacity: 0;
          transition: opacity .12s ease, color .12s ease, background .12s ease; }
.cm-edit-table tr:hover .cm-del, .cm-del:focus-visible { opacity: 1; }
.cm-del:hover { color: var(--red-ink, #b3261e);
                background: color-mix(in srgb, #b3261e 10%, transparent); }

.cm-table .cm-dutytext, .cm-table .cm-role { line-height: 1.5; }

@media (max-width: 760px) {
  .cm-edit-table .cm-role, .cm-edit-table .cm-pick { width: auto; }
  .cm-edit-table td { border-top: 0; padding: 4px 0; }
  .cm-edit-table tr { border-top: 1px solid var(--line); padding: 12px 0; }
  .cm-edit-table tbody tr:first-child { border-top: 0; }
  .cm-del { opacity: 1; }          /* no hover on a phone */
}
