/* IDP portal design system. Tokens and rationale: docs/DESIGN.md. No framework, no inline styles (strict CSP). */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/inter-latin-var.woff2") format("woff2");
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-latin-var.woff2") format("woff2");
}

/* 1. Primitive tokens */
:root {
  --ink-0: #ffffff;
  --ink-25: #f7f8fa;
  --ink-50: #f0f2f5;
  --ink-100: #e3e7ec;
  --ink-200: #cdd3db;
  --ink-300: #aeb7c3;
  --ink-400: #8792a2;
  --ink-500: #5d6878;
  --ink-600: #4e5867;
  --ink-700: #394250;
  --ink-800: #262d38;
  --ink-900: #141920;
  --ink-950: #0c1016;

  --brand-50: #eef4ff;
  --brand-100: #dce7fe;
  --brand-300: #93b4fb;
  --brand-600: #2563eb;
  --brand-700: #1d4fd1;
  --brand-cyan: #06b6d4;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-pill: 999px;

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;
  --leading-tight: 1.25;
  --leading-normal: 1.5;

  --sidebar-width: 15rem;
  --content-max: 80rem;
  --drawer-width: 28rem;
  --duration: 140ms;
}

/* 2. Semantic tokens (light) */
:root {
  color-scheme: light dark;
  --canvas: var(--ink-25);
  --surface: var(--ink-0);
  --surface-sunken: var(--ink-50);
  --border: var(--ink-100);
  --border-strong: var(--ink-200);
  --text: var(--ink-900);
  --text-muted: var(--ink-600);
  --text-subtle: var(--ink-500);
  --accent: var(--brand-600);
  --accent-hover: var(--brand-700);
  --accent-soft: var(--brand-50);
  --on-accent: var(--ink-0);
  --focus-ring: var(--brand-600);
  --scrim: rgb(12 16 22 / 0.42);
  --shadow-raised: 0 1px 2px rgb(12 16 22 / 0.06), 0 1px 1px rgb(12 16 22 / 0.04);
  --shadow-overlay: 0 12px 32px rgb(12 16 22 / 0.18), 0 2px 6px rgb(12 16 22 / 0.08);

  --neutral-bg: var(--ink-50);
  --neutral-fg: var(--ink-700);
  --neutral-border: var(--ink-200);
  --info-bg: #e6f6fa;
  --info-fg: #0b5d73;
  --info-border: #a5dceb;
  --warn-bg: #fff4db;
  --warn-fg: #8a4b00;
  --warn-border: #f3cf7d;
  --progress-bg: var(--brand-50);
  --progress-fg: #1d47b8;
  --progress-border: var(--brand-300);
  --success-bg: #e5f6ea;
  --success-fg: #17663a;
  --success-border: #9fd8b3;
  --danger-bg: #fdeceb;
  --danger-fg: #a52b23;
  --danger-border: #f2b2ad;
}

/* 3. Semantic tokens (dark): same names, re-pointed */
@media (prefers-color-scheme: dark) {
  :root {
    --canvas: var(--ink-950);
    --surface: #12171f;
    --surface-sunken: #0f141b;
    --border: #232b37;
    --border-strong: #2f3946;
    --text: #e7ebf0;
    --text-muted: #a3adba;
    --text-subtle: #8a95a4;
    --accent: #6d9cf8;
    --accent-hover: #8fb3fa;
    --accent-soft: #15233f;
    --on-accent: var(--ink-950);
    --focus-ring: #8fb3fa;
    --scrim: rgb(0 0 0 / 0.6);
    --shadow-raised: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-overlay: 0 12px 32px rgb(0 0 0 / 0.55);

    --neutral-bg: #1b222c;
    --neutral-fg: #c3cbd6;
    --neutral-border: #2f3946;
    --info-bg: #0d2a33;
    --info-fg: #7fd3e6;
    --info-border: #1a4f5e;
    --warn-bg: #2e2210;
    --warn-fg: #f2c46b;
    --warn-border: #5a4419;
    --progress-bg: #15233f;
    --progress-fg: #9dbcfb;
    --progress-border: #2a4478;
    --success-bg: #10281b;
    --success-fg: #7fd6a0;
    --success-border: #1f4d33;
    --danger-bg: #321615;
    --danger-fg: #f5a39c;
    --danger-border: #5e2824;
  }
}

