/* ==========================================================================
   ACD Commerce Cloud: design system
   One stylesheet for the public site, customer portal and owner console.
   Rules for integration with the PHP brain:
   - No inline styles or scripts anywhere (brain CSP: default-src/style-src 'self').
   - Colours come only from the tokens below; components never hard-code colours.
   - Motion is decorative and switched off for prefers-reduced-motion.
   ========================================================================== */

/* ---------- 1. Tokens ---------------------------------------------------- */
:root {
  --font-sans: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Consolas, monospace;

  /* Brand: emerald for "synced/healthy", violet for WooCommerce side, lime for Shopify side */
  --brand-50: #ecfdf5;  --brand-100: #d1fae5; --brand-200: #a7f3d0; --brand-400: #34d399;
  --brand-500: #10b981; --brand-600: #059669; --brand-700: #047857; --brand-800: #065f46; --brand-900: #064e3b;
  --violet-500: #8b5cf6; --violet-600: #7c3aed; --violet-100: #ede9fe;
  --lime-500: #84cc16;   --lime-600: #65a30d;   --lime-100: #ecfccb;
  --sky-500: #0ea5e9;    --amber-500: #f59e0b;  --rose-500: #f43f5e;

  --bg: #f5f7f6;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, rgba(16,185,129,.10), transparent 60%),
             radial-gradient(900px 500px at -10% 10%, rgba(139,92,246,.08), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f0f4f2;
  --surface-3: #e7ede9;
  --glass: rgba(255,255,255,.72);
  --border: #e1e8e4;
  --border-strong: #cad5cf;
  --text: #0c1c17;
  --text-2: #43564f;
  --text-3: #75877f;
  --text-inverse: #ffffff;

  --primary: var(--brand-600);
  --primary-hover: var(--brand-700);
  --primary-soft: var(--brand-50);
  --primary-text: var(--brand-800);
  --woo: var(--violet-600);   --woo-soft: var(--violet-100);
  --shopify: var(--lime-600); --shopify-soft: var(--lime-100);

  --success: #059669; --success-soft: #d1fae5; --success-text: #065f46;
  --warning: #d97706; --warning-soft: #fef3c7; --warning-text: #92400e;
  --danger:  #dc2626; --danger-soft:  #fee2e2; --danger-text:  #991b1b;
  --info:    #2563eb; --info-soft:    #dbeafe; --info-text:    #1e40af;
  --neutral-soft: #eef2f0; --neutral-text: #475a53;

  --grad-brand: linear-gradient(135deg, #059669 0%, #10b981 45%, #7c3aed 100%);
  --grad-soft: linear-gradient(135deg, rgba(16,185,129,.14), rgba(124,58,237,.12));

  --radius-xs: 6px; --radius-sm: 8px; --radius: 12px; --radius-lg: 16px; --radius-xl: 22px; --radius-full: 999px;
  --shadow-xs: 0 1px 2px rgba(12,28,23,.06);
  --shadow-sm: 0 1px 3px rgba(12,28,23,.08), 0 1px 2px rgba(12,28,23,.04);
  --shadow: 0 6px 18px -6px rgba(12,28,23,.12), 0 2px 6px rgba(12,28,23,.05);
  --shadow-lg: 0 24px 48px -16px rgba(12,28,23,.22), 0 8px 16px -8px rgba(12,28,23,.08);
  --ring: 0 0 0 4px rgba(16,185,129,.28);

  --ease: cubic-bezier(.2,.8,.2,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
  --dur-fast: 140ms; --dur: 240ms; --dur-slow: 520ms;

  --sidebar-w: 264px;
  --topbar-h: 64px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #07100d;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, rgba(16,185,129,.12), transparent 60%),
             radial-gradient(900px 500px at -10% 10%, rgba(139,92,246,.12), transparent 60%);
  --surface: #0e1814; --surface-2: #13201b; --surface-3: #1a2923; --glass: rgba(14,24,20,.72);
  --border: #1f2f28; --border-strong: #2c3f37;
  --text: #e7f1ec; --text-2: #a9bbb3; --text-3: #71847c;
  --primary: var(--brand-400); --primary-hover: var(--brand-200); --primary-soft: rgba(52,211,153,.12); --primary-text: var(--brand-200);
  --woo: #a78bfa; --woo-soft: rgba(167,139,250,.14); --shopify: #a3e635; --shopify-soft: rgba(163,230,53,.12);
  --success: #34d399; --success-soft: rgba(52,211,153,.14); --success-text: #6ee7b7;
  --warning: #fbbf24; --warning-soft: rgba(251,191,36,.14); --warning-text: #fcd34d;
  --danger: #f87171;  --danger-soft: rgba(248,113,113,.14); --danger-text: #fca5a5;
  --info: #60a5fa;    --info-soft: rgba(96,165,250,.14);    --info-text: #93c5fd;
  --neutral-soft: rgba(255,255,255,.06); --neutral-text: #a9bbb3;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.4); --shadow-sm: 0 1px 3px rgba(0,0,0,.45);
  --shadow: 0 8px 22px -8px rgba(0,0,0,.6); --shadow-lg: 0 28px 56px -18px rgba(0,0,0,.75);
  --ring: 0 0 0 4px rgba(52,211,153,.30);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #07100d;
    --bg-grad: radial-gradient(1200px 600px at 100% -10%, rgba(16,185,129,.12), transparent 60%),
               radial-gradient(900px 500px at -10% 10%, rgba(139,92,246,.12), transparent 60%);
    --surface: #0e1814; --surface-2: #13201b; --surface-3: #1a2923; --glass: rgba(14,24,20,.72);
    --border: #1f2f28; --border-strong: #2c3f37;
    --text: #e7f1ec; --text-2: #a9bbb3; --text-3: #71847c;
    --primary: var(--brand-400); --primary-hover: var(--brand-200); --primary-soft: rgba(52,211,153,.12); --primary-text: var(--brand-200);
    --woo: #a78bfa; --woo-soft: rgba(167,139,250,.14); --shopify: #a3e635; --shopify-soft: rgba(163,230,53,.12);
    --success: #34d399; --success-soft: rgba(52,211,153,.14); --success-text: #6ee7b7;
    --warning: #fbbf24; --warning-soft: rgba(251,191,36,.14); --warning-text: #fcd34d;
    --danger: #f87171;  --danger-soft: rgba(248,113,113,.14); --danger-text: #fca5a5;
    --info: #60a5fa;    --info-soft: rgba(96,165,250,.14);    --info-text: #93c5fd;
    --neutral-soft: rgba(255,255,255,.06); --neutral-text: #a9bbb3;
    --shadow-xs: 0 1px 2px rgba(0,0,0,.4); --shadow-sm: 0 1px 3px rgba(0,0,0,.45);
    --shadow: 0 8px 22px -8px rgba(0,0,0,.6); --shadow-lg: 0 28px 56px -18px rgba(0,0,0,.75);
    --ring: 0 0 0 4px rgba(52,211,153,.30);
    color-scheme: dark;
  }
}

/* ---------- 2. Base ------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh;
  font-family: var(--font-sans); font-size: 15px; line-height: 1.55;
  color: var(--text); background: var(--bg) var(--bg-grad) fixed;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.15; letter-spacing: -.022em; color: var(--text); }
h1 { font-size: clamp(30px, 4.2vw, 46px); font-weight: 800; }
h2 { font-size: clamp(22px, 2.4vw, 28px); font-weight: 750; }
h3 { font-size: 18px; font-weight: 700; }
h4 { font-size: 15px; font-weight: 650; }
p { margin: 0 0 1em; color: var(--text-2); }
a { color: var(--primary); text-decoration: none; transition: color var(--dur-fast) var(--ease); }
a:hover { color: var(--primary-hover); }
small, .small { font-size: 13px; }
code, kbd, .mono { font-family: var(--font-mono); font-size: .92em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
::selection { background: rgba(16,185,129,.25); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-xs); }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--text); color: var(--surface); }
.skip-link:focus { top: 12px; color: var(--surface); }

/* ---------- 3. Icons ----------------------------------------------------- */
.icon { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: middle; }
.icon-xs { width: 14px; height: 14px; } .icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 22px; height: 22px; } .icon-xl { width: 28px; height: 28px; }
.icon-tile {
  width: 42px; height: 42px; flex: none; display: grid; place-items: center;
  border-radius: 12px; background: var(--primary-soft); color: var(--primary);
}
.icon-tile .icon { width: 20px; height: 20px; }
.icon-tile.lg { width: 54px; height: 54px; border-radius: 16px; } .icon-tile.lg .icon { width: 26px; height: 26px; }
.icon-tile.sm { width: 32px; height: 32px; border-radius: 9px; } .icon-tile.sm .icon { width: 16px; height: 16px; }
.tone-woo { background: var(--woo-soft); color: var(--woo); }
.tone-shopify { background: var(--shopify-soft); color: var(--shopify); }
.tone-info { background: var(--info-soft); color: var(--info); }
.tone-warning { background: var(--warning-soft); color: var(--warning); }
.tone-danger { background: var(--danger-soft); color: var(--danger); }
.tone-neutral { background: var(--neutral-soft); color: var(--neutral-text); }
.tone-grad { background: var(--grad-brand); color: #fff; box-shadow: 0 8px 20px -8px rgba(5,150,105,.6); }

/* ---------- 4. Layout primitives ----------------------------------------- */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 760px; }
.stack > * + * { margin-top: var(--stack, 16px); }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.gap-sm { gap: 10px; } .gap-lg { gap: 28px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 40px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.text-center { text-align: center; } .text-right { text-align: right; }
.muted { color: var(--text-3); } .text-2 { color: var(--text-2); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.break { overflow-wrap: anywhere; }
.hide-sm { } .show-sm { display: none; }

/* ---------- 5. Buttons --------------------------------------------------- */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--text); --btn-bd: var(--border-strong);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid var(--btn-bd);
  background: var(--btn-bg); color: var(--btn-fg); font: 600 14px/1 var(--font-sans); white-space: nowrap;
  cursor: pointer; user-select: none; overflow: hidden; text-decoration: none;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease), background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.btn:hover { color: var(--btn-fg); border-color: var(--text-3); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0) scale(.98); }
