/* Gestión del Taller — estilos. Minimalista, mobile-first, claro/oscuro. */
:root {
  --primary: #1B4D3E;
  --accent: #C9A227;
  --bg: #F7F5EE;
  --card: #FFFFFF;
  --line: #E4DFD0;
  --line-soft: #EEEADF;
  --ink: #1A1F1C;
  --muted: #5B635E;
  --gold-text: #7A5F10;
  --chip: #ECE8DB;
  --ok-bg: #E3EEE8; --ok: #1B4D3E;
  --warn-bg: #F6E7D2; --warn: #8A4B08;
  --danger: #8E2A1C;
  --on-primary: #F7F5EE;
  --on-primary-muted: #E8E2CC;
  --title-on-primary: var(--accent);
  --paper: #FBF7EA; --paper-line: #DCD2B4; --paper-ink: #2A2A22;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F2A22; --card: #163A30; --line: #24493E; --line-soft: #1E4237; --ink: #EDEAE0; --muted: #A9B5AE;
    --gold-text: var(--accent); --chip: #0B211B; --ok-bg: #1E4A3C; --ok: #CFE6DA; --warn-bg: #4A3516; --warn: #F2C98A;
    --danger: #F0A396; --paper: #1B342C; --paper-line: #355A4D; --paper-ink: #EDEAE0; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F2A22; --card: #163A30; --line: #24493E; --line-soft: #1E4237; --ink: #EDEAE0; --muted: #A9B5AE;
  --gold-text: var(--accent); --chip: #0B211B; --ok-bg: #1E4A3C; --ok: #CFE6DA; --warn-bg: #4A3516; --warn: #F2C98A;
  --danger: #F0A396; --paper: #1B342C; --paper-line: #355A4D; --paper-ink: #EDEAE0; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); }
:root[data-theme="dark"] a, .dark-link a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; line-height: 1.15; }
h1 { font-size: 30px; color: var(--primary); }
h2 { font-size: 22px; color: var(--primary); }
h3 { font-size: 18px; }
:root[data-theme="dark"] h1, :root[data-theme="dark"] h2 { color: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) h1, :root:not([data-theme="light"]) h2 { color: var(--accent); } :root:not([data-theme="light"]) a { color: var(--accent); } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Estructura ---------- */
.app { min-height: 100dvh; display: flex; }
.side { display: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 5; }
.top .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top .lname { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .title { font-family: var(--serif); font-size: 26px; font-weight: 600; color: var(--primary); line-height: 1.1; }
:root[data-theme="dark"] .top .title { color: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .top .title { color: var(--accent); } }
.grado-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--accent); background: transparent; color: var(--primary); font: 700 18px var(--serif); cursor: pointer; flex-shrink: 0; text-decoration: none; display: flex; align-items: center; justify-content: center; }
:root[data-theme="dark"] .grado-btn { color: var(--accent); }
.content { flex: 1; padding: 18px 20px 96px; display: flex; flex-direction: column; gap: 16px; width: 100%; max-width: 980px; margin: 0 auto; }
.bottom { position: fixed; left: 0; right: 0; bottom: 0; height: calc(66px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); display: flex; background: var(--card); border-top: 1px solid var(--line); z-index: 10; }
.bottom a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 500; border-top: 2px solid transparent; }
.bottom a.on { color: var(--primary); font-weight: 600; border-top-color: var(--accent); }
:root[data-theme="dark"] .bottom a.on { color: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bottom a.on { color: var(--accent); } }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

