/* VTOS — palette from the ViPrs logo: slate #39474F, steel #AAB2B8, crimson #D7143C. */

:root {
  --slate-900: #1f272c;
  --slate-800: #2b363c;
  --slate-700: #39474f;
  --slate-600: #4d5d66;
  --slate-500: #66767f;
  --steel-400: #8e979d;
  --steel-300: #aab2b8;
  --steel-200: #cfd5d9;
  --steel-100: #e7ebed;
  --steel-50: #f4f6f7;
  --crimson-700: #a80f2f;
  --crimson-600: #c01236;
  --crimson-500: #d7143c;
  --crimson-100: #fbe3e8;

  --bg: var(--steel-50);
  --surface: #ffffff;
  --surface-2: var(--steel-100);
  --border: var(--steel-200);
  --text: var(--slate-900);
  --text-2: var(--slate-600);
  --text-3: var(--slate-500);
  --accent: var(--crimson-500);
  --accent-strong: var(--crimson-600);
  --accent-soft: var(--crimson-100);
  --accent-text: var(--crimson-700);
  --nav-bg: var(--slate-700);
  --nav-text: #ffffff;
  --nav-muted: var(--steel-300);
  --good: #1f7a4d;
  --good-soft: #dff3e8;
  --warn: #8a5a00;
  --warn-soft: #fbefd5;
  --bad: var(--crimson-700);
  --bad-soft: var(--crimson-100);
  --focus: #2f6fdb;
  --shadow: 0 1px 2px rgb(31 39 44 / 0.06), 0 1px 3px rgb(31 39 44 / 0.08);
  --radius: 10px;
  --radius-sm: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

/* Dark: follows the device unless the user picked a theme in Settings (html[data-theme]). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161c20;
    --surface: #1f272c;
    --surface-2: #2b363c;
    --border: #39474f;
    --text: #eef1f3;
    --text-2: #b9c1c6;
    --text-3: #8e979d;
    --accent: #ef3d62;
    --accent-strong: #f25a7a;
    --accent-soft: #3d1a22;
    --accent-text: #ff8fa6;
    --nav-bg: #11171a;
    --good: #6fd3a0;
    --good-soft: #17352a;
    --warn: #f0c065;
    --warn-soft: #3a2f16;
    --bad: #ff8fa6;
    --bad-soft: #3d1a22;
    --focus: #7aa7ff;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161c20;
  --surface: #1f272c;
  --surface-2: #2b363c;
  --border: #39474f;
  --text: #eef1f3;
  --text-2: #b9c1c6;
  --text-3: #8e979d;
  --accent: #ef3d62;
  --accent-strong: #f25a7a;
  --accent-soft: #3d1a22;
  --accent-text: #ff8fa6;
  --nav-bg: #11171a;
  --good: #6fd3a0;
  --good-soft: #17352a;
  --warn: #f0c065;
  --warn-soft: #3a2f16;
  --bad: #ff8fa6;
  --bad-soft: #3d1a22;
  --focus: #7aa7ff;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  min-height: 100vh;
}
a { color: var(--accent-text); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.2; margin: 0; color: var(--text); }
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; font-weight: 650; }
h3 { font-size: 0.95rem; font-weight: 650; }
p { margin: 0; }
small, .muted { color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- Top bar & navigation ----------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--nav-bg); color: var(--nav-text);
  border-bottom: 3px solid var(--crimson-500);
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; gap: 20px; height: 56px;
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 700; }
.brand:hover { color: inherit; }
.brand-mark { width: 38px; height: 38px; border-radius: 50%; background: #fff; display: grid; place-items: center; }
.brand-mark img { width: 32px; height: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text span { white-space: nowrap; font-size: 0.7rem; font-weight: 500; color: var(--nav-muted); letter-spacing: 0.04em; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  color: var(--nav-muted); text-decoration: none; padding: 8px 12px; border-radius: var(--radius-sm);
  font-weight: 550; font-size: 0.95rem; display: flex; align-items: center; gap: 6px; white-space: nowrap;
}
.nav a:hover { color: #fff; background: rgb(255 255 255 / 0.08); }
.nav a[aria-current="page"] { color: #fff; background: rgb(255 255 255 / 0.12); }
.nav svg { width: 18px; height: 18px; }
.user-menu { display: flex; align-items: center; gap: 12px; font-size: 0.9rem; color: var(--nav-muted); white-space: nowrap; }
.user-menu a, .user-menu button {
  color: var(--nav-muted); background: none; border: 0; font: inherit; cursor: pointer; padding: 6px 4px; text-decoration: none;
}
.user-menu a:hover, .user-menu button:hover { color: #fff; }
.user-menu form { margin: 0; }

@media (max-width: 1360px) { .user-menu .user-name { display: none; } }
/* Full menus (8+ sections, e.g. the moderator's) get a wider bar, and drop
   the icons until there's room for them. */
.topbar-inner:has(.nav > a:nth-child(8)) { max-width: 1440px; }
@media (max-width: 1500px) and (min-width: 761px) {
  .nav:has(> a:nth-child(8)) svg { display: none; }
  .nav:has(> a:nth-child(8)) a { padding: 8px 9px; }
}
@media (max-width: 1240px) {
  .topbar-inner { gap: 12px; }
  .nav a { padding: 8px 9px; }
}
@media (max-width: 1000px) and (min-width: 761px) {
  .brand-text { display: none; }
  .nav { gap: 0; }
  .nav a { font-size: 0.88rem; padding: 8px 7px; }
  .nav svg { display: none; }
}
@media (max-width: 760px) {
  .topbar-inner { height: 52px; }
  .nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: var(--nav-bg); border-top: 1px solid rgb(255 255 255 / 0.1);
    justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .nav { overflow-x: auto; scrollbar-width: none; }
  /* Labels stay readable; a long menu scrolls sideways instead of overlapping. */
  .nav a { flex-direction: column; gap: 2px; font-size: 0.68rem; padding: 6px 2px; flex: 1 0 auto; min-width: 58px; justify-content: center; }
  .nav svg { width: 22px; height: 22px; }
  .user-menu .user-name { display: none; }
  body { padding-bottom: 72px; }
}

/* --- Layout --------------------------------------------------------------- */

main { max-width: 1200px; margin: 0 auto; padding: 24px 16px 48px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-head .sub { color: var(--text-2); margin-top: 4px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.stack > * + * { margin-top: 16px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card-head a { font-size: 0.85rem; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 14px 18px 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: block;
}
a.stat:hover { border-color: var(--steel-300); color: inherit; }
.stat .label { font-size: 0.8rem; color: var(--text-3); font-weight: 550; text-transform: uppercase; letter-spacing: 0.04em; }
.stat .value { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 2px; }
.stat .hint { font-size: 0.85rem; color: var(--text-2); }
.stat.alert .value { color: var(--bad); }
.stat.ok .value { color: var(--good); }

/* --- Lists ----------------------------------------------------------------- */

.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-top: 1px solid var(--border); }
.list > li:first-child { border-top: 0; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 10px 0; color: inherit; text-decoration: none;
}
.card.flush .row { padding: 10px 18px; }
a.row:hover { background: var(--surface-2); color: inherit; }
.row .main { flex: 1; min-width: 0; }
.row .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.row .main > .title, .row .main > .meta { display: block; }
.row .meta { font-size: 0.87rem; color: var(--text-2); }
.row .aside { text-align: right; font-size: 0.87rem; color: var(--text-2); white-space: nowrap; }
.time-col { width: 76px; flex: none; font-variant-numeric: tabular-nums; font-size: 0.9rem; color: var(--text-2); }
.day-head {
  position: sticky; top: 59px; z-index: 5; background: var(--bg);
  font-size: 0.8rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3);
  padding: 16px 0 6px;
}
.cancelled .title { text-decoration: line-through; color: var(--text-3); }
.empty { color: var(--text-3); padding: 12px 0; }

/* --- Badges & buttons ------------------------------------------------------ */

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; background: var(--surface-2); color: var(--text-2); white-space: nowrap;
  vertical-align: 1px;
}
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: 0.9rem;
  text-decoration: none; cursor: pointer; min-height: 38px;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.small { padding: 4px 10px; min-height: 30px; font-size: 0.82rem; }
.btn.block { width: 100%; }

/* --- Filters & forms -------------------------------------------------------- */

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.filters input[type=search], .filters select, input[type=time], input[type=text], input[type=search] {
  font: inherit; font-size: 0.95rem; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); min-height: 38px;
}
.filters input[type=search] { min-width: min(100%, 240px); flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font: inherit; font-size: 0.85rem; font-weight: 550; cursor: pointer; text-decoration: none;
}
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"], .chip.on { background: var(--slate-700); border-color: var(--slate-700); color: #fff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .chip[aria-pressed="true"], :root:not([data-theme="light"]) .chip.on { background: var(--steel-200); border-color: var(--steel-200); color: var(--slate-900); }
}
:root[data-theme="dark"] .chip[aria-pressed="true"], :root[data-theme="dark"] .chip.on { background: var(--steel-200); border-color: var(--steel-200); color: var(--slate-900); }

