/* SteelQTO - application stylesheet.
 * Design tokens follow a validated light/dark data-viz palette:
 * single accent hue for magnitude, neutral inks, hairline grids. */

:root {
  color-scheme: light;
  --surface-1: #fcfcfb;
  --page: #f9f9f7;
  --ink-1: #0b0b0b;
  --ink-2: #52514e;
  --ink-muted: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --series-1: #35629b;
  --accent: #35629b;
  --accent-soft: rgba(53, 98, 155, 0.08);
  --good: #0ca30c;
  --critical: #d03b3b;
  --code-bg: #f4f3f0;
  --shadow: 0 1px 3px rgba(11, 11, 11, 0.06), 0 6px 24px rgba(11, 11, 11, 0.05);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1: #1a1a19;
  --page: #0d0d0d;
  --ink-1: #ffffff;
  --ink-2: #c3c2b7;
  --ink-muted: #898781;
  --grid: #2c2c2a;
  --baseline: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --series-1: #5d87ba;
  --accent: #5d87ba;
  --accent-soft: rgba(93, 135, 186, 0.14);
  --code-bg: #232322;
  --shadow: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-1: #1a1a19;
    --page: #0d0d0d;
    --ink-1: #ffffff;
    --ink-2: #c3c2b7;
    --ink-muted: #898781;
    --grid: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --series-1: #5d87ba;
    --accent: #5d87ba;
    --accent-soft: rgba(93, 135, 186, 0.14);
    --code-bg: #232322;
    --shadow: none;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--ink-1);
  font-size: 14px;
  line-height: 1.55;
}
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 20px 64px; }

