/* Data Workbench product UI (P4 visual system). Colours, type, space and motion come from tokens.css only.
   Bright canvas, ink typography, cyan for information, violet only for the primary action and selection. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font-sans); font-size: var(--text-md); line-height: var(--leading-body);
  color: var(--text); background: var(--canvas); text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, h4 { line-height: var(--leading-snug); letter-spacing: -0.015em; margin: 0 0 var(--space-3); }
h1 { font-size: var(--text-2xl); font-weight: var(--weight-strong); letter-spacing: -0.025em; }
h2 { font-size: var(--text-xl); font-weight: var(--weight-strong); }
h3 { font-size: var(--text-lg); font-weight: var(--weight-medium); }
h4 { font-size: var(--text-md); font-weight: var(--weight-medium); }
p { margin: 0 0 var(--space-3); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
  clip-path: inset(50%); white-space: nowrap;
}
.skip-link { position: absolute; left: var(--space-4); top: -100px; z-index: 50; background: var(--surface);
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); }
.skip-link:focus { top: var(--space-3); }

/* --- logo lockup: [crest] Logical Knight. The crest keeps its proportions and is never cropped ------------------ */
.brand { display: inline-flex; align-items: center; gap: var(--space-3); color: var(--text); text-decoration: none; }
.brand:hover { text-decoration: none; }
.lk-lockup { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 40px; }
.lk-crest { display: block; width: 40px; height: 40px; object-fit: contain; flex: none; background: transparent; }
.lk-wordmark { font-weight: var(--weight-strong); font-size: 1.05rem; letter-spacing: -0.01em; white-space: nowrap; }
.product-name { color: var(--text-secondary); font-weight: var(--weight-medium); font-size: var(--text-sm);
  white-space: nowrap; }

/* --- application shell: left navigation, account at the bottom ------------------------------------------------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: var(--space-4);
  padding: var(--space-5) var(--space-4) var(--space-4); background: var(--surface);
  border-right: 1px solid var(--border); overflow-y: auto; z-index: 30;
}
.side-brand { display: flex; flex-direction: column; gap: var(--space-1); padding: 0 var(--space-2); }
.side-org { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2);
  padding: var(--space-3); background: var(--surface-cool); border-radius: var(--radius-md); }
.org-name { font-weight: var(--weight-medium); font-size: var(--text-sm); max-width: 100%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  position: relative; display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm); color: var(--text-secondary); text-decoration: none; font-size: var(--text-sm);
  font-weight: var(--weight-medium); transition: background-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}
.side-nav a:hover { background: var(--surface-cool); color: var(--text); }
.side-nav a[aria-current="page"] { background: var(--selected); color: var(--lk-violet-deep); }
.side-nav a[aria-current="page"]::before { content: ""; position: absolute; left: -16px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--action-primary);
  animation: grow-y var(--duration-base) var(--ease-out); }
.nav-icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--space-2);
  padding-top: var(--space-4); border-top: 1px solid var(--grid-line); }
.side-action { justify-content: flex-start; width: 100%; font-size: var(--text-sm); color: var(--text);
  text-decoration: none; display: flex; align-items: center; min-height: 36px; padding: 0 var(--space-3);
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.side-action:hover { background: var(--surface-cool); text-decoration: none; }
.account { display: flex; flex-direction: column; padding: var(--space-2) var(--space-3) 0; min-width: 0; }
.account-label { font-size: var(--text-xs); color: var(--text-muted); }
#who { font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-logout { align-self: flex-start; }
.main-col { min-width: 0; }
.mobile-bar { display: none; }
.scrim { position: fixed; inset: 0; background: rgba(11, 18, 32, 0.32); z-index: 25; }
.pill {
  display: inline-flex; align-items: center; gap: 0.4em; padding: 0.15em 0.7em; border-radius: var(--radius-pill);
  font-size: var(--text-xs); font-weight: var(--weight-medium); white-space: nowrap; line-height: 1.6;
}
.pill-early { background: var(--lk-cyan-soft); color: var(--lk-cyan-ink); }
.pill-early::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--lk-cyan); }
.pill-paused { background: var(--lk-warning-soft); color: var(--lk-warning); }
.pill-console { background: var(--lk-ink); color: var(--text-on-dark); }

/* --- page ------------------------------------------------------------------------------------------------------ */
main { padding: var(--space-6) var(--gutter) var(--space-8); max-width: calc(var(--content-max) + 2 * var(--gutter)); }
.page-title-row { margin-bottom: var(--space-2); }
.page-head { display: flex; align-items: flex-end; gap: var(--space-4); flex-wrap: wrap;
  margin-bottom: var(--space-5); }
