/* IFC Compliance Workbench — dense, professional engineering-tool UI.
 * Vanilla CSS, no build step. Dark-mode-safe. */

* { box-sizing: border-box; }

:root {
  --font-sans: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --bg: #e9ebef;
  --canvas: #dfe2e8;
  --card: #ffffff;
  --ink: #10141c;
  --muted: #555f6e;
  --line: #dfe2e8;
  --line-strong: #b7bec9;
  --accent: #1957c2;
  --accent-light: #3e7bdb;
  --accent-dark: #0e3a85;
  --accent-soft: color-mix(in srgb, var(--accent) 10%, transparent);
  --ok: #157f3c;
  --bad: #c01c1c;
  --warn: #ab5b06;
  --na: #64748b;
  --chip: #eef1f6;
  --shadow: 0 1px 2px rgba(16, 24, 40, .07);
  --shadow-md: 0 3px 10px rgba(16, 24, 40, .1);
  --radius: 7px;
  --radius-sm: 5px;
  --topbar-h: 58px;
  --content-max: 92rem;
  --gutter: max(1.5rem, calc((100vw - var(--content-max)) / 2));
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --canvas: #101318;
    --card: #1a1e25;
    --ink: #e4e8ef;
    --muted: #94a0af;
    --line: #2b3138;
    --line-strong: #3a414b;
    --accent: #6fa1fa;
    --accent-light: #93bcff;
    --accent-dark: #3560c4;
    --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
    --ok: #4ade80;
    --bad: #f87171;
    --warn: #fbbf24;
    --na: #94a3b8;
    --chip: #232830;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-md: 0 2px 10px rgba(0, 0, 0, .35);
  }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

main, footer { max-width: none; padding: 0 var(--gutter); }

h2 { font-size: 1rem; margin: 0 0 .4rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
h3 { font-size: .82rem; margin: .85rem 0 .35rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.hint { color: var(--muted); font-size: .82rem; margin: 0 0 .8rem; }
#check-results, #inject-results { margin-top: 1.1rem; }
.eyebrow { display: block; color: var(--accent); font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; margin-bottom: .2rem; }
.hidden { display: none !important; }

/* --- topbar ---------------------------------------------------------------- */
#topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0 var(--gutter);
  background: var(--card);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 var(--line), 0 2px 6px rgba(16, 24, 40, .04);
}
.brand-mini { display: flex; align-items: center; gap: .65rem; flex: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px; flex: none;
  box-shadow: 0 1px 1px rgba(16, 24, 40, .06), 0 4px 10px color-mix(in srgb, var(--accent) 30%, transparent);
}
.brand-text { display: flex; flex-direction: column; gap: 0; line-height: 1.15; }
.brand-title { font-size: .92rem; font-weight: 800; letter-spacing: -.015em; white-space: nowrap; color: var(--ink); }
.brand-subtitle { font-size: .68rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .85rem; flex: none; }

/* --- buttons ----------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: .42rem .8rem;
  font-size: .82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .1s, border-color .1s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, black); }
.btn.small { font-size: .75rem; padding: .28rem .6rem; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--chip); border-color: transparent; }
.btn.icon-btn { padding: .28rem .4rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.is-loading { cursor: wait; }
.button-spinner {
  width: .8rem; height: .8rem; border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff; border-radius: 50%; animation: spin .75s linear infinite;
}
.link-btn { border: 0; padding: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }

/* --- user chip ---------------------------------------------------------------- */
.user-bar { display: flex; align-items: center; gap: .55rem; font-size: .8rem; padding-left: .85rem; border-left: 1px solid var(--line-strong); }
.user-avatar { display: inline-flex; width: 1.55rem; height: 1.55rem; align-items: center; justify-content: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: .75rem; }
#user-name { font-weight: 600; }

/* --- workflow switch (topbar segmented control) ------------------------------- */
/* .mode-choice (the per-panel manual/batch switch) shares this same visual
   language but is a distinct class so it never matches app.js's global
   .workflow-choice click handler, which is wired to the top-level
   check/inject switch only. */
.workflow-switch { display: inline-flex; gap: .15rem; padding: .2rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg); }
.workflow-choice, .mode-choice {
  display: inline-flex; align-items: center; gap: .5rem;
  border: 0; border-radius: calc(var(--radius-sm) - 1px); background: transparent; color: var(--muted);
  padding: .4rem .9rem .4rem .6rem; font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background-color .12s, color .12s;
}
.workflow-choice:hover, .mode-choice:hover { color: var(--ink); }
.workflow-choice:disabled, .mode-choice:disabled { opacity: .45; cursor: not-allowed; }
.workflow-choice:disabled:hover, .mode-choice:disabled:hover { color: var(--muted); }
.workflow-choice.active, .mode-choice.active { background: var(--card); color: var(--ink); font-weight: 700; box-shadow: var(--shadow); }
.choice-icon {
  display: inline-flex; width: 1.25rem; height: 1.25rem; align-items: center; justify-content: center;
  border-radius: 4px; border: 1px solid var(--line-strong);
  color: var(--muted); background: var(--card); flex: none;
}
.choice-icon svg { width: 62%; height: 62%; }
.workflow-choice.active .choice-icon {
  color: var(--accent); background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line-strong));
}
.workflow-choice.active .choice-icon.warn {
  color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent);
  border-color: color-mix(in srgb, var(--warn) 45%, var(--line-strong));
}

