/* ═══════════════════════════════════════════════════════════════════════════
   FAZLEY — DESIGN FOUNDATION
   Tokens, reset, typography and the primitives every surface shares.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Light is the default. A studio that sells work to other businesses reads as
   a firm on paper, not as a product launch on a black screen — dark is offered
   as a deliberate second theme rather than the house style. */

:root {
  /* Settings writes --brand-seed / --accent-seed / --ink. Everything derives
     from those, so any colour an administrator picks stays legible in both
     themes without them having to think about contrast. */
  --brand-seed: #a8462a;
  --accent-seed: #2f4858;

  --brand: var(--brand-seed);   /* the one accent, used sparingly */
  --brand-2: var(--accent-seed); /* a quieter second accent for data and links */
  --ink: #16181c;                /* the dark surface, used by the dark theme */

  --brand-soft: color-mix(in srgb, var(--brand) 9%, transparent);
  --brand-line: color-mix(in srgb, var(--brand) 28%, transparent);
  --brand-ink: #ffffff;  /* text sitting on top of --brand */

  /* Paper surfaces */
  --bg: #fbfaf8;
  --bg-2: #f4f2ee;
  --surface: #ffffff;
  --surface-2: #f7f5f1;
  --surface-3: #eeebe4;
  --line: rgba(22, 24, 28, 0.11);
  --line-strong: rgba(22, 24, 28, 0.2);
  --text: #16181c;
  --text-2: #43474e;
  --muted: #6c7178;
  --faint: #969ba2;

  --ok: #2f6f4f;
  --warn: #9a6b18;
  --danger: #a8322f;
  --info: #2f4858;
  --ok-soft: color-mix(in srgb, var(--ok) 10%, transparent);
  --warn-soft: color-mix(in srgb, var(--warn) 12%, transparent);
  --danger-soft: color-mix(in srgb, var(--danger) 9%, transparent);
  --info-soft: color-mix(in srgb, var(--info) 9%, transparent);

  /* Type — a transitional serif for display, the system grotesk for UI.
     Both are installed everywhere, so nothing waits on a webfont. */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI Variable Text', 'Segoe UI',
    Inter, Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', P052, Palatino,
    Georgia, 'Times New Roman', serif;
  --font-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', 'Cascadia Mono', Consolas,
    'Liberation Mono', monospace;

  /* Scale — a tighter ratio than the usual, so headings stop shouting */
  --step--2: clamp(0.7rem, 0.69rem + 0.05vw, 0.75rem);
  --step--1: clamp(0.81rem, 0.79rem + 0.1vw, 0.875rem);
  --step-0: clamp(0.94rem, 0.92rem + 0.12vw, 1rem);
  --step-1: clamp(1.08rem, 1.04rem + 0.24vw, 1.22rem);
  --step-2: clamp(1.28rem, 1.18rem + 0.45vw, 1.55rem);
  --step-3: clamp(1.52rem, 1.34rem + 0.82vw, 2.05rem);
  --step-4: clamp(1.85rem, 1.52rem + 1.5vw, 2.75rem);
  --step-5: clamp(2.2rem, 1.66rem + 2.5vw, 3.6rem);
  --step-6: clamp(2.6rem, 1.75rem + 3.9vw, 4.75rem);

  /* Space */
  --s1: 0.25rem; --s2: 0.5rem; --s3: 0.75rem; --s4: 1rem; --s5: 1.5rem;
  --s6: 2rem;    --s7: 3rem;   --s8: 4rem;    --s9: 6rem;  --s10: 8rem;

  /* Restrained corners. Heavy rounding is the fastest way to look generic. */
  --radius: 6px;
  --radius-sm: 4px;
  --radius-lg: 10px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(22, 24, 28, 0.05);
  --shadow: 0 8px 24px -14px rgba(22, 24, 28, 0.22);
  --shadow-lg: 0 24px 56px -28px rgba(22, 24, 28, 0.3);

  --container: 1160px;
  --container-wide: 1380px;
  --container-narrow: 680px;

  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --fast: 120ms var(--ease);
  --base: 200ms var(--ease);
  --slow: 420ms var(--ease);

  color-scheme: light;
}

