/* patchnotes ops — "Aurora" design system (v3, 2026-08-21).
   Inspired by modern SaaS dashboards: dark-first, generous whitespace,
   soft layered surfaces instead of hard borders, large radii, pill
   controls, one restrained accent with a subtle glow. Light theme is a
   fully-designed counterpart. Server-rendered; JS = theme toggle,
   actions poll, models confirm, copy buttons, list filters, live char
   count — nothing else. */

:root {
  color-scheme: light;
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --surface-2: #EEF1F4;
  --surface-3: #E7EBEF;
  --border: rgba(15, 23, 42, 0.08);
  --border-faint: rgba(15, 23, 42, 0.05);
  --ink: #101828;
  --muted: #667085;
  --accent: #5B5BD6;
  --accent-hover: #4a4ac4;
  --accent-ink: #FFFFFF;
  --accent-dim: color-mix(in srgb, var(--accent) 12%, transparent);
  --ok: #12905D;
  --warn: #B45309;
  --bad: #D92D20;
  --chart-accent: var(--accent);
  --chart-accent-2: #F59E0B;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --tabbar-h: calc(64px + env(safe-area-inset-bottom));
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -12px rgba(15, 23, 42, 0.08);
  --shadow-pop: 0 4px 12px rgba(15, 23, 42, 0.06), 0 24px 48px -16px rgba(15, 23, 42, 0.14);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0B0D12;
    --surface: #12151C;
    --surface-2: #171B23;
    --surface-3: #1D222C;
    --border: rgba(255, 255, 255, 0.07);
    --border-faint: rgba(255, 255, 255, 0.045);
    --ink: #EAECF1;
    --muted: #949CAE;
    --accent: #818CF8;
    --accent-hover: #98A2FF;
    --accent-ink: #0B0D18;
    --accent-dim: color-mix(in srgb, var(--accent) 14%, transparent);
    --ok: #34D394;
    --warn: #FBBF24;
    --bad: #F87171;
    --chart-accent: var(--accent);
    --chart-accent-2: #FBBF24;
    --shadow-card: none;
    --shadow-pop: 0 24px 64px -24px rgba(0, 0, 0, 0.55);
  }
}
/* explicit toggle wins in both directions */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B0D12; --surface: #12151C; --surface-2: #171B23; --surface-3: #1D222C;
  --border: rgba(255, 255, 255, 0.07); --border-faint: rgba(255, 255, 255, 0.045);
  --ink: #EAECF1; --muted: #949CAE;
  --accent: #818CF8; --accent-hover: #98A2FF; --accent-ink: #0B0D18;
  --accent-dim: color-mix(in srgb, var(--accent) 14%, transparent);
  --ok: #34D394; --warn: #FBBF24; --bad: #F87171;
  --chart-accent: var(--accent); --chart-accent-2: #FBBF24;
  --shadow-card: none;
  --shadow-pop: 0 24px 64px -24px rgba(0, 0, 0, 0.55);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #F5F6F8; --surface: #FFFFFF; --surface-2: #EEF1F4; --surface-3: #E7EBEF;
  --border: rgba(15, 23, 42, 0.08); --border-faint: rgba(15, 23, 42, 0.05);
  --ink: #101828; --muted: #667085;
  --accent: #5B5BD6; --accent-hover: #4a4ac4; --accent-ink: #FFFFFF;
  --accent-dim: color-mix(in srgb, var(--accent) 12%, transparent);
  --ok: #12905D; --warn: #B45309; --bad: #D92D20;
  --chart-accent: var(--accent); --chart-accent-2: #F59E0B;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -12px rgba(15, 23, 42, 0.08);
  --shadow-pop: 0 4px 12px rgba(15, 23, 42, 0.06), 0 24px 48px -16px rgba(15, 23, 42, 0.14);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; accent-color: var(--accent); overflow-x: hidden; }