/* 4. Base */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  font-feature-settings: "cv11", "ss03";
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; line-height: var(--leading-tight); letter-spacing: -0.011em; }
h1 { font-size: var(--text-xl); font-weight: 650; }
h2 { font-size: var(--text-md); font-weight: 600; }
h3 { font-size: var(--text-base); font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 0.2em; }
code, .mono { font-family: var(--font-mono); font-size: 0.92em; }
ul, ol { margin: 0; padding: 0; list-style: none; }
dl, dd { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -3rem;
  z-index: 50;
  padding: var(--space-2) var(--space-3);
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius-md);
}
.skip-link:focus { top: var(--space-3); }

.icon {
  width: 1rem;
  height: 1rem;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.15em;
}
.icon--lg { width: 1.5rem; height: 1.5rem; }
.icon--xl { width: 2rem; height: 2rem; stroke-width: 1.5; }

/* 5. Shell: sidebar + main */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-5) var(--space-3);
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.sidebar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-600), var(--brand-cyan));
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-2);
  color: var(--text);
}
.brand:hover { color: var(--text); text-decoration: none; }
.brand__mark { width: 2rem; height: 2rem; flex: none; }
.brand__name { display: block; font-weight: 650; font-size: var(--text-base); line-height: 1.2; }
.brand__product { display: block; color: var(--text-subtle); font-size: var(--text-xs); letter-spacing: 0.02em; }

.nav { display: flex; flex-direction: column; gap: var(--space-1); }
.nav__label {
  padding: var(--space-4) var(--space-2) var(--space-1);
  color: var(--text-subtle);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.nav__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 2.25rem;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-weight: 500;
}
.nav__link:hover { background: var(--surface-sunken); color: var(--text); text-decoration: none; }
.nav__link[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.sidebar__footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-2) 0;
  border-top: 1px solid var(--border);
}
.who { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.who__text { min-width: 0; }
.who__name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.who__role { display: block; color: var(--text-subtle); font-size: var(--text-xs); }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-height: 3.25rem;
  padding: var(--space-2) var(--space-8);
  background: color-mix(in srgb, var(--canvas) 88%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}
.crumbs { display: flex; align-items: center; gap: var(--space-1); min-width: 0; color: var(--text-subtle); font-size: var(--text-sm); }
.crumbs a { color: var(--text-muted); }
.crumbs [aria-current] { color: var(--text); font-weight: 500; }
.topbar__end { margin-left: auto; display: flex; align-items: center; gap: var(--space-3); }

.content {
  width: 100%;
  max-width: var(--content-max);
  padding: var(--space-6) var(--space-8) var(--space-12);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-4); justify-content: space-between; }
.page-head__text { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.page-head__eyebrow { color: var(--text-subtle); font-size: var(--text-sm); }
.page-head__lead { color: var(--text-muted); max-width: 48rem; }
.page-head__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); color: var(--text-muted); font-size: var(--text-sm); }

/* 6. Tenant switcher (details/summary menu, no script needed) */
.switcher { position: relative; }
.switcher > summary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 2rem;
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
  list-style: none;
  font-weight: 500;
}
.switcher > summary::-webkit-details-marker { display: none; }
.switcher__menu {
  position: absolute;
  right: 0;
  z-index: 20;
  min-width: 16rem;
  margin-top: var(--space-1);
  padding: var(--space-1);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-overlay);
}
.switcher__item {
  display: flex;
  flex-direction: column;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text);
}
.switcher__item:hover { background: var(--surface-sunken); text-decoration: none; color: var(--text); }
.switcher__item[aria-current] { background: var(--accent-soft); }
.switcher__item small { color: var(--text-subtle); font-family: var(--font-mono); font-size: var(--text-xs); }

