/* ChamberDeck — formulario de nominación. Sin estilos en línea (política de contenido de nginx).
   Página blanca, tarjeta con sombra suave y logo centrado sobre una insignia navy. Temas: claro, oscuro (automático o manual),
   alto contraste y 4 tamaños de letra. Identidad: navy, dorado y rojo de la Cámara (como la bio y la Gala). */

:root {
  --bg: #ffffff; --surface: #ffffff; --text: #0d1b3e; --muted: #4a566e; --border: #7d8aa5; --soft: #e8ecf4;
  --card-border: #e3e7f0; --shadow: 0 1px 2px rgba(13, 27, 62, 0.05), 0 14px 38px rgba(13, 27, 62, 0.11);
  --primary: #0d1b3e; --on-primary: #ffffff; --accent: #c9973a; --link: #1b3f8f;
  --error: #b52424; --error-bg: #fdf0f0; --ok: #1e6b3a; --focus: #1b3f8f; --info-bg: #f3f5fa;
  --badge-bg: #0d1b3e; --badge-border: transparent; --panel-bg: #ffffff; --seg-bg: #eef1f7; --seg-on: #0d1b3e; --seg-on-t: #ffffff;
  --radius: 12px;
}
:root[data-theme="dark"] {
  --bg: #090f1d; --surface: #111a2e; --text: #eef1f7; --muted: #aab6cc; --border: #7385a6; --soft: #1b2944;
  --card-border: #1f2d4a; --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 16px 42px rgba(0, 0, 0, 0.55);
  --primary: #e4c55e; --on-primary: #0d1b3e; --accent: #e4c55e; --link: #9cc0ff;
  --error: #ff9c9c; --error-bg: #34161f; --ok: #8fe0a8; --focus: #f2c94c; --info-bg: #15213b;
  --badge-bg: #0d1b3e; --badge-border: #2a3a5e; --panel-bg: #14213b; --seg-bg: #0c1527; --seg-on: #e4c55e; --seg-on-t: #0d1b3e;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #090f1d; --surface: #111a2e; --text: #eef1f7; --muted: #aab6cc; --border: #7385a6; --soft: #1b2944;
    --card-border: #1f2d4a; --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 16px 42px rgba(0, 0, 0, 0.55);
    --primary: #e4c55e; --on-primary: #0d1b3e; --accent: #e4c55e; --link: #9cc0ff;
    --error: #ff9c9c; --error-bg: #34161f; --ok: #8fe0a8; --focus: #f2c94c; --info-bg: #15213b;
    --badge-bg: #0d1b3e; --badge-border: #2a3a5e; --panel-bg: #14213b; --seg-bg: #0c1527; --seg-on: #e4c55e; --seg-on-t: #0d1b3e;
  }
}

/* Alto contraste: negro sobre blanco (o al revés), bordes gruesos, sin sombras ni matices */
:root[data-contrast="high"] {
  --bg: #ffffff; --surface: #ffffff; --text: #000000; --muted: #000000; --border: #000000; --soft: #ffffff;
  --card-border: #000000; --shadow: none; --primary: #000000; --on-primary: #ffffff; --accent: #000000; --link: #00008b;
  --error: #8b0000; --error-bg: #ffffff; --ok: #004d1a; --focus: #000000; --info-bg: #ffffff;
  --badge-bg: #000000; --badge-border: #000000; --panel-bg: #ffffff; --seg-bg: #ffffff; --seg-on: #000000; --seg-on-t: #ffffff;
}
:root[data-contrast="high"][data-theme="dark"] {
  --bg: #000000; --surface: #000000; --text: #ffffff; --muted: #ffffff; --border: #ffffff; --soft: #000000;
  --card-border: #ffffff; --primary: #ffff00; --on-primary: #000000; --accent: #ffff00; --link: #8ec5ff;
  --error: #ff8080; --error-bg: #000000; --ok: #7dff9e; --focus: #ffff00; --info-bg: #000000;
  --badge-bg: #000000; --badge-border: #ffffff; --panel-bg: #000000; --seg-bg: #000000; --seg-on: #ffff00; --seg-on-t: #000000;
}
@media (prefers-color-scheme: dark) {
  :root[data-contrast="high"][data-theme="auto"] {
    --bg: #000000; --surface: #000000; --text: #ffffff; --muted: #ffffff; --border: #ffffff; --soft: #000000;
    --card-border: #ffffff; --primary: #ffff00; --on-primary: #000000; --accent: #ffff00; --link: #8ec5ff;
    --error: #ff8080; --error-bg: #000000; --ok: #7dff9e; --focus: #ffff00; --info-bg: #000000;
    --badge-bg: #000000; --badge-border: #ffffff; --panel-bg: #000000; --seg-bg: #000000; --seg-on: #ffff00; --seg-on-t: #000000;
  }
}