body {
  margin: 0;
  background:
    radial-gradient(1100px 420px at 50% -180px,
      color-mix(in srgb, var(--accent) 11%, transparent),
      transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font: 14px/1.6 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
p { overflow-wrap: anywhere; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

.mono, td.ts, .tile-value, h2.mono { font-variant-numeric: tabular-nums; }
.mono, td.ts, textarea, .logbox {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- layout: shell + sidebar (desktop) + tabbar (mobile) ---------- */
.shell { max-width: 100%; margin: 0 auto; padding: 0 18px var(--tabbar-h); }
main { padding-bottom: 40px; }

.pagehead {
  display: flex; align-items: center; gap: 10px;
  height: 56px;
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border-faint);
  margin-bottom: 20px;
}
.pagehead-brand { flex: none; }
.crab { display: block; flex: none; }
.pagehead-title {
  font-size: 19px; font-weight: 700; letter-spacing: -0.02em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.funnel-dot { flex: none; margin-left: 2px; }
.page-sub { color: var(--muted); font-size: 0.88rem; margin: -4px 0 22px; }

.theme-toggle {
  margin-left: auto; flex: none; background: var(--surface); color: var(--muted);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  width: 38px; height: 38px; padding: 0; display: grid; place-items: center;
  cursor: pointer; font-size: 1rem; line-height: 1; min-height: 0;
  box-shadow: var(--shadow-card);
  transition: background .15s ease-out, color .15s ease-out, transform .15s ease-out;
}
.theme-toggle:hover { background: var(--surface-2); color: var(--ink); transform: translateY(-1px); }

.tabbar {
  position: fixed; bottom: 10px; left: 50%; transform: translateX(-50%);
  z-index: 40;
  display: flex; gap: 4px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-pop);
  padding: 6px;
  width: min(calc(100% - 24px), 340px);
  justify-content: space-around;
}
.tabbar a {
  flex: 1; max-width: 104px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--muted); text-decoration: none;
  font-size: 0.63rem; letter-spacing: 0.02em; font-weight: 550;
  padding: 7px 6px; border-radius: var(--radius-pill); min-height: 48px;
  justify-content: center;
  transition: background .18s ease-out, color .18s ease-out;
}
.tabbar a svg { width: 21px; height: 21px; }
.tabbar a.active { color: var(--accent); background: var(--accent-dim); }
.tabbar a:hover { text-decoration: none; color: var(--ink); }
.tabbar a.active:hover { color: var(--accent); }

.sidebar { display: none; }

@media (min-width: 900px) {
  .tabbar { display: none; }
  :root { --tabbar-h: 0px; }
  .sidebar {
    display: flex; flex-direction: column; gap: 2px;
    position: fixed; top: 0; left: 0; bottom: 0; width: 232px;
    padding: 22px 16px; overflow-y: auto;
    background: color-mix(in srgb, var(--surface) 55%, var(--bg));
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--border-faint);
  }
  .sidebar .brand {
    display: flex; align-items: center; gap: 10px; font-weight: 700;
    font-size: 1rem; letter-spacing: -0.01em; padding: 2px 10px 22px;
  }
  .nav-group-label {
    font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--muted); opacity: 0.75; padding: 14px 10px 6px;
  }
  .sidebar a, .sidebar .linklike {
    display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
    color: var(--muted); text-decoration: none;
    padding: 9px 12px; border-radius: 10px; font-size: 0.87rem; font-weight: 500;
    background: none; border: 0; cursor: pointer; font-family: inherit; min-height: 0;
    box-shadow: none;
    transition: background .15s ease-out, color .15s ease-out;
  }
  .sidebar a:hover, .sidebar .linklike:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
  .sidebar a.active {
    color: var(--ink); font-weight: 600; background: var(--surface-2);
    box-shadow: inset 3px 0 0 0 var(--accent);
  }
  .sidebar a.active svg { stroke: var(--accent); }
  .sidebar-sep { height: 1px; background: var(--border-faint); margin: 14px 8px; }
  .pagehead { display: none; }
  .shell { margin-left: 232px; max-width: 1080px; padding: 28px 28px 32px; }
}

