/* Libro de Reclamaciones: the public form, the filed sheet and its printed copy.
   The sheet (.hoja) is also shown in the console's claim page. */

.libro-page { background: var(--background); }
.libro-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 880px; margin: 0 auto; padding: 20px 16px 0;
}
.libro-top .brand-logo { height: 24px; width: auto; }
.libro-theme {
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 999px;
  border: 1px solid var(--border); background: transparent; color: var(--text); cursor: pointer;
}
.libro-theme:hover { background: var(--surface-muted); }

.libro { display: grid; gap: 20px; max-width: 880px; margin: 0 auto; padding: 28px 16px 72px; }
.libro:focus { outline: 0; }
.libro-hero h1, .libro-done h1 { margin: 0 0 8px; }
.libro-hero .lede { max-width: 660px; }

.libro-internal {
  margin: 0; padding: 12px 14px; border-radius: var(--radius);
  border: 1px dashed color-mix(in srgb, var(--warning) 55%, var(--border));
  background: var(--warning-soft); color: var(--warning); font-size: 0.92rem;
}
.libro-internal code { font-family: var(--font-mono); font-size: 0.85em; }

/* Who answers the claim: the provider's legal data, as the official format asks. */
.libro-provider, .hoja-provider {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 20px; margin: 0;
}
.libro-provider {
  padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-raised); box-shadow: var(--shadow-soft);
}
.libro-provider .is-wide, .hoja-provider .is-wide { grid-column: span 2; }
.libro-provider dt, .hoja-provider dt, .hoja-section dt {
  color: var(--muted); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.02em;
}
.libro-provider dd, .hoja-provider dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.hoja-provider dd small { color: var(--muted); font-weight: 400; }
.libro-provider dd small { display: block; color: var(--muted); font-size: 0.8rem; font-weight: 400; }

/* The form */
.libro-form { display: grid; gap: 16px; }
.libro-card {
  margin: 0; padding: 22px 22px 24px; min-width: 0;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-soft);
}
.libro-card legend {
  display: flex; align-items: center; gap: 10px; float: left; width: 100%; margin: 0 0 16px; padding: 0;
  font: 700 1.08rem/1.25 var(--font-display); letter-spacing: -0.01em; color: var(--text);
}
.libro-card legend + * { clear: both; }
.libro-card.is-provider { background: var(--surface-subtle); box-shadow: none; border-style: dashed; }
.libro-card.is-provider legend { margin-bottom: 6px; }
.libro-card.is-provider p { margin: 0; }
.libro-step {
  display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-dark); font: 700 0.9rem/1 var(--font-body);
}
.libro-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.libro-field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.libro-field.is-wide { grid-column: 1 / -1; }
.libro-field > label, .libro-label { color: var(--muted-strong); font-size: 0.9rem; font-weight: 600; }
.libro-field em { color: var(--muted); font-style: normal; font-weight: 500; }
.libro-field input:not([type="checkbox"], [type="radio"]), .libro-field select, .libro-field textarea { width: 100%; }
.libro-field textarea { min-height: 0; }
.libro-hint { color: var(--muted); font-size: 0.82rem; line-height: 1.4; }
.libro-error { color: var(--danger); font-size: 0.82rem; font-weight: 600; line-height: 1.4; }
.libro-field-foot { display: flex; justify-content: space-between; gap: 12px; }
.libro-count { flex: none; color: var(--faint); font-family: var(--font-mono); font-size: 0.75rem; }

.libro-check { display: flex; align-items: flex-start; gap: 10px; color: var(--text) !important; font-weight: 500 !important; cursor: pointer; }
.libro-check input { flex: none; width: 20px; height: 20px; margin: 1px 0 0; }
.libro-check a { color: var(--accent-dark); font-weight: 600; }

.libro-segment {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-raised);
}
.libro-segment label {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px;
  border-radius: 9px; font-weight: 600; color: var(--muted-strong); cursor: pointer;
}
.libro-segment input { position: absolute; opacity: 0; pointer-events: none; }
.libro-segment label:has(input:checked) { background: var(--accent-soft); color: var(--accent-dark); }
.libro-segment label:has(input:focus-visible) { outline: 2px solid var(--ring); outline-offset: 1px; }

.libro-money { position: relative; display: flex; align-items: center; }
.libro-money > span {
  position: absolute; left: 12px; color: var(--muted); font: 600 0.82rem var(--font-mono); pointer-events: none;
}
.libro-money input { padding-left: 38px !important; font-variant-numeric: tabular-nums; }