/* --- cards -------------------------------------------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
  margin: .9rem 0;
}
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding-bottom: .6rem; margin-bottom: .6rem; border-bottom: 1px solid var(--line); }
.section-head h2 { margin: 0; font-size: .98rem; }
.history-hint, .format-chip { color: var(--muted); background: var(--chip); border-radius: 999px; padding: .22rem .55rem; font-size: .72rem; white-space: nowrap; }
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.35rem; height: 1.35rem; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: .74rem; font-weight: 700; flex: none;
}
.tag {
  font-size: .64rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--accent); background: var(--accent-soft);
  border-radius: 999px; padding: .12rem .5rem;
}

/* --- rule-bubble: column-grid marker notation ------------------------------------
 * Rule ids (A1, A2, S1, S10...) already read like the letter/number grid-bubble
 * labels on a structural drawing's column grid. Give them that actual mark —
 * a thin ring, monospace, colour tracking the verdict where one applies —
 * everywhere a rule id appears, instead of plain bold text. */
.rule-bubble {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.9rem; height: 1.9rem; padding: 0 .3rem; flex: none;
  border-radius: 50%; border: 1.5px solid var(--line-strong);
  background: var(--card); color: var(--ink);
  font-family: var(--font-mono); font-weight: 600; font-size: .72rem;
  letter-spacing: -.02em; line-height: 1;
}
.rule-bubble.ok   { color: var(--ok);   border-color: currentColor; }
.rule-bubble.bad  { color: var(--bad);  border-color: currentColor; }
.rule-bubble.warn { color: var(--warn); border-color: currentColor; }
.rule-bubble.na, .rule-bubble.wait { color: var(--na); border-color: currentColor; }

main { padding-top: .9rem; padding-bottom: 1.4rem; }

/* --- auth ----------------------------------------------------------------------- */
.auth-card { max-width: 26rem; margin: 3rem auto; }
.auth-form { display: grid; gap: .7rem; }
.auth-form label { display: grid; gap: .22rem; font-size: .82rem; font-weight: 600; }
.auth-form input { padding: .5rem .6rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--card); color: var(--ink); font: inherit; }
.auth-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* --- drawer: recent activity --------------------------------------------------- */
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 29;
  background: rgba(10, 14, 20, .35);
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 30;
  width: min(22rem, 92vw);
  background: var(--card);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 24px rgba(16, 24, 40, .12);
  transform: translateX(100%);
  transition: transform .18s ease;
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: .85rem 1rem; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: .9rem; }
.drawer-body { padding: .9rem 1rem; overflow-y: auto; }
.history-list { display: grid; gap: .4rem; color: var(--muted); }
.history-item { display: flex; flex-direction: column; gap: .15rem; padding: .55rem .65rem; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: .8rem; background: var(--bg); }
.history-item b { color: var(--ink); }
.history-actions { display: flex; gap: .5rem; margin-top: .2rem; }
.history-list:empty::after { content: "No completed jobs yet."; color: var(--muted); }