/* --- Tables ------------------------------------------------------------------ */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
table.data th {
  text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3);
  font-weight: 650; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.num, table.data th.num { text-align: right; }
table.data a { color: var(--text); font-weight: 600; text-decoration: none; }
table.data a:hover { color: var(--accent-text); text-decoration: underline; }

@media (max-width: 760px) {
  table.data.stack-mobile thead { display: none; }
  table.data.stack-mobile tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
  table.data.stack-mobile td { padding: 0; border: 0; }
  table.data.stack-mobile td[data-label]:not(.primary)::before { content: attr(data-label) ": "; color: var(--text-3); font-size: 0.8rem; }
  table.data.stack-mobile td.primary { grid-column: 1 / -1; font-size: 1rem; }
  table.data.stack-mobile td.hide-mobile { display: none; }
}

/* --- Progress --------------------------------------------------------------- */

.meter { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--slate-600); border-radius: 999px; }
.meter.bad > span { background: var(--accent); }
.meter.good > span { background: var(--good); }
.meter.warn > span { background: var(--warn); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .meter > span { background: var(--steel-300); } }
:root[data-theme="dark"] .meter > span { background: var(--steel-300); }
/* Keep status colours on meters in dark mode (the rules above would win on specificity). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .meter.bad > span { background: var(--accent); }
  :root:not([data-theme="light"]) .meter.good > span { background: var(--good); }
  :root:not([data-theme="light"]) .meter.warn > span { background: var(--warn); }
}
:root[data-theme="dark"] .meter.bad > span { background: var(--accent); }
:root[data-theme="dark"] .meter.good > span { background: var(--good); }
:root[data-theme="dark"] .meter.warn > span { background: var(--warn); }

/* --- Check-in ---------------------------------------------------------------- */

