/* =========================================================
   Task Tracker — "control room" theme
   Graphite dark / warm paper light, violet→cyan accent,
   Geist for text, Geist Mono for numbers and time.
   ========================================================= */

:root {
  color-scheme: light;
  --bg: #f4f2ee;
  --bg-dots: rgb(22 24 29 / 7%);
  --glow-1: rgb(124 108 255 / 12%);
  --glow-2: rgb(34 195 221 / 9%);
  --surface: #ffffff;
  --surface-2: #f6f4f0;
  --surface-3: #ece9e3;
  --sidebar: rgb(255 255 255 / 72%);
  --border: #e6e2da;
  --border-strong: #d6d1c7;
  --text: #15171c;
  --text-2: #4b4f5a;
  --muted: #858a95;
  --accent: #5b4ee8;
  --accent-2: #0ea5c4;
  --accent-hover: #4a3ed6;
  --accent-soft: rgb(91 78 232 / 10%);
  --accent-ring: rgb(91 78 232 / 22%);
  --accent-ink: #ffffff;
  --btn-bg: #5a4436;
  --btn-bg-hover: #6b5344;
  --btn-ink: #fdf8f1;
  --btn-border: #47352a;
  --brand-grad: linear-gradient(135deg, #8a6a52 0%, #5a4436 55%, #3f2f26 100%);
  --brand-glow: rgb(90 68 54 / 45%);
  --hint-link: #7a5a44;
  --nav-accent: #5a4436;
  --nav-soft: rgb(90 68 54 / 9%);
  --nav-bar: linear-gradient(#8a6a52, #47352a);
  --bar: #5b4ee8;
  --good: #0ca30c;
  --warning: #e39b00;
  --serious: #ec835a;
  --critical: #d03b3b;
  --info: #5b4ee8;
  --neutral: #a3a29b;
  --good-soft: rgb(12 163 12 / 10%);
  --warning-soft: rgb(250 178 25 / 16%);
  --serious-soft: rgb(236 131 90 / 14%);
  --critical-soft: rgb(208 59 59 / 10%);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgb(20 18 12 / 5%);
  --shadow: 0 1px 2px rgb(20 18 12 / 4%), 0 10px 30px -18px rgb(20 18 12 / 18%);
  --shadow-lg: 0 2px 6px rgb(20 18 12 / 6%), 0 24px 48px -24px rgb(20 18 12 / 28%);
  --hl: inset 0 1px 0 rgb(255 255 255 / 70%);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --font: "Geist", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --sidebar-w: 248px;
}

/* Dark theme: the theme script in <head> always sets data-theme (saved choice or the system one) */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0b10;
  --bg-dots: rgb(255 255 255 / 4.5%);
  --glow-1: rgb(124 108 255 / 16%);
  --glow-2: rgb(34 195 221 / 9%);
  --surface: #11131a;
  --surface-2: #171a23;
  --surface-3: #1f2330;
  --sidebar: rgb(14 16 22 / 78%);
  --border: #222634;
  --border-strong: #2e3344;
  --text: #eceef4;
  --text-2: #a9afbf;
  --muted: #6f7689;
  --accent: #8b7dff;
  --accent-2: #22c3dd;
  --accent-hover: #a094ff;
  --accent-soft: rgb(139 125 255 / 14%);
  --accent-ring: rgb(139 125 255 / 30%);
  --btn-bg: #3d3770;
  --btn-bg-hover: #48418a;
  --btn-ink: #f0edff;
  --btn-border: #554d94;
  --brand-grad: linear-gradient(135deg, #7c6cff 0%, #5b4ee8 45%, #22c3dd 100%);
  --brand-glow: rgb(124 108 255 / 70%);
  --hint-link: var(--accent);
  --nav-accent: var(--accent);
  --nav-soft: var(--accent-soft);
  --nav-bar: linear-gradient(var(--accent), var(--accent-2));
  --bar: #8b7dff;
  --info: #8b7dff;
  --warning: #fab219;
  --neutral: #6f7480;
  --good-soft: rgb(12 163 12 / 18%);
  --warning-soft: rgb(250 178 25 / 15%);
  --serious-soft: rgb(236 131 90 / 17%);
  --critical-soft: rgb(208 59 59 / 18%);
  --shadow-sm: none;
  --shadow: 0 10px 30px -18px rgb(0 0 0 / 80%);
  --shadow-lg: 0 24px 48px -20px rgb(0 0 0 / 85%);
  --hl: inset 0 1px 0 rgb(255 255 255 / 4%);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  color: var(--text); font: 14px/1.55 var(--font); letter-spacing: -.003em;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 420px at 18% -120px, var(--glow-1), transparent 70%),
    radial-gradient(700px 380px at 95% -80px, var(--glow-2), transparent 70%),
    radial-gradient(var(--bg-dots) 1px, transparent 1.2px) 0 0 / 22px 22px,
    var(--bg);
  background-attachment: fixed;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}
a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-hover); }
h1 { font-size: 26px; margin: 2px 0; font-weight: 650; letter-spacing: -.03em; line-height: 1.2; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; letter-spacing: -.015em; }
h3 { font-size: 11px; margin: 20px 0 8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
code, time, .num, .mono { font-family: var(--mono); }
code { background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 6px; font-size: 12.5px; }
::selection { background: var(--accent-ring); }
.ico { flex: none; }

/* ---------- shell: sidebar + content ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--sidebar-w);
  display: flex; flex-direction: column; gap: 18px; padding: 18px 14px 14px;
  background: var(--sidebar); border-right: 1px solid var(--border);
  backdrop-filter: saturate(160%) blur(18px); -webkit-backdrop-filter: saturate(160%) blur(18px);
  overflow-y: auto;
}
.has-shell .container { margin-left: var(--sidebar-w); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; color: var(--text); letter-spacing: -.02em; font-size: 15.5px; padding: 2px 6px; }
.brand:hover { color: var(--text); }
.brand-mark {
  display: grid; place-items: center; flex: none; border-radius: 9px;
  background: var(--brand-grad);
  box-shadow: 0 6px 18px -6px var(--brand-glow), inset 0 1px 0 rgb(255 255 255 / 30%);
  transition: box-shadow .25s var(--ease);
}
.new-task { justify-content: flex-start; padding: 10px 14px; gap: 8px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px;
  color: var(--text-2); font-weight: 500; transition: background-color .15s, color .15s;
}
.side-nav a:hover { background: var(--surface-2); color: var(--text); }
.side-nav a.active { background: var(--nav-soft); color: var(--text); font-weight: 600; }
.side-nav a:hover .ico, .side-nav a.active .ico { color: var(--nav-accent); }
.side-nav a.active::before {
  content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--nav-bar);
}
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.side-tools { display: flex; gap: 4px; padding: 0 4px; }
.me { display: flex; align-items: center; gap: 6px; padding: 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--hl); }
.me form { margin: 0; }
.me-link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: var(--text); border-radius: 8px; }
.me-link:hover { color: var(--text); }
.me-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.me-name b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-name small { color: var(--muted); font-size: 11.5px; }

.mobilebar { display: none; }
.scrim { display: none; }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-102%); transition: transform .28s var(--ease); box-shadow: var(--shadow-lg); background: var(--surface); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgb(0 0 0 / 35%); animation: fade-in .2s both; }
  .has-shell .container { margin-left: 0; }
  .mobilebar {
    position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 10px;
    height: 58px; padding: 0 12px; background: var(--sidebar); border-bottom: 1px solid var(--border);
    backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px);
  }
}

/* ---------- layout ---------- */
.container { max-width: 1360px; padding: 30px 32px 56px; animation: page-in .35s var(--ease) both; }
@media (min-width: 1700px) { .has-shell .container { margin-left: calc(var(--sidebar-w) + (100vw - var(--sidebar-w) - 1360px) / 2); } }
.container.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; margin: 0 auto; max-width: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-head .actions form { margin: 0; }
.page-head .hint { max-width: 760px; margin-top: 4px; }
.back { font-size: 13px; color: var(--muted); display: inline-flex; gap: 4px; margin-bottom: 4px; }
.back:hover { color: var(--text); }
/* On a physicist's page the back link sits on the same line as the name */
.back + .person { margin-left: 18px; }
@media (max-width: 720px) { .container { padding: 18px 16px 40px; } h1 { font-size: 22px; } }

.card {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow), var(--hl); min-width: 0;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.card-head a { font-size: 13px; font-weight: 500; }
.card-head.pad { padding: 18px 20px 8px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); gap: 18px; margin-bottom: 18px; }
.grid-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; margin-bottom: 18px; }
.grid-main > .card, .grid-detail > .card { margin-bottom: 0; }
@media (max-width: 1100px) { .grid-main, .grid-detail { grid-template-columns: minmax(0, 1fr); } }

