/* NextRole dashboard — design tokens + component kit.
   Layout: fixed left sidebar (4 nav groups) + content column; on phones the
   sidebar becomes a drawer and a bottom bar holds the main sections. */
:root {
  --bg: #f5f7f6;
  --surface: #ffffff;
  --sunken: #eef2f0;
  --hover: #f0f4f2;
  --ink: #13201c;
  --ink-2: #33433e;
  --muted: #5a6b65;
  --line: #dfe6e3;
  --line-strong: #c9d3cf;
  --accent: #0f7a64;
  --accent-hover: #0b6653;
  --accent-soft: #dff1eb;
  --accent-ink: #ffffff;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --crit: #b91c1c;
  --crit-soft: #fee2e2;
  --info: #1d4ed8;
  --info-soft: #dbeafe;
  --ai: #6d28d9;
  --ai-soft: #ede9fe;
  --li: #0a66c2;
  --js: #d6006e;
  --scrim: rgba(19, 32, 28, .45);
  --shadow-sm: 0 1px 2px rgba(19, 32, 28, .06);
  --shadow: 0 1px 2px rgba(19, 32, 28, .05), 0 10px 30px rgba(19, 32, 28, .08);
  --font-ui: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --sidebar-w: 236px;
  --logo-filter: none; /* black logo artwork; inverted for dark mode */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1311; --surface: #131c19; --sunken: #18231f; --hover: #1b2723; --ink: #e6eeeb; --ink-2: #c3d0cb; --muted: #94a59f;
    --line: #25322d; --line-strong: #33433d; --accent: #3cc9a5; --accent-hover: #5bd6b6; --accent-soft: #143a31; --accent-ink: #06231c;
    --ok: #4ade80; --ok-soft: #12321f; --warn: #fbbf24; --warn-soft: #3a2c0c; --crit: #f87171; --crit-soft: #3d1717;
    --info: #93c5fd; --info-soft: #172a45; --ai: #c4b5fd; --ai-soft: #2a2145; --li: #4ea1f3; --js: #ff5aa8;
    --logo-filter: invert(1) brightness(1.15); --scrim: rgba(0, 0, 0, .6); --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1311; --surface: #131c19; --sunken: #18231f; --hover: #1b2723; --ink: #e6eeeb; --ink-2: #c3d0cb; --muted: #94a59f;
  --line: #25322d; --line-strong: #33433d; --accent: #3cc9a5; --accent-hover: #5bd6b6; --accent-soft: #143a31; --accent-ink: #06231c;
  --ok: #4ade80; --ok-soft: #12321f; --warn: #fbbf24; --warn-soft: #3a2c0c; --crit: #f87171; --crit-soft: #3d1717;
  --info: #93c5fd; --info-soft: #172a45; --ai: #c4b5fd; --ai-soft: #2a2145; --li: #4ea1f3; --js: #ff5aa8;
  --logo-filter: invert(1) brightness(1.15); --scrim: rgba(0, 0, 0, .6); --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font-ui); background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
h1, h2, h3 { text-wrap: balance; }
code { font-family: var(--font-mono); font-size: .92em; background: var(--sunken); padding: 1px 6px; border-radius: 4px; }
.mono, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft); }
.hidden { display: none !important; }
.hint { font-size: 12.5px; color: var(--muted); }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--line);
  padding: 18px 12px 14px; display: flex; flex-direction: column; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.logo {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 800; font-size: 16px; letter-spacing: -.02em;
}
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: -.01em; }
.brand-sub { font-size: 11.5px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 14px; }
.nav-group { display: grid; gap: 1px; }
.nav-group > small { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0 10px 4px; }
.tab {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
  border: 0; background: transparent; color: var(--ink-2); font: inherit; font-size: 13.5px; font-weight: 500;
  padding: 7px 10px; border-radius: var(--r-sm); cursor: pointer; text-align: left;
}
.tab:hover { background: var(--hover); color: var(--ink); }
.tab.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.tab .badge { margin-left: auto; }
.side-foot { margin-top: auto; display: grid; gap: 10px; padding: 12px 6px 0; border-top: 1px solid var(--line); }
.account { display: grid; gap: 8px; font-size: 12px; color: var(--muted); }
#whoami { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; font-size: 14px;
}
.icon-btn:hover { background: var(--hover); }
.content { min-width: 0; display: flex; flex-direction: column; }
main { width: 100%; max-width: 1180px; padding: 28px 32px 48px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.015em; }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.mobilebar { display: none; }
.bottombar { display: none; }
.scrim { display: none; }

