/* NordStat — Wireframe stylesheet
   Black & white only. No colour. Intentionally low-fi.
   Goal: communicate UI/UX intent, not visual design. */

:root {
  --ink: #111;
  --ink-2: #444;
  --muted: #777;
  --faint: #aaa;
  --line: #222;
  --line-soft: #cfcfcf;
  --line-dashed: #999;
  --bg: #ffffff;
  --bg-alt: #f6f6f4;
  --bg-stripe: #fafaf9;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.45;
}

a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { background: #000; color: #fff; text-decoration: none; }

code, pre, .mono { font-family: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace; font-size: 12px; }

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; text-transform: uppercase; letter-spacing: 0.06em; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2); }
h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }

/* === APP SHELL === */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }

.sidebar {
  border-right: 1px solid var(--line);
  padding: 14px 0 24px;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
  background: var(--bg-alt);
}
.sidebar .brand {
  font-weight: 800; font-size: 14px; letter-spacing: 0.12em;
  padding: 4px 16px 16px;
  border-bottom: 1px dashed var(--line-dashed);
  display: flex; justify-content: space-between; align-items: baseline;
  text-decoration: none; color: var(--ink);
}
.sidebar .brand:hover { color: var(--ink); }
.sidebar .brand small { font-weight: 400; color: var(--muted); letter-spacing: 0.04em; }

.sidebar .nav-group { padding: 14px 0 6px; }
.sidebar .nav-group h4 { padding: 0 16px 6px; }
.sidebar .nav-group.collapsible > h4 {
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  user-select: none;
}
.sidebar .nav-group.collapsible > h4:focus-visible { outline: 1px dashed var(--line); outline-offset: 2px; }
.sidebar .nav-group.collapsible > h4 .chev {
  display: inline-block;
  width: 0; height: 0;
  border-left: 4px solid var(--muted);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transform: rotate(90deg);
  transition: transform 120ms ease;
}
.sidebar .nav-group.collapsible.collapsed > h4 .chev { transform: rotate(0deg); }
.sidebar .nav-group.collapsible.collapsed > nav { display: none; }
.sidebar nav a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 16px;
  text-decoration: none; color: var(--ink);
  border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: #fff; color: var(--ink); }