/* --- dropzone / file strip ------------------------------------------------------ */
.dropzone {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  text-align: center;
  color: var(--muted);
  transition: border-color .12s, background-color .12s;
}
.dropzone:hover, .dropzone:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone p { margin: .35rem 0; }
.dz-icon { width: 34px; height: 34px; opacity: .6; }
.picked { font-weight: 600; color: var(--ok); margin-top: .4rem !important; }

/* Once a file is picked, collapse the dropzone to a compact strip. */
.dropzone.collapsed {
  padding: .55rem .8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .7rem;
  border-style: solid;
}
.dropzone.collapsed .dz-icon,
.dropzone.collapsed p:not(.picked),
.dropzone.collapsed label.btn { display: none; }
.dropzone.collapsed .picked { margin: 0 !important; }
.picked-change { display: none; }
.dropzone.collapsed .picked-change { display: inline-flex; }

/* --- feedback -------------------------------------------------------------------- */
.error {
  color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, transparent);
  border-radius: var(--radius-sm); padding: .45rem .7rem; font-size: .82rem;
}
.progress { color: var(--muted); display: flex; align-items: center; gap: .5rem; font-size: .82rem; }
.spinner {
  flex: none; width: .95rem; height: .95rem; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.4s; }
  .btn, .dropzone, .drawer { transition: none; }
}
.file-meta { color: var(--muted); font-size: .82rem; }
.dl-row { display: flex; gap: .55rem; flex-wrap: wrap; margin-top: .85rem; }

/* --- rule tables ------------------------------------------------------------------- */
.tables { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 60rem) { .tables { grid-template-columns: 1fr; } }
/* The resizable split pane can make #panel-pane much narrower than the
   viewport, independent of window width, so the two-column layout also
   needs to respond to the pane's own width, not just the viewport's. */
#panel-pane { container-type: inline-size; }
@container (max-width: 34rem) { .tables { grid-template-columns: 1fr; } }

table { border-collapse: collapse; width: 100%; font-size: .8rem; }
.tables table { table-layout: fixed; }
th, td { text-align: left; padding: .4rem; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: break-word; }
th { color: var(--muted); font-weight: 600; font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; }
.tables table th:nth-child(1), .tables table td:nth-child(1) { width: 1.6rem; padding-right: 0; }
.tables table th:nth-child(2), .tables table td:nth-child(2) { width: 3rem; white-space: nowrap; }
/* Candidate-count and applicability-badge columns only exist on the
   injection table (buildRuleTable omits them for the check-compliance
   catalogue), so their width is scoped to that table only — otherwise
   the check table's description column would lose that space for nothing. */
