/* WIRE Design System — foundations + full component library */

:root {
  --wire-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --wire-serif: "Fraunces", "Source Serif 4", "Georgia", serif;
  --wire-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, Menlo, monospace;

  --fs-12: 12px; --fs-13: 13px; --fs-14: 14px; --fs-15: 15px;
  --fs-16: 16px; --fs-18: 18px; --fs-20: 20px; --fs-24: 24px;
  --fs-32: 32px; --fs-44: 44px; --fs-64: 64px;

  --s-2: 2px;  --s-4: 4px;  --s-6: 6px;  --s-8: 8px;
  --s-12: 12px; --s-16: 16px; --s-20: 20px; --s-24: 24px;
  --s-32: 32px; --s-40: 40px; --s-56: 56px; --s-80: 80px;

  --r-0: 0px; --r-s: 4px; --r-m: 8px; --r-l: 14px; --r-pill: 999px;
  --r: var(--r-0);

  --sh-s: 0 1px 2px rgba(10,10,10,.06), 0 1px 1px rgba(10,10,10,.04);
  --sh-m: 0 4px 12px rgba(10,10,10,.08), 0 2px 4px rgba(10,10,10,.05);
  --sh-l: 0 14px 32px rgba(10,10,10,.10), 0 6px 12px rgba(10,10,10,.06);
  --sh: none;

  --bw-1: 1px; --bw-2: 2px;

  --ink-0: #0a0a0a; --ink-1: #1a1a1a; --ink-2: #2a2a2a; --ink-3: #555;
  --ink-4: #888; --ink-5: #b8b8b8;
  --line-1: #1a1a1a; --line-2: #888; --line-3: #d4d4d4;
  --paper: #fafaf7; --paper-2: #f2f2ee; --paper-3: #e8e8e3;
  --highlight: #fff3a8;
  --accent: #4f7af7; --accent-ink: #2d5ae3;
  --good: #2f9e6e; --warn: #c89030; --bad: #d65858;
}

[data-theme="dark"] {
  --sh-s: 0 1px 2px rgba(0,0,0,.5), 0 1px 1px rgba(0,0,0,.4);
  --sh-m: 0 4px 12px rgba(0,0,0,.55), 0 2px 4px rgba(0,0,0,.4);
  --sh-l: 0 14px 32px rgba(0,0,0,.6), 0 6px 12px rgba(0,0,0,.4);
  --ink-0: #f4f4ef; --ink-1: #ececea; --ink-2: #d8d8d4; --ink-3: #a8a8a4;
  --ink-4: #757572; --ink-5: #4a4a48;
  --line-1: #ececea; --line-2: #757572; --line-3: #3a3a38;
  --paper: #111110; --paper-2: #1a1a18; --paper-3: #232321;
  --highlight: #5a4a00;
  --accent: #a0b5ff; --accent-ink: #d0d8ff;
  --good: #7fd9a9; --warn: #ecc77a; --bad: #ffa3a3;
}

[data-radius="s"] { --r: var(--r-s); }
[data-radius="m"] { --r: var(--r-m); }
[data-radius="l"] { --r: var(--r-l); }
[data-shadow="s"] { --sh: var(--sh-s); }
[data-shadow="m"] { --sh: var(--sh-m); }
[data-shadow="l"] { --sh: var(--sh-l); }

[data-font="inter-source"] {
  --wire-sans: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --wire-serif: "Source Serif 4", "Source Serif Pro", "Georgia", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--wire-sans); font-size: var(--fs-15); line-height: 1.5;
  color: var(--ink-1); background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4,h5,h6,p { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

.t-display { font-family: var(--wire-serif); font-size: var(--fs-64); line-height: 1.05; letter-spacing: -0.02em; font-weight: 400; }
.t-h1 { font-family: var(--wire-serif); font-size: var(--fs-44); line-height: 1.1; letter-spacing: -0.015em; font-weight: 400; }
.t-h2 { font-family: var(--wire-serif); font-size: var(--fs-32); line-height: 1.15; letter-spacing: -0.01em; font-weight: 400; }
.t-h3 { font-family: var(--wire-sans); font-size: var(--fs-20); line-height: 1.3; font-weight: 600; }
.t-h4 { font-family: var(--wire-sans); font-size: var(--fs-16); line-height: 1.35; font-weight: 600; }
.t-body { font-size: var(--fs-15); line-height: 1.55; color: var(--ink-2); }
.t-small { font-size: var(--fs-13); line-height: 1.45; color: var(--ink-3); }
.t-mono { font-family: var(--wire-mono); font-size: var(--fs-12); letter-spacing: 0.02em; color: var(--ink-3); text-transform: uppercase; }
.t-eyebrow { font-family: var(--wire-mono); font-size: var(--fs-12); letter-spacing: 0.12em; color: var(--ink-3); text-transform: uppercase; }
.t-serif { font-family: var(--wire-serif); }

.row { display: flex; gap: var(--s-12); align-items: center; }
.col { display: flex; flex-direction: column; gap: var(--s-12); }
.between { justify-content: space-between; }
.muted { color: var(--ink-3); }
.dim { color: var(--ink-4); }
.divider { height: 1px; background: var(--line-3); width: 100%; }

/* Sketch placeholder */
.sketch {
  position: relative; border-radius: var(--r);
  background-color: var(--paper-2);
  background-image: repeating-linear-gradient(135deg, transparent 0 6px, var(--line-3) 6px 7px);
  border: var(--bw-1) solid var(--line-2);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--wire-mono); font-size: var(--fs-12); color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.sketch--dashed { border-style: dashed; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: var(--s-8);
  padding: 10px 16px;
  border: var(--bw-1) solid var(--line-1);
  background: var(--paper); color: var(--ink-1);
  font-size: var(--fs-14); font-weight: 500;
  border-radius: var(--r);
  box-shadow: var(--sh);
  transition: transform .06s ease, background .12s ease, border-color .12s ease;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--paper-2); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--ink-1); color: var(--paper); border-color: var(--ink-1); }
