/* Corrillo · sistema visual */
:root {
  --tinta: #1B1F3B;
  --tinta-2: #4A4F6E;
  --tinta-3: #8A8DA6;
  --coral: #FF5A3C;
  --coral-osc: #E2431F;
  --menta: #14A38B;
  --amarillo: #FFD447;
  --cielo: #7CC6FE;
  --rosa: #F79AC0;
  --papel: #FBF6EE;
  --papel-2: #F3ECDF;
  --blanco: #FFFFFF;
  --linea: #E4DCCD;
  --ok: #14A38B;
  --aviso: #E8A200;
  --error: #D93A2B;
  --fondo: var(--papel);
  --superficie: var(--blanco);
  --texto: var(--tinta);
  --texto-suave: var(--tinta-2);
  --sombra: 0 1px 2px rgba(27,31,59,.08), 0 8px 24px rgba(27,31,59,.08);
  --sombra-nota: 0 1px 1px rgba(27,31,59,.10), 0 4px 10px rgba(27,31,59,.12);
  --radio: 14px;
  --f-titulo: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --f-texto: 'Atkinson Hyperlegible', 'Segoe UI', system-ui, sans-serif;
  /* notas por color */
  --n-amarillo: #FFE38A; --z-amarillo: #FFF6D6;
  --n-cielo: #CBE8FF;    --z-cielo: #EAF5FF;
  --n-rosa: #FFD3E4;     --z-rosa: #FFEFF5;
  --n-menta: #BDEFE3;    --z-menta: #E6F8F3;
  --n-coral: #FFC9BC;    --z-coral: #FFEDE8;
  --n-lila: #DDD3FF;     --z-lila: #F1EDFF;
}
:root[data-theme="dark"] {
  --fondo: #12152B;
  --superficie: #1E2342;
  --texto: #F6F1E8;
  --texto-suave: #B8BAD0;
  --linea: #30365C;
  --papel-2: #252B4F;
  --z-amarillo: #2A2B3C; --z-cielo: #1F2B48; --z-rosa: #2E2440; --z-menta: #19303A; --z-coral: #33263A; --z-lila: #272645;
  --sombra: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--fondo); color: var(--texto);
  font-family: var(--f-texto); font-size: 17px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, .titulo { font-family: var(--f-titulo); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; margin: 0 0 .4em; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.2rem; font-weight: 600; }