/* 7. Surfaces */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-raised);
}
.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}
.card__head p { color: var(--text-subtle); font-size: var(--text-sm); }
.card__body { padding: var(--space-4) var(--space-5); }
.card__foot { padding: var(--space-3) var(--space-5); border-top: 1px solid var(--border); color: var(--text-subtle); font-size: var(--text-sm); }

.grid { display: grid; gap: var(--space-4); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 22rem; gap: var(--space-6); align-items: start; }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }

.tenant-card { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4) var(--space-5); }
.tenant-card__name { display: flex; align-items: center; gap: var(--space-2); font-weight: 600; }
.tenant-card__links { display: flex; flex-wrap: wrap; gap: var(--space-3); font-size: var(--text-sm); }

/* 8. Key-value lists */
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--space-2) var(--space-4); font-size: var(--text-sm); }
.kv dt { color: var(--text-subtle); }
.kv dd { min-width: 0; overflow-wrap: anywhere; }

/* 9. Data tables */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}
.table th {
  position: sticky;
  top: 0;
  padding: var(--space-2) var(--space-4);
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--border);
  color: var(--text-subtle);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-sunken); }
.table__primary { display: flex; flex-direction: column; gap: 2px; min-width: 12rem; }
.table__primary a { font-weight: 550; color: var(--text); }
.table__primary a:hover { color: var(--accent); }
.table__sub { color: var(--text-subtle); font-size: var(--text-xs); }
.table .num { text-align: right; }
.nowrap { white-space: nowrap; }
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }

/* 10. Status pills: tone + icon + text, never color alone */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.125rem 0.5rem 0.125rem 0.4rem;
  border: 1px solid var(--tone-border);
  border-radius: var(--radius-pill);
  background: var(--tone-bg);
  color: var(--tone-fg);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
.pill .icon { width: 0.8rem; height: 0.8rem; stroke-width: 2.5; }
.pill--outline { background: transparent; }
.tone-neutral { --tone-bg: var(--neutral-bg); --tone-fg: var(--neutral-fg); --tone-border: var(--neutral-border); }
.tone-info { --tone-bg: var(--info-bg); --tone-fg: var(--info-fg); --tone-border: var(--info-border); }
.tone-warn { --tone-bg: var(--warn-bg); --tone-fg: var(--warn-fg); --tone-border: var(--warn-border); }
.tone-progress { --tone-bg: var(--progress-bg); --tone-fg: var(--progress-fg); --tone-border: var(--progress-border); }
.tone-success { --tone-bg: var(--success-bg); --tone-fg: var(--success-fg); --tone-border: var(--success-border); }
.tone-danger { --tone-bg: var(--danger-bg); --tone-fg: var(--danger-fg); --tone-border: var(--danger-border); }

.status-planning .icon,
.status-applying .icon { animation: spin 1.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0 0.4rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.6;
  white-space: nowrap;
}
.tags { display: flex; flex-wrap: wrap; gap: var(--space-1); }