/* ---------- header ---------- */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 0 14px; border-bottom: 1px solid var(--grid); margin-bottom: 18px;
}
.logo {
  width: 40px; height: 40px; border-radius: 10px; flex: none;
  background: var(--accent); display: grid; place-items: center;
}
.logo svg { width: 24px; height: 24px; }
.topbar .titles { flex: 1 1 auto; min-width: 0; }
.topbar h1 { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.topbar .sub { font-size: 12.5px; color: var(--ink-muted); }
.topbar .actions { display: flex; gap: 8px; align-items: center; }
.chip {
  font-size: 11px; font-weight: 600; color: var(--accent);
  border: 1px solid var(--accent); border-radius: 99px; padding: 2px 10px; white-space: nowrap;
}
.iconbtn {
  background: none; border: 1px solid var(--baseline); border-radius: 8px;
  width: 34px; height: 34px; cursor: pointer; color: var(--ink-2); font-size: 15px;
}
.iconbtn:hover { border-color: var(--accent); color: var(--accent); }

.intro { color: var(--ink-2); max-width: 900px; margin-bottom: 18px; }

/* ---------- pipeline strip ---------- */
.pipeline { display: flex; gap: 8px; margin: 0 0 22px; flex-wrap: wrap; }
.step {
  flex: 1 1 150px; min-width: 150px;
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.step::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--grid); transition: background .25s;
}
.step.done::before { background: var(--good); }
.step .n { font-size: 10.5px; color: var(--ink-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.step .t { font-weight: 650; font-size: 13px; margin-top: 1px; }
.step .s { font-size: 12px; color: var(--ink-muted); margin-top: 2px; min-height: 18px; }
.step.done .s { color: var(--good); font-weight: 600; }

/* ---------- layout ---------- */
.cols { display: grid; grid-template-columns: 390px 1fr; gap: 20px; align-items: start; }
.cols > div { min-width: 0; }
@media (max-width: 1000px) { .cols { grid-template-columns: 1fr; } }

.card {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card h2 {
  font-size: 12.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--ink-2); margin-bottom: 10px;
}

/* ---------- upload ---------- */
.drop {
  border: 2px dashed var(--baseline); border-radius: 12px; padding: 26px 14px;
  text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop .big { font-weight: 600; }
.drop .sub { color: var(--ink-muted); font-size: 12px; margin-top: 4px; }
.filemeta { font-size: 12px; color: var(--ink-2); margin-top: 10px; display: none; }
.filemeta b { color: var(--ink-1); }

select, button, textarea, input[type="search"] {
  font: inherit; color: var(--ink-1); background: var(--surface-1);
  border: 1px solid var(--baseline); border-radius: 8px;
}
select { padding: 7px 10px; width: 100%; }
label.fld { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin: 12px 0 4px; }
textarea {
  width: 100%; min-height: 300px; padding: 10px;
  font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 11.5px;
  background: var(--code-bg); line-height: 1.45; resize: vertical;
}
.presetdesc { font-size: 12px; color: var(--ink-muted); margin-top: 6px; }
.btnrow { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
button { padding: 8px 14px; font-weight: 600; cursor: pointer; }
button.primary { background: var(--accent); color: #fff; border-color: transparent; }
button.primary:hover { filter: brightness(1.07); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.cfgerr { color: var(--critical); font-size: 12px; margin-top: 6px; white-space: pre-wrap; }
.cfgok { color: var(--good); font-size: 12px; margin-top: 6px; }

/* ---------- KPI tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow);
}
.tile .v { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.tile .v small { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.tile .l { font-size: 12px; color: var(--ink-muted); margin-top: 2px; }

/* ---------- chart ---------- */
.chart .row { display: grid; grid-template-columns: 190px 1fr 78px; align-items: center; gap: 8px; padding: 3px 0; }
.chart .cat { font-size: 12px; color: var(--ink-2); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart .track { position: relative; height: 18px; }
.chart .bar {
  position: absolute; left: 0; top: 0; height: 100%;
  background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; transition: width .35s;
}
.chart .track:hover .bar { filter: brightness(1.12); }
.chart .val { font-size: 12px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.chartnote { font-size: 12px; color: var(--ink-muted); margin-top: 8px; }
.tooltip {
  position: fixed; pointer-events: none; display: none; z-index: 50;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; font-size: 12px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}
.tooltip b { display: block; }

/* ---------- tabs & tables ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--grid); margin-bottom: 12px; flex-wrap: wrap; }
.tabs button {
  border: none; background: none; border-radius: 8px 8px 0 0; padding: 8px 14px;
  color: var(--ink-muted); font-weight: 600; border-bottom: 2px solid transparent;
}
.tabs button.active { color: var(--ink-1); border-bottom-color: var(--accent); }
.toolrow { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.toolrow input[type="search"] { padding: 7px 10px; flex: 1 1 220px; max-width: 340px; }
.badge {
  font-size: 11.5px; color: var(--ink-2); background: var(--code-bg);
  border-radius: 99px; padding: 3px 10px; font-variant-numeric: tabular-nums;
}
.tblwrap { overflow: auto; max-height: 560px; border: 1px solid var(--grid); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
th {
  position: sticky; top: 0; background: var(--surface-1); z-index: 2;
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ink-2); padding: 8px 10px; border-bottom: 1px solid var(--baseline);
  white-space: nowrap; cursor: pointer; user-select: none;
}
th .dir { color: var(--accent); }
td { padding: 5px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.asm td { font-weight: 600; background: var(--accent-soft); }
tr.part td:first-child { padding-left: 26px; color: var(--ink-2); }
.note { font-size: 12px; color: var(--ink-muted); margin: 8px 2px; }
.log {
  font-family: ui-monospace, Consolas, monospace; font-size: 12px;
  background: var(--code-bg); border-radius: 10px; padding: 12px;
  white-space: pre-wrap; max-height: 420px; overflow: auto;
}
.empty { color: var(--ink-muted); text-align: center; padding: 60px 0; }

footer { margin-top: 28px; font-size: 12px; color: var(--ink-muted); border-top: 1px solid var(--grid); padding-top: 14px; }
