/*
  DESIGN SYSTEM — COMPONENTS
  v1 — Import order: tokens.css → base.css → components.css (always last).
  Adapted from Texta's live design-system.css (Session 24 performance pass —
  no backdrop-filter, no orb drift animation, .btn has default md sizing).
*/

/* ─── Bridge variables (short aliases used throughout this file) ─────────── */

:root {
  --glass-bg: var(--color-surface);
  --glass-bg-strong: var(--color-surface-raised);
  --glass-bg-quiet: rgba(255, 255, 255, 0.40);
  --glass-shadow: var(--shadow-glass);
  --glass-edge: var(--color-border);

  --r-sm: var(--radius-sm);
  --r-md: var(--radius-md);
  --r-lg: var(--radius-lg);
  --r-xl: var(--radius-xl);
  --r-2xl: var(--radius-2xl);
  --r-pill: var(--radius-full);
}

body {
  font-feature-settings: "ss01", "cv11";
}

/* ─── Background orbs ──────────────────────────────────────────────────────
   Static radial gradients, brand-tinted via --brand-rgb. No blur filter, no
   animation — both were the primary scroll-performance cost in earlier
   versions. An app applies these three classes to fixed-position divs
   inside a .painterly-bg wrapper; see README for the markup pattern. ────── */

.painterly-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background: var(--color-bg);
}

.painterly-orb {
  position: absolute;
  border-radius: 50%;
}

.painterly-orb-a {
  top: -12%; left: -8%; width: 55%; height: 55%;
  background: radial-gradient(circle, rgba(var(--brand-rgb), 0.13) 0%, transparent 70%);
}
.painterly-orb-b {
  top: 30%; right: -10%; width: 48%; height: 60%;
  background: radial-gradient(circle, rgba(var(--brand-rgb), 0.09) 0%, transparent 70%);
}
.painterly-orb-c {
  bottom: -15%; left: 20%; width: 60%; height: 55%;
  background: radial-gradient(circle, rgba(var(--brand-rgb), 0.10) 0%, transparent 70%);
}

.painterly-grain {
  position: absolute;
  inset: 0;
  opacity: 0.18;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/></svg>");
}

/* ─── Glass card ───────────────────────────────────────────────────────────
   No backdrop-filter — removed for scroll performance. Higher-opacity solid
   surface + inner highlight reads as glass without the compositing cost. ─── */

.glass-card {
  position: relative;
  background: rgba(255, 255, 255, 0.82);
  border: 0.5px solid rgba(255, 255, 255, 0.90);
  box-shadow: var(--shadow-glass);
  border-radius: var(--radius-2xl);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0px, transparent 48px);
}

.glass-card-raised {
  background: rgba(255, 255, 255, 0.94);
  border: 0.5px solid rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-2xl);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.98) inset,
    0 20px 50px -16px rgba(15, 23, 42, 0.18),
    0 6px 18px -6px rgba(15, 23, 42, 0.08);
}

/* ─── Inputs ───────────────────────────────────────────────────────────────
   Overrides the plainer base.css input styling with the glass treatment. ─── */

.input, .select, .textarea,
input:not([type="range"]), textarea, select {
  font-family: var(--font-ui);
  background: rgba(255, 255, 255, 0.72);
  border: 0.5px solid rgba(15, 23, 42, 0.10);
  border-radius: var(--radius-md);
  transition: border-color var(--t-base), background var(--t-base), box-shadow var(--t-base);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.02);
}
.input:hover, .select:hover, .textarea:hover,
input:not([type="range"]):hover, textarea:hover, select:hover {
  border-color: rgba(15, 23, 42, 0.18);
  background: rgba(255, 255, 255, 0.85);
}
.input:focus, .select:focus, .textarea:focus,
input:not([type="range"]):focus, textarea:focus, select:focus {
  border-color: var(--brand);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.14), inset 0 1px 2px rgba(15, 23, 42, 0.02);
  outline: none;
}
input:not([type="color"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]),
textarea, select {
  width: 100%;
  padding: 10px;
  box-sizing: border-box;
}

