:root {
  --bg-0: #07080c;
  --bg-1: #0c0e14;
  --bg-2: #11141c;
  --bg-3: #181c26;
  --border: #1c2230;
  --border-strong: #2a3242;
  --fg: #d4d9e4;
  --fg-strong: #f1f3f8;
  --muted: #4e586c;
  --muted-2: #6b7689;
  --muted-3: #8c95a8;
  --accent: #e8b446;
  --accent-dim: #8a6826;
  --accent-soft: rgba(232, 180, 70, 0.08);
  --green: #4ade80;
  --green-soft: rgba(74, 222, 128, 0.10);
  --red: #f05858;
  --red-soft: rgba(240, 88, 88, 0.10);
  --blue: #6aaeff;
  --tag-main: #6aaeff;
  --tag-models: #5dcfb0;
  --tag-prices: #e89bd9;
  --tag-sync: #f0b864;
  --tag-check: #b994f0;
  --tag-import: #7fd88f;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --serif: 'IBM Plex Serif', Georgia, serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--fg);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'ss01', 'ss02', 'cv11';
  overflow: hidden;
}

body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 8% -10%, rgba(232, 180, 70, 0.05), transparent 60%),
    radial-gradient(ellipse 50% 40% at 100% 100%, rgba(106, 174, 255, 0.035), transparent 65%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed; inset: 0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.012) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.012) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
  z-index: 0;
}

.app {
  position: relative; z-index: 1;
  display: grid;
  grid-template-rows: auto auto 1fr;
  height: 100vh;
}

/* ── TOP BAR ───────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.015), transparent),
              rgba(7, 8, 12, 0.85);
  backdrop-filter: blur(10px);
}
.brand {
  display: flex; align-items: center; gap: 18px;
}
.glyph {
  width: 18px; height: 18px;
  border: 1.5px solid var(--accent);
  transform: rotate(45deg);
  position: relative;
  flex-shrink: 0;
}
.glyph::after {
  content: '';
  position: absolute; inset: 3px;
  background: var(--accent);
  opacity: 0.55;
}
.brand-name {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.16em;
  color: var(--fg-strong);
}
.brand-sep {
  width: 1px; height: 16px; background: var(--border-strong);
}
.brand-sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--muted-3);
  letter-spacing: 0.01em;
}

.topbar-meta {
  display: flex; align-items: center; gap: 24px;
  font-family: var(--mono);
}
.meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 10.5px;
  letter-spacing: 0.1em;
}
.meta-label {
  color: var(--muted);
  text-transform: uppercase;
}
.meta-value {
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.heartbeat {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.5);
  animation: pulse 1.8s ease-out infinite;
}
.heartbeat.off { background: var(--red); animation: none; box-shadow: none; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.55); }
  70%  { box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

/* ── TAB BAR ───────────────────────────────────── */
.tabbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  height: 38px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-0);
}
.tabs {
  display: flex;
  height: 100%;
  align-items: stretch;
}
.tab {
  appearance: none;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted-2);
  padding: 0 18px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color 140ms ease, border-color 200ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.tab:hover { color: var(--fg); }