/* 11. Filters, segmented control, pagination */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); justify-content: space-between; }
.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 2px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.segmented a {
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
}
.segmented a:hover { color: var(--text); text-decoration: none; background: var(--surface); }
.segmented a[aria-current="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-raised); }

.field { display: flex; flex-direction: column; gap: var(--space-1); }
.field label, .field__label { font-weight: 500; font-size: var(--text-sm); }
.field__hint { color: var(--text-subtle); font-size: var(--text-xs); }
.input, .select, .textarea {
  width: 100%;
  min-height: 2.25rem;
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
}
.textarea { min-height: 6rem; resize: vertical; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline-offset: 0; border-color: var(--focus-ring); }
.inline-form { display: flex; align-items: center; gap: var(--space-2); }
.inline-form .select { width: auto; min-height: 2rem; padding-block: var(--space-1); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-top: 1px solid var(--border); font-size: var(--text-sm); }

/* 12. Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 2.25rem;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-weight: 550;
  line-height: 1.2;
  cursor: pointer;
  transition: background var(--duration), border-color var(--duration);
}
.btn:hover { background: var(--surface-sunken); text-decoration: none; color: var(--text); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn--danger { background: var(--surface); border-color: var(--danger-border); color: var(--danger-fg); }
.btn--danger:hover { background: var(--danger-bg); color: var(--danger-fg); }
.btn--ghost { border-color: transparent; background: transparent; color: var(--text-muted); }
.btn--sm { min-height: 1.875rem; padding: var(--space-1) var(--space-3); font-size: var(--text-sm); }
.btn--block { width: 100%; }
.btn[aria-disabled="true"] { opacity: 0.55; pointer-events: none; }
.btn .htmx-indicator { display: none; }
.htmx-request .btn .htmx-indicator, .btn.htmx-request .htmx-indicator { display: inline; }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* 13. Plan summary */
.plan { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--border); }
.plan__cell { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-4) var(--space-5); }
.plan__cell + .plan__cell { border-left: 1px solid var(--border); }
.plan__n { font-size: var(--text-xl); font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1; }
.plan__label { display: flex; align-items: center; gap: var(--space-1); color: var(--text-subtle); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.plan__cell--add .plan__n { color: var(--success-fg); }
.plan__cell--change .plan__n { color: var(--warn-fg); }
.plan__cell--destroy .plan__n { color: var(--danger-fg); }
.plan__cell--zero .plan__n { color: var(--text-subtle); }
.policy { display: flex; gap: var(--space-2); align-items: flex-start; font-size: var(--text-sm); }
.policy--pass { color: var(--success-fg); }
.policy--fail { color: var(--danger-fg); }

/* 14. Timeline */
.timeline { position: relative; display: flex; flex-direction: column; }
.timeline__item { position: relative; display: grid; grid-template-columns: 1.75rem minmax(0, 1fr); gap: var(--space-3); padding-bottom: var(--space-5); }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item::before {
  content: "";
  position: absolute;
  left: calc(0.875rem - 1px);
  top: 1.75rem;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline__item:last-child::before { display: none; }
.timeline__dot {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid var(--tone-border);
  border-radius: 50%;
  background: var(--tone-bg);
  color: var(--tone-fg);
}
.timeline__dot .icon { width: 0.875rem; height: 0.875rem; }
.timeline__body { display: flex; flex-direction: column; gap: var(--space-1); padding-top: 0.2rem; min-width: 0; }
.timeline__title { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font-weight: 500; }
.timeline__meta { color: var(--text-subtle); font-size: var(--text-xs); }
.timeline__reason {
  margin-top: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border-left: 2px solid var(--border-strong);
  background: var(--surface-sunken);
  color: var(--text-muted);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

/* 15. Callouts: notices, problems, empty states */
.callout {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--tone-border);
  border-radius: var(--radius-md);
  background: var(--tone-bg);
  color: var(--tone-fg);
  font-size: var(--text-sm);
}
.callout .icon { margin-top: 0.15rem; }
.callout__body { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.callout__title { font-weight: 600; }
.callout__code { font-family: var(--font-mono); font-size: var(--text-xs); opacity: 0.85; }
.callout ul { list-style: disc; padding-left: var(--space-4); }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-10) var(--space-6);
  color: var(--text-muted);
  text-align: center;
}
.empty .icon { color: var(--text-subtle); margin-bottom: var(--space-2); }
.empty__title { color: var(--text); font-weight: 600; }
.empty__text { max-width: 28rem; font-size: var(--text-sm); }

.code-block {
  margin: 0;
  padding: var(--space-3) var(--space-4);
  max-height: 22rem;
  overflow: auto;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.6;
  white-space: pre;
}

/* 16. Drawer (approval, rejection, cancellation) */
.drawer-root:empty { display: none; }
.drawer-scrim { position: fixed; inset: 0; z-index: 40; background: var(--scrim); }
.drawer {
  position: fixed;
  z-index: 41;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(100%, var(--drawer-width));
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border-strong);
  box-shadow: var(--shadow-overlay);
  animation: drawer-in 180ms ease-out;
}
@keyframes drawer-in { from { transform: translateX(1.5rem); opacity: 0; } }
.drawer__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); padding: var(--space-5); border-bottom: 1px solid var(--border); }
.drawer__head p { color: var(--text-subtle); font-size: var(--text-sm); margin-top: var(--space-1); }
.drawer__body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-5); }
.drawer__foot { display: flex; gap: var(--space-2); justify-content: flex-end; padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border); }
.drawer--page { position: static; width: 100%; max-width: 40rem; border: 1px solid var(--border); border-radius: var(--radius-lg); animation: none; }

