/* ============================================================
   PRIVACY POLICY GENERATOR — step wizard + live legal preview.
   ============================================================ */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eceef3;
  --ink: #1b1d27;
  --muted: #585d6e;
  --subtle: #8a8fa3;
  --line: #e2e4ec;
  --accent: #4b54c7;          /* trust indigo */
  --accent-soft: #ebedfb;
  --ok: #2f7a5f;
  --danger: #b3503f;
  --shadow: 0 12px 32px -20px rgba(25, 30, 60, 0.30);
  --paper-shadow: 0 24px 60px -24px rgba(20, 25, 55, 0.30);
  --radius: 13px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: ui-serif, Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161c;
    --surface: #1b1e26;
    --surface-2: #242833;
    --ink: #e7e9f0;
    --muted: #9aa0b2;
    --subtle: #6b7081;
    --line: #2c313d;
    --accent: #8f97f0;
    --accent-soft: #1f2334;
    --ok: #6fc09a;
    --danger: #e08a78;
    --shadow: 0 20px 48px -24px rgba(0, 0, 0, 0.6);
    --paper-shadow: 0 28px 64px -26px rgba(0, 0, 0, 0.7);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.55; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button, input, select, textarea { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.site-header { position: sticky; top: 0; z-index: 20; height: 58px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(18px, 4vw, 44px); border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(12px); }
.logo-link { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 750; }
.logo-link img { display: block; }
.logo-link small { display: block; font-size: 9.5px; font-weight: 700; color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; }
.home-link { color: var(--muted); font-size: 13px; font-weight: 650; }
.home-link:hover { color: var(--accent); }

.app-shell { width: min(1480px, 100%); margin: 0 auto; padding: clamp(16px, 3vw, 34px); }

.pp-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.pp-head h1 { margin: 4px 0 0; }
.pp-head .lede { color: var(--muted); max-width: 48ch; margin: 0; }

.eyebrow { margin: 0; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(26px, 4vw, 44px); line-height: 1.04; letter-spacing: -0.01em; font-weight: 820; }

.pp-shell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(420px, 0.95fr); gap: 18px; align-items: start; }

/* Stepper nav */
.stepper { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.stepper button { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); padding: 7px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; cursor: pointer; }
.stepper button .num { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--surface-2); color: var(--subtle); font-size: 11px; font-weight: 800; }
.stepper button.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.stepper button.active .num { background: var(--accent); color: #fff; }
.stepper button.done .num { background: var(--ok); color: #fff; }

/* Form */
.form-pane { display: grid; gap: 14px; }
.step { display: none; }
.step.active { display: grid; gap: 14px; }
.panel { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); display: grid; gap: 11px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-head h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); font-weight: 800; }
.panel-desc { margin: -4px 0 2px; color: var(--subtle); font-size: 12px; }

.field { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.field.req > span::after, label.req::after { content: " *"; color: var(--danger); }
.field.inline { display: inline-grid; }
.mini-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini-row:has(> :nth-child(3)) { grid-template-columns: 1fr 1fr 1fr; }

.check-line { display: flex; align-items: flex-start; gap: 9px; color: var(--ink); font-size: 13px; font-weight: 600; padding: 4px 0; }
.check-line input[type="checkbox"], .check-line input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.check-line small { display: block; color: var(--subtle); font-weight: 500; font-size: 11.5px; margin-top: 1px; }
.check-grid { display: grid; gap: 4px; }

/* nested conditional block under a checkbox */
.sub { margin: 2px 0 6px 25px; padding: 10px 12px; border-left: 2px solid var(--accent-soft); display: grid; gap: 9px; }
.sub[hidden] { display: none; }
.sub .field, .sub .check-line { font-size: 12px; }

input[type="text"], input[type="email"], input[type="tel"], input[type="url"], input[type="number"], input[type="date"], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); padding: 9px 10px; outline: none;
}
textarea { resize: vertical; font-family: inherit; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }

.rule-hint { margin: 0; color: var(--subtle); font-size: 11px; font-weight: 600; }
.law-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.law-tag { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--accent-soft); color: var(--accent); }

.step-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 2px; }
.btn { min-height: 40px; padding: 0 18px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 750; cursor: pointer; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); color: #fff; }
.btn[hidden] { display: none; }
.text-btn { border: 0; background: transparent; color: var(--accent); padding: 0; font-weight: 750; font-size: 12px; cursor: pointer; }
.text-btn.danger { color: var(--danger); }

/* Preview */
.preview-pane { position: sticky; top: 74px; display: grid; gap: 12px; }
.preview-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar-actions .btn { min-height: 36px; padding: 0 14px; font-size: 13px; }
.print-tip { margin: 0; }

