/* Dashboard + marketing styles (built on base.css with classic-light variables). */
:root {
  --bg: #f8f7f4;
  --bg-soft: #edece8;
  --fg: #1c1917;
  --card: #ffffff;
  --border: #e4e2dd;
  --accent: #16a34a;
}
.dash-header { background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.sf-logo { display: inline-flex; align-items: center; gap: 9px; font-size: 21px; font-weight: 400; color: var(--fg); letter-spacing: -0.5px; font-family: 'Bricolage', system-ui, sans-serif; }
.sf-logo b { color: var(--accent); font-weight: 800; }
.sf-logo:hover { text-decoration: none; }
.sf-logo svg { display: block; }
.sf-logo-img { display: block; height: 58px; width: auto; margin: -9px 0; }
@media (max-width: 480px) { .sf-logo-img { height: 44px; margin: -6px 0; } }
.dash-nav { display: flex; gap: 18px; align-items: center; margin-left: auto; }
.dash-nav .btn { font-size: 15px; }
.dash-footer { margin-top: 64px; border-top: 1px solid var(--border); padding: 20px 0 36px; font-size: 14px; opacity: 0.75; }

/* Marketing */
.hero { text-align: center; padding: 64px 0 40px; }
.hero h1 {
  font-size: clamp(36px, 6.5vw, 64px); margin: 0 0 14px; letter-spacing: -0.03em; font-weight: 800;
  background: linear-gradient(120deg, var(--fg) 55%, var(--accent));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-sub { font-size: 19px; max-width: 620px; margin: 0 auto 28px; opacity: 0.85; }
.hero-note { font-size: 14px; opacity: 0.65; margin-top: 14px; }
.hero-ctas { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* CSS-only storefront mockup in the hero */
.mockup {
  max-width: 660px; margin: 44px auto 0; background: var(--card);
  border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.12); overflow: hidden; text-align: left;
}
.mockup-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--bg-soft); }
.mockup-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.mockup-bar span { margin-left: 10px; font-size: 12.5px; opacity: 0.65; }
.mockup-body { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 16px; }
.mock-card { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--card); }
.mock-thumb { aspect-ratio: 1; display: block; width: 100%; object-fit: cover; background: var(--bg-soft); }
.mock-card p { margin: 8px 10px 2px; font-size: 12.5px; font-weight: 700; }
.mock-card span { display: block; margin: 0 10px 10px; font-size: 12px; opacity: 0.65; }
@media (max-width: 560px) { .mockup-body { grid-template-columns: repeat(2, 1fr); } .mock-card:nth-child(3) { display: none; } }

.hero-video { display: block; width: 100%; height: auto; background: var(--bg-soft); }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin: 40px 0; }
.feature {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 20px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.feature:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.07); }
.feature-icon {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent); margin-bottom: 12px;
}
.feature h3 { margin: 0 0 6px; font-size: 17px; }
.feature p { margin: 0; font-size: 15px; opacity: 0.85; }
.how { margin: 56px 0; }
.steps { font-size: 17px; max-width: 640px; list-style: none; counter-reset: step; padding-left: 0; }
/* li content must be a single <span>: flex gap would otherwise split around inline tags */
.steps li { margin: 14px 0; counter-increment: step; display: flex; gap: 14px; align-items: baseline; }
.steps li::before {
  content: counter(step); flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 800; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; transform: translateY(5px);
}
.pricing { margin: 56px 0; }
.price-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; align-items: start; }
.price-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 22px; }
.price-card.featured { border-color: var(--accent); box-shadow: 0 12px 36px rgba(22, 163, 74, 0.14); position: relative; }
.price-card.muted { opacity: 0.72; }
.billed-note { margin: -2px 0 10px; font-size: 12.5px; opacity: 0.6; }
.price-card ul { list-style: none; padding-left: 0; }
.price-card li { display: flex; gap: 8px; align-items: baseline; }
.price-card li .icon { color: var(--accent); transform: translateY(2px); }
.price-card li.plan-includes { font-weight: 700; font-size: 13.5px; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.7; margin: 2px 0 8px; }

