/* ==========================================================================
   xallace UI · design freeze v1.0 (21.11.2026)
   Shared tokens and base components for the apps on xallace.github.io.
   Rules: /design/DESIGN.md · Style guide: /design/ · Check: node design/check.mjs <app>
   Extracted from iso22081-profile-lab (the reference app). Load order in <head>:
     /fonts/xallace-type.css  →  /design/xallace-ui.css  →  the app's own style.css
   Do not edit this file without Walter's OK; bump the version and the changelog in DESIGN.md.
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  color-scheme: dark;

  /* surfaces */
  --bg-app: #090d16;
  --bg-panel: #0f151f;
  --bg-card-solid: #111722;
  --bg-glass: rgba(15, 21, 31, 0.92);
  --bg-hover: rgba(233, 237, 245, 0.06);

  /* text */
  --text-main: #e9edf5;
  --text-muted: #a8b3c5;
  --text-dim: #7f8b9f;
  --on-accent: #111722;

  /* lines */
  --border: rgba(233, 237, 245, 0.19);
  --border-soft: rgba(233, 237, 245, 0.11);

  /* status: fixed, independent of the app accent; always paired with a word */
  --st-ok: #58b691;
  --st-fail: #ff695d;
  --st-warn: #ed864b;
  --st-info: #56a8e4;
  --ok-bg: rgba(88, 182, 145, 0.09);
  --fail-bg: rgba(255, 105, 93, 0.10);
  --warn-bg: rgba(237, 134, 75, 0.10);
  --info-bg: rgba(86, 168, 228, 0.09);

  /* the five frozen accents (one per app, see [data-accent] below) */
  --ac-vermilion: #ff7d61;
  --ac-slate: #7aa3c8;
  --ac-emerald: #58b691;
  --ac-cyan: #56a8e4;
  --ac-ochre: #ed864b;

  /* drawing (canvas / on-screen SVG): read with getComputedStyle, see DESIGN.md §7 */
  --draw-paper: #0a101a;
  --draw-grid: rgba(233, 237, 245, 0.065);
  --draw-ink: #e9edf5;
  --draw-ink-soft: #a8b3c5;
  --draw-dim: #7f8b9f;
  --draw-part-fill: rgba(233, 237, 245, 0.065);

  /* type roles (from /fonts/xallace-type.css) */
  --font-ui: var(--xt-text);
  --font-display: var(--xt-title);
  --font-sub: var(--xt-sub);
  --font-mono: var(--xt-mono);
  --font-small: var(--xt-small);   /* only text ≤ 0.70rem, never in canvas/SVG */

  /* shape */
  --radius-lg: 10px;
  --radius-md: 8px;
  --radius-sm: 6px;
  --gap: 16px;
  --content-max: 1500px;
}

