/* Tokens and base adapted from the AuditLink pilot; accent changed to set this demo apart. */
:root {
  color-scheme: dark;
  --bg: #0b111b;
  --surface: #121b29;
  --surface2: #182436;
  --sidebar: #0e1622;
  --ink: #e6ecf5;
  --muted: #9aa8bb;
  --line: #26344a;
  --accent: #8ab4ff;
  --accent-ink: #0b1a33;
  --accent-soft: #1a2c4d;
  --good: #8fd9b4;
  --good-bg: #15342a;
  --info: #a9c4ff;
  --info-bg: #1a2a47;
  --warn: #e9c77f;
  --warn-bg: #352d1b;
  --bad: #ffaba3;
  --bad-bg: #3d2328;
  --radius: 14px;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
button, input, select, textarea { font: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { font-size: 34px; line-height: 1.15; letter-spacing: -1.1px; margin-bottom: 12px; }
h2 { font-size: 17px; letter-spacing: -.3px; line-height: 1.3; margin: 0; }
h3 { font-size: 15px; margin-bottom: 6px; }
h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--muted); margin-bottom: 10px; }
p { color: var(--muted); }
small { font-size: 12px; color: var(--muted); }
code { font-family: Consolas, monospace; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 8px; min-height: 40px; padding: 8px 14px;
  font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
  background: var(--surface2); color: var(--ink); text-decoration: none;
}
button:hover, .button:hover { filter: brightness(1.15); text-decoration: none; }
button:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.secondary { background: transparent; }
.quiet { background: none; border: 0; color: var(--muted); min-height: 36px; padding: 4px 10px; font-size: 16px; }
.danger { color: var(--bad); }

.skip { position: fixed; left: 8px; top: -60px; padding: 12px; background: var(--surface); z-index: 100; }
.skip:focus { top: 8px; }
.loading { padding: 100px; text-align: center; color: var(--muted); }

