/* Redline portal */

@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("inter-var.260c81a4759b.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap;
  src: url("jbmono-var.b058178d7f30.woff2") format("woff2");
}

/* ---------- tokens ---------- */
:root {
  color-scheme: light;
  --bg: #f4f4f2;
  --surface: #ffffff;
  --surface-2: #f9f9f8;
  --sunken: #efefed;
  --ink: #18181b;
  --ink-2: #3f3f46;
  --muted: #71717a;
  --faint: #a1a1aa;
  --line: #e6e6e3;
  --line-2: #d4d4d0;

  --accent: #e0221b;
  --accent-hover: #c41a14;
  --accent-soft: #fdeceb;
  --accent-ink: #ffffff;

  --ok: #15803d;   --ok-soft: #e3f5e8;
  --warn: #b45309; --warn-soft: #fdf1dc;
  --bad: #c42323;  --bad-soft: #fde7e7;
  --run: #2563eb;  --run-soft: #e4ecfd;
  --find: #7c3aed; --find-soft: #efe7fd;
  --idle: #71717a; --idle-soft: #efefed;

  --hdr: #111113;
  --hdr-2: #1c1c20;
  --hdr-ink: #f4f4f5;
  --hdr-muted: #a1a1aa;

  --term: #0d0e11;
  --term-2: #16181d;
  --term-ink: #d4d6dc;
  --term-muted: #6b7080;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(24, 24, 27, .05), 0 1px 1px rgba(24, 24, 27, .03);
  --shadow-lg: 0 10px 30px -10px rgba(24, 24, 27, .25);
  --focus: 0 0 0 3px rgba(224, 34, 27, .25);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0b0d; --surface: #141417; --surface-2: #18181c; --sunken: #101013;
    --ink: #ececee; --ink-2: #c9c9cf; --muted: #8d8d97; --faint: #5f5f69;
    --line: #232328; --line-2: #313138;
    --accent: #f0342d; --accent-hover: #ff4a42; --accent-soft: rgba(240, 52, 45, .14);
    --ok: #4ade80;   --ok-soft: rgba(74, 222, 128, .12);
    --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .12);
    --bad: #f87171;  --bad-soft: rgba(248, 113, 113, .13);
    --run: #60a5fa;  --run-soft: rgba(96, 165, 250, .13);
    --find: #a78bfa; --find-soft: rgba(167, 139, 250, .15);
    --idle: #8d8d97; --idle-soft: rgba(141, 141, 151, .12);
    --hdr: #0f0f12; --hdr-2: #1a1a1f;
    --term: #08090b; --term-2: #111317;
    --shadow: 0 0 0 1px rgba(255, 255, 255, .02);
    --shadow-lg: 0 10px 30px -10px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0b0d; --surface: #141417; --surface-2: #18181c; --sunken: #101013;
  --ink: #ececee; --ink-2: #c9c9cf; --muted: #8d8d97; --faint: #5f5f69;
  --line: #232328; --line-2: #313138;
  --accent: #f0342d; --accent-hover: #ff4a42; --accent-soft: rgba(240, 52, 45, .14);
  --ok: #4ade80;   --ok-soft: rgba(74, 222, 128, .12);
  --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .12);
  --bad: #f87171;  --bad-soft: rgba(248, 113, 113, .13);
  --run: #60a5fa;  --run-soft: rgba(96, 165, 250, .13);
  --find: #a78bfa; --find-soft: rgba(167, 139, 250, .15);
  --idle: #8d8d97; --idle-soft: rgba(141, 141, 151, .12);
  --hdr: #0f0f12; --hdr-2: #1a1a1f;
  --term: #08090b; --term-2: #111317;
  --shadow: 0 0 0 1px rgba(255, 255, 255, .02);
  --shadow-lg: 0 10px 30px -10px rgba(0, 0, 0, .6);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.5 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a.link, .link { color: var(--accent); }