/* ---------- stat tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile {
  --tone: var(--accent); --tone-soft: var(--accent-soft);
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 10px;
  padding: 16px 16px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); box-shadow: var(--shadow-sm), var(--hl);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s;
}
.tile::after {
  content: ""; position: absolute; right: -40px; bottom: -60px; width: 150px; height: 150px; border-radius: 50%;
  background: radial-gradient(circle, var(--tone-soft), transparent 70%); pointer-events: none;
}
a.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); color: var(--text); }
.tile-icon { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-size: 15px; background: var(--tone-soft); }
.tile-label { color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.tile-value { font-size: 32px; font-weight: 650; line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.tile.t-new { --tone-soft: var(--accent-soft); }
.tile.t-work, .tile.t-closed { --tone-soft: var(--good-soft); }
.tile.t-pause { --tone-soft: var(--warning-soft); }
.tile.t-resolved { --tone-soft: var(--serious-soft); }
.tile.t-overdue { --tone-soft: var(--critical-soft); }
.tile-alert { border-color: rgb(208 59 59 / 50%); }
.tile-alert .tile-value { color: var(--critical); }
.tile-alert .tile-icon { animation: alarm 1.6s ease-in-out infinite; }
.tiles.plain .tile { gap: 6px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th {
  font-size: 10.5px; font-weight: 600; color: var(--muted); white-space: nowrap; text-transform: uppercase;
  letter-spacing: .08em; background: var(--surface-2);
}
.table tbody tr { transition: background-color .15s; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table td a { font-weight: 500; color: var(--text); }
.table td a:hover { color: var(--accent); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 13px; color: var(--text-2); }
.table .empty { text-align: center; color: var(--muted); padding: 40px; font-family: var(--font); }
.table tr.is-overdue td { background: linear-gradient(90deg, var(--critical-soft), transparent 45%); }
.table tr.is-overdue td:first-child { box-shadow: inset 3px 0 0 var(--critical); }
.table tr.is-muted td { opacity: .5; }
.table tr.total td { font-weight: 600; border-top: 1px solid var(--border-strong); background: var(--surface-2); }
.task-id { font-family: var(--mono); font-size: 12.5px; color: var(--muted) !important; }
.nowrap { white-space: nowrap; }
.clip { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub { color: var(--muted); font-size: 12px; font-weight: 400; }
.muted { color: var(--muted); font-weight: 400; }

/* ---------- avatars ---------- */
.avatar {
  --h: 250; display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 10px;
  font-size: 12.5px; font-weight: 650; letter-spacing: .02em; color: hsl(var(--h) 70% 28%);
  background: linear-gradient(135deg, hsl(var(--h) 85% 88%), hsl(calc(var(--h) + 40) 80% 80%));
}
:root[data-theme="dark"] .avatar { color: hsl(var(--h) 90% 85%); background: linear-gradient(135deg, hsl(var(--h) 45% 28%), hsl(calc(var(--h) + 40) 45% 22%)); }
.avatar.sm { width: 26px; height: 26px; border-radius: 8px; font-size: 10.5px; }
.person { display: inline-flex; align-items: center; gap: 9px; white-space: nowrap; }

