/* Estilos de las páginas legales. Mismas variables y modo oscuro que index.html. */
:root {
  --bg: #f7f6f2; --surface: #ffffff; --ink: #1d1c19; --muted: #66645d;
  --brand: #ffcc33; --brand-ink: #1d1c19; --accent: #0f766e; --line: #e6e3da;
  --warn-bg: #fff4cc; --warn-line: #b45309;
  --error: #b42318; --error-bg: #fef3f2; --ok: #067647;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #151513; --surface: #1f1e1b; --ink: #f3f1ea; --muted: #a9a69c; --line: #33312c; --accent: #2dd4bf;
          --warn-bg: #2a2416; --warn-line: #fbbf24; --error: #fda29b; --error-bg: #2b1715; --ok: #75e0a7; }
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); line-height: 1.6; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
header { display: flex; align-items: center; justify-content: space-between; padding: 20px 0; }
.logo { font-weight: 800; font-size: 22px; letter-spacing: -.5px; color: var(--ink); text-decoration: none; }
.logo span { background: var(--brand); color: var(--brand-ink); padding: 0 6px; border-radius: 6px; }
nav a { color: var(--muted); text-decoration: none; margin-left: 18px; font-size: 15px; }
main { padding: 8px 0 48px; }
h1 { font-size: clamp(28px, 4.5vw, 40px); line-height: 1.12; margin: 8px 0 8px; letter-spacing: -.5px; }
h2 { font-size: 22px; margin: 36px 0 10px; letter-spacing: -.3px; }
h3 { font-size: 17px; margin: 20px 0 6px; }
p, li { color: var(--ink); }
.meta { color: var(--muted); font-size: 14px; margin: 0 0 20px; }
.draft { background: var(--warn-bg); border: 1.5px solid var(--warn-line); border-radius: 14px; padding: 14px 16px; margin: 16px 0 24px; }
.draft strong { display: block; font-size: 16px; margin-bottom: 4px; }
.draft p { margin: 0; font-size: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; margin: 12px 0; }
.card h3 { margin-top: 0; }
.todo { color: var(--muted); font-style: italic; }
.table { width: 100%; border-collapse: collapse; margin: 8px 0 16px; font-size: 15px; }
.table th, .table td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .3px; }
.table-scroll { overflow-x: auto; }
.steps { padding-left: 22px; }
.steps li { margin-bottom: 6px; }
code { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: 14px; }
a { color: var(--accent); }
footer { padding: 32px 0 48px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }
footer a { color: var(--accent); }


/* ── Botones (mismos que index.html) ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 22px;
       border-radius: 12px; border: 1.5px solid transparent; font: inherit; font-weight: 700; font-size: 16px;
       text-decoration: none; cursor: pointer; }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-link { background: none; border: 0; padding: 8px 4px; min-height: 44px; font: inherit; color: var(--accent);
            text-decoration: underline; cursor: pointer; }
.btn:disabled, .btn-link:disabled { opacity: .6; cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; }
.btn[aria-busy="true"]:disabled { opacity: .85; }
.btn[aria-busy="true"]::before { content: ""; flex: none; width: 1.05em; height: 1.05em; border: 2.5px solid currentColor;
                                 border-right-color: transparent; border-radius: 50%; }
@media (prefers-reduced-motion: no-preference) {
  .btn[aria-busy="true"]::before { animation: spin .8s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }
}
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 20px; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[data-step-heading]:focus { outline: none; }
.skip-link { position: absolute; left: 16px; top: -100px; z-index: 10; padding: 10px 14px; border-radius: 10px;
             background: var(--brand); color: var(--brand-ink); font-weight: 700; text-decoration: none; }
.skip-link:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
           clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ── Formulario web del Libro de Reclamaciones ── */
.libro { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 20px; margin: 24px 0; }
.libro > h2 { margin-top: 0; }
.libro h3 { font-size: 19px; margin: 0 0 8px; }
.stepper { list-style: none; margin: 0 0 24px; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px;
           counter-reset: step; }
.stepper li { counter-increment: step; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
              font-size: 13px; color: var(--muted); }
.stepper li::before { content: counter(step); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
                      border: 1.5px solid var(--line); font-weight: 800; color: var(--muted); }
