/* ============================================================
   DIG & BUILD — xauto design tokens (classic black theme)
   Elevation is surface colour + a 1px border, never shadows
   (menus, toasts and sheets float, so they alone have one).
   Primary action = white/black; secondary = bordered ghost.
   Green = good, red = failed/destructive, amber = waiting —
   and never colour alone: every state has its icon and its word.
   ONE spacing scale (--s*), ONE type scale (--t-*).
   ============================================================ */
:root {
  --bg: #0d0d0d;
  --page: #090909;
  --frame: #101011;
  --surface: #131313;
  --surface2: #171717;
  --elevated: #1f1f1f;
  --input: #0e0e0e;

  --edge: #252525;
  --line: #2e2e2e;
  --hair: #1c1c1c;

  --ink: #ffffff;
  --ink2: #d2d2d2;
  --muted: #9c9c9c;   /* secondary text: 7:1 on the cards */
  --faint: #737373;   /* placeholders and decoration only: never something to read */

  --brand: #0070f3;
  --brand2: #3b93ff;
  --good: #1fcb4f;
  --bad: #ff5c5c;
  --warn: #e9b731;
  --info: #49c3ff;
  --good-bg: rgba(31, 203, 79, 0.09);
  --bad-bg: rgba(255, 92, 92, 0.09);
  --warn-bg: rgba(233, 183, 49, 0.09);
  --info-bg: rgba(73, 195, 255, 0.09);
  --good-line: rgba(31, 203, 79, 0.38);
  --bad-line: rgba(255, 92, 92, 0.42);
  --warn-line: rgba(233, 183, 49, 0.4);
  --info-line: rgba(73, 195, 255, 0.36);

  /* spacing */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  /* type */
  --t-xs: 11px; --t-sm: 12px; --t-md: 13px; --t-base: 14px; --t-lg: 16px; --t-xl: 20px; --t-2xl: 26px;
  /* shape and motion */
  --r-sm: 8px; --r-md: 10px; --r-lg: 14px;
  --fast: 120ms; --med: 200ms; --ease: cubic-bezier(.2, .7, .3, 1);
  /* the least a thing you press may measure */
  --tap: 34px;

  --sans: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
}
/* A finger, not a mouse: everything pressable is at least 42px. */
@media (pointer: coarse) { :root { --tap: 42px; } }

* { box-sizing: border-box; border-color: var(--edge); }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--t-base);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
::selection { background: rgba(0, 112, 243, 0.4); color: #fff; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #262626; border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #353535; }
a { color: var(--brand2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, p { margin: 0; }
button { font-family: var(--sans); }
.hidden { display: none !important; }
.mono { font-family: var(--mono); }
.tabnums, .num { font-variant-numeric: tabular-nums; }
.num { text-align: right; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: var(--t-sm); }
.xs { font-size: var(--t-xs); }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.lucide { width: 16px; height: 16px; stroke-width: 2; flex-shrink: 0; }
.icon-sm svg.lucide, svg.lucide.sm { width: 14px; height: 14px; }

/* Keyboard focus: one ring, everywhere. (A mouse click shows none.) */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--brand2); outline-offset: 2px; border-radius: var(--r-sm); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; border-radius: var(--r-md); }

/* ------------------------------------------------------------ shell */
.shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar {
  width: 248px; flex-shrink: 0; display: flex; flex-direction: column;
  border-right: 1px solid var(--line); background: var(--frame); padding: var(--s4);
  position: sticky; top: 0; height: 100vh; height: 100dvh;
}
.brand { display: inline-flex; align-items: center; gap: var(--s2); color: var(--ink); }
.brand-word { font-weight: 800; letter-spacing: -0.03em; font-size: 18px; line-height: 1; }
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-xs); font-weight: 600; color: var(--muted); white-space: nowrap; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); animation: pulse 2.4s ease-in-out infinite; }
.live.wait .live-dot { background: var(--warn); }
.live.down { color: var(--bad); }
.live.down .live-dot { background: var(--bad); animation: none; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.nav { margin-top: var(--s5); display: flex; flex-direction: column; gap: 2px; }
.nav button {
  display: flex; width: 100%; align-items: center; gap: 10px; border: 0; cursor: pointer; min-height: 38px;
  border-radius: var(--r-md); padding: 0 var(--s3); font: 600 var(--t-md) var(--sans);
  background: transparent; color: var(--muted); transition: background var(--fast), color var(--fast);
}
.nav button:hover { background: rgba(255, 255, 255, 0.05); color: var(--ink2); }
.nav button.on { background: var(--elevated); color: var(--ink); }
.count {
  margin-left: auto; min-width: 20px; padding: 1px 6px; border-radius: 999px; font-size: var(--t-xs); font-weight: 700;
  background: rgba(255, 92, 92, 0.16); color: var(--bad); text-align: center; font-variant-numeric: tabular-nums;
}
.count.solid { background: var(--bad); color: #fff; }

.side-foot { margin-top: auto; border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s3); }
.side-foot .row-kv { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); font-size: var(--t-sm); padding: 3px 0; min-width: 0; }
.side-foot .row-kv > span:first-child { color: var(--muted); flex: none; }
.side-foot .row-kv > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
main { flex: 1; min-width: 0; padding: var(--s5) 28px 48px; max-width: 1500px; width: 100%; }
.mobile-bar, .tabbar { display: none; }