.checkin-head {
  position: sticky; top: 59px; z-index: 10; background: var(--bg); padding: 8px 0 12px;
  border-bottom: 1px solid var(--border); margin-bottom: 8px;
}
.checkin-count { font-size: 1.05rem; font-weight: 650; }
.checkin-count .num { font-size: 1.4rem; }
.checkin-list { list-style: none; margin: 0; padding: 0; }
.checkin-item { border-bottom: 1px solid var(--border); }
.checkin-item[hidden] { display: none; }
.checkin-toggle {
  width: 100%; display: flex; align-items: center; gap: 14px; padding: 12px 4px; min-height: 60px;
  background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.checkin-toggle:active { background: var(--surface-2); }
.check {
  width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--steel-300); flex: none;
  display: grid; place-items: center; color: transparent; transition: all 0.12s;
}
.present .check { background: var(--good); border-color: var(--good); color: #fff; }
.checkin-toggle .name { font-weight: 600; font-size: 1.02rem; }
.checkin-toggle .info { font-size: 0.85rem; color: var(--text-2); }
.checkin-toggle .times { margin-left: auto; font-size: 0.85rem; color: var(--good); font-variant-numeric: tabular-nums; white-space: nowrap; }
.checkin-edit { padding: 0 4px 12px 50px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 0.9rem; }
.checkin-edit label { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.checkin-edit .error { color: var(--bad); font-weight: 600; width: 100%; }
.htmx-request .checkin-toggle { opacity: 0.6; }

/* --- Misc ------------------------------------------------------------------ */

.notice { padding: 12px 16px; border-radius: var(--radius); background: var(--warn-soft); color: var(--warn); margin-bottom: 16px; font-weight: 550; }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.issues { list-style: none; padding: 0; margin: 0; }
.issues li { padding: 8px 0 8px 22px; border-top: 1px solid var(--border); position: relative; font-size: 0.93rem; }
.issues li:first-child { border-top: 0; }
.issues li::before { content: ""; position: absolute; left: 4px; top: 16px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 0.93rem; }
dl.facts dt { color: var(--text-3); }
dl.facts dd { margin: 0; }
.admin-link { font-size: 0.85rem; }

/* --- Login ------------------------------------------------------------------- */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--nav-bg); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 14px; padding: 32px 28px; text-align: center; box-shadow: 0 10px 30px rgb(0 0 0 / 0.25); border-top: 4px solid var(--crimson-500); }
.login-card img { width: 180px; height: auto; margin-bottom: 8px; }
.login-card h1 { font-size: 1.3rem; margin-bottom: 4px; }
.login-card p { color: var(--text-2); margin-bottom: 22px; font-size: 0.93rem; }
.login-card .alt { margin-top: 18px; font-size: 0.82rem; }
.login-card .alt a { color: var(--text-3); }
.email-login { margin-top: 18px; text-align: left; font-size: 0.9rem; }
.email-login summary { cursor: pointer; color: var(--text-2); text-align: center; }
.email-login form { display: grid; gap: 6px; margin: 12px 0 8px; }
.email-login label { font-weight: 600; font-size: 0.85rem; }
.email-login input {
  width: 100%; font: inherit; font-size: 0.95rem; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text); min-height: 40px;
}
.email-login button { margin-top: 8px; }
.email-login small { color: var(--text-3); }
.ms-logo { width: 18px; height: 18px; }

