/* ==========================================================================
   SCS Control — design system
   A single light theme. No framework, no jQuery, no icon font: everything
   below is the whole visual layer.
   ========================================================================== */

/* --------------------------------------------------------------- 1. Tokens */

:root {
  /* Brand ramp */
  --brand-50:  #eef4ff;
  --brand-100: #d9e6ff;
  --brand-200: #b8d0ff;
  --brand-300: #8ab0ff;
  --brand-400: #5b88fb;
  --brand-500: #3a63f0;
  --brand-600: #2848d6;
  --brand-700: #2138a8;
  --brand-800: #1e3186;
  --brand-900: #1d2d6b;

  --cyan-400: #22d3ee;
  --cyan-500: #06b6d4;
  --amber-400: #fbbf24;
  --amber-500: #f59e0b;
  --green-400: #34d399;
  --green-500: #10b981;
  --red-400:  #f87171;
  --red-500:  #ef4444;
  --violet-400: #a78bfa;
  --pink-400: #f472b6;

  /* Semantic surfaces */
  --bg:            #f4f6fc;
  --bg-deep:       #eaeefa;
  --surface:       #ffffff;
  --surface-2:     #f7f9fe;
  --surface-3:     #eef2fb;
  --surface-hover: #e8eefb;
  --line:          rgba(16, 24, 45, .09);
  --line-strong:   rgba(16, 24, 45, .16);

  --text:      #131a2e;
  --text-2:    #4a5878;
  --text-3:    #7b88a6;
  --text-on-accent: #ffffff;

  --accent:       var(--brand-600);
  --accent-soft:  rgba(40, 72, 214, .09);
  --accent-line:  rgba(40, 72, 214, .28);

  --ok:          #0f9d69;
  --ok-soft:     rgba(16, 185, 129, .12);
  --warn:        #b47600;
  --warn-soft:   rgba(245, 158, 11, .14);
  --danger:      #d13b3b;
  --danger-soft: rgba(239, 68, 68, .10);
  --info:        #0b93ad;
  --info-soft:   rgba(6, 182, 212, .12);

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(16, 24, 45, .06);
  --shadow:    0 8px 24px -10px rgba(16, 24, 45, .18);
  --shadow-lg: 0 28px 60px -22px rgba(16, 24, 45, .28);
  --glow:      0 0 0 1px var(--accent-line), 0 14px 40px -18px rgba(40, 72, 214, .4);

  /* Shape + rhythm */
  --r-sm: 8px;
  --r:    12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-full: 999px;

  --sidebar-w: 264px;
  --topbar-h: 68px;

  --ease: cubic-bezier(.22, 1, .36, 1);
  --fast: 140ms var(--ease);
  --med:  240ms var(--ease);

  --font: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
          Roboto, "Helvetica Neue", Arial, "Noto Sans Arabic", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ----------------------------------------------------------------- 2. Base */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* Aurora wash behind everything — the single biggest visual lift, and it
   costs one fixed element with no repaint. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(760px 460px at 12% -6%,  rgba(58, 99, 240, .12), transparent 62%),
    radial-gradient(680px 420px at 92% 4%,   rgba(6, 182, 212, .10), transparent 60%),
    radial-gradient(720px 520px at 68% 102%, rgba(167, 139, 250, .10), transparent 62%);
}

h1, h2, h3, h4, h5 { margin: 0; font-weight: 700; letter-spacing: -.018em; line-height: 1.25; }
h1 { font-size: 26px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }
p  { margin: 0 0 10px; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-decoration: none; transition: color var(--fast); }
a:hover { color: var(--text); }

hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

