/* ===========================================================
   Spotter design system — ported from the supplied templates
   =========================================================== */

:root {
  color-scheme: light;
  --bg: #f7f7f8;
  --bg-2: #f4f4f6;
  --bg-elev: #ffffff;
  --fg: #0b0b0f;
  --fg-2: #3a3a44;
  --fg-3: #6a6a78;
  --fg-4: #9a9aa8;
  --line: rgba(10, 10, 15, 0.08);
  --line-2: rgba(10, 10, 15, 0.04);
  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-bg-2: rgba(255, 255, 255, 0.7);
  --glass-stroke: rgba(255, 255, 255, 0.7);
  --glass-stroke-out: rgba(10, 10, 15, 0.06);
  --glass-blur: 40px;
  --glass-sat: 180%;
  --accent-1: #0a84ff;
  --accent-2: #bf5af2;
  --accent-grad: linear-gradient(135deg, #0a84ff 0%, #bf5af2 100%);
  --accent-grad-cool: linear-gradient(135deg, #64d2ff 0%, #0a84ff 100%);
  --good: #30d158;
  --warn: #ff9f0a;
  --bad: #ff453a;
  --info: #64d2ff;
  --shadow-1: 0 1px 0 rgba(255,255,255,0.6) inset, 0 0 0 1px rgba(10,10,15,0.05), 0 8px 32px -8px rgba(10,10,15,0.12);
  --shadow-2: 0 1px 0 rgba(255,255,255,0.6) inset, 0 0 0 1px rgba(10,10,15,0.05), 0 24px 64px -16px rgba(10,10,15,0.18);
  --radius: 14px;
  --radius-lg: 22px;
  --radius-xl: 24px;
  --base-size: 11px;
}
html.dark {
  color-scheme: dark;
  --bg: #07070b;
  --bg-2: #07070b;
  --bg-elev: #131319;
  --fg: #f5f5f7;
  --fg-2: #c7c7d1;
  --fg-3: #8a8a96;
  --fg-4: #54545e;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.04);
  --glass-bg: rgba(20, 20, 28, 0.5);
  --glass-bg-2: rgba(28, 28, 38, 0.65);
  --glass-stroke: rgba(255, 255, 255, 0.08);
  --glass-stroke-out: rgba(255, 255, 255, 0.04);
  --shadow-1: 0 1px 0 rgba(255,255,255,0.06) inset, 0 0 0 1px rgba(255,255,255,0.04), 0 8px 32px -8px rgba(0,0,0,0.6);
  --shadow-2: 0 1px 0 rgba(255,255,255,0.06) inset, 0 0 0 1px rgba(255,255,255,0.04), 0 24px 64px -16px rgba(0,0,0,0.7);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: var(--base-size);
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
}
.font-display { font-family: 'Inter Tight', system-ui, sans-serif; }
.font-mono   { font-family: 'JetBrains Mono', ui-monospace, monospace; }
.font-num    { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum', 'cv11'; }

a { color: var(--accent-1); text-decoration: none; }
a:hover { filter: brightness(1.1); }

/* ===== Mesh background ===== */
.mesh { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.mesh::before, .mesh::after, .mesh > i {
  content: ''; position: absolute; border-radius: 50%;
  filter: blur(80px); opacity: 0.85; will-change: transform;
}
.mesh::before { width: 60vw; height: 60vw; left: -10vw; top: -20vw;
  background: radial-gradient(circle at 30% 30%, #7cd9ff, transparent 60%);
  animation: drift1 28s ease-in-out infinite alternate; }
.mesh::after { width: 55vw; height: 55vw; right: -12vw; top: 10vh;
  background: radial-gradient(circle at 50% 50%, #3ab7ff, transparent 60%);
  animation: drift2 34s ease-in-out infinite alternate; }
.mesh > .b3 { width: 60vw; height: 60vw; left: 20vw; bottom: -30vw;
  background: radial-gradient(circle at 50% 50%, #34d399, transparent 60%);
  animation: drift3 30s ease-in-out infinite alternate; }
.mesh > .b4 { width: 45vw; height: 45vw; left: 50vw; top: 30vh;
  background: radial-gradient(circle at 50% 50%, #5eead4, transparent 60%);
  animation: drift4 36s ease-in-out infinite alternate; opacity: 0.55; }
html.dark .mesh::before { opacity: 0.45; }
html.dark .mesh::after  { opacity: 0.45; }
html.dark .mesh > .b3   { opacity: 0.4; }
html.dark .mesh > .b4   { opacity: 0.3; }
@keyframes drift1 { from { transform: translate(0,0) scale(1); } to { transform: translate(8vw, 6vh) scale(1.1); } }
@keyframes drift2 { from { transform: translate(0,0) scale(1); } to { transform: translate(-6vw, 8vh) scale(1.15); } }
@keyframes drift3 { from { transform: translate(0,0) scale(1); } to { transform: translate(-10vw, -6vh) scale(1.1); } }
@keyframes drift4 { from { transform: translate(0,0) scale(1); } to { transform: translate(6vw, -8vh) scale(1.2); } }

.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0.45;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.06 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
}

/* ===== Glass surfaces ===== */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  border: 1px solid var(--glass-stroke-out);
  box-shadow: var(--shadow-1);
  border-radius: var(--radius-lg);
  position: relative;
}
.glass::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: 0 1px 0 var(--glass-stroke) inset, 0 0 0 1px rgba(255,255,255,0.06) inset;
}
.glass-strong {
  background: var(--glass-bg-2);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  border: 1px solid var(--glass-stroke-out);
  box-shadow: var(--shadow-2);
  border-radius: var(--radius-lg);
}
.hairline { border: 1px solid var(--line); }
.hairline-b { border-bottom: 1px solid var(--line); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 28px; padding: 0 12px; border-radius: 8px;
  font-family: inherit; font-size: 11.5px; font-weight: 500; color: var(--fg-2);
  background: transparent; border: 1px solid var(--line);
  cursor: pointer; transition: 140ms ease; text-decoration: none;
  letter-spacing: 0.01em; line-height: 1; white-space: nowrap;
}
.btn:hover { background: var(--glass-bg-2); color: var(--fg); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ---- Unified semantic pill buttons (success | danger | info | ghost | primary) ----
   All variants share geometry (28px transparent pill) so they line up cleanly
   in any action row. Use .btn-xs (22px) inside dense tables, .btn-lg (38px) for
   marquee CTAs. Color = intent: success=save/run/confirm, danger=delete/revoke,
   info=open/view/configure/download, ghost=back/cancel/secondary. */
.btn-success, .btn-danger, .btn-info, .btn-ghost, .btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 28px; padding: 0 12px; border-radius: 8px;
  font-family: inherit; font-size: 11.5px; font-weight: 500;
  letter-spacing: 0.01em; line-height: 1;
  cursor: pointer; transition: 140ms ease;
  border: 1px solid transparent; background: transparent;
  text-decoration: none; white-space: nowrap;
}
.btn-success:active, .btn-danger:active, .btn-info:active,
.btn-ghost:active, .btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-success[disabled], .btn-danger[disabled], .btn-info[disabled],
.btn-ghost[disabled], .btn-primary[disabled] {
  opacity: 0.5; cursor: not-allowed; transform: none; filter: grayscale(0.25);
}

.btn-success { background: rgba(48,209,88,0.10); color: #1e8a4a; border-color: rgba(48,209,88,0.28); }
.btn-success:hover { background: rgba(48,209,88,0.18); transform: translateY(-1px); }
html.dark .btn-success { color: #5dd97e; }

.btn-danger { background: rgba(255,69,58,0.08); color: #b8261c; border-color: rgba(255,69,58,0.25); }
.btn-danger:hover { background: rgba(255,69,58,0.16); transform: translateY(-1px); }
html.dark .btn-danger { color: #ff8077; }

.btn-info { background: rgba(10,132,255,0.08); color: #0058c4; border-color: rgba(10,132,255,0.25); }
.btn-info:hover { background: rgba(10,132,255,0.16); transform: translateY(-1px); }
html.dark .btn-info { color: #79b6ff; }

.btn-ghost { background: transparent; color: var(--fg-2); border-color: var(--line); }
.btn-ghost:hover { background: var(--glass-bg-2); color: var(--fg); transform: translateY(-1px); }

/* Primary now reads as a slightly bolder transparent blue (intent: info-CTA) */
.btn-primary {
  background: linear-gradient(180deg, rgba(10,132,255,0.18), rgba(10,132,255,0.10));
  color: #0058c4; border-color: rgba(10,132,255,0.35); font-weight: 600;
}
.btn-primary:hover {
  background: linear-gradient(180deg, rgba(10,132,255,0.28), rgba(10,132,255,0.18));
  transform: translateY(-1px);
}
html.dark .btn-primary { color: #79b6ff; }

/* Sizes — smallest wins */
.btn-xs {
  height: 22px !important; padding: 0 8px !important; border-radius: 6px !important;
  font-size: 10.5px !important; gap: 4px !important;
}
.btn-sm {
  height: 26px; padding: 0 10px; border-radius: 7px; font-size: 11px;
}
.btn-lg {
  height: 38px; padding: 0 18px; border-radius: 10px;
  font-size: 13px; font-weight: 600;
}

/* Right-aligned action footer for forms / cards */
.row-actions {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; flex-wrap: wrap; margin-top: 14px;
}
.row-actions-spread {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-top: 14px;
}

/* ===== Chips / dots ===== */
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
  border-radius: 6px; font-size: 10.5px; font-weight: 500; letter-spacing: 0.01em;
  background: rgba(10,10,15,0.05); color: var(--fg-2);
}
html.dark .chip { background: rgba(255,255,255,0.06); }
.chip-good { background: rgba(48, 209, 88, 0.14); color: #0c8e3a; }
.chip-warn { background: rgba(255, 159, 10, 0.16); color: #b46500; }
.chip-bad  { background: rgba(255, 69, 58, 0.14); color: #b8261c; }
.chip-info { background: rgba(10, 132, 255, 0.14); color: #0058c4; }
html.dark .chip-good { color: #5fec8a; }
html.dark .chip-warn { color: #ffb84d; }
html.dark .chip-bad  { color: #ff8077; }
html.dark .chip-info { color: #6ab6ff; }

.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot-good { background: var(--good); box-shadow: 0 0 0 3px rgba(48,209,88,0.18); }
.dot-warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(255,159,10,0.18); }
.dot-bad  { background: var(--bad);  box-shadow: 0 0 0 3px rgba(255,69,58,0.18); }
.dot-info { background: var(--info); box-shadow: 0 0 0 3px rgba(100,210,255,0.18); }
.status-pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(48,209,88,0.6); } 50% { box-shadow: 0 0 0 6px rgba(48,209,88,0); } }

.live-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--bad);
  display: inline-block; animation: live 1.6s ease-in-out infinite;
}
@keyframes live { 0%,100% { box-shadow: 0 0 0 0 rgba(255,69,58,0.5); } 50% { box-shadow: 0 0 0 6px rgba(255,69,58,0); } }

/* ===== Inputs ===== */
.input {
  width: 100%; height: 42px; padding: 0 14px;
  border-radius: 12px; font-size: 13.5px; outline: none;
  background: rgba(255,255,255,0.55);
  border: 1px solid var(--line); color: var(--fg);
  transition: 150ms ease; font-family: inherit;
}
html.dark .input { background: rgba(255,255,255,0.04); }
.input:focus { border-color: rgba(10,132,255,0.5); box-shadow: 0 0 0 3px rgba(10,132,255,0.15); }
.input::placeholder { color: var(--fg-4); }
.input-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }

.field-label {
  color: var(--fg-2); font-size: 11.5px; font-weight: 500;
  display: block; margin-bottom: 6px;
}
.field-error { color: var(--bad); font-size: 11.5px; margin-top: 4px; }

/* Switch */
.switch { display: inline-flex; align-items: center; gap: 10px; user-select: none; cursor: pointer; }
.switch input { display: none; }
.switch .track {
  width: 40px; height: 24px; border-radius: 999px;
  background: rgba(10,10,15,0.18); position: relative; transition: background .15s ease;
}
html.dark .switch .track { background: rgba(255,255,255,0.18); }
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: white; box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  transition: transform .18s ease;
}
.switch input:checked + .track { background: var(--good); }
.switch input:checked + .track::after { transform: translateX(16px); }

/* ===== Sidebar / nav ===== */
.app-shell { position: relative; z-index: 2; display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  border-right: 1px solid var(--line);
  padding: 14px 10px 12px; display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(10,10,15,0.10); border-radius: 3px; }
html.dark .sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); }

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 2px 6px 8px;
}
.brand .name { font-family: 'Inter Tight', sans-serif; font-weight: 600; font-size: 15px; letter-spacing: -0.015em; color: var(--fg); }
.brand .ver { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--fg-3); display: block; }

/* Workspace card */
.ws-card {
  margin: 0 2px 6px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--glass-bg-2);
  border: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; transition: 120ms ease;
}
.ws-card:hover:not(.ws-static) { background: rgba(255,255,255,0.7); }
html.dark .ws-card:hover:not(.ws-static) { background: rgba(255,255,255,0.06); }
.ws-card.ws-static { cursor: default; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.side-actions a:focus-visible, .side-actions button:focus-visible,
.search-wrap:focus-within { outline: 2px solid var(--accent-1); outline-offset: 2px; }
.ws-card .ws-avatar {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, #ff6b9d, #ffb340);
  display: grid; place-items: center; color: #fff;
  font-weight: 700; font-size: 12px; flex-shrink: 0;
}
.ws-card .ws-meta { flex: 1; min-width: 0; line-height: 1.2; }
.ws-card .ws-meta .top { font-size: 12.5px; font-weight: 600; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-card .ws-meta .sub { font-size: 10.5px; color: var(--fg-3); margin-top: 1px; }
.ws-card .ws-chev { color: var(--fg-4); }

/* Sidebar primary CTA */
.side-cta {
  margin: 2px 2px 6px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; border-radius: 10px; border: 0; cursor: pointer;
  background: var(--accent-grad); color: #fff;
  font-family: inherit; font-size: 12.5px; font-weight: 600;
  box-shadow: 0 1px 0 rgba(255,255,255,0.3) inset, 0 6px 18px -4px rgba(10,132,255,0.55);
  transition: 150ms ease; text-decoration: none;
}
.side-cta:hover { filter: brightness(1.05); }

/* Sidebar action icon row */
.side-actions {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 4px; margin: 0 2px 8px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.side-actions a, .side-actions button {
  display: grid; place-items: center;
  height: 26px; border-radius: 7px;
  background: rgba(10,10,15,0.04);
  border: 1px solid var(--line);
  color: var(--fg-2); cursor: pointer;
  transition: 120ms ease;
}
html.dark .side-actions a, html.dark .side-actions button { background: rgba(255,255,255,0.04); }
.side-actions a:hover, .side-actions button:hover {
  background: var(--glass-bg-2); color: var(--fg);
}
.side-actions svg { width: 13px; height: 13px; }

.logo-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent-grad);
  display: grid; place-items: center;
  box-shadow: 0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px -2px rgba(10,132,255,0.5);
}
.logo-mark.lg {
  width: 44px; height: 44px; border-radius: 14px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.3) inset, 0 8px 24px -4px rgba(10,132,255,0.5);
}
/* When the mark holds a real image (spotter.ai logo), drop the gradient
   pill so the image's own background shows clean. */
.logo-mark.img {
  background: #ffffff;
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset, 0 4px 12px -2px rgba(0,0,0,0.18);
  overflow: hidden;
}
.logo-mark.img img { width: 78%; height: 78%; object-fit: contain; display: block; margin: auto; }

.nav-section {
  font-size: 10px; font-weight: 600; color: var(--fg-4);
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 8px 12px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 5px 10px;
  border-radius: 9px; color: var(--fg-2); font-weight: 500; font-size: 12.5px;
  cursor: pointer; transition: 120ms ease; position: relative;
}
.nav-item .grow { flex: 1; }
.nav-item .nav-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; padding: 2px 6px; border-radius: 5px;
  background: rgba(10,10,15,0.06); color: var(--fg-3);
}
html.dark .nav-item .nav-badge { background: rgba(255,255,255,0.06); }
.nav-item .nav-live {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: 'JetBrains Mono', monospace; font-size: 9.5px;
  padding: 2px 6px; border-radius: 5px;
  background: rgba(255,69,58,0.14); color: #b8261c; font-weight: 600;
  letter-spacing: 0.04em;
}
html.dark .nav-item .nav-live { color: #ff8077; }
.nav-item .nav-live::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%;
  background: #ff453a; animation: live 1.6s ease-in-out infinite;
}
.nav-item:hover { background: rgba(10,10,15,0.04); color: var(--fg); }
html.dark .nav-item:hover { background: rgba(255,255,255,0.05); }
.nav-item.active {
  background: var(--glass-bg-2); color: var(--fg);
  box-shadow: 0 1px 0 var(--glass-stroke) inset, 0 0 0 1px var(--line);
}
.nav-item.active::before {
  content: ''; position: absolute; left: -2px; top: 8px; bottom: 8px; width: 2px;
  background: var(--accent-grad); border-radius: 2px;
}
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.85; }

/* Monthly usage strip */
.usage-strip {
  margin: 6px 2px 4px; padding: 8px 10px;
  border-radius: 12px;
  background: var(--glass-bg-2);
  border: 1px solid var(--line);
}
.usage-strip .row { justify-content: space-between; gap: 6px; }
.usage-strip .lbl { font-size: 11px; color: var(--fg-3); }
.usage-strip .pct { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; color: var(--fg-2); font-weight: 600; }
.usage-strip .bar {
  height: 4px; border-radius: 4px; background: rgba(10,10,15,0.08);
  overflow: hidden; position: relative; margin-top: 7px;
}
html.dark .usage-strip .bar { background: rgba(255,255,255,0.08); }
.usage-strip .bar > i {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--accent-grad); border-radius: inherit;
}
.usage-strip .meta { display: flex; justify-content: space-between; align-items: center; margin-top: 7px; }
.usage-strip .meta span { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--fg-3); }
.usage-strip .meta a {
  font-size: 10.5px; padding: 3px 8px; border-radius: 6px;
  background: rgba(10,132,255,0.10); color: var(--accent-1);
  font-weight: 600;
}

.user-card {
  border-top: 1px solid var(--line);
  padding-top: 8px; margin-top: 4px;
}
.user-card .row { display: flex; align-items: center; gap: 10px; padding: 2px 6px 6px; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, #ff6b9d, #ffb340);
}
.user-card .meta { font-size: 11.5px; color: var(--fg-3); line-height: 1.3; }
.user-card .meta b { color: var(--fg); display: block; font-size: 12.5px; font-weight: 600; }

/* ===== Main / page ===== */
.main { padding: 0 28px 32px; min-width: 0; display: flex; flex-direction: column; }

/* Topbar — attached edge-to-edge, fully white, sticky */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 28px;
  margin: 0 -28px 18px;
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 0;
  border-radius: 0;
  box-shadow: 0 8px 22px -14px rgba(15, 17, 26, 0.12);
}
html.dark .topbar {
  background: rgba(14, 14, 20, 0.62);
  box-shadow: 0 10px 26px -14px rgba(0, 0, 0, 0.6);
}
.topbar .crumbs {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--fg-3);
  border-radius: 9px;
  padding: 0 4px; height: 28px;
  white-space: nowrap;
}
.topbar .crumbs b { color: var(--fg); font-weight: 600; }
.topbar .crumbs .sep { color: var(--fg-4); }

.search-wrap { position: relative; flex: 1 1 auto; max-width: 560px; margin: 0 16px; }
.search-wrap > svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--fg-4); pointer-events: none;
}
.search-input {
  background: var(--glass-bg);
  border: 1px solid var(--line);
  border-radius: 9px; padding: 0 56px 0 32px;
  height: 32px; width: 100%; color: var(--fg);
  font-size: 12.5px; font-family: inherit;
  backdrop-filter: blur(20px) saturate(160%);
}
.search-input::placeholder { color: var(--fg-4); }
.search-input:focus { outline: none; border-color: rgba(10,132,255,0.5); box-shadow: 0 0 0 3px rgba(10,132,255,0.15); }
.search-wrap kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
}
.topbar .spacer { flex: 1; }
.topbar .pills { display: flex; align-items: center; gap: 8px; }

