/* ========================================================
   STUDIO — Shared design system
   ======================================================== */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f6f6f7;
  --surface-3: #ededee;
  --line: #e7e7ea;
  --line-2: #d4d4d8;
  --line-3: #a1a1aa;

  --ink: #09090b;
  --ink-2: #1f1f23;
  --ink-3: #52525b;
  --ink-4: #71717a;
  --ink-5: #a1a1aa;

  --accent: #4f46e5;
  --accent-2: #6366f1;
  --accent-3: #4338ca;
  --accent-soft: #eef2ff;
  --accent-soft-2: #e0e7ff;

  --green: #10b981;
  --green-soft: #d1fae5;
  --green-deep: #047857;
  --amber: #f59e0b;
  --amber-soft: #fef3c7;
  --amber-deep: #b45309;
  --red: #ef4444;
  --red-soft: #fee2e2;
  --red-deep: #b91c1c;
  --slate: #64748b;
  --slate-soft: #f1f5f9;

  /* 5 program-type categories: capacity×ب, capacity×ح, strategic×ب, strategic×ح, workshop */
  --t-remote: #0ea5e9;          /* sky-500 — capacity remote */
  --t-remote-bg: #f0f9ff;       /* sky-50 */
  --t-presence: #16a34a;        /* green-600 — capacity in-person */
  --t-presence-bg: #f0fdf4;     /* green-50 */
  --t-strat-remote: #9333ea;    /* purple-600 — strategic remote */
  --t-strat-remote-bg: #faf5ff; /* purple-50 */
  --t-strat-presence: #db2777;  /* pink-600 — strategic in-person */
  --t-strat-presence-bg: #fdf2f8; /* pink-50 */
  --t-workshop: #ea580c;        /* orange-600 — workshop (always ح) */
  --t-workshop-bg: #fff7ed;     /* orange-50 */
  /* legacy alias (some BC legends still reference --t-strategic) */
  --t-strategic: #db2777;
  --t-strategic-bg: #fdf2f8;

  --sidebar-w: 232px;
  --topbar-h: 52px;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-xs: 4px;

  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.04);
  --shadow: 0 1px 3px 0 rgba(0,0,0,0.06), 0 1px 2px -1px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px -4px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 24px -8px rgba(0,0,0,0.10), 0 4px 8px -4px rgba(0,0,0,0.04);

  /* Topbar/sidebar surface tint (changes per theme) */
  --tb-glass: rgba(255,255,255,0.78);
  --hero-bg-1: #09090b;
  --hero-bg-2: #1f1f23;
  --hero-text: #fafafa;

  color-scheme: light;
}

/* ========== DARK MODE ========== */
[data-theme="dark"] {
  /* Surfaces — lifted from pure-black for better readability */
  --bg: #1a1a1f;
  --surface: #25252b;
  --surface-2: #2f2f37;
  --surface-3: #3a3a44;

  /* Lines — clearly visible */
  --line: #3a3a44;
  --line-2: #4a4a55;
  --line-3: #6c6c77;

  /* Text — high contrast hierarchy */
  --ink: #fafafa;
  --ink-2: #e4e4e7;
  --ink-3: #c2c2c8;
  --ink-4: #9c9ca5;
  --ink-5: #6c6c77;

  /* Accent — brighter for dark bg */
  --accent: #818cf8;
  --accent-2: #a5b4fc;
  --accent-3: #6366f1;
  --accent-soft: rgba(129, 140, 248, 0.18);
  --accent-soft-2: rgba(129, 140, 248, 0.32);

  /* Status — softer brightness, soft bg more visible */
  --green: #4ade80;
  --green-soft: rgba(74, 222, 128, 0.18);
  --green-deep: #86efac;
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.18);
  --amber-deep: #fcd34d;
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.2);
  --red-deep: #fca5a5;
  --slate: #94a3b8;
  --slate-soft: rgba(148, 163, 184, 0.18);

  /* Program types — distinct hues for dark theme (5 categories) */
  --t-remote: #38bdf8;          /* sky-400 */
  --t-remote-bg: rgba(56, 189, 248, 0.18);
  --t-presence: #4ade80;        /* green-400 */
  --t-presence-bg: rgba(74, 222, 128, 0.18);
  --t-strat-remote: #c084fc;    /* purple-400 */
  --t-strat-remote-bg: rgba(192, 132, 252, 0.18);
  --t-strat-presence: #f472b6;  /* pink-400 */
  --t-strat-presence-bg: rgba(244, 114, 182, 0.18);
  --t-workshop: #fb923c;        /* orange-400 */
  --t-workshop-bg: rgba(251, 146, 60, 0.18);
  /* legacy alias */
  --t-strategic: #f472b6;
  --t-strategic-bg: rgba(244, 114, 182, 0.18);

  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.4);
  --shadow: 0 1px 3px 0 rgba(0,0,0,0.5), 0 1px 2px -1px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px -4px rgba(0,0,0,0.5), 0 2px 4px -2px rgba(0,0,0,0.3);
  --shadow-lg: 0 12px 24px -8px rgba(0,0,0,0.6), 0 4px 8px -4px rgba(0,0,0,0.3);

  --tb-glass: rgba(26,26,31,0.82);
  --hero-bg-1: #2f2f37;
  --hero-bg-2: #25252b;
  --hero-text: #fafafa;

  color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