.tab .tab-idx {
  font-size: 9.5px;
  color: var(--muted);
  letter-spacing: 0.2em;
  border: 1px solid var(--border-strong);
  padding: 1px 5px;
  border-radius: 2px;
}
.tab.active {
  color: var(--fg-strong);
  border-bottom-color: var(--accent);
}
.tab.active .tab-idx {
  color: var(--accent);
  border-color: var(--accent-dim);
}
.tab-meta {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono);
}
.tab-meta .meta-label {
  font-size: 10px;
  color: var(--muted-2);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.tab-meta .meta-value {
  font-size: 11px;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

/* ── TAB CONTENT ───────────────────────────────── */
.tab-content {
  min-height: 0;
  overflow: hidden;
  background: var(--bg-1);
  position: relative;
}
.panel { height: 100%; overflow: hidden; }
/* `!important` because per-panel ID rules (`#panel-dashboard { display: grid }`,
   `#panel-controls { display: grid }`) outrank the `.panel[hidden]` attribute
   selector on specificity and would otherwise keep hidden panels visible. */
.panel[hidden] { display: none !important; }

/* Dashboard internal layout: KPIs auto, table fills the rest */
#panel-dashboard {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
}
#panel-dashboard .dash-table { overflow: hidden; display: grid; grid-template-rows: auto 1fr; }

/* Controls: list left, detail right */
#panel-controls {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  min-height: 0;
}
.job-list {
  border-right: 1px solid var(--border);
  background: var(--bg-1);
  overflow: auto;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.job-row {
  appearance: none;
  background: transparent;
  border: none;
  border-left: 2px solid transparent;
  text-align: left;
  padding: 12px 18px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  font-family: var(--mono);
  color: var(--fg);
  text-transform: none;
  letter-spacing: 0;
  transition: background 140ms ease, border-color 140ms ease;
}
.job-row:hover { background: rgba(255, 255, 255, 0.02); }
.job-row.selected {
  background: linear-gradient(90deg, var(--accent-soft) 0%, transparent 60%);
  border-left-color: var(--accent);
}
.job-row .job-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}
.job-row.running .job-dot {
  background: var(--green);
  animation: pulse-green 1.4s ease-out infinite;
}
.job-row.exited.err .job-dot { background: var(--red); }
.job-row .job-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.job-row .job-code {
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.16em;
  font-weight: 500;
}
.job-row .job-desc {
  font-size: 10.5px;
  color: var(--muted-2);
  letter-spacing: 0.08em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job-row .pill {
  padding: 2px 8px;
  font-size: 9.5px;
}

.job-detail {
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  min-height: 0;
  background: var(--bg-0);
  overflow: hidden;
}
.detail-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
}
.detail-title {
  display: flex; align-items: baseline; gap: 12px;
  min-width: 0;
}
.detail-title .section-code { font-size: 12px; }
.detail-title .detail-name {
  font-family: var(--mono);
  color: var(--fg-strong);
  font-size: 13px;
  letter-spacing: 0.01em;
}
.detail-title .detail-name em { font-style: normal; color: var(--muted-3); }
.detail-actions { display: flex; align-items: center; gap: 12px; }
.detail-status {
  font-family: var(--mono, monospace);
  font-size: 11px;
  color: var(--muted-3);
  max-width: 360px;
  text-align: right;
  line-height: 1.3;
}
.detail-status.err { color: var(--red); }

.detail-forms {
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.detail-forms .job-form[hidden] { display: none; }
.detail-forms .job-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.detail-forms .actions-spec {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.detail-runs {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-0);
}
.detail-runs .field-label { font-size: 10px; }
.detail-runs select {
  flex: 1;
  max-width: 460px;
  font-size: 11px;
}
.detail-runs button { padding: 5px 10px; font-size: 10px; }

/* Scoped detail log uses the existing .log-section / .log-split / .log-pane styles
   but lives inside the detail pane, so the header should be slimmer. */
.detail-log {
  border-top: none;
}
.detail-log .log-head { padding: 8px 18px; }

/* ── DASHBOARD PANEL ───────────────────────────── */
.dash-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
}
.kpi {
  position: relative;
  padding: 12px 22px 14px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.kpi:last-child { border-right: none; }
.kpi-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted-2);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.kpi-value {
  font-family: var(--mono);
  font-size: 24px;
  line-height: 1;
  font-weight: 500;
  color: var(--fg-strong);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.kpi-sub {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.kpi-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  opacity: 0.4;
}
.kpi-bar.created { background: var(--green); }
.kpi-bar.deleted { background: var(--red); }

.dash-table {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.dash-table-head {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) 90px 90px minmax(140px, 1.6fr) 110px;
  gap: 14px;
  padding: 7px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-0);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted-2);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.dh-created, .dh-deleted, .dh-stock { text-align: right; }

.dash-rows {
  flex: 1;
  overflow: auto;
}
.dash-empty {
  padding: 32px 22px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted-2);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.dash-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) 90px 90px minmax(140px, 1.6fr) 110px;
  gap: 14px;
  padding: 5px 22px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  align-items: center;
  transition: background 140ms ease;
}
.dash-row:hover { background: rgba(255, 255, 255, 0.012); }
.dash-row.zero { opacity: 0.5; }
.dash-row.import {
  background:
    linear-gradient(90deg, rgba(232, 180, 70, 0.06), transparent 30%);
  border-left: 2px solid var(--accent);
  padding-left: 20px;
}
.dash-row.import:hover { background: rgba(232, 180, 70, 0.08); }
.dept-badge {
  display: inline-block;
  margin-left: 10px;
  padding: 1px 6px;
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  background: var(--accent-soft);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-radius: 2px;
  vertical-align: 1px;
}