.libro-kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.libro-kind {
  position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-raised);
  cursor: pointer; transition: border-color 150ms ease, background-color 150ms ease;
}
.libro-kind:hover { border-color: var(--border-strong); }
.libro-kind input { flex: none; width: 18px; height: 18px; margin: 2px 0 0; }
.libro-kind span { display: grid; gap: 4px; }
.libro-kind strong { font-size: 1rem; }
.libro-kind small { color: var(--muted); font-size: 0.85rem; line-height: 1.45; }
.libro-kind:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }

.libro-notices {
  display: grid; gap: 6px; padding: 14px 16px; border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0; background: var(--surface-muted); color: var(--muted-strong);
  font-size: 0.9rem;
}
.libro-notices p { margin: 0; }
.libro-summary p { margin: 0 0 6px; }
.libro-summary ul { margin: 0; padding-left: 20px; font-weight: 500; }
.libro-summary a { color: inherit; }
.libro-submit { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.libro-submit .button-link { min-height: 50px; padding: 0 26px; font-size: 1.02rem; }
.libro-submit .button-link:disabled { opacity: 0.7; cursor: progress; }
.libro-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* After sending */
.libro-done {
  display: flex; gap: 18px; align-items: flex-start; padding: 24px;
  border: 1px solid color-mix(in srgb, var(--success) 35%, var(--border)); border-radius: var(--radius);
  background: var(--surface-raised); box-shadow: var(--shadow-soft);
}
.libro-done-icon {
  display: grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: 999px;
  background: var(--success-soft); color: var(--success);
}
.libro-done-copy { display: grid; gap: 10px; min-width: 0; }
.libro-done-copy .eyebrow, .libro-done-copy h1, .libro-done-copy .lede { margin: 0; }
.libro-number { font-family: var(--font-mono); white-space: nowrap; color: var(--text); }
.libro-mail { margin: 0; color: var(--muted-strong); }
.libro-mail.is-warning { padding: 10px 12px; border-radius: 10px; background: var(--warning-soft); color: var(--warning); }
.libro-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }

.libro-footer { display: grid; gap: 4px; padding-top: 8px; color: var(--muted); font-size: 0.88rem; text-align: center; }
.libro-footer p { margin: 0; }
.libro-footer a { color: var(--muted-strong); }

/* The sheet: on screen, in the console and on paper. */
.hoja {
  display: grid; gap: 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-raised); box-shadow: var(--shadow-soft);
}
.hoja-head { display: grid; gap: 12px; padding: 20px 22px; border-bottom: 1px solid var(--border); background: var(--surface-subtle); }
.hoja-kicker { margin: 0; color: var(--accent-dark); font: 500 0.72rem var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; }
.hoja-head h2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0; font-size: 1.35rem; }
.hoja-number { font-family: var(--font-mono); font-size: 1.05rem; color: var(--accent-dark); }
.hoja-section { padding: 16px 22px; border-bottom: 1px solid var(--border); }
.hoja-section h3 { margin: 0 0 10px; font-size: 0.98rem; }
.hoja-section dl { display: grid; gap: 10px; margin: 0; }
.hoja-section dl > div { display: grid; grid-template-columns: minmax(150px, 32%) minmax(0, 1fr); gap: 12px; }
.hoja-section dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.hoja-foot { display: grid; gap: 4px; padding: 14px 22px; color: var(--muted); font-size: 0.82rem; }
.hoja-foot p { margin: 0; }

@media (max-width: 720px) {
  .libro { padding-top: 20px; }
  .libro-grid, .libro-kinds { grid-template-columns: minmax(0, 1fr); }
  .libro-provider, .hoja-provider { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .libro-provider .is-wide, .hoja-provider .is-wide { grid-column: 1 / -1; }
  .libro-card { padding: 18px 16px 20px; }
  .libro-done { flex-direction: column; padding: 20px; }
  .hoja-head, .hoja-section, .hoja-foot { padding-left: 16px; padding-right: 16px; }
  .hoja-section dl > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .libro-submit .button-link { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .libro-kind { transition: none; } }

@media print {
  @page { margin: 14mm; }
  :root, :root[data-theme="dark"] {
    color-scheme: light; --background: #ffffff; --surface: #ffffff; --surface-raised: #ffffff;
    --surface-subtle: #f4f4f4; --text: #000000; --muted: #444444; --muted-strong: #222222;
    --border: #bbbbbb; --accent-dark: #000000;
  }
  body { background: #ffffff !important; }
  .no-print, .skip-link, .support-banner, .cside, .cshell-bar, .claim-actions { display: none !important; }
  .libro { padding: 0; max-width: none; }
  .hoja { box-shadow: none; border-color: #999999; break-inside: auto; }
  .hoja-section { break-inside: avoid; }
}
