/* =========================================================
   CÓMPUTO DE PLAZOS · HOJA DE ESTILO
   ---------------------------------------------------------
   Los tokens son los de soleryrealabogados.es (mismos valores
   HSL que apps/web/src/index.css) y las mismas tipografías.
   El planteamiento aquí es distinto al del sitio: una sola
   columna, sin tarjetas ni cajas, y una única pieza con peso
   visual —la fecha de vencimiento—. Todo lo demás calla.
   ========================================================= */

/* Tipografías servidas desde el propio dominio (antes, Google Fonts).
   Mismos ficheros que apps/web/src/fonts/; licencia SIL OFL 1.1 en ./fonts/. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('./fonts/inter-latin-wght-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url('./fonts/playfair-display-latin-wght-normal.woff2') format('woff2');
}

:root {
  --navy:      hsl(160 45% 12%);
  --cream:     hsl(45 31% 95%);
  --gold:      hsl(43 51% 50%);
  --gold-soft: hsl(43 51% 50% / 0.16);

  --bg:        hsl(40 30% 98%);
  --surface:   hsl(0 0% 100%);
  --fg:        hsl(160 45% 12%);
  --fg-soft:   hsl(160 8% 36%);
  --line:      hsl(42 20% 87%);
  /* Borde de campos y controles: 3,7:1 sobre blanco. */
  --field:     hsl(44 9% 50%);
  --alert:     hsl(0 55% 38%);
  --alert-bg:  hsl(0 60% 97%);
  --note:      hsl(32 65% 30%);
  --note-bg:   hsl(45 85% 96%);

  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --sans:  "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 3px; }

.wrap { width: 100%; max-width: 620px; margin: 0 auto; padding: 0 1.25rem; }

/* ---------------- CABECERA ---------------- */
.site-header { background: var(--navy); color: var(--cream); }
.site-header .bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; height: 64px;
}
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; }
.brand img { height: 38px; width: auto; }
.brand .name {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700; font-size: 1.05rem; line-height: 1.1; letter-spacing: -0.01em;
}
.brand .sub {
  display: block;
  font-size: 0.56rem; font-weight: 600; letter-spacing: 0.24em;
  color: var(--gold); margin-top: 2px;
}
.btn-back {
  font-size: 0.8rem; font-weight: 500; text-decoration: none;
  color: hsl(45 31% 95% / 0.75); white-space: nowrap;
}
.btn-back:hover { color: var(--gold); }

/* ---------------- CUERPO ---------------- */
main { padding: 3rem 0 4rem; }

h1 {
  font-family: var(--serif);
  font-size: clamp(2rem, 6vw, 2.6rem);
  font-weight: 700; line-height: 1.1; margin: 0;
  text-wrap: balance;
}
.lede {
  color: var(--fg-soft); margin: 0.6rem 0 2.25rem;
  font-size: 1.02rem; max-width: 42ch;
}

/* ---------------- FORMULARIO ---------------- */
.form { display: flex; flex-direction: column; gap: 1.5rem; }

.field > label, .field > .label {
  display: block;
  font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--fg-soft); margin-bottom: 0.55rem;
}
.hint {
  font-size: 0.8rem; color: var(--fg-soft);
  margin: 0.5rem 0 0; line-height: 1.5;
}

input[type="text"], input[type="number"], select {
  width: 100%;
  font-family: inherit; font-size: 1.05rem; color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--field);
  border-radius: 8px;
  padding: 0.8rem 0.9rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus {
  outline: none; border-color: var(--navy);
  box-shadow: 0 0 0 3px var(--gold-soft);
}
input.error { border-color: var(--alert); }

#fecha { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }

select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.8rem center;
  background-size: 18px; padding-right: 2.6rem;
}

.plazo { display: grid; grid-template-columns: 6.5rem 1fr; gap: 0.6rem; }
.plazo input { text-align: center; font-variant-numeric: tabular-nums; }

.chips { display: flex; gap: 0.5rem; }
.chip {
  flex: 1;
  font-family: inherit; font-size: 0.95rem; font-weight: 500;
  color: var(--fg); background: var(--surface);
  border: 1px solid var(--field); border-radius: 8px;
  padding: 0.72rem 1rem; cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--navy); }
.chip[aria-pressed="true"] {
  background: var(--navy); border-color: var(--navy); color: var(--cream);
}

/* Enlace secundario: la foto es un atajo, no el camino principal. */
.enlace {
  display: inline-block;
  margin-top: 0.6rem; padding: 0;
  background: none; border: none;
  font-family: inherit; font-size: 0.85rem;
  color: var(--fg-soft); cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}
.enlace:hover { color: var(--fg); text-decoration-color: var(--gold); }
.enlace[disabled] { opacity: 0.5; cursor: default; text-decoration: none; }