.btn[disabled], .btn.is-disabled { opacity: .55; pointer-events: none; }
.btn-primary { --btn-bg: var(--primary); --btn-fg: #fff; --btn-bd: transparent; box-shadow: 0 6px 16px -6px rgba(5,150,105,.55); }
:root[data-theme="dark"] .btn-primary { --btn-fg: #04241a; }
.btn-primary:hover { --btn-bg: var(--primary-hover); border-color: transparent; box-shadow: 0 10px 22px -8px rgba(5,150,105,.6); }
.btn-primary::after { /* shine sweep */
  content: ""; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%);
}
.btn-primary:hover::after { transform: translateX(120%); transition: transform 700ms var(--ease); }
.btn-grad { --btn-bg: transparent; --btn-fg: #fff; --btn-bd: transparent; background: var(--grad-brand); background-size: 160% 160%; box-shadow: 0 10px 24px -10px rgba(124,58,237,.55); }
.btn-grad:hover { background-position: 100% 0; border-color: transparent; }
.btn-soft { --btn-bg: var(--primary-soft); --btn-fg: var(--primary-text); --btn-bd: transparent; }
.btn-soft:hover { border-color: transparent; }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; --btn-fg: var(--text-2); }
.btn-ghost:hover { --btn-bg: var(--surface-2); border-color: transparent; box-shadow: none; }
.btn-danger { --btn-bg: var(--danger-soft); --btn-fg: var(--danger-text); --btn-bd: transparent; }
.btn-danger:hover { --btn-bg: var(--danger); --btn-fg: #fff; border-color: transparent; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 7px; }
.btn-lg { height: 50px; padding: 0 24px; font-size: 16px; border-radius: var(--radius); }
.btn-icon { width: 40px; padding: 0; } .btn-icon.btn-sm { width: 32px; }
.btn-block { width: 100%; }
.btn .icon { width: 16px; height: 16px; }
.btn-lg .icon { width: 18px; height: 18px; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::before {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--btn-fg) transparent var(--btn-fg) transparent; animation: spin .7s linear infinite;
}
.btn-group { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.link-arrow { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.link-arrow .icon { width: 16px; height: 16px; transition: transform var(--dur) var(--ease); }
.link-arrow:hover .icon { transform: translateX(3px); }

/* ---------- 6. Surfaces -------------------------------------------------- */
.card {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); padding: 22px;
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.card-flush { padding: 0; overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.card-header h3 { margin: 0; }
.card-body { padding: 22px; }
.card-footer { padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); }
.card-title { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-title h3 { margin: 0; }
.card-glow::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: var(--grad-brand); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; opacity: .9;
}
.panel-soft { background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 18px; }
.divider-list > * + * { border-top: 1px solid var(--border); }

/* ---------- 7. Badges, pills, status ------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
  border-radius: var(--radius-full); font-size: 12px; font-weight: 650; white-space: nowrap;
  background: var(--neutral-soft); color: var(--neutral-text);
}
.badge .icon { width: 13px; height: 13px; }
.badge-success { background: var(--success-soft); color: var(--success-text); }
.badge-warning { background: var(--warning-soft); color: var(--warning-text); }
.badge-danger { background: var(--danger-soft); color: var(--danger-text); }
.badge-info { background: var(--info-soft); color: var(--info-text); }
.badge-brand { background: var(--primary-soft); color: var(--primary-text); }
.badge-woo { background: var(--woo-soft); color: var(--woo); }
.badge-shopify { background: var(--shopify-soft); color: var(--shopify); }
.badge-outline { background: transparent; border: 1px solid var(--border-strong); }
.badge-proposed { /* marks UI for features that are not built yet */
  background: repeating-linear-gradient(135deg, rgba(124,58,237,.14) 0 6px, rgba(124,58,237,.06) 6px 12px);
  color: var(--woo); border: 1px dashed rgba(124,58,237,.45); text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.dot-live { position: relative; }
.dot-live::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: currentColor; animation: ping 1.8s var(--ease) infinite; }
.status { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.status-success { color: var(--success); } .status-warning { color: var(--warning); } .status-danger { color: var(--danger); } .status-muted { color: var(--text-3); }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--primary); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--radius-full); border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; transition: all var(--dur-fast) var(--ease); }
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.is-active { background: var(--text); color: var(--surface); border-color: var(--text); }
.chip .count { font-size: 11px; padding: 1px 7px; border-radius: 10px; background: var(--surface-2); color: var(--text-2); }
.chip.is-active .count { background: rgba(255,255,255,.18); color: inherit; }

/* ---------- 8. Forms ----------------------------------------------------- */
.field { display: block; margin-bottom: 18px; }
.field > label, .label { display: block; margin-bottom: 7px; font-size: 13.5px; font-weight: 600; color: var(--text); }
.hint { margin-top: 6px; font-size: 12.5px; color: var(--text-3); }
.error-text { margin-top: 6px; font-size: 12.5px; color: var(--danger); display: flex; gap: 6px; align-items: center; }
.input, .select, .textarea {
  width: 100%; height: 44px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: 15px/1.2 var(--font-sans); transition: border-color var(--dur-fast), box-shadow var(--dur-fast), background-color var(--dur);
}
.textarea { height: auto; min-height: 96px; padding: 12px 14px; line-height: 1.5; resize: vertical; }
.select { appearance: none; padding-right: 38px; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 19px) 19px, calc(100% - 14px) 19px; background-size: 5px 5px; background-repeat: no-repeat; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(220,38,38,.14); }
.input[readonly] { background: var(--surface-2); }
.input-wrap { position: relative; }
.input-wrap > .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-wrap > .input { padding-left: 40px; }
.input-wrap > .input-action { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.input-group { display: flex; }
.input-group .input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; height: 44px; margin-left: -1px; }
.check, .radio { display: flex; align-items: flex-start; gap: 10px; margin: 10px 0; cursor: pointer; font-size: 14px; color: var(--text); }
.check input, .radio input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--primary); flex: none; }
.check .hint { display: block; margin-top: 2px; font-weight: 400; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px 6px; margin: 0 0 18px; }
legend { padding: 0 6px; font-size: 13px; font-weight: 700; color: var(--text-2); }