/* Layout */
.layout { min-height: 100vh; display: grid; grid-template-columns: 268px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; background: var(--sidebar);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 28px 18px 20px; gap: 22px;
}
.brand { position: relative; display: block; padding-left: 46px; font-size: 18px; font-weight: 650; letter-spacing: -.5px; color: var(--ink); line-height: 1.15; }
.brand:hover { text-decoration: none; }
.brand img { width: 36px; height: 36px; position: absolute; left: 0; top: 0; }
.brand span { display: block; text-transform: uppercase; letter-spacing: 2px; font-size: 9px; margin-top: 5px; color: var(--muted); }
.sidebar .new { width: 100%; }
.sidebar nav { flex: 1; overflow-y: auto; border-top: 1px solid var(--line); padding-top: 14px; }
.nav-title { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); margin: 0 10px 8px; font-weight: 600; }
.sidebar nav a { display: block; color: #c3cedd; font-size: 14px; padding: 9px 10px; border-radius: 8px; margin: 2px 0; }
.sidebar nav a small { display: block; font-size: 11px; }
.sidebar nav a:hover { background: var(--surface2); text-decoration: none; }
.sidebar nav a[aria-current] { background: var(--accent-soft); color: var(--accent); }
.nav-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-empty { font-size: 13px; padding: 0 10px; }
.sidebar-foot { font-size: 11px; margin: 0; border-top: 1px solid var(--line); padding-top: 16px; }
.workspace { min-width: 0; }
main { padding: 40px 44px 64px; max-width: 1320px; margin: auto; outline: none; }

.eyebrow { font-size: 10px; font-weight: 650; letter-spacing: 2.3px; color: var(--accent); margin-bottom: 12px; }
.page-heading { margin-bottom: 24px; }
.page-heading p { max-width: 760px; margin-bottom: 0; font-size: 15px; }
.lead { color: var(--ink); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 28px; overflow-x: auto; }
.tabs a, .tabs span { padding: 10px 16px; font-size: 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a[aria-current] { color: var(--accent); border-bottom-color: var(--accent); }
.tabs span[aria-disabled] { opacity: .45; cursor: not-allowed; }

/* Panels and metrics */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 24px; min-width: 0; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.columns { display: grid; grid-template-columns: 1fr 1.3fr; gap: 24px; align-items: start; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.metrics.two { grid-template-columns: repeat(2, 1fr); }
.metric { border: 1px solid var(--line); background: var(--surface); padding: 18px 20px; border-radius: var(--radius); min-width: 0; }
.metric span { display: block; font-size: 12px; color: var(--muted); }
.metric strong { display: block; font-size: 26px; font-weight: 600; line-height: 1.3; letter-spacing: -.5px; overflow-wrap: anywhere; }
.metric small { display: block; }
.mini-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.mini-metrics .metric { padding: 12px 14px; background: var(--surface2); }
.mini-metrics .metric strong { font-size: 19px; }
.quads { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.quads .panel { margin-bottom: 0; }
.quads + .panel { margin-top: 24px; }
.big { font-size: 52px; font-weight: 600; letter-spacing: -2px; color: var(--ink); line-height: 1; margin-bottom: 12px; }
.big small { font-size: 18px; letter-spacing: 0; }
.provenance { font-size: 13px; margin-bottom: 18px; }

/* Bars */
.bars { list-style: none; padding: 0; margin: 0; }
.bars li { display: grid; grid-template-columns: minmax(0, 1fr) 120px 32px; align-items: center; gap: 12px; padding: 7px 0; font-size: 13px; border-top: 1px solid var(--line); }
.bars li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars b { text-align: right; }
meter { width: 100%; height: 10px; }
meter::-webkit-meter-bar { background: var(--surface2); border: 0; border-radius: 6px; height: 10px; }
meter::-webkit-meter-optimum-value { background: var(--good); border-radius: 6px; }
meter::-webkit-meter-suboptimum-value { background: var(--warn); border-radius: 6px; }
meter::-webkit-meter-even-less-good-value { background: var(--bad); border-radius: 6px; }
meter::-moz-meter-bar { background: var(--good); border-radius: 6px; }

/* Lists, badges, notes */
.bullets { padding-left: 0; list-style: none; margin: 0 0 14px; }
.bullets li { padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; color: #ccd5e2; }
.bullets li:first-child { border-top: 0; }
.badge { display: inline-block; vertical-align: middle; padding: 3px 8px; border: 1px solid #34445c; border-radius: 5px; color: #c0cada; background: #1b2638; font-size: 11px; line-height: 1.4; white-space: nowrap; }
.badge.good { color: var(--good); background: var(--good-bg); border-color: #2c5a45; }
.badge.info { color: var(--info); background: var(--info-bg); border-color: #2f4670; }
.badge.warn { color: var(--warn); background: var(--warn-bg); border-color: #5c4c2c; }
.badge.bad { color: var(--bad); background: var(--bad-bg); border-color: #60353a; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.note { padding: 12px 16px; border-left: 3px solid var(--warn); border-radius: 0 8px 8px 0; background: var(--warn-bg); color: #e3d4ac; font-size: 13px; margin: 0 0 16px; }
.note.info { border-color: var(--info); background: var(--info-bg); color: #c9d7f5; }
.note.bad { border-color: var(--bad); background: var(--bad-bg); color: #f3c9c4; }
.small { font-size: 12px; }
.demo-banner { margin: 0; padding: 10px 44px; border-bottom: 1px solid var(--line); background: var(--warn-bg); color: #e3d4ac; font-size: 13px; }

/* Home */
.demo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.demo { border: 1px solid var(--line); border-radius: 12px; padding: 18px; background: var(--surface2); display: flex; flex-direction: column; }
.demo p { font-size: 13px; flex: 1; }
.demo button { align-self: flex-start; }

/* Steps */
.steps .step { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 14px; padding: 16px 0; border-top: 1px solid var(--line); align-items: start; }
.steps .step:first-child { border-top: 0; padding-top: 0; }
.step-pos { color: var(--accent); font-family: Consolas, monospace; font-size: 13px; padding-top: 2px; }
.step-body h3 { margin-bottom: 2px; }
.step-body p { font-size: 13px; margin-bottom: 8px; }
.step-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.step-actions button { min-height: 34px; font-size: 13px; padding: 5px 10px; }

/* Assessments */
.assessment { border-top: 1px solid var(--line); }
.assessment:first-of-type { border-top: 0; }
.assessment summary { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 14px 4px; cursor: pointer; list-style: none; }
.assessment summary::-webkit-details-marker { display: none; }
.assessment summary:hover .assessment-name { color: var(--accent); }
.assessment[open] summary { border-bottom: 1px dashed var(--line); }
.assessment-name { font-weight: 600; }
.assessment-hours { font-size: 13px; color: var(--muted); white-space: nowrap; }
.assessment-body { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; padding: 18px 4px; }
.assessment-body p { font-size: 13px; }
.override { background: var(--surface2); border-radius: 10px; padding: 16px; margin: 0 4px 18px; }
.override .form-grid { grid-template-columns: 1fr 1fr 2fr; margin-bottom: 10px; }

/* Blueprint */
.blueprint-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.blueprint-head p { margin: 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.workflow { margin: 0; padding-left: 22px; }
.workflow li { padding: 6px 0; font-size: 14px; color: #ccd5e2; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: #8d9db3; font-weight: 500; padding: 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 10px; border-bottom: 1px solid #1f2b3d; vertical-align: top; }
td small { display: block; margin-top: 2px; }
td .button { min-height: 32px; padding: 4px 12px; font-size: 13px; }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
label { font-size: 13px; font-weight: 500; color: #bfcadb; display: block; }
label small { display: block; margin-top: 5px; font-weight: 400; }
input, select, textarea { display: block; width: 100%; border: 1px solid #33445e; border-radius: 7px; background: #0c1420; color: var(--ink); padding: 10px 12px; margin-top: 6px; font-size: 14px; min-height: 42px; }
input[aria-invalid], select[aria-invalid], textarea[aria-invalid] { border-color: var(--bad); }
textarea { resize: vertical; }
input[type=checkbox] { width: 18px; min-height: 18px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
input[type=range] { padding: 0; min-height: 28px; border: 0; background: none; accent-color: var(--accent); margin: 0; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; }
.wide { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px 6px; margin: 0; min-width: 0; }
legend { font-size: 12px; color: var(--muted); padding: 0 6px; }
fieldset.flags { display: flex; gap: 22px; flex-wrap: wrap; padding-bottom: 14px; }
.range { margin-bottom: 10px; }
.range-row { display: grid; grid-template-columns: 1fr 52px; gap: 12px; align-items: center; }
output { font-size: 13px; text-align: right; color: var(--ink); }
.form-error { color: var(--bad); font-size: 13px; white-space: pre-line; margin: 0 0 12px; }
.form-error:empty { display: none; }
.field-error { display: block; color: var(--bad); font-size: 12px; margin-top: 4px; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Empty, dialog, toast */
.empty { padding: 28px 12px; text-align: center; }
.empty p { font-size: 13px; max-width: 360px; margin: 0 auto; }
.empty-icon { display: block; font-size: 30px; color: #5e7699; margin-bottom: 8px; }
dialog { max-width: 760px; width: calc(100% - 32px); border: 1px solid #3a4f72; border-radius: 16px; background: var(--surface); color: var(--ink); padding: 28px; max-height: 90vh; }
dialog::backdrop { background: #03070dcc; backdrop-filter: blur(4px); }
dialog h2 { font-size: 21px; margin-bottom: 18px; }
.dialog-close { margin-top: 8px; }
#toast { position: fixed; bottom: 24px; right: 24px; max-width: 440px; z-index: 200; background: #1d3352; border: 1px solid #3c5a8a; border-radius: 10px; padding: 14px 20px; font-size: 14px; box-shadow: 0 8px 30px #0008; display: none; }
#toast.show { display: block; }
#toast.error { background: #462b2d; border-color: #794248; }

@media (max-width: 1150px) {
  .columns, .quads { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .demo-grid { grid-template-columns: 1fr 1fr; }
  .mini-metrics { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; width: 100%; padding: 16px; gap: 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar nav { display: flex; gap: 6px; overflow-x: auto; padding-top: 10px; }
  .sidebar nav a { flex: none; max-width: 220px; }
  .nav-title, .sidebar-foot { display: none; }
  main { padding: 24px 16px 48px; }
  .demo-banner { padding: 10px 16px; }
  h1 { font-size: 27px; }
  .demo-grid, .metrics, .metrics.two, .form-grid, .assessment-body, .override .form-grid { grid-template-columns: 1fr; }
  .steps .step { grid-template-columns: 28px minmax(0, 1fr); }
  .step-actions { grid-column: 2; justify-content: flex-start; }
  .assessment summary { grid-template-columns: 28px minmax(0, 1fr); }
  .assessment summary .tags, .assessment-hours { grid-column: 2; }
  .bars li { grid-template-columns: minmax(0, 1fr) 80px 28px; }
  #toast { left: 16px; right: 16px; bottom: 16px; }
}
