/* KPOS Merchant Apply — landing + portal styles. Matches the KvoiceOrder
   visual language so a merchant moving between products feels at home.
   Typography spec: see memory feedback_ui_conventions.md (③). All
   components reference these tokens — never hardcode font-size or
   font-weight in component rules. */

:root {
  /* ----- Typography tokens (Square-aligned) ----- */
  --font-ui: 'SQ Market', 'Inter', -apple-system, BlinkMacSystemFont,
             "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;

  /* Type scale — bumped +1-2px across the board (2026-05-22) for
     better readability on the onboarding form-heavy pages. */
  --fs-display: 48px;   /* hero / landing */
  --fs-h1:      30px;   /* page title */
  --fs-h2:      22px;   /* section / panel title */
  --fs-h3:      19px;   /* subsection */
  --fs-body-lg: 17px;
  --fs-body:    16px;   /* base */
  --fs-sm:      14px;   /* labels, secondary */
  --fs-caption: 13px;   /* hints, captions */
  --fs-eyebrow: 12px;   /* uppercase column heads, status pills */

  /* Weights — 400 / 500 / 600 / 700 only (don't use 300 or 800+) */
  --fw-regular:  400;
  --fw-medium:   500;
  --fw-semibold: 600;
  --fw-bold:     700;

  /* Line heights */
  --lh-tight:  1.1;
  --lh-snug:   1.3;
  --lh-normal: 1.5;

  /* Letter spacing (heading tighter, eyebrow looser) */
  --ls-tight:  -0.025em;
  --ls-snug:   -0.015em;
  --ls-normal: 0;
  --ls-wide:   0.04em;

  /* ----- Color tokens (dark theme baseline) ----- */
  --bg: #0f1115;
  --bg-sunken: #12151c;
  --surface: #1a1d24;      /* content blocks (nav, panes) */
  --panel: #1a1d24;        /* elevated: header, modals, dropdowns */
  --panel-border: #262a34;
  --input-bg: #12151c;     /* form fields */
  --input-border: #262a34;  /* field borders — matches panel-border in dark */
  --text: #e6e8ee;
  --muted: #8a92a3;
  --dashed: #262a34;
  --pill-bg: #2a2f3a;

  --accent: #4f8cff;
  --accent-strong: #2a6bff;
  --danger: #ff5d5d;
  --ok: #3bd671;
  --warn: #f5a524;
}

[data-theme="light"] {
  /* 3-layer depth: white page → gray blocks → white inputs.
     Stripe / Linear style — clear visual hierarchy without heavy
     shadows. Header stays white (--panel), content cards are soft
     gray (--surface), inputs pop as white on the gray card. */
  --bg: #ffffff;
  --bg-sunken: #f0f2f5;     /* hover states, progress track, pills */
  --surface: #f5f7fa;        /* content blocks: nav sidebar, form pane */
  --panel: #ffffff;           /* header, modals, dropdowns — stays white */
  --panel-border: #e3e6ec;
  --input-bg: #ffffff;        /* form fields: white on gray surface */
  --input-border: #d8dbe2;    /* field borders — softer than panel-border */
  --text: #1a1d24;
  --muted: #5b6370;
  --dashed: #e3e6ec;
  --pill-bg: #eef1f5;

  --accent: #2a6bff;
  --accent-strong: #1a5ae8;
  --danger: #d63b3b;
  --ok: #1f9b4b;
  --warn: #b26a00;
}

/* CRITICAL: HTML's hidden attribute is just `display: none`, which any
   later display rule overrides. Force it. Without this, [hidden] flex
   modals leak through and you spend an afternoon debugging. */
[hidden] { display: none !important; }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  letter-spacing: -0.005em;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background .2s ease, color .2s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid var(--panel-border);
  background: var(--panel);
}
.top h1 {
  margin: 0;
  font-size: var(--fs-h1);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-snug);
}
.top h1 a { color: inherit; }
.top-right { display: flex; align-items: center; gap: 10px; }

.theme-toggle {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--muted);
  width: 32px; height: 32px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: inherit;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); }

.container { max-width: 1100px; margin: 0 auto; padding: 24px; }

.hero {
  text-align: center;
  padding: 72px 24px 36px;
}
.hero h2 {
  font-size: var(--fs-display);
  margin: 0 0 14px;
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-tight);
  line-height: var(--lh-tight);
}
.hero p {
  font-size: var(--fs-body-lg);
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto 32px;
  line-height: var(--lh-normal);
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 6px;
  border: 0;
  font-size: var(--fs-body);
  font-family: inherit;
  cursor: pointer;
  font-weight: var(--fw-semibold);
  letter-spacing: -0.005em;
  line-height: 1.2;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .05s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent-strong); color: #fff; }