*, *::before, *::after { font-variant-numeric: tabular-nums; }

html { font-size: 14px; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'IBM Plex Sans Arabic', 'Inter', sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
.mono { font-family: 'JetBrains Mono', monospace; }
.latin { font-family: 'Inter', sans-serif; }

a { color: inherit; text-decoration: none; }

/* ========== APP SHELL ========== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-areas: "sidebar main";
  min-height: 100vh;
}
/* Sidebar on RIGHT (RTL standard) via named areas */
.app > .sidebar { grid-area: sidebar; }
.app > .main { grid-area: main; min-width: 0; }

/* ========== SIDEBAR ========== */
.sidebar {
  background: var(--surface);
  border-inline-start: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sb-brand {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sb-mark {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--ink), var(--ink-2));
  color: var(--surface);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 2px 6px -2px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}
.sb-brand-text h1 {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.sb-brand-text p {
  font-family: 'IBM Plex Sans Arabic', sans-serif;
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 500;
  letter-spacing: 0.01em;
  margin-top: 4px;
  line-height: 1.4;
}

.sb-nav {
  flex: 1;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.sb-section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink-4);
  padding: 12px 8px 6px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 500;
}
.sb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
  position: relative;
}
.sb-item:hover { background: var(--surface-2); color: var(--ink); }
.sb-item.active {
  background: var(--ink);
  color: var(--surface);
  box-shadow: 0 1px 2px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.06);
}
.sb-item.active .sb-ico {
  background: rgba(255,255,255,0.1);
  color: var(--surface);
}
[data-theme="dark"] .sb-item.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: #fff;
  box-shadow: 0 4px 12px -4px rgba(99, 102, 241, 0.4), inset 0 1px 0 rgba(255,255,255,0.16);
}
[data-theme="dark"] .sb-item.active .sb-ico { background: rgba(255,255,255,0.16); color: #fff; }
[data-theme="dark"] .sb-item.active .sb-badge { background: rgba(255,255,255,0.18); color: #fff; }
.sb-ico {
  width: 24px; height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  flex-shrink: 0;
}
.sb-badge {
  margin-inline-start: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  background: var(--surface-2);
  color: var(--ink-4);
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 600;
}
.sb-item.active .sb-badge { background: rgba(255,255,255,0.12); color: var(--surface); }
.sb-badge.alert { background: var(--red-soft); color: var(--red-deep); }

.sb-user {
  border-top: 1px solid var(--line);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background 0.12s;
}
.sb-user:hover { background: var(--surface-2); }
.sb-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.sb-user-info { flex: 1; min-width: 0; }
.sb-user-name { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.2; letter-spacing: -0.01em; }
.sb-user-role {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink-4);
  margin-top: 2px;
}
.sb-user-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-3);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: all 0.12s;
}
.sb-user:hover .sb-user-action {
  background: var(--red-soft, #fee2e2);
  color: var(--red-deep, #991b1b);
  border-color: color-mix(in srgb, var(--red, #dc2626) 30%, transparent);
}

/* ========== MAIN ========== */
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ========== TOPBAR ========== */
.topbar {
  background: var(--tb-glass);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
  padding: 10px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--topbar-h);
}
.tb-left { display: flex; align-items: center; gap: 12px; }
.tb-title { font-size: 14px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.tb-crumbs { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-4); }
.tb-crumbs .sep { color: var(--ink-5); font-weight: 300; }
.tb-crumbs .here { color: var(--ink-2); font-weight: 600; }

.tb-right { display: flex; align-items: center; gap: 8px; }

.search-mini {
  position: relative;
  width: 280px;
}
.search-mini input {
  width: 100%;
  padding: 6px 30px 6px 50px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
}
.search-mini input::placeholder { color: var(--ink-5); }
.search-mini input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-mini::before {
  content: '⌕';
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--ink-4);
  font-size: 14px;
  pointer-events: none;
}
.kbd-hint {
  position: absolute;
  left: 6px; top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  display: flex;
  gap: 2px;
}
.kbd {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 4px;
  box-shadow: 0 1px 0 var(--line);
  letter-spacing: -0.02em;
}

.btn-icon {
  width: 32px; height: 32px;
  background: var(--surface);
  color: var(--ink-3);
  border: 1px solid var(--line);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
  font-size: 14px;
  position: relative;
}
.btn-icon:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line-2); }
.btn-icon .dot {
  position: absolute;
  top: 5px; left: 5px;
  width: 6px; height: 6px;
  background: var(--red);
  border-radius: 50%;
  border: 1.5px solid var(--surface);
}