.stepper li[aria-current="step"] { color: var(--ink); font-weight: 700; }
.stepper li[aria-current="step"]::before { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.field { margin: 0 0 18px; }
.field > label, .field-label { display: block; font-weight: 600; margin-bottom: 6px; }
.optional { font-weight: 400; color: var(--muted); font-size: 14px; }
.hint { display: block; color: var(--muted); font-size: 14px; margin: 4px 0 0; }
input[type="text"], input[type="tel"], input[type="email"], select, textarea {
  display: block; width: 100%; max-width: 100%; min-height: 48px; padding: 11px 14px; border: 1.5px solid var(--line);
  border-radius: 12px; background: var(--bg); color: var(--ink); font: inherit; font-size: 16px; }
textarea { min-height: 140px; resize: vertical; }
select { text-overflow: ellipsis; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--error); }
input[readonly] { color: var(--muted); }
.input-code { max-width: 220px; font-size: 22px; letter-spacing: 6px; font-variant-numeric: tabular-nums; }
.input-amount { max-width: 220px; }
.field-error { color: var(--error); font-size: 14px; font-weight: 600; margin: 6px 0 0; }
fieldset { border: 0; margin: 0 0 8px; padding: 0; min-width: 0; }
legend { font-weight: 700; font-size: 17px; padding: 0; margin: 0 0 12px; }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice { display: flex; gap: 10px; align-items: flex-start; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px;
          cursor: pointer; background: var(--bg); }
.choice input { margin-top: 5px; width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
.choice:has(input:checked) { border-color: var(--accent); }
.choice:has(input[aria-invalid="true"]) { border-color: var(--error); }
.choice small { display: block; color: var(--muted); font-size: 14px; }
.error-summary { border: 1.5px solid var(--error); border-left-width: 6px; background: var(--error-bg); border-radius: 12px;
                 padding: 12px 16px; margin: 0 0 20px; }
.error-summary p { margin: 0 0 6px; font-weight: 700; }
.error-summary ul { margin: 0; padding-left: 20px; }
.error-summary a { color: var(--error); }
.form-error { border: 1.5px solid var(--error); background: var(--error-bg); border-radius: 12px; padding: 12px 16px; color: var(--ink); }
.verified { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.verified strong { color: var(--ok); overflow-wrap: anywhere; }
#code-info, .status { overflow-wrap: anywhere; }
.notice { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 14px; color: var(--muted); }
.status { min-height: 1.6em; color: var(--muted); font-size: 14px; margin: 0 0 12px; }

/* Constancia */
.receipt-code { display: block; font-size: clamp(24px, 7vw, 32px); font-weight: 800; letter-spacing: .5px; overflow-wrap: anywhere; margin: 4px 0 12px; }
.receipt-list { display: grid; grid-template-columns: minmax(0, 13em) minmax(0, 1fr); gap: 10px 16px; margin: 16px 0; }
.receipt-list dt { color: var(--muted); font-size: 14px; }
.receipt-list dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
.receipt-list .wide { grid-column: 1 / -1; }
.receipt-provider { font-size: 14px; color: var(--muted); }

@media (max-width: 760px) {
  nav { display: none; }
}
@media (max-width: 520px) {
  .libro { padding: 16px; border-radius: 16px; }
  .choices { grid-template-columns: 1fr; }
  .receipt-list { grid-template-columns: 1fr; gap: 2px; }
  .receipt-list dd { margin-bottom: 10px; }
  .actions .btn { width: 100%; }
}

/* ── Impresión de la constancia ── */
@media print {
  :root { --bg: #fff; --surface: #fff; --ink: #000; --muted: #444; --line: #bbb; --accent: #000; --error: #000; }
  body { background: #fff; color: #000; font-size: 12pt; }
  header nav, footer, .skip-link, .no-print { display: none !important; }
  /* Con la constancia en pantalla se imprime solo lo necesario (aviso de borrador, proveedor y constancia). */
  .receipt-mode .info-only { display: none !important; }
  .libro { border: 0; padding: 0; margin: 0; }
  .receipt-list > * { break-inside: avoid; }
  a { color: #000; text-decoration: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
