/* PolicyForge (bp-lgpd) — "Sereno" identity. Vanilla, no build.
   Standalone product — NOT the BPSO Lab 2026 system. Its own everything:
   · light-first (dark works, but light is the star — kills the "dev tool" read)
   · deep teal #0f766e on cool paper — calm/trust/compliance, not cyber-neon
   · Sora (headings) + Inter (body)
   · preview = a sheet of paper with a letterhead strip, NOT a macOS code window
   The only thread back to BPSO is the footer signature + the quality bar. */

:root {
  /* "Sereno" — light is the default identity */
  --brand: #0f766e; --brand-strong: #115e59; --brand-bright: #0d9488;
  --brand-tint: rgba(15, 118, 110, 0.07);
  --glow: rgba(15, 118, 110, 0.18);
  --bg: #f3f6f9; --surface: #ffffff; --surface-2: #eaf0f3;
  --ink: #112a2e; --muted: #586a70;
  --border: rgba(16, 42, 46, 0.11);
  --border-strong: rgba(16, 42, 46, 0.22);
  --input-bg: #ffffff;
  --sheet-shadow: 0 24px 56px -28px rgba(16, 42, 46, 0.4), 0 2px 6px -2px rgba(16, 42, 46, 0.08);
  --font-head: 'Sora', sans-serif; --font-body: 'Inter', sans-serif;
  --font-mono: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, monospace;
  --ok: #16a34a; --warn: #d97706; --err: #dc2626;
}
[data-theme="dark"] {
  --brand: #2dd4bf; --brand-strong: #5eead4; --brand-bright: #2dd4bf;
  --brand-tint: rgba(45, 212, 191, 0.10);
  --glow: rgba(45, 212, 191, 0.20);
  --bg: #0b1719; --surface: #13242a; --surface-2: #1b333a;
  --ink: #e8f1f1; --muted: #94a8ad;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --input-bg: rgba(255, 255, 255, 0.04);
  --sheet-shadow: 0 24px 56px -26px rgba(0, 0, 0, 0.65), 0 2px 6px -2px rgba(0, 0, 0, 0.4);
  --ok: #22c55e; --warn: #f59e0b; --err: #ef4444;
}