.app-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 4px 0 18px; }
.cf-row { display: flex; gap: 12px; align-items: center; margin: 8px 0; }
.cf-row input[type="text"], .cf-row input:not([type]) { flex: 1; margin: 0; }
.cf-row label.radio { margin: 0; white-space: nowrap; }

/* Store analytics panel */
.stats-panel { max-width: 820px; margin: 6px 0 10px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 12px; margin: 14px 0; }
.stat-tile { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; }
.stat-tile b { display: block; font-size: 23px; font-family: 'Bricolage', system-ui, sans-serif; letter-spacing: -0.02em; }
.stat-tile span { font-size: 12.5px; opacity: 0.7; }
.spark { width: 100%; max-width: 480px; height: 46px; display: block; margin: 6px 0 4px; }
.spark rect { fill: var(--accent); opacity: 0.85; }
.stats-lists { display: flex; gap: 48px; flex-wrap: wrap; margin-top: 10px; }
.stats-lists h4 { margin: 0 0 4px; font-size: 14.5px; }
.stats-lists ol { margin: 0; padding-left: 20px; font-size: 14px; }
.stats-lists li { margin: 3px 0; }

/* Merchant manual (rendered markdown) */
.manual { max-width: 760px; }
.manual h3 { font-size: 26px; margin: 42px 0 10px; padding-top: 18px; border-top: 1px solid var(--border); }
.manual h4 { font-size: 18.5px; margin: 26px 0 6px; }
.manual p, .manual li { font-size: 16px; line-height: 1.65; }
.manual ul, .manual ol { padding-left: 24px; }
.manual li { margin: 6px 0; }
.manual code { background: var(--bg-soft); border-radius: 5px; padding: 1px 6px; font-size: 0.9em; }