@media (max-width: 1023px) {
  .sidebar { display: none; }
  main { padding: var(--s4) var(--s4) 96px; }
  .mobile-bar {
    display: flex; align-items: center; justify-content: space-between; gap: var(--s2);
    position: sticky; top: 0; z-index: 40; border-bottom: 1px solid var(--line); padding: 10px var(--s4);
    background: rgba(16, 16, 17, 0.94); backdrop-filter: blur(8px);
  }
  /* The pages, under the thumb. Four that are looked at all day, and "More" for the rest. */
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    border-top: 1px solid var(--line); background: rgba(16, 16, 17, 0.97); backdrop-filter: blur(10px);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .tabbar button {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 52px; border: 0; background: transparent; color: var(--muted); border-radius: var(--r-md);
    font: 600 10.5px var(--sans); cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .tabbar button svg { width: 20px; height: 20px; }
  .tabbar button.on { color: var(--ink); background: var(--elevated); }
  .tabbar .count { position: absolute; top: 4px; left: calc(50% + 6px); margin: 0; min-width: 17px; padding: 0 4px; font-size: 10px; line-height: 16px; }
}

/* ------------------------------------------------------------ page */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.page-head h1 { font-size: var(--t-xl); font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
.page-head p { margin-top: var(--s1); color: var(--muted); font-size: var(--t-md); max-width: 78ch; }
/* On a phone the screen is for what is going on: a page's one-line description is left out. */
@media (max-width: 720px) { .page-head p { display: none; } .page-head { align-items: center; } }
.stack { display: flex; flex-direction: column; gap: var(--s4); }
.stack.tight { gap: var(--s2); }
.row { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.two.top { align-items: start; }
@media (max-width: 1180px) { .two { grid-template-columns: 1fr; } }
section[data-view] { animation: page-in var(--med) var(--ease); }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } }

/* ------------------------------------------------------------ card */
.card { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); min-width: 0; }
.card-head {
  display: flex; gap: var(--s3); justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--line); padding: var(--s3) var(--s4); flex-wrap: wrap; min-height: 56px;
}
.card-head > div:first-child { min-width: 0; flex: 1 1 220px; }
.card-head h3 { font-size: 15px; font-weight: 700; line-height: 1.3; }
.card-head p { margin-top: 2px; font-size: var(--t-sm); color: var(--muted); }
.card-body { padding: var(--s4); }
.card-body.flush { padding: 0; }
.card > :last-child { border-bottom-left-radius: var(--r-lg); border-bottom-right-radius: var(--r-lg); }
/* A card that folds away (set-up forms used once in a while). */
details.card > summary { list-style: none; cursor: pointer; border-bottom: 1px solid transparent; }
details.card > summary::-webkit-details-marker { display: none; }
details.card[open] > summary { border-bottom-color: var(--line); }
details.card > summary .chev { transition: transform var(--fast); color: var(--muted); }
details.card[open] > summary .chev { transform: rotate(180deg); }
details.card > summary:hover h3 { color: var(--ink); }