.btn--primary:hover { background: var(--accent); text-decoration: none; }
.btn--ghost { background: transparent; color: var(--text); border: 1px solid var(--panel-border); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.plans {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(3, 1fr);
  margin: 40px 0;
}
@media (max-width: 800px) { .plans { grid-template-columns: 1fr; } }

.plan {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 28px 22px;
  display: flex; flex-direction: column;
  transition: transform .15s ease, border-color .15s ease;
}
.plan:hover { transform: translateY(-2px); border-color: var(--accent); }
.plan.featured { border-color: var(--accent); position: relative; }
.plan.featured::after {
  content: "Popular"; position: absolute; top: -10px; right: 16px;
  background: var(--accent-strong); color: #fff; padding: 2px 10px;
  border-radius: 999px; font-size: 11px; letter-spacing: .5px;
}
.plan h3 { margin: 0 0 6px; font-size: 22px; }
.plan .blurb { color: var(--muted); font-size: 13px; margin: 0 0 18px; min-height: 40px; }
.plan .price { font-size: 36px; font-weight: 700; margin: 0 0 4px; }
.plan .price-int { font-size: 14px; color: var(--muted); font-weight: 400; }
.plan ul { list-style: none; padding: 0; margin: 18px 0 22px; flex: 1; }
.plan li { padding: 6px 0; font-size: 14px; color: var(--muted); }
.plan li::before { content: "✓ "; color: var(--ok); font-weight: 700; }
.plan .btn { width: 100%; text-align: center; }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 28px;
  margin-bottom: 20px;
  /* Shadow-only depth — no hard border needed. Stripe/Linear style:
     ring-shadow for edge definition + drop-shadow for lift. */
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04),
              0 1px 3px rgba(0, 0, 0, 0.06);
}
.panel h2 {
  margin: 0 0 16px;
  font-size: var(--fs-h2);
  color: var(--text);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-snug);
}
.panel h3 {
  margin: 0 0 8px;
  font-size: var(--fs-h3);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.01em;
}

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-size: var(--fs-caption); color: var(--text); font-weight: var(--fw-semibold); }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 9px 12px;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  font: inherit;
  font-size: var(--fs-sm);
  line-height: 1.4;
  /* Stripe-style micro-shadow — subtle lift off the surface. */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
/* Hover: border-color climbs from panel-border (very subtle) toward
   muted (clearly perceptible) to telegraph the field is interactive. */
.field input:hover:not(:focus),
.field textarea:hover:not(:focus),
.field select:hover:not(:focus) {
  border-color: var(--muted);
}
/* Focus: accent border + 3px translucent ring + soft drop shadow that
   "lifts" the field. Background lightens slightly so the field reads
   as the active surface. */
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.15),
              0 1px 2px rgba(0, 0, 0, 0.05);
  background: var(--panel);
}
.field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: .55; }

.muted { color: var(--muted); }
.banner {
  padding: 13px 18px; border-radius: 6px;
  margin-bottom: 18px;
  font-size: var(--fs-sm);
  line-height: 1.4;
}
.banner.ok { background: rgba(59, 214, 113, .12); color: var(--ok); border: 1px solid var(--ok); }
.banner.err { background: rgba(255, 93, 93, .12); color: var(--danger); border: 1px solid var(--danger); }
.banner.info { background: rgba(79, 140, 255, .12); color: var(--accent); border: 1px solid var(--accent); }
.banner.warn { background: rgba(245, 165, 36, .12); color: var(--warn); border: 1px solid var(--warn); }

/* Spinner — used by the OCR extraction toast. */
@keyframes spin { to { transform: rotate(360deg); } }

.foot {
  text-align: center;
  padding: 32px 24px 48px;
  font-size: var(--fs-caption);
  color: var(--muted);
  border-top: 1px solid var(--panel-border);
  margin-top: 48px;
}

table.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
table.tbl th, table.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--dashed); text-align: left; vertical-align: middle; }
table.tbl th {
  color: var(--muted);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-eyebrow);
  text-transform: uppercase;
  letter-spacing: var(--ls-wide);
}
table.tbl tr:hover td { background: var(--bg-sunken); }
