/* ==========================================================================
   Fleet — design system

   This is an instrument, not a consumer app. It should read calm and precise:
   status colour is reserved for actual status, so a healthy box is almost
   monochrome and a broken one is impossible to miss. Depth comes from tonal
   layering rather than a border on every surface, and type uses a real scale
   with size-specific tracking instead of one letter-spacing everywhere.
   ========================================================================== */

:root {
  /* Surfaces: a tonal ladder, not a stack of outlined boxes. Each step is a
     genuine lightness increase so elevation reads without a border. */
  --s0: #0a0c11;          /* page */
  --s1: #10131a;          /* cards, chrome */
  --s2: #161a23;          /* raised: rows, inputs */
  --s3: #1d222d;          /* controls */
  --s4: #262c39;          /* hover */

  /* Hairlines. Used sparingly -- only where two surfaces genuinely meet. */
  --line: #232935;
  --line-soft: #1a1f28;

  /* Text: a three-step ramp. Anything below t3 is decoration, not content. */
  --t1: #e8ecf4;
  --t2: #9aa6b8;
  --t3: #667286;

  /* Accent: periwinkle. Distinct from the default-dashboard blue, and calm
     enough to sit next to status colours without competing. */
  --accent: #8898ff;
  --accent-dim: #5f6dcc;
  --accent-glow: rgba(136, 152, 255, 0.14);

  /* Status: desaturated on purpose. These are indicator lamps -- they should
     look like instrumentation, not alerts, until something is actually wrong. */
  --ok: #52b788;
  --warn: #d9a441;
  --bad: #e0685f;
  --idle: #5a6577;
  --ok-bg:   rgba(82, 183, 136, 0.12);
  --warn-bg: rgba(217, 164, 65, 0.12);
  --bad-bg:  rgba(224, 104, 95, 0.12);
  --idle-bg: rgba(90, 101, 119, 0.12);

  /* Elevation. Shadows carry the depth that borders used to. */
  --e1: 0 1px 2px rgba(0, 0, 0, 0.32);
  --e2: 0 2px 8px rgba(0, 0, 0, 0.36), 0 1px 2px rgba(0, 0, 0, 0.3);
  --e3: 0 12px 32px rgba(0, 0, 0, 0.48), 0 2px 8px rgba(0, 0, 0, 0.32);
  --e4: 0 24px 64px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.4);

  /* Tight. This is an instrument panel, not a phone app -- soft corners read
     as consumer software and blur the grid the layout is built on. */
  --r-sm: 2px;
  --r: 3px;
  --r-lg: 4px;

  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Inter, sans-serif;

  /* Springs. Critically damped for UI; the bouncier curve is reserved for
     things the user threw or dismissed themselves. */
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --fast: 130ms;
  --med: 240ms;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--s0);
  color: var(--t1);
  font: 400 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Numbers change constantly on this page; stop them jittering. */
  font-variant-numeric: tabular-nums;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

::selection { background: var(--accent-glow); }

/* Typographic scale. Tracking is size-specific: tighter as text grows,
   looser for small caps labels. One value for all sizes is wrong somewhere. */
h1 { font-size: 1.5rem;   line-height: 1.2;  letter-spacing: -0.021em; font-weight: 640; margin: 0; }
h2 { font-size: 0.95rem;  line-height: 1.35; letter-spacing: -0.008em; font-weight: 600; margin: 0 0 12px; color: var(--t1); }
h3 { font-size: 0.95rem;  line-height: 1.35; letter-spacing: -0.008em; font-weight: 600; margin: 0; }
h2 .muted { color: var(--t3); font-weight: 400; letter-spacing: 0; }

.label {
  font: 600 10.5px/1 var(--sans);
  letter-spacing: 0.07em;           /* positive tracking: small text needs air */
  text-transform: uppercase;
  color: var(--t3);
}

.mono, td.mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: -0.01em; }
.hint { color: var(--t3); font-size: 12.5px; line-height: 1.5; margin-top: 6px; }

/* ==========================================================================
   Controls
   ========================================================================== */