/* The four numbers on the Overview. */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); }
@media (max-width: 900px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat {
  display: block; width: 100%; text-align: left; color: inherit; cursor: pointer; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s3) var(--s4); background: var(--surface);
  transition: border-color var(--fast), background var(--fast);
}
.stat:hover { border-color: #444; background: var(--surface2); }
.stat .label { display: flex; align-items: center; gap: 6px; font-size: var(--t-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.stat .label svg { width: 13px; height: 13px; }
.stat .value { margin-top: 6px; font-size: var(--t-2xl); font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat .value small { font-size: var(--t-base); font-weight: 600; color: var(--muted); }
.stat .sub { margin-top: var(--s1); font-size: var(--t-sm); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 900px) { .stat .sub { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; } }
.stat.good .value { color: var(--good); }
.stat.bad { border-color: var(--bad-line); background: var(--bad-bg); }
.stat.bad .value { color: var(--bad); }
.stat.warn .value { color: var(--warn); }
/* in game / connecting / problem / off, as one bar */
.split { display: flex; gap: 2px; height: 6px; margin-top: var(--s2); border-radius: 999px; overflow: hidden; background: var(--input); }
.split i { display: block; min-width: 3px; transition: flex-grow var(--med) var(--ease); }
.split .good { background: var(--good); }
.split .warn { background: var(--warn); }
.split .bad { background: var(--bad); }
.split .idle { background: #4a4a4a; }

/* ------------------------------------------------------------ buttons */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
  min-height: calc(var(--tap) + 2px); border-radius: var(--r-md); font: 600 var(--t-md) var(--sans); padding: 0 14px; white-space: nowrap;
  border: 1px solid var(--line); background: transparent; color: var(--ink2); text-decoration: none;
  transition: background var(--fast), color var(--fast), border-color var(--fast), transform 80ms;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--ink); text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn:disabled, .btn[aria-disabled=true] { opacity: .45; pointer-events: none; }
.btn.primary { background: #fff; color: #000; border-color: #fff; }
.btn.primary:hover { background: rgba(255, 255, 255, 0.88); color: #000; }
.btn.danger { border-color: var(--bad-line); color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); color: var(--bad); }
.btn.success { border-color: var(--good-line); color: var(--good); }
.btn.success:hover { background: var(--good-bg); color: var(--good); }
.btn.danger.solid { background: #e5484d; border-color: #e5484d; color: #fff; }
.btn.danger.solid:hover { background: #d13c41; color: #fff; }
.btn.quiet { border-color: transparent; color: var(--muted); }
.btn.sm { min-height: var(--tap); padding: 0 10px; font-size: var(--t-sm); }
.btn.icon { min-height: var(--tap); min-width: var(--tap); padding: 0; }
/* Pressed and still working: a spinner where its icon was, and it cannot be pressed twice. */
.btn[data-busy] { pointer-events: none; opacity: .8; }
.btn[data-busy] > svg { display: none; }
.btn[data-busy]::before {
  content: ""; width: 13px; height: 13px; flex: none; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite;
}
.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* A small menu under a button (an account's "more"). Lives outside the lists, so a refresh never closes it. */
.menu {
  position: fixed; z-index: 70; min-width: 220px; max-width: min(320px, calc(100vw - 16px)); padding: var(--s1);
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--elevated);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55); animation: pop var(--fast) var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.menu-item {
  display: flex; width: 100%; align-items: flex-start; gap: 10px; min-height: var(--tap); padding: 8px 10px; border: 0; cursor: pointer;
  border-radius: var(--r-sm); background: transparent; color: var(--ink2); font: 600 var(--t-md) var(--sans); text-align: left;
}
.menu-item svg { margin-top: 2px; color: var(--muted); }
.menu-item small { display: block; margin-top: 1px; font-size: var(--t-xs); font-weight: 400; color: var(--muted); white-space: normal; }
.menu-item:hover, .menu-item:focus-visible { background: rgba(255, 255, 255, 0.07); color: var(--ink); }
.menu-item.danger, .menu-item.danger svg { color: var(--bad); }
.menu-item:disabled { opacity: .45; pointer-events: none; }
.menu-sep { height: 1px; margin: var(--s1) 0; background: var(--line); }
.only-sm { display: none !important; }
@media (max-width: 720px) { .menu-item.only-sm { display: flex !important; } .menu-sep.only-sm { display: block !important; } .hide-sm { display: none !important; } .acct .detail.minor { display: none; } }

/* ------------------------------------------------------------ fields */
.field { display: block; min-width: 0; }
.field > span { display: block; margin-bottom: 6px; font-size: var(--t-sm); font-weight: 600; color: var(--ink2); }
.field .hint, .hint { display: block; margin-top: var(--s1); font-size: var(--t-sm); color: var(--muted); font-weight: 400; line-height: 1.4; }
.field em { font-style: normal; font-weight: 400; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input[type=email], input[type=search], select, textarea {
  width: 100%; min-height: 40px; border-radius: var(--r-md); border: 1px solid #2b2e2b; background: var(--input); color: var(--ink);
  padding: 8px 12px; font: var(--t-base) var(--sans); transition: border-color var(--fast);
}
@media (pointer: coarse) { input[type=text], input[type=password], input[type=number], input[type=email], input[type=search], select, textarea { font-size: 16px; min-height: 44px; } }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: #3c403c; }
input:focus, select:focus, textarea:focus { border-color: var(--brand2); }
textarea { min-height: 110px; resize: vertical; font: var(--t-sm)/1.5 var(--mono); }
select { appearance: none; padding-right: 30px; text-overflow: ellipsis; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--s3) var(--s4); }

.toggle {
  display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap); font-size: var(--t-md); color: var(--ink2); cursor: pointer;
  user-select: none; border: 0; background: none; padding: 0; font-family: var(--sans); text-align: left; -webkit-tap-highlight-color: transparent;
}
.toggle .track { position: relative; width: 36px; height: 20px; border-radius: 999px; border: 1px solid #3a3a3a; background: var(--input); transition: var(--fast); flex-shrink: 0; }
.toggle .knob { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: var(--fast); }
.toggle.on .track { border-color: var(--brand2); background: rgba(59, 147, 255, 0.3); }
.toggle.on .knob { left: 18px; background: var(--brand2); }

/* ------------------------------------------------------------ status */
/* A state: its icon AND its word, tinted. Never the colour alone. */
.st {
  display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 9px 2px 7px; white-space: nowrap;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); font-size: var(--t-xs); font-weight: 700; color: var(--ink2);
}
.st svg { width: 13px; height: 13px; color: var(--muted); }
.st.good { border-color: var(--good-line); background: var(--good-bg); color: #b6f2c6; }
.st.good svg { color: var(--good); }
.st.warn { border-color: var(--warn-line); background: var(--warn-bg); color: #f4dc97; }
.st.warn svg { color: var(--warn); }
.st.bad { border-color: var(--bad-line); background: var(--bad-bg); color: #ffc0c0; }
.st.bad svg { color: var(--bad); }
.st.info { border-color: var(--info-line); background: var(--info-bg); color: #bfe9ff; }
.st.info svg { color: var(--info); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02); padding: 2px 9px; font-size: var(--t-xs); font-weight: 600; color: var(--ink2); white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.pill.good::before { background: var(--good); }
.pill.bad::before { background: var(--bad); }
.pill.warn::before { background: var(--warn); }
.pill.info::before { background: var(--info); }
.tag { display: inline-block; border-radius: 6px; padding: 1px 6px; font-size: 10.5px; font-weight: 700; border: 1px solid var(--line); color: var(--muted); text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }

/* A fact about something: small, quiet, in a row that wraps. */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%; border-radius: 6px; padding: 2px 7px;
  background: rgba(255, 255, 255, 0.045); font-size: var(--t-xs); font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums;
}
.chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip svg { width: 12px; height: 12px; }
.chip.warn { background: var(--warn-bg); color: var(--warn); font-weight: 700; }
.chip.bad { background: var(--bad-bg); color: var(--bad); font-weight: 700; }
.chip.good { background: var(--good-bg); color: var(--good); font-weight: 600; }
/* Chips you press: the filter over a list. */
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
/* (On a phone: one row that scrolls sideways inside itself, not three rows of chips.) */
@media (max-width: 720px) { .seg { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--s4)); padding: 0 var(--s4); } .seg::-webkit-scrollbar { display: none; } .seg button { flex: none; } }
.seg button {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--muted); font: 600 var(--t-sm) var(--sans);
  transition: background var(--fast), color var(--fast), border-color var(--fast);
}
.seg button b { font-weight: 700; color: var(--ink2); font-variant-numeric: tabular-nums; }
.seg button:hover { color: var(--ink); border-color: #444; }
.seg button.on { background: var(--elevated); border-color: #4a4a4a; color: var(--ink); }
.seg button svg { width: 13px; height: 13px; }

.banner { display: flex; gap: 10px; align-items: flex-start; border-radius: var(--r-md); padding: 10px 14px; font-size: var(--t-md); border: 1px solid var(--line); background: var(--surface2); color: var(--ink2); }
.banner > div { min-width: 0; overflow-wrap: anywhere; }
.banner.bad { border-color: var(--bad-line); background: var(--bad-bg); }
.banner.warn { border-color: var(--warn-line); background: var(--warn-bg); }
.banner.good { border-color: var(--good-line); background: var(--good-bg); }
.banner svg { margin-top: 2px; color: var(--muted); }
.banner.bad svg { color: var(--bad); }
.banner.warn svg { color: var(--warn); }
.banner.good svg { color: var(--good); }

/* How far along: a bar, and the figure beside it. */
.bar { height: 6px; border-radius: 999px; background: var(--input); overflow: hidden; min-width: 60px; box-shadow: inset 0 0 0 1px var(--line); }
.bar > i { display: block; height: 100%; background: var(--good); border-radius: 999px; transition: width var(--med) var(--ease); }
.bar.warn > i { background: var(--warn); }
.bar.info > i { background: var(--info); }
.bar.idle > i { background: #5a5a5a; }

/* ------------------------------------------------------------ lists */
/* Lists are rows of a grid, not tables: on a phone each row is a card of its own. */
.table-wrap { overflow-x: auto; }
.pager-top { display: flex; align-items: center; gap: var(--s2); padding: 10px var(--s4); border-bottom: 1px solid var(--line); }
.pager-top svg { flex: none; color: var(--muted); width: 15px; height: 15px; }
.pager-top input { flex: 1; min-width: 0; max-width: 360px; }
.pager-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; padding: 10px var(--s4); border-top: 1px solid var(--line); }
.pager-foot select { width: auto; min-height: var(--tap); padding-top: 4px; padding-bottom: 4px; font-size: var(--t-sm); }
table { width: 100%; border-collapse: collapse; font-size: var(--t-md); }
th { text-align: left; font-size: var(--t-xs); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; padding: 10px var(--s4); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px var(--s4); border-bottom: 1px solid var(--hair); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.empty { display: flex; flex-direction: column; align-items: center; gap: var(--s2); padding: 36px var(--s4); text-align: center; color: var(--muted); font-size: var(--t-md); }
.empty svg { width: 22px; height: 22px; color: var(--faint); }
.empty strong { color: var(--ink2); font-size: var(--t-base); }
.empty.bad { color: var(--bad); }

.rows > .r { border-bottom: 1px solid var(--hair); transition: background var(--fast); }
.rows > .r:last-child { border-bottom: 0; }
.rows > .r:hover { background: rgba(255, 255, 255, 0.018); }
.rows-head {
  display: grid; gap: var(--s4); padding: 9px var(--s4); border-bottom: 1px solid var(--line);
  font-size: var(--t-xs); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em;
}
.lbl { display: none; font-size: var(--t-xs); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who .names { min-width: 0; }
.who .n1 { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .n2 { font-size: var(--t-sm); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .n2.warn { color: var(--warn); font-weight: 600; }
.head { position: relative; width: 28px; height: 28px; border-radius: 6px; flex-shrink: 0; background: var(--elevated); overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: var(--muted); }
.head img { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.detail { font-size: var(--t-sm); color: var(--muted); overflow-wrap: anywhere; }
.detail.warn { color: var(--warn); font-weight: 600; }
/* A scheduled base on an account's row: one line, a Cancel link at its end. */
.detail.sched-line { color: var(--ink2); }
.detail.sched-line .lucide { width: 13px; height: 13px; vertical-align: -2px; }
button.link { background: none; border: 0; padding: 0 0 0 8px; font: inherit; color: var(--muted); text-decoration: underline; cursor: pointer; }
button.link:hover { color: var(--ink2); }
.actions-cell { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; align-items: center; }

/* --- accounts */
.acct, .acct-head { display: grid; grid-template-columns: minmax(170px, 1.1fr) minmax(260px, 2.6fr) minmax(130px, 0.8fr) 352px; gap: var(--s4); }
.acct { padding: var(--s3) var(--s4); align-items: start; }
.acct-state { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.acct-line { display: flex; align-items: flex-start; gap: var(--s2); min-width: 0; }
.acct-line .st { flex: none; }
.acct-doing { font-size: var(--t-md); font-weight: 600; color: var(--ink2); min-width: 0; overflow-wrap: anywhere; padding-top: 2px; }
.acct.off .acct-doing { color: var(--muted); font-weight: 500; }
.acct-proxy { min-width: 0; font-size: var(--t-sm); }
.acct-proxy .mono { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.acct .bar { max-width: 320px; }
@media (max-width: 1280px) {
  .acct-head { display: none; }
  .acct { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); grid-template-areas: "who state" "proxy state" "actions actions"; row-gap: var(--s2); }
  .acct > .who { grid-area: who; } .acct-state { grid-area: state; } .acct-proxy { grid-area: proxy; padding-left: 38px; }
  .acct .actions-cell { grid-area: actions; min-width: 0; justify-content: flex-start; }
  .acct-proxy .lbl { display: inline; margin-right: 6px; }
}
@media (max-width: 720px) {
  .acct { grid-template-columns: minmax(0, 1fr); grid-template-areas: "who" "state" "proxy" "actions"; }
  .acct-proxy { padding-left: 0; }
}

.code-box { display: inline-flex; align-items: center; gap: var(--s2); flex-wrap: wrap; align-self: flex-start; border: 1px solid var(--warn-line); background: var(--warn-bg); border-radius: var(--r-md); padding: 6px 8px 6px 12px; }
.code-box .code { font: 700 var(--t-lg) var(--mono); letter-spacing: 0.08em; color: var(--ink); user-select: all; }

/* --- the Overview's "what is each one doing" */
.minis { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.mini { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 52px; padding: 7px var(--s4); border-bottom: 1px solid var(--hair); border-right: 1px solid var(--hair);
  cursor: pointer; transition: background var(--fast); width: 100%; background: none; border-left: 0; border-top: 0; color: inherit; text-align: left; font: inherit; }
.mini:hover { background: rgba(255, 255, 255, 0.03); }
.mini .names { flex: 1; min-width: 0; }
.mini .n1 { font-weight: 700; font-size: var(--t-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini .n2 { font-size: var(--t-sm); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini.working .n2 { color: var(--ink2); }
.mini.bad .n2 { color: #ffb3b3; }
.mini.warn .n2 { color: #ecd28a; }
@media (max-width: 720px) { .minis { grid-template-columns: minmax(0, 1fr); } .mini { border-right: 0; } }

/* --- what needs a person */
.needs .n { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--hair); }
.needs .n:last-child { border-bottom: 0; }
.needs .n > svg { margin-top: 2px; width: 18px; height: 18px; }
.needs .n.bad > svg { color: var(--bad); }
.needs .n.warn > svg { color: var(--warn); }
.needs .n .body { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: var(--t-md); color: var(--ink2); }
.needs .n .body strong { color: var(--ink); }
.needs .n .meta { margin-top: 3px; font-size: var(--t-sm); color: var(--muted); }
.needs .n .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; flex: none; }
@media (max-width: 720px) { .needs .n { flex-wrap: wrap; } .needs .n .body { flex-basis: calc(100% - 34px); } .needs .n .acts { margin-left: 30px; justify-content: flex-start; } }
.allgood { display: flex; align-items: center; gap: 10px; padding: var(--s3) var(--s4); color: var(--ink2); font-size: var(--t-md); }
.allgood svg { color: var(--good); width: 18px; height: 18px; }

/* --- alerts */
.alert-list .a { display: flex; gap: 10px; align-items: flex-start; padding: 10px var(--s4); border-bottom: 1px solid var(--hair); font-size: var(--t-md); }
.alert-list .a:last-child { border-bottom: 0; }
.alert-list .a > svg { margin-top: 2px; color: var(--muted); }
.alert-list .a.danger > svg { color: var(--bad); }
.alert-list .a.warn > svg { color: var(--warn); }
.alert-list .a.good > svg { color: var(--good); }
.alert-list .a .body { flex: 1; min-width: 0; overflow-wrap: anywhere; color: var(--ink2); }
.alert-list .a .t { flex: none; color: var(--muted); font-size: var(--t-xs); white-space: nowrap; padding-top: 2px; font-variant-numeric: tabular-nums; }
.alert-list .a.unacked { background: var(--bad-bg); }
.alert-list .a .solved { margin-top: 3px; font-size: var(--t-sm); color: var(--good); }
.player-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.player-chip { font-size: var(--t-sm); padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.player-chip.bad { border-color: var(--bad-line); color: var(--bad); }
.player-chip.good { border-color: var(--good-line); color: var(--good); }

/* --- proxies */
.px, .px-head { display: grid; grid-template-columns: minmax(200px, 1.6fr) minmax(110px, 1fr) minmax(110px, 0.9fr) minmax(90px, 0.7fr) minmax(130px, 1.3fr) auto; gap: var(--s4); }
.px { padding: 10px var(--s4); align-items: center; font-size: var(--t-md); }
.px-head > :last-child, .px .actions-cell { min-width: 118px; }
.px-addr { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.px-addr .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.px > div { min-width: 0; }
@media (max-width: 900px) {
  .px-head { display: none; }
  .px { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "addr test" "used used" "ip speed" "actions actions"; gap: 6px var(--s3); padding: var(--s3) var(--s4); }
  .px-addr { grid-area: addr; } .px-test { grid-area: test; justify-self: end; text-align: right; } .px-used { grid-area: used; } .px-ip { grid-area: ip; } .px-speed { grid-area: speed; justify-self: end; }
  .px .actions-cell { grid-area: actions; justify-content: flex-start; }
  .px .lbl { display: inline; margin-right: 6px; }
}

/* --- function runs */
.run, .run-head { display: grid; grid-template-columns: 96px minmax(110px, 1fr) minmax(110px, 1fr) minmax(0, 3fr); gap: var(--s4); }
.run { padding: 10px var(--s4); align-items: center; font-size: var(--t-md); }
.run > div { min-width: 0; }
.run-result { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.run-result .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
@media (max-width: 720px) {
  .run-head { display: none; }
  .run { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "fn when" "who who" "res res"; gap: 4px var(--s3); padding: var(--s3) var(--s4); }
  .run-when { grid-area: when; } .run-who { grid-area: who; } .run-fn { grid-area: fn; } .run-result { grid-area: res; flex-wrap: wrap; }
  .run-result .muted { white-space: normal; }
}

/* ------------------------------------------------------------ functions */
.fn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s3); }
.fn { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; display: flex; flex-direction: column; gap: var(--s2); background: var(--surface); }
.fn h4 { font-size: var(--t-base); font-weight: 700; }
.fn p { font-size: var(--t-sm); color: var(--muted); flex: 1; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.fn .meta { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); }
.fn .meta .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; color: var(--faint); }
.category { margin: 6px 0 -4px; font-size: var(--t-xs); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

.check-list { display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s1); overscroll-behavior: contain; }
.check-list label { display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 4px 8px; border-radius: var(--r-sm); cursor: pointer; font-size: var(--t-md); min-width: 0; }
.check-list label > span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.check-list label .why { margin-left: auto; font-size: var(--t-xs); color: var(--muted); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 0 1 auto; }
.check-list label:hover { background: rgba(255, 255, 255, 0.04); }
.check-list label.off { opacity: .55; cursor: not-allowed; }
input[type=checkbox] { accent-color: var(--brand2); width: 16px; height: 16px; flex: none; }

.result { border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 12px; font-size: var(--t-md); display: flex; gap: 10px; align-items: flex-start; overflow-wrap: anywhere; }
.result.ok { border-color: var(--good-line); }
.result.ok > svg { color: var(--good); }
.result.fail { border-color: var(--bad-line); }
.result.fail > svg { color: var(--bad); }
.result pre { margin: 6px 0 0; max-height: 220px; overflow: auto; font: var(--t-sm)/1.5 var(--mono); color: var(--ink2); white-space: pre-wrap; word-break: break-word; }

/* ------------------------------------------------------------ logs */
.log-tools { display: grid; grid-template-columns: minmax(130px, 200px) minmax(110px, 150px) minmax(140px, 1fr) auto; gap: var(--s2); align-items: center; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
.log-tools .row { flex-wrap: nowrap; }
@media (max-width: 900px) { .log-tools { grid-template-columns: 1fr 1fr; } .log-tools > input { grid-column: 1 / -1; } .log-tools > .row { grid-column: 1 / -1; justify-content: space-between; } }
.log-wrap { position: relative; }
.logs { height: calc(100vh - 250px); height: calc(100dvh - 250px); min-height: 300px; overflow: auto; font: var(--t-sm)/1.55 var(--mono); padding: 10px 14px; background: var(--frame); border-radius: 0 0 var(--r-lg) var(--r-lg); overscroll-behavior: contain; }
@media (max-width: 1023px) { .logs { height: calc(100dvh - 330px); } }
.logs .l { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 0 10px; padding: 1px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.logs .t { color: var(--faint); font-variant-numeric: tabular-nums; }
.logs .s { color: var(--info); max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logs .m { color: var(--ink2); min-width: 0; }
.logs .warn .m { color: var(--warn); }
.logs .error .m { color: var(--bad); }
/* A very long line shows its first three; a press opens it (and closes it again). */
.logs .l.long { cursor: pointer; }
.logs .l.long .m { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.logs .l.long.open .m { display: block; }
.logs .l.long .m::after { content: " …more"; color: var(--brand2); }
.logs .l.long.open .m::after { content: ""; }
@media (max-width: 720px) {
  .logs { padding: 8px 12px; }
  .logs .l { grid-template-columns: auto minmax(0, 1fr); padding: 4px 0; border-bottom: 1px solid var(--hair); }
  .logs .m { grid-column: 1 / -1; }
}
.log-new {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 2; display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--brand2); background: #10294a; color: #fff; cursor: pointer;
  font: 700 var(--t-sm) var(--sans); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5); animation: pop var(--fast) var(--ease);
}
.mini-log { font: var(--t-sm)/1.6 var(--mono); max-height: 330px; overflow: auto; padding: 10px 14px; }
.mini-log .l { display: flex; gap: 10px; white-space: nowrap; overflow: hidden; }
.mini-log .t { color: var(--faint); flex: none; }
.mini-log .m { overflow: hidden; text-overflow: ellipsis; color: var(--ink2); }
.mini-log .warn .m { color: var(--warn); }
.mini-log .error .m { color: var(--bad); }

/* ------------------------------------------------------------ modal / toast / login */
.modal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: var(--s4); background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(3px); animation: fade var(--fast) linear; }
@keyframes fade { from { opacity: 0; } }
.modal-box { display: flex; flex-direction: column; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); animation: rise var(--med) var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.modal-box > div:not(.card-head):not(.modal-foot), .modal-box > .modal-scroll { overflow: auto; min-height: 0; overscroll-behavior: contain; }
.modal-box > div:only-child { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.modal-box > div:only-child > .card-body, .modal-box > div:only-child > .chat-box { overflow: auto; min-height: 0; overscroll-behavior: contain; }
.modal-box .card-head, .modal-box .modal-foot { flex: none; }
.modal-box.wide { max-width: 760px; }
.modal-foot { display: flex; justify-content: flex-end; gap: var(--s2); padding: var(--s3) var(--s4); border-top: 1px solid var(--line); flex-wrap: wrap; }
/* "Are you sure?" — above everything but the toasts, an open modal included. */
.modal.confirm-layer { z-index: 85; }
.modal-box.narrow { max-width: 480px; }
.confirm-title { display: flex; gap: 10px; align-items: center; min-width: 0; }
.confirm-title svg { flex: none; color: var(--warn); }
.confirm-title.danger svg { color: var(--bad); }
.confirm-text { color: var(--ink2); font-size: var(--t-md); line-height: 1.55; white-space: pre-line; }
.confirm-names { display: flex; flex-wrap: wrap; gap: 6px; max-height: 132px; overflow: auto; }
.confirm-list { display: flex; flex-direction: column; gap: 2px; max-height: 190px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-md); padding: 6px 10px; font-size: var(--t-sm); }
.confirm-list div { display: flex; gap: var(--s2); justify-content: space-between; padding: 3px 0; }
.confirm-list div span:last-child { color: var(--warn); text-align: right; }
.confirm-tick { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--bad-line); border-radius: var(--r-md); background: var(--bad-bg); font-size: var(--t-md); cursor: pointer; }
.confirm-tick input { margin-top: 2px; }
@media (max-width: 640px) {
  /* A dialog on a phone is a sheet from the bottom: its buttons under the thumb, never off the screen. */
  .modal { align-items: flex-end; padding: 0; }
  .modal-box, .modal-box.wide, .modal-box.narrow { max-width: none; max-height: calc(100dvh - 24px); border-radius: 18px 18px 0 0; border-left: 0; border-right: 0; border-bottom: 0; animation-name: sheet; }
  .modal-foot { padding-bottom: calc(var(--s3) + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1 1 auto; min-height: 44px; }
}
@keyframes sheet { from { transform: translateY(40px); opacity: .4; } }

.toasts { position: fixed; right: var(--s4); bottom: var(--s4); z-index: 90; display: flex; flex-direction: column; gap: var(--s2); align-items: flex-end; pointer-events: none; max-width: min(440px, calc(100vw - 32px)); }
@media (max-width: 1023px) { .toasts { left: var(--s4); right: var(--s4); bottom: calc(72px + env(safe-area-inset-bottom)); max-width: none; align-items: stretch; } }
.toast { pointer-events: auto; border: 1px solid var(--line); background: var(--elevated); border-radius: var(--r-md); padding: 10px 8px 10px 14px; font-size: var(--t-md); display: flex; gap: 10px; align-items: flex-start; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5); animation: rise var(--med) var(--ease); overflow-wrap: anywhere; }
.toast > svg { margin-top: 2px; color: var(--info); }
.toast.good > svg { color: var(--good); }
.toast.bad { border-color: var(--bad-line); }
.toast.bad > svg { color: var(--bad); }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity var(--med), transform var(--med); }
.toast .x { flex: none; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px 6px; border-radius: 6px; min-height: 24px; }
.toast .x:hover { color: var(--ink); }

.login { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: var(--page); padding: var(--s4); }
.login .card { width: 100%; max-width: 360px; }
.dot-grid { background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px); background-size: 22px 22px; }

.chat-box { height: 360px; max-height: 50dvh; overflow: auto; font: var(--t-sm)/1.55 var(--mono); padding: 10px 14px; background: var(--frame); border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.chat-box .bar { color: var(--warn); height: auto; background: none; box-shadow: none; border-radius: 0; overflow: visible; }

/* ------------------------------------------------------------ live / offline / alerts on every page */
/* The server cannot be reached (a restart, the connection): says so, and goes when it is back. */
.conn-bar { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 95; display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 24px);
  padding: 9px 16px; border-radius: 999px; border: 1px solid var(--warn-line); background: #2a2413; color: var(--ink);
  font-size: var(--t-sm); font-weight: 600; box-shadow: 0 8px 26px rgba(0, 0, 0, 0.55); animation: pop var(--med) var(--ease); }
.conn-bar svg { color: var(--warn); }
/* What is on the page is old: said, and shown. */
body.stale main { opacity: 0.62; transition: opacity var(--med); }
.alert-bar { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; margin-bottom: var(--s4); padding: 10px var(--s3) 10px var(--s4); border-radius: var(--r-md);
  border: 1px solid var(--bad-line); background: rgba(255, 92, 92, 0.13); color: var(--ink); font-size: var(--t-md); animation: alert-pulse 1.4s ease-in-out 3; }
.alert-bar > svg { color: var(--bad); flex: none; }
.alert-bar .grow { min-width: 0; flex: 1 1 240px; overflow-wrap: anywhere; }
.alert-bar .more { color: var(--muted); font-size: var(--t-sm); margin-top: 2px; }
.alert-bar .grow { cursor: pointer; }
.alert-bar .msg { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 720px) { .alert-bar { flex-wrap: nowrap; padding: 8px 8px 8px 12px; gap: 10px; } .alert-bar .grow { flex: 1 1 0; } .alert-bar .row { flex-wrap: nowrap; flex: none; } .alert-bar .btn { min-width: var(--tap); padding: 0 10px; } }
@keyframes alert-pulse { 50% { background: rgba(255, 92, 92, 0.26); } }

/* ------------------------------------------------------------ first load */
.skel { display: block; border-radius: var(--r-sm); background: linear-gradient(90deg, #1a1a1a 25%, #242424 37%, #1a1a1a 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; }
@keyframes shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }
.skel-rows { display: flex; flex-direction: column; gap: 14px; padding: var(--s4); }
.skel-rows .skel { height: 18px; }
.skel-rows .skel:nth-child(2) { width: 82%; }
.skel-rows .skel:nth-child(3) { width: 64%; }
.skel-rows .skel:nth-child(4) { width: 74%; }
.skel.tile { height: 92px; border-radius: var(--r-lg); }

/* ------------------------------------------------------------ settings */
.save-bar { position: sticky; bottom: var(--s4); z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap;
  padding: 10px var(--s3) 10px var(--s4); border: 1px solid var(--brand2); border-radius: var(--r-lg); background: #0f1c2e; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55); animation: rise var(--med) var(--ease); }
@media (max-width: 1023px) { .save-bar { bottom: calc(76px + env(safe-area-inset-bottom)); } }

/* ------------------------------------------------------------ schematics */
.job > .card-head { cursor: default; }
.job-title { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; min-width: 0; }
.job-title h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.job-fold { border: 0; background: none; color: inherit; padding: 0; cursor: pointer; display: flex; align-items: center; gap: var(--s2); min-width: 0; min-height: var(--tap); text-align: left; font: inherit; }
.job-fold .chev { color: var(--muted); transition: transform var(--fast); flex: none; }
.job.open .job-fold .chev { transform: rotate(180deg); }
.job-line { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; padding: 10px var(--s4); font-size: var(--t-md); color: var(--ink2); }
.job-line .bar { flex: 1 1 140px; max-width: 280px; }
.job.st-done:not(.open), .job.st-stopped:not(.open) { background: var(--bg); }

.sc-steps { display: flex; gap: 3px; }
.sc-step { flex: 1; min-width: 0; padding-top: 7px; border-top: 3px solid #2c2c2c; font-size: var(--t-xs); font-weight: 600; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-step.done { border-top-color: var(--good); color: var(--muted); }
.sc-step.now { border-top-color: var(--brand2); color: var(--ink); }
.sc-step.now.wait { border-top-color: var(--warn); }
@media (max-width: 720px) { .sc-step { font-size: 0; padding-top: 0; } .sc-step.now { flex: 4; font-size: var(--t-xs); padding-top: 7px; } }

.sc-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s2); }
.sc-kv > div { border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 12px; min-width: 0; }
.sc-kv .k { font-size: var(--t-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.sc-kv .v { margin-top: 2px; font-size: var(--t-lg); font-weight: 700; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-kv .v small { font-size: var(--t-sm); font-weight: 500; color: var(--muted); }
.sc-kv .v.sm { font-size: var(--t-sm); font-weight: 600; white-space: normal; overflow-wrap: anywhere; }
.sc-kv .bar { margin-top: 6px; }
.sc-kv .wide { grid-column: span 2; }
@media (max-width: 520px) { .sc-kv { grid-template-columns: 1fr 1fr; } .sc-kv .wide { grid-column: 1 / -1; } }

/* A part of a job card with its own heading. */
.sc-part { border: 1px solid var(--line); border-radius: var(--r-md); min-width: 0; }
.sc-part > header, .sc-part > summary { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; padding: 9px 12px; font-size: var(--t-md); font-weight: 700; min-height: 42px; }
.sc-part > summary { cursor: pointer; list-style: none; }
.sc-part > summary::-webkit-details-marker { display: none; }
.sc-part > summary .chev { margin-left: auto; color: var(--muted); transition: transform var(--fast); }
.sc-part[open] > summary .chev { transform: rotate(180deg); }
.sc-part > header .sub, .sc-part > summary .sub { font-weight: 500; color: var(--muted); font-size: var(--t-sm); }
.sc-part > header > svg, .sc-part > summary > svg:first-child { color: var(--muted); }
.sc-part.bad { border-color: var(--bad-line); }
.sc-part.bad > header > svg, .sc-part.bad > summary > svg:first-child { color: var(--bad); }
.sc-part.good { border-color: var(--good-line); }
.sc-part.good > header > svg { color: var(--good); }
.sc-part.warn { border-color: var(--warn-line); }
.sc-part.warn > header > svg { color: var(--warn); }
.sc-part > .body { border-top: 1px solid var(--line); }
.sc-part .pad { padding: 10px 12px; }

/* the strips, one bot each */
.strip, .strip-head { display: grid; grid-template-columns: minmax(150px, 1.1fr) minmax(120px, 0.8fr) minmax(150px, 1.2fr) minmax(0, 2.2fr); gap: var(--s3) var(--s4); }
.strip { padding: 10px 12px; align-items: start; border-bottom: 1px solid var(--hair); font-size: var(--t-md); }
.strip:last-child { border-bottom: 0; }
.strip-head { padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: var(--t-xs); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.strip > div { min-width: 0; }
.strip .who .head { width: 24px; height: 24px; }
.strip-now { display: flex; flex-direction: column; gap: 3px; }
.strip-now .now { color: var(--ink2); font-weight: 600; }
.strip-now .last { color: var(--muted); font-size: var(--t-sm); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.strip-prog .cap { margin-top: var(--s1); font-size: var(--t-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
.strip-stage { display: flex; flex-direction: column; gap: var(--s1); align-items: flex-start; }
@media (max-width: 900px) {
  .strip-head { display: none; }
  .strip { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "who stage" "prog prog" "now now"; }
  .strip > .who { grid-area: who; } .strip-stage { grid-area: stage; align-items: flex-end; } .strip-prog { grid-area: prog; } .strip-now { grid-area: now; }
}

/* what is still wrong, by block */
.wrong-group { border-bottom: 1px solid var(--hair); }
.wrong-group:last-child { border-bottom: 0; }
.wrong-group > summary { display: flex; align-items: center; gap: var(--s2); min-height: 40px; padding: 6px 12px; cursor: pointer; list-style: none; font-size: var(--t-md); }
.wrong-group > summary::-webkit-details-marker { display: none; }
.wrong-group > summary b { min-width: 2.2em; text-align: right; color: var(--bad); font-variant-numeric: tabular-nums; }
.wrong-group > summary .name { font-weight: 700; }
.wrong-group > summary .why { color: var(--muted); font-size: var(--t-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.wrong-group > summary .chev { color: var(--muted); transition: transform var(--fast); flex: none; }
.wrong-group[open] > summary .chev { transform: rotate(180deg); }
.wrong-group[open] > summary .why { visibility: hidden; }
.cell { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px var(--s3); padding: 6px 12px 6px 46px; font-size: var(--t-sm); border-top: 1px solid var(--hair); align-items: baseline; }
.cell .why { color: var(--muted); overflow-wrap: anywhere; }
.cell .why button { border: 0; background: none; color: var(--brand2); cursor: pointer; padding: 0 0 0 4px; font: inherit; }
.coord { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--input); color: var(--ink2); cursor: pointer; padding: 2px 7px; font: 600 var(--t-sm) var(--mono); white-space: nowrap; min-height: 26px; }
.coord:hover { border-color: var(--brand2); color: var(--ink); }
.coord svg { width: 12px; height: 12px; color: var(--muted); }
@media (pointer: coarse) { .coord { min-height: 40px; padding: 2px 10px; } .cell .why button { display: inline-flex; align-items: center; min-height: 40px; padding: 0 10px; vertical-align: middle; } }
@media (max-width: 640px) { .cell { grid-template-columns: minmax(0, 1fr); padding-left: 12px; } }

/* the job's own log */
.issue { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border-bottom: 1px solid var(--hair); font-size: var(--t-md); }
.issue:last-child { border-bottom: 0; }
.issue > svg { margin-top: 2px; color: var(--muted); }
.issue.bad > svg { color: var(--bad); }
.issue.good > svg { color: var(--good); }
.issue .body { flex: 1; min-width: 0; overflow-wrap: anywhere; color: var(--ink2); }
.issue .body .more { margin-top: 3px; color: var(--muted); font-size: var(--t-sm); }
.issue .body ul { margin: 4px 0 0; padding-left: 18px; color: var(--muted); font-size: var(--t-sm); }
.issue .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; align-items: center; }
.issue .t { flex: none; color: var(--muted); font-size: var(--t-xs); white-space: nowrap; padding-top: 2px; font-variant-numeric: tabular-nums; }
.sc-scroll { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
.sc-result { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; }
.sc-result .fig { font-size: var(--t-xl); font-weight: 700; font-variant-numeric: tabular-nums; }
.sc-result .fig small { font-size: var(--t-md); font-weight: 500; color: var(--muted); }
.sc-result .bar { flex: 1 1 160px; }
.file-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s2) var(--s3); align-items: center; padding: 10px var(--s4); border-bottom: 1px solid var(--hair); }
.file-row:last-child { border-bottom: 0; }
.file-row .n1 { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .n2 { font-size: var(--t-sm); color: var(--muted); }

/* ------------------------------------------------------------ intruders (intruders.js) */
/* The filters over the list: account, player, and what kind — on a phone the kinds get a row of their own. */
.in-tools { display: grid; grid-template-columns: minmax(130px, 220px) minmax(130px, 220px) minmax(0, 1fr); gap: var(--s2); align-items: center; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
.in-tools .seg { justify-content: flex-end; }
@media (max-width: 900px) { .in-tools { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .in-tools .seg { grid-column: 1 / -1; justify-content: flex-start; } }
/* Who was seen: one to press per player. */
.in-seen { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s2); }
.in-who { display: flex; flex-direction: column; gap: 5px; min-width: 0; min-height: var(--tap); text-align: left; cursor: pointer; color: inherit; font: inherit; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface2); padding: 10px 12px; transition: border-color var(--fast), background var(--fast); }
.in-who:hover { border-color: #444; background: var(--elevated); }
.in-who.on { border-color: var(--brand2); background: var(--elevated); }
.in-who .n1 { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.in-who .n2 { font-size: var(--t-sm); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.in-more { display: flex; justify-content: center; margin-top: var(--s3); }
/* One record (a row of .alert-list): what happened, a smaller line, the coordinates to press. */
.in-row .what strong { color: var(--ink); }
.in-row .sub { margin-top: 2px; font-size: var(--t-sm); color: var(--muted); }
.in-row .ats { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 7px; align-items: center; }
.in-row .at { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font-size: var(--t-sm); color: var(--muted); }
.in-row .at > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.in-row .t { text-align: right; }
.in-row .t small { display: block; margin-top: 2px; font-size: var(--t-xs); color: var(--muted); }

/* ------------------------------------------------------------ less motion, when asked for */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .btn[data-busy]::before, .spin { animation-duration: 1.6s !important; animation-iteration-count: infinite !important; }
}

/* --- the Operations page (ops.js) */
.op-units { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s3); }
.op-unit { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s3); min-width: 0; }
.op-b { display: grid; grid-template-columns: minmax(150px, 1.2fr) 150px 120px 170px minmax(160px, 2fr) 110px; gap: var(--s4); align-items: center; padding: 9px var(--s4); }
.rows-head.op-b { padding-top: 9px; padding-bottom: 9px; }
.op-prog { display: flex; flex-direction: column; gap: 4px; }
.op-spots { display: flex; flex-direction: column; gap: 6px; }
.op-events { display: flex; flex-direction: column; gap: 4px; font-size: var(--t-sm); }
.op-ev { display: flex; gap: var(--s2); align-items: baseline; color: var(--ink2); }
.op-ev.good span:last-child { color: var(--good); }
.op-ev.bad span:last-child { color: var(--bad); }
@media (max-width: 900px) { .op-b { grid-template-columns: minmax(0, 1fr); gap: 6px; } .rows-head.op-b { display: none; } }

/* ---- accounts from tokens (Accounts → Add accounts → From tokens) ---- */
.tok-wrap { overflow: auto; max-height: 440px; border: 1px solid var(--line); border-radius: 10px; }
.tok-table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.tok-table th, .tok-table td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--hair); vertical-align: top; white-space: nowrap; }
.tok-table td.wrap { white-space: normal; min-width: 220px; }
.tok-table th { position: sticky; top: 0; background: var(--surface2); color: var(--muted); font-weight: 600; z-index: 1; }
.tok-table tr:last-child td { border-bottom: 0; }
.tok-table .bad { color: var(--bad); }
.tok-table .warn { color: var(--warn); }
.tok-table .good { color: var(--good); }
.tok-sum { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
@media (max-width: 720px) { .tok-table th, .tok-table td { padding: 5px 7px; } }

/* ---- the Brain page (brain.js): problems the bots handled, and what needs a person ---- */
.br-people { border-color: var(--bad-line); background: var(--bad-bg); }
.br-people .card-head h3 { color: var(--bad); }
.br-ok .card-body { gap: var(--s2); color: var(--good); }
.br-ok .card-body svg { width: 16px; height: 16px; }
.br-ok .card-body .muted { color: var(--muted); }
.br-list { display: flex; flex-direction: column; }
.br-person { display: flex; align-items: center; gap: var(--s3); padding: 10px 16px; border-top: 1px solid var(--bad-line); }
.br-person:first-child { border-top: 0; }
.br-person > svg { width: 16px; height: 16px; color: var(--bad); flex-shrink: 0; }
.br-person .small { color: var(--ink2); overflow-wrap: anywhere; }
.br-steps { display: flex; flex-wrap: wrap; gap: 4px; }
.br-step { font-size: var(--t-xs); padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.br-step.ok { color: var(--good); border-color: var(--good-line); background: var(--good-bg); }
.br-step.no { color: var(--muted); }
.br-sub { font-size: var(--t-sm); font-weight: 700; color: var(--ink2); margin-top: 4px; }
.br-ladder { display: flex; flex-direction: column; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--hair); }
.br-ladder:last-child { border-bottom: 0; padding-bottom: 0; }
.br-wrap { max-height: 420px; }
@media (max-width: 720px) { .br-person { padding: 10px 12px; flex-wrap: wrap; } .br-person .grow { flex-basis: calc(100% - 40px); } }

/* ================================================================ the farm (farm.js) */
.stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.farm-chart-wrap { width: 100%; overflow: hidden; }
.farm-chart { width: 100%; height: auto; display: block; }
.farm-chart rect { fill: var(--brand); opacity: .75; transition: opacity var(--fast) var(--ease); }
.farm-chart rect.now { fill: var(--good); opacity: .9; }
.farm-chart rect:hover { opacity: 1; }
.farm-chart text { fill: var(--muted); font-size: 11px; }
.farm-row { display: grid; grid-template-columns: minmax(170px, 1.1fr) minmax(220px, 2fr) minmax(120px, .8fr) minmax(110px, .7fr) auto; gap: var(--s4); align-items: center; }
.farm-row.off { opacity: .62; }
.farm-row .farm-base, .farm-row .farm-num { min-width: 0; }
.farm-row .farm-base > div, .farm-row .farm-num > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1000px) {
  .farm-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .farm-row .actions-cell { grid-column: 1 / -1; justify-content: flex-start; }
}
.farm-sale { display: grid; grid-template-columns: 150px minmax(120px, 1fr) 140px minmax(0, 2fr); gap: var(--s3); align-items: center; }
.farm-sale > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) { .farm-sale { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; max-height: 320px; overflow: auto; padding: 2px; }
.pick { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--edge); border-radius: var(--r-sm); background: var(--input); cursor: pointer; }
.pick input { grid-row: 1 / span 2; }
.pick:hover { border-color: var(--line); }
.pick:has(input:checked) { border-color: var(--brand); background: rgba(0, 112, 243, .08); }
.pick.taken { opacity: .5; cursor: not-allowed; }
textarea { width: 100%; resize: vertical; background: var(--input); color: var(--ink); border: 1px solid var(--edge); border-radius: var(--r-sm); padding: 8px 10px; font: inherit; }
.farm-row, .farm-sale { padding: 10px 16px; border-bottom: 1px solid var(--hair); }
.farm-row:last-child, .farm-sale:last-child { border-bottom: 0; }
.farm-sale > .pill, .farm-sale > .btn { justify-self: start; }