/* ---------- typography helpers ---------- */
h1 { font-size: 22px; margin: 4px 0 14px; letter-spacing: -0.02em; font-weight: 700; }
h2 {
  font-size: 11px; margin: 8px 0 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.1em; font-weight: 650;
}
h2.mono {
  text-transform: none; letter-spacing: 0; font-size: 1rem;
  color: var(--ink); font-weight: 650;
}
a { color: var(--accent); text-decoration: none; transition: color .15s ease-out; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
section { margin: 26px 0; }
.muted { color: var(--muted); font-weight: normal; }
.small { font-size: 0.8rem; }
td.ts { white-space: nowrap; word-break: normal; font-size: 0.72rem; color: var(--muted); }
.num { text-align: right; }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.warn-ink { color: var(--warn); }
.accent { color: var(--accent); }
.error {
  background: color-mix(in srgb, var(--bad) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); color: var(--ink);
  padding: 13px 16px; border-radius: var(--radius-sm); white-space: pre-wrap; font-size: 0.86rem;
}
.notice {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  color: var(--ink); padding: 13px 16px; border-radius: var(--radius-sm);
  white-space: pre-wrap; font-size: 0.86rem;
}

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; flex: none; }
.ok-bg { background: var(--ok); box-shadow: 0 0 10px color-mix(in srgb, var(--ok) 60%, transparent); }
.bad-bg { background: var(--bad); box-shadow: 0 0 10px color-mix(in srgb, var(--bad) 60%, transparent); }
.warn-bg { background: var(--warn); box-shadow: 0 0 10px color-mix(in srgb, var(--warn) 60%, transparent); }
.neutral-bg { background: var(--surface-3); box-shadow: none; }
.orig-bg { background: var(--accent); box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 55%, transparent); }
.reply-bg { background: var(--chart-accent-2); box-shadow: 0 0 10px color-mix(in srgb, var(--chart-accent-2) 55%, transparent); }
.dot.dashed { background: transparent; border: 1.5px dashed var(--muted); width: 7px; height: 7px; box-shadow: none; }

/* diff motif — supply gets +, deficit/cooling gets − */
.diff-plus, .diff-minus { font-weight: 650; font-variant-numeric: tabular-nums; }
.diff-plus { color: var(--ok); }
.diff-minus { color: var(--warn); }

/* ---------- panels & tiles ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px; margin: 0 0 16px;
  box-shadow: var(--shadow-card);
}
.panel-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  font-size: 11px; font-weight: 650; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--muted); margin-bottom: 14px;
}
.panel-link { font-size: 0.78rem; text-transform: none; letter-spacing: 0; font-weight: 550; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
.tile {
  background: var(--surface-2); border-radius: 14px;
  padding: 13px 15px 14px; border: 1px solid transparent;
}
.tile.warn { background: color-mix(in srgb, var(--warn) 9%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.tile.good { background: color-mix(in srgb, var(--ok) 8%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.tile-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.tile-value {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 24px; font-weight: 700; margin-top: 5px; overflow-wrap: anywhere;
  letter-spacing: -0.01em; line-height: 1.25;
}
.tile-value.sm { font-size: 18px; }
.tile-value small { font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.linktile { color: inherit; display: block; transition: transform .18s ease-out, border-color .18s ease-out; }
.linktile:hover { transform: translateY(-2px); text-decoration: none; }
.linktile:active { transform: none; }

.status-rows { margin-top: 14px; display: grid; gap: 10px; }
.status-row { display: flex; align-items: center; gap: 9px; font-size: 0.86rem; min-width: 0; }
.status-row .muted { margin-left: auto; text-align: right; }
.status-row .mono { word-break: normal; white-space: nowrap; }
.status-row b { font-variant-numeric: tabular-nums; white-space: nowrap; }

.trigger-list { display: grid; gap: 12px; }
.trigger-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.trigger-row form { margin: 0; }

/* ---------- telemetry strip (Today) ---------- */
.telemetry {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  margin: 0 0 18px;
}
@media (min-width: 600px) { .telemetry { grid-template-columns: repeat(4, 1fr); } }
.tele-item {
  min-width: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 17px;
  box-shadow: var(--shadow-card);
}
.tele-label {
  color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.09em;
  font-weight: 600; display: flex; align-items: center; gap: 6px;
}
.tele-value {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 21px; font-weight: 700; margin-top: 4px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.tele-item.warn .tele-value { color: var(--warn); }
.tele-item.ok .tele-value { color: var(--ok); }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; margin: 12px 0;
  box-shadow: var(--shadow-card);
  transition: transform .18s ease-out, border-color .18s ease-out, box-shadow .18s ease-out;
}
.card.burned { opacity: 0.55; }
.card.attn {
  display: block; color: var(--ink);
  border-color: color-mix(in srgb, var(--warn) 40%, transparent);
  background: color-mix(in srgb, var(--warn) 7%, var(--surface));
  text-decoration: none; font-size: 0.86rem;
}
.card.attn:hover { border-color: var(--warn); transform: translateY(-1px); text-decoration: none; }
.card-title { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; font-size: 0.94rem; letter-spacing: -0.006em; }
a.card-title:hover { color: var(--accent); text-decoration: none; }
.card-meta { color: var(--muted); font-size: 0.78rem; margin: 4px 0 0; overflow-wrap: anywhere; }
.preview { margin: 9px 0 0; color: var(--ink); font-size: 0.87rem; overflow-wrap: anywhere; line-height: 1.6; }
.prio {
  display: inline-block; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-pill); padding: 2px 9px; font-size: 0.68rem; margin-right: 7px;
  font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