.page-head h1, .page-head h2 { margin: 0; }
.page-head .lead { margin: var(--space-1) 0 0; color: var(--text-secondary); max-width: 62ch; }
.page-head .actions { margin-left: auto; display: flex; gap: var(--space-3); flex-wrap: wrap; }
.eyebrow { font-size: var(--text-xs); font-weight: var(--weight-strong); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--lk-cyan-deep); margin-bottom: var(--space-1); }
.section { margin-top: var(--space-7); }
.section > h2 { display: flex; align-items: baseline; gap: var(--space-3); }
.section > h2 .count { color: var(--text-muted); font-weight: var(--weight-regular); font-size: var(--text-md); }
.section-sub { color: var(--text-secondary); margin-top: calc(-1 * var(--space-2)); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--space-6);
  align-items: start; }
.grid-2.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.stack > * + * { margin-top: var(--space-4); }
.card, .panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5); margin: var(--space-3) 0;
}
.panel { box-shadow: var(--shadow-sm); }
.row { display: flex; gap: var(--space-4); flex-wrap: wrap; }
.row > .card { flex: 1 1 320px; }
.banner {
  display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md); margin-bottom: var(--space-5); border: 1px solid transparent;
}
.banner-paused { background: var(--lk-warning-soft); color: var(--lk-warning); border-color: #EBD4A4; }
.banner-info { background: var(--lk-cyan-soft); color: var(--lk-cyan-ink); }
.banner ul { margin: 0; padding-left: var(--space-5); }

/* --- buttons --------------------------------------------------------------------------------------------------- */
button, .btn {
  font: inherit; font-weight: var(--weight-medium); font-size: var(--text-sm); display: inline-flex;
  align-items: center; justify-content: center; gap: var(--space-2); min-height: 40px; padding: 0 var(--space-4);
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--action-secondary);
  color: var(--action-secondary-text); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color var(--duration-fast) var(--ease-out), transform var(--duration-instant) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out);
}
button:hover, .btn:hover { background: var(--action-secondary-hover); text-decoration: none; }
button:active, .btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary, button.btn-primary {
  background: var(--action-primary); color: var(--action-primary-text); border-color: var(--action-primary);
  box-shadow: 0 6px 16px -8px rgba(109, 40, 217, 0.7);
}
.btn-primary:hover, button.btn-primary:hover { background: var(--action-primary-hover);
  border-color: var(--action-primary-hover); box-shadow: 0 10px 22px -10px rgba(109, 40, 217, 0.75); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--text-secondary); }
.btn-quiet:hover { background: var(--surface-cool); color: var(--text); }
.btn-danger { color: var(--lk-error); border-color: #D9A3A4; }
.btn-danger:hover { background: var(--lk-error-soft); }
.btn-small { min-height: 32px; padding: 0 var(--space-3); font-size: var(--text-xs); }
button:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
button.is-busy { position: relative; color: transparent !important; pointer-events: none; }
button.is-busy::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9); border-right-color: transparent; animation: spin 700ms linear infinite;
}
button:not(.btn-primary).is-busy::after { border-color: var(--lk-cyan-deep); border-right-color: transparent; }