@media (max-width: 880px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(290px, 86vw); z-index: 60; height: 100%;
    transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow);
    padding-top: calc(18px + env(safe-area-inset-top, 0px));
  }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 55; }
  .mobilebar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    position: sticky; top: 0; z-index: 40; background: var(--surface); border-bottom: 1px solid var(--line);
    padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  }
  .mobilebar .brand { padding: 0; }
  .mobilebar .logo { width: 28px; height: 28px; font-size: 14px; }
  .bottombar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .bottombar button {
    border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 10.5px; font-weight: 600;
    display: grid; justify-items: center; gap: 2px; padding: 4px 0; cursor: pointer; position: relative;
  }
  .bottombar button .bi { font-size: 18px; line-height: 1; }
  .bottombar button.active { color: var(--accent); }
  .bottombar .badge { position: absolute; top: 0; left: 55%; }
  main { padding: 16px 16px calc(88px + env(safe-area-inset-bottom, 0px)); }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* ---------- Views, cards, grids ---------- */
.view.hidden { display: none; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 16px 18px; margin-bottom: 16px; min-width: 0;
}
.card h2 { margin: 0 0 12px; font-size: 15px; font-weight: 700; color: var(--ink); }
.card h3 { font-size: 14px; }
.card-label { margin: 0 0 10px; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.cards .card { margin-bottom: 0; }
.stat .stat-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.stat .stat-value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 26px; font-weight: 500; color: var(--ink); margin-top: 4px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.row-inline { display: flex; gap: 6px; }
.row-inline select { flex: 1; min-width: 0; }
.actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 880px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--r-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; font-size: 13px; font-weight: 600;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--crit); }
.btn.danger:hover { background: var(--crit-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.hidden { display: none; }

/* ---------- Forms ---------- */
.field label { display: block; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 5px; }
.field input, .field select, .field textarea,
.toolbar input, .toolbar select, #resume-name, #resume-content, .modal-body textarea, .login-card input, .pq-row input, .pq-row select {
  width: 100%; padding: 8px 11px; border-radius: var(--r-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 13.5px;
}
.field input:focus, .field select:focus, .field textarea:focus, .toolbar input:focus, .toolbar select:focus,
#resume-content:focus, .login-card input:focus, .pq-row input:focus, .pq-row select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
#resume-name { margin-bottom: 8px; }
#resume-content, .modal-body textarea { font-family: var(--font-mono); font-size: 12px; resize: vertical; }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input { flex: 1; min-width: 180px; width: auto; }
.toolbar select { width: auto; }
.days { display: flex; flex-wrap: wrap; gap: 12px; padding: 6px 0; }
.days label { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--ink-2); text-transform: none; letter-spacing: 0; font-weight: 500; }
.inline-check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }

/* ---------- Tables ---------- */
.t { width: 100%; border-collapse: collapse; }
.t th, .t td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
.t th { font-weight: 700; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; background: var(--surface); }
.t tbody tr:hover { background: var(--hover); }
.t tbody tr:last-child td { border-bottom: 0; }
.t .actions-cell { text-align: right; white-space: nowrap; }
.t .actions-cell .btn + .btn { margin-left: 4px; }
.t a { text-decoration: none; }
.t a:hover { text-decoration: underline; }
@media (max-width: 880px) { .t { display: block; overflow-x: auto; } }