.btn--primary:hover { background: var(--ink-0); }
.btn--ghost { border-color: transparent; box-shadow: none; }
.btn--ghost:hover { background: var(--paper-2); border-color: var(--line-3); }
.btn--accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn--accent:hover { background: color-mix(in oklab, var(--accent) 80%, var(--paper)); border-color: color-mix(in oklab, var(--accent) 80%, var(--paper)); color: #fff; }
[data-theme="dark"] .btn--accent { color: var(--paper); }
[data-theme="dark"] .btn--accent:hover { color: var(--paper); }
.btn--danger { color: var(--bad); border-color: var(--bad); background: var(--paper); }
.btn--danger:hover { background: color-mix(in oklab, var(--bad) 12%, var(--paper)); border-color: var(--bad); color: var(--bad); }
.btn--primary:hover { background: var(--ink-0); color: var(--paper); }
.btn--sm { padding: 6px 10px; font-size: var(--fs-13); }
.btn--lg { padding: 14px 22px; font-size: var(--fs-16); }
.btn--icon { padding: 8px; }
.btn--pill { border-radius: var(--r-pill); }
.btn[disabled] { opacity: .4; cursor: not-allowed; }

/* Button group (segmented) */
.btn-group { display: inline-flex; border: 1px solid var(--line-1); border-radius: var(--r); overflow: hidden; box-shadow: var(--sh); }
.btn-group .btn { border: 0; border-right: 1px solid var(--line-3); border-radius: 0; box-shadow: none; }
.btn-group .btn:last-child { border-right: 0; }
.btn-group .btn--active { background: var(--ink-1); color: var(--paper); }

/* Chips */
.chip {
  display: inline-flex; align-items: center; gap: var(--s-6);
  padding: 5px 10px;
  border: var(--bw-1) solid var(--line-2);
  background: transparent; color: var(--ink-2);
  font-size: var(--fs-13);
  border-radius: var(--r);
  cursor: pointer;
}
.chip:hover { background: var(--paper-2); }
.chip--active { background: var(--ink-1); color: var(--paper); border-color: var(--ink-1); }
.chip--active:hover { background: var(--ink-0); color: var(--paper); border-color: var(--ink-0); }
.chip--pill { border-radius: var(--r-pill); }
.chip--count::after {
  content: attr(data-count);
  display: inline-grid; place-items: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--paper-2); color: var(--ink-2);
  font-family: var(--wire-mono); font-size: 11px;
  border-radius: var(--r);
}
.chip--active.chip--count::after { background: var(--paper); color: var(--ink-1); }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 6px;
  font-family: var(--wire-mono); font-size: 11px;
  letter-spacing: 0.06em; text-transform: uppercase;
  border: var(--bw-1) solid var(--line-2); color: var(--ink-2);
  border-radius: var(--r);
}
.badge--good { color: var(--good); border-color: var(--good); }
.badge--warn { color: var(--warn); border-color: var(--warn); }
.badge--bad { color: var(--bad); border-color: var(--bad); }
.badge--solid { background: var(--ink-1); color: var(--paper); border-color: var(--ink-1); }
.badge--dot::before { content: ''; width: 6px; height: 6px; background: currentColor; border-radius: 50%; }

/* Inputs */
.field { display: flex; flex-direction: column; gap: var(--s-4); }
.field label { font-family: var(--wire-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px;
  border: var(--bw-1) solid var(--line-1);
  background: var(--paper); color: var(--ink-1);
  font-size: var(--fs-14);
  border-radius: var(--r);
  outline: 0;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--ink-0);
  box-shadow: inset 0 -2px 0 var(--ink-1), var(--sh);
}
.input::placeholder { color: var(--ink-4); }
.field--error .input { border-color: var(--bad); }
.field--error .help { color: var(--bad); }
.help { font-size: var(--fs-12); color: var(--ink-3); }

/* Input addons (icon + suffix) */
.input-group { display: flex; align-items: stretch; border: 1px solid var(--line-1); border-radius: var(--r); background: var(--paper); box-shadow: var(--sh); overflow: hidden; }
.input-group .input { border: 0; box-shadow: none; }
.input-group__addon { padding: 0 12px; display: grid; place-items: center; color: var(--ink-3); border-right: 1px solid var(--line-3); font-family: var(--wire-mono); font-size: 12px; background: var(--paper-2); }
.input-group__addon--right { border-right: 0; border-left: 1px solid var(--line-3); }

/* Search combo */
.search { display: grid; grid-template-columns: 1fr 1fr auto; border: var(--bw-1) solid var(--line-1); background: var(--paper); border-radius: var(--r); box-shadow: var(--sh); overflow: hidden; }
.search > * { border: 0; padding: 12px 14px; background: transparent; }
.search > *:not(:last-child) { border-right: var(--bw-1) solid var(--line-3); }
.search button { background: var(--ink-1); color: var(--paper); padding: 0 22px; font-weight: 500; }