/* --- forms ----------------------------------------------------------------------------------------------------- */
label { display: block; margin: var(--space-2) 0; font-size: var(--text-sm); font-weight: var(--weight-medium); }
.field { margin-bottom: var(--space-4); }
.field > label { margin: 0 0 var(--space-1); }
.hint { display: block; font-size: var(--text-xs); color: var(--text-muted); font-weight: var(--weight-regular);
  margin-top: var(--space-1); }
.field > label .hint { display: inline; margin: 0 0 0 var(--space-2); }
input, select, textarea {
  font: inherit; font-size: var(--text-md); color: var(--text); background: var(--surface); width: 100%;
  min-height: 44px; padding: var(--space-2) var(--space-3); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); transition: border-color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out);
}
textarea { min-height: 96px; resize: vertical; line-height: var(--leading-snug); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.22); }
input[type="checkbox"], input[type="radio"] { width: 18px; min-height: 18px; height: 18px; margin: 0;
  accent-color: var(--action-primary); flex: none; }
.check { display: flex; gap: var(--space-3); align-items: flex-start; font-weight: var(--weight-regular); }
.check input { margin-top: 0.2em; }
.inline { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: flex-end; }
.inline > * { flex: 1 1 160px; }
.inline > div:has(> button:only-child), .inline > div:has(> a.btn:only-child), .inline > div:empty { flex: 0 0 auto; }
.compact input, .compact select { min-height: 34px; padding: var(--space-1) var(--space-2); font-size: var(--text-sm); }
.compact label { margin: 0; font-size: var(--text-xs); color: var(--text-secondary); }
fieldset { border: 0; padding: 0; margin: 0 0 var(--space-4); }
legend { font-weight: var(--weight-medium); font-size: var(--text-sm); margin-bottom: var(--space-2); }
.choice-row { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.choice-row label { margin: 0; display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius-pill);
  cursor: pointer; font-weight: var(--weight-regular); transition: background-color var(--duration-fast) var(--ease-out); }
.choice-row label:has(input:checked) { border-color: var(--action-primary); background: var(--selected); }
.form-error { color: var(--lk-error); font-size: var(--text-sm); margin-top: var(--space-2); min-height: 1.2em; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 var(--space-4); }
.form-grid label { margin-top: 0; }

/* --- tables ---------------------------------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: var(--text-sm); }
th, td { border-bottom: 1px solid var(--grid-line); padding: var(--space-2) var(--space-3); text-align: left;
  vertical-align: top; }
th { background: var(--surface); color: var(--text-secondary); font-weight: var(--weight-medium);
  font-size: var(--text-xs); }
tbody tr { transition: background-color var(--duration-fast) var(--ease-out); }
tbody tr:hover { background: #FAFDFE; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap table { margin: 0; }
.diff-old { color: var(--text-muted); text-decoration: line-through; text-decoration-color: rgba(164, 22, 26, 0.5); }
.diff-new { color: var(--lk-success); font-weight: var(--weight-medium); }

/* --- status ---------------------------------------------------------------------------------------------------- */
.ok { color: var(--lk-success); font-weight: var(--weight-medium); }
.bad { color: var(--lk-error); font-weight: var(--weight-medium); }
.warn { color: var(--lk-warning); font-weight: var(--weight-medium); }
.muted { color: var(--text-muted); font-size: var(--text-sm); }
.chip {
  display: inline-flex; align-items: center; gap: 0.45em; padding: 0.1em 0.65em; border-radius: var(--radius-pill);
  font-size: var(--text-xs); font-weight: var(--weight-medium); background: var(--surface-cool);
  color: var(--text-secondary); white-space: nowrap; line-height: 1.7;
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.chip-ok { background: var(--lk-success-soft); color: var(--lk-success); }
.chip-warn { background: var(--lk-warning-soft); color: var(--lk-warning); }
.chip-bad { background: var(--lk-error-soft); color: var(--lk-error); }
.chip-info { background: var(--lk-cyan-soft); color: var(--lk-cyan-ink); }
.chip-attention { background: var(--lk-violet-soft); color: var(--lk-violet-deep); }
.chip-live::before { animation: pulse 1.4s var(--ease-in-out) infinite; }
code, .mono { font-family: var(--font-mono); font-size: 0.86em; word-break: break-all; }
.error { background: var(--lk-error-soft); border: 1px solid #F1BDBE; color: var(--lk-error);
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); margin: var(--space-3) 0; }
.error ul { margin: var(--space-2) 0 0; padding-left: var(--space-5); }
.error .safe { display: block; color: var(--text-secondary); font-size: var(--text-sm); margin-top: var(--space-1); }
.error button { margin-top: var(--space-2); }
.success { background: var(--lk-success-soft); color: var(--lk-success); padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm); margin: var(--space-3) 0; }

