/* ══ tokens ══════════════════════════════════════════════════════════════
   Pokedex theme: Pokeball red accent over a deep navy screen.

   The chart series are type-flavoured (grass / fire / water) but were picked
   by running the data-viz validator, not by eye — the obvious literal type
   colours (electric yellow especially) fail the lightness band and the CVD
   floors. Both sets below clear every gate against their own surface:
     dark  #1fa06b,#e8553a,#4a90e2 — worst adjacent CVD ΔE 8.3, normal 28.9
     light #128a5c,#d1441f,#2a78d6 — worst adjacent CVD ΔE 9.3, normal 27.4
   Series order is load-bearing (adjacency is what's validated) — reordering
   them means re-running scripts/validate_palette.js.

   Status colours stay the reserved good/warning/serious/critical steps and
   always ship with a text label, never colour alone. */

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a1229;
  --surface: #121d3d;
  --surface-2: #1a2850;
  --surface-3: #26365f;
  --border: rgba(255, 255, 255, .12);
  --hairline: #1f2c52;
  --text: #ffffff;
  --text-2: #c3cbe0;
  --muted: #8a95b3;
  --series-1: #1fa06b;   /* grass — in stock   */
  --series-2: #e8553a;   /* fire  — deal       */
  --series-3: #4a90e2;   /* water — price drop */
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  /* Red: 3.56:1 on the surface (icons) and 4.65:1 under white (button text). */
  --accent: #e51c1c;
  --accent-ink: #ffffff;
  /* Blue: chrome only — links, focus rings, the paired gradient. Deliberately
     a lighter step than --series-3 so page furniture never reads as a mark. */
  --accent-2: #5b9ff0;
  --shadow: 0 1px 2px rgba(0,0,0,.45), 0 8px 24px -12px rgba(3,8,22,.75);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eaf0fb;
  --surface: #ffffff;
  --surface-2: #e4ebf8;
  --surface-3: #cfdcf2;
  --border: rgba(10, 18, 41, .12);
  --hairline: #dde6f5;
  --text: #0a1229;
  --text-2: #46536e;
  --muted: #6f7c99;
  --series-1: #128a5c;
  --series-2: #d1441f;
  --series-3: #2a78d6;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --accent: #c41e25;
  --accent-ink: #ffffff;
  --accent-2: #1e63c4;
  --shadow: 0 1px 2px rgba(10,18,41,.07), 0 8px 24px -14px rgba(10,18,41,.22);
}

/* The Red-and-Blue pairing, used wherever the theme signs its name. */
:root { --rb: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%); }

/* The ball keeps its own red/white/black regardless of theme — it reads as a
   pokeball or it doesn't. */
:root {
  --ball-top: #e51c1c;
  --ball-body: #f6f8fb;
  --ball-line: #14181f;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, figure { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }

svg.ico {
  width: 16px; height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Focus takes the blue half of the pair. A red ring on a text input reads as a
   validation error, which is exactly the wrong signal for "you're here now". */
:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
  border-radius: 4px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: 6px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-track { background: transparent; }

/* ══ login ═══════════════════════════════════════════════════════════════ */

.login-screen {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  /* Red from above, blue from the lower left — the pair, as atmosphere. */
  background:
    radial-gradient(55rem 28rem at 62% -12%, color-mix(in oklab, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(50rem 30rem at 8% 108%, color-mix(in oklab, var(--accent-2) 20%, transparent), transparent 72%),
    var(--bg);
}

/* Oversized pokeball watermark bleeding off the bottom-right. */
.login-screen::after {
  content: "";
  position: absolute;
  right: -14vmin; bottom: -22vmin;
  width: 62vmin; height: 62vmin;
  pointer-events: none;
  opacity: .06;
  background: no-repeat center/contain
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='11' fill='none' stroke='%23ffffff' stroke-width='1.1'/%3E%3Cpath d='M1 12h22' stroke='%23ffffff' stroke-width='1.6'/%3E%3Ccircle cx='12' cy='12' r='3.6' fill='none' stroke='%23ffffff' stroke-width='1.6'/%3E%3C/svg%3E");
}
:root[data-theme="light"] .login-screen::after {
  opacity: .10;
  filter: invert(1);
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
  position: relative;
  overflow: hidden;
  z-index: 1;
}
.login-card::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--rb);
}

.login-brand {
  display: flex; align-items: center; gap: 9px;
  font-size: 19px; font-weight: 640; letter-spacing: -.02em;
}
.login-sub { color: var(--muted); font-size: 13px; margin-top: -10px; }

/* ══ shell ═══════════════════════════════════════════════════════════════ */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex: none;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex; align-items: center; gap: 9px;
  padding: 0 8px 18px;
  margin-bottom: 8px;
  font-size: 16px; font-weight: 640; letter-spacing: -.02em;
  position: relative;
}
/* Red-to-blue hairline under the wordmark. */
.brand::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg,
    var(--accent) 0%, var(--accent-2) 62%, transparent 100%);
}
.logo-text { color: var(--text); }