/* Cards */
.card {
  background: var(--paper); border: var(--bw-1) solid var(--line-1);
  padding: var(--s-20);
  display: flex; flex-direction: column; gap: var(--s-12);
  border-radius: var(--r);
  box-shadow: var(--sh);
}
.card--ghost { border-style: dashed; border-color: var(--line-2); box-shadow: none; }
.card--selected { box-shadow: inset 0 0 0 2px var(--ink-1), var(--sh); }
.card--flat { border: 0; background: var(--paper-2); box-shadow: none; }
.card__hd { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-12); }
.card__title { font-size: var(--fs-18); font-weight: 600; }

/* Tabs */
.tabs { display: flex; gap: var(--s-24); border-bottom: var(--bw-1) solid var(--line-3); }
.tab { padding: 12px 0; font-size: var(--fs-14); color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.tab:hover { color: var(--ink-1); }
.tab--active { color: var(--ink-0); border-bottom-color: var(--ink-1); font-weight: 500; }

/* Segmented control */
.segmented { display: inline-flex; padding: 3px; background: var(--paper-2); border-radius: var(--r); border: 1px solid var(--line-3); }
.segmented button { padding: 6px 12px; font-size: 13px; color: var(--ink-3); border-radius: calc(var(--r) - 1px); }
.segmented button.is-active { background: var(--paper); color: var(--ink-1); box-shadow: var(--sh-s); }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-14); }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: var(--bw-1) solid var(--line-3); }
.table th { font-family: var(--wire-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); font-weight: 500; }
.table tr:hover td { background: var(--paper-2); }

/* Avatar */
.avatar { width: 32px; height: 32px; border: var(--bw-1) solid var(--line-1); border-radius: 50%; background: var(--paper-2); display: grid; place-items: center; font-family: var(--wire-mono); font-size: 11px; color: var(--ink-2); box-shadow: var(--sh); }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { margin-left: -8px; box-shadow: 0 0 0 2px var(--paper); }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* Toggle */
.toggle { width: 36px; height: 20px; border: var(--bw-1) solid var(--line-1); position: relative; cursor: pointer; border-radius: var(--r-pill); }
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; background: var(--ink-1); transition: left .15s ease; border-radius: 50%; }
.toggle--on { background: var(--ink-1); }
.toggle--on::after { left: 18px; background: var(--paper); }

/* Checkbox */
.check { width: 16px; height: 16px; border: var(--bw-1) solid var(--line-1); display: inline-grid; place-items: center; cursor: pointer; border-radius: calc(var(--r) * .5); }
.check--on { background: var(--ink-1); color: var(--paper); }
.check--on::after { content: '✓'; font-size: 12px; line-height: 1; }

/* Radio */
.radio { width: 16px; height: 16px; border: var(--bw-1) solid var(--line-1); border-radius: 50%; display: inline-grid; place-items: center; cursor: pointer; }
.radio--on::after { content: ''; width: 8px; height: 8px; background: var(--ink-1); border-radius: 50%; }

/* Slider */
.slider { display: flex; align-items: center; gap: 12px; height: 24px; }
.slider__track { flex: 1; height: 4px; background: var(--paper-3); position: relative; border-radius: var(--r-pill); }
.slider__fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ink-1); border-radius: var(--r-pill); }
.slider__thumb { position: absolute; top: 50%; width: 16px; height: 16px; background: var(--paper); border: 2px solid var(--ink-1); border-radius: 50%; transform: translate(-50%, -50%); box-shadow: var(--sh); }

/* Progress */
.progress { height: 4px; background: var(--paper-3); position: relative; border-radius: var(--r-pill); overflow: hidden; }
.progress__fill { position: absolute; top: 0; left: 0; bottom: 0; background: var(--ink-1); }

/* Stepper (multi-step indicator) */
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper__dot { width: 24px; height: 24px; border: 1px solid var(--line-1); border-radius: 50%; display: grid; place-items: center; font-family: var(--wire-mono); font-size: 11px; color: var(--ink-3); background: var(--paper); }
.stepper__dot--done { background: var(--ink-1); color: var(--paper); }
.stepper__dot--current { border: 2px solid var(--ink-1); color: var(--ink-1); font-weight: 600; }
.stepper__line { flex: 1; height: 1px; background: var(--line-3); min-width: 24px; }
.stepper__line--done { background: var(--ink-1); }

/* Toast */
.toast { display: flex; gap: var(--s-12); align-items: center; padding: 12px 16px; background: var(--ink-1); color: var(--paper); border: var(--bw-1) solid var(--ink-1); font-size: var(--fs-14); border-radius: var(--r); box-shadow: var(--sh); }

/* Alert / Banner */
.alert { display: flex; gap: 12px; padding: 12px 16px; border: 1px solid var(--line-1); background: var(--paper); border-radius: var(--r); align-items: flex-start; }
.alert__icon { width: 24px; height: 24px; border-radius: 50%; border: 1px solid currentColor; display: grid; place-items: center; flex: 0 0 24px; font-size: 12px; }
.alert--info { color: var(--accent); border-color: var(--accent); background: color-mix(in oklab, var(--accent) 6%, var(--paper)); }
.alert--good { color: var(--good); border-color: var(--good); background: color-mix(in oklab, var(--good) 6%, var(--paper)); }
.alert--warn { color: var(--warn); border-color: var(--warn); background: color-mix(in oklab, var(--warn) 6%, var(--paper)); }
.alert--bad { color: var(--bad); border-color: var(--bad); background: color-mix(in oklab, var(--bad) 6%, var(--paper)); }
.alert__body { color: var(--ink-1); font-size: 14px; }