/* User pill (account menu) in topbar — replaces old sidebar user-card */
.user-pill {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 8px 0 4px;
  border-radius: 16px;
  background: var(--glass-bg); border: 1px solid var(--line);
  color: var(--fg-2); cursor: pointer; user-select: none;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  transition: 120ms ease;
}
.user-pill:hover, .user-pill:focus-visible { color: var(--fg); border-color: rgba(10,132,255,0.35); outline: none; }
.user-pill .avatar { width: 24px; height: 24px; border-radius: 50%; font-size: 10.5px; }
.user-pill .meta { display: flex; flex-direction: column; line-height: 1.1; max-width: 150px; }
.user-pill .meta b { font-size: 11.5px; font-weight: 600; color: var(--fg);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.user-pill .meta em { font-size: 9.5px; color: var(--fg-3); font-style: normal;
  font-family: 'JetBrains Mono', monospace; letter-spacing: 0.04em; text-transform: uppercase; }
.user-pill .chev { color: var(--fg-4); flex-shrink: 0; }

.user-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 200px; padding: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-2);
  display: none; flex-direction: column; gap: 2px;
  z-index: 50;
}
html.dark .user-menu { background: #1a1a22; }
.user-pill.open .user-menu { display: flex; }
.user-menu form { margin: 0; padding: 0; }
.user-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  font-size: 12.5px; font-weight: 500; color: var(--fg-2);
  background: transparent; border: 0; cursor: pointer;
  width: 100%; text-align: left; font-family: inherit;
  text-decoration: none;
}
.user-menu-item:hover { background: rgba(10,132,255,0.10); color: var(--fg); }
.user-menu-item.danger { color: #b8261c; }
html.dark .user-menu-item.danger { color: #ff8077; }
.user-menu-item.danger:hover { background: rgba(255,69,58,0.12); }

@media (max-width: 720px) {
  .user-pill .meta { display: none; }
  .user-pill { padding: 0 6px; }
}

.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; margin-bottom: 18px;
}
.page-header h1 {
  margin: 0; font-family: 'Inter Tight', sans-serif;
  font-size: 17px; font-weight: 600; letter-spacing: -0.018em; line-height: 1.2;
}
.page-header .sub { color: var(--fg-3); font-size: 10.5px; margin-top: 3px; }

/* Cards */
.card { padding: 16px; }
.card h2 {
  margin: 0 0 10px; font-family: 'Inter Tight', sans-serif;
  font-size: 12px; font-weight: 600; letter-spacing: -0.008em;
}
.card .muted { color: var(--fg-3); font-size: 10.5px; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { padding: 18px 20px; }
.stat-card .lbl {
  font-family: 'JetBrains Mono', monospace; font-size: 10.5px; font-weight: 600;
  color: var(--accent-1); letter-spacing: 0.06em; text-transform: uppercase;
}
.stat-num { font-family: 'Inter Tight', sans-serif; font-weight: 600; letter-spacing: -0.02em; font-size: 18px; margin-top: 5px; }
.stat-card .delta { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; color: var(--fg-3); margin-top: 2px; }

/* ===== Tables ===== */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.tbl th { text-align: left; font-weight: 500; color: var(--fg-3); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); color: var(--fg-2); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: rgba(10,10,15,0.02); }
html.dark .tbl tr:hover td { background: rgba(255,255,255,0.025); }

/* ===== Toasts / messages ===== */
.toast {
  padding: 10px 14px; border-radius: 12px; font-size: 12.5px; margin-bottom: 12px;
  background: rgba(48,209,88,0.10); color: #0c8e3a;
  border: 1px solid rgba(48,209,88,0.22);
}
.toast.warning { background: rgba(255,159,10,0.10); color: #b46500; border-color: rgba(255,159,10,0.25); }
.toast.error   { background: rgba(255,69,58,0.10);  color: #b8261c; border-color: rgba(255,69,58,0.22); }

/* ===== Prominent login error panel ===== */
.login-error {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,69,58,0.10), rgba(255,69,58,0.06));
  border: 1px solid rgba(255,69,58,0.30);
  color: #b8261c;
  box-shadow: 0 6px 18px rgba(255,69,58,0.12), inset 0 0 0 1px rgba(255,255,255,0.4);
  animation: login-shake 0.42s cubic-bezier(.36,.07,.19,.97) both;
}
.login-error svg { flex-shrink: 0; margin-top: 1px; color: #d62b1f; }
.login-error-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.login-error-title { font-size: 13px; font-weight: 600; letter-spacing: -0.005em; }
.login-error-hint  { font-size: 11.5px; color: #8e2c25; opacity: 0.85; }
html.dark .login-error { color: #ff8077; background: linear-gradient(180deg, rgba(255,69,58,0.16), rgba(255,69,58,0.08)); }
html.dark .login-error svg { color: #ff5c52; }
html.dark .login-error-hint { color: #ff8077; }

@keyframes login-shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}
html.dark .toast { color: #5fec8a; }
html.dark .toast.warning { color: #ffb84d; }
html.dark .toast.error { color: #ff8077; }

/* ===== Terminal ===== */
.terminal {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #0a0a0f;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: var(--shadow-2);
  display: flex; flex-direction: column;
  font-family: 'JetBrains Mono', monospace;
}
.terminal .titlebar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: linear-gradient(180deg, #15151b, #0a0a0f);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.terminal .dots { display: flex; gap: 6px; }
.terminal .dots span { width: 11px; height: 11px; border-radius: 50%; }
.terminal .dots .r { background: #ff5f57; }
.terminal .dots .y { background: #febc2e; }
.terminal .dots .g { background: #28c840; }
.terminal .title  { font-size: 11.5px; color: #8a8a96; font-weight: 500; }
.terminal .badge {
  font-size: 10.5px; padding: 3px 9px; border-radius: 999px;
  background: rgba(255,255,255,0.06); color: #8a8a96;
  letter-spacing: 0.05em;
}
.terminal .badge.running { background: rgba(48,209,88,0.18); color: #5fec8a; }
.terminal .badge.success { background: rgba(48,209,88,0.18); color: #5fec8a; }
.terminal .badge.failed  { background: rgba(255,69,58,0.20); color: #ff8077; }
.terminal .badge.pending { background: rgba(255,214,10,0.16); color: #ffd60a; }
.terminal .badge.idle    { background: rgba(255,255,255,0.06); color: #8a8a96; }

.terminal pre {
  margin: 0; padding: 12px 16px;
  font-size: 11.5px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
  max-height: 520px; min-height: 320px; overflow: auto;
  color: #d6d6dc;
  background: #0a0a0f;
}
.terminal pre.term-log-full {
  max-height: calc(100vh - 240px); min-height: 480px;
}

/* ===== Compact cmd panel (status + thin progress bar + stats) ===== */
.terminal-compact .cmd-body {
  padding: 12px 16px 10px;
  background: #0a0a0f;
  display: flex; flex-direction: column; gap: 8px;
}
.terminal pre.cmd-ascii {
  margin: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 7.5px; line-height: 1.0;
  color: #00ff7f;
  white-space: pre;
  overflow-x: auto; overflow-y: hidden;
  padding: 0;
  text-align: center;
  background: transparent;
  min-height: 0; max-height: none;
}
.cmd-ascii .lc-banner { color: #00ff7f; text-shadow: 0 0 6px rgba(0,255,127,0.45); font-weight: 600; }
@media (min-width: 720px) { .cmd-ascii { font-size: 9px; } }
@media (min-width: 1100px){ .cmd-ascii { font-size: 10.5px; } }

.cmd-tag-row { display: flex; justify-content: center; margin-top: -2px; }
.cmd-tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 6px;
  background: rgba(0, 255, 127, 0.10);
  border: 1px solid rgba(0, 255, 127, 0.35);
  color: #00ff7f;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.14em;
  text-shadow: 0 0 6px rgba(0, 255, 127, 0.45);
  box-shadow: 0 0 12px rgba(0, 255, 127, 0.18), inset 0 0 0 1px rgba(0,255,127,0.06);
}

/* ===== Log-page stats header (replaces the ASCII banner on /runs/<id>/log/) ===== */
.log-stats-bar {
  display: grid; grid-template-columns: repeat(7, minmax(0,1fr));
  gap: 1px;
  background: rgba(255,255,255,0.06);
  border-top: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-family: 'JetBrains Mono', monospace;
}
.log-stats-bar .ls-cell {
  background: #0a0a0f;
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 3px;
  min-width: 0;
}
.log-stats-bar .ls-cell span {
  font-size: 9.5px; color: #6c6c78;
  letter-spacing: 0.10em; text-transform: uppercase;
}
.log-stats-bar .ls-cell b {
  font-size: 13px; font-weight: 600; color: #e7e7ea;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.log-stats-bar .ls-ok   { color: #5fec8a; text-shadow: 0 0 6px rgba(95,236,138,0.35); }
.log-stats-bar .ls-bad  { color: #ff5c52; text-shadow: 0 0 6px rgba(255,92,82,0.35); }
.log-stats-bar .ls-warn { color: #ffd166; }
.log-stats-bar .ls-num  { color: #c792ea; }
.log-stats-bar .ls-dim  { color: #6c6c78; }
@media (max-width: 900px) { .log-stats-bar { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 540px) { .log-stats-bar { grid-template-columns: repeat(2, 1fr); } }

.cmd-progress { display: flex; flex-direction: column; gap: 6px; }
.cmd-progress .bar {
  position: relative; height: 4px; border-radius: 2px;
  background: rgba(255,255,255,0.06); overflow: hidden;
}
.cmd-progress .bar .fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, #00ff7f, #5fec8a);
  box-shadow: 0 0 8px rgba(0,255,127,0.55);
  border-radius: 2px;
  transition: width 0.4s ease;
}
.cmd-progress .bar .fill.fill-bad {
  background: linear-gradient(90deg, #ff5c52, #ff8077);
  box-shadow: 0 0 8px rgba(255,92,82,0.55);
}
.cmd-progress .pct-row {
  display: flex; align-items: center; gap: 12px;
  font-family: 'JetBrains Mono', monospace; font-size: 10.5px;
}
.cmd-progress .pct { color: #00ff7f; font-weight: 600; }

.cmd-stats {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
}
.cmd-stats > div { display: flex; flex-direction: column; gap: 2px; }
.cmd-stats span { font-size: 9.5px; color: #6c6c78; text-transform: uppercase; letter-spacing: 0.08em; }
.cmd-stats b { font-size: 12.5px; color: #e7e7ea; font-weight: 600; }
.cmd-stats b.ok   { color: #5fec8a; }
.cmd-stats b.warn { color: #ffd166; }

.cmd-actions {
  display: flex; align-items: center; gap: 10px;
  padding-top: 4px;
  border-top: 1px dashed rgba(255,255,255,0.06);
  margin-top: 2px;
  font-family: 'JetBrains Mono', monospace; font-size: 10.5px;
}
.btn-log {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 8px;
  background: rgba(0,255,127,0.10); color: #5fec8a;
  border: 1px solid rgba(0,255,127,0.25);
  font-weight: 600; font-size: 10.5px;
  text-decoration: none; cursor: pointer;
  transition: all 0.15s ease;
}
.btn-log:hover { background: rgba(0,255,127,0.18); box-shadow: 0 0 12px rgba(0,255,127,0.35); }

/* Failure diagnostics block in the terminal pane.
   Rendered when a ScraperRun.status == "failed". The goal is to surface
   the full error message + a friendly classified hint right inside the
   compact terminal card — previously the error was a tiny truncated chip
   in the action bar (truncatechars:80) which was easy to miss, and on
   fast-fail runs (empty error) there was nothing visible at all. */
.cmd-fail {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255,92,82,0.12), rgba(255,92,82,0.04));
  border: 1px solid rgba(255,92,82,0.30);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  color: #ffd6d2;
  display: flex; flex-direction: column; gap: 6px;
}
.cmd-fail-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
}
.cmd-fail-badge {
  padding: 2px 8px; border-radius: 999px;
  background: rgba(255,92,82,0.25); color: #ff8b80;
  font-weight: 700; letter-spacing: 0.08em;
}
.cmd-fail-title { color: #ffb3ad; font-weight: 600; }
.cmd-fail-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 10px; align-items: start;
}
.cmd-fail-label {
  color: #ff8b80; font-weight: 600;
  text-transform: uppercase; font-size: 9.5px; letter-spacing: 0.08em;
  padding-top: 2px;
}
.cmd-fail-msg {
  color: #ffe2de; background: rgba(0,0,0,0.30);
  padding: 4px 8px; border-radius: 6px;
  word-break: break-word; white-space: pre-wrap;
  display: inline-block; max-width: 100%;
}
.cmd-fail-hint { color: #ffd6d2; line-height: 1.55; }
.cmd-fail-hint a { color: #ffb3ad; text-decoration: underline; }
.cmd-fail-hint a:hover { color: #fff; }

@media (max-width: 720px) {
  .cmd-stats { grid-template-columns: repeat(3, 1fr); }
  .cmd-fail-row { grid-template-columns: 1fr; gap: 2px; }
}
.terminal pre::-webkit-scrollbar { width: 8px; }
.terminal pre::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 4px; }
.terminal pre::-webkit-scrollbar-track { background: transparent; }

/* Log token colors emitted by the `colorize_log` template filter */
.terminal pre .lc-banner {
  color: #00ff7f;                                       /* matrix green */
  text-shadow: 0 0 6px rgba(0, 255, 127, 0.45);
  font-weight: 600;
}
.terminal pre .lc-ok     { color: #5fec8a; }
.terminal pre .lc-bad    { color: #ff5c52; font-weight: 600; text-shadow: 0 0 4px rgba(255,92,82,0.35); }
.terminal pre .lc-warn   { color: #ffd166; }
.terminal pre .lc-info   { color: #61c7ff; }
.terminal pre .lc-dim    { color: #6c6c78; }
.terminal pre .lc-num    { color: #c792ea; }

.terminal .titlebar { padding: 8px 12px; }

/* ===== Theme toggle pill ===== */
.theme-pill {
  height: 32px; padding: 0 12px; border-radius: 16px;
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--glass-bg); border: 1px solid var(--line);
  color: var(--fg-2); font-weight: 500; font-size: 11.5px;
  backdrop-filter: blur(20px) saturate(180%);
  cursor: pointer; font-family: inherit;
}
.theme-pill:hover { color: var(--fg); }
.theme-pill.fixed { position: fixed; top: 16px; right: 16px; z-index: 10; }

/* Login two-pane */
.login-wrap {
  position: relative; z-index: 2;
  min-height: 100vh; display: grid; place-items: center; padding: 16px;
}
.login-card { width: 100%; max-width: 960px; overflow: hidden; }
.login-grid { display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 820px) { .login-grid { grid-template-columns: 1fr; } .login-side { display: none; } }
.login-form { padding: 44px; display: flex; flex-direction: column; min-height: 580px; }
.login-side {
  position: relative; padding: 44px;
  background: linear-gradient(135deg, rgba(10,132,255,0.12), rgba(191,90,242,0.10));
  overflow: hidden;
  display: flex; flex-direction: column;
}
.login-side .grid-bg {
  position: absolute; inset: 0; opacity: 0.4;
  background-image:
    linear-gradient(to right, rgba(10,10,15,0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(10,10,15,0.05) 1px, transparent 1px);
  background-size: 32px 32px;
}
html.dark .login-side .grid-bg {
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.05) 1px, transparent 1px);
}

kbd {
  font-family: 'JetBrains Mono', monospace; font-size: 10.5px;
  padding: 2px 5px; border-radius: 5px;
  background: rgba(10,10,15,0.06); border: 1px solid var(--line);
  color: var(--fg-3); line-height: 1;
}
html.dark kbd { background: rgba(255,255,255,0.06); }

/* small utilities */
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.gap-y > * + * { margin-top: 16px; }
.scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll::-webkit-scrollbar-thumb { background: rgba(10,10,15,0.18); border-radius: 4px; }
html.dark .scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); }

/* ===========================================================
   Floating sidebar + responsive shell
   Overrides earlier .app-shell / .sidebar / .main rules.
   =========================================================== */

.app-shell {
  display: block;
  min-height: 100vh;
  grid-template-columns: none;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 244px;
  height: 100vh;
  border-radius: 0;
  border: 0;
  box-shadow: 6px 0 28px -12px rgba(15, 17, 26, 0.10);
  padding: 14px 12px;
  z-index: 60;
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .28s cubic-bezier(.22,.8,.32,1);
  /* Translucent glass — content shows through softly without harming readability */
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
}
html.dark .sidebar {
  background: rgba(14, 14, 20, 0.62);
  box-shadow: 6px 0 32px -12px rgba(0, 0, 0, 0.55);
}
.sidebar::after { content: none; }

/* Three-zone sidebar: head + scrollable nav + pinned foot */
.sb-head, .sb-foot { flex-shrink: 0; }
.sb-nav {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  margin: 2px 0 4px;
  padding: 0 2px;
  /* Hide scrollbar visually — content is sized to fit on standard viewports */
  scrollbar-width: none;
}
.sb-nav::-webkit-scrollbar { width: 0; height: 0; display: none; }
.sb-nav .nav-section:first-child { padding-top: 6px; }

.main {
  margin-left: 244px;          /* sidebar width, attached edge-to-edge */
  padding: 0 28px 32px;
  min-width: 0;
  display: flex; flex-direction: column;
}

/* Mobile menu toggle (hidden on desktop) */
.sb-toggle {
  display: none;
  width: 36px; height: 36px;
  border-radius: 10px;
  align-items: center; justify-content: center;
  background: var(--glass-bg);
  border: 1px solid var(--line);
  color: var(--fg);
  cursor: pointer;
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  flex-shrink: 0;
}
.sb-toggle:hover { background: var(--glass-bg-2); }

/* Backdrop for mobile drawer */
.sb-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 55;
  background: rgba(10,10,15,0.42);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: sb-fade .2s ease;
}
@keyframes sb-fade { from { opacity: 0; } to { opacity: 1; } }
body.sidebar-open .sb-backdrop { display: block; }
body.sidebar-open { overflow: hidden; }

/* Dashboard split: main panel + system panel that wraps under on narrow widths */
.dash-split { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
@media (max-width: 980px) {
  .dash-split { grid-template-columns: 1fr; }
}

/* Tablet: narrower main padding */
@media (max-width: 1280px) {
  .main { padding: 0 20px 28px; }
}

/* Small tablet: shrink sidebar but keep menu+body layout intact */
@media (max-width: 1100px) {
  .sidebar { width: 208px; padding: 10px 8px; }
  .main { margin-left: 230px; padding: 0 18px 24px; }
  .nav-item { font-size: 12px; padding: 6px 9px; }
  .ws-card { padding: 8px; }
  .usage-strip { padding: 9px; }
}

/* Phone: hide sidebar by default, show as drawer */
@media (max-width: 768px) {
  .sidebar {
    width: min(280px, 84vw);
    padding: 12px 10px;
    transform: translateX(calc(-100% - 24px));
    box-shadow: var(--shadow-2), 0 30px 80px -20px rgba(0,0,0,0.45);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .main { margin-left: 0; padding: 0 16px 24px; }
  .sb-toggle { display: inline-flex; }
  .topbar { padding-top: 12px; padding-bottom: 12px; }
  .topbar .crumbs { padding: 0 10px; height: 30px; font-size: 12px; }
  .nav-item, .ws-card, .usage-strip { font-size: 12.5px; padding: 7px 10px; }
  .ws-card, .usage-strip { padding: 10px; }
}

/* Phone: collapse search + secondary chips, allow topbar to wrap, stack page header */
@media (max-width: 720px) {
  body { font-size: 12.5px; }
  .topbar {
    flex-wrap: wrap; gap: 10px;
    padding-top: 10px; padding-bottom: 10px; margin-bottom: 14px;
  }
  .search-wrap { display: none; }
  .topbar .pills { gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
  .topbar .pills .chip-info { display: none; }      /* hide US-East */
  .topbar .pills > button[aria-label="Notifications"] { display: none; }
  .crumb-root { display: none; }
  .topbar .crumbs .sep { display: none; }

  .page-header {
    flex-direction: column; align-items: stretch;
    gap: 12px; margin-bottom: 14px;
  }
  .page-header h1 { font-size: 22px; }

  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px 16px; }
  .stat-num { font-size: 22px; }

  .card { padding: 16px; }
  h1 { font-size: 22px; }

  /* Tables: allow horizontal scroll instead of overflow */
  .tbl, .data-table {
    display: block; overflow-x: auto; white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  /* Lab + API grids already collapse; tighten spacing */
  .lab-fields { grid-template-columns: 1fr !important; }
}

/* Very narrow phones */
@media (max-width: 420px) {
  .stat-grid { grid-template-columns: 1fr; }
  .main { padding: 0 12px 20px; }
  .topbar .crumbs { font-size: 11.5px; padding: 0 8px; }
  .page-header h1 { font-size: 20px; }
  .sidebar { width: 86vw; left: 8px; top: 8px; bottom: 8px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .sidebar, .sb-backdrop { transition: none !important; animation: none !important; }
}

/* ---- Safety app: jobs/keys page styles -------------------------------- */
.page { max-width: 1280px; margin: 0 auto; padding: 18px 22px 52px; }
.page-header { margin-bottom: 14px; }
.page-header h1 { margin: 0 0 3px; font-size: 17px; font-weight: 700; }
.page-header p.muted { margin: 0; color: var(--muted, #6b7280); font-size: 10.5px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.lbl { display:block; font-size: 10.5px; font-weight: 600; color: var(--muted,#6b7280); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.input { padding: 7px 11px; border-radius: 10px; border: 1px solid var(--border,#e5e7eb); background: var(--surface,#fff); font-size: 12.5px; min-width: 180px; }
.btn-sm { padding: 4px 10px; font-size: 11px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 8px 11px; text-align: left; font-size: 12px; border-bottom: 1px solid var(--border,#eef0f3); }
.table th { font-weight: 600; color: var(--muted,#6b7280); font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; }
.table code { background: rgba(0,0,0,.04); padding: 2px 6px; border-radius: 4px; font-size: 11px; }
.badge { display:inline-block; padding: 2px 9px; border-radius: 999px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.badge-pending   { background: rgba(255,214,10,0.18); color: #b89000; }
.badge-running   { background: rgba(10,132,255,0.18); color: #0a84ff; }
.badge-succeeded { background: rgba(48,209,88,0.18); color: #2bb673; }
.badge-failed    { background: rgba(255,69,58,0.20); color: #c93030; }

/* ===== Proxies page: static proxy list + per-row edit ===== */
.proxy-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .proxy-grid { grid-template-columns: 1fr; } }

.input.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; letter-spacing: 0.01em; }
.form-err { color: #c93030; font-size: 11px; margin-top: 4px; }

.static-add { padding-top: 4px; }
.static-add-grid {
  display: grid;
  grid-template-columns: 180px 1fr 220px auto;
  gap: 10px;
  align-items: end;
}
.static-add-grid .grow { min-width: 0; }
.static-add-grid .add-actions { display: flex; gap: 8px; align-items: center; }
@media (max-width: 900px) { .static-add-grid { grid-template-columns: 1fr 1fr; } .static-add-grid .add-actions { grid-column: 1 / -1; justify-content: flex-end; } .static-add-grid .grow { grid-column: 1 / -1; } }

.static-list { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.empty-row { padding: 14px; color: var(--muted, #6b7280); font-size: 12px; text-align: center; border: 1px dashed var(--border, #e5e7eb); border-radius: 10px; }

.static-row { border: 1px solid var(--border, #e5e7eb); border-radius: 10px; background: var(--surface, #fff); }
.static-row.is-off { opacity: 0.65; }
.static-row > summary {
  list-style: none; cursor: default;
  display: grid;
  grid-template-columns: 18px minmax(120px, 180px) 1fr minmax(160px, 220px) auto;
  gap: 12px; align-items: center;
  padding: 10px 14px;
}
.static-row > summary::-webkit-details-marker { display: none; }
.sr-status .dot { display:inline-block; width:8px; height:8px; border-radius:50%; }
.dot-good { background:#30d158; box-shadow: 0 0 6px rgba(48,209,88,0.55); }
.dot-warn { background:#ff9500; box-shadow: 0 0 6px rgba(255,149,0,0.45); }
.sr-label { font-weight: 600; font-size: 12.5px; }
.sr-url { font-size: 11.5px; color: var(--muted, #6b7280); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-meta { font-size: 11px; color: var(--muted, #6b7280); white-space: nowrap; }
.sr-actions { display: flex; gap: 6px; align-items: center; }
.sr-edit-toggle { cursor: pointer; user-select: none; }
.sr-edit-form { padding: 0 14px 14px; border-top: 1px solid var(--border, #eef0f3); padding-top: 12px; margin-top: 2px; }
@media (max-width: 900px) {
  .static-row > summary { grid-template-columns: 18px 1fr auto; }
  .sr-url, .sr-meta { grid-column: 2 / -1; }
}

/* Proxy select dropdown on scraper page */
.proxy-select { min-width: 220px; padding: 8px 12px; border-radius: 10px; }
.scraper-launch { display: flex; flex-direction: column; gap: 4px; }
.scraper-launch .field-label { font-size: 10.5px; }

/* ===== Bell + notifications dropdown (topbar) ============================ */
.topbar-spacer { flex: 1 1 auto; }
.bell-wrap { position: relative; }
.bell-btn { position: relative; }
.bell-dot {
  position: absolute; top: -4px; right: -4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px;
  background: #ff453a; color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px;
  text-align: center; box-shadow: 0 0 0 2px var(--bg, #fff);
}
html.dark .bell-dot { box-shadow: 0 0 0 2px #0e0e14; }

.bell-panel {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 360px; max-width: calc(100vw - 24px);
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  box-shadow: 0 12px 40px -10px rgba(15,17,26,0.20);
  padding: 8px 8px 6px;
  z-index: 80;
  display: none;
  max-height: 70vh; overflow: hidden;
  flex-direction: column;
}
html.dark .bell-panel { background: #15151c; border-color: #25252e; box-shadow: 0 14px 50px -10px rgba(0,0,0,0.6); }
.bell-wrap.open .bell-panel { display: flex; }

.bell-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px 8px; gap: 10px;
  border-bottom: 1px solid var(--border, #eef0f3);
}
.bell-title { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.bell-count { font-size: 10px; padding: 2px 7px; border-radius: 999px; background: rgba(255,69,58,0.15); color: #c93030; font-weight: 600; }
.btn-link { background: none; border: 0; color: var(--accent-1, #0a84ff); font-size: 11.5px; cursor: pointer; padding: 4px 6px; }
.btn-link:hover { text-decoration: underline; }

.bell-list { flex: 1 1 auto; overflow-y: auto; padding: 2px 0; }
.bell-item {
  display: grid; grid-template-columns: 8px 1fr auto;
  gap: 9px; align-items: flex-start;
  padding: 9px 10px; border-radius: 10px;
}
.bell-item:hover { background: rgba(0,0,0,0.03); }
html.dark .bell-item:hover { background: rgba(255,255,255,0.04); }
.bell-item.unread { background: rgba(10,132,255,0.06); }
html.dark .bell-item.unread { background: rgba(10,132,255,0.10); }
.bell-dot-mini { display:inline-block; width:8px; height:8px; border-radius:50%; margin-top:6px; background:#9ca3af; }
.bell-dot-mini.lvl-success { background:#30d158; box-shadow:0 0 6px rgba(48,209,88,0.55); }
.bell-dot-mini.lvl-error   { background:#ff453a; box-shadow:0 0 6px rgba(255,69,58,0.55); }
.bell-dot-mini.lvl-warning { background:#ff9500; box-shadow:0 0 6px rgba(255,149,0,0.55); }
.bell-dot-mini.lvl-info    { background:#0a84ff; box-shadow:0 0 6px rgba(10,132,255,0.55); }
.bell-body { min-width: 0; }
.bell-item-title { display:block; font-weight: 600; font-size: 12.5px; color: var(--fg); text-decoration: none; }
.bell-item-title:hover { text-decoration: underline; }
.bell-item-body { font-size: 11.5px; color: var(--muted, #6b7280); margin-top: 2px; word-wrap: break-word; }
.bell-item-meta { font-size: 10.5px; color: var(--fg-4, #9ca3af); margin-top: 3px; }
.bell-actions { display: flex; gap: 4px; align-items: center; }
.bell-icon-btn {
  width: 22px; height: 22px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent; color: var(--muted,#6b7280);
  cursor: pointer;
}
.bell-icon-btn:hover { background: rgba(0,0,0,0.06); color: var(--fg); }
.bell-icon-btn.danger:hover { background: rgba(255,69,58,0.14); color: #c93030; }
.bell-empty { padding: 24px 14px; text-align: center; color: var(--muted, #6b7280); font-size: 12px; }
.bell-foot { padding: 6px 10px; border-top: 1px solid var(--border, #eef0f3); text-align: center; }

/* Settings tabs + notification list rows */
.tabs-row { display: flex; gap: 4px; border-bottom: 1px solid var(--border, #e5e7eb); margin-bottom: 18px; }
.tab-btn {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; font-size: 13px; font-weight: 500;
  color: var(--muted, #6b7280); text-decoration: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab-btn:hover { color: var(--fg); }
.tab-btn.active { color: var(--accent-1, #0a84ff); border-bottom-color: var(--accent-1, #0a84ff); }
.tab-badge { font-size: 10px; padding: 1px 7px; border-radius: 999px; background: rgba(255,69,58,0.15); color: #c93030; font-weight: 700; }

.card-header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.header-actions { display: flex; gap: 8px; align-items: center; }

.notif-list { display: flex; flex-direction: column; gap: 6px; }
.notif-row {
  display: grid; grid-template-columns: 10px 1fr auto; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--border, #eef0f3); border-radius: 10px;
  background: var(--surface, #fff);
  align-items: center;
}
html.dark .notif-row { background: #181820; border-color: #25252e; }
.notif-row.unread { background: rgba(10,132,255,0.05); border-color: rgba(10,132,255,0.20); }
html.dark .notif-row.unread { background: rgba(10,132,255,0.10); }
.notif-title { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.notif-title a { color: inherit; text-decoration: none; }
.notif-title a:hover { text-decoration: underline; }
.notif-text { font-size: 12px; color: var(--muted, #6b7280); margin-top: 3px; }
.notif-meta { font-size: 10.5px; color: var(--fg-4, #9ca3af); margin-top: 5px; }
.notif-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.badge-success { background: rgba(48,209,88,0.18); color: #2bb673; }
.badge-error   { background: rgba(255,69,58,0.20); color: #c93030; }
.badge-warning { background: rgba(255,149,0,0.20); color: #b87000; }
.badge-info    { background: rgba(10,132,255,0.18); color: #0a84ff; }

/* ===== Responsive sidebar fix: drawer kicks in at 1024px (was 768) =====
   Removes the awkward "shrunk floating sidebar" overlap state at 1024–1100px
   shown in the screenshot. Below 1024px the sidebar fully collapses into the
   hamburger drawer; above 1024px it stays at full width 244px. */
@media (max-width: 1100px) and (min-width: 1025px) {
  /* Force the desktop layout to stay consistent in this band — no shrink. */
  .sidebar { width: 244px; padding: 14px 12px; }
  .main { margin-left: 244px; padding: 0 20px 28px; }
  .nav-item { font-size: 12.5px; padding: 7px 10px; }
}
@media (max-width: 1024px) {
  .sidebar {
    width: min(280px, 84vw);
    padding: 12px 10px;
    transform: translateX(calc(-100% - 24px));
    box-shadow: var(--shadow-2), 0 30px 80px -20px rgba(0,0,0,0.45);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .main { margin-left: 0; padding: 0 16px 24px; }
  .sb-toggle { display: inline-flex; }
  .topbar { padding-top: 12px; padding-bottom: 12px; }
  .topbar .crumbs { padding: 0 10px; height: 30px; font-size: 12px; }
  .bell-panel { width: 320px; }
}

/* ===== Scraper "Run settings" card (above the terminal) ================== */
.scraper-settings-card { padding: 14px 16px; margin-bottom: 14px; }
.ssc-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom: 10px; flex-wrap: wrap; }
.ssc-title { margin: 0; font-size: 13.5px; font-weight: 700; }
.ssc-sub { font-size: 11.5px; color: var(--muted, #6b7280); margin-top: 2px; }
.ssc-sub code { background: rgba(0,0,0,0.05); padding: 1px 5px; border-radius: 4px; font-size: 11px; }
html.dark .ssc-sub code { background: rgba(255,255,255,0.08); }
.ssc-saved { font-size: 10.5px; color: var(--fg-4, #9ca3af); white-space: nowrap; padding-top: 2px; }

/* ===== "How it works" step list (mobile-app monitor explainer card) =======
   A numbered, vertically-stacked walkthrough used on the top card of the
   mobile-app monitor page. Pulled into a shared class (rather than per-item
   inline styles) so the seven steps stay visually identical and the page
   markup reads cleanly. Numbers are circular blue badges matching the
   design-system accent; the connecting hairline gives a "timeline" feel so
   it reads start-to-end at a glance. */
.mam-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.mam-steps li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 2px; position: relative; }
/* Hairline timeline connector between consecutive steps (skip the last). */
.mam-steps li:not(:last-child)::before {
  content: ""; position: absolute; left: 13px; top: 34px; bottom: -2px;
  width: 2px; background: linear-gradient(180deg, rgba(10,132,255,.30), rgba(10,132,255,.06));
}
.mam-step-n {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #0a84ff, #6a5cff);
  box-shadow: 0 2px 6px rgba(10,132,255,.30); position: relative; z-index: 1;
}
.mam-step-t { font-size: 13px; font-weight: 650; margin-bottom: 2px; }
.mam-step-d { font-size: 12px; color: var(--muted, #6b7280); line-height: 1.5; }
.mam-step-d code { background: rgba(0,0,0,0.05); padding: 1px 5px; border-radius: 4px; font-size: 11px; }
html.dark .mam-step-d code { background: rgba(255,255,255,0.08); }
/* Highlight the "no login" trick step so the most surprising part stands out. */
.mam-steps li.mam-key .mam-step-n { background: linear-gradient(135deg, #34c759, #0a84ff); }
.mam-key-tag {
  display: inline-block; margin-left: 6px; font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; color: #1c8c3c;
  background: rgba(52,199,89,.14); border: 1px solid rgba(52,199,89,.30);
  padding: 1px 6px; border-radius: 999px; vertical-align: middle;
}
html.dark .mam-key-tag { color: #5fe07f; }

/* ===== htmx request indicator =============================================
   Standard htmx indicator pattern. htmx adds the `.htmx-request` class to the
   element that fired the request (and toggles it on hx-indicator targets) for
   the duration of the in-flight call. We keep any `.htmx-indicator` hidden by
   default and reveal it only while the request is running, so a "loading…"
   hint can ride along with a button without flashing on idle. Defined once
   here because the project loads bare htmx (no default indicator CSS). */
.htmx-indicator { opacity: 0; transition: opacity 160ms ease-in; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { opacity: 1; }

.ssc-form {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
}
.ssc-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ssc-field .field-label { font-size: 10.5px; }
.input-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; height: 32px; }
.ssc-select { width: 100%; min-width: 0; }
.ssc-run-field { align-items: stretch; }
.btn-sm { padding: 0 14px; font-size: 12px; height: 32px; border-radius: 8px; line-height: 1; display: inline-flex; align-items: center; gap: 6px; }
.ssc-run { min-width: 92px; justify-content: center; font-weight: 600; }

@media (max-width: 720px) {
  .ssc-form { grid-template-columns: 1fr; }
  .ssc-run { width: 100%; }
}

/* ===== API lab — saved credentials, warnings, terminal modal ===== */
.creds-card .card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; margin-bottom: 14px;
}
.creds-fields {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 14px;
}
@media (max-width: 900px) { .creds-fields { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .creds-fields { grid-template-columns: 1fr; } }
.creds-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-top: 16px; flex-wrap: wrap;
}
.creds-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.btn-success.btn-save {
  height: 26px; padding: 0 12px; border-radius: 7px;
  font-size: 11.5px; font-weight: 600; line-height: 1;
  background: transparent;
  color: #1e8a4a; border: 1px solid rgba(48,209,88,0.45);
  box-shadow: 0 0 0 0 rgba(48,209,88,0); 
  display: inline-flex; align-items: center; justify-content: center;
  transition: box-shadow 180ms ease, background 140ms ease, border-color 140ms ease, transform 120ms ease;
}
.btn-success.btn-save:hover {
  background: rgba(48,209,88,0.08);
  border-color: rgba(48,209,88,0.7);
}
.btn-success.btn-save:active { transform: translateY(0) scale(0.98); }
.btn-success.btn-save svg { width: 12px; height: 12px; }
html.dark .btn-success.btn-save { color: #b6f5cf; }

/* ─── Datatable (calls history) ────────────────────────────────── */
.dt-card { display: flex; flex-direction: column; gap: 0; }
.dt-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 14px 0 10px;
}
.dt-search {
  position: relative; display: flex; align-items: center;
  flex: 1 1 260px; min-width: 200px;
}
.dt-search > span {
  position: absolute; left: 10px; font-size: 13px;
  color: var(--muted, #6e6e73); pointer-events: none;
}
.dt-search input[type="search"] {
  width: 100%; padding: 7px 10px 7px 28px; height: 30px;
  border-radius: 8px; border: 1px solid var(--hairline, rgba(60,60,67,0.18));
  background: rgba(255,255,255,0.55); backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font: inherit; color: inherit; outline: none;
  transition: border-color 140ms ease, background 140ms ease;
}
.dt-search input[type="search"]:focus {
  border-color: rgba(10,132,255,0.45);
  background: rgba(255,255,255,0.78);
}
/* Standalone glass input — same look as `.dt-search input` but
   usable outside the search wrapper (icon-less). Used by the PDFs
   filter bar so the License # input shares the transparent
   backdrop-blur style with the source <select> next to it instead
   of falling back to the opaque browser default. */
.dt-input {
  height: 30px; padding: 7px 10px;
  border-radius: 8px; border: 1px solid var(--hairline, rgba(60,60,67,0.18));
  background: rgba(255,255,255,0.55); backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font: inherit; color: inherit; outline: none;
  transition: border-color 140ms ease, background 140ms ease;
  min-width: 200px;
}
.dt-input:focus {
  border-color: rgba(10,132,255,0.45);
  background: rgba(255,255,255,0.78);
}
html.dark .dt-input {
  background-color: rgba(28,28,30,0.55);
  border-color: rgba(255,255,255,0.10);
}
html.dark .dt-input:focus { background-color: rgba(28,28,30,0.78); }
.dt-select {
  height: 30px; padding: 4px 26px 4px 10px;
  border-radius: 8px; border: 1px solid var(--hairline, rgba(60,60,67,0.18));
  background: rgba(255,255,255,0.55); backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font: inherit; color: inherit; outline: none; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%236e6e73' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 9px center;
}
.dt-select:hover { background-color: rgba(255,255,255,0.78); }
html.dark .dt-search input[type="search"],
html.dark .dt-select {
  background-color: rgba(28,28,30,0.55);
  border-color: rgba(255,255,255,0.10);
}
html.dark .dt-search input[type="search"]:focus,
html.dark .dt-select:hover { background-color: rgba(28,28,30,0.78); }

.dt-actions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.dt-count {
  font-size: 11.5px; color: var(--muted, #6e6e73);
  padding: 3px 10px; border-radius: 999px;
  background: rgba(0,0,0,0.04);
  border: 1px solid var(--hairline, rgba(60,60,67,0.10));
}
html.dark .dt-count { background: rgba(255,255,255,0.06); }
.btn-danger-soft { color: #b8261c; }
.btn-danger-soft:hover {
  background: rgba(255,69,58,0.12) !important;
  border-color: rgba(255,69,58,0.30) !important;
  color: #b8261c !important;
}
html.dark .btn-danger-soft, html.dark .btn-danger-soft:hover { color: #ff8077 !important; }

.dt-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 0 10px; padding: 8px 12px;
  font-size: 12px; color: var(--text, #1d1d1f);
  background: linear-gradient(180deg, rgba(10,132,255,0.10), rgba(94,92,230,0.06));
  border: 1px solid rgba(10,132,255,0.22); border-radius: 10px;
}
html.dark .dt-banner { color: #f5f5f7; }
.dt-banner-link {
  background: transparent; border: none; padding: 0; cursor: pointer;
  color: #0058c4; font: inherit; font-weight: 600; text-decoration: underline;
  text-underline-offset: 2px;
}
html.dark .dt-banner-link { color: #79b6ff; }
.dt-banner-link:hover { opacity: 0.8; }

.dt-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.dt thead th { background: transparent; }
.dt th, .dt td { background: transparent; }
.dt-col-check { width: 28px; padding-right: 0; }
.dt-sortable a {
  display: inline-flex; align-items: center; gap: 4px;
  color: inherit; text-decoration: none;
}
.dt-sortable a::after {
  content: "↕"; font-size: 9px; opacity: 0.35;
  transition: opacity 140ms ease;
}
.dt-sortable:hover a::after { opacity: 0.7; }
.dt-sorted-asc  a::after { content: "↑"; opacity: 1; color: #0058c4; }
.dt-sorted-desc a::after { content: "↓"; opacity: 1; color: #0058c4; }
html.dark .dt-sorted-asc a::after,
html.dark .dt-sorted-desc a::after { color: #79b6ff; }

.dt-pager {
  display: flex; justify-content: center; align-items: center; gap: 8px;
  margin-top: 14px;
}

/* Enhancements sub-tab — per-scraper anti-detection / reliability list */
.enh-list { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; }
.enh-item {
  border: 1px solid var(--hairline, rgba(60,60,67,0.12));
  border-radius: 10px; padding: 12px 14px;
  background: rgba(255,255,255,0.55); backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: border-color 140ms ease, background 140ms ease;
}
.enh-item:hover { border-color: rgba(10,132,255,0.32); background: rgba(255,255,255,0.78); }
.enh-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.enh-tag {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px;
  background: linear-gradient(135deg, rgba(10,132,255,0.12), rgba(94,92,230,0.16));
  color: #0058c4; border: 1px solid rgba(10,132,255,0.22);
}
.enh-title { font-size: 13.5px; font-weight: 600; color: var(--text, #1d1d1f); }
.enh-detail { margin-top: 6px; font-size: 12.5px; line-height: 1.5; color: var(--muted, #6e6e73); }
html.dark .enh-item { background: rgba(28,28,30,0.55); }
html.dark .enh-item:hover { background: rgba(28,28,30,0.78); }
html.dark .enh-title { color: #f5f5f7; }

/* Workflow ("how this scraper works") timeline on the Enhancements tab.
   Numbered steps with a gradient connector line linking the badges — the
   blue/purple accent matches the app's design system. */
.wf-overview { margin: 14px 0 0; font-size: 13px; line-height: 1.6; color: var(--muted, #6e6e73); }
.wf-list { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 0; }
.wf-item { position: relative; display: flex; gap: 14px; padding: 0 0 18px; }
.wf-item:last-child { padding-bottom: 0; }
/* connector line drawn from each badge down to the next (skip the last) */
.wf-item:not(:last-child)::before {
  content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px;
  background: linear-gradient(rgba(10,132,255,0.35), rgba(94,92,230,0.16));
}
.wf-num {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 999px;
  display: grid; place-items: center; z-index: 1;
  font-size: 12.5px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #0a84ff, #5e5ce6);
  box-shadow: 0 2px 6px rgba(10,132,255,0.35);
}
.wf-body { padding-top: 3px; }
.wf-title { font-size: 13.5px; font-weight: 600; color: var(--text, #1d1d1f); }
.wf-detail { margin-top: 4px; font-size: 12.5px; line-height: 1.55; color: var(--muted, #6e6e73); }
html.dark .wf-title { color: #f5f5f7; }

/* ── Per-API mode panel — extends .glass.card (no own bg/border) ── */
.api-mode-panel {
  display: block;
  margin: 14px 0 0;
  padding: 18px 20px;   /* override .card's 16px for slightly roomier feel */
  transition: border-color .2s ease;
}

.api-mode-panel-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 14px;
}
.api-mode-panel-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.api-mode-panel-eyebrow {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em;
  font-weight: 700; color: var(--fg-3);
}
.api-mode-panel-name {
  font-size: 13px; font-weight: 600; color: var(--fg-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.api-mode-panel-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
  white-space: nowrap; line-height: 1; flex: 0 0 auto;
}
.api-mode-panel-tag.is-prod {
  background: rgba(48,209,88,0.14) !important;
  color: #1e6b3a !important;
  border: 1px solid rgba(48,209,88,0.35) !important;
}
.api-mode-panel-tag.is-maint {
  background: rgba(255,59,48,0.14) !important;
  color: #8b1a10 !important;
  border: 1px solid rgba(255,59,48,0.38) !important;
}
html.dark .api-mode-panel-tag.is-prod  { background: rgba(48,209,88,0.20) !important; color: #7ee49a !important; border-color: rgba(48,209,88,0.40) !important; }
html.dark .api-mode-panel-tag.is-maint { background: rgba(255,59,48,0.22) !important; color: #ff9b91 !important; border-color: rgba(255,59,48,0.45) !important; }
.api-mode-panel-tag-dot {
  width: 7px; height: 7px; border-radius: 50%; display: inline-block;
}
.api-mode-panel-tag.is-prod  .api-mode-panel-tag-dot { background: #30d158; }
.api-mode-panel-tag.is-maint .api-mode-panel-tag-dot { background: #ff3b30; }

.api-mode-panel-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px; align-items: start;
}
@media (max-width: 820px) {
  .api-mode-panel-row { grid-template-columns: 1fr; }
}

/* Segmented control (replaces native radios) */
.api-mode-seg {
  display: inline-flex;
  background: rgba(255,255,255,0.35);
  border: 1px solid var(--glass-stroke-out);
  border-radius: 12px;
  padding: 3px;
  gap: 3px;
  height: fit-content;
}
html.dark .api-mode-seg { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.10); }
.api-mode-seg-opt {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 12.5px; font-weight: 600;
  cursor: pointer; user-select: none;
  color: var(--fg-2);
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.api-mode-seg-opt input[type="radio"] {
  position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0;
}
.api-mode-seg-opt:hover { color: var(--fg-1); }
.api-mode-seg-opt.sel {
  background: rgba(255,255,255,0.80);
  color: var(--fg-1);
  box-shadow: 0 1px 2px rgba(10,10,15,0.10), 0 0 0 1px var(--glass-stroke-out);
}
html.dark .api-mode-seg-opt.sel {
  background: rgba(28,28,30,0.85);
  box-shadow: 0 1px 2px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.10);
}
.api-mode-seg-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
  flex: 0 0 auto;
}
.api-mode-seg-dot.good { background: #30d158; box-shadow: 0 0 0 3px rgba(48,209,88,0.18); }
.api-mode-seg-dot.warn { background: #ff3b30; box-shadow: 0 0 0 3px rgba(255,59,48,0.18); }
html.dark .api-mode-seg-dot.good { box-shadow: 0 0 0 3px rgba(48,209,88,0.20); }
html.dark .api-mode-seg-dot.warn { box-shadow: 0 0 0 3px rgba(255,59,48,0.20); }

.api-mode-msg-wrap { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.api-mode-msg-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em;
  font-weight: 700; color: var(--fg-3);
}
.api-mode-msg {
  display: block; width: 100%; box-sizing: border-box;
  resize: vertical; min-height: 60px; max-height: 160px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.45);
  border: 1px solid var(--glass-stroke-out);
  font: inherit; font-size: 12.5px; line-height: 1.45; color: var(--fg-1);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.api-mode-msg:focus {
  outline: 0;
  border-color: rgba(10,132,255,0.55);
  box-shadow: 0 0 0 3px rgba(10,132,255,0.18);
}
html.dark .api-mode-msg {
  background: rgba(0,0,0,0.25); border-color: rgba(255,255,255,0.10); color: #f5f5f7;
}
html.dark .api-mode-msg:focus { box-shadow: 0 0 0 3px rgba(10,132,255,0.30); }

.api-mode-panel-foot {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--glass-stroke-out);
}
html.dark .api-mode-panel-foot { border-top-color: rgba(255,255,255,0.08); }
.api-mode-panel-hint {
  font-size: 11.5px; color: var(--fg-3); line-height: 1.4;
}
.api-mode-panel-hint code {
  background: rgba(255,255,255,0.40); color: var(--fg-1);
  padding: 1px 6px; border-radius: 5px;
  font-size: 11px;
  border: 1px solid var(--glass-stroke-out);
}
html.dark .api-mode-panel-hint code { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.10); color: #f5f5f7; }
.api-mode-panel-locked {
  font-size: 11.5px; font-weight: 600; color: var(--fg-3);
  padding: 6px 12px; border-radius: 8px;
  background: rgba(255,255,255,0.35); border: 1px solid var(--glass-stroke-out);
}
html.dark .api-mode-panel-locked { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.10); }
.api-mode-panel.is-readonly .api-mode-seg-opt { cursor: not-allowed; opacity: .85; }

/* Inline maintenance strip shown on non-Status tabs (links to Status) */
.lab-maint-strip {
  display: flex; align-items: center; gap: 12px;
  margin: 14px 0 0; padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255,59,48,0.10);
  border: 1px solid rgba(255,59,48,0.30);
  color: #8b1a10;
  text-decoration: none;
  font-size: 12px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.lab-maint-strip:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px -10px rgba(255,59,48,0.55);
}
html.dark .lab-maint-strip {
  background: rgba(255,59,48,0.18); border-color: rgba(255,59,48,0.40); color: #ff9b91;
}
.lab-maint-strip-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #ff3b30; flex: 0 0 auto;
  box-shadow: 0 0 0 3px rgba(255,59,48,0.20);
}
html.dark .lab-maint-strip-dot { box-shadow: 0 0 0 3px rgba(255,59,48,0.25); }
.lab-maint-strip-msg {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--fg-3);
}
html.dark .lab-maint-strip-msg { color: #c8a070; }
.lab-maint-strip-cta {
  font-weight: 700; color: #8b1a10; flex: 0 0 auto;
}
html.dark .lab-maint-strip-cta { color: #ff9b91; }

/* Subnav warn dot (next to Status tab when in maintenance) */
.lab-subtab-dot-warn { background: #ff3b30 !important; }

/* Status tab page layout */
.lab-status-wrap {
  display: block;
  margin-top: 14px;
}
.lab-status-grid {
  display: block;
  margin-top: 14px;
}
.lab-status-explainer {
  margin-top: 16px;
  padding: 18px 20px;
  /* bg/border/blur inherited from .glass.card */
}
.lab-status-h3 {
  margin: 0 0 12px;
  font-size: 13px; font-weight: 700;
  color: var(--fg-1);
}
.lab-status-modes {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
@media (max-width: 720px) { .lab-status-modes { grid-template-columns: 1fr; } }
.lab-status-mode {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--glass-stroke-out);
  background: rgba(255,255,255,0.30);
}
html.dark .lab-status-mode { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.08); }
.lab-status-mode.is-prod  { background: rgba(48,209,88,0.08);  border-color: rgba(48,209,88,0.28); }
.lab-status-mode.is-maint { background: rgba(255,59,48,0.08);  border-color: rgba(255,59,48,0.30); }
html.dark .lab-status-mode.is-prod  { background: rgba(48,209,88,0.12); border-color: rgba(48,209,88,0.30); }
html.dark .lab-status-mode.is-maint { background: rgba(255,59,48,0.12); border-color: rgba(255,59,48,0.32); }
.lab-status-mode-head { margin-bottom: 10px; }
.lab-status-list {
  margin: 0; padding-left: 18px;
  font-size: 12px; line-height: 1.55;
  color: var(--fg-2);
}
.lab-status-list li { margin-bottom: 4px; }
.lab-status-list code {
  background: rgba(255,255,255,0.45); color: var(--fg-1);
  padding: 1px 6px; border-radius: 5px;
  font-size: 11px; border: 1px solid var(--glass-stroke-out);
}
html.dark .lab-status-list code { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.10); color: #f5f5f7; }

/* (lab-status-aside / lab-status-card / lab-status-links removed —
   side cards are gone; the panel + explainer are the whole page) */

/* Result-status maintenance variant (api_call_status.html) */
.result-maintenance {
  padding: 14px 16px; border-radius: 12px;
  background: rgba(255,59,48,0.10);
  border: 1px solid rgba(255,59,48,0.30);
  color: #8b1a10;
}
html.dark .result-maintenance {
  background: rgba(255,59,48,0.18); border-color: rgba(255,59,48,0.38); color: #ff9b91;
}

/* Overview dashboard — sources currently in maintenance (uses .glass.card) */
.dash-maint {
  margin-bottom: 18px;
  /* bg/border/blur inherited from .glass.card; only tint the border red */
  border-color: rgba(255,59,48,0.32) !important;
}
html.dark .dash-maint { border-color: rgba(255,59,48,0.40) !important; }
.dash-maint-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
.dash-maint-icon {
  width: 32px; height: 32px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(255,59,48,0.18); color: #8b1a10;
  font-size: 18px; font-weight: 700;
}
html.dark .dash-maint-icon { background: rgba(255,59,48,0.25); color: #ff9b91; }
.dash-maint-title { font-weight: 700; color: var(--fg-1); }
.dash-maint-list {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.dash-maint-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(255,255,255,0.40);
  border: 1px solid rgba(255,59,48,0.25);
  text-decoration: none; color: inherit;
  transition: transform .15s ease, box-shadow .15s ease;
}
html.dark .dash-maint-row { background: rgba(255,255,255,0.05); border-color: rgba(255,59,48,0.30); }
.dash-maint-row:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -10px rgba(255,59,48,0.50);
}

/* /apis directory — per-card maintenance tint (transparent) */
.api-card-maint {
  background: rgba(255,59,48,0.06) !important;
  border-color: rgba(255,59,48,0.30) !important;
}
html.dark .api-card-maint {
  background: rgba(255,59,48,0.10) !important; border-color: rgba(255,59,48,0.35) !important;
}
.api-state-pill {
  display: inline-flex !important; align-items: center; gap: 6px;
  padding: 4px 10px !important; border-radius: 999px !important;
  font-size: 10.5px !important; font-weight: 700 !important;
  letter-spacing: .02em; line-height: 1; white-space: nowrap;
  text-decoration: none !important;
}
.api-card .api-state-pill.is-prod,
.api-state-pill.is-prod {
  background: rgba(48,209,88,0.14) !important;
  color: #1e6b3a !important;
  border: 1px solid rgba(48,209,88,0.35) !important;
}
.api-card .api-state-pill.is-maint,
.api-state-pill.is-maint {
  background: rgba(255,59,48,0.14) !important;
  color: #8b1a10 !important;
  border: 1px solid rgba(255,59,48,0.38) !important;
  animation: maintPulseAlert 2.4s ease-in-out infinite;
}
@keyframes maintPulseAlert {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,59,48,0.45); }
  50%      { box-shadow: 0 0 0 4px rgba(255,59,48,0.00); }
}
html.dark .api-state-pill.is-prod  { background: rgba(48,209,88,0.20) !important; color: #7ee49a !important; border-color: rgba(48,209,88,0.40) !important; }
html.dark .api-state-pill.is-maint { background: rgba(255,59,48,0.22) !important; color: #ff9b91 !important; border-color: rgba(255,59,48,0.45) !important; }
/* Amber "to-do" variant — used by the Portals script-status menu for portals
   whose scraper is not yet implemented. Distinct from is-maint (red, an
   operational outage) because "not implemented yet" is a build state, not a
   failure of a live thing. No pulse animation (it's not an alert). */
.api-card .api-state-pill.is-todo,
.api-state-pill.is-todo {
  background: rgba(255,159,10,0.14) !important;
  color: #9a5b00 !important;
  border: 1px solid rgba(255,159,10,0.40) !important;
}
html.dark .api-state-pill.is-todo { background: rgba(255,159,10,0.20) !important; color: #ffcb7a !important; border-color: rgba(255,159,10,0.45) !important; }
.api-state-dot {
  width: 7px; height: 7px; border-radius: 50%; display: inline-block;
  flex: 0 0 auto;
}
.api-state-pill.is-prod  .api-state-dot { background: #30d158 !important; }
.api-state-pill.is-maint .api-state-dot { background: #ff3b30 !important; }
.api-state-pill.is-todo  .api-state-dot { background: #ff9f0a !important; }

/* Vendor portal shortcut shown under the source name in the API lab header.
   Small, low-key (it sits beneath the description), with the full URL muted
   so the operator can sanity-check where it points before clicking. */
.api-website-link {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 6px; font-size: 11px; font-weight: 600;
  color: var(--accent-1); text-decoration: none;
}
.api-website-link:hover { text-decoration: underline; }
.api-website-link .api-website-url {
  color: var(--fg-3); font-weight: 500;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px;
}

/* API testing lab — Test inputs panel inherits .glass.card transparency */
.test-presets {
  /* bg/border/blur inherited from .glass.card so it matches every other panel */
}
.test-presets-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; margin-bottom: 12px; flex-wrap: wrap;
}
.test-presets-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 4px rgba(48,209,88,0.18),
              0 0 12px rgba(48,209,88,0.55);
  animation: presetPulse 2.4s ease-in-out infinite;
  flex: 0 0 auto;
}
@keyframes presetPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(48,209,88,0.18), 0 0 12px rgba(48,209,88,0.55); }
  50%      { box-shadow: 0 0 0 7px rgba(48,209,88,0.06), 0 0 18px rgba(48,209,88,0.75); }
}
.test-presets-body {
  margin: 0; padding: 12px 14px;
  background: rgba(20,30,22,0.05);
  border: 1px solid rgba(48,209,88,0.22);
  border-radius: 10px;
  font-size: 11.5px; line-height: 1.55;
  color: #1e6b3a;
  white-space: pre; overflow-x: auto;
  max-height: 240px; overflow-y: auto;
}
html.dark .test-presets-body {
  background: rgba(20,30,22,0.35);
  color: #8be8a8;
  border-color: rgba(48,209,88,0.22);
}

/* API testing lab — 2-column request/response layout */
.lab-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.lab-grid > .glass.card { margin: 0; }
@media (max-width: 980px) {
  .lab-grid { grid-template-columns: 1fr; gap: 14px; }
}

.warn-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; margin-bottom: 12px;
  border-radius: 10px; font-size: 12px;
  background: rgba(255,159,10,0.10);
  border: 1px solid rgba(255,159,10,0.30);
  color: #8a5a00;
}
html.dark .warn-row { color: #ffcc66; }

.card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; margin-bottom: 12px;
}

.data-table-clicky tbody tr.row-clicky:hover {
  background: rgba(0, 122, 255, 0.06);
}
html.dark .data-table-clicky tbody tr.row-clicky:hover {
  background: rgba(120, 180, 255, 0.08);
}

/* --- Modal backdrop + terminal window --- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(15, 20, 30, 0.55);
  backdrop-filter: blur(6px) saturate(1.1);
  -webkit-backdrop-filter: blur(6px) saturate(1.1);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; animation: modal-fade 140ms ease;
}
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--card-bg, rgba(255,255,255,0.96));
  border: 1px solid var(--line);
  border-radius: 14px;
  width: min(880px, 100%);
  max-height: 88vh; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.45);
  animation: modal-pop 160ms cubic-bezier(.2,.8,.2,1);
}
@keyframes modal-pop {
  from { transform: translateY(8px) scale(0.98); opacity: 0; }
  to   { transform: translateY(0) scale(1);      opacity: 1; }
}

.modal-terminal { background: #0e1117; border-color: #1f2530; color: #e6edf3; }
html.dark .modal-terminal { background: #07090d; }

.term-titlebar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 14px;
  background: linear-gradient(180deg, #1c222c, #141921);
  border-bottom: 1px solid #1f2530;
}
.term-traffic { display: flex; gap: 6px; }
.tl { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.tl-r { background: #ff5f57; cursor: pointer; }
.tl-y { background: #febc2e; }
.tl-g { background: #28c840; }
.term-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: #c9d1d9; flex: 1; min-width: 0;
}
.term-title .font-mono { color: #8b949e; }
.term-close {
  background: transparent; border: 0; color: #8b949e;
  font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.term-close:hover { color: #fff; }

.term-meta {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px 16px;
  padding: 12px 16px;
  background: #11161e;
  border-bottom: 1px solid #1f2530;
  font-size: 11.5px;
}
@media (max-width: 700px) { .term-meta { grid-template-columns: repeat(2, 1fr); } }
.term-meta .muted { color: #6e7681; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.term-meta .font-mono { color: #c9d1d9; font-size: 11.5px; margin-top: 2px; }

.term-body {
  padding: 14px 16px; overflow: auto; flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  background: #0e1117;
}
.term-line {
  margin: 10px 0 4px; color: #e6edf3;
  display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap;
}
.term-line:first-child { margin-top: 0; }
.term-prompt { color: #58a6ff; font-weight: 700; }
.term-accent { color: #d2a8ff; }
.term-dim { color: #6e7681; }
.term-err .term-prompt { color: #ff7b72; }
.term-pre {
  margin: 4px 0 0; padding: 10px 12px;
  background: #161b22; border: 1px solid #1f2530; border-radius: 8px;
  white-space: pre-wrap; word-break: break-word;
  color: #c9d1d9; font-size: 11.5px;
  max-height: 280px; overflow: auto;
}
.term-pre-err { background: rgba(248,81,73,0.08); border-color: rgba(248,81,73,0.35); color: #ffa198; }
.term-pre-out { background: #0d1620; border-color: #1f3550; color: #a5d6ff; }
.term-pre-tall { max-height: 420px; }
.term-eye {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; margin-left: 8px; vertical-align: middle;
  border: 1px solid #1f3550; border-radius: 6px;
  color: #a5d6ff; background: #0d1620; text-decoration: none;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.term-eye:hover { background: #16314d; color: #d2a8ff; border-color: #2f4a6f; }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; padding: 0 !important;
}

/* ========== Code samples panel (Python / Node / cURL) ========== */
.code-card .card-head { margin-bottom: 8px; }
.code-tabs {
  display: flex; align-items: center; gap: 6px; margin: 4px 0 10px;
  flex-wrap: wrap;
}
.code-tab {
  appearance: none; border: 1px solid transparent;
  background: transparent; color: var(--muted, #6b7280);
  padding: 4px 10px; border-radius: 6px; font-size: 11.5px;
  font-family: inherit; cursor: pointer; line-height: 1.4;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.code-tab:hover {
  color: var(--text, #1d1d1f);
  background: rgba(0,0,0,0.04);
}
.code-tab.active {
  color: var(--text, #1d1d1f);
  background: rgba(0,0,0,0.06);
  border-color: rgba(0,0,0,0.08);
}
.code-copy { margin-left: auto; }

.code-shell {
  background: #0e1117; border: 1px solid #1f2530;
  border-radius: 12px; overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
.code-shell-head {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; background: #161b22; border-bottom: 1px solid #1f2530;
}
.term-dot {
  width: 11px; height: 11px; border-radius: 50%; display: inline-block;
}
.dot-r { background: #ff5f57; }
.dot-y { background: #febc2e; }
.dot-g { background: #28c840; }
.code-shell-title {
  margin-left: 8px; color: #8b949e; font-size: 11.5px;
}
.code-pane {
  display: none; margin: 0; padding: 14px 16px;
  white-space: pre; overflow: auto;
  max-height: 460px;
  color: #c9d1d9; font-size: 12px; line-height: 1.55;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  background: #0e1117;
}
.code-pane.active { display: block; }
.code-pane code { color: inherit; background: none; padding: 0; }

.term-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 12px 16px;
  background: #11161e; border-top: 1px solid #1f2530;
}

/* === API lab sub-tab navigation =================================== */
.lab-subnav {
  display: flex; gap: 4px; margin-top: 14px;
  border-bottom: 1px solid var(--line);
  padding: 0 4px; flex-wrap: wrap;
}
.lab-subtab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 14px; margin-bottom: -1px;
  font-size: 12.5px; color: var(--muted, #6b7280);
  text-decoration: none; border-radius: 8px 8px 0 0;
  border: 1px solid transparent; border-bottom: none;
  position: relative; transition: color .12s ease, background .12s ease;
}
.lab-subtab:hover { color: var(--text, #1d1d1f); background: rgba(0,0,0,0.03); }
.lab-subtab.active {
  color: var(--accent-1, #6366f1);
  background: var(--card, #fff);
  border-color: var(--line);
  font-weight: 600;
}
.lab-subtab-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 5px;
  background: rgba(0,0,0,0.04); font-size: 11px;
}
.lab-subtab.active .lab-subtab-ico {
  background: rgba(99,102,241,0.12); color: var(--accent-1, #6366f1);
}
.lab-subtab-count {
  background: rgba(0,0,0,0.06); border-radius: 999px;
  padding: 1px 7px; font-size: 10.5px; font-weight: 600;
  color: var(--fg-2, #4b5563);
}
.lab-subtab.active .lab-subtab-count {
  background: rgba(99,102,241,0.12); color: var(--accent-1, #6366f1);
}
.lab-subtab-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--warn, #f59e0b); display: inline-block;
}

/* === Transparent UI pass — applies to API lab pages =================== */
/* Cards: drop the white wash, just keep the hairline + blur */
.lab-grid .glass.card,
.code-card.glass.card,
.creds-card.glass.card {
  background: transparent;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  box-shadow: none;
}

/* Inputs / selects / textareas inside lab forms — translucent */
.lab-grid input[type="text"],
.lab-grid input[type="password"],
.lab-grid input[type="email"],
.lab-grid input[type="number"],
.lab-grid input[type="date"],
.lab-grid select,
.lab-grid textarea,
.creds-card input[type="text"],
.creds-card input[type="password"],
.creds-card input[type="email"],
.creds-card input[type="number"],
.creds-card input[type="date"],
.creds-card select,
.creds-card textarea {
  background: rgba(255,255,255,0.35);
  border: 1px solid var(--line);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.lab-grid input:focus,
.lab-grid select:focus,
.lab-grid textarea:focus,
.creds-card input:focus,
.creds-card select:focus,
.creds-card textarea:focus {
  background: rgba(255,255,255,0.55);
  outline: none;
  border-color: rgba(99,102,241,0.4);
}
html.dark .lab-grid input,
html.dark .lab-grid select,
html.dark .lab-grid textarea,
html.dark .creds-card input,
html.dark .creds-card select,
html.dark .creds-card textarea { background: rgba(255,255,255,0.05); }

/* Buttons — keep tinted outlines but transparent fills */
.lab-grid .btn-success,
.lab-grid .btn-info,
.lab-grid .btn-danger,
.lab-grid .btn-ghost,
.creds-card .btn-success,
.creds-card .btn-info,
.creds-card .btn-danger,
.creds-card .btn-ghost,
.code-card .btn-ghost {
  background: transparent;
}
.lab-grid .btn-success:hover,
.creds-card .btn-success:hover { background: rgba(48,209,88,0.10); }
.lab-grid .btn-info:hover,
.creds-card .btn-info:hover { background: rgba(10,132,255,0.10); }
.lab-grid .btn-danger:hover,
.creds-card .btn-danger:hover { background: rgba(255,69,58,0.10); }
.lab-grid .btn-ghost:hover,
.creds-card .btn-ghost:hover,
.code-card .btn-ghost:hover { background: rgba(0,0,0,0.04); }

/* History table card */
.api-history-card,
.glass.card .data-table { background: transparent; }

/* Force data tables to fill their parent card.
   WHY: by default <table> sizes to content. With the Caller column
   carrying a short pill ("⇄ External API" / email) the columns
   summed to ~50% of the card width, leaving a huge empty gutter on
   the right (see 2026-05-27 screenshot). `width:100%` + `auto`
   layout lets the browser distribute leftover space across columns
   proportionally, so the table actually uses the whole card. */
.data-table {
  width: 100%;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}
.dt { width: 100%; }

/* Row dividers — near-transparent so the table feels airy but still
   has clear horizontal rhythm. WHY rgba and not var(--line): we
   want this consistent in both light + dark themes without writing
   two rules, and the line variable in this codebase is a bit too
   strong (it was designed for form fields, not data tables). */
.data-table th,
.data-table td {
  border-bottom: 1px solid rgba(60,60,67,0.08);
}
html.dark .data-table th,
html.dark .data-table td {
  border-bottom-color: rgba(255,255,255,0.06);
}
.data-table tr:last-child td { border-bottom: 0; }

/* Header alignment + density.
   WHY left-align all headers: previously <th> inherited the browser
   default `text-align: center`, but every td under it is left-
   aligned. The mismatch made "Caller" hover above empty whitespace
   while its column content sat 20-40px to the right (see screenshot
   2026-05-27 03:04). Forcing th to left fixes the alignment for
   every column at once. Tight padding lets more rows fit on screen
   ("show as max data as you can"). */
.data-table thead th {
  text-align: left;
  font-weight: 500;
  color: var(--fg-3);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 8px 10px;
  white-space: nowrap;
}
.data-table tbody td {
  padding: 7px 10px;
  color: var(--fg-2);
  vertical-align: middle;
}
.data-table tbody tr:hover td { background: rgba(10,10,15,0.025); }
html.dark .data-table tbody tr:hover td { background: rgba(255,255,255,0.03); }

/* Caller cell — flag image + IP + country name. WHY a real PNG flag
   in addition to the emoji: Windows + many Linux distros render the
   Regional Indicator codepoints as two boring "US" letters instead
   of a flag, because Segoe UI Emoji ships no country glyphs. The
   flagcdn.com image is universal. The emoji is kept as accessible
   title text so screen readers still announce a country. */
.caller-cell { min-width: 200px; vertical-align: middle; }
.caller-who { color: var(--fg); font-weight: 500; font-size: 12px; }
.caller-net {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 2px; font-size: 10.5px;
}
.caller-flag-img {
  width: 20px; height: auto; display: inline-block;
  border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
  vertical-align: middle; flex-shrink: 0;
}
.caller-ip { white-space: nowrap; }
.caller-country { color: var(--muted); }
.chip-ext {
  background: rgba(99,102,241,.12);
  color: #4f46e5;
  border: 1px solid rgba(99,102,241,.28);
}
html.dark .chip-ext { color: #a5b4fc; }

/* Hide the long country name on narrow viewports — the flag PNG
   already carries the same info at a glance. Country name still
   shows in the tooltip and the modal. */
@media (max-width: 900px) {
  .caller-country { display: none; }
  .caller-cell { min-width: 150px; }
}
@media (max-width: 560px) {
  .caller-cell { min-width: 120px; }
  .caller-net { font-size: 10.5px; }
}

/* Code shell — keep dark code area but make the *card* around it transparent */
.code-shell {
  background: rgba(13,17,23,0.92);
  border: 1px solid rgba(31,37,48,0.6);
}

/* Sub-tab nav — already transparent, just remove the "active" white fill */
.lab-subtab.active {
  background: rgba(99,102,241,0.06);
  border-color: rgba(99,102,241,0.18);
}

/* Save button keeps its solid green — explicitly opt out so it stays a clear CTA */
/* Save credentials kept transparent + glowing — see definition above. */

/* Compact lab inputs — match the btn-xs/btn-sm scale */
.lab-grid input[type="text"],
.lab-grid input[type="password"],
.lab-grid input[type="email"],
.lab-grid input[type="number"],
.lab-grid input[type="date"],
.lab-grid select,
.lab-grid textarea,
.creds-card input[type="text"],
.creds-card input[type="password"],
.creds-card input[type="email"],
.creds-card input[type="number"],
.creds-card input[type="date"],
.creds-card select,
.creds-card textarea {
  padding: 5px 10px;
  font-size: 11.5px;
  border-radius: 7px;
  height: 28px;
  line-height: 1.3;
}
.lab-grid textarea,
.creds-card textarea { height: auto; min-height: 56px; }
.lab-grid .field-label,
.creds-card .field-label {
  font-size: 10.5px;
  margin-bottom: 4px;
}
.lab-grid .lab-field,
.creds-card .lab-field { gap: 3px; }

/* ─── Mudflap data browser (transparent datatable + filters) ─────── */

/* Smaller transparent input variant — used in filter bars and edit forms */
.input-xs {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 8px;
  background: rgba(255,255,255,0.45);
  border: 1px solid var(--glass-stroke-out);
  color: var(--fg-1);
  width: 100%;
  box-sizing: border-box;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input-xs:focus {
  outline: 0;
  border-color: rgba(10,132,255,0.55);
  box-shadow: 0 0 0 3px rgba(10,132,255,0.18);
}
html.dark .input-xs {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.10);
  color: #f5f5f7;
}
textarea.input-xs { height: auto; padding: 8px 10px; line-height: 1.45; }

/* Lightweight inline messages */
.mdf-msg { margin-top: 12px; padding: 10px 14px; font-size: 12.5px; }
.mdf-msg-success { border-color: rgba(48,209,88,0.30) !important; }
.mdf-msg-error   { border-color: rgba(255,59,48,0.30) !important; }

/* Filter bar */
.mdf-filter-card { margin-top: 14px; padding: 12px 14px; }
.mdf-filter-row {
  display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
}
.mdf-filter-field { flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 4px; }
.mdf-filter-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .07em;
  font-weight: 700; color: var(--fg-3);
}
.mdf-filter-actions { display: flex; gap: 6px; align-items: center; }

/* Transparent datatable.
   `overflow-x: auto` (was: hidden) lets the table scroll sideways inside
   the glass card on narrow viewports — without this the 9-column grid
   blew out of the card and forced the whole page to scroll horizontally
   on phones / split-screens. The card itself keeps its rounded corners
   because we also clip overflow-y. */
.mdf-table-wrap { margin-top: 12px; padding: 0; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
.dt-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: transparent;
  font-size: 12.5px;
}
.dt-table thead th {
  text-align: left;
  padding: 10px 12px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  font-weight: 700; color: var(--fg-3);
  background: rgba(255,255,255,0.20);
  border-bottom: 1px solid var(--glass-stroke-out);
  position: sticky; top: 0; z-index: 1;
}
html.dark .dt-table thead th { background: rgba(255,255,255,0.04); }
.dt-table tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--glass-stroke-out);
  vertical-align: middle;
  color: var(--fg-1);
}
.dt-table tbody tr { transition: background .12s ease; }
.dt-table tbody tr:hover { background: rgba(10,132,255,0.05); }
html.dark .dt-table tbody tr:hover { background: rgba(10,132,255,0.10); }
.dt-table tbody tr:last-child td { border-bottom: 0; }
.dt-filter-row th {
  background: transparent !important;
  padding: 6px 8px !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  position: static !important;
  border-bottom: 1px solid var(--glass-stroke-out);
}
.chip-xs {
  display: inline-block; padding: 2px 7px;
  border-radius: 999px; font-size: 10.5px; font-weight: 700;
  background: rgba(10,132,255,0.10);
  color: #0058c4;
  border: 1px solid rgba(10,132,255,0.22);
}
html.dark .chip-xs { color: #79b6ff; background: rgba(10,132,255,0.18); }
.font-mono { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Pagination */
.mdf-pager {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px; gap: 12px; flex-wrap: wrap;
}
.mdf-pager-controls { display: flex; gap: 6px; flex-wrap: wrap; }

/* Edit form */
.mdf-edit-card { margin-top: 14px; padding: 18px 20px; }
.mdf-edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px 14px;
}
.mdf-edit-field { display: flex; flex-direction: column; gap: 4px; }
.mdf-edit-textarea { resize: vertical; min-height: 60px; max-height: 200px; }
.mdf-edit-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--glass-stroke-out);
}

/* ─────────────────────────────────────────────────────────────────────
   Responsive rules for /scrapers/mudflap/data/ — added 2026-05-15.
   The 9-column data table + 4-field filter bar + edit-row actions all
   blew up below ~900px (table forced page-level horizontal scroll;
   filter inputs collapsed to 150px each and overflowed; pager labels
   wrapped onto two lines breaking the right-aligned counter). These
   queries cascade three breakpoints — tablet / phone / very-narrow —
   each one progressively densifying without hiding any data column.
   ───────────────────────────────────────────────────────────────────── */

/* Tablet & below: filter form stacks vertically once we lose the
   second column of breathing room. Min-width on each field drops so
   they don't all overflow. Sticky thead is disabled because horizontal
   scroll + sticky together causes a Safari repaint glitch. */
@media (max-width: 900px) {
  .mdf-filter-row { gap: 8px; }
  .mdf-filter-field { min-width: 120px; flex-basis: calc(50% - 8px); }
  .mdf-filter-field[style*="flex:2"],
  .mdf-filter-field[style*="flex:1.5"] { flex-basis: 100%; }
  .mdf-filter-actions { flex-basis: 100%; justify-content: flex-end; }
  .dt-table { font-size: 12px; }
  .dt-table thead th { padding: 8px 10px; font-size: 10px; position: static; }
  .dt-table tbody td { padding: 7px 10px; }
  /* Force a sane minimum so the table actually triggers horizontal
     scroll instead of squishing columns into illegible 30px wide cells. */
  .dt-table { min-width: 880px; }
}

/* Phones: tighten paddings further, drop the page-header chip row to
   its own line, make the pager controls fill width, shrink action
   buttons so Edit + Delete stay on one row instead of wrapping. */
@media (max-width: 720px) {
  .mdf-filter-card { padding: 10px 12px; }
  .mdf-filter-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .mdf-filter-field { flex-basis: auto !important; min-width: 0; }
  .mdf-filter-actions { justify-content: stretch; }
  .mdf-filter-actions .btn-info,
  .mdf-filter-actions .btn-ghost { flex: 1; text-align: center; }
  .mdf-pager { flex-direction: column; align-items: stretch; }
  .mdf-pager-controls { justify-content: center; }
  .dt-table { min-width: 720px; font-size: 11.5px; }
  .dt-table thead th, .dt-table tbody td { padding: 6px 8px; }
  /* Inline filter row inputs — give them a sensible min so they're
     not squished to 20px on a 360-wide phone. */
  .dt-filter-row .input { min-width: 80px; }
  /* Edit page: textareas were stuck at 60px which hides 5+ lines.
     Allow them to grow naturally on phones where vertical space is cheap. */
  .mdf-edit-card { padding: 14px 14px; }
  .mdf-edit-grid { gap: 10px; }
  .mdf-edit-foot { flex-direction: column-reverse; gap: 8px; }
  .mdf-edit-foot .btn-info,
  .mdf-edit-foot .btn-ghost { width: 100%; text-align: center; }
}

/* Very narrow (≤420px — small phones in portrait): action buttons
   stack vertically in each row to avoid horizontal overflow inside
   the cell, and the page-header chips sit under the H1 instead of
   beside it. */
@media (max-width: 420px) {
  .mdf-table-wrap td[style*="text-align:right"] form,
  .mdf-table-wrap td[style*="text-align:right"] a {
    display: block;
    margin: 2px 0;
  }
  .mdf-pager-controls .btn-ghost,
  .mdf-pager-controls .btn-info { padding: 4px 8px !important; font-size: 11px !important; }
}

/* Tiny button class — matches btn-info btn-xs visually */
.btn-xs {
  padding: 4px 10px !important;
  font-size: 11.5px !important;
  height: auto !important;
  border-radius: 7px !important;
  line-height: 1.3 !important;
}

/* ─── Per-user section permissions (Users page) ───────────────────── */
.users-perm-create {
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--glass-stroke-out);
}
.users-perm-create-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em;
  font-weight: 700; color: var(--fg-3); margin-bottom: 8px;
}
.users-perm-create-grid {
  display: flex; flex-wrap: wrap; gap: 16px 22px;
}
.users-perm-name {
  font-size: 12px; color: var(--fg-2); text-transform: capitalize;
}

.users-list { display: flex; flex-direction: column; gap: 10px; }
.user-row {
  border: 1px solid var(--glass-stroke-out);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.18);
}
html.dark .user-row { background: rgba(255,255,255,0.03); }
.user-row-head {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 10px;
}
.user-perm-form {
  margin-top: 10px; padding-top: 10px;
  border-top: 1px dashed var(--glass-stroke-out);
}
.user-perm-grid {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 14px 22px;
}

/* ── Inline sort-arrow headers (mudflap data browser) ──────────────
   Arrows are unicode characters rendered inline by the template
   (▲ asc, ▼ desc, ⇅ idle). These rules only handle hover affordance
   and idle dimming — the .dt-sortable / .dt-sorted-* CSS above uses
   ::after pseudo-elements, which would conflict if reused here. */
.dt-sort {
  text-decoration: none;
  color: inherit;
  display: inline-flex;
  gap: 4px;
  align-items: center;
  white-space: nowrap;
}
.dt-sort:hover { color: #0058c4; }
html.dark .dt-sort:hover { color: #79b6ff; }
.dt-sort.is-active { color: #0058c4; font-weight: 600; }
html.dark .dt-sort.is-active { color: #79b6ff; }
.dt-sort-idle { opacity: 0.35; font-size: 0.85em; }
.dt-sort:hover .dt-sort-idle { opacity: 0.7; }

/* ===========================================================
   Atlas Permitlify theme — blue/green operational UI refresh
   =========================================================== */

:root {
  color-scheme: light;
  --pr: #1d4ed8;
  --pr2: #3b82f6;
  --pr3: #1e3a8a;
  --pd: rgba(29,78,216,.09);
  --pg: rgba(29,78,216,.18);
  --ac: #059669;
  --ac2: #10b981;
  --ad: rgba(5,150,105,.09);
  --accent-1: #1d4ed8;
  --accent-2: #059669;
  --accent-grad: linear-gradient(135deg, #1d4ed8 0%, #059669 100%);
  --accent-grad-cool: linear-gradient(135deg, #2563eb 0%, #10b981 100%);
  --good: #22c55e;
  --warn: #d97706;
  --bad: #dc2626;
  --info: #3b82f6;
  --bg: #f0f4f8;
  --bg-2: #f8fafc;
  --bg-elev: #ffffff;
  --surface: var(--bg-elev);
  --surface-2: var(--bg-2);
  --text: #0f172a;
  --muted: #94a3b8;
  --fg: #0f172a;
  --fg-1: #0f172a;
  --fg-2: #475569;
  --fg-3: #94a3b8;
  --fg-4: #cbd5e1;
  --line: rgba(0,0,0,.06);
  --line-2: rgba(0,0,0,.04);
  --border: rgba(0,0,0,.10);
  --hairline: rgba(0,0,0,.06);
  --glass-bg: #ffffff;
  --glass-bg-2: #f8fafc;
  --glass-stroke: rgba(255,255,255,.75);
  --glass-stroke-out: rgba(0,0,0,.06);
  --glass-blur: 0px;
  --glass-sat: 100%;
  --shadow-1: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-2: 0 4px 16px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,.04);
  --shadow-pr: 0 4px 14px rgba(29,78,216,.25);
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 18px;
  --base-size: 13px;
}

html.dark {
  color-scheme: dark;
  --bg: #0f172a;
  --bg-2: #111827;
  --bg-elev: #172033;
  --surface: var(--bg-elev);
  --surface-2: var(--bg-2);
  --text: #f8fafc;
  --muted: #94a3b8;
  --fg: #f8fafc;
  --fg-1: #f8fafc;
  --fg-2: #cbd5e1;
  --fg-3: #94a3b8;
  --fg-4: #64748b;
  --line: rgba(255,255,255,.08);
  --line-2: rgba(255,255,255,.05);
  --border: rgba(255,255,255,.12);
  --hairline: rgba(255,255,255,.08);
  --glass-bg: #172033;
  --glass-bg-2: #111827;
  --glass-stroke-out: rgba(255,255,255,.08);
  --shadow-1: 0 1px 3px rgba(0,0,0,.32), 0 1px 2px rgba(0,0,0,.24);
  --shadow-2: 0 8px 26px rgba(0,0,0,.34), 0 1px 4px rgba(0,0,0,.28);
}

body {
  font-family: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--fg);
  font-size: var(--base-size);
  font-feature-settings: normal;
}

.font-display,
.page-header h1,
.card h2,
.stat-num,
.brand .name,
.login-form h1,
.login-side h2,
.api-title,
.portal-title {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif !important;
  letter-spacing: -.025em;
}

.font-mono,
.nav-section,
.stat-card .lbl,
.stat-card .delta,
.field-label,
.tbl th,
.data-table th,
.chip,
.nav-badge,
.nav-live,
.theme-pill,
.crumb-root {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace !important;
}

.mesh,
.grain {
  display: none !important;
}

.app-shell {
  background: var(--bg);
}

.glass,
.glass-strong,
.card,
.dash-maint,
.api-mode-panel,
.lab-status-explainer,
.api-dir-card,
.portal-card,
.user-card,
.settings-card {
  background: var(--bg-elev) !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-1) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.glass::after,
.glass-strong::after {
  content: none !important;
}

.sidebar {
  background: var(--bg-elev) !important;
  border-right: 1px solid var(--line) !important;
  box-shadow: none !important;
}

.brand .name {
  color: #1c2f74;
  font-size: 16px;
  font-weight: 800;
}

html.dark .brand .name { color: var(--fg); }

.brand .ver {
  color: var(--fg-3);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
}

.logo-mark,
.avatar,
.big-avatar {
  background: var(--accent-grad) !important;
  box-shadow: 0 2px 8px rgba(29,78,216,.25) !important;
}

.sb-nav .nav-item,
.nav-item {
  border-radius: 10px !important;
  color: var(--fg-2) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
}

.sb-nav .nav-item:hover,
.nav-item:hover {
  background: var(--bg-2) !important;
  color: var(--fg) !important;
}

.sb-nav .nav-item.active,
.nav-item.active {
  background: var(--pd) !important;
  color: var(--accent-1) !important;
  font-weight: 700 !important;
}

.nav-section {
  color: var(--fg-3) !important;
  font-size: 9.5px !important;
  font-weight: 600 !important;
  letter-spacing: 1.1px !important;
}

.nav-badge,
.nav-live {
  background: var(--pd) !important;
  color: var(--accent-1) !important;
  border: 1px solid rgba(29,78,216,.18) !important;
  border-radius: 999px !important;
}

.topbar {
  background: var(--bg-elev) !important;
  border: 1px solid var(--line) !important;
  box-shadow: var(--shadow-1) !important;
  border-radius: 14px !important;
}

.topbar .crumbs,
.theme-pill,
.user-pill {
  background: var(--bg-2) !important;
  border: 1px solid var(--line) !important;
  color: var(--fg-2) !important;
  border-radius: 10px !important;
}

.theme-pill:hover,
.user-pill:hover,
.topbar .crumbs:hover {
  background: var(--bg-elev) !important;
  border-color: rgba(29,78,216,.25) !important;
  color: var(--accent-1) !important;
}

.user-menu,
.bell-panel,
.drop-menu {
  background: var(--bg-elev) !important;
  border: 1px solid var(--line) !important;
  border-radius: 14px !important;
  box-shadow: 0 12px 32px rgba(0,0,0,.10), 0 2px 8px rgba(0,0,0,.06) !important;
}

.page-header h1 {
  color: var(--fg) !important;
  font-size: 21px !important;
  font-weight: 800 !important;
}

.page-header .sub,
.sub,
.muted,
.card .muted {
  color: var(--fg-3) !important;
}

.card h2,
.section-title,
.th-title {
  color: var(--fg) !important;
  font-weight: 800 !important;
}

.stat-card {
  background: var(--bg-elev) !important;
  border: 1px solid var(--line) !important;
  border-radius: 14px !important;
  box-shadow: var(--shadow-1) !important;
}

.stat-card:hover,
.card:hover,
.glass:hover {
  box-shadow: var(--shadow-2) !important;
}

.stat-card .lbl {
  color: var(--fg-3) !important;
  font-size: 10px !important;
  letter-spacing: .9px !important;
}

.stat-num {
  color: var(--fg) !important;
  font-size: 28px !important;
  font-weight: 800 !important;
}

.btn,
.btn-success,
.btn-danger,
.btn-info,
.btn-ghost,
.btn-primary,
button.btn,
a.btn {
  border-radius: 10px !important;
  font-family: 'DM Sans', system-ui, sans-serif !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  transition: all .2s ease !important;
}

.btn-primary,
.btn-success {
  background: var(--accent-grad) !important;
  color: #fff !important;
  border-color: transparent !important;
  box-shadow: var(--shadow-pr) !important;
}

.btn-primary:hover,
.btn-success:hover {
  opacity: .92;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(29,78,216,.30) !important;
}

.btn-info,
.btn-ghost,
.btn {
  background: var(--bg-2) !important;
  color: var(--fg-2) !important;
  border: 1px solid var(--border) !important;
}

.btn-info:hover,
.btn-ghost:hover,
.btn:hover {
  background: var(--bg-elev) !important;
  border-color: rgba(29,78,216,.35) !important;
  color: var(--accent-1) !important;
}

.btn-danger {
  background: rgba(220,38,38,.08) !important;
  color: var(--bad) !important;
  border-color: rgba(220,38,38,.20) !important;
}

.btn-xs {
  height: 24px !important;
  padding: 0 9px !important;
  border-radius: 7px !important;
  font-size: 11px !important;
}

.btn-lg {
  height: 40px !important;
  padding: 0 20px !important;
  border-radius: 11px !important;
  font-size: 14px !important;
}

.input,
.input-sm,
.dt-select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
select,
textarea {
  background: var(--bg-2) !important;
  border: 1px solid var(--line) !important;
  border-radius: 10px !important;
  color: var(--fg) !important;
  font-family: 'DM Sans', system-ui, sans-serif !important;
}

.input:focus,
.dt-select:focus,
input:focus,
select:focus,
textarea:focus {
  background: var(--bg-elev) !important;
  border-color: rgba(29,78,216,.40) !important;
  box-shadow: 0 0 0 3px rgba(29,78,216,.08) !important;
  outline: none !important;
}

.field-label,
label {
  color: var(--fg-3);
}

.chip {
  border-radius: 999px !important;
  font-family: 'JetBrains Mono', ui-monospace, monospace !important;
  font-size: 10.5px !important;
  font-weight: 700 !important;
}

.chip-good,
.chip-success,
.chip-completed {
  background: rgba(34,197,94,.10) !important;
  color: #16a34a !important;
  border: 1px solid rgba(34,197,94,.25) !important;
}

.chip-warn,
.chip-pending,
.chip-processing {
  background: rgba(217,119,6,.10) !important;
  color: var(--warn) !important;
  border: 1px solid rgba(217,119,6,.25) !important;
}

.chip-bad,
.chip-error,
.chip-failed {
  background: rgba(220,38,38,.08) !important;
  color: var(--bad) !important;
  border: 1px solid rgba(220,38,38,.20) !important;
}

.chip-info {
  background: rgba(59,130,246,.10) !important;
  color: var(--info) !important;
  border: 1px solid rgba(59,130,246,.25) !important;
}

.dot-good { background: var(--good) !important; }
.dot-warn { background: var(--warn) !important; }
.dot-bad { background: var(--bad) !important; }
.dot-info { background: var(--info) !important; }

.tbl,
.data-table {
  border-collapse: collapse !important;
  background: var(--bg-elev) !important;
  color: var(--fg-2) !important;
}

.tbl thead tr,
.data-table thead tr {
  background: var(--bg-2) !important;
  border-bottom: 1px solid var(--line) !important;
}

.tbl th,
.data-table th {
  color: var(--fg-3) !important;
  font-size: 10px !important;
  font-weight: 600 !important;
  letter-spacing: .9px !important;
}

.tbl td,
.data-table td {
  color: var(--fg-2) !important;
  border-bottom: 1px solid var(--line) !important;
}

.tbl tbody tr:hover,
.data-table tbody tr:hover,
.tbl tbody tr:hover td,
.data-table tbody tr:hover td {
  background: var(--bg-2) !important;
}

.pager,
.dash-pager {
  border-top: 1px solid var(--line) !important;
  background: var(--bg-elev) !important;
}

.pager-num,
.pb,
.dash-pager-label {
  border-radius: 8px !important;
  border-color: var(--border) !important;
}

.pager-num.is-current,
.pb.active {
  background: var(--accent-grad) !important;
  color: #fff !important;
  border-color: transparent !important;
  box-shadow: var(--shadow-pr) !important;
}

.api-badge,
.logo-pill,
.cur-badge {
  background: var(--accent-grad) !important;
  color: #fff !important;
}

.lab-subtab,
.api-tab,
.portal-tab {
  border-radius: 10px !important;
  color: var(--fg-2) !important;
}

.lab-subtab.active,
.api-tab.active,
.portal-tab.active {
  background: var(--pd) !important;
  color: var(--accent-1) !important;
}

.toast {
  background: var(--bg-elev) !important;
  border: 1px solid var(--line) !important;
  border-radius: 12px !important;
  box-shadow: var(--shadow-2) !important;
}

.terminal-log,
.cmd-panel,
pre {
  border-radius: 12px !important;
}

.login-wrap {
  background: var(--bg-elev) !important;
}

.login-card {
  background: var(--bg-elev) !important;
  border: 1px solid var(--line) !important;
  box-shadow: var(--shadow-2) !important;
}

.login-form {
  background: var(--bg-elev) !important;
}

.login-side {
  background: linear-gradient(155deg, #0f172a 0%, #111827 60%, #0d1f3c 100%) !important;
  color: #f8fafc !important;
}

.login-side h2 {
  color: #f8fafc !important;
  font-weight: 800 !important;
}

.login-side p,
.login-side .row {
  color: #94a3b8 !important;
}

.login-error {
  background: rgba(220,38,38,.08) !important;
  color: var(--bad) !important;
  border: 1px solid rgba(220,38,38,.20) !important;
  border-radius: 12px !important;
}

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