/* ============================================================
   Gastos · Angelines
   Tema claro. Móvil primero. Sin frameworks.
   ============================================================ */

/* ---------- Tipografías locales ---------- */
@font-face { font-family:'Bricolage'; src:url('../fonts/bricolage-grotesque-600.woff2') format('woff2'); font-weight:600; font-display:swap; }
@font-face { font-family:'Bricolage'; src:url('../fonts/bricolage-grotesque-700.woff2') format('woff2'); font-weight:700; font-display:swap; }
@font-face { font-family:'Bricolage'; src:url('../fonts/bricolage-grotesque-800.woff2') format('woff2'); font-weight:800; font-display:swap; }
@font-face { font-family:'Hanken';    src:url('../fonts/hanken-grotesk-400.woff2') format('woff2'); font-weight:400; font-display:swap; }
@font-face { font-family:'Hanken';    src:url('../fonts/hanken-grotesk-500.woff2') format('woff2'); font-weight:500; font-display:swap; }
@font-face { font-family:'Hanken';    src:url('../fonts/hanken-grotesk-600.woff2') format('woff2'); font-weight:600; font-display:swap; }
@font-face { font-family:'Hanken';    src:url('../fonts/hanken-grotesk-700.woff2') format('woff2'); font-weight:700; font-display:swap; }

/* ---------- Tokens ---------- */
:root{
  --bg:#F3F7F5;
  --bg-elev:#FFFFFF;
  --surface:#FFFFFF;
  --surface-2:#F1F6F4;
  --surface-3:#E5EDE9;
  --line:#DBE5E1;
  --line-soft:#E8EFEC;
  --text:#16211D;
  --text-2:#4B5A54;
  --muted:#7B8882;
  --accent:#12907A;
  --accent-2:#0C7462;
  --accent-soft:#12907A14;
  --green:#12907A;
  --green-soft:#12907A16;
  --red:#C33F4A;
  --red-soft:#C33F4A14;
  --amber:#B0710B;
  --amber-soft:#B0710B16;
  --radius:18px;
  --radius-sm:12px;
  --radius-lg:24px;
  --shadow:0 1px 2px rgba(18,45,38,.05), 0 8px 22px -14px rgba(18,45,38,.22);
  --shadow-lg:0 2px 6px rgba(18,45,38,.06), 0 24px 48px -24px rgba(18,45,38,.3);
  --nav-h:calc(68px + env(safe-area-inset-bottom));
  --ease:cubic-bezier(.22,.9,.28,1);
}