/* Modal scaffold */
.modal { background: var(--paper); border: var(--bw-1) solid var(--line-1); padding: var(--s-24); max-width: 480px; border-radius: var(--r); box-shadow: var(--sh-l); }

/* Tooltip */
.tooltip { display: inline-block; padding: 4px 8px; background: var(--ink-1); color: var(--paper); font-size: 12px; border-radius: var(--r); box-shadow: var(--sh); position: relative; }
.tooltip::after { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 4px solid transparent; border-top-color: var(--ink-1); }

/* Popover / Menu */
.menu { background: var(--paper); border: 1px solid var(--line-1); border-radius: var(--r); box-shadow: var(--sh-l); padding: 4px; min-width: 180px; }
.menu__item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 14px; cursor: pointer; border-radius: calc(var(--r) * .8); color: var(--ink-1); }
.menu__item:hover { background: var(--paper-2); }
.menu__sep { height: 1px; background: var(--line-3); margin: 4px 0; }
.menu__hint { margin-left: auto; font-family: var(--wire-mono); font-size: 11px; color: var(--ink-4); }

/* Breadcrumb */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3); }
.breadcrumb a { color: var(--ink-3); text-decoration: none; }
.breadcrumb a:hover { color: var(--ink-1); }
.breadcrumb__sep { color: var(--ink-4); }

/* Pagination */
.pagination { display: flex; gap: 4px; align-items: center; }
.pagination__btn { min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid var(--line-3); background: var(--paper); color: var(--ink-2); font-size: 13px; border-radius: var(--r); display: grid; place-items: center; cursor: pointer; }
.pagination__btn:hover { background: var(--paper-2); }
.pagination__btn--active { background: var(--ink-1); color: var(--paper); border-color: var(--ink-1); }

/* KBD */
.kbd { display: inline-block; padding: 1px 6px; border: 1px solid var(--line-3); background: var(--paper-2); font-family: var(--wire-mono); font-size: 11px; color: var(--ink-2); border-radius: calc(var(--r) * .6); box-shadow: 0 1px 0 var(--line-3); }

/* Skeleton */
.skel { background: linear-gradient(90deg, var(--paper-2), var(--paper-3), var(--paper-2)); background-size: 200% 100%; animation: skel 1.4s ease-in-out infinite; border-radius: var(--r); height: 12px; }
@keyframes skel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Accordion */
.accordion { border: 1px solid var(--line-3); border-radius: var(--r); background: var(--paper); overflow: hidden; box-shadow: var(--sh); }
.accordion__item + .accordion__item { border-top: 1px solid var(--line-3); }
.accordion__hd { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; cursor: pointer; }
.accordion__hd:hover { background: var(--paper-2); }
.accordion__caret { font-family: var(--wire-mono); }
.accordion__body { padding: 0 16px 16px; color: var(--ink-2); font-size: 14px; }

/* Tag (input) */
.tag-input { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border: 1px solid var(--line-1); border-radius: var(--r); background: var(--paper); box-shadow: var(--sh); align-items: center; min-height: 40px; }
.tag-input input { border: 0; outline: 0; flex: 1; min-width: 100px; background: transparent; padding: 4px 6px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; background: var(--paper-2); border: 1px solid var(--line-3); border-radius: var(--r); font-size: 12px; }
.tag__x { cursor: pointer; color: var(--ink-3); font-family: var(--wire-mono); }

/* Calendar */
.cal { border: 1px solid var(--line-1); padding: 12px; background: var(--paper); border-radius: var(--r); box-shadow: var(--sh); display: inline-block; }
.cal__hd { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-family: var(--wire-mono); font-size: 12px; }
.cal__grid { display: grid; grid-template-columns: repeat(7, 32px); gap: 2px; }
.cal__cell { height: 32px; display: grid; place-items: center; font-size: 13px; color: var(--ink-2); border-radius: var(--r); cursor: pointer; }
.cal__cell--head { color: var(--ink-4); font-family: var(--wire-mono); font-size: 10px; cursor: default; }
.cal__cell--dim { color: var(--ink-4); }
.cal__cell:hover:not(.cal__cell--head):not(.cal__cell--dim) { background: var(--paper-2); }
.cal__cell--sel { background: var(--ink-1); color: var(--paper); }
.cal__cell--today { box-shadow: inset 0 0 0 1px var(--accent); }

/* File upload */
.upload { border: 1px dashed var(--line-2); border-radius: var(--r); padding: 32px; text-align: center; color: var(--ink-3); background: var(--paper); }
.upload__title { font-weight: 600; color: var(--ink-1); margin-bottom: 4px; }

/* Code */
.code { background: var(--paper-2); border: 1px solid var(--line-3); border-radius: var(--r); padding: 12px 14px; font-family: var(--wire-mono); font-size: 12px; color: var(--ink-2); box-shadow: var(--sh); white-space: pre; overflow: auto; }

/* Stat */
.stat { display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 1px solid var(--line-3); border-radius: var(--r); background: var(--paper); box-shadow: var(--sh); }
.stat__label { font-family: var(--wire-mono); font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; }
.stat__value { font-family: var(--wire-serif); font-size: 32px; line-height: 1; }
.stat__delta { font-size: 12px; }