.dept-name {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.dept-name-line {
  color: var(--fg-strong);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dept-name-meta {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.col-created, .col-deleted, .col-stock {
  text-align: right;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.col-created { color: var(--green); }
.col-created.zero { color: var(--muted); }
.col-deleted { color: var(--red); }
.col-deleted.zero { color: var(--muted); }
.col-stock { color: var(--fg); }

.bars { display: flex; flex-direction: column; gap: 4px; }
.bar {
  position: relative;
  height: 6px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 1px;
  overflow: hidden;
}
.bar::after {
  content: '';
  position: absolute;
  inset: 0;
  width: var(--w, 0%);
  transition: width 600ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.bar.created::after { background: linear-gradient(90deg, rgba(74, 222, 128, 0.6), var(--green)); }
.bar.deleted::after { background: linear-gradient(90deg, rgba(240, 88, 88, 0.6), var(--red)); }

/* ── CONTROLS PANEL ─────────────────────────────── */
.sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  background: var(--bg-1);
  min-height: 100%;
}
.section {
  border-right: 1px solid var(--border);
  padding: 16px 22px 18px;
  display: flex; flex-direction: column; gap: 11px;
  position: relative;
  min-width: 0;
}
.section:last-child { border-right: none; }
.section::before {
  content: '';
  position: absolute;
  top: 0; left: 0; height: 2px; width: 0;
  background: var(--accent);
  transition: width 280ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.section:hover::before { width: 40px; }

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
  margin-bottom: 2px;
}
.section-title {
  display: flex; align-items: baseline; gap: 12px;
  min-width: 0;
}
.section-idx {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  font-variant-numeric: tabular-nums;
}
.section-code {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
}
.section-name {
  font-family: var(--mono);
  color: var(--fg-strong);
  font-size: 12.5px;
  font-weight: 400;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.section-name em {
  font-style: normal;
  color: var(--muted-3);
}

/* form rows */
.field {
  display: grid;
  grid-template-columns: 64px 1fr;
  align-items: center;
  gap: 10px;
}
.field-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted-2);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

select, input[type=text], input[type=number] {
  width: 100%;
  background: var(--bg-0);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  outline: none;
  transition: border-color 140ms ease, background 140ms ease;
  font-feature-settings: 'ss01', 'zero';
}
select:hover, input:hover { border-color: var(--border-strong); }
select:focus, input:focus {
  border-color: var(--accent-dim);
  background: var(--bg-2);
}
select {
  cursor: pointer;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted-3) 50%),
    linear-gradient(135deg, var(--muted-3) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 10px) 50%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  padding-right: 26px;
}
input[type=number] { font-variant-numeric: tabular-nums; }
input::placeholder { color: var(--muted); }

/* action row + buttons */
.actions {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.actions-spec {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.btn-group { display: flex; gap: 4px; }
button {
  appearance: none;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  padding: 6px 14px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  font-weight: 500;
  transition: all 140ms ease;
  position: relative;
}
button:hover { border-color: var(--muted-2); color: var(--fg-strong); background: var(--bg-2); }
button:active { transform: translateY(0.5px); }
button.run {
  color: var(--accent);
  border-color: var(--accent-dim);
}
button.run:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--fg-strong);
  box-shadow: inset 0 0 0 1px var(--accent-dim);
}
button.stop:hover {
  color: var(--red);
  border-color: rgba(240, 88, 88, 0.45);
  background: var(--red-soft);
}
button.ghost {
  border-color: var(--border);
  color: var(--muted-3);
  padding: 4px 10px;
  font-size: 10px;
}
button.ghost:hover { color: var(--fg); border-color: var(--border-strong); }

/* ── STATUS PILL ─────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg-0);
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}
.pill .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted-2);
  flex-shrink: 0;
}
.pill.running {
  color: var(--green);
  border-color: rgba(74, 222, 128, 0.35);
  background: var(--green-soft);
}
.pill.running .dot {
  background: var(--green);
  animation: pulse-green 1.4s ease-out infinite;
}
@keyframes pulse-green {
  0%   { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.55); }
  70%  { box-shadow: 0 0 0 5px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}
.pill.exited.ok { color: var(--muted-3); border-color: var(--border-strong); }
.pill.exited.ok .dot { background: var(--muted-3); }
.pill.exited.err {
  color: var(--red);
  border-color: rgba(240, 88, 88, 0.35);
  background: var(--red-soft);
}
.pill.exited.err .dot { background: var(--red); }

/* ── LOG SECTION ──────────────────────────────────── */
.log-section {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
  background: var(--bg-0);
  border-top: 1px solid var(--border);
}
.log-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 0;
  overflow: hidden;
}
.log-col {
  position: relative;          /* anchor for the .log-jump button */
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--border);
}
.log-col:last-child { border-right: none; }
.log-col-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-0);
}
.log-col-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--muted-3);
  text-transform: uppercase;
}
.log-col-label.err { color: var(--red); }
.log-col-spec {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.log-counter.err { color: var(--red); }
.log-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
}
.log-head-left { display: flex; align-items: center; gap: 26px; }
.log-title {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted-2);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.log-title strong {
  color: var(--accent);
  margin-right: 10px;
  font-weight: 500;
}
.legend {
  display: flex; gap: 16px;
  padding-left: 18px;
  border-left: 1px solid var(--border-strong);
}
.legend-item {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--muted-2);
  text-transform: uppercase;
}
.swatch { width: 10px; height: 2px; border-radius: 0; }
.log-head-right {
  display: flex; align-items: center; gap: 14px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted-2);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.log-counter {
  color: var(--fg-strong);
  font-variant-numeric: tabular-nums;
  margin-left: 6px;
}

