/* ── themed scrollbars (site-wide, liquid glass) ── */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--scroll-rgb), 0.34) transparent;
}
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(var(--scroll-rgb), 0.04);
  border-radius: 999px;
  margin: 4px 0;
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(var(--scroll-rgb), 0.42), rgba(var(--scroll-rgb), 0.2));
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(var(--scroll-rgb), 0.28);
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(var(--scroll-rgb), 0.58), rgba(var(--scroll-rgb), 0.32));
  background-clip: padding-box;
}
::-webkit-scrollbar-corner {
  background: transparent;
}

html,
body {
  margin: 0;
  height: 100%;
  background: radial-gradient(
    140% 120% at 50% -10%,
    var(--bg-radial-top) 0%,
    var(--bg1) 45%,
    var(--bg0) 100%
  );
  color: var(--txt);
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
  overscroll-behavior: none;
}

body {
  overflow: hidden;
}
h1,
h2,
h3,
h4,
h5,
h6,
p {
  margin: 0;
  color: inherit;
  font: inherit;
}
button,
input,
textarea,
select {
  font-family: inherit;
}
:where(button, a, input, textarea, select, [tabindex]):focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

svg {
  display: block;
}
.ic {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ic.fill {
  fill: currentColor;
  stroke: none;
}

/* ── ambient background (grayscale, slow float) ── */
.bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  filter: blur(8px);
}
.blob {
  position: absolute;
  border-radius: 50%;
  opacity: 0.16;
  mix-blend-mode: screen;
  animation: float 20s ease-in-out infinite;
}
.b1 {
  width: 46vh;
  height: 46vh;
  left: -12vh;
  top: -8vh;
  background: radial-gradient(circle, var(--blob-1), transparent 62%);
}
.b2 {
  width: 40vh;
  height: 40vh;
  right: -10vh;
  top: 18vh;
  background: radial-gradient(circle, var(--blob-2), transparent 62%);
  animation-delay: -7s;
}
.b3 {
  width: 52vh;
  height: 52vh;
  left: 10vh;
  bottom: -18vh;
  background: radial-gradient(circle, var(--blob-3), transparent 62%);
  animation-delay: -13s;
}
@keyframes float {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(6vw, 4vh) scale(1.08);
  }
  66% {
    transform: translate(-4vw, -3vh) scale(0.95);
  }
}
/* cursor-reactive dot field — above the blurred blobs, below the app.
   <canvas> is a replaced element, so it needs an explicit size (inset
   alone won't stretch it). */
.fx {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  display: block;
}

/* ── glass primitives ── */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur)) saturate(120%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(120%);
  border: 1px solid var(--glass-brd);
  box-shadow:
    inset 0 1px 0 var(--glass-hi),
    0 12px 40px rgba(0, 0, 0, 0.5);
}
.glass-inset {
  background: var(--inset-bg);
  border: 1px solid var(--inset-brd);
  box-shadow: inset 0 1px 0 var(--inset-hi);
}

/* ── layout (full-screen: sidebar + main) ── */
.app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: row;
  height: 100dvh;
  width: 100%;
  gap: 0;
}

/* ── sidebar ── */
.sidebar {
  flex: 0 0 var(--sidebar-w);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: calc(var(--safe-top) + 14px) 12px calc(var(--safe-bot) + 14px);
  border-radius: 0;
  border: 0;
  border-right: 1px solid var(--glass-brd);
  overflow: hidden;
  line-height: 1.25;
  letter-spacing: 0;
}
.sidebar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 12px;
}
.logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: var(--chip-fg);
  background: var(--chip-bg);
  box-shadow: none;
}
.logo .ic {
  width: 18px;
  height: 18px;
}
.brand-txt h1 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
}
.brand-txt p {
  margin: 2px 0 0;
  font-size: 11.5px;
  line-height: 1.2;
  color: var(--muted);
}
.header-user {
  color: var(--muted2);
  font-weight: 500;
}