/* --- summary numbers (quality, review, workspace, admin) --------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1px;
  background: var(--grid-line); border: 1px solid var(--grid-line); border-radius: var(--radius-md); overflow: hidden;
  margin: var(--space-3) 0 var(--space-4); }
.stat { background: var(--surface); padding: var(--space-3) var(--space-4); }
.stat .n { display: block; font-size: var(--text-2xl); font-weight: var(--weight-strong); letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat .l { display: block; font-size: var(--text-xs); color: var(--text-secondary); }
.stat.attn { box-shadow: inset 0 3px 0 var(--action-primary); }
.stat.warn-stat { box-shadow: inset 0 3px 0 var(--lk-warning); }
.stat.good { box-shadow: inset 0 3px 0 var(--lk-success); }
.stat .n.na { font-size: var(--text-md); color: var(--text-muted); }

/* --- guided steps ---------------------------------------------------------------------------------------------- */
.steps { list-style: none; margin: var(--space-3) 0 var(--space-6); padding: 0; display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--space-2); counter-reset: step; }
.steps li { position: relative; padding-top: 30px; font-size: var(--text-sm); color: var(--text-muted);
  counter-increment: step; }
.steps li::before {
  content: counter(step); position: absolute; top: 0; left: 0; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; font-size: 0.72rem; font-weight: var(--weight-strong);
  background: var(--surface); border: 1px solid var(--border); color: var(--text-muted);
  transition: background-color var(--duration-base) var(--ease-out), transform var(--duration-base) var(--ease-spring);
}
.steps li::after { content: ""; position: absolute; top: 12px; left: 30px; right: 6px; height: 2px;
  background: var(--grid-line); }
.steps li:last-child::after { display: none; }
.steps li .state { display: block; font-size: var(--text-xs); margin-top: 2px; }
.steps li[data-status="DONE"] { color: var(--text-secondary); }
.steps li[data-status="DONE"]::before { content: "\2713"; background: var(--lk-success-soft);
  border-color: #9FD3B0; color: var(--lk-success); }
.steps li[data-status="DONE"]::after { background: #9FD3B0; }
.steps li[data-status="CURRENT"] { color: var(--text); font-weight: var(--weight-medium); }
.steps li[data-status="CURRENT"]::before { background: var(--action-primary); border-color: var(--action-primary);
  color: #fff; transform: scale(1.1); box-shadow: 0 0 0 5px var(--lk-violet-soft); }
.steps li[data-status="BLOCKED"] { color: var(--lk-warning); font-weight: var(--weight-medium); }
.steps li[data-status="BLOCKED"]::before { content: "!"; background: var(--lk-warning-soft); border-color: #E3BE7C;
  color: var(--lk-warning); }
.steps li[data-status="OPTIONAL"] { color: var(--text-secondary); }
.steps li[data-status="OPTIONAL"]::before { border-style: dashed; }

.next-action {
  display: grid; grid-template-columns: auto 1fr auto; gap: var(--space-4); align-items: center;
  padding: var(--space-4) var(--space-5); background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--action-primary); border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-5);
}
.next-action .label { font-size: var(--text-xs); color: var(--text-muted); }
.next-action .text { font-weight: var(--weight-medium); font-size: var(--text-lg); }
.attention { border-left-color: var(--lk-warning); }

/* next steps on the workspace: what to do now, from the server's derived states */
.next-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.next-steps li a { display: grid; grid-template-columns: 32px 1fr auto; gap: var(--space-3); align-items: center;
  padding: var(--space-3) var(--space-4); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); color: var(--text); text-decoration: none;
  transition: border-color var(--duration-fast) var(--ease-out), transform var(--duration-base) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out); }