/* Toggle switch: <label class="switch"><input type="checkbox" role="switch"><span class="switch-track"></span> Label</label> */
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 42px; height: 24px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--border-strong); transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease); flex: none; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform var(--dur) var(--ease-spring); }
.switch input:checked + .switch-track { background: var(--primary); border-color: var(--primary); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--ring); }

/* Setting row: label + description on left, control on right */
.setting { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 0; }
.setting + .setting { border-top: 1px solid var(--border); }
.setting-text h4 { margin: 0 0 3px; }
.setting-text p { margin: 0; font-size: 13.5px; }

/* Password strength */
.strength { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.strength span { height: 4px; border-radius: 2px; background: var(--surface-3); transition: background-color var(--dur) var(--ease); }
.strength[data-score="1"] span:nth-child(-n+1) { background: var(--danger); }
.strength[data-score="2"] span:nth-child(-n+2) { background: var(--warning); }
.strength[data-score="3"] span:nth-child(-n+3) { background: var(--lime-500); }
.strength[data-score="4"] span { background: var(--success); }

/* ---------- 9. Alerts, toasts, empty states ------------------------------ */
.alert { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid transparent; background: var(--info-soft); color: var(--info-text); font-size: 14px; }
.alert .icon { margin-top: 1px; }
.alert p { color: inherit; margin: 0; }
.alert strong { display: block; margin-bottom: 2px; }
.alert-success { background: var(--success-soft); color: var(--success-text); }
.alert-warning { background: var(--warning-soft); color: var(--warning-text); }
.alert-danger { background: var(--danger-soft); color: var(--danger-text); }
.alert .alert-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 12px; min-width: 280px; max-width: 380px; padding: 12px 14px;
  border-radius: var(--radius); background: var(--text); color: var(--surface); box-shadow: var(--shadow-lg);
  pointer-events: auto; animation: toast-in var(--dur-slow) var(--ease-spring) both; font-size: 14px;
}
.toast .icon-tile { width: 30px; height: 30px; border-radius: 9px; background: rgba(255,255,255,.12); color: var(--brand-400); }
.toast.is-leaving { animation: toast-out var(--dur) var(--ease) both; }