button, .btn {
  background: var(--s3);
  border: 1px solid transparent;
  color: var(--t1);
  border-radius: var(--r-sm);
  padding: 8px 13px;
  font: 500 13.5px var(--sans);
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: background var(--fast) var(--ease),
              transform var(--fast) var(--ease),
              opacity var(--fast) var(--ease);
}
button:hover:not(:disabled) { background: var(--s4); }
/* Feedback on press, not release -- waiting for click feels dead. */
button:active:not(:disabled) { transform: scale(0.97); }
button:disabled { opacity: 0.38; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button.primary {
  background: var(--accent); color: #0a0c14; font-weight: 600;
}
button.primary:hover:not(:disabled) { background: #9dabff; }
button.danger { background: transparent; box-shadow: inset 0 0 0 1px #4a2b2b; color: #ef8b83; }
button.danger:hover:not(:disabled) { background: rgba(224, 104, 95, 0.12); }
button.wide { width: 100%; margin-top: 24px; padding: 11px; }
button.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 2px; }
button.ghost { background: transparent; color: var(--t2); }
button.ghost:hover:not(:disabled) { background: var(--s2); color: var(--t1); }

input[type=text], input[type=password], input[type=search], textarea, select {
  width: 100%;
  background: var(--s2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--t1);
  padding: 9px 12px;
  font: 14px var(--sans);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
input::placeholder { color: var(--t3); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
input.code { font: 20px/1 var(--mono); letter-spacing: 0.4em; text-align: center; padding-left: 0.4em; }

label { display: block; font-size: 12.5px; color: var(--t2); margin: 18px 0 7px; }

/* ==========================================================================
   Auth
   ========================================================================== */

body.auth { display: grid; place-items: center; min-height: 100vh; padding: 24px; }

.auth-card {
  width: 100%; max-width: 400px;
  background: var(--s1);
  border-radius: var(--r-lg);
  padding: 34px;
  box-shadow: var(--e3);
}
.auth-card h1 { margin-bottom: 5px; }
.auth-card .sub { color: var(--t2); font-size: 14px; margin: 0 0 26px; }

.error {
  background: var(--bad-bg); color: #f0958d;
  box-shadow: inset 0 0 0 1px rgba(224, 104, 95, 0.28);
  padding: 11px 13px; border-radius: var(--r-sm);
  font-size: 13.5px; margin-bottom: 18px;
}
.notice {
  background: var(--accent-glow); color: #b9c3ff;
  box-shadow: inset 0 0 0 1px rgba(136, 152, 255, 0.22);
  padding: 13px; border-radius: var(--r-sm);
  font-size: 13.5px; margin: 18px 0; line-height: 1.55;
}
.secret {
  font: 13.5px var(--mono);
  background: var(--s0); border-radius: var(--r-sm);
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 13px; word-break: break-all;
  color: var(--accent); user-select: all;
}
.qr {
  display: block; margin: 18px auto; width: 200px; height: 200px;
  background: #fff; padding: 10px; border-radius: 2px;
  box-shadow: var(--e2);
}

/* ==========================================================================
   Shell — translucent chrome, content scrolls underneath
   ========================================================================== */

.topbar {
  display: flex; align-items: center; gap: 15px;
  padding: 0 20px; height: 54px;
  background: rgba(16, 19, 26, 0.72);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  position: sticky; top: 0; z-index: 50;
}
.brand {
  font-weight: 660; font-size: 15px; letter-spacing: -0.02em;
  display: flex; align-items: center; gap: 8px;
}
.brand .mark {
  width: 15px; height: 15px; border-radius: 2px;
  background: linear-gradient(150deg, var(--accent), var(--accent-dim));
  box-shadow: 0 0 12px var(--accent-glow);
}
.topbar .host { color: var(--t3); font: 12px var(--mono); }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--t2); font-size: 13px; }
.topbar form { display: flex; }

.tabs {
  display: flex; gap: 1px; padding: 0 13px;
  background: rgba(16, 19, 26, 0.72);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  overflow-x: auto; scrollbar-width: none;
  position: sticky; top: 54px; z-index: 49;
}
.tabs::-webkit-scrollbar { display: none; }
/* Scroll edge: a soft fade where content passes under the chrome, rather than
   a hard 1px rule sitting there permanently. */
.tabs::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -14px; height: 14px;
  background: linear-gradient(rgba(10, 12, 17, 0.55), transparent);
  pointer-events: none;
}
.tabs button {
  background: none; border: none; border-radius: 0;
  color: var(--t2); padding: 13px 13px 12px;
  white-space: nowrap; font-size: 13.5px; font-weight: 500;
  position: relative;
  transition: color var(--fast) var(--ease);
}
.tabs button::after {
  content: ""; position: absolute; left: 13px; right: 13px; bottom: 0; height: 2px;
  background: var(--accent); border-radius: 2px 2px 0 0;
  transform: scaleX(0); transform-origin: center;
  transition: transform var(--med) var(--ease-out);
}
.tabs button:hover { background: none; color: var(--t1); }
.tabs button:active { transform: none; }
.tabs button.active { color: var(--t1); }
.tabs button.active::after { transform: scaleX(1); }
.tabs .count {
  display: inline-block; margin-left: 7px; padding: 1px 6px;
  border-radius: 2px; background: var(--bad); color: #14080a;
  font: 700 10.5px var(--sans); vertical-align: 1px;
}

main { padding: 20px; max-width: 1360px; margin: 0 auto; }
.panel { display: none; }
.panel.active { display: block; animation: panel-in var(--med) var(--ease-out); }
@keyframes panel-in { from { opacity: 0; transform: translateY(4px); } }

/* ==========================================================================
   Status bar — the loudest thing on screen, and only when it must be
   ========================================================================== */

#statusbar { max-width: 1360px; margin: 20px auto 0; padding: 0 20px; }

.statusbar {
  display: flex; align-items: center; gap: 15px;
  padding: 15px 19px;
  border-radius: var(--r);
  background: var(--s1);
  box-shadow: var(--e2), inset 0 0 0 1px var(--line-soft);
  transition: box-shadow var(--med) var(--ease);
}
.statusbar.bad  { box-shadow: var(--e2), inset 0 0 0 1px rgba(224, 104, 95, 0.35); }
.statusbar.warn { box-shadow: var(--e2), inset 0 0 0 1px rgba(217, 164, 65, 0.3); }

.statusbar .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.statusbar .dot.ok   { background: var(--ok);   box-shadow: 0 0 0 4px var(--ok-bg); }
.statusbar .dot.warn { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-bg); }
.statusbar .dot.bad  {
  background: var(--bad); box-shadow: 0 0 0 4px var(--bad-bg);
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--bad-bg); }
  50%      { box-shadow: 0 0 0 7px rgba(224, 104, 95, 0.05); }
}
.statusbar .headline { font-weight: 590; font-size: 14.5px; letter-spacing: -0.01em; }
.statusbar .sub { color: var(--t2); font-size: 12.5px; margin-top: 2px; }