.log-pane {
  min-height: 0;
  overflow: auto;
  padding: 16px 22px 80px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
  background:
    linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.25) 100%),
    var(--bg-0);
  white-space: pre;
  font-feature-settings: 'ss01', 'ss02', 'zero';
}
.log-pane::-webkit-scrollbar { width: 12px; height: 12px; }
.log-pane::-webkit-scrollbar-track { background: transparent; }
.log-pane::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border: 3px solid var(--bg-0);
  border-radius: 0;
}
.log-pane::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }
.log-pane::-webkit-scrollbar-corner { background: var(--bg-0); }

.log-line { display: block; }
.log-line .ts {
  color: var(--muted);
  margin-right: 14px;
  font-size: 11px;
}
.log-line .tag {
  display: inline-block;
  width: 52px;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 10.5px;
  margin-right: 12px;
  text-align: right;
}
.log-line .pipe { color: var(--border-strong); margin-right: 12px; }
.log-line.tag-main   .tag { color: var(--tag-main); }
.log-line.tag-models .tag { color: var(--tag-models); }
.log-line.tag-prices .tag { color: var(--tag-prices); }
.log-line.tag-sync   .tag { color: var(--tag-sync); }
.log-line.tag-check  .tag { color: var(--tag-check); }
.log-line.tag-import .tag { color: var(--tag-import); }
.log-line.tag-retire .tag { color: var(--tag-check); }
.log-line.tag-ebay   .tag { color: var(--tag-models); }
.log-line .msg { color: var(--fg); }

.log-cursor {
  display: inline-block;
  width: 7px; height: 13px;
  background: var(--accent);
  vertical-align: -2px;
  margin-left: 4px;
  animation: blink 1.05s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* "Jump to live" pill — shown only while a pane is scrolled up and new lines are
   arriving. Clicking it re-pins the pane to the tail. */
.log-jump {
  position: absolute;
  right: 16px;
  bottom: 14px;
  z-index: 4;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bg-0);
  background: var(--accent);
  border: none;
  padding: 5px 11px;
  cursor: pointer;
  border-radius: 2px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}
.log-jump:hover { filter: brightness(1.12); }
.log-jump[hidden] { display: none; }

.empty-state {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
}
.empty-state .glyph-arrow {
  color: var(--muted-2);
  margin-right: 6px;
}

