/* Cuaderno punteado + agua quieta */
:root {
  --papel: #f4f6f3; --hoja: #fff; --tinta: #16242b; --suave: #56686f; --linea: #d8e0dd;
  --agua: #17607a; --agua-suave: #dceef1; --alerta: #9a4a0b; --alerta-suave: #fcefdc; --punto: #c3cfcb;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --papel: #0f181c; --hoja: #162329; --tinta: #e4eeee; --suave: #9db1b5; --linea: #29404a;
    --agua: #7ccbdc; --agua-suave: #1a3943; --alerta: #f2b871; --alerta-suave: #3a2b17; --punto: #26393f; color-scheme: dark; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.5 system-ui, "Segoe UI", sans-serif; color: var(--tinta);
  background: var(--papel) radial-gradient(var(--punto) 1px, transparent 1.2px) 0 0 / 22px 22px; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0 0 .5rem; font-weight: 600; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
a { color: var(--agua); }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { width: 100%; background: var(--hoja); border: 1px solid var(--linea); border-radius: 8px; padding: .55rem .7rem; min-height: 44px; }
textarea { resize: vertical; min-height: 90px; }
button { cursor: pointer; min-height: 40px; padding: .4rem .9rem; border-radius: 8px; border: 1px solid var(--linea); background: var(--hoja); }
button:hover { border-color: var(--agua); }
button.principal { background: var(--agua); border-color: var(--agua); color: var(--papel); font-weight: 600; }
button.liso { border: 0; background: none; color: var(--suave); padding: .3rem .5rem; }
:focus-visible { outline: 3px solid var(--agua); outline-offset: 2px; }
label { display: block; font-size: .9rem; color: var(--suave); }
label > input, label > select, label > textarea { margin-top: .2rem; color: var(--tinta); font-size: 1rem; }

.marco { display: grid; grid-template-columns: 200px minmax(0, 1fr); max-width: 1180px; margin: 0 auto; }
nav { position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto; padding: 1.2rem .6rem; }
nav .marca { font: 600 1.4rem var(--serif); padding: 0 .6rem .8rem; }
nav a { display: flex; justify-content: space-between; padding: .5rem .6rem; border-radius: 8px; text-decoration: none; color: var(--tinta); }
nav a[aria-current] { background: var(--agua-suave); font-weight: 600; }
.cuenta { font-size: .8rem; background: var(--alerta-suave); color: var(--alerta); border-radius: 99px; padding: 0 .5rem; }
main { padding: 1.2rem 1.4rem 5rem; min-width: 0; }
.captura { display: flex; gap: .5rem; margin-bottom: 1.4rem; }

.hoja { background: var(--hoja); border: 1px solid var(--linea); border-radius: 12px; padding: 1rem 1.1rem; margin-bottom: 1rem; }
.columnas { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 1rem; align-items: start; }
.fila { display: flex; gap: .6rem; align-items: center; padding: .45rem 0; border-top: 1px solid var(--linea); }
.fila:first-of-type { border-top: 0; }
.fila .crece { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.fila.hecha .crece > span:first-child { text-decoration: line-through; color: var(--suave); }
.meta { display: block; font-size: .85rem; color: var(--suave); }
.vacio { color: var(--suave); margin: .3rem 0; }
.alerta { background: var(--alerta-suave); color: var(--alerta); border-radius: 10px; padding: .7rem .9rem; margin-bottom: 1rem; }
.alerta a { color: inherit; font-weight: 600; }
.punto { width: 40px; min-width: 40px; height: 40px; padding: 0; border-radius: 50%; }
.punto[aria-pressed="true"] { background: var(--agua); border-color: var(--agua); color: var(--papel); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0 .8rem; }
.chips button[aria-pressed="true"] { background: var(--agua-suave); border-color: var(--agua); }
.acciones { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }

.rejilla { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: .25rem; text-align: center; font-size: .85rem; border-bottom: 1px solid var(--linea); }
th:first-child { text-align: left; min-width: 170px; }
td button { width: 36px; min-height: 36px; padding: 0; border-radius: 50%; }
td button[aria-pressed="true"] { background: var(--agua); border-color: var(--agua); color: var(--papel); }

progress { width: 100%; height: 10px; accent-color: var(--agua); }
.barras { display: flex; gap: 4px; align-items: flex-end; height: 120px; }
.barras div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; font-size: .75rem; color: var(--suave); }
.barras i { display: block; width: 100%; background: var(--agua); border-radius: 4px 4px 0 0; }
.tablero { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }

dialog { width: min(560px, calc(100vw - 24px)); max-height: 90vh; border: 1px solid var(--linea); border-radius: 14px; background: var(--hoja); color: var(--tinta); padding: 1.2rem; }
dialog::backdrop { background: rgb(5 20 26 / .55); }
dialog form > label { margin-bottom: .7rem; }
.texto-nota { white-space: pre-wrap; overflow-wrap: anywhere; }
.error { color: var(--alerta); font-weight: 600; }

#aviso { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); z-index: 20; }
#aviso div { display: flex; gap: .8rem; align-items: center; background: var(--tinta); color: var(--papel); border-radius: 10px; padding: .6rem 1rem; max-width: calc(100vw - 24px); }
#aviso button { background: none; color: inherit; border-color: currentColor; }

.acceso { max-width: 360px; margin: 12vh auto; }
.acceso label { margin-bottom: .8rem; }
.cargando { text-align: center; margin-top: 30vh; }

@media (max-width: 760px) {
  .marco { display: block; }
  nav { position: fixed; z-index: 10; inset: auto 0 0 0; height: auto; display: flex; overflow-x: auto; gap: .2rem; padding: .4rem .4rem calc(.4rem + env(safe-area-inset-bottom)); background: var(--hoja); border-top: 1px solid var(--linea); }
  nav .marca { display: none; }
  nav a { white-space: nowrap; gap: .3rem; font-size: .9rem; }
  main { padding: .9rem .8rem 6rem; }
  .columnas, .tablero { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: no-preference) { button { transition: background-color .15s, border-color .15s; } }