/* --- Messages ----------------------------------------------------------------- */

.messages { list-style: none; margin: 0 0 16px; padding: 0; }
.messages li { padding: 10px 14px; border-radius: var(--radius); background: var(--good-soft); color: var(--good); font-weight: 550; margin-bottom: 6px; }
.messages li.error { background: var(--bad-soft); color: var(--bad); }
.messages li.warning { background: var(--warn-soft); color: var(--warn); }

/* --- Forms --------------------------------------------------------------------- */

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 14px 18px; }
.form-grid.one-col { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field[hidden] { display: none; }
.field > label, .field legend { font-size: 0.85rem; font-weight: 600; color: var(--text-2); }
.field .req { color: var(--accent); }
.field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea {
  font: inherit; font-size: 0.95rem; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); width: 100%; min-height: 40px;
}
.field textarea { resize: vertical; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--bad); }
.field .help { color: var(--text-3); font-size: 0.8rem; }
.field .error { color: var(--bad); font-weight: 600; font-size: 0.82rem; }
.field-check > label { display: flex; align-items: center; gap: 8px; font-weight: 550; color: var(--text); font-size: 0.95rem; }
.field input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--slate-700); }
.field fieldset { border: 0; padding: 0; margin: 0; }
.field legend { margin-bottom: 6px; padding: 0; }
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 2px 12px; }
.check-list.people { max-height: 240px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; }
.check-list label { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 0.93rem; cursor: pointer; }
.check-list label[hidden] { display: none; }
.picker-search { margin-bottom: 6px; }
.form-actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.danger-zone { margin-top: 24px; }
.btn.danger { color: var(--bad); border-color: var(--bad-soft); }
.btn.danger:hover { background: var(--bad-soft); color: var(--bad); }

/* --- Projects & tasks ------------------------------------------------------------ */