.next-steps li a:hover { border-color: var(--lk-sky); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.next-steps .num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--lk-cyan-soft); color: var(--lk-cyan-ink); font-weight: var(--weight-strong); font-size: var(--text-xs); }
.next-steps li:first-child .num { background: var(--action-primary); color: #fff; }
.next-steps .what { font-weight: var(--weight-medium); }
.next-steps .why { display: block; font-size: var(--text-xs); color: var(--text-muted); font-weight: var(--weight-regular); }
.next-steps .go { font-size: var(--text-sm); color: var(--link); }

/* --- upload ---------------------------------------------------------------------------------------------------- */
.dropzone {
  position: relative; display: grid; place-items: center; text-align: center; gap: var(--space-2);
  padding: var(--space-7) var(--space-5); border: 2px dashed #A9C9D6; border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-cool) 100%); cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-out), background-color var(--duration-fast) var(--ease-out),
    transform var(--duration-base) var(--ease-out);
}
.dropzone:hover, .dropzone.is-over { border-color: var(--lk-cyan-deep); transform: translateY(-1px); }
.dropzone.is-over { background: var(--lk-cyan-soft); }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }
.dropzone .big { font-size: var(--text-lg); font-weight: var(--weight-medium); }
.dropzone .formats { display: flex; gap: var(--space-2); justify-content: center; }
.file-pill { display: inline-flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); font-size: var(--text-sm); }
.upload-state { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-3); }
.progress { height: 6px; border-radius: var(--radius-pill); background: var(--grid-line); overflow: hidden;
  margin: var(--space-3) 0; }
.progress > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--lk-cyan-deep),
  var(--lk-cyan)); border-radius: inherit; transition: width var(--duration-base) var(--ease-out); }
.progress.indeterminate > span { width: 35%; animation: slide 1.3s var(--ease-in-out) infinite; }

/* --- lists, empty states, metrics ------------------------------------------------------------------------------- */
.list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--grid-line); }
.list > li { display: flex; gap: var(--space-4); align-items: center; padding: var(--space-3) 0;
  border-bottom: 1px solid var(--grid-line); }
.list > li .grow { flex: 1; min-width: 0; }
.list > li .title { font-weight: var(--weight-medium); }
.list > li .sub { font-size: var(--text-xs); color: var(--text-muted); }
.empty {
  padding: var(--space-5); border: 1px dashed var(--border); border-radius: var(--radius-md);
  color: var(--text-secondary); background: var(--surface);
}
.empty strong { display: block; color: var(--text); font-size: var(--text-md); margin-bottom: var(--space-1); }
.empty .btn, .empty button { margin-top: var(--space-3); }
.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0;
  border-top: 1px solid var(--grid-line); }
.metric { padding: var(--space-4) var(--space-4) var(--space-4) 0; border-bottom: 1px solid var(--grid-line); }
.metric .value { font-size: var(--text-2xl); font-weight: var(--weight-strong); letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; line-height: 1.1; }
.metric .value .of { font-size: var(--text-md); color: var(--text-secondary); font-weight: var(--weight-medium); }
.metric .value.na { font-size: var(--text-md); color: var(--text-muted); font-weight: var(--weight-medium); }
.metric .name { font-size: var(--text-sm); font-weight: var(--weight-medium); margin-top: var(--space-1); }
.metric .def { font-size: var(--text-xs); color: var(--text-muted); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-1) var(--space-4); margin: 0;
  font-size: var(--text-sm); }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