/* Theme toggle */
.theme-toggle .ico-sun { display: none; }
.theme-toggle .ico-moon { display: inline; }
[data-theme="dark"] .theme-toggle .ico-sun { display: inline; }
[data-theme="dark"] .theme-toggle .ico-moon { display: none; }

.pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-3);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  letter-spacing: -0.01em;
}
.pill b { color: var(--ink); font-weight: 600; }
.pill.live::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--green);
  border-radius: 50%;
  margin-left: 5px;
  animation: pulse-green 2s infinite;
  vertical-align: middle;
}
@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.5); }
  50% { box-shadow: 0 0 0 4px rgba(16,185,129,0); }
}

/* ========== CONTENT ========== */
.content {
  flex: 1;
  padding: 26px 24px 50px;
  max-width: 1640px;
  width: 100%;
  margin: 0 auto;
}

/* ========== HEADINGS ========== */
.page-h {
  margin-bottom: 22px;
  animation: fade-up 0.5s ease both;
}
.page-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--accent-soft);
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 500;
  border: 1px solid var(--accent-soft-2);
}
.page-eyebrow::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.15);
}
.page-h h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.025em;
  line-height: 1.15;
}
.page-h h1 .accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.page-h .sub {
  margin-top: 6px;
  color: var(--ink-3);
  font-size: 14px;
  max-width: 640px;
}
.page-h-row {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
}

/* ========== BUTTONS ========== */
.btn {
  border: 0;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: #fff;
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.16);
}
.btn-primary:hover { box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.16); transform: translateY(-1px); }
.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line-2); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 5px; }

/* ========== CARDS ========== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all 0.15s;
}
[data-theme="dark"] .card { box-shadow: 0 0 0 1px rgba(255,255,255,0.02), var(--shadow-sm); }
.card-head {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.015em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title::before {
  content: '';
  width: 3px;
  height: 14px;
  background: var(--accent);
  border-radius: 2px;
}
.card-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-4);
}
.card-body { padding: 14px 18px; }
.card-body.tight { padding: 0; }

/* ========== ANIM ========== */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 5px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--line-3); }
.sidebar::-webkit-scrollbar-thumb { border-color: var(--surface); }