/* chips — pill exception */
.tier-b, .chip-ever, .tier-a, .chip-pillar {
  display: inline-block; border-radius: var(--radius-pill); padding: 2px 9px;
  font-size: 0.62rem; font-weight: 650; text-transform: uppercase;
  letter-spacing: 0.04em; vertical-align: 1px; margin-left: 4px;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}
.tier-a { background: var(--accent-dim); color: var(--accent); }
.tier-b { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.chip-ever { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }
.chip-pillar { background: var(--surface-2); color: var(--muted); }
.badge {
  display: inline-block; padding: 2px 9px; border-radius: var(--radius-pill); font-size: 0.65rem;
  font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}
.badge.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.badge.low { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }

/* ---------- empty states ---------- */
.empty {
  border: 1.5px dashed var(--border); border-radius: var(--radius);
  padding: 32px 20px; text-align: center; color: var(--muted); font-size: 0.85rem;
  background: color-mix(in srgb, var(--surface) 50%, transparent);
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- tabs + filters ---------- */
.tabs {
  display: flex; gap: 8px; overflow-x: auto; margin: 2px 0 18px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none; padding: 2px 0;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  padding: 7px 15px; border-radius: var(--radius-pill); border: 1px solid var(--border);
  color: var(--muted); font-size: 0.79rem; white-space: nowrap; background: var(--surface);
  font-weight: 550; min-height: 36px; display: inline-flex; align-items: center;
  box-shadow: var(--shadow-card);
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  transition: background .15s ease-out, color .15s ease-out, border-color .15s ease-out, box-shadow .15s ease-out;
}
.tabs a:hover { text-decoration: none; background: var(--surface-2); color: var(--ink); }
.tabs a.active {
  background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 650;
  box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--accent) 55%, transparent);
}

.filter-input { margin: 0 0 14px; max-width: 320px; }

.segment {
  display: inline-flex; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 3px; gap: 2px;
}
.segment button, .segment .seg {
  border: 0; background: none; color: var(--muted); font: inherit; font-size: 0.84rem;
  font-weight: 550; padding: 8px 18px; border-radius: 10px; cursor: pointer; min-height: 0;
  box-shadow: none;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  transition: background .15s ease-out, color .15s ease-out;
}
.segment .seg.active {
  background: var(--surface); color: var(--accent); font-weight: 650;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
.segment button:hover:not(.active) { color: var(--ink); }

/* ---------- buttons & forms ---------- */
.row-actions { display: flex; gap: 10px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.row-actions form { margin: 0; }

button, .btn-primary, button.primary {
  background: var(--accent); color: var(--accent-ink);
  border: 1px solid transparent;
  border-radius: var(--radius-pill); padding: 11px 22px; font-size: 0.87rem; font-weight: 600;
  cursor: pointer; font-family: inherit; min-height: 44px; letter-spacing: -0.004em;
  transition: filter 150ms ease-out, transform 150ms ease-out, box-shadow 150ms ease-out, background 150ms ease-out;
}
button:hover, .btn-primary:hover, button.primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 8px 22px -8px color-mix(in srgb, var(--accent) 70%, transparent);
}
button:active, .btn-primary:active, button.primary:active {
  transform: translateY(1px); box-shadow: none;
}
button:disabled {
  opacity: 0.45; cursor: default; transform: none; box-shadow: none;
}
.btn-sm {
  background: var(--surface); color: var(--ink); border: 1px solid var(--border);
  border-radius: var(--radius-pill); padding: 7px 15px; font-size: 0.79rem; font-weight: 550;
  display: inline-flex; align-items: center; text-decoration: none; min-height: 44px;
  cursor: pointer; font-family: inherit; box-shadow: var(--shadow-card);
  transition: background 150ms ease-out, border-color 150ms ease-out, transform 150ms ease-out;
}
.btn-sm:hover { background: var(--surface-2); text-decoration: none; border-color: var(--accent); transform: translateY(-1px); }
.btn-sm:active { transform: none; }
@media (min-width: 900px) { .btn-sm { min-height: 34px; } }

.btn-sm.danger, button.danger {
  background: color-mix(in srgb, var(--bad) 9%, transparent); color: var(--bad);
  border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent);
  box-shadow: none;
}
.btn-sm.danger:hover, button.danger:hover {
  background: color-mix(in srgb, var(--bad) 16%, transparent);
  border-color: var(--bad);
}
.btn-sm.danger:active, button.danger:active { transform: none; box-shadow: none; }