/* Timeline */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline__item { display: grid; grid-template-columns: 32px 1fr; gap: 12px; padding-bottom: 16px; position: relative; }
.timeline__item::before { content: ''; position: absolute; left: 11px; top: 24px; bottom: 0; width: 1px; background: var(--line-3); }
.timeline__item:last-child::before { display: none; }
.timeline__dot { width: 24px; height: 24px; background: var(--paper); border: 1px solid var(--line-1); border-radius: 50%; display: grid; place-items: center; z-index: 1; font-family: var(--wire-mono); font-size: 10px; }
.timeline__dot--done { background: var(--ink-1); color: var(--paper); }

/* List row */
.list-row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; padding: 12px 14px; border: 1px solid var(--line-3); border-radius: var(--r); background: var(--paper); align-items: center; box-shadow: var(--sh); }
.list-row + .list-row { margin-top: 8px; }
.list-row:hover { background: var(--paper-2); }

/* Tree */
.tree { font-size: 14px; }
.tree__node { padding: 4px 8px; display: flex; align-items: center; gap: 6px; cursor: pointer; border-radius: calc(var(--r) * .8); }
.tree__node:hover { background: var(--paper-2); }
.tree__node--active { background: var(--paper-2); font-weight: 500; }
.tree__caret { font-family: var(--wire-mono); width: 12px; color: var(--ink-3); }
.tree__children { padding-left: 16px; border-left: 1px dashed var(--line-3); margin-left: 6px; }

/* Wireframe primitives */
.wf-text { display: block; height: 8px; background: var(--ink-5); border-radius: var(--r); }
.wf-text--lg { height: 14px; background: var(--ink-3); }
.wf-text--md { height: 10px; background: var(--ink-4); }
.wf-text--sm { height: 6px; background: var(--ink-5); }
.wf-lines { display: flex; flex-direction: column; gap: 6px; }
.wf-lines .wf-text:last-child { width: 60%; }
.wf-block {
  background-color: var(--paper-2);
  background-image: repeating-linear-gradient(135deg, transparent 0 6px, var(--line-3) 6px 7px);
  border: 1px solid var(--line-2); border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--wire-mono); font-size: 11px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .08em;
}
.wf-block--dashed { border-style: dashed; }
.wf-avatar { width: 32px; height: 32px; border: 1px solid var(--line-1); border-radius: 50%; background: var(--paper-2); display: grid; place-items: center; font-family: var(--wire-mono); font-size: 11px; color: var(--ink-3); }

/* Icons — unified system. All icons render at 20px box, 1.5 stroke, currentColor */
.ico { width: 20px; height: 20px; flex: 0 0 20px; display: inline-block; vertical-align: middle; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.ico--sm { width: 16px; height: 16px; flex-basis: 16px; }
.ico--lg { width: 24px; height: 24px; flex-basis: 24px; }
.ico--xl { width: 32px; height: 32px; flex-basis: 32px; }

/* Per-surface type scales — toggle via [data-surface] on the showcase area */
.surface { --fs-display: 64px; --fs-h1: 44px; --fs-h2: 32px; --fs-h3: 20px; --fs-body: 15px; --fs-small: 13px; --lh-display: 1.05; --lh-h1: 1.1; --lh-body: 1.55; }
.surface[data-surface="mobile"]  { --fs-display: 36px; --fs-h1: 28px; --fs-h2: 22px; --fs-h3: 17px; --fs-body: 15px; --fs-small: 13px; }
.surface[data-surface="tablet"]  { --fs-display: 48px; --fs-h1: 36px; --fs-h2: 26px; --fs-h3: 18px; --fs-body: 15px; --fs-small: 13px; }
.surface[data-surface="desktop"] { --fs-display: 64px; --fs-h1: 44px; --fs-h2: 32px; --fs-h3: 20px; --fs-body: 15px; --fs-small: 13px; }
.surface .t-display { font-size: var(--fs-display); line-height: var(--lh-display); }
.surface .t-h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); }
.surface .t-h2 { font-size: var(--fs-h2); }
.surface .t-h3 { font-size: var(--fs-h3); }

/* Sidebar / Nav rail / Drawer */
.sidebar { display: flex; flex-direction: column; gap: 2px; padding: 12px; background: var(--paper); border: 1px solid var(--line-3); border-radius: var(--r); box-shadow: var(--sh); min-width: 240px; }
.sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 8px 10px 16px; border-bottom: 1px dashed var(--line-3); margin-bottom: 8px; }
.sidebar__group { font-family: var(--wire-mono); font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .12em; padding: 14px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: calc(var(--r) * .8); color: var(--ink-2); cursor: pointer; font-size: 14px; }
.nav-item:hover { background: var(--paper-2); }
.nav-item--active { background: var(--paper-2); color: var(--ink-0); font-weight: 500; box-shadow: inset 2px 0 0 var(--ink-1); }
.nav-item__count { margin-left: auto; font-family: var(--wire-mono); font-size: 11px; color: var(--ink-3); padding: 1px 6px; border: 1px solid var(--line-3); border-radius: var(--r); }
.nav-rail { display: flex; flex-direction: column; gap: 4px; padding: 8px; background: var(--paper); border: 1px solid var(--line-3); border-radius: var(--r); width: 56px; align-items: center; box-shadow: var(--sh); }
.nav-rail .nav-item { width: 40px; height: 40px; padding: 0; justify-content: center; }
.nav-rail .nav-item--active { background: var(--ink-1); color: var(--paper); box-shadow: none; }
.tabbar { display: flex; padding: 8px 12px; background: var(--paper); border: 1px solid var(--line-3); border-radius: var(--r); box-shadow: var(--sh); justify-content: space-around; }
.tabbar__item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 12px; min-width: 56px; color: var(--ink-3); font-size: 12px; cursor: pointer; }
.tabbar__item--active { color: var(--ink-0); font-weight: 600; }
.drawer { width: 280px; background: var(--paper); border-right: 1px solid var(--line-1); padding: 16px; box-shadow: var(--sh-l); display: flex; flex-direction: column; gap: 4px; }
.megamenu { background: var(--paper); border: 1px solid var(--line-1); border-radius: var(--r); box-shadow: var(--sh-l); padding: 24px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.megamenu__col h5 { font-family: var(--wire-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); margin-bottom: 8px; font-weight: 500; }
.megamenu__col a { display: block; padding: 4px 0; color: var(--ink-2); font-size: 14px; }
.megamenu__col a:hover { color: var(--ink-0); }

/* Autocomplete */
.ac { position: relative; }
.ac__menu { position: relative; margin-top: 4px; background: var(--paper); border: 1px solid var(--line-1); border-radius: var(--r); box-shadow: var(--sh-l); padding: 4px; max-height: 240px; overflow: auto; }
.ac__item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 14px; cursor: pointer; border-radius: calc(var(--r) * .8); }
.ac__item:hover, .ac__item--active { background: var(--paper-2); }
.ac__item mark { background: var(--highlight); color: var(--ink-0); font-weight: 500; }