.freshness { color: var(--t3); font: 11.5px var(--mono); white-space: nowrap; }
.freshness.stale { color: var(--warn); }

/* ==========================================================================
   Cards, stats, tables
   ========================================================================== */

.stat-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 11px; margin-bottom: 20px;
}
.stat {
  background: var(--s1); border-radius: var(--r); padding: 15px 17px;
  box-shadow: var(--e1), inset 0 0 0 1px var(--line-soft);
}
.stat .k { color: var(--t3); font: 600 10.5px var(--sans);
           letter-spacing: 0.07em; text-transform: uppercase; }
.stat .v { font: 620 24px/1.15 var(--sans); letter-spacing: -0.024em; margin-top: 7px; }
.stat .sub { color: var(--t3); font-size: 12px; margin-top: 4px; }

.bar { height: 3px; background: var(--s0); border-radius: 2px; margin-top: 9px; overflow: hidden; }
.bar > i {
  display: block; height: 100%; background: var(--accent); border-radius: 2px;
  transition: width var(--med) var(--ease);
}
.bar > i.warn { background: var(--warn); }
.bar > i.bad { background: var(--bad); }

.card {
  background: var(--s1); border-radius: var(--r);
  box-shadow: var(--e1), inset 0 0 0 1px var(--line-soft);
  overflow: hidden; margin-bottom: 14px;
}
.card > header {
  padding: 13px 17px; display: flex; align-items: center; gap: 11px;
  box-shadow: inset 0 -1px 0 var(--line-soft);
}
.card > header h2 { margin: 0; }
.card > header .spacer { flex: 1; }
.card .pad { padding: 17px; }

