/* =====================================================================
   Design system — shared by the checkout page and the admin.
   Tokens → base → form controls → buttons. Dark mode follows the OS
   unless the user picks a theme (html[data-theme="light" | "dark"]).
   ===================================================================== */

:root {
  color-scheme: light;

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  /* surfaces */
  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-2: #f8f9fd;
  --sunken: #eceef7;
  --line: #e4e7f1;
  --line-strong: #d2d7e8;

  /* text */
  --text: #0e1124;
  --text-2: #4b5170;
  --text-3: #7c829f;

  /* brand */
  --brand: #5b5ef4;
  --brand-2: #9a5cf6;
  --brand-soft: rgba(91, 94, 244, 0.1);
  --brand-ring: rgba(91, 94, 244, 0.3);
  --grad: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);

  /* status */
  --ok: #0c9a6b;
  --ok-soft: rgba(12, 154, 107, 0.12);
  --warn: #b26a00;
  --warn-soft: rgba(224, 138, 0, 0.14);
  --danger: #dc3350;
  --danger-soft: rgba(220, 51, 80, 0.1);
  --info: #3b6cf6;
  --info-soft: rgba(59, 108, 246, 0.11);

  /* depth */
  --shadow-sm: 0 1px 2px rgba(20, 24, 60, 0.05), 0 1px 3px rgba(20, 24, 60, 0.05);
  --shadow-md: 0 10px 30px -12px rgba(30, 36, 90, 0.2), 0 2px 6px rgba(30, 36, 90, 0.05);
  --shadow-lg: 0 30px 70px -24px rgba(30, 36, 90, 0.4);
  --shadow-brand: 0 10px 24px -8px rgba(91, 94, 244, 0.55);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #090b12;
    --surface: #11141e;
    --surface-2: #161a26;
    --sunken: #0d1019;
    --line: #232838;
    --line-strong: #2f364b;
    --text: #eef0fa;
    --text-2: #aab0cc;
    --text-3: #7b829f;
    --brand: #7b7ef8;
    --brand-2: #b07cfa;
    --brand-soft: rgba(123, 126, 248, 0.14);
    --brand-ring: rgba(123, 126, 248, 0.4);
    --ok: #3ddba3;
    --ok-soft: rgba(61, 219, 163, 0.13);
    --warn: #f5b84a;
    --warn-soft: rgba(245, 184, 74, 0.14);
    --danger: #ff7a90;
    --danger-soft: rgba(255, 122, 144, 0.13);
    --info: #7ea2ff;
    --info-soft: rgba(126, 162, 255, 0.14);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 12px 32px -12px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 30px 70px -24px rgba(0, 0, 0, 0.85);
    --shadow-brand: 0 10px 28px -8px rgba(123, 126, 248, 0.45);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090b12;
  --surface: #11141e;
  --surface-2: #161a26;
  --sunken: #0d1019;
  --line: #232838;
  --line-strong: #2f364b;
  --text: #eef0fa;
  --text-2: #aab0cc;
  --text-3: #7b829f;
  --brand: #7b7ef8;
  --brand-2: #b07cfa;
  --brand-soft: rgba(123, 126, 248, 0.14);
  --brand-ring: rgba(123, 126, 248, 0.4);
  --ok: #3ddba3;
  --ok-soft: rgba(61, 219, 163, 0.13);
  --warn: #f5b84a;
  --warn-soft: rgba(245, 184, 74, 0.14);
  --danger: #ff7a90;
  --danger-soft: rgba(255, 122, 144, 0.13);
  --info: #7ea2ff;
  --info-soft: rgba(126, 162, 255, 0.14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 12px 32px -12px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 30px 70px -24px rgba(0, 0, 0, 0.85);
  --shadow-brand: 0 10px 28px -8px rgba(123, 126, 248, 0.45);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.55 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
h1, h2, h3 { letter-spacing: -0.02em; line-height: 1.2; margin: 0; }
p { margin: 0; }
a { color: var(--brand); }
code { font-family: var(--font-mono); font-size: 0.9em; background: var(--sunken); padding: 1px 6px; border-radius: 6px; }
svg.icon { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hide { display: none !important; }
.muted { color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--brand-ring); }

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

/* ---------- Form controls ---------- */
label { display: block; font-size: 13px; font-weight: 550; color: var(--text-2); margin-bottom: 14px; }
input, select, textarea {
  font: inherit; color: var(--text); width: 100%;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  padding: 11px 13px; margin-top: 6px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
input::placeholder, textarea::placeholder { color: var(--text-3); font-weight: 400; }
input:hover, select:hover, textarea:hover { border-color: var(--text-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
textarea { min-height: 84px; resize: vertical; }
select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237c829f' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }

/* Toggle switch: <input type="checkbox" class="switch"> */
input.switch {
  appearance: none; width: 40px; height: 24px; padding: 0; margin: 0; flex: none; cursor: pointer;
  border-radius: 99px; background: var(--line-strong); border: 0; position: relative;
  transition: background 0.2s var(--ease);
}
input.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.2s var(--ease);
}
input.switch:checked { background: var(--grad); }
input.switch:checked::after { transform: translateX(16px); }
input.switch:focus-visible { box-shadow: 0 0 0 4px var(--brand-ring); }

/* ---------- Buttons ---------- */
button {
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  padding: 9px 16px; min-height: 40px;
  transition: transform 0.15s var(--ease), box-shadow 0.15s, background 0.15s, border-color 0.15s, opacity 0.15s;
}
button:hover { border-color: var(--text-3); background: var(--surface-2); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
button.primary { color: #fff; border: 0; background: var(--grad); box-shadow: var(--shadow-brand); }
button.primary:hover { filter: brightness(1.07); transform: translateY(-1px); background: var(--grad); }
button.success { color: #fff; border: 0; background: linear-gradient(135deg, #0c9a6b, #14b886); box-shadow: 0 10px 22px -10px rgba(12, 154, 107, 0.7); }
button.success:hover { filter: brightness(1.06); background: linear-gradient(135deg, #0c9a6b, #14b886); transform: translateY(-1px); }
button.danger { color: var(--danger); }
button.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
button.small { min-height: 30px; padding: 4px 12px; font-size: 13px; border-radius: var(--r-sm); }
button.full { width: 100%; }
button.icon-only { padding: 0; width: 40px; }