/* Tamaño de letra: todo el diseño usa rem */
html { font-size: 100%; }
html[data-font="1"] { font-size: 115%; }
html[data-font="2"] { font-size: 130%; }
html[data-font="3"] { font-size: 150%; }

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.55; font-size: 1rem; -webkit-text-size-adjust: 100%;
}
h1, h2 { line-height: 1.25; margin: 0; }
a, .link { color: var(--link); }
.sr, .hp { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }
.ico { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ico .fill, symbol .fill { fill: currentColor; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
:root[data-contrast="high"] :focus-visible { outline-width: 4px; }

.skip { position: absolute; left: 0.5rem; top: -4rem; z-index: 60; background: var(--primary); color: var(--on-primary); padding: 0.6rem 1rem; border-radius: 8px; }
.skip:focus { top: 0.5rem; }

/* Barra flotante: idioma y tema siempre a la vista; el ícono de accesibilidad despliega el panel con el resto */
.tools-bar { position: fixed; top: 0.9rem; right: 0.9rem; z-index: 50; }
.pill { display: flex; align-items: center; gap: 0.15rem; padding: 0.22rem; background: var(--surface); border: 1px solid var(--card-border); border-radius: 999px; box-shadow: var(--shadow); }
:root[data-contrast="high"] .pill { border: 2px solid var(--border); }
.qlang { display: flex; gap: 0.1rem; padding-right: 0.3rem; margin-right: 0.15rem; border-right: 1px solid var(--soft); }
.qlang button { min-width: 2.6rem; min-height: 2.75rem; padding: 0 0.5rem; font: inherit; font-size: 0.85rem; font-weight: 700; letter-spacing: 0.03em; color: var(--muted); background: transparent; border: 0; border-radius: 999px; cursor: pointer; }
.qlang button:hover { background: var(--soft); }
.qlang button[aria-pressed="true"] { background: var(--seg-on); color: var(--seg-on-t); }
.qbtn { width: 2.75rem; height: 2.75rem; display: grid; place-items: center; color: var(--text); background: transparent; border: 0; border-radius: 50%; cursor: pointer; }
.qbtn:hover { background: var(--soft); }
.qbtn[aria-expanded="true"] { background: var(--primary); color: var(--on-primary); }
.a11y-panel {
  position: absolute; top: 3.8rem; right: 0; width: min(21rem, calc(100vw - 1.8rem)); padding: 1rem 1.1rem 1.1rem;
  background: var(--panel-bg); border: 1px solid var(--card-border); border-radius: 16px; box-shadow: var(--shadow);
}
:root[data-contrast="high"] .a11y-panel { border: 2px solid var(--border); }
.a11y-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 0.4rem; }
.a11y-title { margin: 0; font-weight: 700; }
.a11y-x { width: 2.75rem; height: 2.75rem; display: grid; place-items: center; background: transparent; color: var(--text); border: 0; border-radius: 50%; cursor: pointer; margin: -0.4rem -0.5rem 0 0; }
.ctl { padding: 0.7rem 0; border-top: 1px solid var(--soft); display: flex; flex-direction: column; gap: 0.5rem; }
.ctl-l { font-size: 0.9rem; font-weight: 600; color: var(--muted); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.25rem; padding: 0.25rem; background: var(--seg-bg); border-radius: 12px; border: 1px solid var(--soft); }
.seg.two { grid-template-columns: repeat(2, 1fr); }
.seg button {
  min-height: 2.75rem; display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; padding: 0.3rem 0.5rem;
  font: inherit; font-size: 0.9rem; font-weight: 600; color: var(--text); background: transparent; border: 0; border-radius: 9px; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--seg-on); color: var(--seg-on-t); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); }