.empty { text-align: center; padding: 42px 24px; }
.empty .icon-tile { margin: 0 auto 16px; }
.empty h3 { margin-bottom: 6px; }
.empty p { max-width: 420px; margin: 0 auto 18px; }

/* ---------- 10. Data display --------------------------------------------- */
.kpi { display: flex; flex-direction: column; gap: 10px; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-label { font-size: 13px; font-weight: 600; color: var(--text-3); }
.kpi-value { font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1; color: var(--text); font-variant-numeric: tabular-nums; }
.kpi-delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 700; }
.kpi-delta.up { color: var(--success); } .kpi-delta.down { color: var(--danger); }
.kpi .spark { height: 36px; width: 100%; }

.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th { position: sticky; top: 0; z-index: 1; padding: 11px 16px; text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: middle; }
.table tbody tr { transition: background-color var(--dur-fast) var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .cell-main { display: flex; align-items: center; gap: 12px; color: var(--text); font-weight: 600; }
.table .cell-sub { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-3); }
.table td.actions { text-align: right; white-space: nowrap; }

.progress { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--grad-brand); transition: width 1.1s var(--ease); }
.progress.is-warning > span { background: var(--warning); } .progress.is-danger > span { background: var(--danger); }
.progress-label { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-3); margin-bottom: 6px; }

.ring { position: relative; width: 84px; height: 84px; flex: none; }
.ring > svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 8; }
.ring .ring-bg { stroke: var(--surface-3); }
.ring .ring-fg { stroke: var(--primary); stroke-linecap: round; stroke-dasharray: 226; stroke-dashoffset: 226; transition: stroke-dashoffset 1.3s var(--ease); }
.ring-label { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 18px; }

.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 13px; font-weight: 700; color: #fff; background: var(--grad-brand); }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-group { display: flex; } .avatar-group .avatar { border: 2px solid var(--surface); margin-left: -8px; } .avatar-group .avatar:first-child { margin-left: 0; }

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--text-3); } .kv dd { margin: 0; color: var(--text); font-weight: 550; overflow-wrap: anywhere; }

.code-box { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); font-family: var(--font-mono); font-size: 13.5px; color: var(--text); }
.code-box .value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-big { font-size: 28px; letter-spacing: .18em; font-weight: 700; justify-content: center; padding: 18px; }