/* ---------- status badges: color dot + text label, never color alone ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border);
}
.badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--neutral); flex: none; }
.st-new { background: var(--accent-soft); border-color: transparent; }
.st-new i { background: var(--info); }
.st-accepted { background: var(--good-soft); border-color: transparent; }
.st-accepted i { background: var(--good); }
.st-paused { background: var(--warning-soft); border-color: transparent; }
.st-paused i { background: var(--warning); }
.st-resolved { background: var(--serious-soft); border-color: transparent; }
.st-resolved i { background: var(--serious); }
.st-closed i, .st-cancelled i { background: var(--neutral); }
.st-rejected { background: var(--critical-soft); border-color: transparent; }
.st-rejected i { background: var(--critical); }
.st-overdue { background: var(--critical-soft); border-color: rgb(208 59 59 / 40%); }
.st-new i, .st-accepted i { animation: pulse 2.4s infinite; }

/* ---------- inline bars (stats) ---------- */
.bar-col { min-width: 160px; }
.bar { position: relative; display: flex; align-items: center; gap: 10px; height: 22px; }
.bar span {
  display: block; height: 8px; min-width: 3px; border-radius: 0 4px 4px 0;
  background: var(--bar); transform-origin: left; animation: grow .7s var(--ease) both;
}
.bar em { font-style: normal; font-family: var(--mono); font-size: 12px; color: var(--text-2); white-space: nowrap; }
.matrix td { min-width: 120px; }
.matrix td strong { font-family: var(--mono); }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label, .filters label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.form label.check, label.check { flex-direction: row; align-items: center; gap: 10px; color: var(--text); font-weight: 400; font-size: 14px; cursor: pointer; }
input, select, textarea {
  font: inherit; font-size: 14px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; width: 100%;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); flex: none; padding: 0; }