/* ─── Buttons ──────────────────────────────────────────────────────────────
   .btn alone renders correctly (default = md size). Always pair with a
   variant. Size class is optional but recommended for clarity. ──────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  font-size: 13px;
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  transition: background var(--t-base), color var(--t-base), transform var(--t-base),
    box-shadow var(--t-base), border-color var(--t-base), opacity var(--t-base);
  user-select: none;
  position: relative;
}
.btn:active { transform: translateY(1px) !important; }
.btn:disabled, .btn[disabled], .btn.is-disabled { opacity: 0.48; pointer-events: none; }

.btn-primary {
  background: var(--brand);
  color: #ffffff;
  box-shadow: var(--shadow-brand), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-primary:hover {
  filter: brightness(0.92);
  box-shadow: var(--shadow-brand-lg), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

.btn-glass {
  background: rgba(255, 255, 255, 0.76);
  color: var(--color-text-secondary);
  border: 0.5px solid var(--brand-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 1px 3px rgba(15, 23, 42, 0.05);
}
.btn-glass:hover {
  background: #ffffff;
  color: var(--brand);
  border-color: rgba(var(--brand-rgb), 0.35);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
}
.btn-ghost:hover { background: rgba(15, 23, 42, 0.05); color: var(--color-text-primary); }

.btn-danger {
  background: var(--color-red);
  color: #ffffff;
  box-shadow: 0 6px 16px -6px rgba(185, 28, 28, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-danger:hover { filter: brightness(0.9); transform: translateY(-1px); }

.btn-ink {
  background: var(--color-text-primary);
  color: #ffffff;
  box-shadow: 0 6px 16px -6px rgba(15, 23, 42, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.10);
}
.btn-ink:hover { background: #1e293b; transform: translateY(-1px); }

.btn-sm { padding: 6px 12px; font-size: 12px; gap: 5px; border-radius: var(--radius-sm); }
.btn-md { padding: 9px 16px; font-size: 13px; border-radius: var(--radius-md); }
.btn-lg { padding: 12px 22px; font-size: 14px; border-radius: var(--radius-md); }
.btn-pill { border-radius: var(--radius-full); }

.btn-icon, .btn-icon-sm {
  padding: 0;
  background: rgba(255, 255, 255, 0.72);
  border: 0.5px solid rgba(15, 23, 42, 0.08);
  color: var(--color-text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.btn-icon { width: 32px; height: 32px; }
.btn-icon-sm { width: 26px; height: 26px; }
.btn-icon:hover, .btn-icon-sm:hover { background: #ffffff; color: var(--color-text-primary); border-color: rgba(15, 23, 42, 0.14); }

/* ─── Status badges ────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  border-radius: var(--radius-full);
  border: 0.5px solid;
  white-space: nowrap;
}
.badge .badge-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge-success { background: var(--color-green-bg); color: var(--color-green-strong); border-color: var(--color-green-border); }
.badge-warn    { background: var(--color-amber-bg); color: var(--color-amber-text);   border-color: var(--color-amber-border); }
.badge-error   { background: var(--color-red-bg);   color: var(--color-red-text);     border-color: var(--color-red-border); }
.badge-neutral { background: rgba(15, 23, 42, 0.05); color: var(--color-text-secondary); border-color: rgba(15, 23, 42, 0.10); }
.badge-brand   { background: rgba(var(--brand-rgb), 0.10); color: var(--brand); border-color: var(--brand-border); }

/* ─── Chips / pills ───────────────────────────────────────────────────── */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.76);
  border: 0.5px solid var(--brand-border);
  color: var(--brand);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 1px 4px rgba(15, 23, 42, 0.05);
  cursor: pointer;
  transition: opacity var(--t-base), transform var(--t-base);
  white-space: nowrap;
}
.chip:hover { opacity: 0.82; }
.chip-neutral { background: rgba(15, 23, 42, 0.05); color: var(--color-text-secondary); border-color: rgba(15, 23, 42, 0.08); }
.chip-neutral:hover { background: rgba(15, 23, 42, 0.08); opacity: 1; }
.chip-active {
  background: var(--brand);
  color: #ffffff;
  border-color: rgba(var(--brand-rgb), 0.25);
  box-shadow: var(--shadow-brand), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.chip .chip-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-dot-live {
  background: var(--brand);
  width: 6px; height: 6px; border-radius: 50%;
  animation: ds-pip-pulse 2.4s ease-in-out infinite;
}
@keyframes ds-pip-pulse {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(var(--brand-rgb), 0.45); }
  50% { opacity: 0.7; transform: scale(0.85); box-shadow: 0 0 0 5px rgba(var(--brand-rgb), 0); }
}

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

