@font-face { font-family: 'Nunito'; font-weight: 400; font-display: swap; src: url('fonts/nunito-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 700; font-display: swap; src: url('fonts/nunito-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 800; font-display: swap; src: url('fonts/nunito-latin-800-normal.woff2') format('woff2'); }
:root {
  --navy: #1b365d; --navy-2: #24467a; --red: #d0101b; --bg: #f2f4f8; --card: #fff; --text: #172033; --text-2: #5b6576; --text-3: #8a93a3; --border: #e3e7ee;
  --ok: #15803d; --ok-bg: #e7f6ec; --warn: #b45309; --warn-bg: #fff4e0; --bad: #b91c1c; --bad-bg: #fdecec; --info: #1d4ed8; --info-bg: #e8effd;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
.cargando { padding: 40vh 20px; text-align: center; color: var(--text-3); }

/* Cabecera y navegación */
.cab { background: var(--navy); color: #fff; padding: calc(14px + var(--safe-t)) 18px 16px; position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; }
.cab h1 { margin: 0; font-size: 19px; font-weight: 800; flex: 1; }
.cab small { display: block; font-size: 12px; opacity: .75; font-weight: 400; }
.cab .avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--red); display: grid; place-items: center; font-weight: 800; font-size: 14px; border: 2px solid rgba(255,255,255,.35); }
.cab button.atras { background: none; border: 0; color: #fff; font-size: 24px; padding: 0 6px 0 0; }
main { padding: 16px 14px calc(96px + var(--safe-b)); max-width: 640px; margin: 0 auto; }
nav.barra { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--border); display: flex; padding: 6px 4px calc(6px + var(--safe-b)); z-index: 10; box-shadow: 0 -4px 16px rgba(15,30,60,.06); }
nav.barra button { flex: 1; background: none; border: 0; padding: 4px 2px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11.5px; color: var(--text-3); font-weight: 700; position: relative; }
nav.barra button .ic { font-size: 22px; line-height: 1; filter: grayscale(1); opacity: .7; }
nav.barra button.on { color: var(--navy); } nav.barra button.on .ic { filter: none; opacity: 1; }
nav.barra .pto { position: absolute; top: 0; right: calc(50% - 20px); background: var(--red); color: #fff; border-radius: 99px; font-size: 10.5px; min-width: 17px; height: 17px; padding: 0 4px; display: grid; place-items: center; }

/* Tarjetas */
.card { background: var(--card); border-radius: 16px; padding: 16px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(15,30,60,.05), 0 4px 14px rgba(15,30,60,.04); }
.card h2 { margin: 0 0 10px; font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--navy); font-weight: 800; }
.hola { font-size: 22px; font-weight: 800; margin: 2px 0 14px; color: var(--navy); }
.saldos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.saldo { background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; border-radius: 16px; padding: 14px; }
.saldo.ap { background: linear-gradient(135deg, #5b3fa8, #7a5cc7); }
.saldo .n { font-size: 34px; font-weight: 800; line-height: 1.1; }
.saldo .l { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; opacity: .85; font-weight: 700; }
.saldo .s { font-size: 12.5px; opacity: .8; margin-top: 4px; }
.acciones { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.accion { background: #fff; border: 0; border-radius: 16px; padding: 16px 12px; text-align: left; box-shadow: 0 1px 2px rgba(15,30,60,.05), 0 4px 14px rgba(15,30,60,.04); }
.accion .ic { font-size: 26px; display: block; margin-bottom: 6px; } .accion b { display: block; font-size: 15px; } .accion small { color: var(--text-3); font-size: 12.5px; }
.aviso { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 14px; margin-bottom: 10px; font-size: 14.5px; border: 0; width: 100%; text-align: left; }
.aviso.warn { background: var(--warn-bg); color: var(--warn); } .aviso.info { background: var(--info-bg); color: var(--info); } .aviso.bad { background: var(--bad-bg); color: var(--bad); } .aviso.ok { background: var(--ok-bg); color: var(--ok); }
.aviso .ic { font-size: 20px; } .aviso .f { margin-left: auto; font-size: 18px; opacity: .6; }
.lista > div, .item { padding: 11px 0; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: center; }
.lista > div:last-child, .item:last-child { border-bottom: 0; }
.muted { color: var(--text-3); } .small { font-size: 13px; }
.vacio { color: var(--text-3); text-align: center; padding: 20px 0; font-size: 14.5px; }

/* Formularios */
label.campo { display: block; margin-bottom: 14px; }
label.campo > span { display: block; font-size: 13px; font-weight: 700; color: var(--text-2); margin-bottom: 5px; }
input, select, textarea { width: 100%; border: 1.5px solid var(--border); border-radius: 12px; padding: 12px 13px; background: #fff; font-size: 16px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--navy); }
textarea { min-height: 84px; resize: vertical; }
.fila2 { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; }
.fila2 > * { min-width: 0; }
input[type=date] { min-width: 0; -webkit-appearance: none; appearance: none; min-height: 48px; }
.btn { display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 0; border-radius: 12px; padding: 13px 18px; font-weight: 800; font-size: 16px; background: #e9edf3; color: var(--navy); }
.btn.pri { background: var(--red); color: #fff; } .btn.nav { background: var(--navy); color: #fff; } .btn.ok { background: var(--ok); color: #fff; } .btn.mal { background: #fff; color: var(--bad); border: 1.5px solid #f3b4b4; }
.btn.blq { width: 100%; } .btn:disabled { opacity: .55; }
.btn.peq { padding: 8px 12px; font-size: 14px; border-radius: 10px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { border: 1.5px solid var(--border); background: #fff; border-radius: 999px; padding: 9px 14px; font-weight: 700; font-size: 14.5px; }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.calc { background: var(--info-bg); color: var(--info); border-radius: 12px; padding: 11px 13px; font-size: 14.5px; margin-bottom: 14px; }
.calc.warn { background: var(--warn-bg); color: var(--warn); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; margin-bottom: 14px; } .check input { width: 22px; height: 22px; flex: none; margin: 0; }
.archivos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.archivos span { background: #eef2f7; border-radius: 8px; padding: 5px 9px; font-size: 13px; }
.subir { display: flex; align-items: center; justify-content: center; gap: 8px; border: 2px dashed var(--border); border-radius: 14px; padding: 18px; color: var(--navy); font-weight: 700; background: #fafbfd; }

/* Estados */
.tag { display: inline-block; border-radius: 999px; padding: 3px 10px; font-size: 12.5px; font-weight: 800; white-space: nowrap; }
.tag.ok { background: var(--ok-bg); color: var(--ok); } .tag.warn { background: var(--warn-bg); color: var(--warn); } .tag.bad { background: var(--bad-bg); color: var(--bad); } .tag.info { background: var(--info-bg); color: var(--info); } .tag.gris { background: #eef0f3; color: var(--text-2); }
.sol { border-left: 5px solid var(--border); }
.sol.V { border-left-color: #22a35a; } .sol.AP { border-left-color: #7a5cc7; } .sol.PR { border-left-color: #3b82f6; } .sol.IT { border-left-color: #dc2626; }
.sol .tit { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.sol .tit b { font-size: 16px; }
.pasos { display: flex; gap: 4px; margin: 12px 0 6px; }
.pasos div { flex: 1; text-align: center; font-size: 11px; color: var(--text-3); }
.pasos div i { display: block; height: 5px; border-radius: 3px; background: #e3e7ee; margin-bottom: 4px; }
.pasos div.hecho i { background: var(--ok); } .pasos div.hecho { color: var(--ok); font-weight: 700; }
.pasos div.mal i { background: var(--bad); } .pasos div.mal { color: var(--bad); font-weight: 700; }
.pasos div.ahora i { background: var(--warn); } .pasos div.ahora { color: var(--warn); font-weight: 700; }
.nota { background: #f6f7fa; border-radius: 10px; padding: 8px 10px; font-size: 13.5px; margin-top: 8px; }

/* Calendario */
.mesbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.mesbar b { font-size: 18px; color: var(--navy); }
.mesbar button { background: #fff; border: 1.5px solid var(--border); border-radius: 12px; width: 44px; height: 40px; font-size: 18px; color: var(--navy); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .ds { text-align: center; font-size: 12px; font-weight: 800; color: var(--text-3); padding: 2px 0 4px; }
.cal .d { aspect-ratio: 1 / 1.05; border-radius: 10px; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; position: relative; border: 1.5px solid transparent; }
.cal .d small { font-size: 10px; font-weight: 800; line-height: 1; margin-top: 2px; }
.cal .d.vacio { background: transparent; }
.cal .d.hoy { border-color: var(--navy); }
.cal .d.t-WE { background: #eceff3; color: #9aa3af; } .cal .d.t-FE { background: #d6dee9; color: var(--navy); }
.cal .d.t-V { background: #86efac; color: #0f5130; } .cal .d.t-IT { background: #fca5a5; color: #7f1111; } .cal .d.t-AP { background: #c4b5fd; color: #3b1e8a; }
.cal .d.t-PR { background: #93c5fd; color: #0c3b78; } .cal .d.t-AU { background: #dc2626; color: #fff; } .cal .d.t-Hx, .cal .d.t-FS { background: #fde68a; color: #6b4e00; }
.cal .d.t-null { background: transparent; color: #c7ccd4; }
.cal .d.pend { background-image: repeating-linear-gradient(45deg, transparent, transparent 4px, rgba(180,83,9,.18) 4px, rgba(180,83,9,.18) 8px); border-color: #f5c27a; }
.leyenda { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12.5px; color: var(--text-2); margin-top: 12px; }
.leyenda i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; margin-right: 4px; vertical-align: -1px; }
table.t { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.t td { padding: 7px 0; border-bottom: 1px solid var(--border); } table.t td:last-child { text-align: right; font-weight: 800; }
table.t tr:last-child td { border-bottom: 0; }

/* Avisos y documentos */
.doc { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border); background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; }
.doc:last-child { border-bottom: 0; }
.doc .ic { font-size: 24px; } .doc b { display: block; } .doc.nuevo b::after { content: ' ●'; color: var(--red); }
.texto { white-space: pre-wrap; font-size: 15.5px; line-height: 1.5; }

/* Login */
.login { min-height: 100vh; background: linear-gradient(160deg, var(--navy) 0%, #0f2343 100%); display: flex; flex-direction: column; justify-content: center; padding: 30px 22px calc(30px + var(--safe-b)); }
.login .logo { width: 76px; height: 76px; border-radius: 22px; background: var(--red); color: #fff; display: grid; place-items: center; font-size: 40px; font-weight: 800; margin: 0 auto 16px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.login h1 { color: #fff; text-align: center; margin: 0; font-size: 24px; font-weight: 800; }
.login p.sub { color: rgba(255,255,255,.75); text-align: center; margin: 4px 0 26px; }
.login .card { max-width: 420px; width: 100%; margin: 0 auto; padding: 22px 18px; }
.pin { letter-spacing: .5em; text-align: center; font-size: 22px; font-weight: 800; }
.error { background: var(--bad-bg); color: var(--bad); border-radius: 12px; padding: 10px 12px; font-size: 14.5px; margin-bottom: 12px; }

/* Avisos flotantes y hojas */
.toast { position: fixed; left: 14px; right: 14px; bottom: calc(86px + var(--safe-b)); background: var(--text); color: #fff; padding: 13px 16px; border-radius: 14px; z-index: 50; font-weight: 700; text-align: center; box-shadow: 0 8px 30px rgba(0,0,0,.25); animation: sube .2s ease-out; }
.toast.error { background: var(--bad); } .toast.ok { background: var(--ok); }
@keyframes sube { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.hoja-bg { position: fixed; inset: 0; background: rgba(10,20,40,.45); z-index: 40; display: flex; align-items: flex-end; }
.hoja { background: #fff; width: 100%; max-height: 88vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + var(--safe-b)); animation: sube .2s ease-out; }
.hoja h3 { margin: 0 0 12px; color: var(--navy); }
.instalar { background: #fff8e1; color: #7a4b00; }
@media (min-width: 700px) { .hoja-bg { align-items: center; justify-content: center; } .hoja { max-width: 560px; border-radius: 20px; } }