.sidebar-foot {
  flex: 0 0 auto;
  padding-top: 8px;
  border-top: 1px solid rgba(var(--fg-rgb), 0.08);
}
.side-user {
  width: 100%;
  border: 0;
  cursor: pointer;
  text-align: left;
  font: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  border-radius: var(--radius-sm);
  background: rgba(var(--fg-rgb), 0.045);
  color: inherit;
  line-height: 1.2;
  transition:
    background 0.18s,
    box-shadow 0.18s,
    transform 0.12s;
}
.side-user:hover {
  background: rgba(var(--fg-rgb), 0.09);
}
.side-user:active {
  transform: scale(0.98);
}
.side-user.active {
  background: rgba(var(--fg-rgb), 0.1);
  box-shadow: inset 0 0 0 1px rgba(var(--fg-rgb), 0.16);
}
.side-av {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  flex: 0 0 auto;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-weight: 650;
  font-size: 12px;
  line-height: 1;
  color: var(--chip-fg);
  background: var(--chip-bg);
}
.side-av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.side-user-id {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.side-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-plan {
  font-size: 11px;
  line-height: 1.2;
  color: var(--muted2);
  margin-top: 0;
}

/* ── main column ── */
.main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: calc(var(--safe-top) + 16px) 20px calc(var(--safe-bot) + 16px);
}
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  background: var(--muted2);
  box-sizing: border-box;
}
.dot.idle {
  background: var(--muted2);
}
.dot.running,
.dot.initializing {
  background: var(--ok);
  box-shadow: 0 0 10px var(--ok-glow);
  animation: pulse-ok 1.2s ease-in-out infinite;
}
.dot.waiting {
  background: #f0d98c;
  box-shadow: 0 0 10px rgba(240, 217, 140, 0.5);
  animation: pulse-ok 1.6s ease-in-out infinite;
}
.dot.done {
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok-glow);
}
.dot.error,
.dot.stopped {
  background: var(--err);
  border: none;
  box-shadow: 0 0 10px var(--err-glow);
  animation: pulse-err 0.85s ease-in-out infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}
@keyframes pulse-ok {
  50% {
    opacity: 0.45;
    box-shadow: 0 0 4px var(--ok-glow);
  }
}
@keyframes pulse-err {
  50% {
    opacity: 0.4;
    transform: scale(1.2);
  }
}

.run-spinner {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--txt);
  width: 1ch;
  text-align: center;
  line-height: 1;
  flex: 0 0 auto;
  text-shadow: 0 0 8px rgba(var(--fg-rgb), 0.45);
}
.run-spinner[hidden] {
  display: none;
}

.counter {
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  text-align: center;
  min-width: 64px;
}
.counter span {
  font-size: 20px;
  font-weight: 700;
  display: block;
  line-height: 1;
}
.counter small {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── scroll view ── */
.view {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 2px 4px 6px;
  scrollbar-gutter: stable;
}
.view > * {
  width: 100%;
  max-width: var(--content-max);
  min-width: 0;
}
.view > *,
.subview > * {
  flex-shrink: 0;
}
.subview > * {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

/* ── cards ── */
.card {
  border-radius: var(--radius);
  padding: 16px;
}
.card h2 {
  margin: 0 0 4px;
  font-size: 15px;
}
.card .sub {
  margin: 0 0 14px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}
.card h2 b,
.card .sub b {
  color: var(--txt);
  font-weight: 600;
}

/* Shared icon-led hierarchy for every module card. */
.page-card {
  position: relative;
  overflow: hidden;
}
.page-card::before {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--fg-rgb), 0.32), transparent);
  opacity: 0.7;
  pointer-events: none;
}
.page-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  margin-bottom: 16px;
}
.page-head.compact {
  align-items: center;
  margin-bottom: 12px;
}
.skip-link {
  position: absolute;
  left: 12px;
  top: 8px;
  z-index: 200;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--chip-bg);
  color: var(--chip-fg);
  font-weight: 700;
  transform: translateY(-160%);
  text-decoration: none;
}
.skip-link:focus {
  transform: none;
}

.page-head-icon {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--txt);
  background: rgba(var(--fg-rgb), 0.06);
  border: 1px solid rgba(var(--fg-rgb), 0.08);
}
.page-head-icon .ic {
  width: 21px;
  height: 21px;
}
.page-head-copy {
  flex: 1 1 auto;
  min-width: 0;
}
.page-head-copy h2 {
  margin: 1px 0 0;
  color: var(--txt);
  font-size: 16px;
  font-weight: 750;
  letter-spacing: 0.01em;
}
.page-head-copy .sub {
  margin: 4px 0 0;
  max-width: 78ch;
}
.page-head > .btn {
  flex: 0 0 auto;
  margin-left: auto;
}
.page-head-eyebrow {
  margin-bottom: 3px;
  color: var(--muted2);
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.resource-hub {
  padding-bottom: 13px;
}

.overview-stats {
  align-items: center;
  gap: 7px;
  margin: -1px 0 14px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: rgba(var(--fg-rgb), 0.025);
  border: 1px solid rgba(var(--fg-rgb), 0.07);
}
.overview-stats .chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(var(--fg-rgb), 0.05);
  border: 1px solid rgba(var(--fg-rgb), 0.09);
  line-height: 1.25;
}
.empty-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.empty-panel b {
  color: var(--txt);
  font-size: 14px;
}
.empty-panel > span:last-child {
  max-width: 42ch;
  line-height: 1.5;
}