/* ---------- Pills, chips, badges ---------- */
.status-pill, .outcome-pill, .type-pill, .src-pill, .pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; line-height: 1.6;
}
.status-pill { text-transform: capitalize; }
.status-saved, .status-withdrawn, .outcome-no_easy_apply, .outcome-ended, .src-pill, .pill.mut { background: var(--sunken); color: var(--muted); }
.status-applied, .outcome-ready_to_submit { background: var(--info-soft); color: var(--info); }
.status-screening, .status-interview, .outcome-halted_unknown, .type-pill.external, .src-pill.review, .pill.warn, .src-pill.ai.conf-medium { background: var(--warn-soft); color: var(--warn); }
.status-offer, .outcome-submitted, .type-pill.easy, .pill.ok { background: var(--ok-soft); color: var(--ok); }
.status-rejected, .outcome-rate_limited, .outcome-error, .pill.crit, .src-pill.ai.conf-low { background: var(--crit-soft); color: var(--crit); }
.src-pill.ai { background: var(--ai-soft); color: var(--ai); }
.badge {
  display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 999px; background: var(--crit); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; margin-left: 4px;
}
.badge.hidden { display: none; }
/* Job-board chips: small coloured square + name. */
.badge.board-li, .badge.board-js {
  display: inline-flex; align-items: center; gap: 5px; background: transparent; padding: 0; margin: 0 4px 0 0;
  font-size: 11.5px; font-weight: 700; line-height: 1.4; min-width: 0;
}
.badge.board-li { color: var(--li); }
.badge.board-js { color: var(--js); }
.badge.board-li::before, .badge.board-js::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: currentColor; }