details > summary { cursor: pointer; font-weight: var(--weight-medium); padding: var(--space-2) 0; }
details[open] > summary { margin-bottom: var(--space-2); }

/* approval: a deliberate act */
.approval { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface);
  overflow: hidden; box-shadow: var(--shadow-sm); }
.approval-head { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap;
  padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--grid-line); background: var(--canvas); }
.approval-head h3 { margin: 0; }
.approval-body { padding: var(--space-4) var(--space-5); }
.approval-foot { padding: var(--space-4) var(--space-5); border-top: 1px solid var(--grid-line);
  display: flex; flex-direction: column; gap: var(--space-3); }
.approval.approved { border-color: #9FD3B0; }
.approval.approved .approval-head { background: var(--lk-success-soft); }
.approved-tick { width: 32px; height: 32px; border-radius: 50%; background: var(--lk-success); display: grid;
  place-items: center; }
.approved-tick svg path { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw 600ms var(--ease-out) 100ms forwards; }

/* analysis results */
.result-section { padding: var(--space-4) 0; border-top: 1px solid var(--grid-line); }
.result-section:first-child { border-top: 0; }
.result-section h3 { font-size: var(--text-sm); text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-secondary); margin-bottom: var(--space-2); }
.result-section ul { margin: 0; padding-left: var(--space-5); }

/* dashboards and charts */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--space-4); }
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: var(--space-4); min-width: 0; }
.chart-card h3 { font-size: var(--text-md); margin-bottom: var(--space-1); }
.chart-card .sub { font-size: var(--text-xs); color: var(--text-muted); margin-bottom: var(--space-3); }
.chart-card.kpi .big { font-size: var(--text-3xl); font-weight: var(--weight-strong); letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums; line-height: 1.05; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-svg .grid { stroke: var(--grid-line); stroke-width: 1; }
.chart-svg .axis-label { font: 11px var(--font-sans); fill: var(--text-muted); }
.chart-svg .value-label { font: 600 11px var(--font-sans); fill: var(--text-secondary); }
.chart-svg .mark { fill: var(--lk-cyan-deep); }
.chart-svg .mark-line { fill: none; stroke: var(--lk-cyan-deep); stroke-width: 2; stroke-linejoin: round;
  stroke-linecap: round; }
.chart-svg .mark-area { fill: var(--lk-cyan-deep); opacity: 0.1; }
.chart-svg .dot { fill: var(--lk-cyan-deep); stroke: var(--surface); stroke-width: 2; }
.chart-svg .hit { fill: transparent; }
.chart-svg .bar-group:hover .mark { fill: var(--lk-violet); }
.chart-svg .appear-bar { transform-box: fill-box; transform-origin: bottom; animation: grow-y 520ms var(--ease-out) both; }
.chart-tools { display: flex; gap: var(--space-2); margin-top: var(--space-2); }
.freshness { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; font-size: var(--text-sm);
  color: var(--text-secondary); }

/* --- dialog and toast ------------------------------------------------------------------------------------------ */
dialog {
  border: 0; border-radius: var(--radius-lg); padding: 0; width: min(560px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem); box-shadow: var(--shadow-lg); color: var(--text);
}
dialog[open] { animation: dialog-in var(--duration-base) var(--ease-out); }
dialog::backdrop { background: rgba(11, 18, 32, 0.38); backdrop-filter: blur(2px); }
.dialog-body { padding: var(--space-5) var(--space-5) var(--space-4); overflow-y: auto; }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-3); padding: var(--space-3) var(--space-5)
  var(--space-5); }
