/* ==========================================================================
   Storefront styles
   ========================================================================== */

/* Theme: light by default, dark when the device prefers it,
   overridable with the toggle (html[data-theme]). */
:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --border: #e3e6eb;
  --border-strong: #cfd4dc;
  --text: #111827;
  --text-muted: #5b6472;
  --text-subtle: #8a93a3;
  --accent: #2f5bea;
  --accent-hover: #2349c7;
  --accent-soft: #eaf0ff;
  --success: #0f7a4a;
  --success-soft: #e7f6ee;
  --warning: #9a5b00;
  --warning-soft: #fff4dd;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --on-success: #ffffff;
  --header-bg: rgba(255, 255, 255, .92);
  --seg-active: #ffffff;
  --backdrop: rgba(17, 24, 39, .5);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, .12);
  --radius: 10px;
  --radius-sm: 6px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  color-scheme: dark;
  --bg: #000000;
  --surface: #0d0d0f;
  --surface-2: #17171a;
  --border: #26262b;
  --border-strong: #3a3a41;
  --text: #f3f4f6;
  --text-muted: #a1a1aa;
  --text-subtle: #71717a;
  --accent: #3b6cff;
  --accent-hover: #5a82ff;
  --accent-soft: rgba(59, 108, 255, .16);
  --success: #3ddc97;
  --success-soft: rgba(61, 220, 151, .14);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, .14);
  --danger: #ff6b60;
  --danger-soft: rgba(255, 107, 96, .14);
  --on-success: #04130b;
  --header-bg: rgba(0, 0, 0, .85);
  --seg-active: #3a3a41;
  --backdrop: rgba(0, 0, 0, .75);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, .7);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #0d0d0f;
  --surface-2: #17171a;
  --border: #26262b;
  --border-strong: #3a3a41;
  --text: #f3f4f6;
  --text-muted: #a1a1aa;
  --text-subtle: #71717a;
  --accent: #3b6cff;
  --accent-hover: #5a82ff;
  --accent-soft: rgba(59, 108, 255, .16);
  --success: #3ddc97;
  --success-soft: rgba(61, 220, 151, .14);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, .14);
  --danger: #ff6b60;
  --danger-soft: rgba(255, 107, 96, .14);
  --on-success: #04130b;
  --header-bg: rgba(0, 0, 0, .85);
  --seg-active: #3a3a41;
  --backdrop: rgba(0, 0, 0, .75);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, .7);
}

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.mono { font-family: var(--mono); }
.container { width: min(1120px, 100% - 40px); margin-inline: auto; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  border: 1px solid transparent; font-weight: 600; font-size: 14px;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary, a.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--header-bg); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between; height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.brand img { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; }
.main-nav { display: flex; align-items: center; gap: 6px; }
.main-nav a:not(.btn), .main-nav button.link {
  padding: 8px 12px; border-radius: var(--radius-sm); background: none; border: 0;
  color: var(--text-muted); font-size: 14px; font-weight: 500;
}
.main-nav a:not(.btn):hover, .main-nav button.link:hover { color: var(--text); background: var(--surface-2); }

/* ---------- Hero ---------- */
.hero { padding: 72px 0 40px; }
.hero .eyebrow {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 12px; font-weight: 600; letter-spacing: .02em;
}
.hero h1 {
  max-width: 680px; margin: 16px 0 14px;
  font-size: clamp(30px, 5vw, 46px); line-height: 1.12; letter-spacing: -0.02em;
}
.hero p { max-width: 560px; margin: 0 0 26px; color: var(--text-muted); font-size: 17px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Plans ---------- */
.section { padding: 32px 0 56px; }
.section-head {
  display: flex; flex-wrap: wrap; gap: 16px;
  align-items: center; justify-content: space-between; margin-bottom: 24px;
}
.section-head h2 { margin: 0; font-size: 22px; letter-spacing: -0.01em; }

.segmented {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface-2); border-radius: 8px;
}
.segmented button {
  padding: 7px 14px; border: 0; border-radius: 6px; background: transparent;
  color: var(--text-muted); font-size: 13px; font-weight: 600;
}
.segmented button[aria-pressed="true"] { background: var(--seg-active); color: var(--text); box-shadow: var(--shadow-sm); }