/* Native controls (select popup, scrollbars) follow the theme */
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg); color: var(--ink);
  font-family: var(--font-body); line-height: 1.6; overflow-x: hidden;
  /* "Sereno" substrate: one calm top glow — sober, no texture noise */
  background-image: radial-gradient(ellipse 1100px 600px at 50% -240px, var(--brand-tint), transparent 70%);
  background-attachment: fixed;
}
h1, h2, h3, legend { font-family: var(--font-head); letter-spacing: -0.02em; }
a { color: var(--brand); }
/* Hardcoded (custom props don't resolve in ::selection on some browsers) */
::selection { background: #0f766e; color: #fff; }
::-moz-selection { background: #0f766e; color: #fff; }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--brand); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ===== Nav (standalone product chrome — no portfolio "back" link) ===== */
.pf-nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 13px 24px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--border);
}
/* Brand: icon-tile + name — the product-family grammar (ContractFlow/AirBridge/AudioWriter) */
.pf-brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.pf-logo-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(145deg, #0f766e, #115e59); color: #fff; font-size: 1.2rem;
  box-shadow: 0 5px 12px -4px rgba(15, 118, 110, 0.45); flex-shrink: 0;
}
.pf-brand-name { font-family: var(--font-head); font-weight: 700; font-size: 1.18rem; letter-spacing: -0.02em; color: var(--ink); }
.pf-nav-actions { display: flex; align-items: center; gap: 14px; }
.pf-nav-link { color: var(--muted); text-decoration: none; font-size: .85rem; font-weight: 500; white-space: nowrap; transition: color .18s; }
.pf-nav-link:hover { color: var(--ink); }
.pf-nav-div { width: 1px; height: 22px; background: var(--border); flex-shrink: 0; }
.lang-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.lang-switch button {
  appearance: none; border: 0; background: transparent; color: var(--muted);
  font: 600 .76rem var(--font-body); letter-spacing: .03em; padding: .42rem .72rem; cursor: pointer;
  transition: color .18s, background .18s;
}
.lang-switch button:hover { color: var(--ink); }
html[data-lang="pt"] [data-set-lang="pt"],
html[data-lang="en"] [data-set-lang="en"],
html[data-lang="es"] [data-set-lang="es"] { background: var(--brand); color: #fff; }
.theme-btn {
  appearance: none; width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: 50%; background: var(--surface);
  color: var(--muted); font-size: 1.1rem; cursor: pointer; transition: color .2s, transform .2s, border-color .2s;
}
.theme-btn:hover { color: var(--brand); border-color: var(--brand); transform: rotate(15deg); }
[data-theme="light"] .theme-btn .ri-moon-line { display: none; }
[data-theme="dark"] .theme-btn .ri-sun-line { display: none; }

/* ===== Hero ===== */
.pf-hero { max-width: 880px; margin: 56px auto 40px; padding: 0 24px; text-align: center; }
.pf-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-head); font-weight: 700; text-transform: uppercase;
  letter-spacing: .18em; font-size: .7rem; color: var(--brand); margin-bottom: 18px;
  background: var(--brand-tint); border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent);
  padding: 6px 14px; border-radius: 999px;
}
.pf-hero h1 { font-size: clamp(2rem, 4.6vw, 3.1rem); font-weight: 700; line-height: 1.08; margin-bottom: 16px; color: var(--ink); }
.pf-sub { color: var(--muted); font-size: 1.08rem; max-width: 600px; margin: 0 auto 22px; }
.trust-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--ink); box-shadow: 0 6px 18px -10px rgba(16,42,46,.25);
  border-radius: 999px; padding: 8px 16px; font-size: .82rem; font-weight: 500;
}
.trust-badge i { font-size: .95rem; color: var(--brand); }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 50%, transparent); } 50% { opacity: .7; box-shadow: 0 0 0 5px transparent; } }
.lang-note { margin-top: 12px; font-size: .8rem; color: var(--muted); }
html[data-lang="pt"] .lang-note { display: none; }

/* ===== Generator layout ===== */
.gen {
  max-width: 1240px; margin: 0 auto; padding: 0 24px;
  display: grid; grid-template-columns: minmax(400px, 1fr) 1.04fr; gap: 34px; align-items: start;
}

/* ===== Form (airy cards, not a dev panel) ===== */
.gen-form { min-width: 0; }
.fset {
  border: 1px solid var(--border); border-radius: 16px; padding: 22px 22px 20px; margin-bottom: 18px;
  background: var(--surface); box-shadow: 0 2px 4px -2px rgba(16,42,46,.05);
}
.fset legend {
  font-family: var(--font-head); font-weight: 700; font-size: .82rem; text-transform: uppercase;
  letter-spacing: .08em; padding: 0 10px 0 8px; color: var(--brand); margin-left: -2px;
}
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-size: .85rem; font-weight: 600; color: var(--ink); margin-bottom: 7px; }
.field input, .field select {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--input-bg); color: var(--ink); font: 400 .95rem var(--font-body);
  transition: border-color .18s, box-shadow .18s;
}
.field input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.field select option { background: var(--surface); color: var(--ink); }
.field input:focus, .field select:focus, .switch:focus-visible {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--glow);
}
.req { color: var(--brand); }
.field input.invalid.touched { border-color: var(--err); box-shadow: 0 0 0 3px color-mix(in srgb, var(--err) 20%, transparent); }
.field-msg { display: block; min-height: 0; font-size: .76rem; color: var(--err); margin-top: 5px; }
.field-help { display: block; font-size: .78rem; color: var(--muted); margin: 2px 0 4px; line-height: 1.45; }