[data-theme='dark'] {
  /* The accent is lifted against a dark ground — the light-mode value does not
     carry enough contrast to pass AA on small text. */
  --brand: color-mix(in srgb, var(--brand-seed) 68%, #ffffff);
  --brand-2: color-mix(in srgb, var(--accent-seed) 55%, #ffffff);
  --brand-soft: color-mix(in srgb, var(--brand) 14%, transparent);
  --brand-line: color-mix(in srgb, var(--brand) 32%, transparent);
  --brand-ink: #17100c;

  --bg: var(--ink);
  --bg-2: #101216;
  --surface: #1a1d22;
  --surface-2: #20242a;
  --surface-3: #282d34;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.17);
  --text: #e9e7e3;
  --text-2: #b3b7bd;
  --muted: #858b93;
  --faint: #5f656d;

  --ok: #4fae7e;
  --warn: #d3a04a;
  --danger: #d9615c;
  --info: #7ba3bd;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 10px 30px -14px rgba(0, 0, 0, 0.65);
  --shadow-lg: 0 28px 64px -30px rgba(0, 0, 0, 0.8);

  color-scheme: dark;
}

/* ── Reset ─────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-synthesis-weight: none;
}

img, svg, video, canvas { display: block; max-width: 100%; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }
table { border-collapse: collapse; width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection { background: var(--brand); color: var(--brand-ink); }

/* ── The mark beside the wordmark ──────────────────────────────────────────
   Defined here rather than in site.css because every layout loads this file
   and only the public pages load that one — in the control room the dot had no
   size or colour at all and rendered as nothing.

   It breathes rather than flashing: the opacity dips while a ring expands and
   fades, which reads as a live signal without the hard on/off of a blink. The
   reduced-motion block below stops it dead for anyone who asks. */

.brand-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  /* Always green — a live-status signal, not a brand accent. --ok is defined in
     both themes and inherited by every design, so this holds everywhere. */
  background: var(--ok);
  margin-left: 1px;
  flex: 0 0 auto;
  animation: brand-pulse 2.4s ease-in-out infinite;
}

@keyframes brand-pulse {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent);
  }
  50% {
    opacity: 0.45;
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--ok) 0%, transparent);
  }
}

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

/* ── Scrollbars ────────────────────────────────────────────────────────── */

* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }

/* ── Typography ────────────────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

.display {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.028em;
  line-height: 1.02;
}

/* A typographic label, not a coloured pill. The rule reads as a printed
   sidehead rather than a badge. */
.eyebrow {
  font-family: var(--font-sans);
  font-size: var(--step--2);
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
}
.eyebrow::before {
  content: '';
  width: 1.5em;
  height: 1px;
  background: var(--brand);
}
.eyebrow.is-plain::before { display: none; }

.lede { font-size: var(--step-1); color: var(--text-2); line-height: 1.55; text-wrap: pretty; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--font-mono); font-size: 0.92em; letter-spacing: -0.01em; }
.center { text-align: center; }
.balance { text-wrap: balance; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Emphasis inside a display heading — a real typographic device (an italic in
   the serif) rather than a gradient fill. */
.accent-phrase {
  font-style: italic;
  color: var(--brand);
}

/* Inline SVG icons. Sized in em so they sit with the text they label. */
.icon {
  width: 1.15em;
  height: 1.15em;
  flex: 0 0 auto;
  vertical-align: -0.2em;
}
.icon-inline { width: 1em; height: 1em; vertical-align: -0.125em; }

/* ── Layout ────────────────────────────────────────────────────────────── */

.container { width: min(100% - 2.5rem, var(--container)); margin-inline: auto; }
.container-wide { width: min(100% - 2.5rem, var(--container-wide)); margin-inline: auto; }
.container-narrow { width: min(100% - 2.5rem, var(--container-narrow)); margin-inline: auto; }

.section { padding-block: clamp(3.5rem, 7vw, 7rem); }
.section-sm { padding-block: clamp(2.25rem, 4vw, 4rem); }
.section-lg { padding-block: clamp(4.5rem, 10vw, 9.5rem); }

.stack > * + * { margin-top: var(--stack, 1rem); }
.row { display: flex; align-items: center; gap: var(--gap, 0.75rem); }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, 0.75rem); }
.between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.grid { display: grid; gap: var(--gap, 1.5rem); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }
.spacer-sm { height: 2rem; } .spacer-md { height: 4rem; } .spacer-lg { height: 7rem; }