input[type="file"] { padding: 8px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-ring); }
textarea { resize: vertical; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > label { flex: 1 1 160px; }
.grow { flex: 2 1 220px !important; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0; }
legend { padding: 0 6px; font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px; }
.checks .check { padding: 9px 11px; border-radius: 10px; border: 1px solid transparent; transition: background-color .15s, border-color .15s; }
.checks .check:hover { background: var(--surface-2); }
.checks .check:has(input:checked) { background: var(--accent-soft); border-color: var(--accent-ring); }
.check.disabled { opacity: .5; cursor: not-allowed; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
.form-actions { display: flex; gap: 8px; }
.inline-form { display: flex; gap: 8px; align-items: flex-start; }
.inline { display: inline; margin: 0; }
.copy { display: flex; gap: 8px; margin-bottom: 12px; }
.copy input { font-family: var(--mono); font-size: 12.5px; }

.filters {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 18px;
  padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm), var(--hl);
}
.filters label { flex: 1 1 150px; }
.filter-actions { display: flex; gap: 8px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid var(--btn-border);
  color: var(--btn-ink); background: var(--btn-bg);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgb(255 255 255 / 8%);
  transition: background-color .15s, border-color .15s, transform .15s var(--ease);
}
.btn:hover { color: var(--btn-ink); background: var(--btn-bg-hover); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:focus-visible, .icon-btn:focus-visible, .link:focus-visible, .side-nav a:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--accent-ring); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm), var(--hl); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: transparent; color: var(--critical); border-color: rgb(208 59 59 / 45%); box-shadow: none; }
.btn.danger:hover { background: var(--critical-soft); color: var(--critical); }
.btn.wide { width: 100%; padding: 12px 16px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; font-weight: 500; }
.link:hover { color: var(--accent-hover); }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; cursor: pointer;
  background: transparent; border: 1px solid transparent; color: var(--text-2);
  transition: background-color .15s, color .15s, transform .15s var(--ease), border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.accent { color: var(--accent); }
.lang-toggle { width: auto; padding: 0 10px; font-family: var(--mono); font-size: 11.5px; font-weight: 600; letter-spacing: .06em; }
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
.danger-text { color: var(--critical); }

.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); flex-wrap: wrap; }
.segmented a { padding: 6px 13px; color: var(--text-2); border-radius: 9px; white-space: nowrap; font-weight: 500; font-size: 13px; transition: background-color .15s, color .15s; }
.segmented a:hover { color: var(--text); }
.segmented a.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }

.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 8px; font-family: var(--mono); font-size: 13px; color: var(--text-2); }