/* Aspect ratio */
.ar { position: relative; width: 100%; }
.ar::before { content: ''; display: block; padding-bottom: var(--ar, 56.25%); }
.ar > * { position: absolute; inset: 0; }
.ar--1\/1 { --ar: 100%; } .ar--4\/3 { --ar: 75%; } .ar--16\/9 { --ar: 56.25%; } .ar--3\/4 { --ar: 133.33%; } .ar--21\/9 { --ar: 42.85%; }

/* Circular progress */
.cprog { width: 32px; height: 32px; transform: rotate(-90deg); }
.cprog__bg { fill: none; stroke: var(--paper-3); stroke-width: 3; }
.cprog__fg { fill: none; stroke: var(--ink-1); stroke-width: 3; stroke-linecap: round; transition: stroke-dashoffset .3s; }
.cprog--indet { animation: cprog-spin 1s linear infinite; }
@keyframes cprog-spin { to { transform: rotate(270deg); } }

/* Sheet — bottom/side panel */
.sheet { background: var(--paper); border: 1px solid var(--line-1); border-radius: var(--r); box-shadow: var(--sh-l); padding: 20px; max-width: 480px; }
.sheet__handle { width: 36px; height: 4px; background: var(--line-2); border-radius: var(--r-pill); margin: -8px auto 12px; }
.sheet__hd { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px dashed var(--line-3); }

/* Link */
.link { color: var(--ink-1); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; cursor: pointer; }
.link:hover { color: var(--accent); text-decoration-thickness: 2px; }
.link--accent { color: var(--accent); }
.link--quiet { color: var(--ink-3); text-decoration-color: var(--line-3); }
.link--quiet:hover { color: var(--ink-0); text-decoration-color: var(--ink-1); }
.link--inline { display: inline-flex; align-items: center; gap: 4px; }