p { margin: 0 0 1em; }
a { color: var(--coral-osc); }
:root[data-theme="dark"] a { color: #FF8A70; }
small, .suave { color: var(--texto-suave); }
.oculto { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* marca */
.marca { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; color: inherit; font-family: var(--f-titulo); font-weight: 800; font-size: 1.35rem; letter-spacing: -0.03em; }
.marca img { width: 34px; height: 34px; }

/* botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  font: 700 1rem/1 var(--f-texto); padding: .85rem 1.2rem; border-radius: 999px; border: 2px solid transparent;
  background: var(--coral); color: #fff; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .08s ease, background .15s ease, box-shadow .15s ease; box-shadow: 0 2px 0 var(--coral-osc);
}
.btn:hover { background: var(--coral-osc); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible { outline: 3px solid var(--cielo); outline-offset: 2px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.sec { background: var(--superficie); color: var(--texto); border-color: var(--linea); box-shadow: none; }
.btn.sec:hover { border-color: var(--texto-suave); }
.btn.menta { background: var(--menta); box-shadow: 0 2px 0 #0D7D6A; }
.btn.menta:hover { background: #0F8F7A; }
.btn.fantasma { background: transparent; color: var(--texto); box-shadow: none; padding: .55rem .8rem; }
.btn.fantasma:hover { background: var(--papel-2); }
.btn.peque { padding: .5rem .85rem; font-size: .9rem; }
.btn.grande { padding: 1.1rem 1.6rem; font-size: 1.15rem; }
.btn.bloque { width: 100%; }
.btn.peligro { background: transparent; color: var(--error); border-color: transparent; box-shadow: none; }
.btn.peligro:hover { background: #FDECEA; }

/* formularios */
label { display: block; font-weight: 700; margin: 0 0 .35rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], textarea, select {
  width: 100%; font: 400 1rem var(--f-texto); color: var(--texto); background: var(--superficie);
  border: 2px solid var(--linea); border-radius: 12px; padding: .8rem .9rem;
}
textarea { resize: vertical; min-height: 6rem; }
input:focus, textarea:focus, select:focus { border-color: var(--tinta); outline: none; }
.campo { margin-bottom: 1rem; }
.fila { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.fila > * { flex: 1 1 auto; }
.check { display: flex; align-items: center; gap: .6rem; font-weight: 400; cursor: pointer; }
.check input { width: 1.25rem; height: 1.25rem; accent-color: var(--coral); }
.pin-input { font: 800 2.2rem var(--f-titulo) !important; letter-spacing: .3em; text-align: center; }

/* tarjetas */
.tarjeta { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); box-shadow: var(--sombra); padding: 1.4rem; }
.chip { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; font-weight: 700; padding: .25rem .6rem; border-radius: 999px; background: var(--papel-2); color: var(--texto); }
.chip.ok { background: #D7F3EC; color: #0B6B5A; }
.chip.aviso { background: #FFF1C9; color: #7A5600; }
.chip.coral { background: #FFE3DC; color: #B13115; }
.aviso-caja { padding: .8rem 1rem; border-radius: 12px; background: #FFF1C9; color: #5E4300; margin-bottom: 1rem; }
.error-caja { padding: .8rem 1rem; border-radius: 12px; background: #FDECEA; color: #8C2116; margin-bottom: 1rem; }

/* cabecera simple */
.cabecera { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem clamp(1rem, 4vw, 2.5rem); }
.contenedor { max-width: 1080px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2.5rem) 3rem; }
.estrecho { max-width: 460px; margin: 0 auto; padding: 0 1rem 3rem; }

/* toast */
#toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: .5rem; align-items: center; pointer-events: none; }
.toast { background: var(--tinta); color: #fff; padding: .75rem 1.1rem; border-radius: 12px; box-shadow: var(--sombra); font-weight: 700; animation: entra .25s ease; max-width: 90vw; }
.toast.error { background: var(--error); }
@keyframes entra { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* modal */
.modal-fondo { position: fixed; inset: 0; background: rgba(27,31,59,.5); display: flex; align-items: center; justify-content: center; z-index: 500; padding: 1rem; }
.modal { background: var(--superficie); color: var(--texto); border-radius: 18px; box-shadow: var(--sombra); width: min(720px, 100%); max-height: 92vh; overflow: auto; padding: 1.6rem; }
.modal h2 { margin-bottom: 1rem; }
.modal-pie { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.2rem; flex-wrap: wrap; }

/* estado de conexion */
.conexion { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; color: var(--texto-suave); }
.conexion::before { content: ''; width: .55rem; height: .55rem; border-radius: 50%; background: var(--ok); }
.conexion.off::before { background: var(--error); }

/* notas (comunes) */
.nota-color-amarillo { background: var(--n-amarillo); }
.nota-color-cielo { background: var(--n-cielo); }
.nota-color-rosa { background: var(--n-rosa); }
.nota-color-menta { background: var(--n-menta); }
.nota-color-coral { background: var(--n-coral); }
.nota-color-lila { background: var(--n-lila); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.modal-peque { width: min(480px, 100%); }
.modal-peque input, .modal-peque textarea { margin-bottom: .2rem; }
.modal-peque textarea { min-height: 7rem; }
.btn.peligro-lleno { background: var(--error); box-shadow: 0 2px 0 #A82A1E; }
.btn.peligro-lleno:hover { background: #B83224; }