/* Switch (role=switch button) */
.switch {
  display: flex; align-items: center; gap: 13px; width: 100%; text-align: left;
  background: none; border: 0; padding: 9px 0; cursor: pointer; color: var(--ink);
  font: 400 .94rem var(--font-body); border-radius: 8px;
}
.switch-track {
  width: 42px; height: 24px; border-radius: 999px; background: var(--border-strong);
  position: relative; flex-shrink: 0; transition: background .2s;
}
.switch-track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.switch[aria-checked="true"] .switch-track { background: var(--brand); }
.switch[aria-checked="true"] .switch-track::after { transform: translateX(18px); }
.dep-block { margin: 2px 0 6px 18px; padding-left: 16px; border-left: 2px solid color-mix(in srgb, var(--brand) 38%, transparent); }
.dep-block[hidden] { display: none; }

/* ===== Preview = a sheet of paper ===== */
.preview {
  position: sticky; top: 88px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; overflow: hidden; box-shadow: var(--sheet-shadow);
}
/* Letterhead strip: shield mark + segmented document tabs (NOT a code window) */
.preview-chrome {
  display: flex; align-items: center; gap: 13px; padding: 13px 16px; flex-shrink: 0;
  border-bottom: 1px solid var(--border); background: var(--brand-tint);
}
.sheet-mark { font-size: 1.2rem; color: var(--brand); flex-shrink: 0; line-height: 1; }
.doc-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.doc-tab {
  display: inline-flex; align-items: center; gap: 8px; background: transparent; border: 0;
  font: 600 .82rem var(--font-head); padding: 7px 14px; border-radius: 999px; cursor: pointer;
  color: var(--muted); transition: background .18s, color .18s, box-shadow .18s;
}
.doc-tab:hover { color: var(--ink); }
.doc-tab[aria-selected="true"] { background: var(--surface); color: var(--brand); box-shadow: 0 1px 4px -1px rgba(16,42,46,.18); }
.doc-tab-label { white-space: nowrap; }
.ready-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); flex-shrink: 0; transition: background .25s; }
.doc-tab.ready .ready-dot { background: var(--ok); }

.completeness { height: 3px; background: var(--border); }
.completeness-fill { display: block; height: 100%; width: 0; background: var(--brand); transition: width .35s ease; }