.section-head { max-width: 46rem; margin-bottom: clamp(2rem, 4vw, 3.25rem); }
.section-head.center { margin-inline: auto; }
.section-head h2 { font-size: var(--step-3); margin-block: 0.7rem 0.85rem; }
.section-head p { color: var(--text-2); font-size: var(--step-0); }

/* ── Buttons ───────────────────────────────────────────────────────────── */

.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  --btn-line: var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55em;
  padding: 0.72em 1.35em;
  border-radius: var(--radius-sm);
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 1px solid var(--btn-line);
  font-size: var(--step--1);
  font-weight: 550;
  letter-spacing: -0.005em;
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--fast), background var(--fast), border-color var(--fast), opacity var(--fast);
}
.btn:hover { transform: translateY(-1px); border-color: var(--muted); }
.btn:active { transform: translateY(0); }
.btn[disabled], .btn.is-disabled { opacity: 0.5; pointer-events: none; }

.btn-primary {
  --btn-bg: var(--brand);
  --btn-fg: var(--brand-ink);
  --btn-line: var(--brand);
  font-weight: 600;
}
.btn-primary:hover { --btn-bg: color-mix(in srgb, var(--brand) 88%, #fff); border-color: var(--brand); }

.btn-accent { --btn-bg: var(--brand-2); --btn-fg: #fff; --btn-line: var(--brand-2); }
.btn-ghost { --btn-bg: transparent; --btn-line: var(--line-strong); }
.btn-ghost:hover { --btn-bg: var(--surface-2); }
.btn-quiet { --btn-bg: transparent; --btn-line: transparent; color: var(--muted); padding-inline: 0.7em; }
.btn-quiet:hover { color: var(--text); --btn-bg: var(--surface-2); transform: none; }
.btn-danger { --btn-bg: var(--danger-soft); --btn-fg: var(--danger); --btn-line: transparent; }
.btn-danger:hover { --btn-bg: var(--danger); --btn-fg: #fff; }
.btn-sm { padding: 0.5em 0.9em; font-size: var(--step--2); }
.btn-lg { padding: 0.9em 1.7em; font-size: var(--step-0); }
.btn-block { width: 100%; }
.btn-icon { padding: 0.55em; aspect-ratio: 1; }

.link {
  color: var(--brand);
  text-decoration: none;
  border-bottom: 1px solid var(--brand-line);
  padding-bottom: 1px;
  transition: border-color var(--fast);
}
.link:hover { border-color: var(--brand); }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  color: var(--brand);
  font-size: var(--step--1);
  font-weight: 550;
}
.link-arrow svg, .link-arrow span:last-child { transition: transform var(--base); }
.link-arrow:hover span:last-child { transform: translateX(3px); }

/* ── Surfaces ──────────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--card-pad, 1.5rem);
  transition: border-color var(--base), transform var(--base), background var(--base);
}
.card-hover:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.inset { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }

.hairline { height: 1px; background: var(--line); border: 0; }
.hairline-fade {
  height: 1px;
  border: 0;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
}

/* ── Badges & pills ────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.25em 0.65em;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  border: 1px solid var(--line);
  font-size: var(--step--2);
  font-weight: 550;
  letter-spacing: 0.01em;
  color: var(--text-2);
  white-space: nowrap;
}
.badge-brand { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand); }
.badge-ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.badge-warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.badge-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.badge-info { background: var(--info-soft); border-color: transparent; color: var(--info); }
.badge-dot::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.35em 0.8em;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: var(--step--2);
  color: var(--text-2);
  transition: all var(--fast);
}
a.chip:hover, .chip.is-active { border-color: var(--brand-line); color: var(--brand); background: var(--brand-soft); }

.tag {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  color: var(--muted);
  padding: 0.15em 0.5em;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

/* ── Avatars ───────────────────────────────────────────────────────────── */

.avatar {
  --size: 2.5rem;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  background: var(--surface-3);
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--size) * 0.36);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--brand-ink);
  overflow: hidden;
}
.avatar-sm { --size: 1.9rem; }
.avatar-lg { --size: 3.5rem; }
.avatar-xl { --size: 5.5rem; }
.avatar-stack { display: flex; }
.avatar-stack .avatar + .avatar { margin-left: -0.7rem; }

/* ── Forms ─────────────────────────────────────────────────────────────── */