/* ---------- flash / toast ---------- */
.flash {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 12px; margin-bottom: 16px;
  border: 1px solid rgb(12 163 12 / 30%); background: var(--good-soft); animation: drop-in .35s var(--ease) both;
}
.flash::before { content: "✓"; font-weight: 700; color: var(--good); }
.flash.error { border-color: rgb(208 59 59 / 35%); background: var(--critical-soft); }
.flash.error::before { content: "!"; color: var(--critical); }
.toast {
  position: fixed; right: 18px; bottom: 18px; max-width: min(420px, calc(100vw - 36px)); z-index: 50;
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--text); color: var(--bg); padding: 13px 16px; border-radius: 14px;
  box-shadow: 0 18px 40px -12px rgb(0 0 0 / 45%); font-size: 13px; animation: toast-in .35s var(--ease) both;
}
.toast[hidden] { display: none; }
.toast::before { content: "🔔"; }
.live-updated { animation: highlight 1.6s var(--ease); }

/* ---------- feed / timeline ---------- */
.feed { list-style: none; margin: 0; padding: 0; max-height: 560px; overflow-y: auto; }
.feed li { display: grid; grid-template-columns: 82px 1fr; gap: 10px; padding: 9px 8px; border-radius: 10px; font-size: 13px; }
.feed li + li { border-top: 1px dashed var(--border); }
.feed li:hover { background: var(--surface-2); }
.feed time, .timeline time { color: var(--muted); font-size: 11.5px; white-space: nowrap; padding-top: 1px; }
.feed a { color: var(--text); font-weight: 400; }
.feed a:hover { color: var(--accent); }
.feed .ev-overdue a, .feed .ev-reject a { color: var(--critical); }
.feed li.empty { display: block; color: var(--muted); text-align: center; padding: 24px; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; display: grid; grid-template-columns: 132px 1fr; gap: 8px; padding: 10px 0 10px 24px; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline li:first-child::before { top: 16px; }
.timeline li:last-child::before { bottom: calc(100% - 16px); }
.timeline li::after {
  content: ""; position: absolute; left: 0; top: 15px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--border-strong);
}
.timeline li.actor-physicist::after { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline li.actor-admin::after { border-color: var(--good); }
.timeline li.ev-overdue::after, .timeline li.ev-reject::after { border-color: var(--critical); background: var(--critical); }
@media (max-width: 520px) { .timeline li { grid-template-columns: 1fr; gap: 0; } }

.meta { display: grid; grid-template-columns: max-content 1fr; gap: 9px 20px; margin: 0; }
.meta dt { color: var(--muted); font-size: 13px; }
.meta dd { margin: 0; }
.pre { white-space: pre-wrap; margin: 4px 0; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.chips li { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 10px; font-size: 12px; }
.chips li.used { background: var(--good-soft); border-color: transparent; }

/* ---------- tasks by physicist ---------- */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.people-grid > .card { margin: 0; }
@media (max-width: 420px) { .people-grid { grid-template-columns: minmax(0, 1fr); } }
.person-card { display: flex; flex-direction: column; gap: 12px; transition: box-shadow .2s var(--ease), border-color .2s; }
.person-card:hover { box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.person-card.is-muted { opacity: .6; }
.person-card.has-overdue { border-color: rgb(208 59 59 / 40%); }
.person-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.person-head .person { color: var(--text); min-width: 0; white-space: normal; }
.person-head .person b { font-weight: 600; font-size: 15px; }
.person-head .person:hover b { color: var(--accent); }
.sub.block { display: block; }
.person-counts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.mini-tasks { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; flex: 1; }
.mini-tasks li { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border-radius: 10px; font-size: 13.5px; }
.mini-tasks li + li { border-top: 1px dashed var(--border); }
.mini-tasks li:hover { background: var(--surface-2); }
.mini-tasks li.is-overdue { box-shadow: inset 3px 0 0 var(--critical); background: linear-gradient(90deg, var(--critical-soft), transparent 60%); }
.mini-tasks a { color: var(--text); font-weight: 500; overflow-wrap: anywhere; }
.mini-tasks a:hover { color: var(--accent); }
.mini-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.mini-meta time { color: var(--muted); font-size: 11.5px; margin-left: auto; white-space: nowrap; }
.mini-tasks li.empty { color: var(--muted); text-align: center; padding: 18px; }
.empty-note { color: var(--muted); text-align: center; margin: 12px 0; }
.page-head h1 .sub.mono { font-size: 14px; margin-left: 4px; }

/* ---------- templates ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.tpl-card { display: flex; flex-direction: column; gap: 12px; margin: 0; overflow: hidden; transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s; }
.tpl-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); opacity: .85;
}
.tpl-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.tpl-card.is-muted { opacity: .55; }
.tpl-card.is-muted::before { background: var(--neutral); }
.tpl-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.tpl-head h2 { margin: 0; font-size: 16px; }
.tpl-head h2 a { color: var(--text); }
.tpl-text { margin: 0; }
.tpl-steps { margin: 0; padding: 0; list-style: none; counter-reset: s; font-size: 13px; color: var(--text-2); display: grid; gap: 5px; }
.tpl-steps li { counter-increment: s; display: flex; gap: 8px; align-items: baseline; }
.tpl-steps li::before { content: counter(s); font-family: var(--mono); font-size: 11px; color: var(--muted); min-width: 14px; text-align: right; }
.tpl-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; flex-wrap: wrap; padding-top: 10px; border-top: 1px dashed var(--border); }
.tpl-langs { display: flex; gap: 4px; }
.lang { font-family: var(--mono); font-size: 10.5px; font-weight: 600; padding: 2px 6px; border-radius: 6px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.lang.on { background: var(--good-soft); color: var(--text); border-color: transparent; }
.tpl-actions { display: flex; gap: 8px; }

.lang-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.lang-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.lang-tag { align-self: flex-start; font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .08em; padding: 3px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
@media (max-width: 900px) { .lang-grid { grid-template-columns: minmax(0, 1fr); } }

.steps { display: flex; flex-direction: column; gap: 12px; }
.step-row { border: 1px solid var(--border); border-radius: 14px; padding: 16px; background: var(--surface-2); display: flex; flex-direction: column; gap: 12px; animation: drop-in .25s var(--ease) both; }
.step-row input, .step-row textarea, .step-row select { background: var(--surface); }
.step-head { display: flex; justify-content: space-between; align-items: center; }
.step-num { font-weight: 650; font-family: var(--mono); font-size: 13px; color: var(--accent); }
.step-tools { display: flex; gap: 2px; }
.step-image { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.step-image img { max-height: 120px; max-width: 220px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); }
.step-image label { flex: 1 1 220px; }
.sticky-actions { position: sticky; bottom: 0; padding: 14px 0; background: linear-gradient(transparent, var(--bg) 45%); z-index: 5; }
.danger-zone { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; border-color: rgb(208 59 59 / 30%); margin-top: 24px; }
.danger-zone h2 { margin-bottom: 4px; }

/* ---------- task page ---------- */
.task-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.task-steps li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.task-steps li.done { background: var(--good-soft); }
.task-steps .mark { flex: none; }
.task-steps details { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.task-steps summary { cursor: pointer; color: var(--hint-link); }
.task-steps details img { display: block; max-width: 100%; max-height: 260px; margin-top: 8px; border-radius: 10px; border: 1px solid var(--border); }
.attachment { display: block; margin-top: 8px; }
.attachment img { max-width: 100%; max-height: 300px; border-radius: 12px; border: 1px solid var(--border); cursor: zoom-in; transition: transform .2s var(--ease), box-shadow .2s; }
.attachment img:hover { transform: scale(1.01); box-shadow: var(--shadow-lg); }

/* ---------- auth ---------- */
.auth-card { width: min(410px, 100%); padding: 34px; box-shadow: var(--shadow-lg), var(--hl); animation: rise .5s var(--ease) both; overflow: hidden; }
.auth-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.auth-card .brand { justify-content: center; font-size: 20px; margin-bottom: 24px; }
.auth-theme { position: fixed; top: 14px; right: 14px; display: flex; gap: 4px; z-index: 10; }
.center { text-align: center; font-size: 13px; }

/* ---------- motion ---------- */
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes drop-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes highlight { 0% { background-color: var(--accent-soft); } 100% { background-color: transparent; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 transparent; } 50% { box-shadow: 0 0 0 3px var(--accent-soft); } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes alarm { 0%, 100% { transform: none; } 50% { transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* header cells of numeric columns keep the header style, only the values are monospaced */
.table th.num { font-family: var(--font); font-size: 10.5px; color: var(--muted); }