/* 17. Toasts */
.toasts {
  position: fixed;
  z-index: 60;
  right: var(--space-5);
  bottom: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: min(calc(100% - 2.5rem), 24rem);
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--ink-900);
  color: var(--ink-50);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-overlay);
  font-size: var(--text-sm);
  animation: toast-in 180ms ease-out;
}
.toast .icon { color: #7fd6a0; margin-top: 0.1rem; }
.toast__text { flex: 1; }
.toast__close { padding: 0; border: 0; background: none; color: var(--ink-300); cursor: pointer; }
@keyframes toast-in { from { transform: translateY(0.5rem); opacity: 0; } }
@media (prefers-color-scheme: dark) {
  .toast { background: var(--ink-100); color: var(--ink-900); }
  .toast .icon { color: var(--success-border); }
  .toast__close { color: var(--ink-600); }
}

/* 18. Sign-in */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 30rem);
}
.auth__aside {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-8);
  padding: var(--space-10);
  background: var(--ink-950);
  color: var(--ink-100);
  overflow: hidden;
}
.auth__aside::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 4px;
  background: linear-gradient(90deg, var(--brand-600), var(--brand-cyan));
}
.auth__aside .brand { color: var(--ink-0); }
.auth__aside .brand__product { color: var(--ink-300); }
.auth__claim { max-width: 30rem; display: flex; flex-direction: column; gap: var(--space-3); }
.auth__claim h1 { color: var(--ink-0); font-size: 1.75rem; }
.auth__claim p { color: var(--ink-300); }
.auth__states { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.auth__main { display: flex; align-items: center; justify-content: center; padding: var(--space-8) var(--space-6); background: var(--surface); }
.auth__form { width: 100%; max-width: 22rem; display: flex; flex-direction: column; gap: var(--space-5); }
.auth__form h2 { font-size: var(--text-lg); }
.auth__lang { display: flex; gap: var(--space-3); font-size: var(--text-sm); }

/* 19. Responsive */
@media (max-width: 64rem) {
  .split { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 56rem) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-4);
    padding: var(--space-3) var(--space-4);
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .nav { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; order: 3; width: 100%; }
  .nav__label { display: none; }
  .nav__link { white-space: nowrap; }
  .sidebar__footer { margin: 0 0 0 auto; flex-direction: row; align-items: center; padding: 0; border-top: 0; }
  .who__text { display: none; }
  .topbar { position: static; padding: var(--space-2) var(--space-4); flex-wrap: wrap; }
  .content { padding: var(--space-5) var(--space-4) var(--space-10); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth__aside { padding: var(--space-6); gap: var(--space-5); }
  .plan__cell { padding: var(--space-3); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* 20. Page-specific */
.card__divider { border-bottom: 1px solid var(--border); }
.catalog-item { display: flex; flex-direction: column; }
.catalog-item .card__body { flex: 1; }
.catalog-item .card__foot { display: flex; align-items: center; gap: var(--space-2); }
.error-page { max-width: 40rem; margin: 0 auto; padding-top: var(--space-12); }
.tag--text { font-family: var(--font-sans); font-weight: 500; }
.tag .icon { width: 0.8rem; height: 0.8rem; }
