/* Diseño accesible: letra grande, alto contraste, botones grandes, pocas opciones. */
:root {
  --font-size: 20px;
  --bg: #ffffff;
  --surface: #f2f4f7;
  --text: #111111;
  --muted: #3d3d3d;
  --primary: #0a4fa6;
  --primary-text: #ffffff;
  --danger: #a3141c;
  --ok: #17652d;
  --focus: #ffb000;
  --border: #5b5b5b;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0d0d; --surface: #1d1f23; --text: #f5f5f5; --muted: #d0d0d0;
    --primary: #7cb7ff; --primary-text: #0d0d0d; --danger: #ff8a8f; --ok: #7ee29b; --border: #a0a0a0;
  }
}
* { box-sizing: border-box; }
html { font-size: var(--font-size); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--primary); }
:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--bg); padding: .5rem; z-index: 10; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  padding: .75rem 1rem; border-bottom: 2px solid var(--border); flex-wrap: wrap; }
.brand { font-size: 1.4rem; font-weight: 700; text-decoration: none; color: var(--text); }
.topbar-tools { display: flex; gap: .5rem; }
.tool { min-width: 3rem; min-height: 3rem; font-size: 1rem; font-weight: 700; border-radius: var(--radius);
  border: 2px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; padding: 0 .75rem; }

.mainnav { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; padding: .75rem 1rem; }
.mainnav a { display: flex; align-items: center; justify-content: center; min-height: 3.2rem; padding: .5rem;
  border: 2px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text);
  font-weight: 700; background: var(--surface); text-align: center; }
.mainnav a[aria-current="page"] { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }

main { flex: 1; width: 100%; max-width: 52rem; margin: 0 auto; padding: 1rem; }
h1 { font-size: 1.7rem; margin: .5rem 0 1rem; }
h2 { font-size: 1.3rem; margin: 1.25rem 0 .5rem; }
.hint { color: var(--muted); margin-top: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 3.2rem;
  padding: .5rem 1.25rem; font-size: 1.05rem; font-weight: 700; border-radius: var(--radius); cursor: pointer;
  border: 2px solid var(--primary); background: var(--primary); color: var(--primary-text); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-big { min-height: 5rem; font-size: 1.4rem; width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.listening { background: var(--danger); border-color: var(--danger); color: #fff; }

form.stack, .stack { display: grid; gap: .75rem; }
label { font-weight: 700; display: grid; gap: .25rem; }
input, select, textarea { font: inherit; padding: .65rem .75rem; min-height: 3rem; border: 2px solid var(--border);
  border-radius: 10px; background: var(--bg); color: var(--text); width: 100%; }
textarea { min-height: 6rem; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; }
.row > * { flex: 1 1 10rem; }

.list { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.item { display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: .75rem 1rem; border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.item .meta { color: var(--muted); font-size: .9rem; }
.item.done .title { text-decoration: line-through; color: var(--muted); }
.item-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.empty { color: var(--muted); font-style: italic; }

.tabs { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tabs button[aria-selected="true"] { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }

.chat { display: grid; gap: .5rem; margin: 1rem 0; max-height: 50vh; overflow-y: auto; }
.bubble { padding: .75rem 1rem; border-radius: var(--radius); max-width: 90%; }
.bubble.user { justify-self: end; background: var(--primary); color: var(--primary-text); }
.bubble.bot { justify-self: start; background: var(--surface); border: 2px solid var(--border); }
.bubble .actions { display: flex; gap: .5rem; margin-top: .5rem; }

.alert-banner { position: sticky; bottom: 0; background: #fff3c4; color: #111; border-top: 4px solid #b37400;
  padding: 1rem; display: grid; gap: .5rem; }
.footer { display: flex; gap: 1rem; align-items: center; justify-content: center; flex-wrap: wrap;
  padding: 1rem; border-top: 2px solid var(--border); }
dialog { border: 3px solid var(--border); border-radius: var(--radius); max-width: 34rem; width: calc(100% - 2rem);
  background: var(--bg); color: var(--text); padding: 1.25rem; }
dialog::backdrop { background: rgba(0,0,0,.6); }
.dialog-actions { display: flex; gap: .75rem; justify-content: flex-end; flex-wrap: wrap; margin-top: 1rem; }
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); background: var(--text);
  color: var(--bg); padding: .9rem 1.25rem; border-radius: var(--radius); font-weight: 700; max-width: 90%; z-index: 20; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
@media (min-width: 600px) { .mainnav { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .mainnav { grid-template-columns: repeat(6, 1fr); } }

/* ---------- Modo Básica / Registrada y paneles de cuenta ---------- */
.session-bar { display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: .5rem 1rem; background: var(--surface); border-bottom: 2px solid var(--border); font-size: .95rem; }
.session-bar .btn { min-height: 2.6rem; padding: .25rem 1rem; }
.choices { display: grid; gap: 1rem; margin-bottom: 1rem; }
.choice { display: grid; gap: .35rem; text-align: left; padding: 1.25rem 1.5rem; min-height: 6rem; cursor: pointer;
  font: inherit; color: var(--text); background: var(--surface); border: 3px solid var(--border); border-radius: var(--radius); }
.choice:hover { border-color: var(--primary); }
.choice-title { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.choice-text { color: var(--muted); }
@media (min-width: 700px) { .choices { grid-template-columns: 1fr 1fr; } }
.pin { font-size: 1.5rem; letter-spacing: .4em; max-width: 12rem; }
.pin-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.pin-row .btn { min-height: 3rem; }
label .hint { font-weight: 400; font-size: .9rem; }
.check { display: flex; gap: .75rem; align-items: center; font-weight: 700; }
.check input { width: 1.75rem; min-height: 1.75rem; height: 1.75rem; flex: none; }
details.consent { border: 2px solid var(--border); border-radius: var(--radius); padding: .5rem 1rem; background: var(--surface); }
details.consent summary { cursor: pointer; font-weight: 700; min-height: 2.5rem; display: flex; align-items: center; }
.links { margin-top: 1.25rem; }
.links a { font-size: 1.05rem; font-weight: 700; }
.notice { padding: .75rem 1rem; border-radius: var(--radius); border: 2px solid var(--border); margin: 0; }
.notice-error { border-color: var(--danger); color: var(--danger); font-weight: 700; }
.notice-info { border-color: var(--primary); }

/* El foco del área principal es para lectores de pantalla; no dibujar borde. */
main:focus, main:focus-visible { outline: none; }
.more { margin-top: .75rem; }