.field { display: block; margin-bottom: 1.1rem; }
.field-label {
  display: block;
  font-size: var(--step--1);
  font-weight: 550;
  margin-bottom: 0.4rem;
  color: var(--text);
}
.field-label .req { color: var(--danger); margin-left: 0.15em; }
.field-help { font-size: var(--step--2); color: var(--muted); margin-top: 0.35rem; line-height: 1.5; }

.input, .textarea, .select {
  width: 100%;
  padding: 0.68em 0.85em;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: var(--step--1);
  transition: border-color var(--fast), background var(--fast), box-shadow var(--fast);
  appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
  background: var(--surface);
}
.input[readonly], .textarea[readonly] { opacity: 0.7; cursor: default; }
.textarea { resize: vertical; min-height: 6rem; line-height: 1.6; }
.textarea-code { font-family: var(--font-mono); font-size: var(--step--2); line-height: 1.55; }

/* The caret is a real chevron matching the icon set, and the space it needs is
   a named token. Anything that restyles a select must reserve --caret-space on
   the right, or the arrow lands on top of the longest option. */
.select {
  --caret-space: 2.25rem;
  padding-right: var(--caret-space);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236c7178' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 9.5 7 6.5 7-6.5'/%3E%3C/svg%3E");
  background-position: right 0.8rem center;
  background-size: 11px 11px;
  background-repeat: no-repeat;
}
[data-theme='dark'] .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23858b93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 9.5 7 6.5 7-6.5'/%3E%3C/svg%3E");
}
.select:disabled { opacity: 0.55; }

/* A tighter select that still keeps its caret gutter. Use this instead of
   writing a padding shorthand inline. */
.select-compact {
  --caret-space: 1.9rem;
  width: auto;
  font-size: var(--step--2);
  padding: 0.38em var(--caret-space) 0.38em 0.7em;
  background-position: right 0.6rem center;
  background-size: 10px 10px;
}

.input-group { display: flex; gap: 0.5rem; align-items: stretch; }
.input-group .input { flex: 1; }

.check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  cursor: pointer;
  font-size: var(--step--1);
  padding: 0.15rem 0;
}
.check input[type='checkbox'], .check input[type='radio'] {
  appearance: none;
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.2rem;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface-2);
  cursor: pointer;
  transition: all var(--fast);
  position: relative;
}
.check input[type='radio'] { border-radius: 50%; }
.check input:checked { background: var(--brand); border-color: var(--brand); }
.check input[type='checkbox']:checked::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--brand-ink);
  clip-path: polygon(14% 46%, 38% 70%, 86% 22%, 94% 32%, 38% 88%, 6% 56%);
}
.check input[type='radio']:checked::after {
  content: '';
  position: absolute;
  inset: 25%;
  border-radius: 50%;
  background: var(--brand-ink);
}

.switch { display: inline-flex; align-items: center; gap: 0.65rem; cursor: pointer; font-size: var(--step--1); }
/* Off is RED and on is GREEN — a switch's state must be readable at a glance,
   not inferred from which side the knob sits on. */
.switch input { appearance: none; width: 2.4rem; height: 1.35rem; border-radius: 99px;
  background: var(--danger); border: 1px solid var(--danger); position: relative;
  cursor: pointer; transition: background var(--fast), border-color var(--fast); flex: 0 0 auto; }
.switch input::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 3px;
  transform: translateY(-50%);
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 50%;
  background: #fff;
  transition: all var(--fast);
}
.switch input:checked { background: var(--ok); border-color: var(--ok); }
.switch input:checked::after { left: calc(100% - 1.1rem); background: #fff; }

/* ── Self-hosted captcha field ─────────────────────────────────────────────
   The image keeps a white plate in both themes: the challenge strokes are dark,
   and legibility is the entire point. */
.captcha-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.45rem; }
.captcha-image {
  display: inline-flex;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius, 6px);
  padding: 2px;
  user-select: none;
}
.captcha-image svg { display: block; }
.captcha-refresh {
  width: 2.2rem;
  height: 2.2rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius, 6px);
  background: var(--surface);
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.captcha-refresh:hover { background: var(--surface-2); }

.radio-cards { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.radio-card {
  flex: 1 1 8rem;
  position: relative;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  cursor: pointer;
  font-size: var(--step--1);
  text-align: center;
  transition: all var(--fast);
}
.radio-card input { position: absolute; opacity: 0; pointer-events: none; }
.radio-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.1rem; }
.form-grid > .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.form-error { color: var(--danger); font-size: var(--step--2); margin-top: 0.3rem; }