a.link:hover { text-decoration: underline; }
code, pre, .mono, kbd { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.xs { font-size: 11.5px; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stack > * + * { margin-top: 16px; }
.hide { display: none !important; }
svg.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 14px; height: 14px; }
svg.i.lg { width: 20px; height: 20px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }

/* ---------- header ---------- */
.hdr {
  background: var(--hdr); color: var(--hdr-ink); position: sticky; top: 0; z-index: 20;
  border-bottom: 1px solid #000;
}
.hdr::after { /* the red line */
  content: ""; display: block; height: 3px;
  background: linear-gradient(90deg, var(--accent) 0 72%, #ff8a3d 86%, #ffd23f 100%);
}
.hdr-in { max-width: 1200px; margin: 0 auto; padding: 0 20px; height: 56px; display: flex; align-items: center; gap: 22px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16.5px; letter-spacing: -.02em; color: #fff; }
.logo svg { width: 28px; height: 28px; }
.logo em { font-style: normal; color: var(--accent); }
.nav { display: flex; gap: 2px; flex: 1; min-width: 0; }
.nav a {
  display: flex; align-items: center; gap: 7px; padding: 7px 11px; border-radius: 8px;
  color: var(--hdr-muted); font-weight: 500; white-space: nowrap;
}
.nav a:hover { color: var(--hdr-ink); background: var(--hdr-2); }
.nav a.on { color: #fff; background: var(--hdr-2); box-shadow: inset 0 -2px 0 var(--accent); }
.hdr-right { display: flex; align-items: center; gap: 8px; }
.pill-status {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--hdr-2); color: var(--hdr-muted); white-space: nowrap;
}
.pill-status .dot { width: 7px; height: 7px; border-radius: 50%; background: #71717a; }
.pill-status.is-live { color: #86efac; }
.pill-status.is-live .dot { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); animation: pulse 2s infinite; }
.pill-status.is-down { color: #fca5a5; background: rgba(239, 68, 68, .15); }
.pill-status.is-down .dot { background: #ef4444; }
.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 8px;
  border: 0; background: transparent; color: var(--hdr-muted); cursor: pointer;
}
.icon-btn:hover { background: var(--hdr-2); color: var(--hdr-ink); }
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #ff8a3d); color: #fff; font-weight: 700; font-size: 13px;
  text-transform: uppercase;
}
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px; padding: 6px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg);
}
.menu-pop .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-pop a, .menu-pop button {
  display: flex; width: 100%; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px;
  border: 0; background: none; color: var(--ink-2); font: inherit; cursor: pointer; text-align: left;
}
.menu-pop a:hover, .menu-pop button:hover { background: var(--sunken); color: var(--ink); }

@media (max-width: 760px) {
  .hdr-in { gap: 8px; padding: 0 12px; }
  .logo span { display: none; }
  .nav a { padding: 7px 9px; }
  .nav a:not(.on) .lbl { display: none; }
  .pill-status .txt { display: none; }
  .pill-status { padding: 7px; }
  .icon-btn { width: 32px; }
}

/* ---------- layout ---------- */
main { max-width: 1200px; margin: 0 auto; padding: 28px 20px 80px; }
@media (max-width: 760px) { main { padding: 20px 12px 60px; } }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 26px; line-height: 1.15; letter-spacing: -.025em; margin: 0; font-weight: 750; }
.page-head .sub { color: var(--muted); margin: 6px 0 0; }
.crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.crumb:hover { color: var(--ink); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 18px; }
.kpis > .card, .meta > .card { margin-top: 0; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-h h2 { font-size: 14.5px; font-weight: 650; margin: 0; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.card-h h2 .count { font-weight: 500; color: var(--muted); }
.card-b { padding: 18px; }
.empty { padding: 28px 18px; color: var(--muted); text-align: center; }
.empty svg { display: block; margin: 0 auto 8px; color: var(--faint); width: 28px; height: 28px; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.kpi { position: relative; padding: 16px 18px; overflow: hidden; }
.kpi .k-label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi .k-val { font-size: 30px; font-weight: 750; letter-spacing: -.03em; line-height: 1.1; margin-top: 8px; font-variant-numeric: tabular-nums; }
.kpi .k-val small { font-size: 15px; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.kpi .k-foot { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi .k-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; }
.kpi .k-ico svg { width: 15px; height: 15px; }
.k-ok .k-ico { background: var(--ok-soft); color: var(--ok); }
.k-find .k-ico { background: var(--find-soft); color: var(--find); }
.k-find .k-val { color: var(--find); }
.k-bad .k-ico { background: var(--bad-soft); color: var(--bad); }
.k-bad.has .k-val { color: var(--bad); }
.k-act .k-ico { background: var(--accent-soft); color: var(--accent); }
a.kpi:hover { border-color: var(--line-2); }
.meter { height: 4px; border-radius: 4px; background: var(--sunken); margin-top: 10px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--ok); border-radius: 4px; }

/* ---------- live bar ---------- */
.live { display: flex; align-items: center; gap: 12px; padding: 12px 16px; flex-wrap: wrap; margin-bottom: 18px; }
.live-title { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 13.5px; }
.live-title .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.live.on .live-title .dot { background: var(--run); box-shadow: 0 0 0 4px var(--run-soft); animation: pulse 1.4s infinite; }
.live-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 6px 5px 11px; border-radius: 999px;
  background: var(--run-soft); color: var(--run); font-weight: 600; font-size: 12.5px;
}
.live-chip.q { background: var(--idle-soft); color: var(--idle); }
.live-chip .t { font-variant-numeric: tabular-nums; font-weight: 500; opacity: .85; }
.live-chip button { border: 0; background: rgba(0,0,0,.06); color: inherit; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; padding: 0; }
.live-chip button:hover { background: var(--bad-soft); color: var(--bad); }
.live-next { color: var(--muted); font-size: 13px; }

/* ---------- segmented / tabs ---------- */
.seg { display: inline-flex; padding: 3px; background: var(--sunken); border: 1px solid var(--line); border-radius: 10px; gap: 2px; }
.seg button, .seg label, .seg a {
  border: 0; background: none; font: inherit; font-size: 13px; font-weight: 550; color: var(--muted);
  padding: 5px 12px; border-radius: 7px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.seg button .n, .seg label .n { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.seg a:hover { color: var(--ink); }
.seg a.on.find { color: var(--find); }
.seg a.on.bad { color: var(--bad); }
.seg button.on, .seg a.on, .seg label:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: var(--shadow), 0 0 0 1px var(--line); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }

/* ---------- watcher list ---------- */
.w-list { list-style: none; margin: 0; padding: 0; }
.w-row {
  display: grid; align-items: center; gap: 16px;
  grid-template-columns: 52px minmax(0, 1.7fr) 172px minmax(0, 1.1fr) 104px 108px;
  padding: 13px 18px; border-top: 1px solid var(--line);
}
.w-list .w-row:first-child { border-top: 0; }
.w-head { padding-top: 10px; padding-bottom: 10px; background: var(--surface-2); border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.w-head > div { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.w-row:not(.w-head):hover { background: var(--surface-2); }
.w-name { font-weight: 650; font-size: 14.5px; letter-spacing: -.01em; display: inline-flex; align-items: center; gap: 8px; }
.w-name:hover { color: var(--accent); }
.w-desc { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.w-tags { display: inline-flex; gap: 5px; margin-left: 2px; }
.w-row.off .w-name { color: var(--muted); }
.w-row.off .strip, .w-row.off .w-last { opacity: .55; }
.w-last { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.w-last .top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.w-next { font-size: 13px; font-variant-numeric: tabular-nums; }
.w-next .paused { color: var(--faint); display: inline-flex; align-items: center; gap: 5px; }
.w-act { display: flex; justify-content: flex-end; gap: 6px; }
.is-hidden { display: none !important; }
.w-group + .w-group { border-top: 1px solid var(--line); }
.g-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 18px; background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.g-head + .w-row { border-top: 0; }
.g-name { font-weight: 700; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.g-meta { color: var(--muted); font-size: 12px; }
.g-head .btn-ghost { height: 26px; font-size: 12px; }
.fn { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 11.5px; color: var(--muted); }
.tag-mini { display: inline-block; font-size: 10.5px; font-weight: 600; color: var(--muted); background: var(--sunken); border-radius: 4px; padding: 0 5px; margin-left: 2px; }
.tagbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.tagchip {
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font: inherit; font-size: 12.5px;
  font-weight: 550; padding: 3px 10px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px;
}
.tagchip .n { color: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.tagchip:hover { border-color: var(--faint); }
.tagchip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.tagchip.on .n { color: inherit; opacity: .7; }
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px; background: var(--bad-soft); color: var(--bad); font-size: 13.5px; }
.banner ul { margin: 4px 0 0; padding-left: 18px; color: var(--ink-2); }
.banner code { font-size: 12px; }
.notif { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--surface-2); }
.notif + .notif { margin-top: 10px; }
.notif .n-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.notif .n-body { white-space: pre-wrap; word-break: break-word; font-size: 13px; }
.sched-lbl { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.sched-lbl svg { color: var(--faint); }

@media (max-width: 980px) {
  .w-head { display: none; }
  .w-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "tog name act" "strip strip strip" "last last next";
    gap: 10px 12px; padding: 14px 14px;
  }
  .w-row > .c-tog { grid-area: tog; }
  .w-row > .c-name { grid-area: name; }
  .w-row > .c-strip { grid-area: strip; }
  .w-row > .c-last { grid-area: last; }
  .w-row > .c-next { grid-area: next; text-align: right; }
  .w-row > .c-act { grid-area: act; }
  .w-desc { white-space: normal; }
  .c-strip .sched-lbl { display: none; }
  .c-strip .strip i { max-width: none; }
}

/* ---------- health strip ---------- */
.strip { display: flex; align-items: flex-end; gap: 2px; height: 22px; }
.strip i {
  flex: 1 1 0; max-width: 6px; min-width: 3px; height: 100%; border-radius: 2px;
  background: var(--ok); opacity: .9; position: relative;
}
.strip i.s-warning { background: var(--warn); }
.strip i.s-failed, .strip i.s-timeout, .strip i.s-lost { background: var(--bad); }
.strip i.s-cancelled { background: var(--faint); height: 55%; }
.strip i.s-running, .strip i.s-queued { background: var(--run); animation: pulse 1.2s infinite; }
.strip i.s-none { background: var(--sunken); opacity: 1; height: 40%; }
.strip i.found { background: var(--find); }
.strip i.found::after { content: ""; position: absolute; left: 50%; top: -5px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--find); }
.strip.big { height: 34px; gap: 3px; }
.strip.big i { max-width: none; }
.strip a { display: contents; }
.strip-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.strip-legend span { display: inline-flex; align-items: center; gap: 5px; }
.strip-legend b { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; line-height: 1;
  padding: 4px 8px; border-radius: 6px; white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-success { color: var(--ok); background: var(--ok-soft); }
.b-warning { color: var(--warn); background: var(--warn-soft); }
.b-failed, .b-timeout, .b-lost { color: var(--bad); background: var(--bad-soft); }
.b-running, .b-queued { color: var(--run); background: var(--run-soft); }
.b-running .dot { animation: pulse 1.2s infinite; }
.b-cancelled, .b-idle { color: var(--idle); background: var(--idle-soft); }
.b-active { color: var(--ok); background: var(--ok-soft); }
.b-find { color: var(--find); background: var(--find-soft); }
.tag {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--muted);
  background: var(--sunken); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; white-space: nowrap;
}
.problem { color: var(--warn); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.problem.bad { color: var(--bad); }

/* ---------- switch ---------- */
.switch {
  border: 0; background: none; padding: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 9px;
  color: inherit; font: inherit;
}
.switch .track {
  width: 38px; height: 22px; border-radius: 999px; background: var(--line-2); position: relative;
  transition: background .18s ease; flex: none;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .18s ease;
}
.switch.on .track { background: var(--ok); }
.switch.on .track::after { transform: translateX(16px); }
.switch .lbl { font-size: 13px; font-weight: 550; color: var(--muted); }
.switch.on .lbl { color: var(--ink); }
.switch.htmx-request .track { opacity: .6; }
/* checkbox rendered as a switch (Django form field) */
.check-switch { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.check-switch input { appearance: none; -webkit-appearance: none; margin: 0; width: 38px; height: 22px; border-radius: 999px; background: var(--line-2); position: relative; cursor: pointer; transition: background .18s; flex: none; }
.check-switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .18s; }
.check-switch input:checked { background: var(--ok); }
.check-switch input:checked::after { transform: translateX(16px); }
.check-switch input:focus-visible { box-shadow: var(--focus); }
.check-switch b { display: block; font-weight: 600; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: 13.5px;
  cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; }
.btn-icon { width: 32px; padding: 0; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 2px rgba(224,34,27,.3); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--sunken); color: var(--ink); border-color: transparent; }
.btn-danger:hover { color: var(--bad); border-color: var(--bad); background: var(--bad-soft); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
form.inline { display: inline-flex; margin: 0; }

/* ---------- forms ---------- */
.field { margin-bottom: 18px; }
.field > label, .label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--ink-2); }
.help { color: var(--muted); font-size: 12px; margin-top: 6px; }
.errorlist { color: var(--bad); margin: 6px 0 0; padding: 0; list-style: none; font-size: 12.5px; }
input[type=text], input[type=url], input[type=number], input[type=password], input[type=search], select, textarea {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 8px;
  background: var(--surface); color: var(--ink); font: inherit; transition: border-color .12s, box-shadow .12s;
}
input::placeholder { color: var(--faint); }
input:hover, select:hover { border-color: var(--faint); }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
select { appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; }
.input-suffix { position: relative; }
.input-suffix input { padding-right: 70px; }
.input-suffix span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 12.5px; pointer-events: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding-top: 4px; }

/* settings-style sections: description left, fields right */
.section { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 28px; padding: 22px 18px; border-top: 1px solid var(--line); }
.section:first-child { border-top: 0; }
.section h3 { margin: 0 0 6px; font-size: 14px; font-weight: 650; }
.section p { margin: 0; color: var(--muted); font-size: 13px; }
.section .field:last-child { margin-bottom: 0; }
@media (max-width: 860px) { .section { grid-template-columns: 1fr; gap: 12px; } }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
thead th {
  font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  background: var(--surface-2); white-space: nowrap; padding-top: 9px; padding-bottom: 9px;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
tr.off td { color: var(--muted); }
td.r, th.r { text-align: right; }
tr.day td {
  background: var(--sunken); color: var(--muted); font-size: 11.5px; font-weight: 650; letter-spacing: .04em;
  text-transform: uppercase; padding-top: 7px; padding-bottom: 7px;
}
tr.clickable { cursor: pointer; }
.run-id { color: var(--muted); font-variant-numeric: tabular-nums; }
.run-id:hover { color: var(--accent); }
@media (max-width: 760px) { .hide-sm { display: none; } th, td { padding: 10px 12px; } }

/* ---------- list entries ---------- */
.entry { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); }
.entry:first-child { border-top: 0; }
.entry .v { font-size: 13px; word-break: break-all; }
.entry .v a:hover { color: var(--accent); }
.entry .n { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.entry.off .v { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.add-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.3fr) auto; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
@media (max-width: 760px) { .add-row { grid-template-columns: 1fr; } }

/* ---------- run page ---------- */
.meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
@media (max-width: 860px) { .meta { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.meta .card { padding: 14px 16px; margin: 0; }
.meta .m-label { color: var(--muted); font-size: 12px; font-weight: 500; display: flex; gap: 6px; align-items: center; }
.meta .m-val { font-size: 16px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.meta .m-sub { color: var(--muted); font-size: 12px; }
.callout { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: var(--radius); margin-bottom: 18px; font-size: 13.5px; }
.callout svg { margin-top: 2px; }
.callout.warn { background: var(--warn-soft); color: var(--warn); }
.callout.bad { background: var(--bad-soft); color: var(--bad); }
.callout b { display: block; }
.callout .t { color: var(--ink-2); word-break: break-word; }
.facts { display: flex; flex-wrap: wrap; gap: 10px; }
.fact { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 13px; min-width: 96px; }
.fact .f-k { font-size: 11.5px; color: var(--muted); text-transform: capitalize; }
.fact .f-v { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; word-break: break-word; }
.fact.hl { border-color: var(--find); background: var(--find-soft); }
.fact.hl .f-v { color: var(--find); }
details.raw { margin-top: 14px; }
details.raw summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
pre.json { background: var(--sunken); border: 1px solid var(--line); padding: 12px 14px; border-radius: 8px; overflow: auto; margin: 10px 0 0; }

.term { background: var(--term); border-radius: var(--radius); overflow: hidden; border: 1px solid #000; }
.term-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--term-2); color: var(--term-muted); font-size: 12.5px; }
.term-bar .lights { display: flex; gap: 6px; }
.term-bar .lights i { width: 10px; height: 10px; border-radius: 50%; background: #3a3d45; }
.term-bar .lights i:nth-child(1) { background: #ff5f57; } .term-bar .lights i:nth-child(2) { background: #febc2e; } .term-bar .lights i:nth-child(3) { background: #28c840; }
.term-bar .btn-ghost { color: var(--term-muted); height: 26px; }
.term-bar .btn-ghost:hover { background: #22252c; color: var(--term-ink); }
.term pre { margin: 0; padding: 14px 0; color: var(--term-ink); overflow: auto; max-height: 72vh; font-size: 12.5px; line-height: 1.65; }
.term .ln { display: block; padding: 0 16px 0 58px; text-indent: -58px; white-space: pre-wrap; word-break: break-word; }
.term .ln::before { content: attr(data-n); display: inline-block; width: 58px; padding-right: 14px; text-indent: 0; box-sizing: border-box; text-align: right; color: #3f434d; user-select: none; }
.term .ln.cmd { color: #7dd3fc; }
.term .ln.cmt { color: var(--term-muted); }
.term .ln.err { color: #fca5a5; background: rgba(248, 113, 113, .08); }
.term .ln.wrn { color: #fcd34d; }
.term .ln.sum { color: #c4b5fd; }
.term .ln.ok { color: #86efac; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 50; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 36px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 10px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  font-size: 13.5px; animation: toast-in .2s ease-out;
}
.toast svg { margin-top: 1px; }
.toast.success svg { color: var(--ok); }
.toast.warning svg { color: var(--warn); }
.toast.error svg { color: var(--bad); }
.toast.info svg { color: var(--run); }
.toast.bye { opacity: 0; transform: translateY(6px); transition: all .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- pager / filters ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.filters select { width: auto; min-width: 150px; height: 34px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--line); }

/* ---------- login ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(224, 34, 27, .16), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(255, 138, 61, .12), transparent 60%),
    var(--hdr);
}
.auth { width: 100%; max-width: 380px; }
.auth .logo { justify-content: center; font-size: 22px; margin-bottom: 26px; }
.auth .logo svg { width: 40px; height: 40px; }
.auth .card { padding: 26px; border: 0; box-shadow: 0 30px 60px -20px rgba(0,0,0,.6); }
.auth h1 { font-size: 18px; margin: 0 0 4px; letter-spacing: -.01em; }
.auth .sub { color: var(--muted); margin: 0 0 20px; font-size: 13px; }
.auth .btn { width: 100%; height: 40px; margin-top: 4px; }
.auth .foot { text-align: center; color: #71717a; font-size: 12px; margin-top: 18px; }
.form-error { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 8px; background: var(--bad-soft); color: var(--bad); font-size: 13px; margin-bottom: 16px; }

@keyframes pulse { 50% { opacity: .4; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.notif-list { padding: 6px 18px 14px; }
.notif-list .notif { margin-top: 10px; }
.notif.compact .n-body { max-height: 4.8em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.notif .n-head { flex-wrap: wrap; }
.notif .n-job a:hover { color: var(--accent); }
.day-label { font-size: 11.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
.day-label:first-child { margin-top: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
table.items tr.store-row td {
  background: var(--surface-2); border-top: 1px solid var(--line); padding-top: 9px; padding-bottom: 9px;
}
table.items tbody tr.store-row:first-child td { border-top: 0; }
table.items tr.store-row:hover td { background: var(--surface-2); }
.store-name { font-weight: 700; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
/* per-row ⋮ menu: positioned by app.js (fixed) so the table never clips it */
.row-menu { display: inline-block; }
.row-menu > summary { list-style: none; }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu[open] > summary { background: var(--sunken); color: var(--ink); }
.row-menu .menu-pop { position: fixed; top: auto; right: auto; z-index: 40; min-width: 230px; text-align: left; }
.row-menu .menu-pop form { margin: 0; }
.row-menu .menu-pop span { display: flex; flex-direction: column; }
.row-menu .menu-pop small { color: var(--muted); font-size: 11.5px; }
.store-toggle {
  display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 2px 4px 2px 0;
  margin-left: -2px; cursor: pointer; color: inherit; font: inherit; border-radius: 6px;
}
.store-toggle:hover .store-name { color: var(--ink); }
.store-toggle .chev { color: var(--muted); transition: transform .15s ease; }
tr.store-row.collapsed .store-toggle .chev { transform: rotate(-90deg); }
tr.store-row { cursor: pointer; }
tr.item-row.collapsed { display: none; }
.js-only { display: none !important; }
html.js .js-only { display: flex !important; }
details.howto { margin-top: 16px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: var(--surface-2); }
details.howto summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--ink-2); }
details.howto dl { margin: 12px 0 4px; }
details.howto dt { font-weight: 650; font-size: 13px; margin-top: 12px; }
details.howto dt:first-child { margin-top: 0; }
details.howto dd { margin: 3px 0 0; color: var(--ink-2); font-size: 13px; line-height: 1.55; }
details.howto code { font-size: 11.5px; background: var(--sunken); padding: 1px 4px; border-radius: 4px; word-break: break-all; }
.icon-kit { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.icon-kit-hero { border-radius: 26px; box-shadow: var(--shadow-lg); flex: none; }
.icon-kit-sizes { display: flex; gap: 10px; align-items: flex-end; flex: none; padding-top: 64px; }
.icon-kit-sizes img:nth-child(1) { border-radius: 11px; }
.icon-kit-sizes img:nth-child(2) { border-radius: 8px; }
.icon-kit-sizes img:nth-child(3) { border-radius: 5px; }
.icon-kit-text { flex: 1; min-width: 240px; }
.icon-kit-text p { margin: 0; color: var(--ink-2); font-size: 13.5px; }