.project-card { text-decoration: none; color: inherit; display: block; }
.project-card:hover { border-color: var(--steel-300); color: inherit; }
.project-card .meta { font-size: 0.87rem; color: var(--text-2); }
.overdue { color: var(--bad); font-weight: 600; }
.quick-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px; margin-bottom: 16px; }
.quick-add input[type=text] { flex: 1; min-width: 200px; }
.quick-add input { font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); min-height: 40px; }
.board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
@media (max-width: 760px) { .board { grid-template-columns: repeat(4, 82%); scroll-snap-type: x mandatory; } .board-col { scroll-snap-align: start; } }
.board-col { background: var(--surface-2); border-radius: var(--radius); padding: 10px; min-height: 120px; }
.board-col h2 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-2); margin: 2px 4px 10px; }
.board-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.task-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; box-shadow: var(--shadow); }
.task-card.is-overdue { border-left: 3px solid var(--accent); }
.task-title { font-weight: 600; color: var(--text); text-decoration: none; display: block; }
.task-title:hover { color: var(--accent-text); text-decoration: underline; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-2); margin-top: 6px; }
.task-move { margin-top: 8px; }
.board.board-5 { grid-template-columns: repeat(5, minmax(220px, 1fr)); }
.task-meta .badge { white-space: normal; max-width: 100%; }
@media (max-width: 760px) { .board.board-5 { grid-template-columns: repeat(5, 82%); } }
.error-text { color: var(--bad); font-weight: 600; font-size: 0.82rem; margin: 6px 0 0; }
.task-move select { font: inherit; font-size: 0.8rem; padding: 3px 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-2); }
.avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--slate-600); color: #fff; font-size: 0.68rem; font-weight: 700; display: inline-grid; place-items: center; }
.link-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.link-picker select, .link-picker input { font: inherit; font-size: 0.9rem; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); min-height: 38px; }
.link-picker input { flex: 1; min-width: 160px; }
.link-results { width: 100%; }

/* --- Inventory ----------------------------------------------------------------- */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--text-2); text-decoration: none; font-weight: 600; font-size: 0.93rem;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.tabs .count { background: var(--surface-2); border-radius: 999px; padding: 0 7px; font-size: 0.78rem; margin-left: 4px; }
.request-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.request-actions form, .badges form { margin: 0; }
.card.flush .request-row { padding: 10px 18px; }
@media (max-width: 760px) { .request-row { flex-wrap: wrap; } .request-row .aside { width: 100%; justify-content: flex-start; } }
.inline-select { font: inherit; font-size: 0.9rem; padding: 7px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text); min-height: 38px; }

/* --- Calendar ------------------------------------------------------------------ */

.cal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.cal-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-row + .cal-row { border-top: 1px solid var(--border); }
.cal-weekdays div { padding: 8px; font-size: 0.75rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); }
.cal-day { min-height: 112px; padding: 6px; border-left: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day:first-child { border-left: 0; }
.cal-day.outside { background: var(--surface-2); }
.cal-day.outside .cal-date { color: var(--text-3); }
.cal-date { font-size: 0.82rem; font-weight: 650; color: var(--text-2); padding: 0 2px 2px; font-variant-numeric: tabular-nums; }
.cal-wd { display: none; }
.cal-day.is-today .cal-date { color: var(--accent-text); }
.cal-day.is-today { box-shadow: inset 0 3px 0 var(--accent); }
.cal-entry {
  --stripe: var(--slate-600);
  display: block; font-size: 0.78rem; line-height: 1.3; padding: 2px 6px; border-radius: 4px; text-decoration: none;
  color: var(--text); background: var(--surface-2); border-left: 3px solid var(--stripe);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-entry:hover { color: var(--text); filter: brightness(0.96); }
.cal-entry .title { font-weight: 600; }
.cal-entry .cal-time { color: var(--text-2); font-variant-numeric: tabular-nums; }
.cal-entry .cal-note { display: block; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }
.cal-entry.cancelled .title { text-decoration: line-through; color: var(--text-3); }
.cal-entry.is-overdue { background: var(--bad-soft); }
.cal-competition { --stripe: var(--accent); background: var(--accent-soft); }
.cal-sessions { --stripe: var(--steel-300); background: transparent; }
.cal-sessions .cal-note { display: none; }
.cal-projects { --stripe: var(--good); }
.cal-tasks { --stripe: var(--warn); }
.cal-shopping { --stripe: var(--focus); }
.cal-tools { --stripe: var(--text-3); }
.cal-chip.on { border-left: 4px solid var(--stripe, transparent); }
.cal-chip.cal-events { --stripe: var(--slate-600); }
.cal-chip.cal-sessions { --stripe: var(--steel-300); }
.cal-empty { margin-top: 12px; }

@media (max-width: 760px) {
  .cal { background: none; border: 0; box-shadow: none; overflow: visible; }
  .cal-row { display: block; }
  .cal-row.cal-weekdays { display: none; }
  .cal-row + .cal-row { border-top: 0; }
  .cal-day { min-height: 0; border-left: 0; padding: 0; margin-bottom: 12px; gap: 6px; }
  .cal-day.empty, .cal-day.outside { display: none; }
  .cal-wd { display: inline; }
  .cal-day.is-today { box-shadow: none; }
  .cal-date { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); padding: 4px 0; }
  .cal-entry { font-size: 0.93rem; padding: 8px 12px; white-space: normal; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--stripe); }
  .cal-competition { background: var(--accent-soft); }
}