/* The pokeball mark. Its own class, not .ico — .ico forces fill:none and
   stroke:currentColor, which would erase the two-tone fill. */
.ball { flex: none; display: block; width: 22px; height: 22px; }
.login-brand .ball { width: 26px; height: 26px; }
.thumb-ph .ball { width: 22px; height: 22px; opacity: .55; }
.empty .ball { width: 38px; height: 38px; opacity: .45; margin-bottom: 2px; }

.nav { display: grid; gap: 2px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background .12s ease, color .12s ease;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--surface-2); color: var(--text); font-weight: 560; }
.nav-item.active .ico { color: var(--accent); }

/* Pokedex-style selection rail on the active row. */
.nav-item { position: relative; }
.nav-item.active::before {
  content: "";
  position: absolute; left: -14px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px; font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.sidebar-foot { margin-top: auto; display: grid; gap: 10px; }

.conn {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 10px;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 12px;
  color: var(--muted);
}
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted);
  flex: none;
}
.dot.live { background: var(--good); box-shadow: 0 0 0 3px color-mix(in oklab, var(--good) 22%, transparent); }
.dot.down { background: var(--critical); box-shadow: 0 0 0 3px color-mix(in oklab, var(--critical) 22%, transparent); }

.sidebar-user {
  display: flex; align-items: center; gap: 4px;
  padding: 0 4px;
  font-size: 12.5px; color: var(--muted);
}
.sidebar-user > span:first-child {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.icon-btn {
  display: grid; place-items: center;
  width: 28px; height: 28px;
  border: 0; border-radius: 7px;
  background: transparent; color: var(--muted);
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 24px 32px 18px;
  position: sticky; top: 0;
  background: color-mix(in oklab, var(--bg) 86%, transparent);
  backdrop-filter: blur(8px);
  z-index: 20;
}
/* Red-to-blue rule replacing the plain border. Sticky establishes the
   containing block, so no position:relative needed. */
.topbar::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--rb);
  opacity: .55;
}
.topbar h1 { font-size: 19px; font-weight: 620; letter-spacing: -.02em; }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.view { padding: 24px 32px 48px; display: grid; gap: 20px; align-content: start; }

/* ══ buttons ═════════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px; font-weight: 520;
  cursor: pointer;
  white-space: nowrap;
  /* Cart/listing actions are anchors wearing .btn — kill the link underline. */
  text-decoration: none;
  transition: background .12s ease, border-color .12s ease, opacity .12s ease;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: var(--accent); border-color: transparent; color: var(--accent-ink);
}
.btn-primary:hover { background: color-mix(in oklab, var(--accent) 88%, #000); }
.btn-danger { color: var(--critical); }
.btn-danger:hover { background: color-mix(in oklab, var(--critical) 12%, var(--surface)); }
.btn-sm { padding: 5px 9px; font-size: 12px; }
.btn-block { width: 100%; }

/* ══ cards ═══════════════════════════════════════════════════════════════ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}
.card-head h2 { font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
.card-head .sub { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.card-body { padding: 18px; }

.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}
.stat-label {
  color: var(--muted); font-size: 12px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .05em;
}
.stat-value {
  font-size: 30px; font-weight: 650; letter-spacing: -.03em;
  margin-top: 6px; line-height: 1.1;
}
.stat-meta { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

/* ══ badges ══════════════════════════════════════════════════════════════
   Status color never carries meaning alone — every badge has a text label. */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 580;
  letter-spacing: .01em;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex: none;
}
.badge-restock  { color: var(--good);     background: color-mix(in oklab, var(--good) 14%, transparent); }
.badge-deal     { color: var(--warning);  background: color-mix(in oklab, var(--warning) 16%, transparent); }
.badge-drop     { color: var(--series-3); background: color-mix(in oklab, var(--series-3) 15%, transparent); }
.badge-ok       { color: var(--good);     background: color-mix(in oklab, var(--good) 12%, transparent); }
.badge-failing  { color: var(--critical); background: color-mix(in oklab, var(--critical) 14%, transparent); }
.badge-paused   { color: var(--muted);    background: var(--surface-2); }
.badge-starting { color: var(--serious);  background: color-mix(in oklab, var(--serious) 14%, transparent); }

.tag {
  display: inline-block;
  padding: 1.5px 7px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 11.5px; font-weight: 520;
}

/* ══ tables ══════════════════════════════════════════════════════════════ */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left;
  padding: 9px 18px;
  color: var(--muted);
  font-size: 11.5px; font-weight: 580;
  text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 11px 18px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .1s ease; }