.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.plan-card {
  position: relative; display: flex; flex-direction: column;
  padding: 24px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.plan-card.is-featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan-card[hidden] { display: none; }
.plan-flag {
  position: absolute; top: -11px; left: 20px;
  padding: 2px 10px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 600;
}
.plan-name { margin: 0; font-size: 16px; font-weight: 600; }
.plan-duration { margin: 2px 0 16px; color: var(--text-muted); font-size: 13px; }
.plan-price { display: flex; align-items: baseline; gap: 8px; margin-bottom: 18px; }
.plan-price strong { font-size: 32px; letter-spacing: -0.02em; line-height: 1; }
.plan-price span { color: var(--text-subtle); font-size: 13px; }
.plan-features { list-style: none; margin: 0 0 20px; padding: 18px 0 0; border-top: 1px solid var(--border); flex: 1; }
.plan-features li {
  position: relative; padding-left: 22px; margin-bottom: 9px;
  font-size: 14px; color: var(--text-muted);
}
.plan-features li::before {
  content: ""; position: absolute; left: 2px; top: 7px; width: 5px; height: 9px;
  border: solid var(--success); border-width: 0 2px 2px 0; transform: rotate(45deg) scale(.85);
}
.plan-methods { margin: 12px 0 0; text-align: center; font-size: 12px; color: var(--text-subtle); }
.empty-state { padding: 48px 0; text-align: center; color: var(--text-muted); }

/* ---------- How it works ---------- */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.step { padding: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.step-num {
  display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center;
  margin-bottom: 12px; border-radius: 50%; background: var(--accent-soft);
  color: var(--accent); font-size: 13px; font-weight: 700;
}
.step h3 { margin: 0 0 6px; font-size: 15px; }
.step p { margin: 0; color: var(--text-muted); font-size: 14px; }

/* ---------- Footer ---------- */
.site-footer { padding: 28px 0 36px; border-top: 1px solid var(--border); background: var(--surface); }
.site-footer .container { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.footer-links { display: flex; flex-wrap: wrap; gap: 18px; font-size: 14px; color: var(--text-muted); }
.footer-links a:hover { color: var(--text); }
.copyright { font-size: 13px; color: var(--text-subtle); }

/* ---------- Dialogs ---------- */
dialog.modal {
  width: min(480px, calc(100% - 24px)); max-height: calc(100dvh - 24px);
  padding: 0; border: 0; border-radius: 14px; background: var(--surface);
  box-shadow: var(--shadow-md); overflow: auto;
}
dialog.modal::backdrop { background: var(--backdrop); }
.modal-head {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 17px; }
.icon-btn {
  width: 32px; height: 32px; border: 0; border-radius: 6px; background: transparent;
  color: var(--text-muted); font-size: 18px; line-height: 1;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 22px; }

.summary {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 14px 16px; margin-bottom: 20px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
}
.summary-name { font-weight: 600; }
.summary-sub { font-size: 13px; color: var(--text-muted); }
.summary-price { text-align: right; font-weight: 600; white-space: nowrap; }
.summary-price small { display: block; font-weight: 400; color: var(--text-muted); }

.method-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; margin-bottom: 20px; }
.method-tabs button {
  padding: 10px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); font-size: 13px; font-weight: 600; color: var(--text-muted);
}
.method-tabs button[hidden] { display: none; }
.method-tabs button[aria-selected="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; }
.field .optional { font-weight: 400; color: var(--text-subtle); }
.field input[type="text"], .field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface-2);
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.pay-box { margin: 4px 0 16px; padding: 14px 16px; border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.pay-box .label { font-size: 12px; color: var(--text-muted); }
.copy-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 8px; }
.copy-row code { font-family: var(--mono); font-size: 15px; word-break: break-all; }
.pay-box p { margin: 0; font-size: 13px; color: var(--text-muted); }

.upload {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); width: 100%; text-align: left;
}
.upload:hover { border-color: var(--accent); }
.upload img { width: 44px; height: 44px; object-fit: cover; border-radius: 4px; }
.upload img[hidden] { display: none; }

.steps-list { margin: 0 0 16px; padding-left: 18px; font-size: 14px; color: var(--text-muted); }
.steps-list li { margin-bottom: 6px; }

.form-note { margin: 12px 0 0; text-align: center; font-size: 12.5px; color: var(--text-subtle); }
.form-error {
  margin-top: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--danger-soft); color: var(--danger); font-size: 13px;
}
.spinner {
  width: 18px; height: 18px; margin: 0 auto 8px; border: 2px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.result { padding: 12px 0 4px; text-align: center; }
.result-icon {
  display: inline-flex; width: 48px; height: 48px; align-items: center; justify-content: center;
  margin-bottom: 14px; border-radius: 50%; background: var(--success-soft); color: var(--success);
}
.result h3 { margin: 0 0 6px; font-size: 18px; }
.result p { margin: 0 0 14px; color: var(--text-muted); }
.order-ref { display: inline-block; padding: 6px 12px; border-radius: 6px; background: var(--surface-2); font-family: var(--mono); font-size: 13px; }

/* History */
.history-list { margin-top: 16px; }
.history-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.history-item:last-child { border-bottom: 0; }
.history-top { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; font-size: 14px; }
.history-meta { display: flex; justify-content: space-between; margin-top: 2px; font-size: 12.5px; color: var(--text-muted); }
.badge {
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; text-transform: capitalize;
  background: var(--surface-2); color: var(--text-muted);
}
.badge.approved { background: var(--success-soft); color: var(--success); }
.badge.pending  { background: var(--warning-soft); color: var(--warning); }
.badge.rejected { background: var(--danger-soft); color: var(--danger); }
.muted-text { color: var(--text-muted); font-size: 14px; }

@media (max-width: 640px) {
  .container { width: calc(100% - 28px); }
  .brand, .main-nav a, .main-nav button.link { white-space: nowrap; }
  .brand { font-size: 15px; }
  .main-nav { gap: 2px; }
  .main-nav a:not(.btn), .main-nav button.link { padding: 8px; font-size: 13px; }
  .main-nav .btn-sm { padding: 7px 10px; }
  .hero { padding: 48px 0 24px; }
  .main-nav .hide-sm { display: none; }
  .field-row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }

/* ---------- Theme toggle ---------- */
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; margin: 0 2px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text-muted); }
.theme-toggle:hover { background: var(--surface-2); color: var(--text); }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}