/* ---------------- RESULTADO ---------------- */
.salida { margin-top: 2.5rem; }

.espera {
  color: var(--fg-soft); font-size: 0.95rem;
  border-top: 1px solid var(--line); padding-top: 1.5rem;
}

.veredicto { border-top: 2px solid var(--gold); padding-top: 1.5rem; }
.veredicto .k {
  font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--fg-soft);
}
.veredicto .fecha {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 6.5vw, 2.5rem);
  font-weight: 700; line-height: 1.12;
  margin-top: 0.35rem; text-wrap: balance;
}
.veredicto .restan {
  margin-top: 0.6rem; font-size: 0.9rem; color: var(--fg-soft);
}
.veredicto .restan b { color: var(--fg); font-weight: 600; }
.veredicto .restan.urgente b, .veredicto .restan.urgente { color: var(--alert); }

.gracia {
  margin-top: 1.25rem; padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}
.gracia .k {
  font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--fg-soft);
  display: block; margin-bottom: 0.2rem;
}
.gracia strong { font-weight: 600; }

.nota {
  margin-top: 1.25rem; padding: 0.85rem 1rem;
  border-radius: 8px; font-size: 0.85rem; line-height: 1.55;
  background: var(--note-bg); color: var(--note);
}
.nota.error { background: var(--alert-bg); color: var(--alert); }

.acciones { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.5rem; }
.btn {
  font-family: inherit; font-size: 0.88rem; font-weight: 600;
  border-radius: 8px; padding: 0.62rem 1rem;
  cursor: pointer; border: 1px solid var(--field);
  background: var(--surface); color: var(--fg);
  text-decoration: none; display: inline-flex; align-items: center;
  transition: all 0.15s;
}
.btn:hover { border-color: var(--navy); }
.btn:active { transform: scale(0.985); }
.btn-primary { background: var(--navy); border-color: var(--navy); color: var(--cream); }
.btn-primary:hover { background: hsl(218 45% 18%); border-color: hsl(218 45% 18%); }

/* ---------------- AJUSTES ---------------- */
.avanzado { margin-top: 2.5rem; border-top: 1px solid var(--line); }
.avanzado summary {
  cursor: pointer; list-style: none;
  padding: 1rem 0;
  font-size: 0.78rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-soft);
}
.avanzado summary::-webkit-details-marker { display: none; }
.avanzado summary::after { content: ' +'; color: var(--gold); }
.avanzado[open] summary::after { content: ' –'; }
.avanzado-cuerpo { display: flex; flex-direction: column; gap: 1.5rem; padding-bottom: 1.5rem; }

.field.toggle { display: flex; align-items: flex-start; gap: 1rem; }
.field.toggle > div { flex: 1; }
.switch {
  flex: 0 0 auto; width: 46px; height: 26px; margin-top: 2px;
  border-radius: 999px; background: var(--line); border: none;
  cursor: pointer; position: relative; transition: background 0.2s;
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: transform 0.2s;
}
.switch[aria-checked="true"] { background: var(--navy); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }

/* ---------------- CONSULTA ---------------- */
.consulta {
  margin-top: 3rem;
  background: var(--navy); color: var(--cream);
  border-radius: 10px; padding: 1.75rem;
}
.consulta h2 {
  font-family: var(--serif); font-size: 1.3rem; font-weight: 700;
  margin: 0 0 0.5rem; line-height: 1.2;
}
.consulta p {
  margin: 0 0 1.25rem; font-size: 0.92rem;
  color: hsl(45 31% 95% / 0.8); max-width: 46ch;
}
.btn-consulta {
  background: var(--gold); border-color: var(--gold); color: var(--navy);
}
.btn-consulta:hover { background: hsl(43 51% 44%); border-color: hsl(43 51% 44%); }

/* ---------------- AVISO Y PIE ---------------- */
.aviso {
  margin-top: 2.5rem;
  font-size: 0.8rem; line-height: 1.6; color: var(--fg-soft);
  border-left: 2px solid var(--line); padding-left: 1rem;
}

.site-footer {
  background: var(--navy); color: hsl(45 31% 95% / 0.7);
  font-size: 0.8rem; padding: 1.5rem 0;
}
.site-footer .wrap {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem;
  justify-content: space-between;
}
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--gold); }

/* ---------------- VARIOS ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 24px;
  transform: translateX(-50%) translateY(120%);
  background: var(--navy); color: var(--cream);
  padding: 0.7rem 1.1rem; border-radius: 8px; font-size: 0.88rem;
  transition: transform 0.25s ease, opacity 0.25s ease, visibility 0.25s;
  opacity: 0; visibility: hidden; pointer-events: none; z-index: 100;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; visibility: visible; }

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

@media print {
  .site-header, .site-footer, .acciones, .avanzado, .toast { display: none !important; }
  body { background: #fff; }
  main { padding: 0; }
}