.field {
  margin-bottom: 12px;
}
.field:last-child {
  margin-bottom: 0;
}
.field label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 7px;
  letter-spacing: 0.3px;
}
.field .val {
  float: right;
  color: var(--txt);
  font-weight: 700;
}
/* sliders read as their own row — keep the gap to the next field even */
.range-field {
  margin-bottom: 12px;
}
.range-field label {
  margin-bottom: 0;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"],
textarea,
select {
  width: 100%;
  color: var(--txt);
  font: inherit;
  font-size: 14px;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  outline: none;
  min-height: 22px;
}
/* Standalone inputs (legacy / scraper sliders context) outside .input-wrap */
.field > input[type="text"],
.field > input[type="number"],
.field > input[type="search"],
.field > textarea,
.field > select,
.add-row > input {
  background: rgba(var(--fg-rgb), 0.045);
  border: 1px solid rgba(var(--fg-rgb), 0.12);
  border-radius: var(--radius-sm);
  padding: 12px 13px;
  transition:
    border-color 0.15s,
    box-shadow 0.15s,
    background 0.15s;
}
.field > input:focus,
.field > textarea:focus,
.field > select:focus,
.add-row > input:focus {
  border-color: rgba(var(--fg-rgb), 0.55);
  box-shadow: 0 0 0 3px rgba(var(--fg-rgb), 0.12);
  background: rgba(var(--fg-rgb), 0.07);
}

/* glass input wrapper — used for profile, auth, admin search, passwords */
.input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  padding: 0 12px;
  min-height: 46px;
  transition:
    border-color 0.15s,
    box-shadow 0.15s,
    background 0.15s;
}
.input-wrap:focus-within {
  border-color: rgba(var(--fg-rgb), 0.55) !important;
  box-shadow:
    0 0 0 3px rgba(var(--fg-rgb), 0.12),
    inset 0 1px 0 rgba(var(--fg-rgb), 0.12);
  background: rgba(var(--fg-rgb), 0.07) !important;
}
.input-wrap input,
.input-wrap textarea {
  flex: 1;
  min-width: 0;
  padding: 12px 0;
}
.input-wrap.textarea-wrap {
  align-items: stretch;
  padding: 10px 12px;
  min-height: 88px;
}
.input-wrap.textarea-wrap textarea {
  resize: vertical;
  min-height: 68px;
  line-height: 1.45;
  font-family: inherit;
  font-size: 13px;
  padding: 0;
}
.input-wrap.compact {
  min-height: 42px;
  padding: 0 12px;
}
.input-wrap.compact input {
  padding: 10px 0;
  font-size: 13px;
}
.input-wrap input,
.input-wrap textarea {
  font-size: 13px;
}
.input-prefix {
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  flex: 0 0 auto;
  user-select: none;
}
.input-toggle {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: rgba(var(--fg-rgb), 0.08);
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition:
    background 0.15s,
    color 0.15s;
}
.input-toggle:hover {
  background: rgba(var(--fg-rgb), 0.14);
  color: #fff;
}
.input-toggle .ic {
  width: 18px;
  height: 18px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.form-stack .field:last-child {
  margin-bottom: 0;
}
/* section headers pop: white + bold + soft glow, with a hairline fading right */
.form-section-title,
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 22px 0 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--txt);
  text-shadow: 0 0 14px rgba(var(--fg-rgb), 0.22);
}
.form-section-title::after,
.section-title::after {
  content: "";
  flex: 1 1 24px;
  height: 1px;
  border-radius: 1px;
  background: linear-gradient(90deg, rgba(var(--fg-rgb), 0.28), rgba(var(--fg-rgb), 0.02));
}
.form-section-title:first-child,
.section-title:first-child {
  margin-top: 4px;
}
.section-hint {
  margin: -4px 0 12px;
  font-size: 12px;
}
.template-preview {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted, #8b93a7);
  line-height: 1.35;
}