tbody tr:hover { background: var(--surface-2); }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }

/* ══ alert feed ══════════════════════════════════════════════════════════ */

.feed { display: grid; }
.feed-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 13px 18px;
  border-bottom: 1px solid var(--hairline);
}
.feed-row:last-child { border-bottom: 0; }
.feed-row:hover { background: var(--surface-2); }

.thumb {
  width: 48px; height: 48px;
  border-radius: 8px;
  object-fit: contain;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.thumb-ph { display: grid; place-items: center; }

.feed-title {
  font-weight: 530; font-size: 13.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.feed-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 4px; color: var(--muted); font-size: 12px;
}
.feed-actions { display: flex; align-items: center; gap: 8px; }

.price { font-weight: 620; font-variant-numeric: tabular-nums; }
.price-under { color: var(--good); font-weight: 580; }

/* ══ chart ═══════════════════════════════════════════════════════════════ */

.chart-wrap { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.grid-line { stroke: var(--hairline); stroke-width: 1; }
.axis-label { fill: var(--muted); font-size: 11px; }
.bar-seg { transition: opacity .1s ease; }
.chart:hover .bar-seg { opacity: .55; }
.chart .bar-col:hover .bar-seg { opacity: 1; }

.legend {
  display: flex; gap: 16px; flex-wrap: wrap;
  padding: 0 18px 16px;
  font-size: 12.5px; color: var(--text-2);
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { width: 9px; height: 9px; border-radius: 2.5px; flex: none; }

.tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 12.5px;
  box-shadow: var(--shadow);
  z-index: 30;
  min-width: 130px;
}
.tooltip-day { font-weight: 600; margin-bottom: 5px; }
.tooltip-row { display: flex; align-items: center; gap: 7px; justify-content: space-between; }
.tooltip-row span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.tooltip-row b { font-variant-numeric: tabular-nums; }

.spark { display: block; width: 100%; height: 40px; overflow: visible; }

/* ══ forms ═══════════════════════════════════════════════════════════════ */

.field { display: grid; gap: 6px; }
.field > span, .field-label {
  font-size: 12.5px; font-weight: 540; color: var(--text-2);
}
.field .hint { font-size: 12px; color: var(--muted); font-weight: 400; }

input[type=text], input[type=password], input[type=number], input[type=url], select, textarea {
  width: 100%;
  padding: 8px 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color .12s ease, background .12s ease;
}
input:hover, select:hover, textarea:hover { border-color: var(--surface-3); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent-2) 22%, transparent);
}
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { resize: vertical; min-height: 66px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; }

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 15px, calc(100% - 11px) 15px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.form-row { display: grid; gap: 14px; }
.span-2 { grid-column: 1 / -1; }