.table-wrap { overflow: hidden; border-radius: var(--radius-2xl); }
table { width: 100%; border-collapse: collapse; font-family: var(--font-ui); font-size: 13px; }
table th {
  text-align: left;
  padding: 11px 18px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  background: rgba(255, 255, 255, 0.28);
  border-bottom: var(--hairline-quiet);
  white-space: nowrap;
}
table td { padding: 12px 18px; border-top: var(--hairline-quiet); color: var(--color-text-secondary); vertical-align: middle; }
table tbody tr:first-child td { border-top: none; }
table tbody tr:hover td { background: rgba(255, 255, 255, 0.32); }
table td.mono-cell, table td.num-cell { font-family: var(--font-mono); font-size: 12.5px; color: var(--color-text-primary); letter-spacing: -0.01em; }
table td.name-cell { color: var(--color-text-primary); font-weight: 500; }
table td.actions-cell { text-align: right; white-space: nowrap; }

/* ─── Kicker labels ───────────────────────────────────────────────────── */

.kicker {
  font-family: var(--font-ui);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.kicker::before { content: ''; display: block; width: 16px; height: 1.5px; background: linear-gradient(90deg, var(--brand), transparent); flex-shrink: 0; }
.kicker.plain::before { content: none; }

/* ─── Stat values ─────────────────────────────────────────────────────── */

.stat-val { font-family: var(--font-mono); font-size: 26px; font-weight: 500; letter-spacing: -0.02em; line-height: 1; color: var(--color-text-primary); }

/* ─── Nav active state ────────────────────────────────────────────────── */

.nav-link-active {
  background: var(--brand) !important;
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 4px 14px -6px rgba(var(--brand-rgb), 0.52) !important;
}

/* ─── Segmented control ───────────────────────────────────────────────── */

.seg { display: inline-flex; padding: 3px; background: rgba(15, 23, 42, 0.04); border-radius: var(--radius-full); border: 0.5px solid rgba(15, 23, 42, 0.05); gap: 2px; }
.seg button {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  color: var(--color-text-tertiary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background var(--t-base), color var(--t-base), box-shadow var(--t-base);
}
.seg button.active, .seg button[data-active="true"] {
  background: #ffffff;
  color: var(--color-text-primary);
  box-shadow: var(--shadow-sm), 0 0 0 0.5px rgba(15, 23, 42, 0.04);
}
.seg button:hover:not(.active):not([data-active="true"]) { color: var(--color-text-primary); background: rgba(255, 255, 255, 0.45); }

/* ─── Toggle switch ───────────────────────────────────────────────────── */

.toggle-wrap { position: relative; width: 38px; height: 22px; display: inline-block; flex-shrink: 0; }
.toggle-wrap input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute; inset: 0;
  background: var(--color-border);
  border-radius: var(--radius-full);
  transition: background var(--t-base);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
  cursor: pointer;
}
.toggle-track::after {
  content: ''; position: absolute;
  width: 16px; height: 16px;
  background: #ffffff; border-radius: 50%;
  left: 3px; top: 3px;
  transition: transform var(--t-base);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18);
}
.toggle-wrap input:checked + .toggle-track { background: var(--brand); }
.toggle-wrap input:checked + .toggle-track::after { transform: translateX(16px); }