.pw-hints {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 12px;
}
.pw-hint {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--muted2);
}
.pw-hint .ic {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  opacity: 0.5;
}
.pw-hint.ok {
  color: var(--muted);
}
.pw-hint.ok .ic {
  opacity: 1;
  color: #fff;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
textarea:focus,
select:focus {
  outline: none;
}
/* neutralize built-in reveal/clear controls so password fields match the theme */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
  display: none;
}
input::-webkit-credentials-auto-fill-button {
  background-color: var(--muted);
}
input:-webkit-autofill,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--txt);
  -webkit-box-shadow: 0 0 0 1000px rgba(30, 30, 33, 0.9) inset;
  caret-color: var(--txt);
  transition: background-color 9999s ease-in-out 0s;
}
textarea {
  resize: vertical;
  min-height: 96px;
  line-height: 1.5;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12.5px;
}
select {
  appearance: none;
}

/* range slider (monochrome, with filled track) */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  outline: none;
  margin: 9px 0 3px;
  background: linear-gradient(
    to right,
    rgb(var(--accent-rgb)) 0%,
    rgb(var(--accent-rgb)) var(--fill, 0%),
    rgba(var(--fg-rgb), 0.12) var(--fill, 0%),
    rgba(var(--fg-rgb), 0.12) 100%
  );
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chip-bg), var(--chip-bg-2));
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  cursor: pointer;
  border: none;
  transition: transform 0.12s;
}
input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chip-bg), var(--chip-bg-2));
  cursor: pointer;
}
input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.14);
}
input[type="range"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.22);
}

/* segmented control */
.seg {
  display: flex;
  gap: 4px;
  background: rgba(var(--fg-rgb), 0.045);
  border: 1px solid rgba(var(--fg-rgb), 0.1);
  border-radius: var(--radius-sm);
  padding: 4px;
}
.seg button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s;
}
.seg button.on {
  color: var(--chip-fg);
  background: linear-gradient(135deg, var(--chip-bg), var(--chip-bg-2));
  box-shadow: 0 4px 12px rgba(var(--shadow-rgb), 0.35);
}
/* wrapping variant: labels never get squeezed — a button that doesn't fit
   moves to the next row at full width instead of cramping its text */
.seg-wrap {
  flex-wrap: wrap;
}
.seg-wrap button {
  flex: 1 0 auto;
  min-width: 64px;
  font-size: 12px;
  padding: 9px 12px;
}
.objective-seg {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.objective-seg button {
  min-width: 0;
}
/* hint that sits right under a segmented control (inside the same field) */
.section-hint.seg-hint {
  margin: 8px 2px 0;
}

/* ── buttons ── */
.btn {
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-sm);
  padding: 13px 18px;
  color: var(--txt);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition:
    transform 0.12s,
    box-shadow 0.2s,
    opacity 0.2s;
}
.btn:active {
  transform: scale(0.97);
}
.btn .ic {
  width: 18px;
  height: 18px;
}
.btn.primary {
  flex: 0 0 auto;
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--accent), rgba(var(--accent-rgb), 0.78));
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.btn.primary:disabled {
  opacity: 0.45;
}
.btn.ghost {
  background: rgba(var(--accent-rgb), 0.07);
  border: 1px solid rgba(var(--accent-rgb), 0.16);
}
.btn.ghost:disabled {
  opacity: 0.4;
}
.btn.off,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}
.btn.small {
  padding: 9px 14px;
  font-size: 13px;
}

.runbar {
  flex: 0 0 auto;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  transition:
    border-color 0.25s,
    box-shadow 0.25s;
}
.runbar .run-meta {
  flex: 1 1 auto;
}
.runbar .run-actions {
  flex: 0 0 auto;
}
.runbar.is-running {
  border-color: rgba(34, 197, 94, 0.35);
  box-shadow:
    inset 0 1px 0 var(--glass-hi),
    0 12px 40px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(34, 197, 94, 0.12);
}
.runbar.is-stopped {
  border-color: rgba(239, 68, 68, 0.45);
  box-shadow:
    inset 0 1px 0 var(--glass-hi),
    0 12px 40px rgba(0, 0, 0, 0.5),
    0 0 18px rgba(239, 68, 68, 0.18);
  animation: runbar-alert 1.1s ease-in-out infinite;
}
@keyframes runbar-alert {
  50% {
    border-color: rgba(239, 68, 68, 0.75);
    box-shadow:
      inset 0 1px 0 var(--glass-hi),
      0 0 24px rgba(239, 68, 68, 0.28);
  }
}
.run-meta.is-active #statusText {
  color: var(--ok);
}
.run-meta.is-alert #statusText {
  color: var(--err);
}
.run-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--muted);
}
.run-found {
  margin-left: auto;
  color: var(--muted2);
}
.run-found b {
  color: var(--txt);
  font-weight: 700;
}
.run-actions {
  display: flex;
  gap: 10px;
}