.btn-secondary {
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--border);
  box-shadow: none;
}
.btn-secondary:hover { background: var(--surface); border-color: var(--accent); box-shadow: none; }
.btn-secondary:active { transform: none; box-shadow: none; }

.btn-quiet { background: transparent; color: var(--muted); border: 1px solid var(--border); box-shadow: none; }
.btn-quiet:hover { background: var(--surface-2); color: var(--ink); border-color: var(--border); box-shadow: none; }
.btn-quiet:active { transform: none; box-shadow: none; }
.linklike { text-decoration: none; }

input[type="password"], input[type="url"], input[type="text"], input[type="number"], input[type="search"], textarea, select {
  width: 100%; padding: 11px 15px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--surface); color: var(--ink);
  font: inherit; font-size: max(16px, 0.9rem); min-height: 46px;
  transition: border-color .15s ease-out, box-shadow .15s ease-out, background .15s ease-out;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.75; }
input:focus, textarea:focus, select:focus {
  border-color: var(--accent); outline: none;
  box-shadow: 0 0 0 4px var(--accent-dim);
  background: var(--surface);
}
select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 19px) center, calc(100% - 14px) center;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 36px;
}
input[type="file"] {
  font-size: 0.84rem; color: var(--ink); max-width: 100%;
  flex: 1 1 240px; min-width: 200px;
}
input[type="file"]::file-selector-button {
  background: var(--surface); color: var(--ink); border: 1px solid var(--border);
  border-radius: var(--radius-pill); padding: 8px 15px; font: inherit; font-size: 0.8rem; font-weight: 550;
  margin-right: 10px; cursor: pointer;
  transition: background .15s ease-out, border-color .15s ease-out;
}
input[type="file"]::file-selector-button:hover { background: var(--surface-2); border-color: var(--accent); }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible,
a:focus-visible, summary:focus-visible, .tabbar a:focus-visible, .sidebar a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
textarea { font-size: max(16px, 0.86rem); line-height: 1.65; min-height: 280px; resize: vertical; }
.inline-form { display: flex; gap: 10px; margin: 14px 0; flex-wrap: wrap; align-items: center; }
.inline-form input, .inline-form select { flex: 1; min-width: 0; }
.field-label { font-size: 0.77rem; color: var(--muted); font-weight: 600; margin: 0 0 7px; letter-spacing: 0.01em; }
.field-gap { height: 12px; }

.check-row { display: flex; align-items: center; gap: 9px; margin-top: 14px; cursor: pointer; }
.check-row input[type="checkbox"] { width: auto; min-height: 0; accent-color: var(--accent); width: 17px; height: 17px; }

/* ---------- tables ---------- */
table {
  border-collapse: separate; border-spacing: 0; width: 100%;
  background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-card);
}
td, th {
  padding: 11px 16px; border-bottom: 1px solid var(--border-faint);
  text-align: left; font-variant-numeric: tabular-nums; font-size: 0.84rem;
  vertical-align: middle;
}
th {
  color: var(--muted); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.08em; border-bottom: 1px solid var(--border); font-weight: 600;
  background: color-mix(in srgb, var(--surface-2) 60%, transparent);
}
tr:last-child td { border-bottom: 0; }
@media (min-width: 900px) {
  @media (hover: hover) {
    tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
  }
}
.panel table { border: 0; border-radius: 0; background: none; box-shadow: none; }
.panel th { background: none; }
.panel td, .panel th { padding-left: 2px; padding-right: 12px; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }

/* ---------- post text / logs ---------- */
.post-text {
  background: var(--surface-2); border: 1px solid var(--border-faint);
  border-radius: 14px; padding: 15px 17px; white-space: pre-wrap;
  overflow-wrap: anywhere; font-family: inherit; font-size: 0.93rem; margin: 10px 0; line-height: 1.65;
}
.post-block { display: grid; grid-template-columns: 1fr auto; align-items: center; }
.post-block .post-text { grid-column: 1 / -1; }
.copy-btn {
  grid-column: 2; justify-self: end;
  background: var(--surface); color: var(--muted); border: 1px solid var(--border);
  border-radius: var(--radius-pill); padding: 4px 12px; font-size: 0.68rem; font-weight: 600;
  min-height: 0; cursor: pointer; margin: -10px 2px 10px;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  box-shadow: var(--shadow-card);
  transition: color 150ms ease-out, border-color 150ms ease-out, background 150ms ease-out;
}
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }
.copy-btn.copied { color: var(--ok); border-color: var(--ok); }