/* ========== SEMESTER SWITCHER ========== */
.sem-switch {
  position: relative;
}
.sem-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px 5px 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  letter-spacing: -0.01em;
  transition: all 0.15s;
  font-family: inherit;
}
.sem-pill:hover { background: var(--surface-2); border-color: var(--line-2); }
.sem-pill.active {
  background: var(--accent-soft);
  border-color: var(--accent-soft-2);
  color: var(--accent);
}
.sem-pill::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  margin-left: 4px;
  box-shadow: 0 0 0 2px var(--accent-soft-2);
}
.sem-pill .caret {
  font-family: 'JetBrains Mono', monospace;
  color: var(--ink-4);
  font-size: 10px;
  margin-right: 2px;
}
.sem-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-end: 0;
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 5px;
  z-index: 70;
  display: none;
  animation: pop 0.15s ease both;
}
.sem-dropdown.open { display: block; }
.sem-dropdown::before {
  content: 'الفصول الدراسيّة';
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink-4);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
  padding: 8px 10px 5px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.sem-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
}
.sem-item:hover { background: var(--surface-2); }
.sem-item-info { flex: 1; min-width: 0; }
.sem-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.015em;
}
.sem-item-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink-4);
  margin-top: 2px;
  letter-spacing: -0.01em;
}
.sem-item-status {
  font-family: 'Inter', sans-serif;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.sem-item.active .sem-item-status {
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: #fff;
}
.sem-item.active {
  background: var(--accent-soft);
}
.sem-item.vacation .sem-item-status {
  background: var(--amber-soft);
  color: var(--amber-deep);
}

/* ========== SHARED MODAL ========== */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(9,9,11,0.5);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-bg.open { display: flex; animation: fade-in 0.2s; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface);
  width: 100%;
  max-width: 540px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 32px 64px -16px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,0,0,0.04);
  animation: pop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
[data-theme="dark"] .modal {
  box-shadow: 0 0 0 1px rgba(255,255,255,0.05), 0 32px 64px -16px rgba(0,0,0,0.7);
}
@keyframes pop { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: start;
}
.modal-head h3 { font-size: 17px; font-weight: 700; color: var(--ink); letter-spacing: -0.02em; }
.modal-head h3 em { font-style: italic; color: var(--accent); }
.modal-head p { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--ink-4); margin-top: 4px; letter-spacing: -0.01em; }
.modal-head .close {
  width: 28px; height: 28px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-3);
  cursor: pointer;
  font-size: 14px;
  border-radius: 6px;
}
.modal-head .close:hover { background: var(--surface-2); }
.modal-body { padding: 18px 22px; }
.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field label {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-3);
  margin-bottom: 5px;
  font-weight: 500;
}
.field input, .field select {
  width: 100%;
  padding: 8px 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.modal-foot {
  padding: 12px 22px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-foot .ctx { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--ink-3); }
.modal-foot .ctx b { color: var(--accent); font-weight: 600; }

/* ========== HELPERS ========== */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: -0.02em;
}
.tag-green { background: var(--green-soft); color: var(--green-deep); }
.tag-amber { background: var(--amber-soft); color: var(--amber-deep); }
.tag-red { background: var(--red-soft); color: var(--red-deep); }
.tag-slate { background: var(--slate-soft); color: var(--slate); }
.tag-accent { background: var(--accent-soft); color: var(--accent); }

.dot-status {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.dot-status.green { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.dot-status.amber { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.dot-status.red { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.dot-status.slate { background: var(--slate); box-shadow: 0 0 0 3px var(--slate-soft); }

.divider {
  height: 1px;
  background: var(--line);
  margin: 12px 0;
}

.hr-vertical { width: 1px; height: 12px; background: var(--line); display: inline-block; vertical-align: middle; margin: 0 8px; }

/* ============================================
   Trainer detail drawer (shared across pages)
   ============================================ */
.td-bg {
  position: fixed; inset: 0;
  background: rgba(9,9,11,0.45);
  backdrop-filter: blur(4px);
  z-index: 110;
  display: none;
}
.td-bg.open { display: block; animation: fade-in 0.18s; }
.td-drawer {
  position: fixed;
  top: 0; bottom: 0; left: 0;
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  box-shadow: 8px 0 32px -8px rgba(0,0,0,0.18);
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 111;
  display: flex;
  flex-direction: column;
}
.td-bg.open + .td-drawer,
.td-drawer.open { transform: translateX(0); }

.td-head {
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  position: sticky; top: 0; z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
}
.td-close {
  width: 32px; height: 32px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-3);
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
}
.td-close:hover { background: var(--ink); color: var(--surface); }
.td-head h2 { font-size: 14px; font-weight: 600; color: var(--ink-3); flex: 1; }

.td-body { padding: 18px 20px; flex: 1; }

.td-profile {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.td-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
  color: var(--ink-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.td-avatar.senior {
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: var(--surface);
  border-color: transparent;
  box-shadow: 0 0 0 2px var(--accent-soft-2);
}
.td-pinfo { flex: 1; min-width: 0; }
.td-pname { font-size: 18px; font-weight: 700; color: var(--ink); letter-spacing: -0.02em; display: flex; align-items: center; gap: 6px; }
.td-pcat { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--ink-4); margin-top: 2px; text-transform: uppercase; }
.td-pemail { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; direction: ltr; text-align: right; }
.td-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.td-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid;
  line-height: 1.6;
}
.td-badge.status-leave   { color: var(--red-deep); background: var(--red-soft); border-color: var(--red-soft); }
.td-badge.status-scholarship { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-soft-2); }
.td-badge.status-resigned { color: var(--ink-4); background: var(--surface-2); border-color: var(--line); }
.td-badge.deduction { color: var(--amber-deep); background: var(--amber-soft); border-color: var(--amber-soft); }
.td-badge.admin    { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-soft-2); }
.td-sr {
  font-family: 'Inter', sans-serif;
  font-size: 9px; font-weight: 700;
  padding: 1px 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: var(--surface);
  border-radius: 3px;
  letter-spacing: 0.04em;
}

.td-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}
.td-stat {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
}
.td-stat-l { font-size: 10px; color: var(--ink-4); text-transform: uppercase; letter-spacing: 0.02em; font-family: 'JetBrains Mono', monospace; }
.td-stat-v { font-family: 'Inter', sans-serif; font-size: 20px; font-weight: 700; color: var(--ink); margin-top: 4px; letter-spacing: -0.025em; }
.td-stat-v small { font-size: 11px; font-weight: 500; color: var(--ink-4); margin-right: 2px; }