/* corner ticks on the EXEC section */
.corner-tl, .corner-tr, .corner-bl, .corner-br {
  position: absolute;
  width: 6px; height: 6px;
  border: 1px solid var(--accent);
  opacity: 0.35;
}
.corner-tl { top: -1px; left: -1px;  border-right: none; border-bottom: none; }
.corner-tr { top: -1px; right: -1px; border-left: none;  border-bottom: none; }
.corner-bl { bottom: -1px; left: -1px;  border-right: none; border-top: none; }
.corner-br { bottom: -1px; right: -1px; border-left: none;  border-top: none; }

/* ── combobox state (input + datalist) ───────────────────────────────────── */
input.combo {
  padding-right: 26px;
  background-image:
    radial-gradient(circle at 92% 50%, var(--muted) 0 2.5px, transparent 3px),
    radial-gradient(circle at 96% 50%, var(--muted) 0 2.5px, transparent 3px);
  background-repeat: no-repeat;
}
input.combo.valid {
  border-color: rgba(74, 222, 128, 0.35);
  background-image:
    radial-gradient(circle at 92% 50%, var(--green) 0 2.5px, transparent 3px),
    radial-gradient(circle at 96% 50%, var(--green) 0 2.5px, transparent 3px);
}
input.combo.invalid {
  border-color: rgba(240, 88, 88, 0.45);
  background-image:
    radial-gradient(circle at 92% 50%, var(--red) 0 2.5px, transparent 3px),
    radial-gradient(circle at 96% 50%, var(--red) 0 2.5px, transparent 3px);
}
input.shake { animation: shake 0.35s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }
@keyframes shake {
  10%, 90%  { transform: translateX(-1px); }
  20%, 80%  { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-3px); }
  40%, 60% { transform: translateX(3px); }
}

/* ── auth meta in topbar ─────────────────────────────────────────────────── */
.auth-meta { display: none; align-items: center; gap: 8px; }
.auth-meta.on, .auth-meta.warn { display: inline-flex; }
.auth-meta.on    .meta-value { color: var(--green); }
.auth-meta.warn  .meta-value { color: var(--accent); }
.auth-meta.warn  { position: relative; }
.auth-meta.warn::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  margin-right: 2px;
  animation: pulse-amber 1.8s ease-out infinite;
}
@keyframes pulse-amber {
  0% { box-shadow: 0 0 0 0 rgba(232, 180, 70, 0.55); }
  70% { box-shadow: 0 0 0 6px rgba(232, 180, 70, 0); }
  100% { box-shadow: 0 0 0 0 rgba(232, 180, 70, 0); }
}
.auth-meta #logout-btn {
  padding: 2px 8px;
  font-size: 9.5px;
}

/* ── nodes pill (topbar) ─────────────────────────────────────────────────── */
#nodes-meta { display: inline-flex; align-items: center; gap: 8px; }
#nodes-meta .meta-value { color: var(--fg); }
#nodes-meta.up    .meta-value { color: var(--green); }
#nodes-meta.warn  .meta-value { color: var(--accent); }
#nodes-meta.down  .meta-value { color: var(--red); }
#nodes-meta button {
  padding: 2px 8px;
  font-size: 9.5px;
}

/* ── modal ───────────────────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(2px);
}
.modal-card {
  position: relative;
  width: min(560px, 92vw);
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
  border: 1px solid var(--border);
  box-shadow:
    0 0 0 1px rgba(232, 180, 70, 0.05),
    0 30px 80px -30px rgba(0, 0, 0, 0.85);
}
.modal-card::before,
.modal-card::after {
  content: '';
  position: absolute;
  width: 8px; height: 8px;
  border: 1px solid var(--accent);
  opacity: 0.5;
}
.modal-card::before { top: -1px; left: -1px;  border-right: none; border-bottom: none; }
.modal-card::after  { bottom: -1px; right: -1px; border-left: none; border-top: none; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-0);
}
.modal-title {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--accent);
  font-weight: 500;
}
.modal-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 14px; }
.modal-section { display: flex; flex-direction: column; gap: 8px; }
.modal-section-title {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--muted-2);
  text-transform: uppercase;
}
.modal-foot {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 4px;
}
.modal-status {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted-2);
  letter-spacing: 0.06em;
  min-height: 14px;
}
.modal-status.ok  { color: var(--green); }
.modal-status.err { color: var(--red); }
.modal input[type=password] {
  width: 100%;
  background: var(--bg-0);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  outline: none;
}
.modal input[type=password]:focus { border-color: var(--accent-dim); background: var(--bg-2); }