.logbox {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 16px; overflow-x: auto;
  font-size: 0.72rem; line-height: 1.7; white-space: pre;
  box-shadow: var(--shadow-card);
}

/* ---------- charts ---------- */
.chart-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; margin: 10px 0;
  box-shadow: var(--shadow-card);
}
.spark { width: 100%; height: auto; display: block; margin-top: 10px; }
.spark .axis { stroke: var(--border-faint); stroke-width: 1; }
.spark .series { stroke: var(--chart-accent); fill: none; stroke-width: 2.5;
  filter: drop-shadow(0 6px 10px color-mix(in srgb, var(--chart-accent) 30%, transparent)); }
.spark .series-dot { fill: var(--chart-accent); stroke: var(--surface); stroke-width: 3; }
.spark .chart-ink { fill: var(--muted); font-size: 11px; }
.bar-cron { fill: var(--chart-accent); }
.bar-inter { fill: var(--chart-accent-2); }
.bar-budget { stroke: var(--bad); stroke-width: 1.5; stroke-dasharray: 4 3; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 0.78rem; color: var(--ink); margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 4px; display: inline-block; }
.chart-range { margin-top: 8px; }
details summary {
  cursor: pointer; color: var(--muted); padding: 9px 0; font-size: 0.86rem;
  transition: color .15s ease-out;
}
details summary:hover { color: var(--ink); }
details[open] summary { margin-bottom: 8px; }

/* meter bars (topics target/actual) */
.meter { background: var(--surface-2); border-radius: var(--radius-pill); height: 7px; overflow: hidden; margin-top: 5px; }
.meter > i { display: block; height: 100%; background: var(--chart-accent); border-radius: var(--radius-pill);
  box-shadow: 0 0 8px color-mix(in srgb, var(--chart-accent) 45%, transparent); }

/* ---------- menus ---------- */
.menu-list { display: grid; gap: 10px; }
.menu-list a {
  display: grid; gap: 2px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 18px;
  box-shadow: var(--shadow-card);
  transition: transform .18s ease-out, border-color .18s ease-out;
}
.menu-list a b { font-weight: 600; font-size: 0.92rem; letter-spacing: -0.006em; }
.menu-list a:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); transform: translateY(-1px); text-decoration: none; }
.menu-list a span { color: var(--muted); font-size: 0.79rem; }
.signout { margin-top: 22px; }

/* ---------- login ---------- */
.login-body {
  display: grid; place-items: center; min-height: 100dvh;
  margin: 0; padding: 20px;
  background:
    radial-gradient(800px 400px at 50% -140px,
      color-mix(in srgb, var(--accent) 14%, transparent),
      transparent 70%),
    var(--bg);
  color: var(--ink);
  font: 14px/1.6 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.login-card {
  width: min(380px, 92vw); display: grid; gap: 15px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 40px 32px 34px;
  text-align: center; margin: 0;
  box-shadow: var(--shadow-pop);
}
.login-logo { display: grid; place-items: center; margin-bottom: 2px; }
.login-logo .crab { width: 52px; height: 52px; }
.login-card .wordmark { font-weight: 700; font-size: 1.25rem; letter-spacing: -0.02em; margin: 0; }
.login-card .tagline { color: var(--muted); font-size: 0.83rem; margin: -10px 0 10px; }
.login-card input {
  padding: 13px 15px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: max(16px, 0.95rem);
  text-align: center; min-height: 48px;
  transition: border-color .15s ease-out, box-shadow .15s ease-out;
}
.login-card input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 4px var(--accent-dim); }
.login-card button {
  background: var(--accent); color: var(--accent-ink); border: 1px solid transparent;
  border-radius: var(--radius-pill); padding: 13px; font: inherit; font-weight: 600;
  cursor: pointer; min-height: 48px;
  transition: filter 150ms ease-out, transform 150ms ease-out, box-shadow 150ms ease-out;
}
.login-card button:hover { background: var(--accent-hover); box-shadow: 0 8px 24px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.login-card button:active { transform: translateY(1px); box-shadow: none; }
.login-card button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.login-card .error {
  background: color-mix(in srgb, var(--bad) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent);
  padding: 10px 13px; border-radius: 12px; font-size: 0.84rem; margin: 0;
}

/* ---------- motion discipline ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