.stepper { display: grid; grid-template-columns: 1fr auto 1fr; gap: 0.5rem; align-items: center; }
.stepper button {
  min-height: 2.75rem; font: inherit; font-weight: 700; color: var(--text); background: var(--seg-bg); border: 1px solid var(--soft); border-radius: 10px; cursor: pointer;
}
.stepper button:disabled { opacity: 0.4; cursor: not-allowed; }
.step-val { min-width: 3.4rem; text-align: center; font-weight: 700; }
.switch { position: relative; width: 3.4rem; height: 2rem; padding: 0; background: var(--seg-bg); border: 2px solid var(--border); border-radius: 999px; cursor: pointer; }
.switch .knob { position: absolute; top: 2px; left: 2px; width: 1.4rem; height: 1.4rem; background: var(--muted); border-radius: 50%; transition: transform 0.18s ease, background 0.18s ease; }
.switch[aria-checked="true"] { background: var(--primary); border-color: var(--primary); }
.switch[aria-checked="true"] .knob { transform: translateX(1.4rem); background: var(--on-primary); }
@media (prefers-reduced-motion: reduce) { .switch .knob { transition: none; } }

/* Página */
.page { min-height: 100vh; }
.page:focus { outline: none; }
.shell { max-width: 46rem; margin: 0 auto; padding: 2.2rem 1rem 3rem; }

/* Logo centrado sobre una insignia navy que se monta en el borde de la tarjeta */
.logo-badge {
  position: relative; z-index: 2; width: min(16rem, 72%); margin: 0 auto -2.9rem; padding: 0.75rem 1.2rem;
  background: var(--badge-bg); border: 1px solid var(--badge-border); border-radius: 20px; box-shadow: 0 10px 26px rgba(13, 27, 62, 0.28);
}
.logo { width: 100%; height: auto; display: block; }

/* Tarjeta */
.card {
  background: var(--surface); border: 1px solid var(--card-border); border-radius: 22px; box-shadow: var(--shadow);
  padding: 4.3rem 2.4rem 2.2rem; min-width: 0;
}
.title { display: flex; flex-direction: column; gap: 0.35rem; text-align: center; font-size: 1.25rem; letter-spacing: 0.02em; }
.title-sub { font-size: 0.98rem; font-weight: 600; color: var(--muted); }
.lead { text-align: center; margin: 1.1rem auto 1.6rem; max-width: 36rem; color: var(--muted); }
.req-note { color: var(--muted); margin: 0 0 1.4rem; font-size: 0.9rem; }

.notice { border-radius: var(--radius); padding: 0.9rem 1.1rem; margin: 0 0 1.4rem; }
.error-box { background: var(--error-bg); color: var(--error); border: 2px solid var(--error); }
.error-box ul { margin: 0.4rem 0 0; padding-left: 1.3rem; }
.error-box a { color: inherit; font-weight: 700; }