/* Timeline / activity feed */
.timeline { position: relative; margin: 0; padding: 0; list-style: none; }
.timeline li { position: relative; display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; padding: 10px 0; }
.timeline li::before { content: ""; position: absolute; left: 16px; top: 42px; bottom: -10px; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline .icon-tile { width: 34px; height: 34px; border-radius: 10px; }
.timeline .icon-tile .icon { width: 16px; height: 16px; }
.timeline h4 { margin: 2px 0 2px; font-size: 14px; }
.timeline p { margin: 0; font-size: 13px; }
.timeline time { font-size: 12px; color: var(--text-3); white-space: nowrap; padding-top: 4px; }

/* Checklist (onboarding) */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--border); }
.checklist li:first-child { border-top: 0; }
.check-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; border: 2px solid var(--border-strong); color: transparent; transition: all var(--dur) var(--ease-spring); }
.checklist li.is-done .check-dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.checklist li.is-done .check-dot .icon { animation: pop 420ms var(--ease-spring) both; }
.checklist li.is-done h4 { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--border-strong); }
.checklist li.is-current .check-dot { border-color: var(--primary); box-shadow: var(--ring); }
.checklist h4 { margin: 0; font-size: 14.5px; }
.checklist p { margin: 2px 0 0; font-size: 13px; }
.check-dot .icon { width: 14px; height: 14px; stroke-width: 3; }

/* Stepper (wizard) */
.stepper { display: flex; align-items: flex-start; gap: 0; list-style: none; margin: 0 0 32px; padding: 0; counter-reset: step; }
.stepper li { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; font-size: 13px; font-weight: 600; color: var(--text-3); }
.stepper li::before { counter-increment: step; content: counter(step); position: relative; z-index: 1; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); color: var(--text-3); font-weight: 700; transition: all var(--dur) var(--ease); }
.stepper li::after { content: ""; position: absolute; top: 17px; left: calc(50% + 22px); right: calc(-50% + 22px); height: 2px; background: var(--border); }
.stepper li:last-child::after { display: none; }
.stepper li.is-done { color: var(--text-2); }
.stepper li.is-done::before { content: "✓"; background: var(--primary); border-color: var(--primary); color: #fff; }
.stepper li.is-done::after { background: var(--primary); }
.stepper li.is-current { color: var(--text); }
.stepper li.is-current::before { border-color: var(--primary); color: var(--primary); box-shadow: var(--ring); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 12px 14px; border: 0; background: none; color: var(--text-3); font: 600 14px var(--font-sans); cursor: pointer; white-space: nowrap; transition: color var(--dur-fast) var(--ease); }
.tab::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--primary); transform: scaleX(0); transition: transform var(--dur) var(--ease); }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"], .tab[aria-current="page"] { color: var(--text); }
.tab[aria-selected="true"]::after, .tab[aria-current="page"]::after { transform: scaleX(1); }
.tab .count { font-size: 11px; padding: 1px 7px; border-radius: 10px; background: var(--surface-2); color: var(--text-2); }
.tab-panel[hidden] { display: none; }
.tab-panel { animation: fade-up var(--dur-slow) var(--ease) both; }
.segmented { display: inline-flex; padding: 3px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.segmented button { border: 0; background: transparent; padding: 6px 12px; border-radius: 6px; font: 600 13px var(--font-sans); color: var(--text-3); cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

/* Dropdown menu (details-based, works without JS) */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; min-width: 240px; padding: 6px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: pop-in var(--dur) var(--ease) both; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 8px; border: 0; background: none; color: var(--text-2); font: 500 14px var(--font-sans); text-align: left; cursor: pointer; }
.menu-item:hover { background: var(--surface-2); color: var(--text); }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--border); }

/* Modal (dialog element) */
dialog.modal { width: min(520px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog.modal[open] { animation: pop-in var(--dur-slow) var(--ease-spring) both; }
dialog.modal::backdrop { background: rgba(4,12,9,.55); backdrop-filter: blur(4px); }
.modal-head { display: flex; gap: 14px; padding: 22px 22px 0; }
.modal-body { padding: 16px 22px 8px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px 22px; }

/* Skeleton loading */
.skeleton { position: relative; overflow: hidden; border-radius: 6px; background: var(--surface-3); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent); animation: shimmer 1.4s infinite; }
:root[data-theme="dark"] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent); }
.sk-line { height: 12px; margin: 10px 0; } .sk-title { height: 22px; width: 45%; } .sk-block { height: 110px; }