/* Divider */
.div-h { height: 1px; background: var(--line-3); width: 100%; }
.div-h--dashed { background: transparent; border-top: 1px dashed var(--line-3); height: 0; }
.div-v { width: 1px; background: var(--line-3); align-self: stretch; }
.div-label { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-family: var(--wire-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.div-label::before, .div-label::after { content: ''; flex: 1; height: 1px; background: var(--line-3); }

/* Grid demo */
.grid-demo { display: grid; gap: 8px; }
.grid-demo > div { background: var(--paper-2); border: 1px dashed var(--line-3); padding: 16px; text-align: center; font-family: var(--wire-mono); font-size: 11px; color: var(--ink-3); border-radius: var(--r); }

/* Hand-drawn box */
.handbox { border: var(--bw-1) solid var(--line-1); position: relative; padding: var(--s-12) var(--s-16); border-radius: var(--r); }
.handbox::before, .handbox::after { content: ''; position: absolute; width: 6px; height: 6px; background: var(--paper); border: 1px solid var(--line-1); }
.handbox::before { top: -4px; left: -4px; }
.handbox::after { bottom: -4px; right: -4px; }

/* Scribble */
.scribble { position: relative; display: inline-block; }
.scribble::after { content: ''; position: absolute; left: -2px; right: -2px; bottom: -4px; height: 6px; background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 6' preserveAspectRatio='none'><path d='M0 4 Q 10 0 20 3 T 40 3 T 60 3 T 80 3' fill='none' stroke='%231a1a1a' stroke-width='1.5'/></svg>") repeat-x; background-size: 80px 6px; }
[data-theme="dark"] .scribble::after { filter: invert(1); }

/* Search component (§02.36) */
.search-input { position: relative; display: flex; align-items: stretch; border: 1px solid var(--line-1); background: var(--paper); border-radius: var(--r); box-shadow: var(--sh); overflow: hidden; min-width: 240px; }
.search-input:focus-within { border-color: var(--ink-0); box-shadow: inset 0 -2px 0 var(--ink-1), var(--sh); }
.search-input--sm { font-size: var(--fs-13); }
.search-input--sm .search-input__field { padding: 6px 10px; }
.search-input--sm .search-input__icon { width: 28px; }
.search-input--lg .search-input__field { padding: 14px 16px; font-size: var(--fs-16); }
.search-input--lg .search-input__icon { width: 44px; }
.search-input--error { border-color: var(--bad); }
.search-input--error:focus-within { border-color: var(--bad); box-shadow: inset 0 -2px 0 var(--bad), var(--sh); }
.search-input--disabled { opacity: .5; pointer-events: none; background: var(--paper-2); }
.search-input__icon { width: 36px; display: grid; place-items: center; color: var(--ink-3); border-right: 1px solid var(--line-3); background: var(--paper-2); font-family: var(--wire-mono); }
.search-input__icon svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.5; }
.search-input__field { flex: 1; padding: 10px 12px; border: 0; outline: 0; background: transparent; color: var(--ink-1); font: inherit; min-width: 0; }
.search-input__field::placeholder { color: var(--ink-4); }
.search-input__scope { padding: 8px 10px; border-right: 1px solid var(--line-3); background: var(--paper-2); color: var(--ink-3); font-family: var(--wire-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; display: grid; place-items: center; gap: 4px; white-space: nowrap; cursor: pointer; }
.search-input__scope:hover { background: var(--paper-3); color: var(--ink-1); }
.search-input__clear { background: transparent; border: 0; padding: 0 12px; color: var(--ink-3); cursor: pointer; font-family: var(--wire-mono); font-size: 14px; display: none; }
.search-input.is-filled .search-input__clear { display: block; }
.search-input__clear:hover { color: var(--ink-0); }
.search-input__kbd { display: flex; gap: 4px; align-items: center; padding: 0 10px; border-left: 1px solid var(--line-3); background: var(--paper-2); }
.search-input__loader { padding: 0 12px; display: grid; place-items: center; color: var(--ink-3); }
.search-input__loader svg { width: 14px; height: 14px; animation: cprog-spin 1s linear infinite; }
.search-input.is-loading .search-input__clear { display: none; }
.search-input.is-loading .search-input__loader { display: grid; }
.search-input:not(.is-loading) .search-input__loader { display: none; }
.search-input__submit { padding: 0 16px; background: var(--ink-1); color: var(--paper); border: 0; border-left: 1px solid var(--ink-1); font-size: 13px; font-weight: 500; cursor: pointer; }
.search-input__submit:hover { background: var(--ink-0); }

.search-pop { position: relative; }
.search-pop__menu { display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 50; background: var(--paper); border: 1px solid var(--line-1); border-radius: var(--r); box-shadow: var(--sh-l); padding: 6px; max-height: 320px; overflow: auto; }
.search-pop.is-open .search-pop__menu { display: block; }
.search-pop__head { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px 4px; font-family: var(--wire-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
.search-pop__head a { color: var(--ink-3); text-decoration: none; cursor: pointer; }
.search-pop__head a:hover { color: var(--ink-0); }
.search-pop__item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; font-size: 14px; cursor: pointer; border-radius: calc(var(--r) * .8); color: var(--ink-1); }
.search-pop__item:hover, .search-pop__item.is-active { background: var(--paper-2); }
.search-pop__item mark { background: var(--highlight); color: var(--ink-0); font-weight: 500; }
.search-pop__item .t-mono { margin-left: auto; }
.search-pop__sep { height: 1px; background: var(--line-3); margin: 6px 4px; }
.search-pop__empty { padding: 24px 16px; text-align: center; color: var(--ink-3); font-size: 13px; }
.search-pop__empty strong { display: block; color: var(--ink-1); font-size: 14px; margin-bottom: 4px; }

/* ── shadcn-parity primitives ─────────────────────────────────────── */

/* Toggle button (press-state, distinct from .toggle switch) */
.t-toggle { display: inline-flex; align-items: center; justify-content: center; padding: 6px 12px; min-width: 32px; border: 1px solid var(--line-3); background: var(--paper); color: var(--ink-2); font-size: var(--fs-13); border-radius: var(--r); cursor: pointer; }
.t-toggle:hover { background: var(--paper-2); color: var(--ink-0); }
.t-toggle.is-on { background: var(--ink-1); color: var(--paper); border-color: var(--ink-1); }
.t-toggle.is-on:hover { background: var(--ink-0); }
.t-toggle-group { display: inline-flex; border: 1px solid var(--line-1); border-radius: var(--r); overflow: hidden; }
.t-toggle-group .t-toggle { border: 0; border-right: 1px solid var(--line-3); border-radius: 0; }
.t-toggle-group .t-toggle:last-child { border-right: 0; }
.t-toggle-group .t-toggle.is-on { background: var(--ink-1); color: var(--paper); }

/* Alert dialog / generic modal wrapper */
.modal-wrap { position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; padding: 24px; }
.modal-wrap.modal--open { display: flex; }
.modal-wrap .modal__overlay { position: absolute; inset: 0; background: rgba(10,10,10,.4); cursor: pointer; }
[data-theme="dark"] .modal-wrap .modal__overlay { background: rgba(0,0,0,.6); }
.modal-wrap .modal { position: relative; z-index: 1; }

/* Collapsible */
.collapsible { border: 1px solid var(--line-3); background: var(--paper); border-radius: var(--r); overflow: hidden; }
.collapsible__hd { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; cursor: pointer; text-align: left; background: transparent; border: 0; color: var(--ink-1); font-size: 14px; font-weight: 500; }
.collapsible__hd:hover { background: var(--paper-2); }
.collapsible__caret { font-family: var(--wire-mono); }
.collapsible__body { padding: 0 16px 14px; color: var(--ink-2); font-size: 14px; display: none; }
.collapsible.is-open .collapsible__body { display: block; }

/* Hover card */
.hover-trigger { position: relative; display: inline-block; cursor: help; }
.hover-card { display: none; position: absolute; top: calc(100% + 8px); left: 0; z-index: 50; width: 280px; padding: 14px; background: var(--paper); border: 1px solid var(--line-1); border-radius: var(--r); box-shadow: var(--sh-l); font-size: 13px; color: var(--ink-1); white-space: normal; text-align: left; }
.hover-trigger:hover > .hover-card, .hover-trigger:focus-within > .hover-card { display: block; }

/* Input OTP */
.otp { display: inline-flex; gap: 8px; align-items: center; }
.otp__cell { width: 44px; height: 52px; text-align: center; font-family: var(--wire-mono); font-size: 20px; border: 1px solid var(--line-1); background: var(--paper); color: var(--ink-1); border-radius: var(--r); outline: 0; }
.otp__cell:focus { border-color: var(--ink-0); box-shadow: inset 0 -2px 0 var(--ink-1); }
.otp__cell.is-filled { background: var(--paper-2); }
.otp__sep { font-family: var(--wire-mono); color: var(--ink-4); }

/* Menubar */
.menubar { position: relative; display: inline-flex; border: 1px solid var(--line-3); background: var(--paper); border-radius: var(--r); padding: 2px; gap: 2px; }
.menubar__item { padding: 6px 12px; font-size: 13px; color: var(--ink-2); border-radius: calc(var(--r) * .8); cursor: pointer; background: transparent; border: 0; }
.menubar__item:hover, .menubar__item.is-open { background: var(--paper-2); color: var(--ink-0); }
.menubar__menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 60; min-width: 220px; }

/* Resizable */
.resizable { display: flex; border: 1px solid var(--line-3); border-radius: var(--r); overflow: hidden; background: var(--paper); }
.resizable__pane { flex: 1 1 0; min-width: 80px; padding: 16px; overflow: hidden; }
.resizable__handle { flex: 0 0 6px; background: var(--paper-2); cursor: col-resize; border-left: 1px solid var(--line-3); border-right: 1px solid var(--line-3); position: relative; }
.resizable__handle::before { content: ''; position: absolute; top: 50%; left: 50%; width: 1px; height: 24px; background: var(--ink-4); transform: translate(-50%, -50%); box-shadow: -2px 0 0 var(--ink-4), 2px 0 0 var(--ink-4); }
.resizable__handle:hover { background: var(--paper-3); }

/* Scroll area */
.scroll-area { overflow: auto; border: 1px solid var(--line-3); border-radius: var(--r); background: var(--paper); scrollbar-width: thin; scrollbar-color: var(--ink-2) transparent; }
.scroll-area::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll-area::-webkit-scrollbar-track { background: transparent; }
.scroll-area::-webkit-scrollbar-thumb { background: var(--ink-2); border-radius: var(--r-pill); border: 2px solid var(--paper); }
.scroll-area::-webkit-scrollbar-thumb:hover { background: var(--ink-0); }
.scroll-area--x { overflow-x: auto; overflow-y: hidden; }

/* Sonner / toast stack */
.sonner { position: fixed; bottom: 24px; right: 24px; z-index: 300; display: flex; flex-direction: column-reverse; gap: 8px; max-width: 360px; pointer-events: none; }
.sonner .toast { pointer-events: auto; animation: sonner-in .22s ease; }
.sonner .toast--good { background: var(--paper); color: var(--ink-1); border-color: var(--good); }
.sonner .toast--warn { background: var(--paper); color: var(--ink-1); border-color: var(--warn); }
.sonner .toast--bad  { background: var(--paper); color: var(--ink-1); border-color: var(--bad); }
@keyframes sonner-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Carousel */
.carousel { width: 100%; }
.carousel__viewport { overflow: hidden; border: 1px solid var(--line-3); border-radius: var(--r); background: var(--paper); }
.carousel__track { display: flex; transition: transform .28s ease; }
.carousel__slide { flex: 0 0 100%; padding: 16px; }
.carousel__dots { display: inline-flex; gap: 6px; }
.carousel__dot { width: 10px; height: 10px; border: 1px solid var(--line-1); background: transparent; border-radius: 50%; padding: 0; cursor: pointer; }
.carousel__dot.is-active { background: var(--ink-1); }

/* Combobox */
.combobox { position: relative; display: inline-block; min-width: 280px; }
.combobox__trigger { display: flex; justify-content: space-between; align-items: center; gap: 8px; cursor: pointer; background: var(--paper); width: 100%; text-align: left; }
.combobox__trigger:hover { background: var(--paper-2); }
.combobox__caret { font-family: var(--wire-mono); color: var(--ink-3); }
.combobox__menu { display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 50; background: var(--paper); border: 1px solid var(--line-1); border-radius: var(--r); box-shadow: var(--sh-l); padding: 6px; }
.combobox.is-open .combobox__menu { display: block; }
.combobox__list { max-height: 220px; overflow: auto; }
.combobox__item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 14px; cursor: pointer; border-radius: calc(var(--r) * .8); color: var(--ink-1); }
.combobox__item:hover, .combobox__item.is-active { background: var(--paper-2); }
.combobox__item.is-selected::before { content: '✓'; font-family: var(--wire-mono); color: var(--ink-1); margin-right: 4px; }
.combobox__item:not(.is-selected)::before { content: ''; width: 12px; margin-right: 4px; }

/* Context menu host */
.ctx-target { user-select: none; }