/* About page */
.founder-card {
  display: flex; gap: 22px; align-items: center; background: var(--card);
  border: 1px solid var(--border); border-radius: 16px; padding: 24px; max-width: 640px; margin: 24px 0;
}
.founder-card img { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.founder-card h3 { margin: 0 0 2px; }
.founder-role { color: var(--accent); font-weight: 700; font-size: 14px; margin: 0 0 8px; }
.founder-bio { font-size: 14.5px; opacity: 0.85; margin: 0 0 10px; }
.founder-links { display: flex; gap: 14px; font-size: 14px; font-weight: 600; }
.dash-footer .container { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.dash-footer a { color: inherit; opacity: 0.9; }
.price-card h3 { margin-top: 0; }
.price-amount { font-size: 40px; font-weight: 800; }
.price-amount span { font-size: 16px; font-weight: 400; opacity: 0.6; }
.price-card ul { padding-left: 18px; }
.price-card li { margin: 6px 0; }
.soon { font-size: 12px; background: var(--bg-soft); border-radius: 999px; padding: 2px 10px; vertical-align: middle; font-weight: 600; }
.compare { margin: 56px 0; }
.compare-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.compare-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: 14px; font-size: 14.5px; min-width: 560px; }
.compare-table th, .compare-table td { padding: 9px 14px; border-bottom: 1px solid var(--border); text-align: left; }
.compare-table th:not(:first-child), .compare-table td:not(:first-child) { text-align: center; }
.compare-table thead th { font-size: 15px; background: var(--bg-soft); }
.compare-table td:nth-child(2) { background: color-mix(in srgb, var(--accent) 6%, transparent); font-weight: 600; }

.faq { max-width: 720px; margin: 56px auto; }
.faq details { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; margin: 10px 0; }
.faq summary { font-weight: 700; cursor: pointer; }

/* Dashboard */
.flash { border-radius: 10px; padding: 10px 14px; font-weight: 600; }
.flash-err { background: #fee2e2; color: #991b1b; }
.flash-ok { background: #dcfce7; color: #166534; }
/* Same width as the create-store form card below, for a consistent column. */
.store-list { margin: 18px 0 34px; display: grid; gap: 12px; max-width: 560px; }
.store-card { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.store-card h3 { margin: 0 0 4px; }
.store-url { font-size: 14px; }
.addr-input { display: flex; align-items: center; gap: 6px; }
.addr-input input { max-width: 240px; }
.two-col { display: grid; grid-template-columns: minmax(320px, 480px) 1fr; gap: 36px; margin-top: 22px; }
/* Grid items default to min-width:auto, which refuses to shrink below their
   content — a wide table would then stretch its column past the viewport.
   min-width:0 lets the column shrink so the table can scroll inside itself. */
.two-col > section { min-width: 0; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.orders-table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--card); border-radius: 10px; }
/* Mobile: tables scroll inside their own box instead of widening the page */
@media (max-width: 700px) {
  .orders-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .two-col { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
.orders-table th, .orders-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.orders-table select { width: auto; padding: 3px 6px; margin: 0; }
/* On narrow screens multi-column tables would otherwise push the whole page
   wider than the viewport (horizontal scroll), which made the sticky header —
   only 100vw wide — look narrower than the content. Let each table scroll
   inside its own box instead so the page never overflows sideways. */
@media (max-width: 640px) {
  .orders-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ---- App feel: bottom tab bar (mobile app pages only) + toasts + text pass ---- */

/* Slightly larger "tiny" text on dashboard/admin (storefront untouched). */
.muted-note { font-size: 14px; }
.orders-table { font-size: 15px; }
.stat-tile span { font-size: 13.5px; }
label { font-size: 14.5px; }

/* Header gear (store settings) — native-app pattern, mobile only. */
.header-gear { display: none; color: var(--fg); opacity: 0.75; padding: 8px; margin: -8px -4px -8px -8px; }
.header-gear:hover { opacity: 1; }

.tab-bar { display: none; }
@media (max-width: 719px) {
  /* Floating bottom bar with icon + label tabs. */
  .tab-bar {
    position: fixed; left: 12px; right: 12px; bottom: max(10px, env(safe-area-inset-bottom));
    display: flex; z-index: 30;
    background: var(--card); border: 1px solid var(--border); border-radius: 18px;
    padding: 6px 4px; box-shadow: 0 10px 34px rgba(0, 0, 0, 0.16);
  }
  .tab-bar a {
    flex: 1; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; font-size: 11.5px; font-weight: 600; color: var(--fg); opacity: 0.62; text-decoration: none; border-radius: 12px;
  }
  .tab-bar a.active { color: var(--accent); opacity: 1; }
  .tab-bar a:active { background: var(--bg-soft); }
  /* The bar replaces the header text links; logo + gear + sign-out remain. */
  .dash-nav .nav-link { display: none; }
  .header-gear { display: inline-flex; }
  body.has-tab-bar main { padding-bottom: 96px; }
  body.has-tab-bar .dash-footer { padding-bottom: 110px; }
}

/* Transient messages (Flash) float as toasts; app.js adds the classes. */
.toast-wrap {
  position: fixed; bottom: 24px; left: 16px; right: 16px; z-index: 40;
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
@media (max-width: 719px) {
  body.has-tab-bar .toast-wrap { bottom: calc(84px + env(safe-area-inset-bottom)); }
}
.toast-wrap .flash {
  pointer-events: auto; margin: 0; max-width: 560px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.22);
  transition: opacity 0.45s ease, transform 0.45s ease;
  padding-right: 38px; position: relative;
}
.toast-hide { opacity: 0; transform: translateY(10px); }
.toast-close {
  position: absolute; top: 6px; right: 6px; border: 0; background: transparent;
  cursor: pointer; font-size: 14px; opacity: 0.6; padding: 4px 6px; color: inherit;
}
.toast-close:hover { opacity: 1; }
.toast-wrap .flash .btn { margin-left: 8px; vertical-align: middle; }

/* ---- Store page: section cards + sticky "on this page" jump list ---- */
html { scroll-behavior: smooth; }
[id] { scroll-margin-top: 78px; }

.panel {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 18px 20px 20px; margin: 0 0 20px;
}
.panel > h2 { margin: 2px 0 12px; }
.health-panel { border-color: #fca5a5; background: #fff7f7; }
.health-list { margin: 0; padding-left: 20px; }
.health-list li { margin: 7px 0; font-size: 14.5px; }
/* Forms inside a panel drop their own card chrome (no card-in-card). */
.panel .card { background: transparent; border: 0; padding: 0; border-radius: 0; }
.panel .form-card { max-width: 560px; }
/* Wide tables scroll inside their panel instead of overflowing it. */
.panel .orders-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.store-live { margin: 4px 0; }
.store-live .icon { vertical-align: -2px; }
.sheet-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.sheet-row .inline-form { display: flex; align-items: center; gap: 6px; }
@media (max-width: 640px) { .panel { padding: 14px 14px 16px; border-radius: 14px; } }

.page-toc { display: none; }
@media (min-width: 1400px) {
  .page-toc {
    position: fixed; top: 112px; width: 152px; z-index: 10;
    right: max(10px, calc((100vw - 1080px) / 2 - 162px));
    display: flex; flex-direction: column; gap: 2px; font-size: 13.5px;
  }
  .page-toc .toc-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.5; padding: 0 10px 6px; }
  .page-toc a {
    padding: 6px 10px; color: var(--fg); opacity: 0.68; text-decoration: none;
    border-left: 2px solid transparent; border-radius: 0 8px 8px 0;
  }
  .page-toc a:hover { opacity: 1; background: var(--bg-soft); }
  .page-toc a.active { color: var(--accent); opacity: 1; font-weight: 700; border-left-color: var(--accent); }
}

/* GA consent bar (marketing pages) — hidden until the script decides. */
.consent-bar {
  position: fixed; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 50;
  display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  max-width: 720px; margin: 0 auto; padding: 12px 16px;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18); font-size: 14px;
}
.consent-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* Merchant guide */
.tsv-block {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px; overflow-x: auto; font-size: 12.5px; line-height: 1.7; white-space: pre;
}
.guide-table { font-size: 14px; margin: 12px 0 4px; }
.guide-table td:nth-child(2) { white-space: nowrap; }

/* ---- v8: button polish, usage meters, pagination, danger zone ---- */
.btn { border-radius: 10px; letter-spacing: 0.01em; }
.btn-primary {
  background: linear-gradient(180deg, #12a87d, #0c8a6a);
  border-color: #0b7a5e; color: #fff;
  box-shadow: 0 1px 2px rgba(12, 138, 106, 0.28);
}
.btn-primary:hover { filter: brightness(1.06); box-shadow: 0 6px 16px rgba(12, 138, 106, 0.3); }
.btn-danger { background: linear-gradient(180deg, #d64541, #b93c37); border-color: #a93226; color: #fff; }
.btn-danger:hover { filter: brightness(1.06); box-shadow: 0 6px 16px rgba(185, 60, 55, 0.3); }

.usage-grid { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 10px 0 18px; }
.usage { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.usage-label { opacity: 0.75; }
.usage-num { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.meter { width: 140px; height: 8px; background: var(--bg-soft, #e8ebe9); border-radius: 6px; overflow: hidden; flex: none; }
.meter > i { display: block; height: 100%; background: linear-gradient(90deg, #12a87d, #0c8a6a); border-radius: 6px; }
.meter.warn > i { background: linear-gradient(90deg, #e8a13c, #d97706); }
.meter.over > i { background: linear-gradient(90deg, #e05252, #b93c37); }

.pager { display: flex; align-items: center; gap: 10px; margin: 10px 0 4px; font-size: 13px; }
.pager span { opacity: 0.75; font-variant-numeric: tabular-nums; }

/* Long-form reading text sits better justified. */
.manual p { text-align: justify; }

/* v9: marketing currency picker */
.cur-picker { display: flex; gap: 8px; justify-content: center; margin: 4px 0 14px; }
.cur-btn.active { background: linear-gradient(180deg, #12a87d, #0c8a6a); border-color: #0b7a5e; color: #fff; }

/* v10: usage-triggered upgrade prompts */
.upsell {
  background: #fff8ec; border: 1px solid #f0ddb4; border-radius: 10px;
  padding: 12px 16px; margin: 4px 0 18px; max-width: 720px; font-size: 14px;
}
.upsell p { margin: 4px 0 8px; }