.paper-wrap { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); padding: clamp(10px, 2vw, 22px); max-height: calc(100dvh - 150px); overflow: auto; }

/* ---------- Policy document ---------- */
.policy-doc {
  --pad: clamp(24px, 4vw, 48px);
  width: 100%; max-width: 760px; margin: 0 auto;
  background: #ffffff; color: #1b1d27; border-radius: 4px; box-shadow: var(--paper-shadow);
  padding: var(--pad); font-size: 13.5px; line-height: 1.62;
}
.policy-doc h1 { font-size: 24px; font-weight: 820; letter-spacing: -0.01em; margin: 0 0 4px; color: #1b1d27; }
.policy-doc .doc-sub { color: #585d6e; font-size: 12.5px; margin: 0 0 22px; }
.policy-doc h2 { font-size: 15.5px; font-weight: 800; margin: 26px 0 8px; color: #2a2d3a; }
.policy-doc h3 { font-size: 13.5px; font-weight: 750; margin: 16px 0 4px; color: #2a2d3a; }
.policy-doc p { margin: 0 0 10px; }
.policy-doc ul { margin: 4px 0 12px; padding-left: 20px; }
.policy-doc li { margin: 4px 0; }
.policy-doc table { width: 100%; border-collapse: collapse; margin: 6px 0 14px; font-size: 12.5px; }
.policy-doc th, .policy-doc td { text-align: left; vertical-align: top; padding: 7px 9px; border: 1px solid #e2e4ec; }
.policy-doc th { background: #f5f6f8; font-weight: 700; }
.policy-doc .toc { background: #f7f8fb; border: 1px solid #e2e4ec; border-radius: 8px; padding: 14px 18px; margin: 0 0 22px; }
.policy-doc .toc ol { margin: 6px 0 0; padding-left: 20px; columns: 2; column-gap: 28px; font-size: 12.5px; }
.policy-doc .toc a { color: #4b54c7; }
.policy-doc .muted-note { color: #585d6e; font-size: 12px; font-style: italic; }
.policy-empty { text-align: center; color: var(--subtle); padding: 60px 20px; font-size: 14px; }

/* Disclaimer / info / faq */
.disclaimer { display: flex; gap: 12px; align-items: flex-start; margin-top: 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--accent-soft); color: var(--ink); font-size: 13px; line-height: 1.55; }
.disclaimer .dz-badge { flex-shrink: 0; font-size: 16px; color: var(--accent); }
.disclaimer p { margin: 0; }

.info { margin-top: 16px; padding: clamp(20px, 3vw, 30px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); display: grid; gap: 18px; }
.info-intro h2 { font-size: clamp(20px, 2.6vw, 30px); margin: 6px 0 8px; letter-spacing: -0.01em; }
.info-intro p { color: var(--muted); margin: 0; }
.faq { display: grid; gap: 10px; }
.faq-2col { grid-template-columns: 1fr 1fr; align-items: start; }
details { border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); padding: 0 16px; }
summary { cursor: pointer; font-weight: 750; padding: 13px 0; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--ink); }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--accent); font-weight: 800; font-size: 17px; }
details[open] summary::after { content: "\2013"; }
details > p, details > ul { margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.55; }

.site-footer { max-width: 1480px; margin: 0 auto; padding: 24px clamp(16px, 3vw, 34px) 36px; display: flex; gap: 16px; justify-content: space-between; color: var(--subtle); font-size: 12px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 16px; }

@media (max-width: 1080px) {
  .pp-shell { grid-template-columns: 1fr; }
  .preview-pane { position: static; }
  .paper-wrap { max-height: none; }
}
@media (max-width: 720px) {
  .app-shell { padding: 14px; }
  .mini-row, .mini-row:has(> :nth-child(3)), .faq-2col, .policy-doc .toc ol { grid-template-columns: 1fr; columns: 1; }
  .site-header { padding: 0 14px; }
  .home-link { display: none; }
  .site-footer { flex-direction: column; }
}

/* ---------- print → PDF ---------- */
@media print {
  @page { size: A4; margin: 18mm; }
  .site-header, .site-footer, .form-pane, .stepper, .pp-head, .preview-toolbar, .print-tip, .disclaimer, .info { display: none !important; }
  body { background: #fff; }
  .app-shell { width: auto; max-width: none; padding: 0; }
  .pp-shell { display: block; }
  .preview-pane { position: static; display: block; }
  .paper-wrap { border: 0; background: #fff; padding: 0; overflow: visible; max-height: none; }
  .policy-doc { max-width: none; width: 100%; box-shadow: none; border-radius: 0; padding: 0; font-size: 11pt; }
  .policy-doc .toc { break-inside: avoid; }
  .policy-doc h2 { break-after: avoid; }
}