/* ─── Modal ────────────────────────────────────────────────────────────── */

.modal-scrim { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 24px; }
.modal {
  background: rgba(255, 255, 255, 0.98);
  border: 0.5px solid rgba(255, 255, 255, 0.90);
  border-radius: var(--radius-2xl);
  padding: 28px 32px;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.95) inset, 0 24px 64px rgba(15, 23, 42, 0.18);
}
.modal h3 { font-family: var(--font-ui); font-size: 16px; font-weight: 700; color: var(--color-text-primary); margin-bottom: 6px; letter-spacing: -0.01em; }
.modal p.lead { font-size: 13px; color: var(--color-text-secondary); margin-bottom: 16px; font-family: var(--font-ui); line-height: 1.55; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions > * { flex: 1; }

/* ─── Toast ────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-lg);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-primary);
  animation: ds-toast-in 240ms ease-out;
  z-index: 300;
}
.toast-success { background: var(--color-green-bg); border: 0.5px solid var(--color-green-border); }
.toast-icon { width: 18px; height: 18px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.toast-close { background: transparent; border: none; cursor: pointer; color: var(--color-text-tertiary); padding: 0; }
@keyframes ds-toast-in { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }

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

.empty-state { text-align: center; padding: 40px 20px; color: var(--color-text-tertiary); }
.empty-state-icon { width: 48px; height: 48px; border-radius: var(--radius-lg); background: rgba(15, 23, 42, 0.04); display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; color: var(--color-text-tertiary); }
.empty-state h4 { font-family: var(--font-ui); font-size: 14px; font-weight: 700; color: var(--color-text-primary); margin-bottom: 6px; }
.empty-state p { font-size: 13px; color: var(--color-text-secondary); max-width: 320px; margin: 0 auto 18px; }

/* ─── Onboarding step states ──────────────────────────────────────────── */

.onboard-step-done   { background: var(--color-green-bg); border: 0.5px solid var(--color-green-border); }
.onboard-step-active { background: rgba(var(--brand-rgb), 0.09); border: 0.5px solid rgba(var(--brand-rgb), 0.28); }
.onboard-step-future { background: rgba(15, 23, 42, 0.02); border: 0.5px solid rgba(15, 23, 42, 0.05); opacity: 0.55; }

/* ─── Delivery bar ────────────────────────────────────────────────────── */

.deliver-bar { height: 4px; border-radius: var(--radius-full); background: rgba(15, 23, 42, 0.06); overflow: hidden; }
.deliver-bar-fill { height: 100%; background: linear-gradient(90deg, var(--color-green-strong), #34d399); border-radius: var(--radius-full); transition: width var(--t-slow); }

/* ─── Form labels ─────────────────────────────────────────────────────── */

.field-label { font-family: var(--font-ui); font-size: 11px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--color-text-tertiary); display: block; margin-bottom: 6px; }
.field-hint { font-size: 11.5px; color: var(--color-text-tertiary); margin-top: 5px; line-height: 1.4; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid > .full { grid-column: 1 / -1; }

/* ─── Section typography ──────────────────────────────────────────────── */

.section-title { font-family: var(--font-ui); font-size: 14px; font-weight: 700; color: var(--color-text-primary); letter-spacing: -0.01em; }
.section-sub { font-size: 12px; color: var(--color-text-secondary); margin-top: 2px; }
.view-all-link { font-family: var(--font-ui); font-size: 12px; font-weight: 600; color: var(--brand); display: inline-flex; align-items: center; gap: 4px; text-decoration: none; transition: opacity var(--t-base); }
.view-all-link:hover { opacity: 0.72; }

/* ─── Quick action rows ───────────────────────────────────────────────── */

.qa-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; width: 100%; text-align: left; border-top: var(--hairline-quiet); background: transparent; border-left: none; border-right: none; border-bottom: none; cursor: pointer; transition: background var(--t-base); font-family: var(--font-ui); }
.qa-row:first-child { border-top: none; }
.qa-row:hover { background: rgba(var(--brand-rgb), 0.05); }
.qa-row-icon { width: 30px; height: 30px; border-radius: 8px; background: rgba(var(--brand-rgb), 0.10); color: var(--brand); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.qa-row-label { flex: 1; font-size: 13px; font-weight: 600; color: var(--color-text-primary); }

/* ─── Slider / range ───────────────────────────────────────────────────────
   Two layers, pick whichever fits:

   1) NATIVE — enhanced <input type="range">. Fine for a single value with a
      simple filled track, e.g. a volume or quantity control.

   2) CUSTOM — .slider / .slider-track / .slider-fill / .slider-tick /
      .slider-thumb div-based markup. Use this whenever you need multiple
      thumbs (a date RANGE), tick marks, or snap-point indicators — things
      a native <input type="range"> cannot do. JS positions .slider-fill's
      left/width and each .slider-thumb's left as percentages; CSS only
      handles the visual language. See README for a markup example. ────── */

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(15, 23, 42, 0.08);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: var(--shadow-brand), 0 0 0 3px #fff;
  cursor: pointer;
  transition: transform var(--t-fast);
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.12); }
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--brand); border: 3px solid #fff;
  box-shadow: var(--shadow-brand);
  cursor: pointer;
}
input[type="range"]::-moz-range-track { background: rgba(15, 23, 42, 0.08); height: 4px; border-radius: var(--radius-full); }

