/* Copiloto ERP — design tokens (docs/branding/DESIGN.md, source of truth).
   Variable names match the convention already used across cp-connect's
   templates (--ink, --blue, ...) — kept unprefixed for consistency, not the
   doc's "cp-" prose labels.

   Fonts are SELF-HOSTED (FR step 6) — no external CDN, ever. A CDN would
   need a CSP font-src/style-src widening and leak visitor IPs to a third
   party on every public page load. The files are same-origin, so the
   existing 'self' policy already covers them; nothing in the CSP changes.

   Sora is loaded here and used ONLY for public display headings, per owner
   decision #2 (docs/design/2026-07-25-refresh/copy-review.md). The SPA is
   Inter-only and does not consume this file — do not add Sora there.

   Values are pinned against the DESIGN.md frontmatter by
   tests/branding/test_token_parity.py.

   NO `unicode-range`, deliberately. The FR step 6 plan said the @font-face
   rules would carry the latin range; review finding F3 caught that only
   `font-display: swap` shipped. Resolved as a decision to OMIT it, because:

   1. It would save nothing. `unicode-range` exists so a browser can skip
      downloading a subset it has no characters for. There is exactly ONE
      subset per weight here (Inter 230 codepoints, Sora 223), and a PT-BR
      page always contains latin text — so the file downloads either way.
   2. It would BREAK decomposed Portuguese. The files carry the combining
      marks U+0300 U+0301 U+0303 U+0309 U+0323 (Sora: the first three),
      every one of which the canonical Google `latin` range EXCLUDES. NFD
      text — "decisão" as a + U+0303, which macOS and several paste paths
      emit — would then lose Inter for the accent alone, rendering a
      fallback-font tilde over an Inter letter.
   3. Without the range the font applies to all text and the browser does
      per-character fallback anyway, which is the behavior we want.

   If a future subset regeneration DOES want a range, keep those combining
   marks in it. `tests/apps/web/test_static_assets.py` permits the change and
   fails only if they are dropped. */

/* Inter — UI, body, headings, forms, tables (DESIGN.md typography.fonts.ui) */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/inter-latin-400.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/inter-latin-500.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/inter-latin-600.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/inter-latin-700.woff2") format("woff2");
}

/* Sora — public display headings only (owner decision #2). Only the two
   weights the display ramp uses are shipped; do not add more without a
   heading that needs them. */
@font-face {
  font-family: "Sora";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/sora-latin-600.woff2") format("woff2");
}
@font-face {
  font-family: "Sora";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/sora-latin-700.woff2") format("woff2");
}

:root {
  /* Core palette */
  --ink: #17202A;
  --cloud: #F7F9FC;
  --line: #D8DEE8;
  --muted: #5B6677;
  --teal: #0E9384;
  --blue: #2563EB;
  --amber: #F59E0B;
  --success: #16A34A;
  --danger: #DC2626;
  --surface: #FFFFFF;

  /* Derived — WCAG AA small-text variants + tinted backgrounds */
  --teal-deep: #0B7568;
  --teal-soft: #E6F5F2;
  --blue-hover: #1D4FD8;
  --blue-soft: #EFF4FE;
  --amber-deep: #B45309;
  --amber-soft: #FEF5E7;
  --success-deep: #15803D;
  --success-soft: #EFFAF2;
  --danger-soft: #FDF1F0;
  --bg-hover: #F1F4F9;
  --disabled: #AEB6C2;

  /* Type. --font keeps its system fallbacks: font-display:swap means the
     stack renders before Inter arrives, and a failed font fetch must never
     leave the page unstyled. --font-display is Sora for public display
     headings ONLY (owner decision #2) and falls back to the same stack. */
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: Sora, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Shape */
  --radius: 6px;
  --radius-container: 8px;
  --radius-pill: 999px;

  /* Elevation (flat-first; shadows for lifted/sticky elements only) */
  --shadow-sm: 0 1px 2px rgba(23, 32, 42, 0.06);
  --shadow-md: 0 2px 8px rgba(23, 32, 42, 0.08);
  --shadow-lg: 0 8px 28px rgba(23, 32, 42, 0.18);
}