.td-section { margin-bottom: 20px; }
.td-section h4 {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 6px;
}
.td-section h4::before {
  content: '';
  width: 3px; height: 12px;
  background: var(--accent);
  border-radius: 1.5px;
}

.td-quota-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.td-quota-row {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 6px;
  font-size: 12px;
}
.td-quota-row b { font-family: 'Inter', sans-serif; font-size: 14px; color: var(--ink); }
.td-quota-bar {
  height: 6px;
  background: var(--surface-3);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.td-quota-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 3px;
  transition: width 0.3s;
}
.td-quota-fill.over { background: linear-gradient(90deg, var(--red), var(--red-deep)); }
.td-quota-fill.complete { background: linear-gradient(90deg, var(--green), var(--green-deep)); }
.td-quota-fill.close { background: linear-gradient(90deg, var(--amber), var(--amber-deep)); }
.td-quota-meta { font-size: 11px; color: var(--ink-3); }
.td-quota-meta b { color: var(--ink-2); }

.td-prog-list { display: flex; flex-direction: column; gap: 4px; }
.td-prog-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.td-prog-item .bar {
  width: 3px; height: 28px;
  border-radius: 2px;
  flex-shrink: 0;
}
.td-prog-item .bar.remote        { background: var(--t-remote); }
.td-prog-item .bar.presence      { background: var(--t-presence); }
.td-prog-item .bar.strat-remote  { background: var(--t-strat-remote); }
.td-prog-item .bar.strat-presence{ background: var(--t-strat-presence); }
.td-prog-item .bar.workshop      { background: var(--t-workshop); }
.td-prog-item .info { flex: 1; min-width: 0; }
.td-prog-item .pname { font-size: 12px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td-prog-item .pmeta { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--ink-4); margin-top: 2px; }
.td-prog-item .phours {
  font-family: 'Inter', sans-serif;
  font-size: 11px; font-weight: 700;
  color: var(--ink-2);
  background: var(--surface-2);
  padding: 3px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}
.td-empty {
  text-align: center; padding: 20px;
  color: var(--ink-4); font-size: 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

.td-assign-row {
  display: flex; gap: 6px; margin-top: 10px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
}
.td-week-select {
  flex: 1;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: 'IBM Plex Sans Arabic', sans-serif;
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
}
.td-week-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.td-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  display: flex; gap: 8px;
  position: sticky; bottom: 0;
}
.td-foot button { flex: 1; }

/* ========================================================
   Assignment modal v2 — Catalog browser (used on both
   distribution and business-center pages via openAssignmentModal)
   ======================================================== */