.site {
  background: var(--s1); border-radius: var(--r); margin-bottom: 10px;
  box-shadow: var(--e1), inset 0 0 0 1px var(--line-soft);
  overflow: hidden;
  transition: box-shadow var(--med) var(--ease);
}
.site:hover { box-shadow: var(--e2), inset 0 0 0 1px var(--line); }
.site > header {
  display: flex; align-items: center; gap: 13px;
  padding: 14px 17px; cursor: pointer; user-select: none;
  transition: background var(--fast) var(--ease);
}
.site > header:hover { background: var(--s2); }
.site > header:active { background: var(--s2); }
.site h3 { font-size: 14.5px; }
.site .domains { color: var(--t3); font-size: 12px; margin-top: 2px; }
.site .chev {
  color: var(--t3); font-size: 10px;
  transition: transform var(--med) var(--ease-out);
}
.site.open .chev { transform: rotate(90deg); }
.site .body {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows var(--med) var(--ease-out);
}
.site.open .body { grid-template-rows: 1fr; }
.site .body > div { overflow: hidden; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; color: var(--t3);
  font: 600 10.5px var(--sans); letter-spacing: 0.07em; text-transform: uppercase;
  padding: 10px 17px;
  box-shadow: inset 0 -1px 0 var(--line-soft);
  background: var(--s1);
}
td {
  padding: 10px 17px; vertical-align: middle;
  box-shadow: inset 0 -1px 0 var(--line-soft);
}
tbody tr:last-child td { box-shadow: none; }
tbody tr { transition: background var(--fast) var(--ease); }
tbody tr:hover { background: var(--s2); }
td.actions { text-align: right; white-space: nowrap; }
td.actions button { margin-left: 5px; }
.sub-path { color: var(--t3); font-size: 11.5px; margin-top: 2px; font-family: var(--mono); }