/* ---------- 11. Public site ---------------------------------------------- */
.site-header { position: sticky; top: 0; z-index: 50; backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); background: var(--glass); border-bottom: 1px solid transparent; transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.site-header.is-scrolled { border-bottom-color: var(--border); box-shadow: var(--shadow-xs); }
.site-header .container { display: flex; align-items: center; gap: 24px; height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; font-size: 17px; letter-spacing: -.02em; }
.brand:hover { color: var(--text); }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--grad-brand); color: #fff; box-shadow: 0 6px 16px -6px rgba(5,150,105,.7); }
.brand-mark .icon { width: 18px; height: 18px; stroke-width: 2.4; }
.brand:hover .brand-mark .icon { animation: spin 900ms var(--ease); }
.brand small { display: block; font-size: 11px; font-weight: 600; color: var(--text-3); letter-spacing: .02em; }
.site-nav { display: flex; gap: 4px; margin-left: 12px; }
.site-nav a { padding: 8px 12px; border-radius: 8px; color: var(--text-2); font-weight: 600; font-size: 14px; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.site-header .header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.hero { position: relative; padding: 72px 0 56px; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center; }
.hero h1 { font-size: clamp(36px, 4.6vw, 58px); letter-spacing: -.04em; margin: 16px 0 18px; }
.gradient-text { background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent; background-size: 200% 200%; animation: grad-shift 8s ease infinite; }
.lead { font-size: clamp(17px, 1.6vw, 20px); color: var(--text-2); max-width: 580px; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 28px; }
.trust { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 28px; font-size: 13.5px; color: var(--text-3); }
.trust span { display: inline-flex; align-items: center; gap: 7px; }
.trust .icon { color: var(--primary); width: 16px; height: 16px; }
.hero-blob { position: absolute; z-index: -1; border-radius: 50%; filter: blur(60px); opacity: .5; animation: float 14s ease-in-out infinite; }
.hero-blob.b1 { width: 420px; height: 420px; right: -80px; top: -60px; background: rgba(16,185,129,.35); }
.hero-blob.b2 { width: 340px; height: 340px; left: -120px; bottom: -120px; background: rgba(124,58,237,.25); animation-delay: -5s; }

/* Animated sync visual */
.sync-visual { position: relative; padding: 26px; border-radius: var(--radius-xl); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.sync-visual::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--grad-soft); opacity: .6; pointer-events: none; }
.sync-nodes { position: relative; display: grid; grid-template-columns: 1fr 96px 1fr; align-items: center; }
.sync-node { position: relative; z-index: 1; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); animation: float 6s ease-in-out infinite; }
.sync-node:last-child { animation-delay: -3s; }
.sync-node h4 { margin: 10px 0 2px; }
.sync-node p { margin: 0; font-size: 12.5px; }
.sync-link { position: relative; height: 64px; }
.sync-link > svg { width: 100%; height: 100%; overflow: visible; }
.sync-link path { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 6 8; animation: dash 1.2s linear infinite; }
.sync-link .p1 { stroke: var(--woo); } .sync-link .p2 { stroke: var(--shopify); animation-direction: reverse; }
.sync-hub { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: var(--grad-brand); box-shadow: 0 0 0 8px rgba(16,185,129,.15), 0 12px 24px -8px rgba(5,150,105,.7); }
.sync-hub .icon { animation: spin 3.2s linear infinite; }
.event-feed { position: relative; margin-top: 22px; display: grid; gap: 10px; }
.event { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); font-size: 13.5px; animation: slide-in var(--dur-slow) var(--ease) both; }
.event .icon-tile { width: 30px; height: 30px; border-radius: 9px; } .event .icon-tile .icon { width: 15px; height: 15px; }
.event strong { color: var(--text); font-weight: 650; }
.event time { margin-left: auto; font-size: 12px; color: var(--text-3); white-space: nowrap; }