@media (min-width: 900px) {
  .side { display: flex; flex-direction: column; gap: 18px; width: 240px; flex-shrink: 0; background: var(--primary); color: var(--on-primary); padding: 24px 14px; position: sticky; top: 0; height: 100dvh; }
  :root[data-theme="dark"] .side { background: #0B211B; border-right: 1px solid var(--line); }
  .side .brand { display: flex; gap: 10px; align-items: center; padding: 0 8px; }
  .side .brand b { font: 600 19px var(--serif); color: var(--accent); display: block; line-height: 1.1; }
  .side .brand small { color: var(--on-primary-muted); font-size: 12px; }
  .side nav { display: flex; flex-direction: column; gap: 2px; }
  .side nav a { min-height: 42px; display: flex; align-items: center; gap: 10px; padding: 0 12px; border-radius: 8px; color: var(--on-primary-muted); text-decoration: none; font-size: 14px; }
  .side nav a.on { background: rgba(255,255,255,.1); color: var(--on-primary); font-weight: 600; box-shadow: inset 2px 0 0 var(--accent); }
  .side .foot { margin-top: auto; font-size: 12px; color: var(--on-primary-muted); padding: 0 8px; }
  .bottom { display: none; }
  .top .brandmark { display: none; }
  .content { padding: 28px 32px 48px; }
}

/* ---------- Componentes ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.card.pad0 { padding: 6px 16px; }
.card.hero { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
:root[data-theme="dark"] .card.hero { background: var(--card); border-color: #2B5547; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .card.hero { background: var(--card); border-color: #2B5547; } }
.hero .label { color: var(--on-primary-muted); }
.hero .big { color: var(--title-on-primary); }
.label { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-text); }
.big { font: 600 26px/1.1 var(--serif); color: var(--primary); }
.huge { font: 600 38px/1 var(--serif); }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 6px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.gridauto { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.list > .item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line-soft); }
.list > .item:first-child { border-top: none; }
.item .t { display: flex; flex-direction: column; min-width: 0; }
.item .t b { font-weight: 500; }
.item > .row > b, .item > b { white-space: nowrap; }
.tile { aspect-ratio: 1; background: var(--card); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-decoration: none; color: var(--ink) !important; font-size: 12px; font-weight: 500; }
.tile .ico { stroke: var(--accent); width: 24px; height: 24px; stroke-width: 1.5; }
.link-card { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink) !important; min-height: 44px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.badge { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.neutral { background: var(--chip); color: var(--muted); }
.gcircle { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--accent); display: inline-flex; align-items: center; justify-content: center; font: 700 16px var(--serif); color: var(--primary); flex-shrink: 0; }
:root[data-theme="dark"] .gcircle { color: var(--accent); }

.btn { min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--primary); font-size: 13px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
:root[data-theme="dark"] .btn { color: var(--ink); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 600; }
:root[data-theme="dark"] .btn.primary { background: var(--accent); border-color: var(--accent); color: #0F2A22; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { background: var(--accent); border-color: var(--accent); color: #0F2A22; } :root:not([data-theme="light"]) .btn { color: var(--ink); } }
.btn.gold { background: var(--accent); border-color: var(--accent); color: #0F2A22; font-weight: 600; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 12px; }
.hero .btn.outline { background: transparent; border-color: var(--accent); color: var(--on-primary); }

.seg { display: flex; gap: 4px; padding: 4px; background: var(--chip); border-radius: 12px; }
.seg button, .seg a { flex: 1; min-height: 40px; border: none; border-radius: 9px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none; display: flex; align-items: center; justify-content: center; }
.seg .on { background: var(--card); color: var(--primary); font-weight: 600; box-shadow: 0 1px 2px rgba(15,42,34,.12); }
:root[data-theme="dark"] .seg .on { color: var(--accent); }
.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a, .tabs button { min-height: 44px; padding: 0 2px; border: none; background: none; color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none; display: flex; align-items: center; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs .on { color: var(--primary); font-weight: 600; border-bottom-color: var(--accent); }
:root[data-theme="dark"] .tabs .on { color: var(--accent); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.chip { flex-shrink: 0; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--primary); font-size: 13px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; text-decoration: none; }
.chip.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 600; }
:root[data-theme="dark"] .chip { color: var(--ink); }
:root[data-theme="dark"] .chip.on { background: var(--accent); border-color: var(--accent); color: #0F2A22; }

label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
input.i, select.i, textarea.i { min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-size: 14px; color: var(--ink); width: 100%; }
textarea.i { padding: 10px 12px; line-height: 1.5; resize: vertical; }
input.i:focus, select.i:focus, textarea.i:focus, .btn:focus-visible, a:focus-visible, .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; color: var(--ink); }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.note { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.note .ico { width: 14px; height: 14px; stroke: var(--gold-text); }
.bar { height: 4px; background: var(--chip); border-radius: 2px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.bar.green > i { background: var(--primary); }
.empty { text-align: center; color: var(--muted); padding: 24px 8px; font-size: 14px; }
.error { color: var(--danger); font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 50; max-width: 90vw; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
@media (min-width: 900px) { .toast { bottom: 24px; } }
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 760px; }
table.t th { text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 8px; font-weight: 600; }
table.t td { padding: 10px 8px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
table.t td.c, table.t th.c { text-align: center; }
dialog { border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--ink); padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 40px); }
dialog::backdrop { background: rgba(10, 20, 16, .55); }
dialog .dhead { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); }
dialog .dbody { padding: 18px; display: flex; flex-direction: column; gap: 12px; }

/* Login */
.auth { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth .box { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.auth .mark { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; margin-bottom: 8px; }

/* Libro de actas */
.libro { background: var(--paper); border: 1px solid var(--paper-line); border-radius: 4px 10px 10px 4px; box-shadow: inset 6px 0 0 rgba(160,140,90,.18), 0 8px 20px rgba(15,42,34,.08); padding: 24px 22px 22px 28px; font-family: var(--serif); color: var(--paper-ink); display: flex; flex-direction: column; gap: 12px; }
.libro .hdr { display: flex; justify-content: space-between; font: 11px var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--gold-text); }
.libro .tit { text-align: center; border-bottom: 1px solid var(--paper-line); padding-bottom: 8px; }
.libro .tit b { display: block; font-size: 24px; color: var(--primary); }
:root[data-theme="dark"] .libro .tit b { color: var(--accent); }
.libro .txt { font-size: 17px; line-height: 1.6; text-align: justify; white-space: pre-line; }
.firmas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 12px; }
.firmas div { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.firmas .f1 { font-style: italic; font-size: 18px; min-height: 26px; color: var(--primary); }
:root[data-theme="dark"] .firmas .f1 { color: var(--accent); }
.firmas .ln { width: 100%; border-top: 1px solid var(--muted); }
.firmas small { font: 11px var(--sans); color: var(--muted); }

/* Urna */
.bolas { display: flex; gap: 36px; justify-content: center; padding: 8px 0; }
.bola-btn { display: flex; flex-direction: column; align-items: center; gap: 10px; border: none; background: transparent; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--ink); padding: 0; }
.bola { display: block; width: 104px; height: 104px; border-radius: 50%; transition: box-shadow .15s; }
.bola.blanca { background: radial-gradient(circle at 35% 30%, #fff, #E2DDCD); border: 1px solid #CFC8B4; box-shadow: 0 6px 14px rgba(15,42,34,.12); }
.bola.negra { background: radial-gradient(circle at 35% 30%, #4B4B4B, #0B0B0B); border: 1px solid #0B0B0B; box-shadow: 0 6px 14px rgba(15,42,34,.22); }
.bola-btn[aria-checked="true"] .bola { box-shadow: 0 0 0 4px var(--bg), 0 0 0 6px var(--accent); }
.escrutinio { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
.escrutinio span { display: block; aspect-ratio: 1; border-radius: 50%; animation: caer .55s ease-out both; }
.escrutinio .b { background: radial-gradient(circle at 35% 30%, #fff, #DCD6C3); }
.escrutinio .n { background: radial-gradient(circle at 35% 30%, #4B4B4B, #0B0B0B); box-shadow: 0 0 0 1px var(--accent); }
@keyframes caer { 0% { transform: translateY(-90px); opacity: 0 } 70% { transform: translateY(4px); opacity: 1 } 100% { transform: none; opacity: 1 } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Chat */
.chat { display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; flex-direction: column; gap: 3px; max-width: 82%; align-self: flex-start; align-items: flex-start; }
.msg.mio { align-self: flex-end; align-items: flex-end; }
.msg .a { font-size: 12px; font-weight: 600; color: var(--gold-text); }
.msg .b { padding: 10px 14px; border-radius: 16px 16px 16px 4px; background: var(--card); border: 1px solid var(--line); font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.msg.mio .b { border-radius: 16px 16px 4px 16px; background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.msg .h { font-size: 11px; color: var(--muted); }
.composer { position: sticky; bottom: 66px; display: flex; gap: 8px; padding: 10px 0; background: var(--bg); }
@media (min-width: 900px) { .composer { bottom: 0; } }
.composer input { border-radius: 22px; }
.send { width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--primary); color: var(--accent); display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }

/* Recibo e impresión */
.recibo { max-width: 640px; margin: 0 auto; }
@media print {
  .side, .bottom, .top, .noprint { display: none !important; }
  body { background: #fff; color: #000; }
  .content { padding: 0; }
  .card { border-color: #999; }
}