/* ── nav (vertical inside sidebar) ── */
.tabbar {
  flex: 0 0 auto;
  display: flex;
  gap: 2px;
}
.tab {
  border: 0;
  background: transparent;
  color: var(--muted2);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  border-radius: 12px;
  text-decoration: none;
  transition:
    background 0.18s,
    color 0.18s,
    box-shadow 0.18s;
}
.tab .tic {
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
}
.tab .tic .ic {
  width: 21px;
  height: 21px;
}
.tab.active {
  color: var(--txt);
  background: rgba(var(--fg-rgb), 0.09);
  box-shadow: inset 0 1px 0 rgba(var(--fg-rgb), 0.18);
}

.sidebar .tabbar {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0;
}
.sidebar .tab {
  flex: 0 0 auto;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0;
  position: relative;
}
.sidebar .tab .tic,
.sidebar .tab .tic .ic {
  width: 18px;
  height: 18px;
}
.sidebar .tab > span:last-child {
  flex: 1;
  text-align: left;
  line-height: 1.2;
}
.sidebar .tab:hover:not(.active) {
  color: var(--txt);
  background: rgba(var(--fg-rgb), 0.055);
}
.sidebar .tab.active::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 14px;
  border-radius: 2px;
  background: var(--accent);
}

/* ── scraper sub-navigation ── */
.subnav {
  border-radius: var(--radius-sm);
  padding: 4px;
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 2px;
  margin-bottom: 2px;
  position: sticky;
  top: 0;
  z-index: 3;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
}
.subtab {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--muted2);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.18s;
  white-space: nowrap;
}
.subtab .tic {
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
}
.subtab .tic .ic {
  width: 19px;
  height: 19px;
}
.subtab.active {
  color: var(--chip-fg);
  background: linear-gradient(135deg, var(--chip-bg), var(--chip-bg-2));
  box-shadow: 0 4px 12px rgba(var(--shadow-rgb), 0.35);
}
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin: 0 0 4px;
  font-size: 12px;
}
.crumb {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}
.crumb:hover {
  color: var(--txt);
}
.crumb.is-current {
  color: var(--txt);
  pointer-events: none;
}
.crumb-sep {
  color: var(--muted2);
  opacity: 0.55;
}
.subview {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── result cards ── */
.result {
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.3s ease both;
}
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
.avatar {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 17px;
  color: var(--chip-fg);
  background: linear-gradient(135deg, var(--chip-bg), var(--chip-bg-2));
}
.r-main {
  flex: 1;
  min-width: 0;
}
.r-name {
  display: flex;
  align-items: center;
  gap: 6px;
}
.r-name a {
  color: var(--txt);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.r-name .ver {
  color: var(--txt);
  display: inline-flex;
}
.r-name .ver .ic {
  width: 15px;
  height: 15px;
}
.r-handle {
  color: var(--muted);
  font-size: 12px;
}
.r-stats {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.chip {
  font-size: 11px;
  color: var(--muted);
}
.chip b {
  color: var(--txt);
  font-weight: 600;
}
.chip.er b {
  color: #fff;
}

/* ── console (monochrome, differentiated by weight/opacity/bar) ── */
.console {
  border-radius: var(--radius-sm);
  padding: 12px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.55;
  color: #d4d4d8;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.4);
  scrollbar-gutter: stable;
}
.console div {
  padding-left: 8px;
  border-left: 2px solid transparent;
}
.console .console-line {
  display: grid;
  grid-template-columns: 5ch minmax(0, 1fr);
  gap: 10px;
}
.console-line-number {
  color: rgba(var(--fg-rgb), 0.34);
  font-variant-numeric: tabular-nums;
  text-align: right;
  user-select: none;
}
.console-line-text {
  min-width: 0;
}
.console .l-ok {
  color: var(--txt);
  border-left-color: rgba(var(--fg-rgb), 0.55);
}
.console .l-warn {
  color: var(--muted);
  border-left-color: rgba(var(--fg-rgb), 0.28);
}
.console .l-err {
  color: var(--txt);
  font-weight: 700;
  border-left-color: var(--txt);
}
.console .l-plus {
  color: var(--txt);
  border-left-color: rgba(var(--fg-rgb), 0.8);
}

/* ── list editor (queries / seeds / tokens) ── */
.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(var(--fg-rgb), 0.045);
  border: 1px solid rgba(var(--fg-rgb), 0.08);
  transition:
    border-color 0.16s,
    background 0.16s,
    transform 0.12s;
}
.list-item span {
  flex: 1;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item span.mono {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 13px;
  letter-spacing: 0.3px;
}
.list-item button {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 9px;
  border: 1px solid rgba(var(--fg-rgb), 0.12);
  cursor: pointer;
  background: rgba(var(--fg-rgb), 0.06);
  color: var(--muted);
  display: grid;
  place-items: center;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s,
    transform 0.12s;
}
.list-item button .ic {
  width: 15px;
  height: 15px;
}
.list-item button:active {
  transform: scale(0.9);
}
.list-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.list-editor:last-child {
  margin-bottom: 0;
}
.list-editor .list:has(.empty) {
  border-radius: 12px;
  background: rgba(var(--fg-rgb), 0.018);
}
.list-editor .empty {
  padding: 13px 12px;
}
.add-row {
  display: flex;
  gap: 10px;
  margin-top: 0;
  align-items: stretch;
}
.add-row input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 46px;
}
.add-row .btn {
  flex: 0 0 48px;
  width: 48px;
  min-height: 46px;
  padding: 0;
}

/* ── token / proxy manager ── */
.tm-head {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}
.tm-head-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--txt);
  background: rgba(var(--fg-rgb), 0.08);
  border: 1px solid rgba(var(--fg-rgb), 0.12);
}
.tm-head-icon .ic {
  width: 20px;
  height: 20px;
}
.tm-head-copy {
  flex: 1 1 auto;
  min-width: 0;
}
.tm-stats {
  align-items: center;
  margin: 2px 0 14px;
  min-height: 30px;
}
.tm-stats .chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(var(--fg-rgb), 0.05);
  border: 1px solid rgba(var(--fg-rgb), 0.09);
  font-size: 11.5px;
}
.tm-stats .chip b {
  font-weight: 700;
}
.tm-stats .chip.warm {
  background: rgba(var(--fg-rgb), 0.09);
  border-color: rgba(var(--fg-rgb), 0.16);
  color: var(--txt);
}
.tm-clear {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted2);
  padding: 6px 11px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid rgba(var(--fg-rgb), 0.1);
  transition:
    color 0.15s,
    border-color 0.15s,
    background 0.15s;
}
.tm-clear .btn-ic .ic {
  width: 14px;
  height: 14px;
}
.tm-list {
  margin-bottom: 12px;
}
.tm-list .list-item {
  animation: viewIn 0.28s cubic-bezier(0.22, 0.61, 0.36, 1) both;
  animation-delay: calc(var(--i, 0) * 22ms);
}
.tm-add {
  margin: 0;
}
.tm-add textarea {
  min-height: 84px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}
.tm-add-btn {
  width: 100%;
}

.upload-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(var(--fg-rgb), 0.08);
}
.upload-stack > .textarea-wrap {
  margin: 0;
}
.upload-stack > .btn {
  width: 100%;
  min-height: 42px;
  margin: 0;
}
.upload-stack .upload-help {
  margin: 0;
  padding: 10px 2px 0;
  border-top: 1px solid rgba(var(--fg-rgb), 0.055);
}

.empty {
  text-align: center;
  color: var(--muted2);
  font-size: 13px;
  padding: 32px 12px;
}
.empty .big {
  display: grid;
  place-items: center;
  margin: 0 auto 10px;
  opacity: 0.6;
}
.empty .big .ic {
  width: 34px;
  height: 34px;
}

.hint {
  font-size: 11.5px;
  color: var(--muted2);
  margin-top: 8px;
  line-height: 1.5;
}
.hint b {
  color: var(--muted);
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 16px 0;
  border: 0;
}