/* --- Divisions ------------------------------------------------------------------ */

.mini-head { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); margin: 12px 0 2px; }
.card-head + .mini-head { margin-top: 0; }
.dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.dot { width: 10px; height: 10px; border-radius: 2px; background: var(--surface-2); border: 1px solid var(--border); }
.dot.on { background: var(--good); border-color: var(--good); }

/* --- Training passport ------------------------------------------------------ */

.training-matrix th.cert { font-size: 0.75rem; white-space: nowrap; text-align: center; }
.training-matrix td.cell { text-align: center; padding: 8px 4px; }
.training-matrix td:first-child, .training-matrix th:first-child { position: sticky; left: 0; background: var(--surface); white-space: nowrap; }

/* --- Check-in station ------------------------------------------------------- */

.station-body { background: var(--nav-bg); min-height: 100vh; }
.station { max-width: 720px; margin: 0 auto; padding: 32px 16px; color: #fff; text-align: center; }
.station header { display: flex; align-items: center; gap: 16px; justify-content: center; margin-bottom: 28px; text-align: left; }
.station header img { width: 64px; height: 64px; }
.station header h1 { font-size: 1.6rem; margin: 0; color: #fff; }
.station header p { margin: 0; color: var(--nav-muted); }
.station label { display: block; font-size: 1.3rem; font-weight: 700; margin-bottom: 10px; }
.station input { width: 100%; font-size: 1.4rem; padding: 14px; border-radius: var(--radius); border: 2px solid var(--steel-300);
  text-align: center; background: #fff; color: #111; letter-spacing: 0.1em; }
.station #hint { color: var(--nav-muted); margin-top: 8px; }
.station-result { margin-top: 28px; min-height: 180px; }
.station-message { border-radius: 14px; padding: 24px 16px; background: var(--surface); color: var(--text); }
.station-message.good { border-top: 6px solid var(--good); }
.station-message.bad { border-top: 6px solid var(--crimson-500); }
.station-message .big { font-size: 2rem; font-weight: 800; margin: 0 0 6px; }
.station-message p { margin: 0; font-size: 1.1rem; }
.station .present { color: var(--nav-muted); margin-top: 16px; font-size: 1.05rem; }
.station .present .num { color: #fff; font-weight: 700; }
.station-camera { margin-top: 20px; }
.station-camera video { width: 100%; max-width: 420px; border-radius: var(--radius); margin-top: 12px; }
.station-exit { margin-top: 40px; font-size: 0.85rem; }
.station-exit a { color: var(--nav-muted); }

/* --- Badges ------------------------------------------------------------------ */

.badge-row { flex-wrap: wrap; }
.badge-scan { display: flex; gap: 6px; align-items: center; }
.badge-scan input { font: inherit; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); width: 200px; }
.qr-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.qr-card { display: flex; align-items: center; gap: 12px; border: 1px dashed var(--border); border-radius: var(--radius-sm);
  padding: 12px; background: #fff; color: #111; break-inside: avoid; }
.qr-card svg { flex: none; }
.qr-card div { display: grid; gap: 2px; }
.qr-card span, .qr-card small { color: #444; font-size: 0.85rem; }
@media print {
  .topbar, .no-print, .messages { display: none !important; }
  body, main { background: #fff !important; padding: 0 !important; }
  .qr-cards { grid-template-columns: repeat(2, 1fr); }
}

/* --- Org chart ----------------------------------------------------------------- */

.org-top { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.org-box { min-width: 220px; }
.org-box h2 { font-size: 1rem; margin-bottom: 6px; }
.org-box ul { margin: 0; padding-left: 18px; }
.org-arrow { font-size: 1.6rem; color: var(--text-3); }
.org-sides { display: grid; grid-template-columns: 4fr 6fr; gap: 20px; }
.org-side { display: grid; gap: 12px; align-content: start; }
.org-captain { border-top: 4px solid var(--steel-300); text-align: center; }
.org-captain h2 { font-size: 1.15rem; margin: 0; }
.org-kicker { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); margin: 0; }
.org-extra { font-size: 0.9rem; margin: 4px 0 0; }
.org-divisions { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.org-division { padding: 12px 14px; }
.org-division h3 { font-size: 1rem; margin: 0; }
.org-division h3 a { color: var(--text); text-decoration: none; }
.org-division h3 a:hover { color: var(--accent-text); text-decoration: underline; }
.org-lead { font-weight: 600; font-size: 0.9rem; margin: 2px 0 8px; color: var(--text-2); }
.org-roles { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 0.85rem; }
.org-roles li { display: flex; flex-wrap: wrap; gap: 2px 6px; border-left: 2px solid var(--accent); padding-left: 8px; }
.org-roles li span { color: var(--text-2); width: 100%; }
.org-roles strong { font-weight: 600; }
.org-note { font-size: 0.85rem; margin: 0; }
.org-sub { margin-top: 10px; }
.org-sub .org-division { background: var(--surface-2); box-shadow: none; }
@media (max-width: 900px) { .org-sides { grid-template-columns: 1fr; } }
.org-roles-wide { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 16px; }

/* "View as" banner (look-only impersonation). */
.view-as-bar { position: relative; z-index: 25; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: center; padding: 8px 16px; background: var(--warn-soft); color: var(--warn); font-weight: 600; font-size: 0.9rem; border-bottom: 2px solid var(--warn); }
.perm-table { table-layout: fixed; }
.perm-table td, .perm-table th { text-align: center; }
.perm-table th:first-child { width: 44%; }
.perm-table td:first-child, .perm-table th:first-child { text-align: left; }
.perm-table input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--slate-700); }
.perm-extra { display: block; font-size: 0.82rem; color: var(--text-2); margin-top: 4px; }

/* Footer and What's new. */
.site-footer { text-align: center; color: var(--text-3); font-size: 0.82rem; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); }
.site-footer a { color: inherit; }
.release { margin-bottom: 16px; }
.release h2 { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.release h2 .version { font-variant-numeric: tabular-nums; }
.release ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.release li { display: grid; grid-template-columns: 84px 1fr; gap: 10px; align-items: baseline; }
.release li .area { color: var(--text-3); font-size: 0.82rem; }
@media (max-width: 560px) { .release li { grid-template-columns: 1fr; gap: 2px; } }

/* Highlighted box, e.g. a one-time set-password link. */
.callout { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.callout input[readonly] { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; }
.email-actions { display: flex; flex-direction: column; gap: 6px; }
.email-actions .help { display: block; }

/* Org chart: roles that report to another role sit indented beneath it. */
.org-roles li.org-reports { border-left: 0; padding-left: 14px; display: block; }
.org-roles li.org-reports > .org-roles li { border-left-color: var(--border); }
.org-roles li.org-role-group { border-left-color: var(--border); }
.org-roles li.org-role-group span { color: var(--text); }