/* ── Alerts ────────────────────────────────────────────────────────────── */

.alert {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: var(--step--1);
  line-height: 1.55;
}
.alert-success { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); color: var(--ok); }
.alert-error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); color: var(--danger); }
.alert-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); color: var(--warn); }
.alert-info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, transparent); color: var(--info); }

/* ── Flash toasts ──────────────────────────────────────────────────────── */

.flash-stack {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: min(24rem, calc(100vw - 3rem));
}
.flash {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  font-size: var(--step--1);
  animation: flash-in 320ms var(--ease);
}
.flash-success { border-left: 3px solid var(--ok); }
.flash-error { border-left: 3px solid var(--danger); }
.flash-info { border-left: 3px solid var(--info); }
.flash button { color: var(--faint); font-size: 1.1rem; line-height: 1; margin-left: auto; }
@keyframes flash-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } }

/* ── Tables ────────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); }
.table { font-size: var(--step--1); }
.table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: var(--step--2);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 0.8rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--fast); }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-compact td, .table-compact th { padding: 0.55rem 0.75rem; }

/* ── Progress ──────────────────────────────────────────────────────────── */

.meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 99px; background: var(--brand); transition: width var(--slow); }
.meter-ok > span { background: var(--ok); }
.meter-danger > span { background: var(--danger); }

/* ── Empty state ───────────────────────────────────────────────────────── */

.empty {
  text-align: center;
  padding: clamp(2.5rem, 6vw, 4.5rem) 1.5rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
}
.empty-icon { font-size: 2rem; opacity: 0.4; margin-bottom: 0.75rem; }
.empty h3 { font-size: var(--step-1); color: var(--text); margin-bottom: 0.4rem; }

/* ── Prose ─────────────────────────────────────────────────────────────── */

.prose { font-size: 1.03rem; line-height: 1.75; color: var(--text-2); }
.prose > * + * { margin-top: 1.15em; }
.prose h2, .prose h3, .prose h4 { color: var(--text); margin-top: 2em; margin-bottom: 0.6em; letter-spacing: -0.02em; }
.prose h2 { font-size: var(--step-2); }
.prose h3 { font-size: var(--step-1); }
.prose h4 { font-size: var(--step-0); }
.prose a { color: var(--brand); border-bottom: 1px solid var(--brand-line); }
.prose a:hover { border-color: var(--brand); }
.prose strong { color: var(--text); font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.35em; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin-top: 0.4em; }
.prose li::marker { color: var(--brand); }
.prose blockquote {
  border-left: 2px solid var(--brand);
  padding: 0.35em 0 0.35em 1.25em;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.12em;
  line-height: 1.5;
}
.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 0.14em 0.4em;
  border-radius: 5px;
  color: var(--brand);
}
.prose pre {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  font-size: 0.85em;
  line-height: 1.6;
}
.prose pre code { background: none; border: 0; padding: 0; color: var(--text-2); }
.prose img { border-radius: var(--radius-sm); border: 1px solid var(--line); }
.prose hr { margin-block: 2.5em; }
.prose table { font-size: 0.92em; margin-block: 1.5em; }
.prose th, .prose td { padding: 0.6rem 0.85rem; border: 1px solid var(--line); text-align: left; }
.prose th { background: var(--surface-2); color: var(--text); font-weight: 600; }

/* ── Utilities ─────────────────────────────────────────────────────────── */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.hidden { display: none !important; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; } .mt-5 { margin-top: 3rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.ml-auto { margin-left: auto; } .mr-auto { margin-right: auto; }
.w-full { width: 100%; } .flex-1 { flex: 1; } .flex-wrap { flex-wrap: wrap; }
.items-start { align-items: flex-start; } .items-center { align-items: center; }
.justify-center { justify-content: center; } .justify-end { justify-content: flex-end; }
.text-sm { font-size: var(--step--1); } .text-xs { font-size: var(--step--2); }
.text-right { text-align: right; }
.tabular { font-variant-numeric: tabular-nums; }
.pos-up { color: var(--ok); } .pos-down { color: var(--danger); }
.scroll-x { overflow-x: auto; }

.reveal { opacity: 0; transform: translateY(18px); transition: opacity 700ms var(--ease), transform 700ms var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }
