/*
 * OSiA platform stylesheet: the ONE design system of every portal surface
 * (the application shell, its native views and the standalone pages).
 * Klee identity: Arial 14px, #003595 for actions and selection, coral #E94A3F
 * for destructive or sensitive actions, system / light / dark themes.
 *
 * Themes: `data-theme` on <html> is set by the shell (and by i18n.js on the
 * standalone pages). The media query below only covers the first paint of a
 * page whose script has not run yet; both blocks MUST stay identical.
 */
:root {
  color-scheme: light;
  --page: #f5f6f8;
  --bg: #ffffff;
  --bg-surface: #f7f9fc;
  --bg-hover: #eef2f8;
  --border: #dbe1ea;
  --border-strong: #c4ccd9;
  --text: #191814;
  --text-2: #4d5460;
  --text-3: #626873;
  --accent: #003595;
  --accent-hover: #174ba8;
  --accent-soft: #e8eef8;
  --accent-text: #003595;
  --on-accent: #ffffff;
  /* Coral: destructive and sensitive actions. Text uses the darker shade (contrast). */
  --danger: #e94a3f;
  --danger-strong: #c23a30;
  --danger-soft: rgba(233, 74, 63, .10);
  --danger-text: #b3342b;
  --ok: #15803d;
  --ok-soft: rgba(21, 128, 61, .09);
  --warn: #92560a;
  --warn-soft: rgba(217, 119, 6, .12);
  --code-bg: #f2f4f8;
  --top-line: #003595;
  --err: var(--danger-text);
  --green: var(--ok);
  --green-soft: var(--ok-soft);
  --logo-checker: #ced4de;
}
[data-theme="dark"] {
  color-scheme: dark;
  --page: #11151d;
  --bg: #1b2230;
  --bg-surface: #151c28;
  --bg-hover: #243654;
  --border: #34415a;
  --border-strong: #48566c;
  --text: #edf1f7;
  --text-2: #c3cddc;
  --text-3: #adb8ca;
  --accent: #3b63b8;
  --accent-hover: #4a73c9;
  --accent-soft: #243654;
  --accent-text: #91b6ff;
  --on-accent: #ffffff;
  --danger: #e94a3f;
  --danger-strong: #d0443a;
  --danger-soft: rgba(233, 74, 63, .16);
  --danger-text: #ff9b92;
  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, .10);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .12);
  --code-bg: #151c28;
  --top-line: #5b7fc7;
  --logo-checker: #7c869c;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --page: #11151d; --bg: #1b2230; --bg-surface: #151c28; --bg-hover: #243654; --border: #34415a; --border-strong: #48566c;
    --text: #edf1f7; --text-2: #c3cddc; --text-3: #adb8ca; --accent: #3b63b8; --accent-hover: #4a73c9; --accent-soft: #243654;
    --accent-text: #91b6ff; --on-accent: #ffffff; --danger: #e94a3f; --danger-strong: #d0443a; --danger-soft: rgba(233, 74, 63, .16);
    --danger-text: #ff9b92; --ok: #4ade80; --ok-soft: rgba(74, 222, 128, .10); --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .12);
    --code-bg: #151c28; --top-line: #5b7fc7; --logo-checker: #7c869c;
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body {
  font: 14px/1.5 Arial, Helvetica, sans-serif;
  background: var(--page);
  color: var(--text-2);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
::selection { background: #003595; color: #fff; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: 'Cascadia Code', Consolas, 'SF Mono', monospace; }
code { background: var(--code-bg); padding: 1px 5px; border-radius: 2px; font-size: 12px; overflow-wrap: anywhere; }
hr { border: none; border-top: 1px solid var(--border); margin: 0 0 28px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h2, h3, h4 { color: var(--text); }

/* ── Logo (inline lockup themed like the extension's os-osia-logo) ───────── */
.osia-checker { fill: var(--logo-checker); }
.osia-mark { fill: var(--text); }
.logo { display: flex; align-items: center; }
.logo svg { height: 34px; width: auto; display: block; }
.gate-lockup { display: flex; justify-content: center; margin-bottom: 28px; }
.gate-lockup svg { width: 210px; height: auto; display: block; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 8px 14px; font: 600 13px/1.3 Arial, Helvetica, sans-serif;
  border-radius: 4px; cursor: pointer; white-space: nowrap; text-decoration: none;
  border: 1px solid transparent; transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { text-decoration: none; }
.btn svg { width: 13px; height: 13px; fill: currentColor; flex-shrink: 0; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-default { background: var(--bg); color: var(--text-2); border-color: var(--border); }
.btn-default:hover:not(:disabled) { background: var(--bg-surface); border-color: var(--border-strong); color: var(--text); }
.btn-danger { background: transparent; color: var(--danger-text); border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn-danger-solid { background: var(--danger-strong); border-color: var(--danger-strong); color: #fff; }
.btn-danger-solid:hover:not(:disabled) { background: var(--danger); border-color: var(--danger); }
.btn-link { background: none; border: 0; padding: 4px 2px; min-height: 0; color: var(--accent-text); font-weight: 600; }
.btn-link:hover { text-decoration: underline; }
.btn-small { min-height: 30px; padding: 4px 10px; font-size: 12px; }
.btn-label { display: flex; flex-direction: column; line-height: 1.15; }
.btn-sub { font-size: 9px; font-weight: 400; opacity: .7; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > label, .field-label { color: var(--text); font-size: 13px; font-weight: 600; }
.field .optional { color: var(--text-3); font-weight: 400; }
.hint { color: var(--text-3); font-size: 12px; line-height: 1.45; }
.view-intro { margin-bottom: 16px; }
.add-form { margin-top: 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-items: start; }
.add-form .field { margin-bottom: 0; }
/* Button on the input row: label line (13px x 1.45) + field gap. */
.add-form > .actions { margin-top: 25px; }
@media (max-width: 600px) { .add-form { grid-template-columns: minmax(0, 1fr); } .add-form > .actions { margin-top: 10px; } }
.field-error { color: var(--danger-text); font-size: 12px; min-height: 0; }
.ownership-panel { min-width: 0; color: var(--text); overflow-wrap: anywhere; }
.ownership-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.ownership-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.ownership-panel .meta { margin: 0; gap: 8px 18px; }
.ownership-section { margin-top: 24px; }
.ownership-section h4 { margin: 0 0 10px; font-size: 13px; font-weight: 700; }
.ownership-empty { margin: 0; font-size: 13px; color: var(--text-3); }
.ownership-people { list-style: none; margin: 0; padding: 0; }
.ownership-people li { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.ownership-email { min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
.ownership-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 12px; margin: 18px 0 22px; max-width: 680px; }
.ownership-add .field { margin: 0; }
.ownership-add > .actions { margin: 25px 0 0; }
.ownership-disclosure { border-top: 1px solid var(--border); }
.ownership-disclosure > summary { cursor: pointer; padding: 14px 0; font-size: 13px; font-weight: 600; color: var(--text-2); }
.ownership-disclosure > summary:hover { color: var(--accent-text); }
.ownership-form { max-width: 600px; padding: 4px 0 20px; }
.ownership-form > .hint { margin-bottom: 16px; }
.ownership-footnote { margin-top: 20px; max-width: 75ch; }
.ownership-panel input:not([type="checkbox"]), .ownership-panel select, .ownership-panel textarea { box-sizing: border-box; width: 100%; min-height: 38px; padding: 8px 12px; font: inherit; background: var(--bg); color: var(--text); border: 1px solid var(--border-strong); border-radius: 4px; caret-color: var(--accent-text); }
.ownership-panel textarea { resize: vertical; min-height: 80px; }
.ownership-panel :is(input, select, textarea):focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.ownership-panel [aria-busy="true"] { opacity: .7; }
.card > .ownership-card { border-top: 1px solid var(--border); }
.card > .ownership-card > summary { margin: 0; padding: 11px 20px; font-size: 12px; color: var(--text-2); }
.card > .ownership-card > summary:hover { background: var(--bg-hover); }
.card > .ownership-card > .ownership-panel { padding: 8px 20px 20px; }
.card .ownership-disclosure > summary { margin: 0; font-size: 13px; padding: 14px 0; }
.panel > .ownership-panel { border-top: 1px solid var(--border); margin-top: 24px; padding-top: 20px; }
@media (max-width: 600px) {
  .ownership-add { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .ownership-add > .actions { margin-top: 10px; }
  .ownership-head { align-items: flex-start; }
  .card > .ownership-card > summary { padding: 12px 14px; }
  .card > .ownership-card > .ownership-panel { padding: 4px 14px 16px; }
}
.input, .gate-input, .modal-input,
.native-view input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.native-view select, .native-view textarea {
  width: 100%; min-height: 38px; padding: 8px 12px; font: 14px/1.4 Arial, Helvetica, sans-serif;
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: 4px; color: var(--text);
  outline: none; transition: border-color .12s, box-shadow .12s; caret-color: var(--accent-text);
}
.native-view textarea { min-height: 76px; resize: vertical; }
.native-view input[type="file"] { width: 100%; padding: 8px; border: 1px dashed var(--border-strong); border-radius: 4px; background: var(--bg-surface); color: var(--text-2); font: inherit; }
.input::placeholder, .gate-input::placeholder, .modal-input::placeholder, .native-view ::placeholder { color: var(--text-3); }
.input:focus, .gate-input:focus, .modal-input:focus,
.native-view input:focus, .native-view select:focus, .native-view textarea:focus { border-color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-soft); }
.native-view [aria-invalid="true"], .gate-input.err, .modal-input.err { border-color: var(--danger) !important; }
.check { display: flex; align-items: flex-start; gap: 10px; margin: 4px 0 16px; color: var(--text-2); font-size: 13px; line-height: 1.45; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 1px; flex: none; accent-color: var(--accent); }
.slug-preview { font-size: 12px; color: var(--text-3); }
.slug-preview code { color: var(--text); }
progress { width: 100%; height: 8px; accent-color: var(--accent); }

/* ── Notices: near the action that produced them, announced politely ───── */
.notice { font-size: 13px; line-height: 1.45; border-radius: 4px; }
.notice:empty { display: none; }
.notice:not(:empty) { margin-top: 12px; padding: 10px 12px; background: var(--bg-surface); border: 1px solid var(--border); color: var(--text-2); }
.notice.is-ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.notice.is-error { background: var(--danger-soft); border-color: transparent; color: var(--danger-text); }
.notice.is-warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }

/* ── Chips (states) ──────────────────────────────────────────────────────── */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 1.5; white-space: nowrap; background: var(--bg-hover); color: var(--text-2); }
.chip-progress { background: var(--accent-soft); color: var(--accent-text); }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-danger { background: var(--danger-soft); color: var(--danger-text); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── Panels, cards and metadata ─────────────────────────────────────────── */
.panel { border: 1px solid var(--border); border-radius: 6px; background: var(--bg); padding: 20px; margin-bottom: 20px; }
/* Create a group, folded behind its button once groups exist. */
.create-group:not([open]) { border: 0; background: none; padding: 0; }
.create-group > summary { display: inline-flex; list-style: none; cursor: pointer; }
.create-group > summary::-webkit-details-marker { display: none; }
.create-group[open] > summary { margin-bottom: 16px; }
.create-group > form { margin: 0; }
.panel > h3, .panel-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h3 { font-size: 15px; font-weight: 700; }
.panel-sub { color: var(--text-3); font-size: 13px; margin-bottom: 14px; }
.stack > * + * { margin-top: 12px; }
.item-card { border: 1px solid var(--border); border-radius: 6px; background: var(--bg); padding: 16px 18px; overflow-wrap: anywhere; }
.item-card + .item-card { margin-top: 10px; }
.item-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.item-title { color: var(--text); font-size: 14px; font-weight: 700; }
.meta { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin-top: 10px; font-size: 13px; }
.meta dt { color: var(--text-3); }
.meta dd { color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.quote { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg-surface); color: var(--text); font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.quote-label { display: block; margin-bottom: 4px; color: var(--text-3); font-size: 12px; font-weight: 700; white-space: normal; }
.quote.is-warn { border-color: var(--warn); }
.problem-list { margin: 6px 0 0 18px; font-size: 13px; }
.rows { list-style: none; }
.rows > li { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--border); }
.rows > li:first-child { border-top: 0; }
.row-main { min-width: 0; overflow-wrap: anywhere; }
.row-sub { color: var(--text-3); font-size: 12px; }
.sub-title { margin: 18px 0 6px; font-size: 13px; font-weight: 700; color: var(--text); }
details.tech { margin-top: 12px; font-size: 12px; }
details.tech > summary, details.disclosure > summary { cursor: pointer; color: var(--text-3); font-weight: 600; padding: 6px 0; }
details.tech[open] > summary { margin-bottom: 4px; }
details.disclosure { margin-top: 12px; }
details.disclosure > summary { color: var(--accent-text); }
.empty-state { padding: 32px 20px; border: 1px dashed var(--border-strong); border-radius: 6px; text-align: center; color: var(--text-3); }
.empty-state strong { display: block; margin-bottom: 6px; color: var(--text); font-size: 15px; }
.empty-state p { max-width: 56ch; margin: 0 auto; }
.empty-state .actions { justify-content: center; }
.confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 4px; background: var(--danger-soft); color: var(--text); font-size: 13px; }
.confirm.is-neutral { background: var(--accent-soft); }
.confirm-text { flex: 1 1 220px; }
.segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.segment { display: grid; gap: 4px; padding: 16px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text-2); text-align: left; font: inherit; cursor: pointer; }
.segment strong { color: var(--text); font-size: 15px; }
.segment span { font-size: 13px; }
.segment:hover { border-color: var(--border-strong); }
.segment[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.preview { max-height: 520px; overflow: auto; padding: 12px; border: 1px solid var(--border); border-radius: 4px; background: var(--code-bg); color: var(--text); font-size: 12px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.preview-panel { margin-top: 14px; }
.preview-panel > .sub-title { margin-top: 0; }
.diff-add { color: var(--ok); }
.diff-del { color: var(--danger-text); }
.file-list { display: flex; flex-wrap: wrap; gap: 6px; }
.file-list .btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }

/* Checklist (review) */
.checklist { list-style: none; display: grid; gap: 8px; margin-top: 8px; }
.checklist li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; align-items: start; font-size: 13px; }
.checklist .mark { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: 12px; font-weight: 700; background: var(--bg-hover); color: var(--text-3); }
.checklist .is-ok .mark { background: var(--ok-soft); color: var(--ok); }
.checklist .is-fail .mark { background: var(--danger-soft); color: var(--danger-text); }
.checklist .is-pending .mark { background: var(--warn-soft); color: var(--warn); }
.checklist strong { color: var(--text); }
.checklist .row-sub { display: block; }
.checklist .problem-list li { display: list-item; }
.disabled-reason { margin-top: 8px; color: var(--warn); font-size: 12px; }

/* Review layout */
.view-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.view-tabs .spacer { flex: 1; }
.view-tabs .btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent); }
.split { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.queue { display: grid; gap: 10px; }
.queue-list { display: grid; gap: 6px; max-height: 70vh; overflow: auto; padding: 2px; }
.queue-item { display: grid; gap: 4px; width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg); color: var(--text-2); font: inherit; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.queue-item:hover { border-color: var(--border-strong); background: var(--bg-surface); }
.queue-item[aria-current="true"] { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.queue-item strong { color: var(--text); }
.queue-item .row-sub { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chips .btn { min-height: 30px; padding: 4px 10px; font-size: 12px; }
.filter-chips .btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.count { font-weight: 400; opacity: .8; }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; align-items: end; }
.filters .field { margin: 0; }
.table-scroll { overflow-x: auto; margin-top: 14px; border: 1px solid var(--border); border-radius: 4px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data th { background: var(--bg-surface); color: var(--text); font-weight: 700; white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
.pager { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

/* ── Licence gate ────────────────────────────────────────────────────────── */
.gate { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.gate-box { width: 100%; max-width: 400px; text-align: center; }
.gate-title { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.gate-sub { font-size: 13px; color: var(--text-3); margin-bottom: 24px; }
.gate-input { font-family: 'Cascadia Code', Consolas, 'SF Mono', monospace; font-size: 13px; padding: 10px 14px; background: var(--bg-surface); border-color: var(--border); }
.gate-btn { width: 100%; min-height: 40px; margin-top: 10px; padding: 10px; font: 600 13px Arial, Helvetica, sans-serif; background: var(--accent); color: var(--on-accent); border: none; border-radius: 4px; cursor: pointer; }
.gate-btn:hover { background: var(--accent-hover); }
.gate-err { margin-top: 10px; font-size: 12px; color: var(--danger-text); min-height: 18px; }
.gate-info { margin-top: 20px; font-size: 12px; color: var(--text-3); line-height: 1.5; }

/* ── Modal (licence) ─────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, .45); display: flex; align-items: center; justify-content: center; padding: 24px; animation: fadeIn .12s ease; }
[data-theme="dark"] .modal-overlay { background: rgba(0, 0, 0, .65); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { width: 100%; max-width: 480px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; animation: slideUp .12s ease; max-height: calc(100vh - 48px); overflow-y: auto; }
@keyframes slideUp { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 13px; font-weight: 600; color: var(--text); }
.modal-close { width: 32px; height: 32px; border: none; background: none; color: var(--text-3); cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 4px; }
.modal-close:hover { color: var(--text); background: var(--bg-hover); }
.modal-close svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.modal-body { padding: 20px; }
.modal-row { margin-bottom: 14px; }
.modal-row:last-child { margin-bottom: 0; }
.modal-label { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.modal-val { font-size: 13px; color: var(--text); word-break: break-all; }
.modal-sep { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.modal-input { font-family: 'Cascadia Code', Consolas, 'SF Mono', monospace; font-size: 12px; background: var(--bg-surface); border-color: var(--border); margin-bottom: 8px; }
.modal-actions { display: flex; gap: 6px; }
.modal-actions .btn { flex: 1; }
.modal-err { font-size: 12px; color: var(--danger-text); min-height: 16px; margin-bottom: 6px; }
.modal-meta { display: flex; gap: 24px; flex-wrap: wrap; }
.modal-meta > div { min-width: 0; }

/* ── Bridge downloads ────────────────────────────────────────────────────── */
.section { margin-bottom: 32px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; flex-wrap: wrap; gap: 8px; }
.section-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; color: var(--text-3); }
.tabs { display: flex; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.tab { min-height: 32px; padding: 4px 14px; font: 500 12px Arial, Helvetica, sans-serif; color: var(--text-3); background: var(--bg); border: none; border-right: 1px solid var(--border); cursor: pointer; white-space: nowrap; }
.tab:last-child { border-right: none; }
.tab:hover { color: var(--text-2); background: var(--bg-surface); }
.tab.active { color: var(--text); background: var(--bg-surface); font-weight: 600; }
.tab .v { font-size: 10px; color: var(--text-3); margin-left: 3px; font-weight: 400; }
.tab.active .v { color: var(--text-2); }
.card { border: 1px solid var(--border); border-radius: 4px; background: var(--bg); }
.card + .card { margin-top: 10px; }
.card-main { padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-top: 2px solid var(--top-line); }
.card-info { flex: 1; min-width: 180px; }
.card-info p { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.card-title { font-size: 14px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; line-height: 1.4; }
.card-desc { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.card-actions { display: flex; gap: 6px; align-items: stretch; }
.card details summary { cursor: pointer; font-size: 12px; color: var(--text-3); margin-top: 6px; }
.tag { display: inline-block; padding: 1px 6px; font-size: 11px; font-weight: 600; border-radius: 2px; }
.tag-v { background: var(--accent-soft); color: var(--accent-text); }
.tag-latest { background: var(--ok-soft); color: var(--ok); font-size: 10px; text-transform: uppercase; letter-spacing: .4px; }
.older-btn { display: flex; align-items: center; gap: 5px; width: 100%; min-height: 36px; padding: 8px 20px; background: none; border: none; border-top: 1px solid var(--border); color: var(--text-3); font: 12px Arial, Helvetica, sans-serif; cursor: pointer; }
.older-btn:hover { color: var(--text-2); background: var(--bg-hover); }
.older-btn svg { width: 10px; height: 10px; fill: currentColor; transition: transform .15s; }
.older-btn.open svg { transform: rotate(180deg); }
.card details.older-versions > summary.older-btn { margin-top: 0; list-style: none; }
.older-versions > summary::-webkit-details-marker { display: none; }
.older-versions[open] > .older-btn svg { transform: rotate(180deg); }
.older-list { display: none; border-top: 1px solid var(--border); }
.older-list.show { display: block; }
.older-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 20px; gap: 8px; flex-wrap: wrap; }
.older-row:not(:last-child) { border-bottom: 1px solid var(--border); }
.older-row:hover { background: var(--bg-hover); }
.older-v { font-size: 13px; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }
.older-tag { font-size: 11px; color: var(--text-3); margin-left: 6px; }
.older-actions { display: flex; gap: 4px; }
.steps { counter-reset: step; }
.step { display: flex; gap: 10px; font-size: 13px; line-height: 1.6; color: var(--text-2); padding: 4px 0; }
.step strong { color: var(--text); font-weight: 600; }
.step-n { counter-increment: step; width: 20px; height: 20px; border: 1px solid var(--border); border-radius: 2px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: var(--text-3); flex-shrink: 0; margin-top: 2px; }
.step-n::after { content: counter(step); }
.vscode-dl { display: flex; align-items: center; gap: 12px; padding: 14px 20px; margin-bottom: 16px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg); }
.vscode-dl:hover { border-color: var(--border-strong); text-decoration: none; }
.vscode-dl-icon { width: 36px; height: 36px; border-radius: 4px; background: #0078d4; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.vscode-dl-icon img { width: 16px; height: 16px; }
.vscode-dl-text { flex: 1; }
.vscode-dl-title { font-size: 13px; font-weight: 500; color: var(--text); }
.vscode-dl-sub { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.manual-downloads > summary { cursor: pointer; padding: 14px 0; font-weight: 600; font-size: 14px; }
.manual-downloads[open] > summary { margin-bottom: 12px; }
.sub-block + .sub-block { margin-top: 20px; }
.sub-label { font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
/* Manual downloads: one block per need, one row per OneStream version. */
.dl-intro { margin: 0 0 20px; color: var(--text-2); font-size: 13px; max-width: 70ch; }
.dl-block { border: 1px solid var(--border); border-radius: 6px; background: var(--bg); padding: 18px 20px; }
.dl-block + .dl-block { margin-top: 16px; }
.dl-title { margin: 0 0 6px; color: var(--text); font-size: 14px; font-weight: 700; }
.dl-hint { margin: 0 0 12px; color: var(--text-2); font-size: 13px; max-width: 70ch; }
.dl-legend { margin: 0 0 14px; padding-left: 18px; color: var(--text-2); font-size: 13px; }
.dl-legend li + li { margin-top: 2px; }
.dl-legend strong { color: var(--text); }
.dl-toggle { border: 1px solid var(--border); border-radius: 4px; padding: 8px 14px; color: var(--text-2); font-weight: 600; }
.dl-toggle.open { border-radius: 4px 4px 0 0; }
.dl-versions { border: 1px solid var(--border); border-top: 0; border-radius: 0 0 4px 4px; }
.dl-row { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; padding: 10px 14px; }
.dl-block > .dl-row { padding: 10px 0 0; }
.dl-versions .dl-row:not(:last-child) { border-bottom: 1px solid var(--border); }
.dl-versions .dl-row:hover { background: var(--bg-hover); }
.dl-name { color: var(--text); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dl-meta { margin-left: 8px; color: var(--text-3); font-size: 12px; font-weight: 400; }
.dl-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dl-actions .btn svg { width: 12px; height: 12px; fill: currentColor; }
.dl-size { margin-left: 4px; color: inherit; opacity: .7; font-weight: 400; }
.dl-missing { color: var(--text-3); font-size: 12px; }

/* ── Library ─────────────────────────────────────────────────────────────── */
.library-toolbar { display: flex; align-items: end; gap: 12px; margin: 24px 0; flex-wrap: wrap; }
.library-search { flex: 1; min-width: 0; }
.library-search label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--text); }
.library-search .gate-input { margin: 0; font-family: inherit; font-size: 14px; }
.library-toolbar .btn { min-height: 40px; }

.loading, .error { text-align: center; padding: 56px 20px; color: var(--text-3); font-size: 13px; }
.error { color: var(--danger-text); }
.spin { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: sp .6s linear infinite; margin: 0 auto 10px; }
@keyframes sp { to { transform: rotate(360deg); } }
.no-ch { text-align: center; padding: 28px 20px; color: var(--text-3); font-size: 13px; }

.product-head { margin-bottom: 24px; }
.product-head h2 { font-size: 20px; font-weight: 600; color: var(--text); letter-spacing: -.3px; }
.product-head p { font-size: 13px; color: var(--text-3); margin-top: 4px; max-width: 72ch; }
.product-head-actions { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ── Application shell (KP Hub aligned) ─────────────────────────────────── */
.app-shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; padding: 28px 16px 20px; border-right: 1px solid var(--border); background: var(--bg); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 12px 32px; text-decoration: none !important; color: var(--text); }
.brand .logo svg { height: 28px; width: auto; display: block; }
/* The logo box includes the checker above the wordmark: the label sits on the
   wordmark's own band (bottom 62% of the logo). */
.brand small { align-self: flex-end; height: 18px; padding-left: 12px; border-left: 1px solid var(--border-strong); font-size: 15px; line-height: 24px; font-weight: 600; color: var(--text-2); letter-spacing: -.01em; }
.nav { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.nav a { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 10px 12px; border-radius: 4px; color: var(--text-3); font-size: 14px; text-decoration: none; }
.nav a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.nav a.active { color: var(--accent-text); background: var(--accent-soft); font-weight: 600; }
.nav svg, .side-action svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-badge { margin-left: auto; padding: 1px 6px; border-radius: 3px; background: var(--accent-soft); color: var(--accent-text); font-size: 11px; font-weight: 600; }
.nav a.active .nav-badge { background: var(--bg); }
.sidebar-account { margin-top: auto; padding-top: 20px; }
.sidebar-account > .btn { width: 100%; min-height: 40px; }
/* The account card holds the identity only; Licence and Sign out stay below it, as sidebar actions. */
.account-card { display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: center; gap: 10px; margin-bottom: 6px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-surface); }
.account-avatar { display: grid; place-items: center; align-self: start; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.account-text { min-width: 0; }
.account-name, .account-mail { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.account-name { color: var(--text); font-size: 13px; font-weight: 600; line-height: 1.35; }
.account-mail { color: var(--text-3); font-size: 12px; line-height: 1.4; }
.account-mail { cursor: pointer; border-radius: 3px; }
.account-mail:hover { color: var(--text-2); }
.account-mail:focus-visible { outline: 2px solid var(--danger); outline-offset: 2px; }
.account-mail.is-open { white-space: normal; overflow-wrap: anywhere; }
.account-detail { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px !important; }
.account-chip { padding: 1px 6px; border-radius: 3px; background: var(--accent-soft); color: var(--accent-text); font-size: 11px; font-weight: 600; line-height: 1.5; }
.side-action { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 10px 12px; border: 0; border-radius: 4px; background: transparent; color: var(--text-3); font: inherit; cursor: pointer; text-align: left; }
.side-action:hover { background: var(--bg-hover); color: var(--text); }
.workspace { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; padding: 0 32px; border-bottom: 1px solid var(--border); background: var(--bg); color: var(--text-3); font-size: 12px; }
.crumbs { display: flex; align-items: center; gap: 10px; min-width: 0; }
.crumbs svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.crumbs strong { color: var(--text); font-weight: 400; }
.preferences { display: flex; align-items: center; gap: 8px; }
/* Language and theme: small segmented controls, the pressed one raised, hover only tinted. */
.switch { display: flex; gap: 2px; padding: 2px; border: 1px solid var(--border-strong); border-radius: 7px; background: var(--bg-surface); }
.switch button { display: grid; place-items: center; min-width: 28px; height: 24px; padding: 0 6px; border: 0; border-radius: 5px; background: transparent; color: var(--text-3); font: 700 11px Arial, sans-serif; letter-spacing: .04em; cursor: pointer; }
.switch button svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.switch button:hover { color: var(--text); }
.switch button[aria-pressed="true"] { background: var(--bg); color: var(--accent-text); box-shadow: 0 1px 2px rgba(25, 24, 20, .14); }
#main { flex: 1; width: 100%; max-width: 880px; margin: 0 auto; padding: 32px; }
body.wide-view #main { max-width: 1160px; }
.foot { padding: 20px 32px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); text-align: center; margin-top: auto; }
.foot strong { color: var(--text-2); font-weight: 600; }
.view-foot { margin-top: 32px; color: var(--text-3); font-size: 12px; max-width: 80ch; }

/* Landing: a public page, outside the application shell. */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; max-width: 1120px; margin: 0 auto; padding: 24px 32px; }
.site-header .brand { padding: 0; }
.site-header-end { display: flex; align-items: center; gap: 16px; }
.site-header-end > .btn { min-height: 40px; padding: 10px 16px; }
.is-landing .app-shell { display: block; }
.is-landing .sidebar, .is-landing .topbar { display: none; }
.is-landing #main { max-width: 1120px; padding-top: 8px; padding-bottom: 56px; }
.is-landing .foot { border-top: 0; }
.is-landing .hero-copy { padding: 56px 48px; }
.is-landing .hero h1 { font-size: clamp(30px, 4.2vw, 46px); }

/* Welcome */
.welcome { display: grid; gap: 24px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(260px, .85fr); overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.hero-copy { padding: 44px 40px; }
.hero h1 { margin: 0 0 16px; color: var(--text); font-size: clamp(28px, 3.6vw, 38px); line-height: 1.12; letter-spacing: -.03em; font-weight: 700; text-wrap: balance; }
.hero p { max-width: 46ch; margin: 0; font-size: 15px; line-height: 1.7; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 28px; }
.hero-actions .btn { min-height: 44px; padding: 12px 18px; font-size: 13px; }
.flow { position: relative; display: flex; flex-direction: column; justify-content: center; padding: 36px 32px; background-color: var(--accent-soft);
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 24px 24px; background-position: -1px -1px; }
.flow-node { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--bg); box-shadow: 0 4px 12px rgba(0, 29, 81, .08); }
.flow-node strong { color: var(--text); font-size: 13px; }
.flow-node small { color: var(--text-3); font-size: 12px; }
.flow-core { border-color: var(--accent); }
.flow-core strong { color: var(--accent-text); }
.flow-link { position: relative; height: 34px; margin-left: 28px; border-left: 2px dashed var(--border-strong); }
.flow-link::after { content: ''; position: absolute; left: -5px; top: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: flow-packet 2.4s cubic-bezier(.45, 0, .55, 1) infinite; }
.flow-link + .flow-node + .flow-link::after { animation-delay: 1.2s; }
@keyframes flow-packet { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { transform: translateY(26px); opacity: 0; } }
.tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.tool { display: flex; flex-direction: column; padding: 28px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); scroll-margin-top: 24px; }
.tool-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.tool-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-text); }
.tool-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tool h2 { margin: 0; color: var(--text); font-size: 18px; font-weight: 600; }
.tool > p { margin: 0; line-height: 1.65; }
.tool ul { display: grid; gap: 10px; margin: 20px 0 24px; padding: 0; list-style: none; }
.tool li { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; line-height: 1.55; }
.tool li svg { width: 16px; height: 16px; margin-top: 2px; fill: none; stroke: var(--accent-text); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tool li strong { color: var(--text); }
.tool-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: auto; padding-top: 20px; border-top: 1px solid var(--border); }
.tool-foot .btn { min-height: 40px; }
.tool-note { font-size: 12px; color: var(--text-3); }
.support { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; padding: 20px 28px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.support p { margin: 0; color: var(--text); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.welcome > * { animation: rise .7s cubic-bezier(.16, 1, .3, 1) both; }
.welcome > :nth-child(2) { animation-delay: .08s; }
.welcome > :nth-child(3) { animation-delay: .16s; }

/* ── Standalone pages (privacy, moved-page notices) ─────────────────────── */
body.standalone .site-header { border-bottom: 1px solid var(--border); max-width: none; background: var(--bg); }
body.standalone .site-header img { display: block; object-fit: contain; }
.standalone-main { width: 100%; max-width: 780px; margin: 0 auto; padding: 32px; flex: 1; }
.standalone-main h1 { color: var(--text); font-size: 28px; line-height: 1.2; margin: 8px 0 12px; letter-spacing: -.02em; }
.standalone-main h2 { font-size: 18px; margin: 28px 0 8px; }
.standalone-main p { max-width: 72ch; margin: 0 0 12px; line-height: 1.6; }
.standalone-main .meta-line { color: var(--text-3); font-size: 13px; }

/* ── Motion and responsive ───────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; scroll-behavior: auto !important; }
  .flow-link::after { display: none; }
  .spin { animation: none; border-top-color: var(--border-strong); }
}
@media (max-width: 1000px) {
  .hero { grid-template-columns: 1fr; }
  .flow { padding: 28px; }
  .split { grid-template-columns: 1fr; }
  .queue-list { max-height: 40vh; }
}
@media (max-width: 760px) {
  .app-shell { display: flex; flex-direction: column; }
  .sidebar { position: static; height: auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 16px; border-right: 0; border-bottom: 1px solid var(--border); overflow: visible; }
  .brand { padding: 0; }
  /* Wrap rather than scroll: a sideways-scrolling nav hid Groups on phones. */
  .nav { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
  .nav a { min-height: 44px; padding: 10px 12px; white-space: nowrap; }
  .nav a svg { display: none; }
  .sidebar-account { grid-column: 2; grid-row: 1; margin: 0; padding: 0; }
  .sidebar-account > .btn { width: auto; min-height: 44px; padding: 8px 14px; }
  #profileMenu:not([hidden]) { display: flex; align-items: center; gap: 4px; }
  .account-card { display: block; margin: 0; padding: 0; border: 0; background: none; }
  .account-text { display: none; }
  #profileActions { display: flex; gap: 2px; }
  .side-action { width: auto; min-height: 44px; padding: 10px; }
  .side-action span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .topbar { min-height: 52px; padding: 0 16px; }
  .crumbs { display: none; }
  .preferences { margin-left: auto; }
  .switch button { min-width: 36px; height: 32px; }
  #main, .standalone-main { padding: 20px 16px; }
  .site-header { flex-wrap: wrap; padding: 16px; }
  .site-header-end { display: contents; }
  .site-header .preferences { order: 3; width: 100%; justify-content: flex-end; }
  .tools, .segmented { grid-template-columns: 1fr; }
  .hero-copy, .is-landing .hero-copy { padding: 28px 22px; }
  .tool { padding: 22px; }
  .support { padding: 18px 22px; }
  .panel { padding: 16px; }
  .meta { grid-template-columns: 1fr; gap: 0; }
  .meta dd { margin-bottom: 6px; }
  /* 44 px touch targets */
  .btn, .btn-small, .tab, .older-btn, .queue-item, .filter-chips .btn, .gate-btn,
  .native-view input:not([type="checkbox"]):not([type="radio"]), .native-view select { min-height: 44px; }
  .check input { width: 22px; height: 22px; }
  .card-main { padding: 12px 14px; }
  .card-actions { width: 100%; }
  .card-actions .btn { flex: 1; }
  .tabs { width: 100%; }
  .tab { flex: 1; text-align: center; padding: 5px 6px; font-size: 11px; }
  .older-row { padding: 8px 14px; }
  .older-actions { width: 100%; }
  .older-actions .btn { flex: 1; }
  .gate { padding: 20px 16px; }
  .gate-box { max-width: 100%; }
  .modal-overlay { padding: 12px; }
  .modal { max-width: 100%; }
  .modal-body { padding: 16px; }
  .modal-meta { gap: 12px; }
}