::selection { background: var(--accent-soft); color: var(--text); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.icon { width: 18px; height: 18px; flex: none; display: block; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }

.muted   { color: var(--text-2); }
.dim     { color: var(--text-3); }
.tiny    { font-size: 11.5px; }
.small   { font-size: 12.5px; }
.strong  { font-weight: 650; }
.mono    { font-family: var(--mono); font-size: .92em; }
.nowrap  { white-space: nowrap; }
.center  { text-align: center; }
.right   { text-align: right; }
.grow    { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden  { display: none !important; }

.row { display: flex; align-items: center; gap: 10px; }
.row-tight { display: flex; align-items: center; gap: 6px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: var(--r-full);
  border: 3px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

/* ---------------------------------------------------------------- 3. Shell */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 20px 18px;
  min-height: var(--topbar-h);
}
.brand-mark {
  width: 38px; height: 38px;
  flex: none;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(140deg, var(--brand-400), var(--brand-600) 55%, var(--cyan-500));
  box-shadow: 0 8px 22px -8px rgba(58, 99, 240, .8);
}
.brand-mark .icon { width: 21px; height: 21px; }
.brand-name { font-weight: 800; font-size: 15.5px; letter-spacing: -.02em; }
.brand-sub  { font-size: 11px; color: var(--text-3); letter-spacing: .06em; text-transform: uppercase; font-weight: 600; }

.nav { padding: 6px 12px 12px; overflow-y: auto; flex: 1; }
.nav-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 16px 10px 7px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: var(--r);
  color: var(--text-2);
  font-weight: 550;
  position: relative;
  transition: background var(--fast), color var(--fast), transform var(--fast);
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item:active { transform: scale(.985); }
.nav-item .icon { color: var(--text-3); transition: color var(--fast); }
.nav-item:hover .icon { color: var(--text-2); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 650;
}
.nav-item.active .icon { color: var(--accent); }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.nav-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  color: var(--text-2);
}
.nav-count.hot { background: var(--danger-soft); color: var(--danger); }

.sidebar-foot { padding: 12px; border-top: 1px solid var(--line); }

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.user-card .avatar { flex: none; }

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

.topbar {
  height: var(--topbar-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar-title { min-width: 0; }
.topbar-title h1 { font-size: 18px; }
.topbar-title .crumbs { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.topbar-title .crumbs a { color: var(--text-3); }
.topbar-title .crumbs a:hover { color: var(--accent); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.page { padding: 26px; flex: 1; }
.page-wide { padding: 22px 26px; }
.container { max-width: 1180px; margin: 0 auto; }
.container-wide { max-width: 1680px; margin: 0 auto; }

.menu-toggle { display: none; }

/* ------------------------------------------------------------ 4. Buttons */

.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  --btn-line: var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r);
  border: 1px solid var(--btn-line);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--fast), background var(--fast), border-color var(--fast), box-shadow var(--fast), opacity var(--fast);
  user-select: none;
}
.btn:hover { background: var(--surface-hover); border-color: var(--line-strong); color: var(--text); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn[disabled], .btn.is-busy { opacity: .55; pointer-events: none; }

.btn-primary {
  --btn-bg: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  --btn-fg: #fff;
  --btn-line: transparent;
  box-shadow: 0 8px 20px -10px rgba(58, 99, 240, .9);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--brand-400), var(--brand-500));
  box-shadow: 0 12px 26px -10px rgba(58, 99, 240, 1);
  color: #fff;
}
.btn-danger { --btn-bg: var(--danger-soft); --btn-fg: var(--danger); --btn-line: transparent; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-ghost { --btn-bg: transparent; --btn-line: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-soft { --btn-bg: var(--accent-soft); --btn-fg: var(--accent); --btn-line: transparent; }
.btn-soft:hover { background: var(--accent); color: #fff; }

.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: var(--r-sm); gap: 5px; }
.btn-sm .icon { width: 15px; height: 15px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 14.5px; border-radius: var(--r-md); }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn-block { width: 100%; }

/* Icon-only control that only reveals itself on row hover */
.btn-quiet {
  background: transparent;
  border-color: transparent;
  color: var(--text-3);
  opacity: 0;
}
.row-hover:hover .btn-quiet,
.btn-quiet:focus-visible { opacity: 1; }
.btn-quiet:hover { background: var(--surface-hover); color: var(--text); }
.btn-quiet.danger:hover { background: var(--danger-soft); color: var(--danger); }

/* A disabled quiet button must not be *more* visible than an enabled one:
   the generic .btn[disabled] opacity would otherwise out-specify .btn-quiet. */
.btn-quiet[disabled] { opacity: 0; }
.row-hover:hover .btn-quiet[disabled] { opacity: .35; }

.btn-group { display: inline-flex; gap: 6px; }

/* Segmented control */
.segment {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.segment a, .segment button {
  padding: 5px 13px;
  border: 0;
  background: transparent;
  border-radius: var(--r-sm);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--fast), color var(--fast);
}
.segment a:hover, .segment button:hover { color: var(--text); background: var(--surface-hover); }
.segment .on { background: var(--accent); color: #fff; }
.segment .on:hover { background: var(--accent); color: #fff; }

/* ------------------------------------------------------------- 5. Surfaces */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.card-head h2, .card-head h3 { font-size: 14.5px; }
.card-head .sub { font-size: 12px; color: var(--text-3); }
.card-head .actions { margin-left: auto; display: flex; gap: 7px; align-items: center; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
.card-foot { padding: 13px 18px; border-top: 1px solid var(--line); background: var(--surface-2); }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 14px; }
.stat {
  position: relative;
  padding: 17px 18px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
  transition: transform var(--med), border-color var(--med), box-shadow var(--med);
}
.stat:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow); }
.stat::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 70%);
  opacity: .8;
}
.stat .label {
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat .value {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.1;
  margin-top: 7px;
  font-variant-numeric: tabular-nums;
}
.stat .foot { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.stat.tone-ok::after     { background: linear-gradient(90deg, var(--ok), transparent 70%); }
.stat.tone-warn::after   { background: linear-gradient(90deg, var(--warn), transparent 70%); }
.stat.tone-danger::after { background: linear-gradient(90deg, var(--danger), transparent 70%); }
.stat.tone-info::after   { background: linear-gradient(90deg, var(--info), transparent 70%); }
.stat.tone-ok .label .icon     { color: var(--ok); }
.stat.tone-warn .label .icon   { color: var(--warn); }
.stat.tone-danger .label .icon { color: var(--danger); }
.stat.tone-info .label .icon   { color: var(--info); }
.stat .label .icon { color: var(--accent); }

/* Hero band on the dashboard */
.hero {
  position: relative;
  padding: 26px 28px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(58, 99, 240, .16), transparent 55%),
    linear-gradient(300deg, rgba(6, 182, 212, .13), transparent 55%),
    var(--surface);
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  right: -60px; top: -70px;
  width: 260px; height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(58, 99, 240, .3), transparent 68%);
  filter: blur(14px);
  pointer-events: none;
}
.hero h1 { font-size: 25px; margin-bottom: 5px; }
.hero .lede { color: var(--text-2); font-size: 14px; max-width: 62ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 17px; position: relative; }

/* --------------------------------------------------------------- 6. Pills */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  border-radius: var(--r-full);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: .01em;
  background: var(--surface-3);
  color: var(--text-2);
  white-space: nowrap;
}
.pill .icon { width: 13px; height: 13px; }
.pill-green { background: var(--ok-soft);     color: var(--ok); }
.pill-amber { background: var(--warn-soft);   color: var(--warn); }
.pill-red   { background: var(--danger-soft); color: var(--danger); }
.pill-sky   { background: var(--info-soft);   color: var(--info); }
.pill-brand { background: var(--accent-soft); color: var(--accent); }
.pill-slate { background: var(--surface-3);   color: var(--text-2); }