.sidebar nav a.active { background: #fff; border-left-color: var(--line); font-weight: 700; }
.sidebar nav a .badge { font-size: 11px; color: var(--muted); }

/* === MAIN === */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 24px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 10;
}
.topbar .crumbs { color: var(--muted); font-size: 12px; }
.topbar .crumbs strong { color: var(--ink); font-weight: 600; }
.topbar .right { display: flex; align-items: center; gap: 16px; font-size: 12px; }
.topbar .right .pill { border: 1px solid var(--line); padding: 2px 8px; border-radius: 999px; }
.topbar .right .bell {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: 6px;
}
.topbar .right .bell:hover { background: var(--bg-alt); border-color: var(--line); }
.topbar .right .bell.active { background: var(--bg-alt); border-color: var(--line); }
.topbar .right .bell .bell-badge {
  position: absolute; top: -3px; right: -3px;
  min-width: 14px; height: 14px; padding: 0 3px;
  border: 1px solid var(--ink);
  background: #fff;
  border-radius: 999px;
  font-size: 9px; font-weight: 700; line-height: 12px;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.page { padding: 24px 28px 80px; max-width: 1280px; }

.pageheader { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.pageheader .title { display: flex; flex-direction: column; gap: 4px; }
.pageheader p { margin: 0; color: var(--muted); }

/* === BUTTONS === */
.btn {
  display: inline-block;
  padding: 5px 12px;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit; font-size: 12px;
  cursor: pointer;
  text-decoration: none; color: var(--ink);
}
.btn:hover { background: #000; color: #fff; }
.btn.primary { background: #000; color: #fff; }
.btn.primary:hover { background: #fff; color: #000; }
.btn.ghost { border-color: var(--line-soft); color: var(--ink-2); }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* === TABS === */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs a {
  padding: 6px 14px; text-decoration: none; color: var(--muted);
  border: 1px solid transparent; border-bottom: none;
  position: relative; bottom: -1px;
}
.tabs a.active { color: var(--ink); font-weight: 700; border-color: var(--line); background: #fff; }

/* === CARDS / BOXES === */
.card { border: 1px solid var(--line); padding: 14px 16px; background: #fff; }
.card + .card { margin-top: 12px; }
.card .card-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.card .card-h h2, .card .card-h h3 { margin: 0; }

.box-dashed { border: 1px dashed var(--line-dashed); padding: 16px; color: var(--muted); }
.box-dashed.tall { min-height: 200px; display: flex; align-items: center; justify-content: center; text-align: center; }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-2-1 { grid-template-columns: 2fr 1fr; }
.grid.cols-1-2 { grid-template-columns: 1fr 2fr; }

/* === TABLES === */
table.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
table.tbl th, table.tbl td {
  text-align: left; padding: 7px 10px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
table.tbl th {
  font-weight: 600; color: var(--ink-2);
  border-bottom: 1px solid var(--line);
  text-transform: uppercase; font-size: 11px; letter-spacing: 0.05em;
  background: var(--bg-alt);
}
table.tbl tr:hover td { background: var(--bg-stripe); }
table.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl td.mono { font-family: ui-monospace, monospace; font-size: 11px; }

/* === STATUS DOTS / TAGS === */
.tag {
  display: inline-block;
  padding: 1px 7px;
  border: 1px solid var(--line);
  font-size: 11px;
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.tag.solid { background: #000; color: #fff; }
.tag.muted { border-color: var(--line-soft); color: var(--muted); }
.tag.dashed { border-style: dashed; }

.dot {
  display: inline-block; width: 8px; height: 8px;
  border: 1px solid var(--line); border-radius: 50%;
  vertical-align: middle; margin-right: 6px;
}
.dot.solid { background: #000; }
.dot.half { background: linear-gradient(90deg, #000 50%, #fff 50%); }
.dot.empty { background: #fff; }
.dot.x { border-style: dashed; }

/* === KEY/VALUE ROWS === */
.kv { display: grid; grid-template-columns: 160px 1fr; row-gap: 6px; column-gap: 12px; font-size: 12px; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; }

/* === FAKE INPUT FIELDS === */
.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  padding: 5px 8px;
  font: inherit; font-size: 12px;
  color: var(--ink);
}
.input::placeholder { color: var(--faint); }
.textarea { min-height: 70px; font-family: ui-monospace, monospace; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field > label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.field .hint { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* === STEPS / WIZARD === */
.steps { display: flex; gap: 0; border: 1px solid var(--line); }
.steps .step { flex: 1; padding: 10px 14px; border-right: 1px solid var(--line-soft); position: relative; }
.steps .step:last-child { border-right: none; }
.steps .step .n { font-weight: 700; margin-right: 8px; }
.steps .step.active { background: #000; color: #fff; }
.steps .step.done { background: var(--bg-alt); color: var(--muted); }
a.step { text-decoration: none; color: var(--ink); }
a.step:hover { background: #000; color: #fff; }
a.step.done:hover { background: var(--ink-2); color: #fff; }

/* === MAP-LIKE MATRIX === */
.matrix { border: 1px solid var(--line); border-collapse: collapse; font-size: 11px; }
.matrix th, .matrix td { border: 1px solid var(--line-soft); padding: 6px 10px; text-align: center; min-width: 64px; }
.matrix th { background: var(--bg-alt); }
.matrix td.full { background: #000; color: #fff; }
.matrix td.partial { background: repeating-linear-gradient(45deg, #000, #000 2px, #fff 2px, #fff 4px); color: transparent; }
.matrix td.missing { color: var(--faint); }

/* === DIFF === */
.diff { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--line); }
.diff .diff-side { padding: 10px 12px; border-right: 1px solid var(--line-soft); font-family: ui-monospace, monospace; font-size: 11px; white-space: pre; overflow-x: auto; }
.diff .diff-side:last-child { border-right: none; }
.diff .diff-h { display: flex; justify-content: space-between; padding: 6px 12px; background: var(--bg-alt); border-bottom: 1px solid var(--line-soft); font-size: 11px; }
.line-rem { background: repeating-linear-gradient(135deg, #eee, #eee 2px, #fff 2px, #fff 6px); text-decoration: line-through; }
.line-add { background: #000; color: #fff; }

/* === TIMELINE === */
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); padding-left: 16px; }
.timeline li { position: relative; padding: 4px 0 14px; }
.timeline li::before {
  content: ""; position: absolute; left: -22px; top: 8px;
  width: 10px; height: 10px; border: 2px solid var(--line); background: #fff; border-radius: 50%;
}
.timeline li.done::before { background: #000; }
.timeline li.running::before { background: #fff; border-style: dashed; }
.timeline li .when { color: var(--muted); font-size: 11px; }

/* === STAT === */
.stat { border: 1px solid var(--line); padding: 12px 14px; background: #fff; }
.stat .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.stat .value { font-size: 26px; font-weight: 700; line-height: 1.1; margin-top: 2px; }
.stat .delta { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* === MISC === */
.divider { height: 1px; background: var(--line-soft); margin: 18px 0; border: 0; }
.spacer-sm { height: 8px; }
.spacer { height: 16px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.right { text-align: right; }

.note {
  border-left: 3px solid var(--line);
  padding: 6px 12px;
  background: var(--bg-alt);
  font-size: 12px;
  color: var(--ink-2);
}

.callout {
  border: 1px dashed var(--line-dashed);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--ink-2);
  background: var(--bg-stripe);
}

/* === WIREFRAME WATERMARK === */
.wf-mark {
  position: fixed; right: 10px; bottom: 8px;
  font-size: 10px; color: var(--faint);
  letter-spacing: 0.1em; text-transform: uppercase;
  border: 1px dashed var(--line-dashed); padding: 2px 6px;
  background: rgba(255,255,255,0.85);
  pointer-events: none;
}

/* === Modal-ish panel === */
.modal {
  border: 2px solid var(--line);
  background: #fff;
  padding: 18px 20px;
  max-width: 560px;
  box-shadow: 6px 6px 0 #000;
}
.modal .modal-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.modal .close-x {
  cursor: pointer; color: var(--muted); text-decoration: none;
  font-size: 18px; line-height: 1; padding: 4px;
}
.modal .close-x:hover { color: var(--ink); }

/* Overlay backdrop for dialog-style modals */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  display: none;
  align-items: flex-start; justify-content: center;
  z-index: 100;
  padding: 60px 16px 16px;
  overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal-overlay .modal { width: 100%; }
.modal-step { display: none; }
.modal-step.active { display: block; }

/* Big "choice" buttons in modal */
.choice-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  font-family: inherit; font-size: 13px;
  margin-bottom: 8px;
}
.choice-btn:hover { background: var(--bg-alt); border-color: var(--ink); }
.choice-btn strong { display: block; font-size: 14px; margin-bottom: 2px; }
.choice-btn .muted { font-size: 11px; }

/* CSV drop zone in upload step */
.csv-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px;
  border: 2px dashed var(--line-dashed);
  background: var(--bg-alt);
  padding: 28px 16px;
  cursor: pointer;
  text-align: center;
  font-size: 13px;
  color: var(--ink);
}
.csv-drop:hover, .csv-drop.dragging { border-color: var(--ink); background: #fff; }
.csv-drop .muted { font-size: 11px; }
.csv-file-info {
  border: 1px solid var(--line);
  padding: 10px 14px;
  background: #fff;
}

/* Disabled primary button (used until a CSV is chosen) */
.btn.disabled, .btn[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}

/* Sparkline placeholder */
.spark {
  height: 28px; border: 1px dashed var(--line-dashed);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--faint); letter-spacing: 0.1em;
}

/* ============================================================ */
/* Generic helper: force all child .card elements inside a grid */
/* to stretch to equal height across every row of the grid.     */
/* ============================================================ */
.cards-stretch {
  align-items: stretch;
  grid-auto-rows: 1fr;
}
.cards-stretch > .card {
  height: 100%;
  min-height: 100%;
  align-self: stretch;
  margin: 0;          /* cancel the global `.card + .card { margin-top: 12px }` */
}
.cards-stretch > .card + .card { margin-top: 0; }

/* ============================================================ */
/* Catalogue card — used by the Transform Step picker.          */
/* Built from scratch: only block children, no inline <code>    */
/* baseline shifts, no <a> default-style quirks.                */
/* ============================================================ */
.cat-card {
  display: block;
  padding: 14px 16px;
  border: 1px dashed var(--line-dashed);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  min-height: 100%;
  box-sizing: border-box;
}
.cat-card:hover { background: var(--bg-alt); border-color: var(--ink); }
.cat-card .cat-name {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.4;
  margin: 0;
}
.cat-card .cat-desc {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  margin: 4px 0 0;
}

/* ============================================================ */
/* Pipeline-kind picker (used in step 1 of new-pipeline wizard) */
/* ============================================================ */

.kind-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
  align-items: stretch;
}
.kind-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  cursor: pointer;
  padding: 14px 16px;
  background: #fff;
  border: 2px solid var(--line);
  height: 100%; /* fill the stretched grid cell */
}
.kind-card.selected { border-color: #000; }
.kind-card .head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.kind-card .head strong { font-weight: 700; }
.kind-card .desc {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

/* ============================================================ */
/* v2 features toggle + element styling                         */
/* ============================================================ */

/* Hide v2 elements by default; reveal when body has .show-v2 */
.v2 { display: none !important; }
body.show-v2 .v2 { display: revert !important; }

/* Light-green tint for v2 elements when visible.
   Subtle enough to read against the b/w wireframe, distinctive enough
   to flag "this isn't shipping in R1". */
body.show-v2 .v2 {
  background: #eaf7ea !important;
  border-color: #6fbf6f !important;
  position: relative;
}
/* Small "v2" badge in the top-right corner of any v2 block */
body.show-v2 .v2::before {
  content: "v2";
  position: absolute;
  top: 6px; right: 8px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #2e7d32;
  background: #fff;
  border: 1px solid #6fbf6f;
  padding: 1px 5px;
  border-radius: 3px;
  pointer-events: none;
}
/* Allow inline v2 (e.g. a <span class="v2">) without overlay artefacts.
   Buttons are excluded — they keep their own padding for vertical centering. */
body.show-v2 span.v2,
body.show-v2 a.v2:not(.btn),
body.show-v2 strong.v2,
body.show-v2 em.v2,
body.show-v2 li.v2 {
  background: #eaf7ea !important;
  padding: 0 4px;
  border-radius: 2px;
}
body.show-v2 span.v2::before,
body.show-v2 a.v2:not(.btn)::before,
body.show-v2 strong.v2::before,
body.show-v2 em.v2::before,
body.show-v2 li.v2::before { content: none; }

/* Tabs marked v2: keep the tab strip's own padding so the v2 tab doesn't
   visually shrink next to its non-v2 siblings. Just tint the background. */
body.show-v2 .tabs a.v2 {
  padding: 6px 14px;
  border-radius: 0;
}

/* Buttons marked v2: keep their own padding, just tint background + border.
   Also suppress the corner "v2" badge — a tinted button is signal enough,
   and the absolute-positioned badge would overlap the button's text. */
body.show-v2 .btn.v2 {
  background: #eaf7ea !important;
  border-color: #6fbf6f !important;
  color: var(--ink) !important;
}
body.show-v2 .btn.v2::before { content: none !important; }

/* A v2 wrapper inside a <dl> (used to hide a single key/value row).
   The wrapper itself uses display: contents so the dt/dd flow into the
   parent .kv grid columns. Visual tint is applied to the children, and
   the corner ::before badge is suppressed (no room in a dl row). */
body.show-v2 dl > div.v2 {
  display: contents !important;
  background: none !important;
  border: 0 !important;
}
body.show-v2 dl > div.v2::before { content: none !important; }
body.show-v2 dl > div.v2 > dt,
body.show-v2 dl > div.v2 > dd {
  background: #eaf7ea;
}

/* Bottom-left fixed toggle */
.v2-toggle {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 2px 2px 0 #000;
  font-size: 11px;
  letter-spacing: 0.04em;
  cursor: pointer;
  user-select: none;
}
.v2-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.v2-toggle .track {
  position: relative;
  display: inline-block;
  width: 28px; height: 14px;
  border-radius: 999px;
  background: #ddd;
  border: 1px solid var(--line);
  transition: background 120ms ease;
}
.v2-toggle .track::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  width: 10px; height: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 50%;
  transition: left 120ms ease;
}
.v2-toggle input:checked + .track { background: #6fbf6f; border-color: #2e7d32; }
.v2-toggle input:checked + .track::after { left: 14px; border-color: #2e7d32; }
.v2-toggle input:focus-visible + .track { outline: 1px dashed var(--ink); outline-offset: 2px; }
.v2-toggle .label { color: var(--ink); font-weight: 600; }