.toast {
  position: fixed; right: var(--space-5); bottom: var(--space-5); z-index: 60; max-width: 380px;
  background: var(--lk-ink); color: var(--text-on-dark); padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg); animation: toast-in var(--duration-base) var(--ease-spring);
}
.toast.ok-toast::before { content: "\2713"; margin-right: var(--space-2); color: #7FE0A0; }

/* --- motion ---------------------------------------------------------------------------------------------------- */
.appear { animation: appear var(--duration-slow) var(--ease-out) both; }
.appear-2 { animation-delay: 60ms; }
.appear-3 { animation-delay: 120ms; }
.skeleton { border-radius: var(--radius-sm); min-height: 1em; background: linear-gradient(90deg, var(--grid-line) 0%,
  #F3F8FA 50%, var(--grid-line) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes appear { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.3; transform: scale(0.8); } }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes grow-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes draw { to { stroke-dashoffset: 0; } }

iframe { width: 100%; height: 80vh; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); }
.prep-table table { min-width: 960px; }
td select { min-width: 8.5rem; }

/* --- responsive ------------------------------------------------------------------------------------------------ */
@media (max-width: 1100px) {
  .grid-2, .grid-2.even { grid-template-columns: 1fr; }
  .steps { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: var(--space-4); }
  .steps li:nth-child(4)::after { display: none; }
}
@media (max-width: 1023px) {
  .shell { display: block; }
  .mobile-bar { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0;
    z-index: 20; padding: var(--space-2) var(--gutter); background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--border); backdrop-filter: saturate(1.4) blur(10px); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); height: auto;
    transform: translateX(-102%); transition: transform var(--duration-base) var(--ease-out); box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  .prep-table::before { content: "Wide table: scroll sideways. Editing is easiest on a larger screen.";
    display: block; padding: var(--space-2) var(--space-3); font-size: var(--text-xs); color: var(--text-muted); }
}
@media (max-width: 640px) {
  main { padding-top: var(--space-5); }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps li::after { display: none; }
  .next-action { grid-template-columns: 1fr; }
  .page-head .actions { margin-left: 0; width: 100%; }
  .page-head .actions > * { flex: 1; }
  .card, .panel { padding: var(--space-3) var(--space-4); }
  .lk-lockup.has-crest .lk-wordmark { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0ms !important; scroll-behavior: auto !important; }
  .progress.indeterminate > span { width: 100%; opacity: 0.6; }
  .chip-live::before { animation: none; }
}

/* in-page tabs (owner console) */
.tabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--border); overflow-x: auto;
  scrollbar-width: none; margin: var(--space-5) 0 var(--space-4); }
.tabs a { position: relative; padding: var(--space-3) var(--space-3); color: var(--text-secondary); text-decoration: none;
  font-size: var(--text-sm); font-weight: var(--weight-medium); white-space: nowrap;
  transition: color var(--duration-fast) var(--ease-out); }
.tabs a::after { content: ""; position: absolute; left: var(--space-3); right: var(--space-3); bottom: -1px; height: 2px;
  background: var(--action-primary); transform: scaleX(0); transform-origin: left;
  transition: transform var(--duration-base) var(--ease-out); }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--text); }
.tabs a[aria-current="page"]::after { transform: scaleX(1); }

/* refinements from the screenshot review */
.shell { background: linear-gradient(90deg, var(--surface) 248px, var(--canvas) 248px); }
.prep-table td input:not([type="checkbox"]) { min-width: 10rem; }
.prep-table .inline.compact > * { flex: 1 1 140px; }
.prep-actions { margin-top: var(--space-4); }
.dash-grid { align-items: start; }
.metric .value.breakdown { font-size: var(--text-lg); line-height: 1.4; }
.range { display: grid; grid-template-columns: auto 1fr; gap: var(--space-1) var(--space-2); align-items: center; }
.range span { font-size: var(--text-xs); color: var(--text-muted); font-weight: var(--weight-regular); }
@media (max-width: 1023px) { .shell { background: var(--canvas); } }
@media (max-width: 640px) {
  .list > li { flex-wrap: wrap; }
  .list > li .grow { flex-basis: 100%; }
}

.org-line { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin: 0 0 var(--space-1);
  font-size: var(--text-lg); font-weight: var(--weight-medium); color: var(--text-secondary); }