/* ---------- Bars & meters ---------- */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar { display: grid; grid-template-columns: 120px 1fr 40px; align-items: center; gap: 10px; }
.bar-label { font-size: 12px; color: var(--ink-2); }
.bar-track, .meter-track, .progress { background: var(--sunken); border-radius: 999px; height: 8px; overflow: hidden; }
.bar-fill, .progress > i { display: block; background: var(--accent); height: 100%; border-radius: 999px; }
.bar-count { font-size: 12px; color: var(--ink-2); text-align: right; font-family: var(--font-mono); }
.meters { display: grid; gap: 8px; }
.meter { font-size: 12px; color: var(--ink-2); }
.meter-top { display: flex; justify-content: space-between; margin-bottom: 4px; }
.meter-top b { font-family: var(--font-mono); font-weight: 500; }
.meter-fill { height: 100%; background: var(--ok); border-radius: 999px; }
.meter-fill.warn { background: var(--warn); }
.meter-fill.full { background: var(--crit); }
.meter-board { font-size: 12px; font-weight: 700; color: var(--muted); margin: 8px 0 2px; grid-column: 1 / -1; }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(6, minmax(160px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.kcol { background: var(--sunken); border-radius: var(--r-md); padding: 10px; min-height: 200px; }
.kcol h3 { margin: 0 0 10px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; justify-content: space-between; }
.kcol h3 .n { background: var(--surface); color: var(--ink-2); padding: 0 7px; border-radius: 6px; font-family: var(--font-mono); }
.kitem { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px; margin-bottom: 8px; cursor: pointer; box-shadow: var(--shadow-sm); }
.kitem:hover { border-color: var(--line-strong); }
.kitem .kt { font-weight: 600; font-size: 13px; }
.kitem .kc { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ---------- Misc content ---------- */
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.kv:last-child { border-bottom: 0; }
.steps { margin: 0; padding-left: 20px; line-height: 1.9; }
.banner { border-radius: var(--r-md); padding: 12px 16px; margin-bottom: 16px; font-size: 13.5px; background: var(--crit-soft); border: 1px solid color-mix(in srgb, var(--crit) 30%, transparent); color: var(--crit); }
.banner.hidden { display: none; }
.banner a, .banner button { margin-left: 8px; }
.shield-banner { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); color: var(--warn); }
.paygrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.paybox { border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.paybox h3 { margin: 0; font-size: 15px; }
.paybox.hidden { display: none; }
.qr { max-width: 220px; width: 100%; border-radius: var(--r-sm); border: 1px solid var(--line); background: #fff; }
.qr:not([src]), .qr[src=""] { display: none; }
.dropzone { display: flex; align-items: center; justify-content: center; border: 2px dashed var(--line-strong); border-radius: var(--r-md); padding: 28px 16px; text-align: center; cursor: pointer; color: var(--muted); background: var(--sunken); }
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { display: none; }
.run-box { margin-top: 12px; padding: 12px; border: 1px solid var(--line); background: var(--sunken); border-radius: var(--r-md); color: var(--ink-2); font-size: 13px; }
.run-box pre { margin: 8px 0 0; white-space: pre-wrap; font-family: var(--font-ui); font-size: 12.5px; max-height: 260px; overflow: auto; color: var(--ink-2); }
.pq { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 10px; background: var(--surface); }
.pq-q { font-weight: 700; margin-bottom: 4px; }
.pq-meta { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.pq-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pq-row input, .pq-row select { flex: 1; min-width: 180px; width: auto; }
.pq-ai { font-size: 12px; color: var(--ai); margin-top: 6px; }
.ai-banner { background: var(--ai-soft); border: 1px solid color-mix(in srgb, var(--ai) 30%, transparent); color: var(--ai); border-radius: var(--r-md); padding: 10px 14px; margin-bottom: 12px; font-size: 13px; }
.ai-banner.hidden { display: none; }
.field.ai-filled input, .field.ai-filled select { border-color: var(--ai); background: var(--ai-soft); }
.field.ai-filled > label::after { content: attr(data-ai-tag); margin-left: 6px; font-size: 10px; font-weight: 700; color: var(--ai); background: var(--ai-soft); border-radius: 999px; padding: 1px 6px; text-transform: none; letter-spacing: 0; }
.shield-card h2 { margin: 0; }
.shield-cooldown { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--crit-soft); color: var(--crit); border-radius: var(--r-md); padding: 10px 14px; margin-bottom: 12px; font-size: 13px; }
.shield-cooldown.hidden { display: none; }
.shield-repeat { background: var(--warn-soft); color: var(--warn); border-radius: var(--r-md); padding: 10px 14px; margin-bottom: 12px; font-size: 13px; font-weight: 600; display: grid; gap: 4px; }
.shield-repeat.hidden { display: none; }
.todo-btns { display: flex; gap: 6px; }
.shield-events { list-style: none; padding: 0; margin: 8px 0 0; font-size: 12px; color: var(--ink-2); display: grid; gap: 4px; }
.queue-box { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--sunken); }
.queue-box.hidden { display: none; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.checklist li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.checklist .tick { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; flex: none; background: var(--crit-soft); color: var(--crit); }
.checklist li.done .tick { background: var(--ok-soft); color: var(--ok); }
.checklist li.done span.t { color: var(--muted); }
.checklist a { font-size: 13px; }
.board-split { display: flex; flex-wrap: wrap; gap: 8px 24px; padding: 10px 16px; font-size: 13px; color: var(--ink-2); }
.stat-boards { margin-top: 4px; font-size: 12px; color: var(--muted); }

/* Answer bank */
.ans-cell { cursor: text; }
.inline-edit { display: flex; gap: 6px; align-items: center; }
.inline-edit input { flex: 1; min-width: 120px; padding: 6px 8px; border: 1px solid var(--accent); border-radius: var(--r-sm); font: inherit; background: var(--surface); color: var(--ink); }
.ans-toolbar { margin: 8px 0 12px; }
tr.row-attention td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.bulk-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 8px 12px; margin-bottom: 10px; background: var(--warn-soft); border-radius: var(--r-md); }
.bulk-bar.hidden { display: none; }
.bulk-all { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.sel-col { width: 28px; text-align: center; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: var(--scrim); display: grid; place-items: center; z-index: 100; padding: 20px; }
.modal.hidden { display: none; }
.modal-card { background: var(--surface); border-radius: var(--r-lg); max-width: 800px; width: 100%; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { margin: 0; font-size: 16px; }
.modal-header .x { background: transparent; border: 0; font-size: 24px; cursor: pointer; color: var(--muted); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-body .field { margin-bottom: 14px; }
.modal-body label { display: block; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.modal-body .val { font-size: 13px; color: var(--ink); }
.modal-body pre { background: var(--sunken); padding: 12px; border-radius: var(--r-sm); white-space: pre-wrap; font-size: 12px; max-height: 240px; overflow-y: auto; }

/* ---------- Login ---------- */
.login { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: grid; place-items: center; padding: 16px; }
.login.hidden { display: none; }
.login-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 28px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow);
}
.login-card h2 { margin: 0; font-size: 20px; font-weight: 800; }
.login-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.login-card input { padding: 10px 12px; font-size: 14px; }
.login-error { color: var(--crit); font-size: 12px; min-height: 16px; }
.login-head { display: flex; align-items: center; justify-content: space-between; }

/* ---------- Language switch (EN | BM, rendered by /i18n.js) ---------- */
.lang-switch { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); flex: none; }
.lang-switch button {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font: inherit; font-size: 11px; font-weight: 700; letter-spacing: .03em; line-height: 1;
  padding: 6px 10px; border-radius: 999px; min-width: 32px;
}
.lang-switch button:hover { background: var(--hover); }
.lang-switch button.active { background: var(--accent); color: var(--accent-ink); }

/* ---------- Home ---------- */
.home-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.home-grid > .card { margin-bottom: 0; }
.home-stack { display: grid; gap: 16px; margin-bottom: 16px; }
.run-card { display: grid; gap: 12px; border-width: 1px; }
.run-card.s-running { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.run-card.s-waiting { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.run-card.s-stalled, .run-card.s-noext { border-color: color-mix(in srgb, var(--crit) 45%, var(--line)); }
.run-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.run-state { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; }
.run-state .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.s-running .run-state { color: var(--accent); }
.s-running .run-state .dot { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.s-waiting .run-state { color: var(--warn); }
.s-waiting .run-state .dot { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.s-stalled .run-state, .s-noext .run-state { color: var(--crit); }
.s-stalled .run-state .dot, .s-noext .run-state .dot { background: var(--crit); box-shadow: 0 0 0 4px var(--crit-soft); }
.s-idle .run-state { color: var(--ink-2); }
@media (prefers-reduced-motion: no-preference) { .s-running .run-state .dot { animation: lia-pulse 1.8s ease-in-out infinite; } }
@keyframes lia-pulse { 50% { box-shadow: 0 0 0 7px transparent; } }
.run-title { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.run-sub { color: var(--muted); font-size: 13px; }
.run-stats { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.run-stats b { font-family: var(--font-mono); font-weight: 500; }
.run-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.boards { display: grid; gap: 14px; }
.board-row { display: grid; gap: 6px; }
.board-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.board-num { font-family: var(--font-mono); font-size: 22px; font-weight: 500; }
.board-num small { font-size: 12px; color: var(--muted); }
.todo-list { display: grid; gap: 8px; }
.todo {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 9px 10px; border-radius: var(--r-sm); background: var(--sunken); text-decoration: none; color: var(--ink);
}
.todo:hover { background: var(--hover); }
.todo .ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: 12px; }
.ico.q { background: var(--warn-soft); color: var(--warn); }
.ico.r { background: var(--ai-soft); color: var(--ai); }
.ico.s { background: var(--crit-soft); color: var(--crit); }
.ico.p { background: var(--info-soft); color: var(--info); }
.todo b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo span.sub { color: var(--muted); font-size: 12px; }
.empty-ok { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; padding: 6px 2px; }
.empty-ok .ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); font-weight: 800; }
.timeline { display: grid; }
.tl-row { display: grid; grid-template-columns: 52px 96px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.tl-row:last-child { border-bottom: 0; }
.tl-row .t { color: var(--muted); font-size: 12px; font-family: var(--font-mono); }
.tl-row .who { min-width: 0; }
.tl-row .who b { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-row .who span { color: var(--muted); font-size: 12px; }
.stat-strip { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 13px; color: var(--muted); }
.stat-strip b { color: var(--ink); font-family: var(--font-mono); font-weight: 500; }
.link-more { font-size: 12.5px; font-weight: 600; text-decoration: none; }
@media (max-width: 880px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .tl-row { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .tl-row .board-cell { display: none; }
}

/* ---------- Kit additions (F4+) ---------- */
.save-bar { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 8px; padding: 12px 0; background: linear-gradient(to top, var(--bg) 70%, transparent); z-index: 5; }
@media (max-width: 880px) { .save-bar { bottom: calc(64px + env(safe-area-inset-bottom, 0px)); } }
.field-wide { grid-column: 1 / -1; }
.cell-2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.cell-2 a { color: var(--ink); }
.switch { position: relative; display: inline-block; width: 36px; height: 20px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: background .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: var(--shadow-sm); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-left: auto; box-shadow: 0 0 0 3px var(--accent-soft); }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 200;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--r-md); font-weight: 600; font-size: 13px; box-shadow: var(--shadow);
  transition: opacity .18s, transform .18s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--crit); color: #fff; }
@media (max-width: 880px) { .toast { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); } }
@media (prefers-reduced-motion: reduce) { .switch span, .switch span::after, .toast { transition: none; } }
.two-line { display: grid; gap: 2px; min-width: 0; }
.two-line b { font-weight: 600; }
.two-line span { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12.5px; flex-wrap: wrap; }
.t tr.row-click { cursor: pointer; }
a.icon-btn { text-decoration: none; }
.icon-btn.danger { color: var(--crit); }
.icon-btn.danger:hover { background: var(--crit-soft); }
.t .actions-cell .icon-btn + .icon-btn { margin-left: 4px; }
.opt-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 100%; }
.opt-chip {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-size: 12.5px; font-weight: 500;
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
}
.opt-chip:hover { border-color: var(--accent); }
.opt-chip.sel { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; }

/* Job details: a drawer from the right instead of a centred popup. */
.modal { place-items: stretch end; padding: 0; }
.modal-card { height: 100%; max-height: 100vh; max-width: 580px; border-radius: 0; animation: lia-drawer .18s ease-out; }
@keyframes lia-drawer { from { transform: translateX(24px); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .modal-card { animation: none; } }
.chip-input { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 8px; min-height: 40px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); cursor: text; }
.chip-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chip-input input { flex: 1; width: auto !important; min-width: 180px; border: 0 !important; box-shadow: none !important; padding: 4px !important; outline: none; background: transparent; }
.tchip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 12.5px; }
.tchip button { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px; border-radius: 999px; }
.tchip button:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.pill-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.pill-checks label { display: inline-flex; align-items: center; cursor: pointer; text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 13px; color: var(--ink); margin: 0; }
.pill-checks input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pill-checks span { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); }
.pill-checks input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.pill-checks input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.builder .field { margin-bottom: 12px; }
.manual-add { margin-top: 14px; }
.manual-add summary { cursor: pointer; margin-bottom: 10px; }

/* ---------- Brand (NextRole) ---------- */
.brand-lockup { display: block; height: auto; max-width: 100%; filter: var(--logo-filter); }
.sidebar .brand .brand-lockup { width: 141px; margin-bottom: 4px; }
.mobilebar .brand-lockup { width: 114px; }
.login-head .brand-lockup { width: 140px; }
.tagline { margin: -4px 0 4px; font-size: 13px; color: var(--muted); }