.tables table.with-applicability th:nth-child(4), .tables table.with-applicability td:nth-child(4) { width: 2.7rem; white-space: nowrap; }
.tables table.with-applicability th:nth-child(5), .tables table.with-applicability td:nth-child(5) { width: 4.6rem; }
.tables table.with-applicability td:nth-child(5) .badge { white-space: normal; text-align: center; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.rule-id { white-space: nowrap; padding-left: .2rem; }
.clause { display: block; color: var(--muted); font-size: .73rem; }
tr.na td { opacity: .55; }
table tr:not(:first-child):nth-child(even) td { background: color-mix(in srgb, var(--chip) 55%, transparent); }
tbody tr:hover, table tr:hover { background: color-mix(in srgb, var(--accent) 6%, transparent) !important; }

/* --- badges -------------------------------------------------------------------------- */
.badge {
  display: inline-block; font-size: .68rem; font-weight: 700;
  border-radius: 999px; padding: .1rem .55rem;
  border: 1px solid currentColor; white-space: nowrap;
}
.badge.ok    { color: var(--ok); }
.badge.bad   { color: var(--bad); }
.badge.warn  { color: var(--warn); }
.badge.na    { color: var(--na); }
.badge.wait  { color: var(--muted); }

details summary { cursor: pointer; color: var(--accent); font-size: .8rem; }
details pre {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: .55rem; font-size: .74rem; overflow-x: auto; white-space: pre-wrap;
}
.source-rule { margin-top: .3rem; }
.source-rule summary { font-size: .72rem; font-weight: 600; }
.source-rule pre { margin: .3rem 0 0; max-height: 13rem; line-height: 1.45; }
.result-source-rule { margin: .6rem 0; }

/* --- injection result cards ------------------------------------------------------ */
.mut-card {
  border: 1px solid var(--line);
  border-left: 3px solid var(--bad);
  border-radius: var(--radius-sm);
  padding: .7rem .9rem;
  margin: .6rem 0;
  background: var(--card);
}
.mut-card.mutation-location { cursor: pointer; }
.mut-card.mutation-location:hover,
.mut-card.mutation-location:focus-visible {
  border-color: var(--bad);
  background: color-mix(in srgb, var(--bad) 6%, var(--card));
  outline: none;
}
.mut-head { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.mut-type {
  font-family: var(--font-mono);
  font-size: .76rem; font-weight: 600; color: var(--muted);
}
.mut-attr { font-size: .76rem; color: var(--muted); }
.mut-desc { margin: .4rem 0 .3rem; font-size: .85rem; }
.mut-meta { display: flex; gap: .35rem; flex-wrap: wrap; }
.chip.mono {
  font-family: var(--font-mono);
  font-size: .7rem; color: var(--muted);
}
.chg {
  font-size: .8rem; background: var(--chip);
  border-radius: var(--radius-sm); padding: .1rem .55rem; white-space: nowrap;
}
.chg s { color: var(--muted); }
.chg b { color: var(--bad); }
.chg-arrow { margin: 0 .3rem; color: var(--muted); }
.chg-del {
  color: var(--bad); font-weight: 700;
  background: color-mix(in srgb, var(--bad) 10%, transparent);
}
.ver-checks { margin-top: .7rem; }
.ver-checks ul {
  list-style: none; margin: .45rem 0 0; padding: 0;
  display: flex; flex-direction: column; gap: .35rem;
}
.ver-checks li {
  display: flex; align-items: baseline; gap: .55rem;
  font-size: .8rem; flex-wrap: wrap;
}
.vc-name {
  font-family: var(--font-mono);
  font-size: .76rem; font-weight: 600;
}
.vc-msg { color: var(--muted); }

/* --- batch test-case generation --------------------------------------------------- */
.mode-switch { margin: .9rem 0 1.1rem; }
.batch-config { display: grid; gap: .7rem; max-width: 26rem; }
.batch-config label { display: grid; gap: .3rem; font-size: .82rem; font-weight: 600; }
.batch-config input[type="number"] {
  width: 6rem; padding: .5rem .6rem; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--card); color: var(--ink); font: inherit;
}
.batch-config input[type="number"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.batch-config .hint { margin: 0; }
#batch-progress { margin-top: 1rem; }
#batch-progress-summary { margin-bottom: .7rem; }
.batch-case {
  border: 1px solid var(--line);
  border-left: 3px solid var(--na);
  border-radius: var(--radius-sm);
  padding: .65rem .85rem;
  margin: .55rem 0;
  background: var(--card);
}
.batch-case.done { border-left-color: var(--ok); }
.batch-case.failed { border-left-color: var(--bad); }
.batch-case.running { border-left-color: var(--warn); }
.batch-case-head { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.batch-case-msg { color: var(--muted); font-size: .82rem; }
.batch-case-body { margin-top: .55rem; }

/* --- summary: banner + stat tiles ------------------------------------------------ */
.banner {
  display: flex; gap: .6rem; align-items: flex-start;
  border-radius: var(--radius-sm); padding: .65rem .85rem; margin-bottom: .85rem;
  border: 1px solid var(--line); font-size: .86rem;
}
.banner .b-icon {
  flex: none; width: 1.3rem; height: 1.3rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: .78rem; margin-top: .05rem;
}
.banner.ok   { background: color-mix(in srgb, var(--ok) 8%, var(--card)); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.banner.ok .b-icon { background: var(--ok); }
.banner.bad  { background: color-mix(in srgb, var(--bad) 8%, var(--card)); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.banner.bad .b-icon { background: var(--bad); }
.banner.warn { background: color-mix(in srgb, var(--warn) 10%, var(--card)); border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); }
.banner.warn .b-icon { background: var(--warn); }

.tiles {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: .6rem; margin-bottom: .95rem;
}
.tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .55rem .75rem .65rem;
}
.tile-label {
  display: flex; align-items: center; gap: .35rem;
  font-size: .72rem; font-weight: 600; color: var(--muted);
}
.tile-value {
  display: block; font-size: 1.55rem; font-weight: 700; line-height: 1.15;
  letter-spacing: -.01em; margin-top: .1rem; font-variant-numeric: tabular-nums;
}
.dot { width: .5rem; height: .5rem; border-radius: 50%; flex: none; }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--bad); }
.dot.warn { background: var(--warn); }
.dot.na { background: var(--na); }

/* --- per-rule result cards ----------------------------------------------------------- */
.rule-result {
  border: 1px solid var(--line);
  border-left: 3px solid var(--na);
  border-radius: var(--radius-sm);
  padding: .75rem .9rem;
  margin: .7rem 0;
  background: var(--card);
}
.rule-result.pass           { border-left-color: var(--ok); }
.rule-result.fail,
.rule-result.violation,
.rule-result.error          { border-left-color: var(--bad); }
.rule-result.unknown        { border-left-color: var(--warn); }
.rule-result.not_applicable { border-left-color: var(--na); }

.rr-head { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.rr-title { font-weight: 700; font-size: .9rem; }
.rr-count {
  font-size: .74rem; font-weight: 700; color: var(--bad);
  background: color-mix(in srgb, var(--bad) 12%, transparent);
  border-radius: 999px; padding: .04rem .55rem;
}
.rr-time { margin-left: auto; color: var(--muted); font-size: .76rem; font-variant-numeric: tabular-nums; }
.rr-summary { margin: .35rem 0 .15rem; font-size: .86rem; }
.rr-footer { color: var(--muted); font-size: .74rem; margin-top: .5rem; }

/* --- violation cards ------------------------------------------------------------------ */
.violation {
  border: 1px solid color-mix(in srgb, var(--bad) 35%, var(--line));
  background: color-mix(in srgb, var(--bad) 4%, var(--card));
  border-radius: var(--radius-sm);
  padding: .65rem .85rem;
  margin: .55rem 0;
}
.v-head { display: flex; gap: .55rem; align-items: baseline; }
.v-num {
  flex: none; width: 1.35rem; height: 1.35rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bad); color: #fff; font-size: .72rem; font-weight: 700;
}
.v-title { font-weight: 600; font-size: .88rem; }

.v-explain {
  margin: .5rem 0 .3rem;
  padding: .5rem .7rem;
  border-radius: var(--radius-sm);
  background: var(--chip);
  border-left: 3px solid var(--accent);
}
.v-explain p { margin: .12rem 0; font-size: .84rem; }
.v-plain { font-size: .86rem !important; }
.v-label {
  font-weight: 700; font-size: .68rem; text-transform: uppercase;
  color: var(--accent); letter-spacing: .03em; margin-right: .3rem;
}
.v-note { color: var(--muted); }

.v-meta { margin: .4rem 0 0; }
.v-ref { color: var(--muted); font-size: .72rem; margin-top: .4rem; }

.chip {
  display: inline-block; font-size: .72rem; font-weight: 600;
  background: var(--chip); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: .04rem .45rem; margin: 0 .22rem .22rem 0;
}
.chip.limit { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }

table.v-locations { margin-top: .45rem; font-size: .8rem; table-layout: fixed; }
table.v-locations th { font-size: .66rem; }
table.v-locations th:nth-child(1), table.v-locations td:nth-child(1) { width: 28%; }
table.v-locations th:nth-child(2), table.v-locations td:nth-child(2) { width: 14%; }
table.v-locations th:nth-child(3), table.v-locations td:nth-child(3) { width: 36%; }
table.v-locations th:nth-child(4), table.v-locations td:nth-child(4) { width: 22%; }
.v-el { font-weight: 600; overflow-wrap: break-word; }
.v-guid {
  display: block; font-family: var(--font-mono);
  font-size: .68rem; color: var(--muted); overflow-wrap: break-word;
}
.v-storey { color: var(--muted); overflow-wrap: break-word; }
.v-measured { overflow-wrap: break-word; }
.v-action { text-align: right; }
.show-in-model {
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line));
  border-radius: var(--radius-sm); padding: .28rem .48rem; background: var(--accent-soft);
  color: var(--accent); font: 700 .7rem/1.15 system-ui, sans-serif; cursor: pointer;
  white-space: normal; max-width: 100%;
}
.show-in-model:hover, .show-in-model:focus-visible { background: var(--accent); color: #fff; outline: none; }
.v-measured .kv {
  display: inline-block; max-width: 100%; box-sizing: border-box;
  font-size: .74rem; background: var(--chip);
  border-radius: var(--radius-sm); padding: .06rem .45rem; margin: 0 .22rem .22rem 0;
  font-variant-numeric: tabular-nums;
  white-space: normal; overflow-wrap: anywhere; word-break: break-word;
}
.v-measured .kv b { font-weight: 700; }

.v-unknown { margin-top: .55rem; }
.v-unknown ul { margin: .35rem 0 0; padding-left: 1.1rem; font-size: .8rem; }

.show-more { margin-top: .3rem; }

/* --- workflow cards --------------------------------------------------------------- */
.workflow-card { position: relative; overflow: hidden; }
.workflow-card { display: none; }
.workflow-card.active { display: block; }
.workflow-card::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 3px; background: var(--accent); }
.inject-workflow::before { background: var(--warn); }
.workflow-icon {
  position: absolute; top: 1rem; right: 1rem;
  display: inline-flex; width: 2rem; height: 2rem; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
}
.workflow-icon svg { width: 60%; height: 60%; }
.inject-workflow .workflow-icon { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.workflow-card-head { padding: .2rem 3rem .8rem 0; border-bottom: 1px solid var(--line); margin-bottom: .8rem; }
.workflow-meta { display: flex; align-items: center; gap: .4rem; margin-bottom: .3rem; }
.workflow-step { color: var(--muted); font-size: .66rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.workflow-card-head h2 { margin: 0; font-size: 1.05rem; }
.workflow-purpose { margin: .25rem 0 0; color: var(--muted); font-size: .84rem; }

/* --- workspace split: model preview | workflow panel ------------------------------ */
#workspace-split {
  display: grid;
  grid-template-columns: 1fr 6px 1fr;
  align-items: stretch;
  gap: 0 .75rem;
  min-height: 0;
}
#preview-pane {
  min-width: 0;
  position: sticky;
  top: calc(var(--topbar-h) + .9rem);
  align-self: start;
  height: calc(100vh - var(--topbar-h) - 1.8rem);
  min-height: 24rem;
  display: flex;
  flex-direction: column;
}
#preview-card {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
#preview-card .viewer-shell { flex: 1; min-height: 16rem; }
#panel-pane {
  min-width: 0;
  align-self: start;
  max-height: calc(100vh - var(--topbar-h) - 1.8rem);
  overflow-y: auto;
  padding-right: .1rem;
}
#pane-resizer {
  width: 6px;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  cursor: col-resize;
  background: transparent;
  position: relative;
}
#pane-resizer:hover .pane-grip,
body.pane-dragging #pane-resizer .pane-grip { background: var(--accent); }
.pane-grip {
  width: 3px;
  flex: 1;
  max-height: 5rem;
  border-radius: 3px;
  background: var(--line-strong);
}
.pane-collapse-btn {
  position: absolute;
  left: 50%;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--muted);
  font-size: .8rem;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