.form-error {
  padding: 9px 12px;
  border-radius: 8px;
  background: color-mix(in oklab, var(--critical) 12%, transparent);
  border: 1px solid color-mix(in oklab, var(--critical) 30%, transparent);
  color: var(--critical);
  font-size: 12.5px;
}

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 34px; height: 20px; border-radius: 999px;
  background: var(--surface-3);
  position: relative; flex: none;
  transition: background .15s ease;
}
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff;
  transition: transform .15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.switch input:checked + .switch-track { background: var(--good); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ══ watchlist ═══════════════════════════════════════════════════════════ */

.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.source-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: grid;
  gap: 12px;
  align-content: start;
}
.source-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.source-name { font-weight: 600; font-size: 14px; word-break: break-word; }
.source-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.source-detail {
  font-size: 12.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.source-stats {
  display: flex; gap: 16px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--text-2);
  padding-top: 10px; border-top: 1px solid var(--hairline);
}
.source-stats b { font-variant-numeric: tabular-nums; font-weight: 600; }
.source-err {
  font-size: 12px; color: var(--critical);
  background: color-mix(in oklab, var(--critical) 10%, transparent);
  border-radius: 6px; padding: 7px 9px;
  word-break: break-word;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.source-actions { display: flex; gap: 7px; flex-wrap: wrap; }

/* ══ setup checklist ═════════════════════════════════════════════════════ */

.checklist { display: grid; gap: 2px; }
.check-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--hairline);
}
.check-item:last-child { border-bottom: 0; }
.check-mark {
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; flex: none;
  border: 1.5px solid var(--surface-3);
  color: transparent;
}
.check-item.done .check-mark {
  background: var(--good); border-color: var(--good); color: #fff;
}
.check-item.done .check-text { color: var(--muted); text-decoration: line-through; }
.check-text { flex: 1; font-size: 13.5px; }
.check-text small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; text-decoration: none; }

/* ══ logs ════════════════════════════════════════════════════════════════ */

.log-view {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.65;
  background: var(--bg);
  border-radius: 8px;
  padding: 14px 16px;
  max-height: 62vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.log-line { display: block; }
.log-err { color: var(--critical); }
.log-warn { color: var(--warning); }
.log-hit { color: var(--good); }

/* ══ modal ═══════════════════════════════════════════════════════════════ */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, .55);
  display: grid; place-items: center;
  padding: 24px;
  animation: fade .12s ease;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  width: 100%; max-width: 620px;
  max-height: 88vh;
  display: flex; flex-direction: column;
  animation: pop .14s cubic-bezier(.2, .9, .3, 1.1);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 17px 20px; border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-size: 15px; font-weight: 620; }
.modal-body { padding: 20px; overflow-y: auto; display: grid; gap: 16px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 9px;
  padding: 15px 20px; border-top: 1px solid var(--border);
}

@keyframes fade { from { opacity: 0 } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.99) } }

/* ══ toasts ══════════════════════════════════════════════════════════════ */

.toasts {
  position: fixed; bottom: 20px; right: 20px; z-index: 200;
  display: grid; gap: 8px; justify-items: end;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 9px;
  padding: 11px 15px;
  box-shadow: var(--shadow);
  font-size: 13px;
  max-width: 380px;
  animation: slide .16s ease;
}
.toast.ok { border-left-color: var(--good); }
.toast.err { border-left-color: var(--critical); }
@keyframes slide { from { opacity: 0; transform: translateX(12px) } }

/* ══ empty / loading ═════════════════════════════════════════════════════ */

.empty {
  display: grid; gap: 7px; justify-items: center;
  padding: 44px 24px; text-align: center;
}
.empty-icon {
  width: 38px; height: 38px; color: var(--muted); opacity: .5;
  stroke-width: 1.4;
}
.empty h3 { font-size: 14px; font-weight: 580; }
.empty p { color: var(--muted); font-size: 13px; max-width: 400px; }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
  border-radius: 6px;
  height: 13px;
}
@keyframes shimmer { to { background-position: -200% 0 } }

.filters { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.filters select { width: auto; min-width: 130px; }

.link { color: var(--accent-2); text-decoration: none; }
.link:hover { text-decoration: underline; }

.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; }

/* ══ responsive ══════════════════════════════════════════════════════════ */

@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: static;
    flex-direction: row; align-items: center; gap: 12px;
    padding: 10px 14px;
    border-right: 0; border-bottom: 1px solid var(--border);
    overflow-x: auto;
  }
  .brand { padding: 0 8px 0 0; }
  .nav { display: flex; gap: 2px; }
  .nav-item span:not(.nav-badge) { display: none; }
  .sidebar-foot { margin-top: 0; margin-left: auto; grid-auto-flow: column; align-items: center; }
  .conn span:last-child { display: none; }
  .sidebar-user > span:first-child { display: none; }
  .topbar, .view { padding-left: 18px; padding-right: 18px; }
  .feed-row { grid-template-columns: 40px minmax(0, 1fr); }
  .feed-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

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