/* Reset + base */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
body {
  font-family: var(--font);
  background: var(--cloud);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
}
img, svg { max-width: 100%; display: block; }
a { color: var(--blue); }

/* Typography ramp (docs/branding/DESIGN.md) */
h1 { font-size: 28px; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; margin-bottom: 12px; }
h2 { font-size: 22px; font-weight: 700; line-height: 1.30; letter-spacing: -0.005em; margin: 40px 0 12px; }
h3 { font-size: 17px; font-weight: 600; line-height: 1.35; margin: 24px 0 8px; }
p, li { color: var(--muted); margin-bottom: 8px; }
ol, ul { padding-left: 22px; margin-bottom: 12px; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--blue-soft);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 13px;
}
.label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
@media (max-width: 600px) {
  h1 { font-size: 22px; }
  h2 { font-size: 18px; }
  h3 { font-size: 16px; }
}

/* Buttons — sentence case only, never uppercase (button label is model copy) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.btn:disabled { cursor: not-allowed; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--blue-hover); }
.btn-primary:disabled { background: var(--disabled); }
.btn-secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--blue); height: auto; padding: 4px 8px; }
.btn-ghost:hover { background: var(--blue-soft); }
.btn-block { width: 100%; }

/* Forms */
label, .field-label { display: block; font-weight: 600; font-size: 13px; color: var(--ink); margin-bottom: 6px; }
input, select, textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}
.field { margin-bottom: 20px; }
.field.has-error input, .field.has-error select { border-color: var(--danger); background: var(--danger-soft); }
.field-error {
  font-size: 13px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid var(--danger-soft);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin-bottom: 16px;
}
.field-hint { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-container); padding: 20px; }

/* Badges */
.badge { display: inline-block; border-radius: var(--radius); padding: 2px 8px; font-size: 12px; font-weight: 600; }
.badge-info { background: var(--blue-soft); color: var(--blue); }
.badge-success { background: var(--success-soft); color: var(--success-deep); }
.badge-risk { background: var(--amber-soft); color: var(--amber-deep); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-neutral { background: var(--bg-hover); color: var(--muted); }

/* The draft banner lived here — a thin amber bar reading "draft — confirm
   before publishing", rendered above the header on every public page. Its own
   condition for removal was "until owner copy review"; that review closed
   2026-07-25 with all 13 decisions resolved
   (docs/design/2026-07-25-refresh/copy-review.md), so the warning outlived the
   thing it warned about — and did so ON PRODUCTION, above owner-APPROVED
   footer copy it directly contradicted. Removed; the amber tokens stay, they
   still back .badge-risk. */

/* Spinner (progress polling) */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--line);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: cp-spin .8s linear infinite;
}
@keyframes cp-spin { to { transform: rotate(360deg); } }

/* Plan card — shared by the landing pricing table and the signup plan step */
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.plan-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-container);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}
.plan-card.selectable { cursor: pointer; }
.plan-card.selected { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.plan-card--highlight { border-color: var(--blue); }
.plan-name { margin: 0; }
.plan-tagline { font-size: 13px; min-height: 18px; margin-bottom: 0; }
.plan-price { font-size: 30px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; margin-bottom: 0; }
.plan-price span { font-size: 14px; font-weight: 400; color: var(--muted); }
.plan-trial { font-size: 13px; color: var(--teal-deep); font-weight: 600; margin-bottom: 0; }
.plan-bullets { list-style: none; padding: 0; margin: 0; flex-grow: 1; }
.plan-bullets li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--ink);
}
.plan-bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--teal-soft);
  border: 1px solid var(--teal);
}
.pricing-loading, .pricing-error { grid-column: 1 / -1; color: var(--muted); }
.pricing-error { color: var(--danger); }

/* Progress checklist (signup progress screen) */
.progress-list { list-style: none; padding: 0; margin: 24px 0 0; }
.progress-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.progress-row:last-child { border-bottom: none; }
.progress-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  background: var(--bg-hover);
  color: var(--muted);
}
.progress-icon.done { background: var(--success-soft); color: var(--success-deep); }
.progress-icon.warn { background: var(--amber-soft); color: var(--amber-deep); }
.progress-label { font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.progress-sub { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* Utility */
.hidden { display: none !important; }
.muted { color: var(--muted); }
