/*
 * The one palette, shared by every screen.
 *
 * Before this file each page carried its own :root — four different palettes
 * across ten pages, with token names that disagreed (--ink vs --text, --line
 * meaning a border in one file and a stroke colour in another). Six screens
 * under one nav cannot look like one product that way, so the light
 * blue-grey set below (the one seven of the ten pages already used) is now
 * the only one. A page that needs a colour adds a token here rather than a
 * literal of its own.
 */

:root {
  /* Surfaces */
  --bg: #f4f6fb;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-strong: rgba(255, 255, 255, 0.98);
  --panel-sunken: #f3f6fc;

  /* Text */
  --ink: #162033;
  --ink-soft: #1d2940;
  --body: #47556f;
  --muted: #5f6b82;
  --faint: #72809a;

  /* Lines and depth */
  --line: rgba(107, 123, 156, 0.22);
  --line-soft: rgba(107, 123, 156, 0.10);
  --shadow: 0 18px 40px rgba(20, 32, 61, 0.08);
  --shadow-sm: 0 6px 16px rgba(20, 32, 61, 0.06);

  /* Brand */
  --brand: #1f4fd6;
  --brand-ink: #2252b3;
  --brand-wash: rgba(31, 79, 214, 0.08);

  /* Schema layers — the three mapping kinds, same hues the hierarchy
   * viewer already used so its diagrams need no recolouring. */
  --meta: #bb5b12;
  --meta-wash: rgba(249, 115, 22, 0.10);
  --entity: #2252b3;
  --entity-wash: rgba(37, 99, 235, 0.10);
  --relation: #6d4a99;
  --relation-wash: rgba(123, 92, 167, 0.12);

  /* Diagram strokes (schema hierarchy viewer) */
  --meta-stroke: #4f6b8a;
  --entity-stroke: #2f7f72;
  --relation-stroke: #7b5ca7;
  --icon-bg: #ffffff;
  --icon-stroke: #5a7192;

  /* State — job status, health, log levels */
  --ok: #157f5f;
  --ok-wash: rgba(16, 185, 129, 0.12);
  --warn: #9a6400;
  --warn-wash: rgba(245, 158, 11, 0.14);
  --err: #b91c1c;
  --err-wash: rgba(220, 38, 38, 0.10);
  --idle: #52607b;
  --idle-wash: rgba(107, 123, 156, 0.14);

  /* Type — the stack the existing pages already declare, so adopting this file
   * does not change a single glyph on them. */
  --font-body: "SUIT Variable", "Pretendard Variable", "Noto Sans KR", system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* The shell's own height, so a page can size its own scroll area. */
  --shell-height: 52px;
}

* { box-sizing: border-box; }

/* No `font-size` here on purpose. None of the existing pages set one on body,
 * so declaring a baseline would shrink every element that inherits its size —
 * a change nobody asked for, on pages that only wanted the palette. A screen
 * that wants a baseline sets its own. */
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

/* ---------- The shell: top bar, nav, dataset picker ---------- */

.shell {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: var(--panel-strong);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

/* Row 1: brand + nav. Row 2: the dataset picker, on its own line so it reads
   as "which data this screen is about" rather than one more nav item. */
.shell-row {
  display: flex;
  align-items: center;
  gap: 18px;
  height: var(--shell-height);
  padding: 0 18px;
}
.shell-row + .shell-row { border-top: 1px solid var(--line-soft); }

.shell-brand {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
}

.shell-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.shell-nav::-webkit-scrollbar { display: none; }

.shell-nav a {
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.shell-nav a:hover { background: var(--brand-wash); color: var(--brand-ink); }
.shell-nav a[aria-current="page"] {
  background: var(--brand-wash);
  color: var(--brand-ink);
  font-weight: 800;
}

/* A screen that is planned but not built: shown so the nav reads as the whole
   product, not clickable so it cannot hand out a 404. */
.shell-nav-pending {
  padding: 6px 11px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--faint);
  opacity: 0.55;
  cursor: default;
  white-space: nowrap;
}

.shell-dataset {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}
.shell-dataset label {
  font-size: 11px;
  font-weight: 700;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.shell-dataset select {
  padding: 5px 9px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--ink);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  max-width: 320px;
}
.shell-dataset select:disabled { color: var(--faint); }

/* ---------- Shared primitives ---------- */

.badge {
  font-size: 10.5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 700;
  display: inline-block;
}
.badge-meta { background: var(--meta-wash); color: var(--meta); }
.badge-entity { background: var(--entity-wash); color: var(--entity); }
.badge-relation { background: var(--relation-wash); color: var(--relation); }
.badge-empty { background: var(--line-soft); color: #6a7690; }
.badge-skipped { background: var(--idle-wash); color: var(--idle); border: 1px dashed rgba(107, 123, 156, 0.3); }
.badge-failed { background: var(--err-wash); color: var(--err); }
.badge-ok { background: var(--ok-wash); color: var(--ok); }
.badge-warn { background: var(--warn-wash); color: var(--warn); }

.empty-state {
  padding: 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  color: #51607d;
  font-size: 12px;
  border: 1px dashed rgba(102, 119, 154, 0.25);
}

/* ---------- Markdown, as the chunker emits it ---------- */

.md-body { font-size: 12px; color: var(--body); line-height: 1.7; word-break: break-word; }
.md-h { font-weight: 800; color: #20304d; margin: 10px 0 4px; line-height: 1.45; }
.md-body > .md-h:first-child { margin-top: 0; }
.md-h1 { font-size: 15px; }
.md-h2 { font-size: 14.5px; }
.md-h3 { font-size: 14px; }
.md-h4 { font-size: 13.5px; }
.md-h5 { font-size: 12.5px; font-weight: 700; color: #33405d; }
.md-h6 { font-size: 12px; font-weight: 700; color: var(--body); }
.md-p { margin: 4px 0; }
.md-indent { padding-left: 14px; }
.md-table-wrap { overflow-x: auto; margin: 8px 0; }
/* min-width, not width: inside the scrolling wrapper a wide 지급기준표 must be
 * allowed to exceed the column rather than be squeezed into it. */
.md-table { border-collapse: collapse; font-size: 11.5px; min-width: 100%; }
.md-table td { border: 1px solid var(--line); padding: 4px 7px; vertical-align: top; }
.md-body code { background: rgba(107, 123, 156, 0.12); padding: 1px 4px; border-radius: 4px; font-size: 11px; }

/* ---------- Detail panels ---------- */

.detail-eyebrow {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 800;
  color: #6a7690;
  margin-bottom: 4px;
}
.detail-title { font-size: 14px; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 8px; color: var(--ink-soft); }
.detail-text { font-size: 12px; color: var(--body); margin-bottom: 10px; }
.detail-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.detail-chip {
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--panel-sunken);
  border: 1px solid rgba(107, 123, 156, 0.14);
  font-size: 11px;
  color: #44516c;
}
.detail-kv { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 8px; }
.detail-kv th,
.detail-kv td { padding: 6px 8px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
/* width:1% + nowrap shrinks the label column to its text, so the value gets the
   rest. A fixed or percentage width misbehaves at both extremes here: the table
   renders full-page under Relation and half-page inside the Meta/Entity grid. */
.detail-kv th { width: 1%; color: var(--idle); font-weight: 700; white-space: nowrap; }
.detail-kv tr:last-child th,
.detail-kv tr:last-child td { border-bottom: none; }
.detail-sub-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--faint);
  margin: 6px 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