.pill-live { position: relative; padding-left: 20px; }
.pill-live::before {
  content: "";
  position: absolute;
  left: 8px; top: 50%;
  width: 6px; height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: ping 1.8s var(--ease) infinite;
}
@keyframes ping {
  0%   { box-shadow: 0 0 0 0 currentColor; opacity: 1; }
  70%  { box-shadow: 0 0 0 6px transparent; opacity: .85; }
  100% { box-shadow: 0 0 0 0 transparent; opacity: 1; }
}

.dot-sep { color: var(--text-3); }

/* Avatars */
.avatar {
  width: 34px; height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 750;
  color: #fff;
  letter-spacing: .02em;
  flex: none;
}
.avatar-sm { width: 27px; height: 27px; border-radius: 9px; font-size: 10.5px; }
.avatar-lg { width: 48px; height: 48px; border-radius: 15px; font-size: 16px; }
.av-1 { background: linear-gradient(135deg, #5b88fb, #2848d6); }
.av-2 { background: linear-gradient(135deg, #22d3ee, #0891b2); }
.av-3 { background: linear-gradient(135deg, #a78bfa, #7c3aed); }
.av-4 { background: linear-gradient(135deg, #fbbf24, #d97706); }
.av-5 { background: linear-gradient(135deg, #34d399, #059669); }
.av-6 { background: linear-gradient(135deg, #f472b6, #db2777); }
.av-7 { background: linear-gradient(135deg, #fb923c, #ea580c); }
.av-8 { background: linear-gradient(135deg, #818cf8, #4f46e5); }

/* --------------------------------------------------------------- 7. Forms */

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.field .hint { font-size: 11.5px; color: var(--text-3); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }

.input, .select, .textarea {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--r);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  transition: border-color var(--fast), box-shadow var(--fast), background var(--fast);
  appearance: none;
}
.textarea { height: auto; padding: 10px 12px; min-height: 78px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--surface);
}
.select {
  padding-right: 34px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236f7c9c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 9 7 7 7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  cursor: pointer;
}
.select option { background: var(--surface); color: var(--text); }

.input-icon { position: relative; }
.input-icon .icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}
.input-icon .input { padding-left: 37px; }

/* Checkbox / radio as chips — used for shift days */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 13px;
  border-radius: var(--r-full);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--fast);
  user-select: none;
}
.chip:hover { border-color: var(--text-3); color: var(--text); }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:checked) {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.chip input:focus-visible + span { text-decoration: underline; }

/* Toggle */
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 40px; height: 23px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  position: relative;
  transition: background var(--fast), border-color var(--fast);
  flex: none;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: var(--text-2);
  transition: transform var(--med), background var(--fast);
}
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(17px); background: #fff; }

/* --------------------------------------------------------------- 8. Tables */

.table-wrap { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
table.data thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 11px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.data tbody tr { transition: background var(--fast); }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .num { font-variant-numeric: tabular-nums; text-align: right; }
table.data .actions-cell { text-align: right; white-space: nowrap; width: 1%; }
table.data tr.is-clickable { cursor: pointer; }

/* Empty state */
.empty {
  padding: 46px 26px;
  text-align: center;
  color: var(--text-3);
}
.empty .icon-wrap {
  width: 56px; height: 56px;
  margin: 0 auto 14px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-3);
}
.empty .icon-wrap .icon { width: 25px; height: 25px; }
.empty h3 { color: var(--text-2); margin-bottom: 5px; font-size: 15px; }
.empty p { font-size: 13px; max-width: 44ch; margin: 0 auto 15px; }

/* ------------------------------------------------------ 9. Bus workspace */

.workspace {
  display: grid;
  grid-template-columns: 300px 330px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  height: calc(100vh - var(--topbar-h) - 44px);
}

.pane {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.pane-head {
  padding: 14px 15px;
  border-bottom: 1px solid var(--line);
  flex: none;
  background: var(--surface);
}
.pane-head .eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
}
.pane-head h2 { font-size: 15px; margin-top: 3px; }
.pane-head .sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.pane-body { overflow-y: auto; flex: 1; min-height: 0; padding: 9px; }
.pane-foot { padding: 11px; border-top: 1px solid var(--line); flex: none; background: var(--surface-2); }
.pane-search { padding: 10px 11px 0; flex: none; }

/* Selectable list item shared by the shift and bus panes */
.pick {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 11px;
  border-radius: var(--r);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: background var(--fast), border-color var(--fast), transform var(--fast);
  position: relative;
}
.pick:hover { background: var(--surface-2); }
.pick:active { transform: scale(.99); }
.pick.on {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}
.pick.on::before {
  content: "";
  position: absolute;
  left: 0; top: 12px; bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.pick .title { font-weight: 650; font-size: 13.5px; }
.pick .meta { font-size: 11.5px; color: var(--text-3); display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.pick .lead {
  width: 38px; height: 38px;
  flex: none;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.05;
  text-align: center;
}
.pick.on .lead { background: var(--accent); color: #fff; }
/* Row controls stay out of the layout until the row is hovered or focused, so
   the title gets the full width of a narrow pane instead of truncating early. */
.pick .trail {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  width: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity var(--fast);
}
.pick:hover .trail,
.pick:focus-within .trail { width: auto; overflow: visible; opacity: 1; }

.pane-group {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 12px 11px 5px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.pane-group::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.pane-group.today { color: var(--accent); }

/* Stop cards — the third pane */
.stop {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  margin-bottom: 9px;
  overflow: hidden;
  transition: border-color var(--fast), box-shadow var(--fast), opacity var(--fast);
}
.stop:hover { border-color: var(--line-strong); }
.stop.is-open { border-color: var(--accent-line); box-shadow: var(--shadow-sm); }
.stop.dragging { opacity: .45; }
.stop.drop-target { border-color: var(--accent); border-style: dashed; }

.stop-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  cursor: pointer;
  user-select: none;
}
.stop-order {
  width: 30px; height: 30px;
  flex: none;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--text-2);
  font-weight: 750;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  transition: background var(--fast), color var(--fast);
}
.stop.is-open .stop-order { background: var(--accent); color: #fff; }
.stop-title { font-weight: 600; font-size: 13.5px; }
.stop-meta { font-size: 11.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; margin-top: 1px; }
.stop-grip {
  color: var(--text-3);
  cursor: grab;
  opacity: 0;
  transition: opacity var(--fast), color var(--fast);
  padding: 2px;
  border-radius: 6px;
}
.stop:hover .stop-grip { opacity: 1; }
.stop-grip:hover { color: var(--text); background: var(--surface-3); }
.stop-grip:active { cursor: grabbing; }
.stop-caret { color: var(--text-3); transition: transform var(--med); }
.stop.is-open .stop-caret { transform: rotate(90deg); }

.stop-body { border-top: 1px solid var(--line); padding: 11px 12px; background: var(--surface); }
/* Collapsed by default: only the expanded stop shows its riders. */
.stop:not(.is-open) .stop-body { display: none; }

.rider {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  transition: background var(--fast);
}
.rider:hover { background: var(--surface-2); }
.rider .name { font-size: 13px; font-weight: 550; }
.rider .sub { font-size: 11.5px; color: var(--text-3); }

.riders-empty {
  font-size: 12.5px;
  color: var(--text-3);
  padding: 9px 8px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  text-align: center;
}

/* Drop indicator while reordering */
.drop-line {
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  margin: 3px 0;
  box-shadow: 0 0 8px var(--accent);
}

/* --------------------------------------------------------- 10. Overlays */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  background: rgba(19, 26, 46, .45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--med);
}
.overlay.open { opacity: 1; pointer-events: auto; }

/* Modal */
.modal-wrap { place-items: center; padding: 22px; }
.modal {
  width: min(560px, 100%);
  max-height: min(84vh, 760px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  transform: translateY(14px) scale(.985);
  opacity: 0;
  transition: transform var(--med), opacity var(--med);
}
.overlay.open .modal { transform: none; opacity: 1; }
.modal-head { padding: 19px 21px 15px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; }
.modal-head h2 { font-size: 17px; }
.modal-head .sub { font-size: 12.5px; color: var(--text-3); margin-top: 3px; }
.modal-head .close { margin-left: auto; }
.modal-body { padding: 20px 21px; overflow-y: auto; display: flex; flex-direction: column; gap: 15px; }
.modal-foot {
  padding: 14px 21px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 9px;
  justify-content: flex-end;
  background: var(--surface-2);
}
.modal-icon {
  width: 40px; height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--accent-soft);
  color: var(--accent);
}
.modal-icon.danger { background: var(--danger-soft); color: var(--danger); }
.modal-icon.warn   { background: var(--warn-soft);   color: var(--warn); }

/* Picker list inside a modal */
.picker-list { display: flex; flex-direction: column; gap: 3px; max-height: 340px; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--r);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--text);
  width: 100%;
  transition: background var(--fast), border-color var(--fast);
}
.picker-item:hover, .picker-item.cursor { background: var(--surface-2); border-color: var(--line); }
.picker-item.on { background: var(--accent-soft); border-color: var(--accent-line); }
.picker-item .label { font-weight: 600; font-size: 13.5px; }
.picker-item .meta { font-size: 11.5px; color: var(--text-3); }
.picker-item .tick { margin-left: auto; color: var(--accent); opacity: 0; flex: none; }
.picker-item.on .tick { opacity: 1; }
.picker-count { font-size: 12px; color: var(--text-3); }

/* Command palette */
.palette-wrap { align-items: flex-start; justify-items: center; padding: 12vh 20px 20px; }
.palette {
  width: min(620px, 100%);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: translateY(-12px) scale(.985);
  opacity: 0;
  transition: transform var(--med), opacity var(--med);
}
.overlay.open .palette { transform: none; opacity: 1; }
.palette-input {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.palette-input input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15.5px;
  outline: none;
}
.palette-input input::placeholder { color: var(--text-3); }
.palette-results { max-height: 400px; overflow-y: auto; padding: 7px; }
.palette-group {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 11px 11px 5px;
}
.palette-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: var(--r);
  color: var(--text);
  cursor: pointer;
  transition: background var(--fast);
}
.palette-item:hover, .palette-item.cursor { background: var(--surface-2); color: var(--text); }
.palette-item .icon { color: var(--text-3); }
.palette-item.cursor .icon { color: var(--accent); }
.palette-item .meta { margin-left: auto; font-size: 11.5px; color: var(--text-3); }
.palette-foot {
  padding: 9px 15px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 14px;
  font-size: 11.5px;
  color: var(--text-3);
  background: var(--surface-2);
}

kbd {
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 650;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: var(--surface-3);
  color: var(--text-2);
  line-height: 1.5;
}

/* Drawer */
.drawer-wrap { justify-items: end; }
.drawer {
  width: min(500px, 100%);
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateX(24px);
  opacity: 0;
  transition: transform var(--med), opacity var(--med);
}
.overlay.open .drawer { transform: none; opacity: 1; }
.drawer-head { padding: 20px 22px; border-bottom: 1px solid var(--line); display: flex; gap: 13px; align-items: center; }
.drawer-body { padding: 20px 22px; overflow-y: auto; flex: 1; }

/* Toasts */
.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
  max-width: 380px;
}
.toast {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 13px 15px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in 340ms var(--ease);
  position: relative;
  overflow: hidden;
}
.toast.out { animation: toast-out 220ms var(--ease) forwards; }
@keyframes toast-in  { from { transform: translateX(28px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-out { to { transform: translateX(28px); opacity: 0; } }
.toast::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.toast .t-icon {
  width: 26px; height: 26px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--accent-soft);
  color: var(--accent);
}
.toast .t-title { font-weight: 700; font-size: 13px; }
.toast .t-msg { font-size: 12.5px; color: var(--text-2); }
.toast.success::before { background: var(--ok); }
.toast.success .t-icon { background: var(--ok-soft); color: var(--ok); }
.toast.error::before { background: var(--danger); }
.toast.error .t-icon { background: var(--danger-soft); color: var(--danger); }
.toast.warning::before { background: var(--warn); }
.toast.warning .t-icon { background: var(--warn-soft); color: var(--warn); }
.toast .t-close { margin-left: auto; }

/* --------------------------------------------------------- 11. Data extras */

/* Progress bar */
.progress {
  height: 6px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--cyan-400));
  transition: width 600ms var(--ease);
}
.progress.ok > span { background: linear-gradient(90deg, var(--green-500), var(--green-400)); }

/* Attention list on the dashboard */
.attention { display: flex; flex-direction: column; }
.attention-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  transition: background var(--fast);
}
.attention-item:last-child { border-bottom: 0; }
.attention-item:hover { background: var(--surface-2); }
.attention-item .badge {
  width: 40px; height: 40px;
  flex: none;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.attention-item.amber .badge { background: var(--warn-soft);   color: var(--warn); }
.attention-item.red   .badge { background: var(--danger-soft); color: var(--danger); }
.attention-item.sky   .badge { background: var(--info-soft);   color: var(--info); }
.attention-item.slate .badge { background: var(--surface-3);   color: var(--text-2); }
.attention-item .what { font-weight: 600; font-size: 13.5px; }
.attention-item .why  { font-size: 12px; color: var(--text-3); }
.attention-item .go   { margin-left: auto; flex: none; }

/* All-clear panel */
.allclear { padding: 34px 22px; text-align: center; }
.allclear .ring {
  width: 62px; height: 62px;
  margin: 0 auto 15px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ok-soft);
  color: var(--ok);
}
.allclear .ring .icon { width: 28px; height: 28px; }

/* Timeline for trip detail */
.timeline { position: relative; padding-left: 30px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 11px; top: 8px; bottom: 8px;
  width: 2px;
  background: var(--line);
  border-radius: 2px;
}
.tl-item { position: relative; padding: 0 0 20px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -24px; top: 5px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--line-strong);
}
.tl-item.done::before { background: var(--ok); border-color: var(--ok); }
.tl-item.live::before {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* Sparkline / chart blocks */
.chart { width: 100%; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .area { fill: url(#sparkFill); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.chart .pt { fill: var(--accent); }
.chart .lbl { fill: var(--text-3); font-size: 10px; font-family: var(--font); }

.donut-legend { display: flex; flex-direction: column; gap: 9px; }
.donut-legend .row-tight { justify-content: space-between; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* Map containers */
.map { width: 100%; height: 420px; border-radius: var(--r-md); overflow: hidden; background: var(--surface-3); }
.map-tall { height: calc(100vh - var(--topbar-h) - 190px); min-height: 460px; }
.leaflet-container { background: var(--surface-3) !important; font-family: var(--font) !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg) !important;
}
.leaflet-popup-content-wrapper { border-radius: var(--r) !important; }
.leaflet-popup-content { margin: 11px 13px !important; font-size: 12.5px !important; line-height: 1.5 !important; }
.leaflet-bar a { background: var(--surface) !important; color: var(--text) !important; border-color: var(--line) !important; }
.leaflet-bar a:hover { background: var(--surface-hover) !important; }
.leaflet-control-attribution {
  background: color-mix(in srgb, var(--surface) 82%, transparent) !important;
  color: var(--text-3) !important;
  font-size: 10px !important;
}
.leaflet-control-attribution a { color: var(--text-2) !important; }

.map-pin-label {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 26px; height: 26px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 750;
  border: 2px solid var(--surface);
  box-shadow: var(--shadow);
}
.map-pin-label.bus { background: var(--ok); width: 30px; height: 30px; }
.map-pin-label.school { background: var(--violet-400); }

/* Skeleton loading */
.skeleton {
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
  color: transparent !important;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.sk-line { height: 11px; margin-bottom: 8px; }
.sk-row { height: 46px; margin-bottom: 8px; border-radius: var(--r); }

/* Split layouts */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.split-wide { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; align-items: start; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }

/* Toolbar above tables */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.toolbar .spacer { flex: 1; }
.toolbar .input-icon { min-width: 230px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 16px; background: var(--surface-2); }
.tab {
  padding: 12px 15px;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: color var(--fast), border-color var(--fast);
}
.tab:hover { color: var(--text); }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.tab .count {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  color: var(--text-3);
  font-weight: 700;
}
.tab.on .count { background: var(--accent-soft); color: var(--accent); }

/* ------------------------------------------------------------- 12. Login */

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.login-aside {
  position: relative;
  padding: 44px 46px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  overflow: hidden;
  background:
    radial-gradient(620px 420px at 18% 8%,  rgba(58, 99, 240, .10), transparent 64%),
    radial-gradient(560px 400px at 88% 92%, rgba(6, 182, 212, .10), transparent 62%),
    var(--surface-2);
  border-right: 1px solid var(--line);
}

/* Faint map grid behind the illustration, so the panel reads as a route map. */
.login-aside::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 45%, #000 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 50% 45%, #000 30%, transparent 78%);
  opacity: .8;
}

.login-aside > * { position: relative; }

.login-aside h2 { font-size: 31px; letter-spacing: -.03em; line-height: 1.18; max-width: 16ch; }
.login-aside p { color: var(--text-2); font-size: 14.5px; max-width: 40ch; margin-top: 12px; }

/* The illustration itself */
.login-art { width: 100%; max-width: 470px; margin: 0 auto; display: block; }
.login-art-wrap { flex: 1; display: grid; place-items: center; min-height: 0; }

.login-points { display: flex; flex-direction: column; gap: 13px; }
.login-point { display: flex; gap: 12px; align-items: flex-start; }
.login-point .tick {
  width: 26px; height: 26px;
  flex: none;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}
.login-point strong { font-size: 13.5px; }
.login-point span { font-size: 12.5px; color: var(--text-3); display: block; }

/* Gentle motion on the illustration. The bus itself is driven by
   <animateMotion> in the markup so it can follow the route and pause at
   each stop; these cover the road dashes and the active stop marker. */
@keyframes stop-pulse {
  0%, 100% { r: 7; opacity: 1; }
  50%      { r: 8.4; opacity: .82; }
}
@keyframes dash-flow { to { stroke-dashoffset: -220; } }

.art-route-live {
  stroke-dasharray: 10 12;
  animation: dash-flow 9s linear infinite;
}
.art-stop-live { animation: stop-pulse 2.6s var(--ease) infinite; transform-origin: center; }

/* ---- Admin school picker ---- */

.picker-page { min-height: 100vh; }
.picker-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 26px 60px;
}
.picker-shell h1 { font-size: 28px; }
.picker-shell > .mb-3 p { max-width: 64ch; }

.school-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 16px;
}
.school-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--med), border-color var(--med), box-shadow var(--med);
}
.school-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-line);
  box-shadow: var(--shadow);
}
.school-card h3 { font-size: 16px; }
.school-card .btn { margin-top: auto; }

.school-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
}
.school-stats .v {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.school-stats .k {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* Current-school chip in the sidebar */
.school-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  margin-bottom: 8px;
  border-radius: var(--r);
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast);
}
.school-switch:hover { background: var(--surface-hover); color: var(--text); }
.school-switch .k {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
}
.school-switch .v { font-size: 13px; font-weight: 650; }

.login-main { display: grid; place-items: center; padding: 40px 24px; }
.login-card { width: min(390px, 100%); }
.login-card h1 { font-size: 25px; margin-bottom: 6px; }

.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 13px;
  border-radius: var(--r);
  font-size: 13px;
  border: 1px solid transparent;
}
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: rgba(248, 113, 113, .3); }
.alert-info  { background: var(--info-soft);   color: var(--info);   border-color: rgba(34, 211, 238, .3); }
.alert-warn  { background: var(--warn-soft);   color: var(--warn);   border-color: rgba(251, 191, 36, .3); }

/* ------------------------------------------------------- 13. Motion + a11y */

.fade-in { animation: fade-in 340ms var(--ease) both; }
@keyframes fade-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

.stagger > * { animation: fade-in 400ms var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: 20ms; }
.stagger > *:nth-child(2) { animation-delay: 55ms; }
.stagger > *:nth-child(3) { animation-delay: 90ms; }
.stagger > *:nth-child(4) { animation-delay: 125ms; }
.stagger > *:nth-child(5) { animation-delay: 160ms; }
.stagger > *:nth-child(6) { animation-delay: 195ms; }
.stagger > *:nth-child(7) { animation-delay: 230ms; }
.stagger > *:nth-child(8) { animation-delay: 265ms; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px; top: -60px;
  z-index: 300;
  padding: 9px 15px;
  border-radius: var(--r);
  background: var(--accent);
  color: #fff;
  font-weight: 650;
  transition: top var(--fast);
}
.skip-link:focus { top: 12px; color: #fff; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* -------------------------------------------------------- 14. Responsive */

@media (max-width: 1320px) {
  .workspace { grid-template-columns: 270px 300px minmax(0, 1fr); }
  .split, .split-wide { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: 1fr;
    height: auto;
  }
  .pane { height: auto; max-height: 62vh; }
  .workspace .pane-body { max-height: 46vh; }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 268px; }

  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-102%);
    transition: transform var(--med);
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(19, 26, 46, .40);
    backdrop-filter: blur(3px);
  }

  .menu-toggle { display: inline-flex; }
  .topbar { padding: 0 15px; gap: 10px; }
  .topbar-title h1 { font-size: 16px; }
  .topbar-title .crumbs { display: none; }
  .page, .page-wide { padding: 15px; }

  .login-page { grid-template-columns: 1fr; }
  .login-aside { display: none; }

  .stats { grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 10px; }
  .stat .value { font-size: 25px; }

  .toasts { left: 14px; right: 14px; bottom: 14px; max-width: none; }
  .drawer { width: 100%; }
  .modal-wrap { padding: 12px; align-items: flex-end; }
  .modal { max-height: 88vh; }
  .palette-wrap { padding: 8vh 12px 12px; }

  table.data { font-size: 12.5px; }
  table.data thead th, table.data tbody td { padding: 9px 10px; }
  .hide-sm { display: none !important; }
}

@media (max-width: 560px) {
  .hide-xs { display: none !important; }
  .hero { padding: 20px; }
  .hero h1 { font-size: 21px; }
  .field-row { grid-template-columns: 1fr; }
  .toolbar { padding: 10px 12px; }
  .toolbar .input-icon { min-width: 0; flex: 1; }
}

@media print {
  .sidebar, .topbar-actions, .toolbar, .toasts, .btn, .menu-toggle { display: none !important; }
  body, .card, .pane { background: #fff !important; color: #000 !important; }
  body::before { display: none; }
  .page, .page-wide { padding: 0; }
}