.out-toolbar { display: flex; flex-wrap: wrap; gap: 8px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.out-action {
  font: 600 .8rem var(--font-body); padding: 8px 13px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: transparent; color: var(--ink); cursor: pointer;
  transition: border-color .18s, color .18s, background .18s;
}
.out-action:not(:disabled):hover { border-color: var(--brand); color: var(--brand); background: var(--brand-tint); }
.out-action.copied { border-color: var(--ok); color: var(--ok); }
.out-action:disabled { opacity: .42; cursor: not-allowed; }

/* Document body — the sheet content */
.doc-body { padding: 30px 34px; max-height: 66vh; overflow-y: auto; counter-reset: sec; }
.doc-body h1 { font-size: 1.5rem; margin-bottom: 4px; color: var(--ink); }
.doc-body .doc-stamp { color: var(--muted); font-size: .8rem; margin-bottom: 18px; }
.doc-body h2 { counter-increment: sec; font-size: 1.05rem; margin: 24px 0 8px; color: var(--ink); }
.doc-body h2::before { content: counter(sec) ". "; color: var(--brand); font-weight: 700; }
.doc-body p { font-size: .93rem; line-height: 1.75; margin-bottom: 10px; max-width: 70ch; color: var(--ink); }
.doc-body ul { margin: 0 0 12px 22px; } .doc-body li { font-size: .93rem; line-height: 1.65; margin-bottom: 5px; }
.doc-body a { color: var(--brand); word-break: break-word; }

/* Empty-state ghost */
.doc-ghost { padding: 14px 6px; }
.ghost-pill {
  display: inline-block; padding: 5px 13px; border-radius: 999px; font-size: .82rem;
  background: var(--brand-tint); border: 1px dashed color-mix(in srgb, var(--brand) 35%, transparent);
  color: var(--brand); margin-bottom: 18px;
}
.ghost-line { display: block; height: 11px; border-radius: 5px; background: var(--surface-2); margin: 12px 0; }
.ghost-line.short { width: 58%; }
.ghost-hint { text-align: center; color: var(--muted); margin-top: 26px; font-size: .92rem; }

.disclaimer {
  padding: 15px 18px; font-size: .8rem; line-height: 1.55; color: var(--muted);
  border-top: 1px solid var(--border); background: color-mix(in srgb, var(--warn) 7%, transparent);
}

/* ===== Conversion CTA ===== */
.cta-panel { max-width: 1240px; margin: 38px auto 0; padding: 0 24px; }
.cta-inner {
  background: linear-gradient(140deg, color-mix(in srgb, var(--brand) 12%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, var(--brand) 26%, transparent);
  border-radius: 20px; padding: 34px 30px; text-align: center; box-shadow: var(--sheet-shadow);
}
.cta-eyebrow { font-family: var(--font-head); font-weight: 700; text-transform: uppercase; letter-spacing: .13em; font-size: .74rem; color: var(--brand); }
.cta-headline { font-size: clamp(1.35rem, 3vw, 1.85rem); font-weight: 700; margin: 8px auto 12px; max-width: 600px; color: var(--ink); }
.cta-body { color: var(--muted); max-width: 580px; margin: 0 auto 20px; }
.cta-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.cta-primary {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
  background: var(--brand); color: #fff; font-weight: 600; padding: 13px 24px; border-radius: 11px;
  box-shadow: 0 10px 22px -8px var(--glow); transition: transform .18s, box-shadow .18s, background .18s;
}
.cta-primary:hover { transform: translateY(-2px); background: var(--brand-strong); box-shadow: 0 14px 28px -8px var(--glow); }
.cta-secondary { display: inline-flex; align-items: center; padding: 13px 22px; border-radius: 11px; border: 1px solid var(--border-strong); color: var(--ink); text-decoration: none; transition: border-color .18s, color .18s; }
.cta-secondary:hover { border-color: var(--brand); color: var(--brand); }
.cta-micro { margin-top: 14px; font-size: .8rem; color: var(--muted); }
.cta-panel[hidden] { display: none; }
#cta:not([hidden]) .cta-inner { animation: rise .5s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ===== Footer (the only thread back to BPSO) ===== */
.pf-foot { max-width: 1240px; margin: 44px auto 32px; padding: 24px 24px 0; border-top: 1px solid var(--border); text-align: center; }
.pf-foot p { color: var(--muted); font-size: .85rem; margin-bottom: 5px; }
.pf-foot-offline { font-size: .78rem !important; opacity: .8; }

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  background: var(--ink); border: 1px solid var(--ink); color: var(--bg);
  padding: 12px 18px; border-radius: 10px; font-size: .88rem; box-shadow: 0 12px 30px -10px rgba(0,0,0,.4);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 80;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ===== Focus visibility ===== */
.doc-tab:focus-visible, .out-action:focus-visible, .lang-switch button:focus-visible,
.theme-btn:focus-visible, .pf-brand:focus-visible, .pf-nav-link:focus-visible,
.cta-primary:focus-visible, .cta-secondary:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px;
}

/* ===== Responsive ===== */
@media (max-width: 960px) {
  .gen { grid-template-columns: 1fr; }
  .preview { position: static; }
  .doc-body { max-height: none; }
}
@media (max-width: 560px) {
  .pf-nav { flex-wrap: wrap; }
  .pf-nav-link, .pf-nav-div { display: none; }
  .pf-hero { margin-top: 34px; }
  .doc-body { padding: 24px 20px; }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ===== Print: only the document, black on white ===== */
@media print {
  .pf-nav, .gen-form, .preview-chrome, .completeness, .out-toolbar, #cta, .pf-foot, .toast, .skip-link, .pf-hero, .disclaimer { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
  .gen, .preview { display: block !important; box-shadow: none !important; border: 0 !important; position: static !important; max-width: none !important; }
  .doc-body { max-height: none !important; overflow: visible !important; padding: 0 !important; color: #000 !important; }
  .doc-body h1, .doc-body h2, .doc-body p, .doc-body li { color: #000 !important; }
  .doc-body h2 { page-break-after: avoid; }
  .doc-body p, .doc-body li { page-break-inside: avoid; }
  @page { margin: 2cm; }
}