.slider { position: relative; width: 100%; height: 32px; display: flex; align-items: center; }
.slider-track {
  position: absolute;
  left: 0; right: 0;
  height: 4px;
  border-radius: var(--radius-full);
  background: rgba(15, 23, 42, 0.08);
}
.slider-fill {
  position: absolute;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--brand);
  /* left / width set by JS as percentages, e.g. style={{ left: '20%', width: '45%' }} */
}
.slider-thumb {
  position: absolute;
  top: 50%;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: var(--shadow-brand), 0 0 0 3px #fff;
  transform: translate(-50%, -50%);
  cursor: grab;
  transition: transform var(--t-fast);
  /* left set by JS as a percentage, e.g. style={{ left: '20%' }} */
}
.slider-thumb:active { cursor: grabbing; transform: translate(-50%, -50%) scale(1.15); }
.slider-tick {
  position: absolute;
  top: 50%;
  width: 2px; height: 8px;
  background: rgba(15, 23, 42, 0.15);
  transform: translate(-50%, -50%);
  border-radius: 1px;
  /* left set by JS as a percentage */
}
.slider-tick.snap {
  background: rgba(var(--brand-rgb), 0.4);
  height: 10px;
}
.slider-label {
  position: absolute;
  top: -22px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-text-tertiary);
  transform: translateX(-50%);
  white-space: nowrap;
}

/* ─── Checkbox ────────────────────────────────────────────────────────── */

.checkbox { position: relative; width: 18px; height: 18px; flex-shrink: 0; display: inline-block; }
.checkbox input { position: absolute; opacity: 0; width: 18px; height: 18px; margin: 0; cursor: pointer; }
.checkbox-box {
  width: 18px; height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface-solid);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  pointer-events: none;
}
.checkbox-box svg { width: 12px; height: 12px; opacity: 0; transform: scale(0.6); transition: opacity var(--transition-fast), transform var(--transition-fast); stroke: #fff; }
.checkbox input:checked + .checkbox-box { background: var(--brand); border-color: var(--brand); }
.checkbox input:checked + .checkbox-box svg { opacity: 1; transform: scale(1); }
.checkbox input:focus-visible + .checkbox-box { box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.18); }

/* ─── Radio ───────────────────────────────────────────────────────────── */