/* accent: set ONE on <html data-accent="…">; vermilion is the default */
:root, [data-accent="vermilion"] { --accent: #ff7d61; --accent-rgb: 255, 125, 97; }
[data-accent="slate"]   { --accent: #7aa3c8; --accent-rgb: 122, 163, 200; }
[data-accent="emerald"] { --accent: #58b691; --accent-rgb: 88, 182, 145; }
[data-accent="cyan"]    { --accent: #56a8e4; --accent-rgb: 86, 168, 228; }
[data-accent="ochre"]   { --accent: #ed864b; --accent-rgb: 237, 134, 75; }
:root, [data-accent] {
  --accent-soft: rgba(var(--accent-rgb), 0.12);
  --accent-line: rgba(var(--accent-rgb), 0.45);
  --border-strong: rgba(var(--accent-rgb), 0.55);
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  min-height: 100%;
  background: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
body { line-height: 1.4; overflow-x: hidden; }
a { color: var(--accent); }
img, canvas, svg { max-width: 100%; }
code, kbd, samp { font-family: var(--font-mono); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: rgba(var(--accent-rgb), 0.35); }
.hidden { display: none !important; }
.app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- 3. Header, tabs, buttons ---------- */
.app-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 18px; background: var(--bg-panel); border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.header-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.header-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.back-chip { text-decoration: none; }
.brand-badge {
  width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); border: 1px solid var(--border-strong); color: var(--accent);
}
.brand-text { min-width: 0; }
.brand-text h1 {
  font-family: var(--font-display); font-size: 1.05rem; font-weight: 400;
  letter-spacing: 0.04em; line-height: 1.15;
}
.brand-text .sub-tag { font-family: var(--font-sub); font-size: 0.8rem; font-weight: 600; color: var(--accent); margin-left: 6px; letter-spacing: 0; }
.source-ref { font-family: var(--font-sub); font-size: 0.72rem; color: var(--text-muted); }

.main-tabs {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  background: var(--bg-hover); padding: 4px; border-radius: var(--radius-lg); border: 1px solid var(--border);
}
.tab-btn {
  appearance: none; border: none; background: transparent; color: var(--text-muted);
  font-family: var(--font-sub); font-size: 0.8rem; font-weight: 600;
  padding: 7px 12px; border-radius: 7px; cursor: pointer; white-space: nowrap;
  transition: background 0.16s ease, color 0.16s ease;
}
.tab-btn:hover { color: var(--text-main); background: var(--bg-hover); }
.tab-btn.active, .tab-btn[aria-selected="true"] { background: var(--accent); color: var(--on-accent); }

.pill-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: var(--radius-md);
  border: 1px solid var(--border); background: var(--bg-card-solid); color: var(--text-main);
  font-family: var(--font-sub); font-size: 0.78rem; font-weight: 600;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.pill-btn:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.pill-btn.accent { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.pill-btn.solid { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.mini-btn, .preset-btn {
  border: 1px solid var(--border); border-radius: 7px;
  background: var(--bg-panel); color: var(--text-main);
  font-family: var(--font-sub); font-size: 0.73rem; font-weight: 600;
  padding: 4px 10px; cursor: pointer;
}
.mini-btn:hover, .preset-btn:hover { border-color: var(--border-strong); }
.mini-btn.active, .preset-btn.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.preset-grid { display: flex; flex-wrap: wrap; gap: 6px; }

.inline-check { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-sub); font-size: 0.75rem; cursor: pointer; line-height: 1.35; }
.inline-check input { accent-color: var(--accent); }

/* ---------- 4. Workspace and layout ---------- */
.workspace { flex: 1; width: 100%; max-width: var(--content-max); margin: 0 auto; padding: 16px 18px 20px; }
.view { display: none; }
.view.active { display: block; }
/* drawing left, controls right; stacks below 1060 px */
.split-layout {
  display: grid; grid-template-columns: minmax(0, 1.38fr) minmax(320px, 1fr);
  gap: var(--gap); align-items: start;
}
.stage-col, .control-col { min-width: 0; }

/* ---------- 5. Cards ---------- */
.plate-card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-card-solid); margin-bottom: 12px; overflow: hidden; }
.plate-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 8px 14px; border-bottom: 1px solid var(--border-soft); background: var(--bg-panel);
}
.plate-fig-label { font-family: var(--font-small); font-size: 0.68rem; letter-spacing: 0.07em; color: var(--text-main); }
.plate-fig-note { font-family: var(--font-small); font-size: 0.7rem; color: var(--text-dim); }
.plate-head-controls { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.plate-canvas { display: block; width: 100%; height: 380px; background: var(--draw-paper); }

.panel-card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-card-solid); padding: 16px 18px; }
.control-section { padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--border-soft); }
.control-section:first-child { padding-top: 0; margin-top: 0; border-top: none; }
.section-label { font-family: var(--font-small); font-size: 0.68rem; letter-spacing: 0.08em; color: var(--text-dim); margin-bottom: 8px; text-transform: uppercase; }

/* ---------- 6. Inputs ---------- */
.slider-item { margin-bottom: 10px; }
.slider-head { display: flex; justify-content: space-between; gap: 8px; font-family: var(--font-sub); font-size: 0.75rem; margin-bottom: 3px; color: var(--text-muted); }
.slider-head strong { font-family: var(--font-mono); color: var(--text-main); font-weight: 600; }
.slider-item input[type="range"] { width: 100%; accent-color: var(--accent); }
.slider-note { font-family: var(--font-small); font-size: 0.7rem; line-height: 1.35; color: var(--text-dim); margin: 2px 0 8px; }
.field { display: flex; flex-direction: column; gap: 4px; font-family: var(--font-sub); font-size: 0.75rem; color: var(--text-muted); }
.field input, .field select {
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-main);
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 8px;
}
.field input:focus, .field select:focus { border-color: var(--accent-line); outline: none; }

/* ---------- 7. Results ---------- */
.verdict-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.verdict-cell {
  min-width: 0; overflow-wrap: break-word;
  border: 1px solid var(--border); border-top: 3px solid var(--text-main);
  border-radius: 9px; padding: 10px 13px; background: var(--bg-card-solid);
}
.verdict-cell.pass { border-top-color: var(--st-ok); background: var(--ok-bg); }
.verdict-cell.fail { border-top-color: var(--st-fail); background: var(--fail-bg); }
.verdict-cell.warn { border-top-color: var(--st-warn); background: var(--warn-bg); }
.verdict-cell.info { border-top-color: var(--st-info); background: var(--info-bg); }
.v-kicker { display: block; font-family: var(--font-small); font-size: 0.68rem; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 3px; }
.v-value { font-family: var(--font-display); font-size: 1.42rem; line-height: 1.08; margin-bottom: 3px; }
.verdict-cell.pass .v-value { color: var(--st-ok); }
.verdict-cell.fail .v-value { color: var(--st-fail); }
.verdict-cell.warn .v-value { color: var(--st-warn); }
.verdict-cell.info .v-value { color: var(--st-info); }
.v-sub { display: block; font-size: 0.74rem; color: var(--text-muted); line-height: 1.3; }