/* ==========================================================================
   Pills & tags
   ========================================================================== */

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 2px;
  font: 600 11.5px var(--sans); letter-spacing: -0.004em;
  white-space: nowrap;
}
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 1px; background: currentColor; }
.pill.flat::before { display: none; }
.pill.ok   { background: var(--ok-bg);   color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad  { background: var(--bad-bg);  color: var(--bad); }
.pill.idle { background: var(--idle-bg); color: #8792a6; }

.tag {
  display: inline-block; padding: 2px 7px; border-radius: 2px;
  background: var(--s3); color: var(--t2);
  font: 500 11.5px var(--mono); letter-spacing: -0.01em;
  margin-right: 4px;
}

/* ==========================================================================
   Backups

   The banner is the one element in the panel allowed to be loud. "Your
   backups are on the disk you are backing up" is not a detail row.
   ========================================================================== */

.banner {
  position: relative; padding: 13px 15px 13px 18px; margin-bottom: 16px;
  border-radius: 3px; background: var(--s2);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}
.banner::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  border-radius: 3px 0 0 3px;
}
.banner.bad  { background: var(--bad-bg); }
.banner.bad::before  { background: var(--bad); }
.banner.warn { background: var(--warn-bg); }
.banner.warn::before { background: var(--warn); }

.banner .b-title {
  font-weight: 590; font-size: 13.5px; letter-spacing: -0.008em; margin-bottom: 3px;
}
.banner.bad  .b-title { color: #f0958d; }
.banner.warn .b-title { color: #e6bd72; }
.banner .b-detail { color: var(--t2); font-size: 12.5px; line-height: 1.5; }

/* Checking "include secrets" changes what the export is. Say so before the
   click, not in a toast afterwards. */
.hint.danger { color: #f0958d; }

#export-result .pill { margin-left: 8px; }

/* ==========================================================================
   Issues
   ========================================================================== */

.group-head { margin: 24px 0 11px; }
.group-head:first-child { margin-top: 0; }
.group-head h2 { margin-bottom: 3px; }

.card.issue { position: relative; padding-left: 3px; }
.card.issue::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
}
.card.issue.bad::before  { background: var(--bad); }
.card.issue.warn::before { background: var(--warn); }
.card.issue.idle::before { background: var(--idle); }

.issue-head { display: flex; gap: 11px; align-items: center; margin-bottom: 7px; flex-wrap: wrap; }
.issue-head strong { font-weight: 590; letter-spacing: -0.008em; }
.issue-detail { color: var(--t2); font-size: 12.5px; }

.fix {
  display: flex; align-items: center; gap: 11px;
  margin-top: 12px; padding: 9px 11px;
  background: var(--s0); border-radius: var(--r-sm);
  box-shadow: inset 0 0 0 1px var(--line);
  overflow-x: auto;
}
.fix-label {
  font: 600 9.5px var(--sans); letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--t3); flex: none;
}
.fix-cmd {
  font: 12.5px var(--mono); color: #a8b4ff;
  white-space: pre; flex: 1; user-select: all;
}
.fix button { flex: none; }

/* ==========================================================================
   Logs & editor
   ========================================================================== */

.toolbar { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin-bottom: 13px; }
.toolbar select, .toolbar input { width: auto; min-width: 190px; }
.toolbar .spacer { flex: 1; }
.check { display: flex; align-items: center; gap: 7px; margin: 0; color: var(--t2);
         font-size: 13px; white-space: nowrap; cursor: pointer; }
.check input { width: auto; }

.log-view {
  background: #06080c; border-radius: var(--r);
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 14px 16px;
  font: 12.5px/1.6 var(--mono); letter-spacing: -0.01em;
  white-space: pre-wrap; word-break: break-word;
  max-height: 64vh; overflow: auto; color: #b8c4d4;
}
.log-view .err  { color: #f0958d; }
.log-view .warnline { color: #e8c274; }
.log-view mark { background: var(--accent-glow); color: #cdd5ff; border-radius: 3px; }
.log-view .dim { opacity: 0.32; }

textarea.conf {
  width: 100%; min-height: 480px;
  font: 12.5px/1.65 var(--mono);
  background: #06080c; border: none;
  box-shadow: inset 0 0 0 1px var(--line);
  border-radius: var(--r); color: #b8c4d4;
  padding: 15px; resize: vertical; tab-size: 4;
}

.empty { color: var(--t3); padding: 34px; text-align: center; font-size: 13.5px; }

.result {
  margin-top: 13px; padding: 11px 13px; border-radius: var(--r-sm);
  font: 12.5px var(--mono); white-space: pre-wrap;
  max-height: 240px; overflow: auto;
}
.result.ok  { background: var(--ok-bg);  box-shadow: inset 0 0 0 1px rgba(82,183,136,0.25);  color: #7fd3a8; }
.result.bad { background: var(--bad-bg); box-shadow: inset 0 0 0 1px rgba(224,104,95,0.25); color: #f0958d; }

/* ==========================================================================
   Command palette
   ========================================================================== */

.palette-back {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(4, 6, 10, 0.5);
  backdrop-filter: blur(3px);
  display: flex; justify-content: center;
  padding: 12vh 20px 20px;
  animation: fade var(--fast) var(--ease);
}
@keyframes fade { from { opacity: 0; } }

.palette {
  width: 100%; max-width: 580px; height: max-content; max-height: 62vh;
  background: rgba(22, 26, 35, 0.88);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border-radius: var(--r-lg);
  box-shadow: var(--e4), inset 0 0 0 1px rgba(255, 255, 255, 0.07);
  display: flex; flex-direction: column; overflow: hidden;
  /* Materialise: blur + scale together, so it arrives as a surface. */
  animation: palette-in var(--med) var(--ease-out);
}
@keyframes palette-in {
  from { opacity: 0; transform: scale(0.97) translateY(-6px); }
}
.palette input {
  background: transparent; border: none; box-shadow: none;
  padding: 17px 19px; font-size: 15.5px; color: var(--t1);
  letter-spacing: -0.01em;
}
.palette input:focus { box-shadow: none; }
.palette .results { overflow-y: auto; padding: 5px; }
.palette .sect {
  font: 600 9.5px var(--sans); letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--t3); padding: 10px 14px 5px;
}
.palette .row {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 14px; border-radius: var(--r-sm); cursor: pointer;
  font-size: 13.5px;
}
.palette .row .what { flex: 1; min-width: 0; }
.palette .row .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette .row .meta { color: var(--t3); font: 11.5px var(--mono); margin-top: 1px; }
.palette .row.sel { background: var(--accent-glow); box-shadow: inset 0 0 0 1px rgba(136,152,255,0.22); }
.palette .row .kbd { color: var(--t3); font: 11px var(--mono); }
.palette footer {
  padding: 9px 15px; color: var(--t3); font-size: 11.5px;
  box-shadow: inset 0 1px 0 var(--line-soft); display: flex; gap: 15px;
}

kbd {
  display: inline-block; padding: 1px 5px; border-radius: 2px;
  background: var(--s3); color: var(--t2);
  font: 500 11px var(--mono); box-shadow: inset 0 -1px 0 rgba(0,0,0,0.3);
}

/* ==========================================================================
   Toasts & modals
   ========================================================================== */

#toasts {
  position: fixed; right: 18px; bottom: 18px; z-index: 200;
  display: flex; flex-direction: column; gap: 9px;
  max-width: min(420px, calc(100vw - 36px));
}
.toast {
  background: rgba(29, 34, 45, 0.9);
  backdrop-filter: blur(18px) saturate(170%);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  border-radius: var(--r); padding: 12px 15px; font-size: 13.5px;
  box-shadow: var(--e3), inset 0 0 0 1px rgba(255,255,255,0.06);
  position: relative; padding-left: 17px;
  animation: toast-in var(--med) var(--ease-out);
}
.toast::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px;
  border-radius: 0; background: var(--accent);
}
.toast.ok::before  { background: var(--ok); }
.toast.bad::before { background: var(--bad); }
.toast .t { font-weight: 590; margin-bottom: 2px; letter-spacing: -0.008em; }
.toast .d { color: var(--t2); font: 11.5px var(--mono); word-break: break-word; }
@keyframes toast-in { from { opacity: 0; transform: translateX(14px) scale(0.98); } }

.modal-back {
  position: fixed; inset: 0; z-index: 250;
  background: rgba(4, 6, 10, 0.62);
  backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px;
  animation: fade var(--fast) var(--ease);
}
.modal {
  background: var(--s2); border-radius: var(--r-lg); padding: 24px;
  max-width: 470px; width: 100%;
  box-shadow: var(--e4), inset 0 0 0 1px rgba(255,255,255,0.06);
  animation: palette-in var(--med) var(--ease-out);
}
.modal h3 { font-size: 16.5px; margin-bottom: 9px; letter-spacing: -0.015em; }
.modal p { color: var(--t2); font-size: 13.5px; margin: 0 0 22px; line-height: 1.6; }
.modal .row { display: flex; gap: 9px; justify-content: flex-end; }

/* ==========================================================================
   Responsive & accessibility
   ========================================================================== */

@media (max-width: 760px) {
  main { padding: 14px; }
  #statusbar { padding: 0 14px; margin-top: 14px; }
  .statusbar { flex-wrap: wrap; }
  .topbar .host, .topbar .who { display: none; }
  th, td { padding: 9px 11px; }
  td.actions { text-align: left; }
  .fix { flex-wrap: wrap; }
  .fix-cmd { white-space: pre-wrap; word-break: break-all; }
  .palette-back { padding: 6vh 12px 12px; }
}

/* Reduced motion: keep the comprehension-carrying opacity changes, drop
   everything vestibular. Not "no feedback" -- gentler feedback. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .site .body { transition: none; }
}

@media (prefers-reduced-transparency: reduce) {
  .topbar, .tabs { background: var(--s1); backdrop-filter: none; }
  .palette { background: var(--s2); backdrop-filter: none; }
  .toast  { background: var(--s3); backdrop-filter: none; }
  .palette-back, .modal-back { backdrop-filter: none; }
}

@media (prefers-contrast: more) {
  :root { --t2: #c3ccda; --t3: #9aa6b8; --line: #3a4354; }
  .card, .site, .stat { box-shadow: var(--e1), inset 0 0 0 1px var(--line); }
}

/* ==========================================================================
   Site previews
   ========================================================================== */

.shot {
  width: 108px; height: 68px; flex: none;
  border-radius: 2px; overflow: hidden;
  background: var(--s2);
  box-shadow: inset 0 0 0 1px var(--line), var(--e1);
  position: relative;
  cursor: zoom-in;
  transition: box-shadow var(--fast) var(--ease);
}
.shot:hover { box-shadow: inset 0 0 0 1px var(--accent-dim), var(--e2); }
.shot img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: top center;
  display: block;
  /* Screenshots are busy; knock them back so they read as context, not content */
  opacity: 0.88;
  transition: opacity var(--fast) var(--ease);
}
.shot:hover img { opacity: 1; }
.shot .none {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--t3); font: 10px var(--mono); text-align: center; padding: 4px;
}

.shot-modal {
  max-width: min(1180px, 94vw); width: auto;
  padding: 0; background: var(--s1); overflow: hidden;
}
.shot-modal img { display: block; width: 100%; height: auto; }
.shot-modal .bar {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 15px; background: var(--s2); height: auto;
  border-radius: 0; margin: 0;
}
.shot-modal .bar .spacer { flex: 1; }
.shot-modal .bar .cap { font-weight: 590; letter-spacing: -0.01em; }
.shot-modal .bar .when { color: var(--t3); font: 11.5px var(--mono); }

@media (max-width: 760px) {
  .shot { width: 76px; height: 48px; }
}