*,*::before,*::after{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0; background:var(--bg); color:var(--text);
  font-family:'Hanken',system-ui,-apple-system,'Segoe UI',sans-serif;
  font-size:16px; line-height:1.5; -webkit-font-smoothing:antialiased;
  overscroll-behavior-y:none; -webkit-tap-highlight-color:transparent;
}
body::before{
  content:''; position:fixed; inset:0; pointer-events:none; z-index:0;
  background:
    radial-gradient(900px 500px at 10% -12%, #12907A12, transparent 62%),
    radial-gradient(700px 420px at 105% 0%, #2E7DB80d, transparent 58%);
}
h1,h2,h3,h4{ font-family:'Bricolage',system-ui,-apple-system,sans-serif; font-weight:700; margin:0; letter-spacing:-.02em; }
button,input,select,textarea{ font:inherit; color:inherit; }
button{ background:none; border:0; cursor:pointer; }
a{ color:inherit; }
::-webkit-scrollbar{ width:8px;height:8px } ::-webkit-scrollbar-thumb{ background:var(--surface-3); border-radius:8px }
.num{ font-family:'Bricolage',system-ui,-apple-system,sans-serif; font-weight:700; font-variant-numeric:tabular-nums; letter-spacing:-.02em; }
.tnum{ font-variant-numeric:tabular-nums; }
.hidden{ display:none !important }

/* ---------- Layout ---------- */
#app{ position:relative; z-index:1; min-height:100%; }
.shell{ display:flex; flex-direction:column; min-height:100dvh; }
main{ flex:1; padding:0 16px calc(var(--nav-h) + 28px); max-width:1180px; width:100%; margin:0 auto; }
.view{ animation:fade .28s var(--ease); }
@keyframes fade{ from{opacity:0; transform:translateY(6px)} to{opacity:1; transform:none} }

/* ---------- Cabecera ---------- */
.topbar{
  position:sticky; top:0; z-index:40; padding:calc(env(safe-area-inset-top) + 12px) 16px 10px;
  background:linear-gradient(180deg,var(--bg) 72%,transparent);
  max-width:1180px; margin:0 auto; width:100%;
}
.topbar-row{ display:flex; align-items:center; gap:12px; }
.brand{ display:flex; align-items:center; gap:11px; min-width:0; }
.brand-mark{ width:36px;height:36px;border-radius:12px; display:grid;place-items:center; flex:none;
  background:linear-gradient(145deg,#17A58B,#0E7C69); box-shadow:0 6px 16px -7px #12907A88; color:#fff }
.brand-mark svg{ width:20px;height:20px; }
.brand-txt{ min-width:0 }
.brand-txt b{ display:block; font-family:'Bricolage'; font-size:16px; line-height:1.15; letter-spacing:-.02em;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
.brand-txt span{ display:block; font-size:12px; color:var(--muted); }
.topbar .spacer{ flex:1 }
.icon-btn{
  width:42px;height:42px;border-radius:13px;display:grid;place-items:center;
  background:var(--surface); border:1px solid var(--line); color:var(--text-2);
  transition:.18s var(--ease); flex:none; box-shadow:var(--shadow);
}
.icon-btn:hover{ background:var(--surface-2); color:var(--text) }
.icon-btn:active{ transform:scale(.94) }
.icon-btn svg{ width:19px;height:19px }
.icon-btn.on{ background:var(--accent-soft); border-color:#12907A44; color:var(--accent-2) }

/* selector de mes */
.month-nav{ display:flex; align-items:center; gap:6px; margin-top:14px; }
.month-nav .pill{
  flex:1; display:flex; align-items:center; justify-content:center; gap:8px;
  height:46px; border-radius:15px; background:var(--surface); border:1px solid var(--line);
  font-weight:600; letter-spacing:-.01em; box-shadow:var(--shadow);
}
.month-nav .pill svg{ width:17px;height:17px; color:var(--muted) }
.month-nav .arrow{ width:46px;height:46px;border-radius:14px;background:var(--surface);border:1px solid var(--line);
  display:grid;place-items:center;color:var(--text-2); flex:none; box-shadow:var(--shadow) }
.month-nav .arrow:active{ transform:scale(.94) }
.month-nav .arrow svg{ width:19px;height:19px }

/* ---------- Tarjetas ---------- */
.card{
  background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
  padding:16px; box-shadow:var(--shadow);
}
.card + .card{ margin-top:14px }
.card-head{ display:flex; align-items:center; gap:10px; margin-bottom:14px }
.card-head h3{ font-size:16px; letter-spacing:-.01em }
.card-head .spacer{ flex:1 }
.section-title{ font-size:12px; text-transform:uppercase; letter-spacing:.12em; color:var(--muted); font-weight:700;
  margin:26px 0 10px; font-family:'Hanken' }
.section-title:first-child{ margin-top:18px }

/* ---------- Hero ---------- */
.hero{
  position:relative; overflow:hidden; margin-top:16px;
  border-radius:var(--radius-lg); padding:22px 20px 20px;
  background:linear-gradient(155deg,#E3F2ED 0%,#EFF7F4 55%,#FFFFFF 100%);
  border:1px solid #CFE3DC; box-shadow:var(--shadow);
}
.hero::after{ content:''; position:absolute; width:280px;height:280px; right:-110px; top:-140px; border-radius:50%;
  background:radial-gradient(circle,#12907A1f,transparent 66%); }
.hero-label{ font-size:12px; color:var(--accent-2); letter-spacing:.06em; text-transform:uppercase; font-weight:700 }
.hero-value{ font-size:clamp(38px,11vw,52px); line-height:1.02; margin:8px 0 4px }
.hero-sub{ font-size:13.5px; color:var(--text-2) }
.hero-sub b{ color:var(--text) }
.hero-split{ display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:18px; position:relative }
.hero-split > div{ background:#ffffffb0; border:1px solid #D7E7E1; border-radius:14px; padding:11px 12px }
.hero-split .k{ font-size:12px; color:var(--text-2); display:flex; align-items:center; gap:6px }
.hero-split .v{ font-size:19px; margin-top:3px }
.dotmark{ width:8px;height:8px;border-radius:50%; display:inline-block; flex:none }

/* barra progreso */
.bar{ height:8px; border-radius:99px; background:var(--surface-3); overflow:hidden; position:relative }
.bar > i{ display:block; height:100%; border-radius:99px; transition:width .5s var(--ease) }
.bar.thin{ height:6px }

/* ---------- Métricas ---------- */
.stat-grid{ display:grid; grid-template-columns:repeat(2,1fr); gap:12px }
.stat{ background:var(--surface); border:1px solid var(--line); border-radius:var(--radius-sm); padding:13px 14px;
  box-shadow:var(--shadow) }
.stat .k{ font-size:11.5px; color:var(--muted); text-transform:uppercase; letter-spacing:.07em; font-weight:700 }
.stat .v{ font-size:21px; margin-top:5px }
.stat .d{ font-size:12px; color:var(--text-2); margin-top:2px }

/* ---------- Lista de gastos ---------- */
.day-head{ display:flex; align-items:baseline; gap:8px; margin:20px 2px 9px }
.day-head b{ font-size:13.5px; font-weight:700; letter-spacing:-.01em }
.day-head .spacer{ flex:1 }
.day-head span{ font-size:12.5px; color:var(--muted); font-variant-numeric:tabular-nums }

.entry{
  display:flex; align-items:center; gap:12px; padding:12px; border-radius:15px;
  background:var(--surface); border:1px solid var(--line); transition:.18s var(--ease); width:100%; text-align:left;
  box-shadow:var(--shadow);
}
.entry + .entry{ margin-top:8px }
.entry:active{ transform:scale(.995) }
.entry-ico{ width:40px;height:40px;border-radius:13px; flex:none; display:grid;place-items:center; }
.entry-ico svg{ width:19px;height:19px }
.entry-main{ flex:1; min-width:0 }
.entry-name{ font-weight:600; font-size:15px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
.entry-meta{ font-size:12px; color:var(--muted); display:flex; align-items:center; gap:6px; margin-top:3px; flex-wrap:wrap }
.entry-amt{ text-align:right; flex:none }
.entry-amt .a{ font-size:16px; font-family:'Bricolage'; font-weight:700; font-variant-numeric:tabular-nums }
.entry .thumb{ width:40px;height:40px;border-radius:11px; object-fit:cover; flex:none; border:1px solid var(--line) }

.tag{ font-size:11px; padding:2.5px 7px; border-radius:7px; background:var(--surface-3); color:var(--text-2); font-weight:600;
  letter-spacing:.02em; white-space:nowrap; display:inline-flex; align-items:center; gap:4px }
.tag svg{ width:11px;height:11px }
.tag.persona{ background:var(--accent-soft); color:var(--accent-2) }
.tag.foto{ background:#2E7DB814; color:#2E7DB8 }

/* ---------- Chips / filtros ---------- */
.chips{ display:flex; gap:8px; overflow-x:auto; padding:2px 0 4px; scrollbar-width:none; -webkit-overflow-scrolling:touch }
.chips::-webkit-scrollbar{ display:none }
.chip{
  flex:none; padding:9px 14px; border-radius:99px; background:var(--surface); border:1px solid var(--line);
  font-size:13.5px; color:var(--text-2); font-weight:600; white-space:nowrap; transition:.16s var(--ease);
  display:inline-flex; align-items:center; gap:6px;
}
.chip svg{ width:14px;height:14px }
.chip.on{ background:var(--accent); color:#fff; border-color:var(--accent) }

.filterbar{ display:flex; gap:8px; align-items:center; margin-top:12px }
.filterbar .search{ flex:1; position:relative }
.filterbar .search svg{ position:absolute; left:13px; top:50%; transform:translateY(-50%); width:17px;height:17px; color:var(--muted) }
.filterbar .search input{ padding-left:38px }
.active-filters{ display:flex; flex-wrap:wrap; gap:7px; margin-top:10px }
.active-filters .fchip{ display:inline-flex; align-items:center; gap:6px; padding:5px 8px 5px 11px; border-radius:99px;
  background:var(--accent-soft); border:1px solid #12907A33; color:var(--accent-2); font-size:12.5px; font-weight:600 }
.active-filters .fchip svg{ width:13px;height:13px }

/* ---------- Navegación inferior ---------- */
.tabbar{
  position:fixed; left:0; right:0; bottom:0; z-index:50; height:var(--nav-h);
  padding-bottom:env(safe-area-inset-bottom);
  display:grid; grid-template-columns:repeat(5,1fr);
  background:rgba(255,255,255,.92); backdrop-filter:blur(18px) saturate(150%);
  border-top:1px solid var(--line);
}
.tabbar button{ display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px;
  color:var(--muted); font-size:11px; font-weight:600; letter-spacing:.01em; position:relative }
.tabbar svg{ width:22px;height:22px }
.tabbar button.on{ color:var(--accent-2) }
.tabbar button.on::before{ content:''; position:absolute; top:0; width:26px; height:2.5px; border-radius:0 0 4px 4px;
  background:var(--accent) }

/* botón flotante añadir */
.fab{
  position:fixed; right:16px; bottom:calc(var(--nav-h) + 14px); z-index:45;
  width:60px;height:60px;border-radius:20px; display:grid;place-items:center;
  background:linear-gradient(150deg,#17A58B,#0E7C69); color:#fff;
  box-shadow:0 12px 28px -10px #12907Aaa; transition:.2s var(--ease);
}
.fab:active{ transform:scale(.92) }
.fab svg{ width:26px;height:26px }

/* ---------- Botones ---------- */
.btn{
  height:50px; padding:0 18px; border-radius:15px; display:inline-flex; align-items:center; justify-content:center; gap:8px;
  background:var(--surface); border:1px solid var(--line); color:var(--text); font-weight:600; font-size:15px;
  transition:.16s var(--ease); box-shadow:var(--shadow);
}
.btn:hover{ background:var(--surface-2) }
.btn:active{ transform:scale(.985) }
.btn.primary{ background:linear-gradient(150deg,#17A58B,#0E7C69); border-color:transparent; color:#fff;
  box-shadow:0 8px 20px -10px #12907Acc }
.btn.ghost{ background:transparent; box-shadow:none }
.btn.danger{ color:var(--red); border-color:#C33F4A33 }
.btn.block{ width:100% }
.btn.sm{ height:40px; padding:0 14px; font-size:14px; border-radius:12px }
.btn svg{ width:18px;height:18px }
.btn[disabled]{ opacity:.5; pointer-events:none }
.btn-row{ display:flex; gap:10px; margin-top:12px }
.btn-row .btn{ flex:1 }

/* ---------- Formularios ---------- */
.field{ margin-bottom:14px }
.field > label{ display:block; font-size:12.5px; color:var(--text-2); font-weight:700; margin-bottom:6px; letter-spacing:.01em }
.input, select.input, textarea.input{
  width:100%; height:52px; padding:0 14px; border-radius:15px;
  background:var(--surface); border:1px solid var(--line); color:var(--text); outline:none;
  transition:.16s var(--ease); font-size:16px; /* 16px evita el zoom en iOS */
}
textarea.input{ height:auto; padding:12px 14px; resize:vertical; min-height:86px; line-height:1.45 }
select.input{ appearance:none; background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237B8882' stroke-width='2.2' stroke-linecap='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat:no-repeat; background-position:right 12px center; background-size:18px; padding-right:38px }
.input:focus{ border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft) }
.input.big{ height:70px; font-family:'Bricolage'; font-weight:700; font-size:32px; text-align:center; letter-spacing:-.02em }
.input::placeholder{ color:#A3AEA9 }
.row2{ display:grid; grid-template-columns:1fr 1fr; gap:10px }
.seg{ display:grid; gap:6px; background:var(--surface-2); border:1px solid var(--line); border-radius:15px; padding:4px }
.seg.c2{ grid-template-columns:1fr 1fr } .seg.c3{ grid-template-columns:repeat(3,1fr) }
.seg button{ height:42px; border-radius:11px; font-size:14px; font-weight:600; color:var(--text-2); transition:.16s var(--ease);
  display:flex; align-items:center; justify-content:center; gap:6px }
.seg button svg{ width:15px;height:15px }
.seg button.on{ background:var(--surface); color:var(--accent-2); box-shadow:var(--shadow) }
.switch{ display:flex; align-items:center; gap:12px; padding:13px 14px; background:var(--surface);
  border:1px solid var(--line); border-radius:15px; margin-bottom:10px; box-shadow:var(--shadow) }
.switch .t{ flex:1 }
.switch .t b{ display:block; font-size:14.5px; font-weight:600 }
.switch .t span{ font-size:12px; color:var(--muted) }
.toggle{ width:50px;height:30px;border-radius:99px;background:var(--surface-3); position:relative; flex:none; transition:.2s var(--ease) }
.toggle::after{ content:''; position:absolute; top:3px; left:3px; width:24px;height:24px;border-radius:50%; background:#fff;
  transition:.22s var(--ease); box-shadow:0 1px 3px rgba(0,0,0,.2) }
.toggle.on{ background:var(--accent) }
.toggle.on::after{ left:23px }
.hint{ font-size:12px; color:var(--muted); margin-top:-6px; margin-bottom:12px; line-height:1.45 }

/* opciones en lista (permisos, y cualquier elección con explicación) */
.opts{ display:flex; flex-direction:column; gap:8px }
.opt{ display:flex; align-items:flex-start; gap:11px; padding:13px 14px; width:100%; text-align:left;
  background:var(--surface); border:1px solid var(--line); border-radius:15px; transition:.16s var(--ease) }
.opt:active{ transform:scale(.99) }
.opt .mark{ width:21px;height:21px;border-radius:50%; border:2px solid var(--line); flex:none; margin-top:1px;
  display:grid; place-items:center; transition:.16s var(--ease) }
.opt .mark::after{ content:''; width:11px;height:11px;border-radius:50%; background:var(--accent);
  transform:scale(0); transition:.18s var(--ease) }
.opt.on{ border-color:var(--accent); background:var(--accent-soft) }
.opt.on .mark{ border-color:var(--accent) }
.opt.on .mark::after{ transform:scale(1) }
.opt .t{ flex:1; min-width:0 }
.opt .t b{ display:block; font-size:14.5px; font-weight:600 }
.opt .t span{ display:block; font-size:12px; color:var(--muted); line-height:1.35; margin-top:1px }

/* selector de categoría */
.catgrid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(80px,1fr)); gap:8px; max-height:250px; overflow:auto; padding:2px }
.catgrid button{ padding:11px 6px; border-radius:14px; background:var(--surface); border:1px solid var(--line);
  display:flex; flex-direction:column; align-items:center; gap:6px; font-size:11.5px; color:var(--text-2); font-weight:600;
  text-align:center; line-height:1.2 }
.catgrid button svg{ width:21px;height:21px }
.catgrid button.on{ border-color:var(--accent); background:var(--accent-soft); color:var(--text) }

/* ticket */
.ticket-zone{ margin-bottom:14px }
.ticket-zone .btn-row{ margin-top:8px }
.ticket-box{ display:flex; gap:10px; align-items:center; padding:12px; background:var(--surface-2);
  border:1px dashed #C7D6D0; border-radius:15px }
.ticket-box img{ width:56px;height:56px;border-radius:12px; object-fit:cover; flex:none; border:1px solid var(--line) }
.ticket-box .t{ flex:1; min-width:0 }
.ticket-box .t b{ display:block; font-size:14px }
.ticket-box .t span{ font-size:12px; color:var(--muted) }

/* ---------- Hoja / modal ---------- */
.sheet-back{
  position:fixed; inset:0; z-index:100; background:rgba(22,40,35,.32); backdrop-filter:blur(3px);
  display:flex; align-items:flex-end; justify-content:center; animation:fadein .2s var(--ease);
}
@keyframes fadein{ from{opacity:0} to{opacity:1} }
.sheet{
  width:100%; max-width:540px; max-height:93dvh; overflow:auto; background:var(--bg-elev);
  border:1px solid var(--line); border-bottom:0; border-radius:26px 26px 0 0;
  padding:8px 18px calc(22px + env(safe-area-inset-bottom));
  animation:up .3s var(--ease); box-shadow:0 -18px 50px -20px rgba(18,45,38,.35);
}
.sheet.wide{ max-width:820px }
@keyframes up{ from{ transform:translateY(28px); opacity:.4 } to{ transform:none; opacity:1 } }
.sheet-grip{ width:38px;height:4px;border-radius:99px;background:var(--surface-3); margin:6px auto 14px }
.sheet h2{ font-size:21px; margin-bottom:4px }
.sheet .sub{ font-size:13px; color:var(--muted); margin-bottom:18px }
.sheet-actions{ display:flex; gap:10px; margin-top:20px }
.sheet-actions .btn{ flex:1 }

/* ---------- Toast ---------- */
.toasts{ position:fixed; left:0; right:0; bottom:calc(var(--nav-h) + 12px); z-index:200; display:flex;
  flex-direction:column; align-items:center; gap:8px; pointer-events:none; padding:0 16px }
.toast{ background:#16211D; border:1px solid #16211D; color:#F2F7F5; padding:12px 16px;
  border-radius:14px; font-size:14px; font-weight:500; box-shadow:var(--shadow-lg); animation:up .25s var(--ease);
  max-width:440px; display:flex; align-items:center; gap:9px }
.toast.err{ background:#8E2A33; border-color:#8E2A33 }
.toast.ok{ background:#0C6B5A; border-color:#0C6B5A }
.toast svg{ width:17px;height:17px; flex:none }

/* ---------- Diario de incidencias ---------- */
.tl{ position:relative; padding-left:26px }
.tl::before{ content:''; position:absolute; left:8px; top:6px; bottom:6px; width:2px; background:var(--line) }
.tl-item{ position:relative; padding:0 0 18px }
.tl-item::before{ content:''; position:absolute; left:-22px; top:5px; width:11px;height:11px; border-radius:50%;
  border:2px solid var(--bg); background:var(--p,var(--muted)) }
.tl-top{ display:flex; align-items:center; gap:8px; font-size:12.5px; color:var(--muted); margin-bottom:5px; flex-wrap:wrap }
.tl-txt{ background:var(--surface); border:1px solid var(--line); border-radius:14px; padding:12px 13px;
  font-size:14.5px; line-height:1.5; white-space:pre-wrap; word-break:break-word; box-shadow:var(--shadow) }

/* ---------- Listas de ajustes ---------- */
.list-row{ display:flex; align-items:center; gap:12px; padding:14px; background:var(--surface);
  border:1px solid var(--line); border-radius:15px; width:100%; text-align:left; box-shadow:var(--shadow) }
.list-row + .list-row{ margin-top:8px }
.list-row .t{ flex:1; min-width:0 }
.list-row .t b{ display:block; font-size:14.5px; font-weight:600 }
.list-row .t span{ font-size:12px; color:var(--muted) }
.list-row .chev{ color:var(--muted) }
.list-row .chev svg{ width:18px;height:18px }
.swatch{ width:36px;height:36px;border-radius:12px; flex:none; display:grid;place-items:center }
.swatch svg{ width:17px;height:17px }
.avatar{ width:38px;height:38px;border-radius:50%; flex:none; display:grid;place-items:center;
  font-family:'Bricolage'; font-weight:700; font-size:15px; color:#fff }

/* ---------- Gráficos ---------- */
.chart{ width:100%; display:block; overflow:visible }
.legend{ display:flex; flex-direction:column; gap:10px; margin-top:16px }
.legend-row{ display:flex; align-items:center; gap:9px; font-size:13.5px }
.legend-row .n{ flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; color:var(--text-2) }
.legend-row .v{ font-variant-numeric:tabular-nums; font-weight:600 }
.legend-row .p{ font-size:12px; color:var(--muted); width:40px; text-align:right; font-variant-numeric:tabular-nums }
.donut-wrap{ position:relative; display:grid; place-items:center }
.donut-center{ position:absolute; text-align:center; pointer-events:none }
.donut-center .v{ font-family:'Bricolage'; font-weight:700; font-size:24px; letter-spacing:-.02em }
.donut-center .k{ font-size:11.5px; color:var(--muted) }

.rank{ display:flex; flex-direction:column; gap:13px }
.rank-row .top{ display:flex; align-items:center; gap:9px; font-size:13.5px; margin-bottom:6px }
.rank-row .top .n{ flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
.rank-row .top .v{ font-variant-numeric:tabular-nums; font-weight:600 }

/* ---------- Vacío ---------- */
.empty{ text-align:center; padding:40px 20px; color:var(--muted) }
.empty svg{ width:42px;height:42px; opacity:.4; margin-bottom:12px }
.empty p{ margin:0 0 4px; font-size:14.5px; color:var(--text-2) }
.empty small{ font-size:13px }

/* ---------- Acceso ---------- */
.auth{ min-height:100dvh; display:grid; place-items:center; padding:24px }
.auth-card{ width:100%; max-width:390px; }
.auth-logo{ width:66px;height:66px;border-radius:22px; display:grid;place-items:center; margin:0 auto 20px; color:#fff;
  background:linear-gradient(145deg,#17A58B,#0E7C69); box-shadow:0 14px 32px -14px #12907Aaa }
.auth-logo svg{ width:33px;height:33px }
.auth h1{ font-size:30px; text-align:center; margin-bottom:22px }
.auth-box{ background:var(--surface); border:1px solid var(--line); border-radius:22px; padding:22px; box-shadow:var(--shadow-lg) }
.err-box{ background:var(--red-soft); border:1px solid #C33F4A44; color:#9B2F39; border-radius:13px; padding:12px 13px;
  font-size:13.5px; margin-bottom:14px }

/* ---------- Escritorio ---------- */
@media (min-width:860px){
  main{ padding:0 28px 60px }
  .topbar{ padding:22px 28px 12px }
  .tabbar{
    top:0; bottom:auto; height:auto; width:232px; right:auto; grid-template-columns:1fr;
    border-top:0; border-right:1px solid var(--line); padding:100px 14px 20px; gap:4px; align-content:start;
    background:rgba(255,255,255,.75);
  }
  .tabbar button{ flex-direction:row; justify-content:flex-start; gap:12px; height:48px; padding:0 14px;
    border-radius:13px; font-size:14.5px }
  .tabbar button.on{ background:var(--accent-soft) }
  .tabbar button.on::before{ top:50%; left:0; transform:translateY(-50%); width:3px; height:22px; border-radius:0 4px 4px 0 }
  .shell{ padding-left:232px }
  .fab{ right:36px; bottom:36px }
  .stat-grid{ grid-template-columns:repeat(4,1fr) }
  .hero-split{ grid-template-columns:repeat(4,1fr) }
  .grid2{ display:grid; grid-template-columns:1fr 1fr; gap:14px; align-items:start }
  .grid2 .card + .card{ margin-top:0 }
  .sheet-back{ align-items:center }
  .sheet{ border-radius:24px; border-bottom:1px solid var(--line); max-height:90dvh }
  .toasts{ bottom:24px }
}
@media (max-width:859px){ .grid2 > * + *{ margin-top:14px } }

/* accesibilidad */
@media (prefers-reduced-motion:reduce){ *{ animation-duration:.01ms !important; transition-duration:.01ms !important } }
:focus-visible{ outline:2px solid var(--accent); outline-offset:2px }

/* ============================================================
   INFORME IMPRIMIBLE
   Se genera dentro de #print y sólo se ve al imprimir.
   ============================================================ */
#print{ display:none }

@media print{
  @page{ size:A4; margin:14mm 12mm; }
  body{ background:#fff !important; color:#000; font-size:10.5pt }
  body::before{ display:none }
  #app, .shell, .topbar, .tabbar, .fab, .toasts, .sheet-back, main{ display:none !important }
  #print{ display:block !important }

  #print *{ color:#000 }
  .p-head{ display:flex; align-items:flex-start; gap:14px; border-bottom:2px solid #000; padding-bottom:10px; margin-bottom:14px }
  .p-head .t{ flex:1 }
  .p-head h1{ font-family:'Bricolage',system-ui,-apple-system,sans-serif; font-size:19pt; margin:0 0 3px }
  .p-head .meta{ font-size:9.5pt; color:#444 !important }
  .p-head .tot{ text-align:right }
  .p-head .tot .k{ font-size:8.5pt; text-transform:uppercase; letter-spacing:.08em; color:#444 !important }
  .p-head .tot .v{ font-family:'Bricolage',system-ui,-apple-system,sans-serif; font-size:20pt; font-weight:700 }

  .p-sec{ margin:16px 0 8px; font-size:11pt; font-weight:700; font-family:'Bricolage',system-ui,-apple-system,sans-serif;
    border-bottom:1px solid #999; padding-bottom:3px }
  .p-sec:first-of-type{ margin-top:8px }

  table.p-tab{ width:100%; border-collapse:collapse; font-size:9.5pt }
  table.p-tab th{ text-align:left; font-size:8pt; text-transform:uppercase; letter-spacing:.06em;
    border-bottom:1px solid #000; padding:4px 5px; color:#333 !important }
  table.p-tab td{ padding:4px 5px; border-bottom:1px solid #DDD; vertical-align:top }
  table.p-tab tr{ break-inside:avoid }
  table.p-tab .r{ text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap }
  table.p-tab tfoot td{ border-top:2px solid #000; border-bottom:0; font-weight:700; padding-top:6px }

  .p-note{ font-size:8.5pt; color:#555 !important; font-style:italic }
  .p-foot{ margin-top:18px; border-top:1px solid #999; padding-top:6px; font-size:8pt; color:#555 !important;
    display:flex; justify-content:space-between }
  .p-sign{ margin-top:26px; display:grid; grid-template-columns:1fr 1fr; gap:40px; break-inside:avoid }
  .p-sign div{ border-top:1px solid #000; padding-top:5px; font-size:9pt }
  .p-break{ break-before:page }
}