.spec-table { width: 100%; border-collapse: collapse; font-size: 0.76rem; }
.spec-table tr { border-bottom: 1px solid var(--border-soft); }
.spec-table th { text-align: left; padding: 5px 6px 5px 0; font-weight: 400; color: var(--text-muted); }
.spec-table td { text-align: right; padding: 5px 0; font-family: var(--font-mono); font-size: 0.74rem; font-weight: 600; }
.table-scroll { width: 100%; overflow-x: auto; }
.tag-ok { color: var(--st-ok); }
.tag-fail { color: var(--st-fail); }
.tag-warn { color: var(--st-warn); }
.tag-info { color: var(--st-info); }

.chip {
  display: inline-block; font-family: var(--font-small); font-size: 0.68rem; letter-spacing: 0.05em;
  padding: 2px 7px; border-radius: 5px; border: 1px solid var(--border); color: var(--text-muted); white-space: nowrap;
}
.chip.ok   { background: var(--ok-bg);   color: var(--st-ok);   border-color: rgba(88, 182, 145, 0.35); }
.chip.fail { background: var(--fail-bg); color: var(--st-fail); border-color: rgba(255, 105, 93, 0.35); }
.chip.warn { background: var(--warn-bg); color: var(--st-warn); border-color: rgba(237, 134, 75, 0.35); }
.chip.info { background: var(--info-bg); color: var(--st-info); border-color: rgba(86, 168, 228, 0.35); }
.chip.not-verified { border-style: dashed; color: var(--st-warn); border-color: rgba(237, 134, 75, 0.55); }

.issue-stack { display: flex; flex-direction: column; gap: 6px; }
.issue-item { border-radius: 7px; padding: 7px 10px; font-size: 0.76rem; line-height: 1.4; border: 1px solid var(--border-soft); }
.issue-item.error { background: var(--fail-bg); border-color: rgba(255, 105, 93, 0.45); }
.issue-item.warn  { background: var(--warn-bg); border-color: rgba(237, 134, 75, 0.45); }
.issue-item.ok    { background: var(--ok-bg);   border-color: rgba(88, 182, 145, 0.45); }
.issue-item.note  { background: var(--info-bg); border-color: rgba(86, 168, 228, 0.40); }
.issue-item strong { font-family: var(--font-sub); }

/* ---------- 8. Text sheets ---------- */
.plate-heading { font-family: var(--font-display); font-size: 1.25rem; font-weight: 400; margin-bottom: 7px; }
.plate-heading.large { font-size: 1.6rem; }
.plate-subhead { font-family: var(--font-sub); font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.plate-prose { font-size: 0.86rem; line-height: 1.55; color: var(--text-muted); margin-bottom: 12px; }
.plate-prose code, .plate-list code, .spec-table code {
  font-size: 0.85em; background: var(--bg-panel); padding: 1px 5px; border-radius: 4px;
  border: 1px solid var(--border-soft); color: var(--text-main); white-space: nowrap;
}
.plate-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.plate-list li { position: relative; padding-left: 14px; font-size: 0.84rem; line-height: 1.48; }
.plate-list li::before { content: "▸"; position: absolute; left: 0; color: var(--accent); font-family: var(--font-mono); }
.sources-footer-box {
  border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 7px;
  background: var(--bg-panel); padding: 12px 15px; font-size: 0.8rem; line-height: 1.55; color: var(--text-muted);
}

/* ---------- 9. Footer ---------- */
.site-footer {
  margin-top: auto; padding: 10px 20px; border-top: 1px solid var(--border); background: var(--bg-panel);
  display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap;
  font-family: var(--font-sub); font-size: 0.74rem; color: var(--text-muted);
}
.site-footer a { color: var(--accent); font-weight: 600; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer code { font-family: var(--font-mono); }

/* ---------- 10. Breakpoints: 1060 (stack), 640 (phone) ---------- */
@media (max-width: 1060px) {
  .split-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .app-header { padding: 8px 12px; }
  .workspace { padding: 12px 12px 16px; }
  .main-tabs { width: 100%; }
  .tab-btn { flex: 1 1 auto; text-align: center; padding: 7px 8px; }
  .verdict-strip { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .v-value { font-size: 1.2rem; }
  .plate-canvas { height: 300px; }
  .panel-card { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