/* Secciones (dentro de la misma tarjeta, separadas por una línea) */
.sec { position: relative; border: 0; padding: 0; margin: 0 0 2rem; min-width: 0; }
.sec::before { content: ""; display: block; height: 1px; background: var(--soft); margin: 0 0 1.6rem; }
:root[data-contrast="high"] .sec::before { background: var(--border); }
.sec legend { float: left; width: 100%; padding: 0; margin: 0 0 1.2rem; font-weight: 700; font-size: 1.1rem; }
.sec legend::after { content: ""; display: block; width: 2.6rem; height: 3px; margin-top: 0.45rem; background: var(--accent); border-radius: 3px; }
.sec legend + * { clear: both; }
.sec.last { margin-bottom: 0; }

/* Campos */
.field { margin: 0 0 1.25rem; position: relative; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.1rem; }
.grid3 { display: grid; grid-template-columns: 1.6fr 1.6fr 1fr; gap: 0 1.1rem; }
label, .lab { display: block; font-weight: 600; margin: 0 0 0.4rem; }
.star { color: var(--error); font-weight: 700; }
input[type="text"], input[type="email"], input[type="tel"], input[type="url"], select, textarea {
  width: 100%; min-height: 3rem; padding: 0.65rem 0.85rem; font: inherit; color: var(--text); background: var(--surface);
  border: 1.5px solid var(--border); border-radius: 10px; transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:hover, select:hover, textarea:hover { border-color: var(--text); }
textarea { resize: vertical; min-height: 7rem; line-height: 1.5; }
input::placeholder { color: var(--muted); opacity: 0.8; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--error); box-shadow: inset 4px 0 0 var(--error); }
.autofilled { background: var(--info-bg); border-color: var(--accent); }
.hint, .count { margin: 0.35rem 0 0; font-size: 0.88rem; color: var(--muted); }
.count { text-align: right; }
.count.left { text-align: left; font-weight: 600; }
.err { margin: 0.4rem 0 0; color: var(--error); font-weight: 600; font-size: 0.94rem; }
.err::before { content: "⚠ "; }
.found { margin: 0.7rem 0 0; padding: 0.65rem 0.9rem; background: var(--info-bg); border-left: 4px solid var(--accent); border-radius: 8px; font-size: 0.95rem; }
.link { background: none; border: 0; padding: 0.4rem 0.2rem; font: inherit; text-decoration: underline; cursor: pointer; }
.field.check { display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 0.75rem; align-items: start; }
.field.check input { width: 1.6rem; height: 1.6rem; margin: 0.12rem 0 0; accent-color: var(--primary); }
.field.check label { font-weight: 500; margin: 0; }
.field.check .err { grid-column: 2; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 3rem; padding: 0.6rem 1.4rem; font: inherit; font-weight: 700;
  color: var(--on-primary); background: var(--primary); border: 2px solid var(--primary); border-radius: 10px; cursor: pointer; text-align: center; margin: 0;
  box-shadow: 0 1px 2px rgba(13, 27, 62, 0.18); transition: filter 0.15s ease, transform 0.15s ease;
}
.btn.secondary { color: var(--text); background: transparent; border-color: var(--border); box-shadow: none; }
.btn.big { min-width: 15rem; font-size: 1.08rem; }
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.6; cursor: progress; }
.actions { margin: 0.4rem 0 0; display: flex; flex-direction: column; gap: 0.7rem; align-items: flex-start; }
.actions.center { align-items: center; }
@media (prefers-reduced-motion: reduce) { .btn, input, select, textarea { transition: none; } }