.modal.modal-am {
  max-width: 720px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
}
.modal-am .modal-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; padding: 0; }
.am-tabs {
  display: flex; gap: 4px;
  padding: 12px 22px 0;
  border-bottom: 1px solid var(--line);
}
.am-tab {
  padding: 8px 14px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  margin-bottom: -1px;
}
.am-tab:hover { color: var(--ink); background: var(--surface-2); }
.am-tab.on {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--accent-soft);
}
.am-pane { padding: 14px 22px 0; flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.am-pane[hidden] { display: none; }
.am-search {
  width: 100%;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 8px;
}
.am-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.am-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.am-chip {
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: inherit;
  font-size: 11px;
  color: var(--ink-3);
  cursor: pointer;
  font-weight: 500;
}
.am-chip:hover { color: var(--ink); border-color: var(--ink-4); }
.am-chip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); font-weight: 600; }
.am-list {
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  min-height: 200px;
  max-height: 300px;
}
.am-prog {
  padding: 9px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.12s;
}
.am-prog:last-child { border-bottom: 0; }
.am-prog:hover { background: var(--accent-soft); }
.am-prog.on {
  background: linear-gradient(90deg, var(--accent-soft), var(--accent-soft-2));
  box-shadow: inset 4px 0 0 var(--accent), 0 0 0 1px var(--accent-soft-2);
  position: relative;
}
.am-prog.on::after {
  content: '✓';
  position: absolute;
  top: 50%; left: 12px;
  transform: translateY(-50%);
  width: 22px; height: 22px;
  background: var(--accent);
  color: var(--surface);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.3);
}
.am-prog.on .am-prog-name { color: var(--accent); font-weight: 700; }
.am-prog.on .am-prog-row1,
.am-prog.on .am-prog-row2 { padding-left: 30px; }
.am-prog-row1 { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.am-kind {
  font-size: 9.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid;
  flex-shrink: 0;
  line-height: 1.5;
}
.am-kind.kind-diploma  { color: var(--bc-diploma, #9333ea);  background: var(--bc-diploma-bg, #f3e8ff);  border-color: var(--bc-diploma-bg, #f3e8ff); }
.am-kind.kind-directed { color: var(--bc-directed, #db2777); background: var(--bc-directed-bg, #fce7f3); border-color: var(--bc-directed-bg, #fce7f3); }
.am-prog-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 700;
  color: var(--ink-4);
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}
.am-prog.on .am-prog-code { color: var(--accent); background: var(--surface); }
.am-prog-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  /* Mixed Arabic/Latin program names: keep "MS Project" etc. in correct order
     inside RTL context. */
  unicode-bidi: plaintext;
}
.am-prog-row2 { display: flex; justify-content: space-between; align-items: center; font-size: 10.5px; color: var(--ink-4); }
.am-prog-hrs {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  color: var(--ink-3);
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 3px;
}
.am-prog.on .am-prog-hrs { color: var(--accent); background: var(--surface); }
.am-list-empty,
.am-list-more { padding: 18px; text-align: center; color: var(--ink-4); font-size: 12px; }
.am-list-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--ink-4);
  text-align: left;
  margin-top: 6px;
}
.am-selected {
  margin: 12px 22px 0;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--accent-soft), var(--accent-soft-2));
  border: 1px solid var(--accent-soft-2);
  border-radius: var(--radius-sm);
  animation: fade-in 0.15s ease;
}
.am-selected[hidden] { display: none; }
.am-sel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.am-sel-check {
  width: 22px; height: 22px;
  background: var(--accent);
  color: var(--surface);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.3);
}
.am-sel-name { font-size: 14px; font-weight: 700; color: var(--ink); flex: 1; }
.am-sel-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--accent);
  background: var(--surface);
  padding: 2px 7px;
  border-radius: 3px;
}
.am-sel-grid {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
}
.am-sel-grid .field { margin: 0; }
.am-sel-grid .field input { padding: 7px 10px; font-size: 13px; }
.am-sel-grid .type-pick { grid-template-columns: repeat(auto-fit, minmax(95px, 1fr)); gap: 4px; }
.am-sel-grid .type-opt { padding: 6px 4px; font-size: 11px; }
.am-sel-grid .type-opt i { height: 2px; margin-bottom: 4px; }