#pane-resizer:hover .pane-collapse-btn { display: inline-flex; }
#collapse-left { top: calc(50% - 2.1rem); transform: translateX(-50%); }
#collapse-right { top: calc(50% + .7rem); transform: translateX(-50%); }
.pane-collapse-btn:hover { border-color: var(--accent); color: var(--accent); }
.pane-expand-chip {
  display: none;
  align-items: center;
  gap: .3rem;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: .3rem .7rem;
  font-size: .76rem;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: .6rem;
}
#workspace-split.collapsed-left #expand-left,
#workspace-split.collapsed-right #expand-right { display: inline-flex; }
#workspace-split.collapsed-left #preview-pane,
#workspace-split.collapsed-right #panel-pane { display: none; }
#workspace-split.collapsed-left #pane-resizer,
#workspace-split.collapsed-right #pane-resizer { cursor: default; }

.preview-card { margin: 0; }
.preview-placeholder {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: .84rem;
}
.preview-head-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.viewer-shell { position: relative; height: min(58vw, 32rem); min-height: 18rem; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #1c232c; }
#ifc-viewer { display: block; width: 100%; height: 100%; }
.preview-toolbar { position: absolute; z-index: 3; top: .6rem; left: .6rem; right: .6rem; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; padding: .3rem; border: 1px solid rgba(255,255,255,.16); border-radius: var(--radius-sm); background: rgba(15,20,28,.92); }
.preview-tool { min-height: 1.9rem; border: 0; border-radius: var(--radius-sm); padding: .38rem .58rem; background: transparent; color: #dfe4ea; font: 700 .72rem/1.1 system-ui, sans-serif; cursor: pointer; white-space: nowrap; }
.preview-tool:hover, .preview-tool:focus-visible, .preview-tool.active { background: var(--accent); color: #fff; outline: none; }
.preview-tool:disabled { opacity: .4; cursor: not-allowed; }
.preview-tool-divider { width: 1px; height: 1.4rem; margin: 0 .1rem; background: rgba(255,255,255,.22); }
.preview-tool.flagged { display: inline-flex; align-items: center; gap: .35rem; color: #ffb4b0; }
.preview-tool.flagged:hover:not(:disabled), .preview-tool.flagged:focus-visible:not(:disabled) { background: var(--bad); color: #fff; }
.preview-tool.flagged:disabled { color: #dfe4ea; }
.preview-tool-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.1rem; height: 1.1rem; padding: 0 .3rem; border-radius: 999px;
  background: var(--bad); color: #fff; font-size: .66rem; font-weight: 800;
}
.viewer-loading { position: absolute; inset: 0; display: grid; place-items: center; gap: .6rem; color: #fff; background: rgba(20,26,34,.78); font-weight: 600; font-size: .84rem; }
.viewer-loading::before {
  content: ""; width: 1.3rem; height: 1.3rem;
  border: 2px solid rgba(255,255,255,.28); border-top-color: #fff; border-radius: 50%;
  animation: spin .8s linear infinite;
}
.viewer-selection { margin: .55rem 0 0; padding: .45rem .6rem; border-radius: var(--radius-sm); background: var(--chip); color: var(--muted); font-family: var(--font-mono); font-size: .76rem; }

/* --- responsive: stack below the split breakpoint ---------------------------------- */
@media (max-width: 60rem) {
  #workspace-split {
    display: block;
  }
  #workspace-split.collapsed-left #preview-pane,
  #workspace-split.collapsed-right #panel-pane { display: block; }
  #pane-resizer { display: none; }
  .pane-expand-chip { display: none !important; }
  #preview-pane, #panel-pane { position: static; max-height: none; height: auto; overflow: visible; }
  #preview-card .viewer-shell { flex: none; }
  #preview-pane { margin-bottom: .9rem; }
  #topbar { flex-wrap: wrap; height: auto; padding: .5rem .75rem; gap: .5rem; }
  .brand-subtitle { display: none; }
  .workflow-switch { order: 3; width: 100%; justify-content: stretch; }
  .workflow-choice { flex: 1; justify-content: center; }
  .drawer { width: 100%; }
  #app-footer { flex-direction: column; align-items: flex-start; gap: .5rem; }
}

/* --- footer: compact brand + copyright bar ---------------------------------------- */
#app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: .9rem;
  padding-bottom: .9rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .78rem;
}
.footer-brand { display: flex; align-items: center; gap: .55rem; }
.footer-mark { width: 22px; height: 22px; border-radius: 6px; flex: none; box-shadow: 0 1px 1px rgba(16,24,40,.06), 0 3px 8px color-mix(in srgb, var(--accent) 25%, transparent); }
.footer-brand-title { font-weight: 700; font-size: .82rem; color: var(--ink); letter-spacing: -.01em; }
.footer-bottom { white-space: nowrap; }