.radio { position: relative; width: 18px; height: 18px; flex-shrink: 0; display: inline-block; }
.radio input { position: absolute; opacity: 0; width: 18px; height: 18px; margin: 0; cursor: pointer; }
.radio-dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface-solid);
  display: flex; align-items: center; justify-content: center;
  transition: border-color var(--transition-fast);
  pointer-events: none;
}
.radio-dot::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); opacity: 0; transform: scale(0.5); transition: opacity var(--transition-fast), transform var(--transition-fast); }
.radio input:checked + .radio-dot { border-color: var(--brand); }
.radio input:checked + .radio-dot::after { opacity: 1; transform: scale(1); }
.radio input:focus-visible + .radio-dot { box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.18); }

.check-row { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check-row-label { font-size: 13px; color: var(--color-text-primary); }

/* ─── Search input ────────────────────────────────────────────────────── */

.search-input-wrap { position: relative; display: flex; align-items: center; }
.search-input-wrap svg { position: absolute; left: 12px; width: 15px; height: 15px; color: var(--color-text-tertiary); pointer-events: none; }
.search-input-wrap input { padding-left: 34px !important; }
.search-input-wrap .search-clear {
  position: absolute; right: 8px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.06);
  border: none;
  color: var(--color-text-tertiary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* ─── Stepper (multi-step progress) ──────────────────────────────────────
   e.g. invoice creation, onboarding, checkout. Numbered circles connected
   by a line; states mirror .onboard-step-* semantics. ─────────────────── */

.stepper { display: flex; align-items: center; }
.step { display: flex; align-items: center; gap: 10px; }
.step-circle {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  transition: background var(--transition-base), color var(--transition-base), border-color var(--transition-base);
  border: 1.5px solid var(--color-border);
  color: var(--color-text-tertiary);
  background: var(--color-surface-solid);
}
.step-label { font-family: var(--font-ui); font-size: 12.5px; font-weight: 600; color: var(--color-text-tertiary); white-space: nowrap; }
.step-line { width: 40px; height: 1.5px; background: var(--color-border); margin: 0 8px; flex-shrink: 0; }

.step.done .step-circle { background: var(--color-green-strong); border-color: var(--color-green-strong); color: #fff; }
.step.done .step-label { color: var(--color-text-secondary); }
.step.done + .step-line { background: var(--color-green-strong); }

.step.active .step-circle { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 0 0 4px rgba(var(--brand-rgb), 0.14); }
.step.active .step-label { color: var(--color-text-primary); }

@media (max-width: 640px) {
  .step-label { display: none; }
  .step-line { width: 20px; }
}

/* ─── File upload / dropzone ─────────────────────────────────────────── */

.dropzone {
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition-base), background var(--transition-base);
  background: rgba(255, 255, 255, 0.4);
}
.dropzone:hover, .dropzone.is-dragover {
  border-color: var(--brand);
  background: rgba(var(--brand-rgb), 0.05);
}
.dropzone-icon { width: 36px; height: 36px; margin: 0 auto 10px; border-radius: var(--radius-md); background: rgba(var(--brand-rgb), 0.10); color: var(--brand); display: flex; align-items: center; justify-content: center; }
.dropzone-text { font-size: 13px; font-weight: 600; color: var(--color-text-primary); margin-bottom: 3px; }
.dropzone-hint { font-size: 11.5px; color: var(--color-text-tertiary); }

.file-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.5);
  border: var(--hairline-quiet);
  margin-top: 8px;
}
.file-row-icon { width: 28px; height: 28px; border-radius: var(--radius-sm); background: rgba(var(--brand-rgb), 0.10); color: var(--brand); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.file-row-name { font-size: 12.5px; font-weight: 500; color: var(--color-text-primary); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row-size { font-family: var(--font-mono); font-size: 11px; color: var(--color-text-tertiary); }

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

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(15, 23, 42, 0.10); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(15, 23, 42, 0.18); background-clip: padding-box; border: 2px solid transparent; }