/* Type picker (used inside am-selected) */
.modal-am .type-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(95px, 1fr)); gap: 6px; }
.modal-am .type-opt {
  padding: 8px 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  font-size: 12px;
  color: var(--ink);
  transition: all 0.15s;
}
.modal-am .type-opt i { display: block; width: 100%; height: 3px; border-radius: 2px; margin-bottom: 6px; }
.modal-am .type-opt[data-t="remote"] i         { background: var(--t-remote); }
.modal-am .type-opt[data-t="presence"] i       { background: var(--t-presence); }
.modal-am .type-opt[data-t="strat-remote"] i   { background: var(--t-strat-remote); }
.modal-am .type-opt[data-t="strat-presence"] i { background: var(--t-strat-presence); }
.modal-am .type-opt[data-t="workshop"] i       { background: var(--t-workshop); }
.modal-am .type-opt[data-t="capacity"] i       { background: var(--bc-capacity, #0891b2); }
.modal-am .type-opt[data-t="diploma"] i        { background: var(--bc-diploma, #9333ea); }
.modal-am .type-opt[data-t="directed"] i       { background: var(--bc-directed, #db2777); }
.modal-am .type-opt:hover { border-color: var(--ink-4); }
.modal-am .type-opt.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* BC time-slot toggle inside am-selected */
.am-slot-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}
.am-slot-opt {
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--ink);
  font-weight: 500;
  transition: all 0.15s;
}
.am-slot-opt:hover { border-color: var(--ink-4); }
.am-slot-opt.on {
  border-color: var(--bc-accent, var(--accent));
  background: var(--bc-accent-soft, var(--accent-soft));
  color: var(--bc-accent, var(--accent));
  font-weight: 700;
}

/* Task pane */
.am-task-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.am-task-opt {
  padding: 11px 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
}
.am-task-opt:hover { border-color: var(--ink-4); }
.am-task-opt.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.am-task-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.am-task-pay[hidden] { display: none; }
.am-task-hint {
  font-size: 11px;
  color: var(--ink-4);
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  line-height: 1.5;
}

.am-foot-left { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.am-income {
  font-family: 'IBM Plex Sans Arabic', sans-serif;
  font-size: 11.5px;
  color: var(--green-deep);
  background: #f0fdf4;
  padding: 4px 9px;
  border-radius: 4px;
  border: 1px solid #d1fae5;
  width: fit-content;
}
.am-income[hidden] { display: none; }
.am-income b { color: var(--green-deep); font-weight: 700; }
.am-income.warn { color: var(--amber-deep); background: var(--amber-soft); border-color: var(--amber-soft); }
.am-income.warn b { color: var(--amber-deep); }

/* ========================================================
   Density toggle (matrix row height: comfy/normal/compact)
   ======================================================== */
.density-seg button {
  font-family: inherit;
  font-size: 14px;
  padding: 4px 9px;
  line-height: 1;
}
body.density-compact { --row-h: 40px; }
body.density-normal  { --row-h: 60px; }
body.density-comfy   { --row-h: 82px; }
/* Fit mode: column width becomes 1fr (auto-distribute), so all weeks fit
   on screen without horizontal scroll regardless of week count (12 / 14 / 17). */
body.density-fit     { --row-h: 50px; --col-week: minmax(0, 1fr); }
/* Do NOT set overflow on #matrix itself — `overflow-x: hidden` implicitly
   forces `overflow-y: auto`, which makes the matrix its own sticky context
   and breaks the sticky week-head row when the user scrolls vertically. */
body.density-fit #matrix { min-width: 0; width: 100%; }
body.density-fit .matrix-scroll { overflow-x: hidden; }
body.density-fit .trainer-cell { padding: 6px 9px; gap: 6px; }
body.density-fit .quota-ring { width: 32px; height: 32px; }
body.density-fit .quota-ring::after { inset: 3px; }
body.density-fit .quota-pct { font-size: 10px; }
body.density-fit .quota-pct small { display: none; }
body.density-fit .t-avatar { width: 22px; height: 22px; font-size: 10px; }
body.density-fit .trainer-name { font-size: 11.5px; }
body.density-fit .trainer-cat,
body.density-fit .trainer-rate { display: none; }
body.density-fit .trainer-quota,
body.density-fit .trainer-total { font-size: 10px; margin-top: 1px; }
body.density-fit .sr-badge { font-size: 8px; padding: 0 3px; }
body.density-fit .cell { min-height: 50px; padding: 2px; }
body.density-fit .prog { padding: 3px 4px; }
body.density-fit .prog-name { font-size: 9.5px; -webkit-line-clamp: 2; line-height: 1.15; }
body.density-fit .prog-foot { font-size: 9px; }
body.density-fit .wh-name { font-size: 11px; }
body.density-fit .wh-date { font-size: 9px; }
body.density-fit .wh-day-matrix .dc { font-size: 7px; }

body.density-compact .trainer-cell { padding: 4px 9px; gap: 6px; }
body.density-compact .quota-ring { width: 28px; height: 28px; }
body.density-compact .quota-ring::after { inset: 3px; }
body.density-compact .quota-pct { font-size: 9px; }
body.density-compact .quota-pct small { display: none; }
body.density-compact .t-avatar { width: 20px; height: 20px; font-size: 10px; }
body.density-compact .trainer-name { font-size: 11.5px; }
body.density-compact .trainer-cat,
body.density-compact .trainer-rate { display: none; }
body.density-compact .trainer-quota,
body.density-compact .trainer-total { font-size: 10px; margin-top: 1px; }
body.density-compact .sr-badge { font-size: 8px; padding: 0 3px; }
body.density-compact .income-meter { width: 8px; }
body.density-compact .cell { min-height: 40px; padding: 2px; }
body.density-compact .prog { padding: 3px 5px 2px 4px; }
body.density-compact .prog-name { font-size: 10px; -webkit-line-clamp: 1; }
body.density-compact .prog-foot { display: none; }
body.density-compact .cell.multi .prog { padding: 2px 4px; }

body.density-normal .trainer-cell { padding: 6px 10px; gap: 7px; }
body.density-normal .quota-ring { width: 36px; height: 36px; }
body.density-normal .quota-pct { font-size: 10px; }
body.density-normal .t-avatar { width: 22px; height: 22px; font-size: 10px; }
body.density-normal .trainer-name { font-size: 12px; }
body.density-normal .trainer-cat { font-size: 8.5px; }
body.density-normal .trainer-quota,
body.density-normal .trainer-total { font-size: 10.5px; margin-top: 2px; }
body.density-normal .cell { min-height: 60px; }
body.density-normal .prog-name { font-size: 10px; }

/* ========================================================
   Program tooltip (hover on .prog)
   ======================================================== */
.prog-tip {
  position: fixed;
  z-index: 1000;
  background: var(--ink);
  color: var(--surface);
  padding: 8px 12px;
  border-radius: 6px;
  font-family: 'IBM Plex Sans Arabic', sans-serif;
  font-size: 11.5px;
  line-height: 1.55;
  box-shadow: 0 8px 20px -4px rgba(0,0,0,0.2);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  white-space: nowrap;
  max-width: 280px;
}
.prog-tip.show { opacity: 1; }
.prog-tip::after {
  content: '';
  position: absolute;
  top: 100%; right: 14px;
  border: 5px solid transparent;
  border-top-color: var(--ink);
}
.prog-tip-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  font-size: 11.5px;
}
.prog-tip-chip i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.prog-tip-chip.remote i        { background: var(--t-remote); }
.prog-tip-chip.presence i      { background: var(--t-presence); }
.prog-tip-chip.strat-remote i  { background: var(--t-strat-remote); }
.prog-tip-chip.strat-presence i{ background: var(--t-strat-presence); }
.prog-tip-chip.workshop i      { background: var(--t-workshop); }
/* BC types */
.prog-tip-chip.capacity i      { background: var(--bc-capacity, #0891b2); }
.prog-tip-chip.diploma i       { background: var(--bc-diploma, #9333ea); }
.prog-tip-chip.directed i      { background: var(--bc-directed, #db2777); }
.prog-tip-name { font-weight: 700; font-size: 12px; margin-bottom: 3px; white-space: normal; }
.prog-tip-meta { font-size: 10.5px; opacity: 0.85; font-family: 'JetBrains Mono', monospace; }

/* ========================================================
   Cell overload warning (>30h or >2 programs/week)
   ======================================================== */
.cell.overload {
  background: #fef2f2;
  box-shadow: inset 0 0 0 2px var(--red);
}
.cell.overload:hover { background: #fee2e2; }
.cell.overload.col-active { background: #fee2e2; }
.cell-overload-badge {
  position: absolute;
  top: 3px; left: 3px;
  z-index: 2;
  font-family: 'Inter', sans-serif;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  background: var(--red);
  color: var(--surface);
  border-radius: 999px;
  line-height: 1.4;
  box-shadow: 0 1px 2px rgba(220, 38, 38, 0.35);
  pointer-events: none;
}
.cell-overload-badge::before { content: '⚠ '; }