.section { padding: 72px 0; }
.section-alt { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { max-width: 640px; margin: 0 auto 40px; text-align: center; }
.section-head p { font-size: 17px; }
.feature { padding: 24px; }
.feature h3 { margin: 16px 0 6px; }
.feature p { margin: 0; font-size: 14.5px; }
.steps { counter-reset: s; display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.step { position: relative; padding: 22px; }
.step::before { counter-increment: s; content: "0" counter(s); display: block; margin-bottom: 14px; font-size: 13px; font-weight: 800; letter-spacing: .1em; color: var(--primary); }
.plan { display: flex; flex-direction: column; gap: 14px; padding: 28px; }
.plan.is-featured { border-color: transparent; box-shadow: var(--shadow-lg); transform: translateY(-8px); }
.plan .price { font-size: 42px; font-weight: 800; letter-spacing: -.04em; color: var(--text); line-height: 1; }
.plan .price small { font-size: 15px; font-weight: 600; color: var(--text-3); letter-spacing: 0; }
.plan ul { list-style: none; margin: 4px 0 8px; padding: 0; display: grid; gap: 10px; }
.plan li { display: flex; gap: 10px; font-size: 14px; color: var(--text-2); }
.plan li .icon { color: var(--primary); width: 17px; height: 17px; margin-top: 2px; }
.plan li.is-off { color: var(--text-3); } .plan li.is-off .icon { color: var(--text-3); }
.plan .btn { margin-top: auto; }
.ribbon { position: absolute; top: 16px; right: 16px; }
.faq details { border-bottom: 1px solid var(--border); padding: 16px 0; }
.faq summary { display: flex; justify-content: space-between; align-items: center; gap: 16px; cursor: pointer; font-weight: 650; list-style: none; color: var(--text); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .icon { transition: transform var(--dur) var(--ease); color: var(--text-3); }
.faq details[open] summary .icon { transform: rotate(180deg); }
.faq details p { margin: 10px 0 0; }
.cta { position: relative; overflow: hidden; padding: 48px; border-radius: var(--radius-xl); background: var(--grad-brand); color: #fff; }
.cta h2, .cta p { color: #fff; } .cta p { opacity: .88; }
.cta .btn { --btn-bg: #fff; --btn-fg: #064e3b; --btn-bd: transparent; }
.cta::after { content: ""; position: absolute; width: 380px; height: 380px; right: -120px; top: -140px; border-radius: 50%; background: rgba(255,255,255,.12); animation: float 10s ease-in-out infinite; }
.site-footer { padding: 48px 0 32px; border-top: 1px solid var(--border); margin-top: 40px; }
.site-footer .cols { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 32px; }
.site-footer h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14px; }
.site-footer ul a { color: var(--text-2); } .site-footer ul a:hover { color: var(--text); }
.legal { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-3); }

/* ---------- 12. Auth ----------------------------------------------------- */
.auth { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.auth-aside { position: sticky; top: 0; height: 100vh; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 40px; background: #05241b; color: #e7f1ec; }
.auth-aside::before { content: ""; position: absolute; inset: 0; background: radial-gradient(600px 400px at 90% 0%, rgba(16,185,129,.45), transparent 60%), radial-gradient(500px 400px at 0% 100%, rgba(124,58,237,.45), transparent 60%); animation: grad-shift 12s ease infinite; background-size: 140% 140%; }
.auth-aside > * { position: relative; }
.auth-aside h2, .auth-aside h3 { color: #fff; } .auth-aside p { color: rgba(231,241,236,.78); }
.auth-aside .brand, .auth-aside .brand:hover { color: #fff; }
.auth-quote { padding: 22px; border-radius: var(--radius-lg); background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); backdrop-filter: blur(6px); }
.auth-points { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 14px; }
.auth-points li { display: flex; gap: 12px; align-items: flex-start; color: rgba(231,241,236,.9); }
.auth-points .icon-tile { background: rgba(255,255,255,.1); color: #6ee7b7; width: 34px; height: 34px; border-radius: 10px; }
.auth-main { display: grid; min-width: 0; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; min-width: 0; max-width: 420px; }
.auth-card > .row-between { flex-wrap: wrap; gap: 12px; }
.auth-card h1 { font-size: 32px; }
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; font-size: 12.5px; color: var(--text-3); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- 13. App shell (portal + owner console) ----------------------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 18px 14px; background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; z-index: 60; }
.sidebar .brand { padding: 4px 8px 16px; }
.nav-section { margin: 14px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.nav-link { position: relative; display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; color: var(--text-2); font-weight: 600; font-size: 14px; transition: background-color var(--dur-fast), color var(--dur-fast); }
.nav-link .icon { width: 18px; height: 18px; color: var(--text-3); transition: color var(--dur-fast), transform var(--dur) var(--ease-spring); }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link:hover .icon { transform: scale(1.1); }
.nav-link[aria-current="page"] { background: var(--primary-soft); color: var(--primary-text); }
.nav-link[aria-current="page"] .icon { color: var(--primary); }
.nav-link[aria-current="page"]::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
.nav-link .badge { margin-left: auto; height: 20px; padding: 0 7px; font-size: 11px; }
.sidebar-foot { margin-top: auto; padding-top: 14px; }
.upgrade-card { padding: 16px; border-radius: var(--radius); background: var(--grad-soft); border: 1px solid var(--border); }
.upgrade-card h4 { margin: 8px 0 4px; } .upgrade-card p { font-size: 13px; margin-bottom: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px; border-radius: var(--radius); border: 1px solid var(--border); }
.user-chip strong { display: block; font-size: 13.5px; color: var(--text); } .user-chip > div span { display: block; font-size: 12px; color: var(--text-3); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 45; display: flex; align-items: center; gap: 12px; height: var(--topbar-h); padding: 0 28px; background: var(--glass); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid var(--border); }
.topbar .search { position: relative; flex: 1; max-width: 420px; }
.topbar .search .input { height: 38px; padding-left: 38px; background: var(--surface-2); border-color: transparent; }
.topbar .search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 16px; height: 16px; }
.topbar .search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 11px; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--border-strong); color: var(--text-3); background: var(--surface); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.notif-dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); }
.content { padding: 28px; max-width: 1320px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.page-head h1 { font-size: clamp(26px, 3vw, 34px); margin: 6px 0 4px; }
.page-head p { margin: 0; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-3); }
.breadcrumb a { color: var(--text-3); } .breadcrumb a:hover { color: var(--text); }
.breadcrumb .icon { width: 14px; height: 14px; }
.sidebar-backdrop { display: none; }

.welcome { position: relative; overflow: hidden; display: flex; align-items: center; gap: 24px; padding: 26px 28px; border-radius: var(--radius-xl); color: #fff; background: #064e3b; }
.welcome::before { content: ""; position: absolute; inset: 0; background: radial-gradient(500px 300px at 100% 0%, rgba(52,211,153,.55), transparent 60%), radial-gradient(400px 300px at 20% 120%, rgba(139,92,246,.5), transparent 60%); }
.welcome > * { position: relative; }
.welcome h2 { color: #fff; margin: 4px 0 6px; } .welcome p { color: rgba(255,255,255,.82); margin: 0; }
.welcome .ring .ring-bg { stroke: rgba(255,255,255,.18); } .welcome .ring .ring-fg { stroke: #6ee7b7; } .welcome .ring-label { color: #fff; }
.welcome .btn { --btn-bg: #fff; --btn-fg: #064e3b; --btn-bd: transparent; }

.store-card { display: flex; flex-direction: column; gap: 16px; }
.store-link { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 14px; border-radius: var(--radius); background: var(--surface-2); }
.store-end { display: flex; align-items: center; gap: 10px; min-width: 0; }
.store-end strong { display: block; font-size: 13.5px; color: var(--text); } .store-end span { display: block; font-size: 12px; color: var(--text-3); }
.store-end:last-child { justify-content: flex-end; text-align: right; }
.pipe { position: relative; width: 70px; height: 4px; border-radius: 2px; background: var(--border-strong); overflow: hidden; }
.pipe::after { content: ""; position: absolute; inset: 0; width: 40%; border-radius: 2px; background: var(--primary); animation: pipe 1.6s var(--ease) infinite; }
.pipe.is-paused::after { animation: none; width: 100%; background: var(--warning); opacity: .5; }
.pipe.is-broken { background: var(--danger-soft); } .pipe.is-broken::after { animation: none; width: 100%; background: repeating-linear-gradient(90deg, var(--danger) 0 6px, transparent 6px 10px); }

.chart { width: 100%; height: 220px; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .area { fill: url(#acd-area); }
.chart .stop-a { stop-color: var(--primary); stop-opacity: .28; }
.chart .stop-b { stop-color: var(--primary); stop-opacity: 0; }
.chart .line { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1200; stroke-dashoffset: 1200; animation: draw 1.8s var(--ease) forwards; }
.chart .line-2 { stroke: var(--woo); stroke-dasharray: 1200; }
.chart .bar { fill: var(--primary); opacity: .85; transform-origin: bottom; transform-box: fill-box; animation: grow-y 900ms var(--ease) both; }
.chart .bar.is-alt { fill: var(--woo); opacity: .7; }
.chart text { fill: var(--text-3); font-size: 11px; font-family: var(--font-sans); }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--primary); }
.legend i.alt { background: var(--woo); } .legend i.warn { background: var(--warning); } .legend i.bad { background: var(--danger); }

/* ---------- 14. Prototype helpers (not for production) ------------------- */
.proto-switcher { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 95; }
.proto-switcher > summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: var(--radius-full); background: var(--text); color: var(--surface); font: 650 13px var(--font-sans); cursor: pointer; box-shadow: var(--shadow-lg); }
.proto-switcher > summary::-webkit-details-marker { display: none; }
.proto-switcher .menu-panel { left: 50%; right: auto; transform: translateX(-50%); animation: none; top: auto; bottom: calc(100% + 10px); min-width: 280px; max-height: 70vh; overflow: auto; }
.proto-note { font-size: 11.5px; color: var(--text-3); padding: 6px 10px 8px; }

/* ---------- 15. Reveal-on-scroll & keyframes ----------------------------- */
html.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 700ms var(--ease), transform 700ms var(--ease); transition-delay: var(--delay, 0ms); }
html.js .reveal.is-visible { opacity: 1; transform: none; }
.delay-1 { --delay: 80ms; } .delay-2 { --delay: 160ms; } .delay-3 { --delay: 240ms; } .delay-4 { --delay: 320ms; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ping { 0% { transform: scale(1); opacity: .6; } 80%, 100% { transform: scale(2.6); opacity: 0; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes dash { to { stroke-dashoffset: -28; } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(0); } 100% { transform: scale(1); } }
@keyframes pop-in { from { opacity: 0; transform: translateY(6px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }
@keyframes grad-shift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes pipe { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes grow-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
  html.js .reveal { opacity: 1; transform: none; }
  .chart .line { stroke-dashoffset: 0; }
}

/* ---------- 16. Responsive ----------------------------------------------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 960px) {
  .hero-grid, .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-nav { display: none; }
  .site-footer .cols { grid-template-columns: 1fr 1fr; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: var(--sidebar-w); transform: translateX(-105%); transition: transform var(--dur) var(--ease); box-shadow: var(--shadow-lg); }
  .app.is-nav-open .sidebar { transform: none; }
  .app.is-nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(4,12,9,.45); }
  .show-sm { display: inline-flex; } .hide-sm { display: none; }
  .plan.is-featured { transform: none; }
}
@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .grid-2, .grid-3, .grid-4, .steps { grid-template-columns: 1fr; }
  .content { padding: 20px 16px; }
  .topbar { padding: 0 16px; }
  .topbar .search { display: none; }
  .hero { padding: 40px 0; }
  .section { padding: 48px 0; }
  .cta { padding: 32px 24px; }
  .welcome { flex-direction: column; align-items: flex-start; }
  .store-link { grid-template-columns: 1fr; } .store-end:last-child { justify-content: flex-start; text-align: left; } .pipe { width: 100%; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; } .kv dd { margin-bottom: 10px; }
  .setting { flex-direction: column; align-items: flex-start; }
  .alert { flex-wrap: wrap; } .alert > div { flex: 1 1 calc(100% - 40px); } .alert .alert-actions { margin-left: 30px; }
  .page-head .btn-group { width: 100%; }
  .stepper li { font-size: 11px; }
  .toast-region { left: 16px; right: 16px; } .toast { min-width: 0; max-width: none; }
  .site-footer .cols { grid-template-columns: 1fr; }
  .sync-nodes { grid-template-columns: 1fr; gap: 12px; } .sync-link { height: 48px; transform: rotate(90deg); }
}