/* Archivos */
.file-in { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.file-in:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.drop { display: flex; flex-wrap: wrap; align-items: center; gap: 0.7rem 1rem; padding: 1rem; border: 2px dashed var(--border); border-radius: 14px; background: var(--info-bg); }
.drop.over { border-style: solid; border-color: var(--accent); }
.drop-t { color: var(--muted); font-size: 0.95rem; }
.infobox { background: var(--info-bg); border: 1px solid var(--soft); border-left: 4px solid var(--accent); border-radius: 10px; padding: 0.9rem 1.1rem; margin: 0 0 1.3rem; }
.infobox p { margin: 0.4rem 0; }
.formato { margin: 0.7rem 0 !important; }
.doc-link { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 700; padding: 0.55rem 0.9rem; border: 1.5px solid var(--link); border-radius: 10px; text-decoration: none; min-height: 2.75rem; }
.doc-link:hover { background: var(--surface); }
.prev-one { display: flex; align-items: center; gap: 0.8rem; margin-top: 0.8rem; }
.thumb { width: 4.6rem; height: 4.6rem; object-fit: cover; border-radius: 10px; border: 1.5px solid var(--border); background: #fff; flex: none; }
.sig-list { list-style: none; margin: 0.8rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.7rem; }
.sig-item { display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem; border: 1px solid var(--soft); border-radius: 12px; background: var(--surface); }
:root[data-contrast="high"] .sig-item { border: 2px solid var(--border); }
.sig-item.bad { border-color: var(--error); }
.sig-meta { flex: 1; min-width: 0; font-size: 0.9rem; }
.sig-meta strong, .sig-meta span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sig-meta .err { white-space: normal; margin: 0.15rem 0 0; font-size: 0.85rem; }
.rm { min-height: 2.75rem; min-width: 2.75rem; border: 1px solid var(--border); background: transparent; color: var(--text); border-radius: 10px; font: inherit; cursor: pointer; }

/* Progreso */
.progress { margin: 0.5rem 0 1rem; }
.bar { height: 0.9rem; border: 1.5px solid var(--border); border-radius: 999px; overflow: hidden; background: var(--surface); }
.bar-in { height: 100%; width: 0; background: var(--primary); }

/* Pantalla de carga: logo palpitando (solo si la consulta tarda) */
.busy { position: absolute; inset: 0; z-index: 5; display: flex; align-items: flex-start; justify-content: center; padding-top: 5rem; background: rgba(9, 15, 29, 0.28); border-radius: var(--radius); pointer-events: none; }
.busy-card { background: #0d1b3e; color: #fff; border-radius: 16px; padding: 1rem 1.7rem; text-align: center; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35); border: 2px solid var(--accent); }
.busy-card p { margin: 0.4rem 0 0; font-weight: 600; }
.pulse { width: 7.5rem; height: auto; display: block; margin: 0 auto; animation: latido 1.1s ease-in-out infinite; }
@keyframes latido { 0%, 100% { transform: scale(1); opacity: 0.8; } 50% { transform: scale(1.09); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; opacity: 1; } * { scroll-behavior: auto !important; } }

/* Final */
.done { text-align: center; padding: 1rem 0 0.5rem; }
.done:focus { outline: none; }
.done h2 { color: var(--ok); font-size: 1.5rem; }
.radicado { font-size: 2rem; font-weight: 800; letter-spacing: 0.08em; margin: 0.3rem 0 1rem; }
.foot { text-align: center; color: var(--muted); margin-top: 1.8rem; font-size: 0.88rem; }

/* Celular y zoom alto: una columna, sin desbordes, objetivos táctiles grandes */
@media (max-width: 40rem) {
  .shell { padding: 4.3rem 0.7rem 2rem; }
  .logo-badge { width: min(13rem, 66%); margin-bottom: -2.4rem; padding: 0.6rem 1rem; border-radius: 18px; }
  .card { padding: 3.5rem 1.05rem 1.5rem; border-radius: 18px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .title { font-size: 1.12rem; }
  .btn.big { width: 100%; min-width: 0; }
  .actions { align-items: stretch; }
  .drop { flex-direction: column; align-items: stretch; text-align: center; }
  .drop .btn { width: 100%; }
  .sig-list { grid-template-columns: 1fr; }
  .tools-bar { top: 0.6rem; right: 0.6rem; }
  .busy { padding-top: 4.5rem; }
}
@media print {
  .tools-bar, .skip, .actions, #form, .busy, .logo-badge { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border: 0; padding-top: 1rem; }
}
