/* Ruta Neta — estilos. Los temas se eligen con body[data-tema]; los tonos del acento (--a1, --a2,
   --mark…) los calcula app.js a partir del color elegido. Móvil primero; en pantallas anchas la
   navegación pasa a una barra lateral. */

:root {
  --a1: #7c3aed; --a2: #2563eb; --mark: #9d72f2; --mark-dim: #4d3d8a; --mark-14: rgba(157,114,242,.14);
  --accent-text: #c9b3ff; --accent-soft: rgba(124,58,237,.24); --ring-track: #3a2f6b; --focus: rgba(157,114,242,.6);
  --radius: 20px; --radius-sm: 13px; --gap: 14px; --tab-h: 66px; --rail-w: 248px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
html { font-size: 15px; -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
html[data-fuente="grande"] { font-size: 17px; }
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.45; -webkit-font-smoothing: antialiased; overflow-x: hidden; -webkit-tap-highlight-color: transparent; }
body.con-hoja { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .88em; background: var(--card-2); padding: .1em .35em; border-radius: 6px; }
pre { overflow-x: auto; background: var(--card-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; font-size: .82rem; line-height: 1.5; }
pre code { background: none; padding: 0; }

/* ---------- Temas ---------- */
body[data-tema="cristal"] {
  color-scheme: dark;
  --bg: #0e0a26; --card: rgba(255,255,255,.075); --card-2: rgba(255,255,255,.1); --card-solid: #211a47;
  --border: rgba(255,255,255,.13); --border-strong: rgba(255,255,255,.24);
  --text: #f6f4ff; --muted: #c3bfe5; --faint: #938ebd;
  --blur: blur(22px) saturate(160%); --shadow: 0 10px 30px rgba(6,3,28,.35);
  --input: rgba(255,255,255,.07); --input-border: rgba(255,255,255,.17);
  --nav-bg: rgba(22,16,52,.62); --sheet-bg: rgba(31,24,68,.95); --th-bg: #261e52; --zebra: rgba(255,255,255,.035); --row-hover: rgba(255,255,255,.08);
  --chip-bg: rgba(255,255,255,.06); --seg-bg: rgba(255,255,255,.07); --seg-on: rgba(255,255,255,.18);
  --grid: rgba(255,255,255,.09); --axis: rgba(255,255,255,.3); --cell-empty: rgba(255,255,255,.05);
  --tip-bg: #f6f4ff; --tip-text: #17132e; --tip-muted: #5c5778;
  --good: #66d46f; --bad: #ff8585; --warn: #fbb315; --line-2: rgba(255,255,255,.5); --backdrop: rgba(5,2,20,.55);
  --c1: #9887ef; --c2: #00a888; --c3: #e76624; --c4: #338ced; --c5: #e24d8b; --c6: #d28e05;
}
body[data-tema="cristal-claro"] {
  color-scheme: light;
  --bg: #e9e6fb; --card: rgba(255,255,255,.56); --card-2: rgba(255,255,255,.72); --card-solid: #ffffff;
  --border: rgba(255,255,255,.85); --border-strong: rgba(91,72,190,.22);
  --text: #1c1838; --muted: #55507a; --faint: #7f7a9e;
  --blur: blur(18px) saturate(170%); --shadow: 0 8px 28px rgba(70,50,170,.13);
  --input: rgba(255,255,255,.78); --input-border: rgba(91,72,190,.22);
  --nav-bg: rgba(250,249,255,.74); --sheet-bg: rgba(250,249,255,.97); --th-bg: #f1eefe; --zebra: rgba(91,72,190,.04); --row-hover: rgba(91,72,190,.08);
  --chip-bg: rgba(255,255,255,.62); --seg-bg: rgba(91,72,190,.09); --seg-on: #ffffff;
  --grid: rgba(40,30,90,.09); --axis: rgba(40,30,90,.28); --cell-empty: rgba(40,30,90,.06);
  --tip-bg: #1c1838; --tip-text: #ffffff; --tip-muted: #cbc6ec;
  --good: #11752a; --bad: #c4302f; --warn: #9a6200; --line-2: rgba(40,30,90,.38); --backdrop: rgba(30,20,70,.35);
  --c1: #6a4ce2; --c2: #00b894; --c3: #f47230; --c4: #257de0; --c5: #ee7fac; --c6: #f2a600;
}
body[data-tema="nocturno"] {
  color-scheme: dark;
  --bg: #0b0a1a; --card: #16142c; --card-2: #1d1a38; --card-solid: #16142c;
  --border: rgba(255,255,255,.07); --border-strong: rgba(255,255,255,.16);
  --text: #ecebff; --muted: #aba8cf; --faint: #7f7ca6;
  --blur: none; --shadow: 0 6px 22px rgba(0,0,0,.28);
  --input: #1d1a38; --input-border: rgba(255,255,255,.11);
  --nav-bg: rgba(14,12,32,.94); --sheet-bg: #17152e; --th-bg: #1f1c3c; --zebra: rgba(255,255,255,.025); --row-hover: rgba(255,255,255,.05);
  --chip-bg: #1d1a38; --seg-bg: #1d1a38; --seg-on: #2d2955;
  --grid: rgba(255,255,255,.07); --axis: rgba(255,255,255,.26); --cell-empty: rgba(255,255,255,.04);
  --tip-bg: #f3f2ff; --tip-text: #17132e; --tip-muted: #5c5778;
  --good: #62d26b; --bad: #ff7b7b; --warn: #fbb315; --line-2: rgba(255,255,255,.45); --backdrop: rgba(0,0,0,.55);
  --c1: #9887ef; --c2: #00a888; --c3: #e76624; --c4: #338ced; --c5: #e24d8b; --c6: #d28e05;
}
body[data-tema="clasico"] {
  color-scheme: light;
  --bg: #f3f3f8; --card: #ffffff; --card-2: #f6f5fb; --card-solid: #ffffff;
  --border: #e5e4ef; --border-strong: #d3d1e3;
  --text: #1b1a2e; --muted: #5d5b76; --faint: #8b89a3;
  --blur: none; --shadow: 0 1px 2px rgba(20,16,60,.05), 0 4px 16px rgba(20,16,60,.05);
  --input: #ffffff; --input-border: #d9d7e6;
  --nav-bg: rgba(255,255,255,.95); --sheet-bg: #ffffff; --th-bg: #f6f5fb; --zebra: #fafafd; --row-hover: #f1effa;
  --chip-bg: #ffffff; --seg-bg: #ecebf4; --seg-on: #ffffff;
  --grid: #e9e8f1; --axis: #c2c0d4; --cell-empty: #f0eff6;
  --tip-bg: #1b1a2e; --tip-text: #ffffff; --tip-muted: #c8c6dc;
  --good: #11752a; --bad: #c4302f; --warn: #9a6200; --line-2: #9b99b3; --backdrop: rgba(20,16,50,.4);
  --c1: #6a4ce2; --c2: #00b894; --c3: #f47230; --c4: #257de0; --c5: #ee7fac; --c6: #f2a600;
}
body[data-tema="amoled"] {
  color-scheme: dark;
  --bg: #000000; --card: #0d0d13; --card-2: #15151d; --card-solid: #0d0d13;
  --border: #1f1f28; --border-strong: #2e2e3a;
  --text: #f2f2f7; --muted: #a3a3b8; --faint: #75758c;
  --blur: none; --shadow: none;
  --input: #15151d; --input-border: #2a2a35;
  --nav-bg: rgba(0,0,0,.94); --sheet-bg: #0d0d13; --th-bg: #16161f; --zebra: rgba(255,255,255,.02); --row-hover: rgba(255,255,255,.05);
  --chip-bg: #15151d; --seg-bg: #15151d; --seg-on: #27273a;
  --grid: rgba(255,255,255,.08); --axis: rgba(255,255,255,.28); --cell-empty: rgba(255,255,255,.04);
  --tip-bg: #f2f2f7; --tip-text: #111118; --tip-muted: #5c5c70;
  --good: #62d26b; --bad: #ff7b7b; --warn: #fbb315; --line-2: rgba(255,255,255,.45); --backdrop: rgba(0,0,0,.7);
  --c1: #9887ef; --c2: #00a888; --c3: #e76624; --c4: #338ced; --c5: #e24d8b; --c6: #d28e05;
}
body[data-efectos="reducidos"] { --blur: none; }
body[data-efectos="reducidos"][data-tema="cristal"] { --card: rgba(40,32,86,.72); --nav-bg: rgba(22,16,52,.96); }
body[data-efectos="reducidos"][data-tema="cristal-claro"] { --card: rgba(255,255,255,.86); --nav-bg: rgba(250,249,255,.97); }

/* Fondo de cristal: manchas de color que flotan detrás del vidrio */
#bg { display: none; position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
body[data-tema^="cristal"] #bg { display: block; }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; will-change: transform; animation: flotar 26s ease-in-out infinite alternate; }
.b1 { width: 72vmax; height: 72vmax; left: -28vmax; top: -32vmax; background: var(--a1); }
.b2 { width: 62vmax; height: 62vmax; right: -26vmax; bottom: -28vmax; background: var(--a2); animation-duration: 33s; }
.b3 { width: 38vmax; height: 38vmax; left: 38%; top: 38%; background: #d946ef; opacity: .26; animation-duration: 41s; }
body[data-tema="cristal-claro"] .blob { opacity: .36; }
body[data-tema="cristal-claro"] .b3 { opacity: .18; }
body[data-efectos="reducidos"] .blob { animation: none; }
@keyframes flotar { from { transform: translate(0,0) scale(1); } to { transform: translate(7vmax, 5vmax) scale(1.12); } }

/* ---------- Estructura ---------- */
#app { position: relative; z-index: 1; min-height: 100vh; }
#topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--nav-bg); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border-bottom: 1px solid var(--border); }
.tb-brand { display: flex; }
.tb-title { flex: 1; font-weight: 700; font-size: 1.06rem; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo-xs { width: 30px; height: 30px; display: block; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; text-decoration: none; background: linear-gradient(135deg, var(--a1), var(--a2)); flex: none; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.4rem; }
.crono-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-size: .8rem; font-weight: 700; text-decoration: none; }
.crono-pill i { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; animation: latido 1.4s ease-in-out infinite; }
@keyframes latido { 50% { opacity: .35; } }
#view { position: relative; padding: 16px 16px calc(var(--tab-h) + 100px + env(safe-area-inset-bottom)); max-width: 1180px; margin: 0 auto; outline: none; }
#tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding: 0 4px env(safe-area-inset-bottom); background: var(--nav-bg); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border-top: 1px solid var(--border); }
.tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: .7rem; font-weight: 600; text-decoration: none; }
.tab .i { width: 22px; height: 22px; position: relative; z-index: 1; }
.tab::before { content: ''; position: absolute; top: 9px; width: 52px; height: 30px; border-radius: 15px; background: transparent; transition: background .2s; }
.tab.on { color: var(--accent-text); }
.tab.on::before { background: var(--accent-soft); }
.tab .badge { position: absolute; top: 6px; left: calc(50% + 6px); }
.fab { position: fixed; right: 18px; bottom: calc(var(--tab-h) + 18px + env(safe-area-inset-bottom)); z-index: 31; width: 58px; height: 58px; border: 0; border-radius: 20px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--a1), var(--a2)); box-shadow: 0 10px 26px var(--accent-soft), 0 4px 12px rgba(0,0,0,.25); transition: transform .15s; }
.fab .i { width: 28px; height: 28px; stroke-width: 2.4; }
.fab:active { transform: scale(.94); }
#rail { display: none; }
body.sin-perfil #topbar, body.sin-perfil #tabbar, body.sin-perfil #fab, body.sin-perfil #rail { display: none !important; }
body.sin-perfil #view { padding-bottom: 40px; }

@media (min-width: 960px) {
  #app { padding-left: var(--rail-w); }
  body.sin-perfil #app { padding-left: 0; }
  #rail { position: fixed; z-index: 25; inset: 0 auto 0 0; width: var(--rail-w); display: flex; flex-direction: column; gap: 18px; padding: 20px 16px; background: var(--nav-bg); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border-right: 1px solid var(--border); }
  .rail-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; text-decoration: none; letter-spacing: -.01em; padding: 4px 6px; }
  .rail-nav { display: flex; flex-direction: column; gap: 4px; }
  .rail-item { position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; color: var(--muted); text-decoration: none; font-weight: 600; }
  .rail-item:hover { background: var(--row-hover); color: var(--text); }
  .rail-item.on { background: var(--accent-soft); color: var(--accent-text); }
  .rail-item .badge { margin-left: auto; }
  .rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
  #tabbar, .fab { display: none; }
  #topbar { padding: 12px 32px; }
  .tb-brand, .tb-title { visibility: hidden; }
  #view { padding: 24px 32px 56px; }
}

/* ---------- Tipografía y utilidades ---------- */
h1, h2, h3 { margin: 0; letter-spacing: -.015em; line-height: 1.2; }
h1 { font-size: 1.55rem; font-weight: 750; }
h2 { font-size: 1.05rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
h3 { font-size: .98rem; font-weight: 700; margin-bottom: 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hint { color: var(--muted); font-size: .84rem; margin: 6px 0 10px; display: block; }
.hint .i { vertical-align: -2px; }
.lead-muted { color: var(--muted); font-size: 1rem; }
.eyebrow { font-size: .8rem; font-weight: 600; letter-spacing: .01em; opacity: .92; }
.link { color: var(--accent-text); text-decoration: none; font-weight: 600; font-size: .86rem; display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.link-btn { border: 0; background: none; padding: 4px 2px; color: var(--accent-text); font-weight: 600; font-size: .84rem; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.warn-t { color: var(--warn); }
.good-t { color: var(--good); }
.err { color: var(--bad); font-size: .86rem; margin: 4px 0; }
.err-pre { white-space: pre-wrap; font-size: .75rem; color: var(--muted); }

/* Íconos (sprite SVG) */
.i { width: 1.2em; height: 1.2em; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.i.xs { width: .95em; height: .95em; }
.i.sm { width: 1.05em; height: 1.05em; }
.i.lg { width: 1.6em; height: 1.6em; }
.i.xl { width: 2.6em; height: 2.6em; stroke-width: 1.6; }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px; border-radius: 14px; border: 1px solid transparent; font-weight: 650; font-size: .95rem; text-decoration: none; transition: transform .12s, filter .15s, background .15s; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.primary { color: #fff; background: linear-gradient(135deg, var(--a1), var(--a2)); box-shadow: 0 6px 18px var(--accent-soft); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: var(--card-2); border-color: var(--border); color: var(--text); }
.btn.ghost:hover { background: var(--row-hover); }
.btn.danger { color: #fff; background: #c4302f; }
.btn.danger-text { color: var(--bad); }
.btn.sm { min-height: 38px; padding: 7px 13px; font-size: .88rem; border-radius: 12px; }
.btn.lg { min-height: 54px; font-size: 1.05rem; border-radius: 16px; }
.btn.wide { width: 100%; }
.btn-col { display: flex; flex-direction: column; gap: 10px; }
.file-btn { cursor: pointer; }
.icon-btn { width: 42px; height: 42px; flex: none; display: inline-grid; place-items: center; border-radius: 13px; border: 1px solid var(--border); background: var(--card-2); color: var(--text); position: relative; text-decoration: none; }
.icon-btn.sm { width: 34px; height: 34px; border-radius: 10px; }
.icon-btn[disabled] { opacity: .35; }
.icon-btn .badge { position: absolute; top: -4px; right: -4px; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #e11d48; color: #fff; font-size: .68rem; font-weight: 800; display: inline-grid; place-items: center; line-height: 1; }

/* ---------- Tarjetas ---------- */
.card { position: relative; background: var(--card); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: var(--gap); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-sub { color: var(--muted); font-size: .82rem; margin: 3px 0 0; }
.page-head { display: flex; align-items: center; gap: 10px; margin: 2px 0 14px; }
.page-head h1 { flex: 1; }
.page-head .back { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: var(--card-2); border: 1px solid var(--border); text-decoration: none; }
.dash { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
.dash > .card { margin-bottom: 0; }
.dash + .card, .dash + .dash, .card + .dash { margin-top: var(--gap); }
.dash { margin-bottom: var(--gap); }
@media (min-width: 720px) { .dash { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dash > .hero { grid-column: 1 / -1; } }
@media (min-width: 1180px) { .dash:not(.two) { grid-template-columns: repeat(3, minmax(0, 1fr)); } .dash > .hero { grid-column: span 1; grid-row: span 1; } }

/* Saludo */
.greet { margin: 4px 2px 16px; }
.greet-date { color: var(--muted); font-size: .86rem; margin: 0 0 2px; font-weight: 600; }
.greet h1 { font-size: 1.75rem; }
.greet-sub { color: var(--muted); margin: 6px 0 0; }

/* Héroe */
.hero { color: #fff; border: 0; overflow: hidden; background: linear-gradient(140deg, var(--a1) 0%, var(--a2) 100%); box-shadow: 0 14px 34px var(--accent-soft); }
.hero::before, .hero::after { content: ''; position: absolute; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.28), rgba(255,255,255,0) 70%); pointer-events: none; }
.hero::before { width: 260px; height: 260px; right: -90px; top: -110px; }
.hero::after { width: 200px; height: 200px; left: -80px; bottom: -120px; opacity: .6; }
.hero > * { position: relative; z-index: 1; }
.hero-top { display: flex; align-items: center; justify-content: space-between; }
.hero-ring { position: relative; display: grid; place-items: center; }
.hero-ring span { position: absolute; font-size: .78rem; font-weight: 800; }
.hero .ring-track { stroke: rgba(255,255,255,.25); }
.hero .ring-fill { stroke: #fff; }
.hero-num { font-size: clamp(2.3rem, 10vw, 3.3rem); font-weight: 780; letter-spacing: -.03em; line-height: 1.05; margin: 6px 0 4px; }
.hero-sub { font-size: .86rem; opacity: .9; }
.hero-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.2); }
.hero-stats small { display: block; font-size: .72rem; opacity: .85; }
.hero-stats b { font-size: 1rem; font-weight: 700; white-space: nowrap; }
.hero-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.btn.on-hero { background: #fff; color: #1d1546; min-height: 42px; padding: 8px 14px; }
.btn.on-hero.ghost { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.3); }

.kv-big { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.kv-big b { font-size: 1.7rem; font-weight: 760; letter-spacing: -.02em; }
.kv-big span { color: var(--muted); font-size: .86rem; }
.delta-line { font-size: .84rem; font-weight: 700; margin: 4px 0 8px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.delta-line span { color: var(--muted); font-weight: 500; }
.delta-line.up, .delta.up { color: var(--good); }
.delta-line.down, .delta.down { color: var(--bad); }
.mini-chart { margin: 6px -4px 4px; min-height: 92px; }
.mini-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.mini-stats small { display: block; color: var(--muted); font-size: .76rem; }
.mini-stats b { font-size: 1.05rem; }
.meta-row { display: flex; justify-content: space-between; font-size: .84rem; color: var(--muted); margin: 10px 0 6px; }
.meta-row b { color: var(--text); }
.meter { height: 8px; border-radius: 999px; background: var(--ring-track); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--a1), var(--a2)); }

/* En curso */
.live { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-color: var(--border-strong); }
.live-dot { width: 12px; height: 12px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 0 rgba(239,68,68,.6); animation: pulso 1.8s infinite; flex: none; }
@keyframes pulso { 0% { box-shadow: 0 0 0 0 rgba(239,68,68,.55); } 70% { box-shadow: 0 0 0 12px rgba(239,68,68,0); } 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); } }
.live-txt { flex: 1; display: flex; flex-direction: column; font-size: .88rem; }
.live-txt span { color: var(--muted); }

/* Lo que dicen tus datos */
.insight .card-head h2 .i { color: var(--accent-text); }
.insight-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
@media (min-width: 720px) { .insight-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.ins { background: var(--card-2); border: 1px solid var(--border); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ins small { color: var(--muted); font-size: .76rem; }
.ins b { font-size: 1.08rem; overflow-wrap: anywhere; }
.ins span { font-size: .8rem; color: var(--muted); }
.ins-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ins-list li { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; line-height: 1.45; }
.ins-list li .i { margin-top: 2px; color: var(--accent-text); }
.ins-list li.bien .i { color: var(--good); }
.ins-list li.ojo .i { color: var(--warn); }

/* ---------- Listas ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.li { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-top: 1px solid var(--border); }
.li:first-child { border-top: 0; }
.li.tap { cursor: pointer; border-radius: 10px; }
.li.tap:hover { background: var(--row-hover); }
.li-i { color: var(--accent-text); width: 22px; height: 22px; }
.li-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.li-t b { font-weight: 650; font-size: .94rem; overflow-wrap: anywhere; }
.li-t small { color: var(--muted); font-size: .8rem; }
.li-t small .i { vertical-align: -2px; }
.li-t .when { color: var(--faint); font-size: .74rem; }
.li-v { text-align: right; display: flex; flex-direction: column; gap: 2px; font-variant-numeric: tabular-nums; }
.li-v b { font-weight: 700; white-space: nowrap; }
.li-v small { color: var(--muted); font-size: .76rem; white-space: nowrap; }
.li.read .li-t b { font-weight: 500; color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--mark); margin-right: 6px; vertical-align: 1px; }
.count { font-size: .78rem; font-weight: 700; color: var(--muted); background: var(--card-2); border-radius: 999px; padding: 2px 8px; }

/* Tareas */
.task .check-btn { width: 28px; height: 28px; flex: none; border-radius: 9px; border: 2px solid var(--border-strong); background: transparent; display: grid; place-items: center; color: transparent; padding: 0; }
.task .check-btn .i { width: 16px; height: 16px; stroke-width: 3; }
.task.done .check-btn { background: var(--mark); border-color: var(--mark); color: #fff; }
.task.done .li-t b { text-decoration: line-through; color: var(--muted); }
.task.late .li-t small { color: var(--bad); }
.task { cursor: pointer; }
.prio { font-size: .72rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--card-2); color: var(--muted); display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.prio.alta { color: var(--bad); }
.km-bar { display: block; height: 5px; border-radius: 999px; background: var(--ring-track); overflow: hidden; margin-top: 5px; max-width: 220px; }
.km-bar i { display: block; height: 100%; background: var(--mark); border-radius: 999px; }
.task-sec.late { border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.muted-sec { opacity: .85; }

/* Menú rápido */
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.quick-item { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px; border-radius: 16px; background: var(--card-2); border: 1px solid var(--border); text-align: left; text-decoration: none; color: var(--text); min-height: 104px; }
.quick-item:hover { background: var(--row-hover); }
.quick-item .i { color: var(--accent-text); }
.quick-item b { font-size: .95rem; }
.quick-item small { color: var(--muted); font-size: .78rem; line-height: 1.3; }
.quick-grid .quick-item:first-child:nth-last-child(odd) { grid-column: 1 / -1; }

/* ---------- Formularios ---------- */
.form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin-bottom: 12px; }
.form .field { margin-bottom: 0; }
.field > span { font-size: .82rem; font-weight: 650; color: var(--muted); }
.field.big > span { font-size: 1.1rem; color: var(--text); }
.field.inline { flex-direction: row; align-items: center; justify-content: space-between; margin: 6px 0 10px; }
.field.inline input { max-width: 140px; }
input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=file]), select, textarea { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--input-border); background: var(--input); color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { border-color: var(--mark); box-shadow: 0 0 0 3px var(--accent-soft); }
.field.big input { min-height: 56px; font-size: 1.15rem; border-radius: 14px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.row2, .row3 { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row3 { grid-template-columns: 1.3fr 1fr 1fr; }
@media (max-width: 480px) { .row3 { grid-template-columns: 1fr 1fr; } .row3 > :first-child { grid-column: 1 / -1; } }
.form-errs { margin: 0; padding: 10px 12px 10px 30px; border-radius: 12px; background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); font-size: .86rem; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 14px; background: var(--card-2); border: 1px solid var(--border); cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--a1); margin-top: 2px; flex: none; }
.check span { display: flex; flex-direction: column; gap: 2px; }
.check small { color: var(--muted); font-size: .8rem; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-top: 1px solid var(--border); cursor: pointer; }
.switch-row:first-of-type { border-top: 0; }
.switch-row span { display: flex; flex-direction: column; gap: 2px; }
.switch-row small { color: var(--muted); font-size: .8rem; }
.switch-row.big b { font-size: 1.02rem; }
input[role=switch] { appearance: none; width: 50px; height: 30px; border-radius: 999px; background: var(--border-strong); position: relative; flex: none; cursor: pointer; transition: background .2s; }
input[role=switch]::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
input[role=switch]:checked { background: var(--a1); }
input[role=switch]:checked::after { transform: translateX(20px); }
input[role=switch]:disabled { opacity: .4; }
.fold { border: 1px dashed var(--border-strong); border-radius: 14px; padding: 0 12px; }
.fold summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 12px 0; cursor: pointer; font-weight: 650; font-size: .92rem; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary span { flex: 1; }
.fold[open] .chev, .guide[open] .chev { transform: rotate(180deg); }
.chev { transition: transform .2s; color: var(--muted); }
.fold-body { padding-bottom: 12px; }
.preview:empty { display: none; }
.prev-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 12px; border-radius: 14px; background: var(--accent-soft); }
.prev-grid small { display: block; font-size: .72rem; color: var(--muted); }
.prev-grid b { font-size: .92rem; white-space: nowrap; }
@media (max-width: 380px) { .prev-grid { grid-template-columns: repeat(2, 1fr); } }
.meta-line { color: var(--faint); font-size: .76rem; margin: 0; display: flex; align-items: center; gap: 5px; }
.calc-metas { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.calc-metas .field { flex: 0 0 170px; margin: 0; }
.edit-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.edit-list li { display: flex; gap: 8px; align-items: center; }
.add-row { display: flex; gap: 8px; margin-bottom: 12px; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; margin-bottom: 12px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--chip-bg); color: var(--text); font-size: .88rem; font-weight: 600; white-space: nowrap; transition: background .15s, color .15s; }
.chip .i { width: 16px; height: 16px; color: var(--accent-text); }
.chip.on { background: linear-gradient(135deg, var(--a1), var(--a2)); border-color: transparent; color: #fff; }
.chip.on .i { color: #fff; }
.chip.ghost { border-style: dashed; }
.chips.tight .chip { padding: 6px 11px; }

/* Control segmentado */
.seg-ctl { display: inline-flex; gap: 3px; padding: 3px; border-radius: 13px; background: var(--seg-bg); border: 1px solid var(--border); max-width: 100%; }
.seg-ctl button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 650; font-size: .88rem; white-space: nowrap; }
.seg-ctl button.on { background: var(--seg-on); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg-ctl.wide { display: flex; width: 100%; margin-bottom: 12px; }
.seg-ctl.compact button { padding: 5px 10px; min-height: 32px; font-size: .82rem; }
.seg-ctl.icons button { padding: 5px 9px; }
.seg-ctl.scroll { overflow-x: auto; scrollbar-width: none; margin-bottom: 10px; }
.card .seg-ctl { margin-bottom: 10px; }

/* Barra de herramientas (una fila sobre lo que filtra) */
.toolbar { display: flex; align-items: center; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 4px; margin: 0 -2px 8px; }
.toolbar::-webkit-scrollbar { display: none; }
.toolbar > * { flex: none; }
.tool { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 7px 13px; border-radius: 12px; border: 1px solid var(--border); background: var(--card-2); color: var(--text); font-weight: 600; font-size: .86rem; white-space: nowrap; text-decoration: none; }
.tool.on { border-color: var(--mark); color: var(--accent-text); background: var(--accent-soft); }
.tool[disabled] { opacity: .4; }
.period-label { font-weight: 700; font-size: .95rem; padding: 0 4px; white-space: nowrap; }
.range-line { color: var(--muted); font-size: .82rem; margin: 0 2px 10px; }
.count-line { margin: 4px 2px 8px; }

/* Franja de totales */
.sumstrip { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; margin-bottom: 10px; }
.sumstrip::-webkit-scrollbar { display: none; }
.sum-chip { flex: none; padding: 9px 13px; border-radius: 14px; background: var(--card); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--border); display: flex; flex-direction: column; }
.sum-chip small { font-size: .72rem; color: var(--muted); }
.sum-chip b { font-size: .98rem; white-space: nowrap; }
.sum-chip.hl { background: linear-gradient(135deg, var(--a1), var(--a2)); color: #fff; border-color: transparent; }
.sum-chip.hl small { color: rgba(255,255,255,.85); }

/* Cifras */
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
@media (min-width: 720px) { .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .stats-grid:not(.rep) { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.stat { background: var(--card); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--border); border-radius: 16px; padding: 12px 13px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.card .stat { background: var(--card-2); -webkit-backdrop-filter: none; backdrop-filter: none; }
.stat .lbl { font-size: .76rem; color: var(--muted); font-weight: 600; }
.stat .val { font-size: 1.22rem; font-weight: 740; letter-spacing: -.01em; overflow-wrap: anywhere; }
.stat.hl { background: linear-gradient(135deg, var(--a1), var(--a2)); border-color: transparent; color: #fff; }
.stat.hl .lbl, .stat.hl .sub { color: rgba(255,255,255,.88); }
.stat.hl .delta { color: #fff; }
.stat .sub { font-size: .74rem; color: var(--muted); }
.delta { font-size: .76rem; font-weight: 700; display: inline-flex; align-items: center; gap: 2px; }
.delta.neutral { color: var(--muted); }
.delta .vs { font-weight: 500; color: var(--muted); }

/* ---------- Tablas ---------- */
.tbl-wrap { overflow: auto; max-height: 72vh; border-radius: 14px; border: 1px solid var(--border); background: var(--card); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); margin-bottom: 12px; }
.tbl-wrap.twin { max-height: 420px; }
.card .tbl-wrap { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
.tbl { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .86rem; font-variant-numeric: tabular-nums; }
.tbl th { position: sticky; top: 0; z-index: 2; background: var(--th-bg); text-align: left; font-weight: 650; color: var(--muted); padding: 0; white-space: nowrap; border-bottom: 1px solid var(--border); }
.tbl th button { width: 100%; border: 0; background: none; padding: 10px 11px; text-align: inherit; font-weight: 650; color: inherit; display: flex; align-items: center; gap: 4px; justify-content: inherit; }
.tbl th.n button { justify-content: flex-end; }
.tbl th:not(:has(button)) { padding: 10px 11px; }
.tbl th.sorted { color: var(--accent-text); }
.tbl td { padding: 10px 11px; border-top: 1px solid var(--border); white-space: nowrap; }
.tbl tbody tr:first-child td { border-top: 0; }
.tbl .n { text-align: right; }
.tbl td.wrap { white-space: normal; min-width: 180px; }
.tbl tbody tr:nth-child(even) td { background: var(--zebra); }
.tbl tbody tr[data-row], .tbl tbody tr[data-dia] { cursor: pointer; }
.tbl tbody tr[data-row]:hover td, .tbl tbody tr[data-dia]:hover td { background: var(--row-hover); }
.tbl tr.off td { color: var(--faint); }
.tbl tfoot td { position: sticky; bottom: 0; z-index: 2; background: var(--th-bg); font-weight: 750; border-top: 1px solid var(--border-strong); }
.tbl th:first-child, .tbl td:first-child { position: sticky; left: 0; z-index: 1; box-shadow: inset -1px 0 0 var(--border); }
.tbl td:first-child, .tbl tbody tr:nth-child(even) td:first-child { background: var(--th-bg); }
.tbl th:first-child, .tbl tfoot td:first-child { z-index: 3; }

/* Tarjetas de datos */
.dcards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-bottom: 12px; }
.dcard { background: var(--card); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--border); border-radius: 16px; padding: 13px; cursor: pointer; box-shadow: var(--shadow); }
.dcard:hover { border-color: var(--border-strong); }
.dcard header { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.dcard header b { font-size: .92rem; }
.dcard-v { font-weight: 760; font-size: 1.1rem; text-align: right; white-space: nowrap; display: flex; flex-direction: column; }
.dcard-v small { font-size: .7rem; color: var(--muted); font-weight: 600; }
.dcard-kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px; }
.dcard-kv small { display: block; color: var(--muted); font-size: .7rem; }
.dcard-kv b { font-size: .86rem; font-weight: 650; overflow-wrap: anywhere; }
.dlist { background: var(--card); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--border); border-radius: 16px; padding: 4px 12px; margin-bottom: 12px; }

/* ---------- Gráficos ---------- */
.chart-card .card-head { margin-bottom: 8px; }
.chart-box { width: 100%; }
.chart { display: block; max-width: 100%; overflow: visible; font-family: var(--font); }
.c-grid { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.c-axis { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.c-tick { fill: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.c-bar { fill: var(--mark); transition: opacity .15s, filter .15s; }
.c-bar.dim { fill: var(--mark-dim); }
.c-bar.hl { fill: var(--mark); }
.c-bar.on { filter: brightness(1.2) saturate(1.1); }
.c-hit { fill: transparent; cursor: pointer; }
.c-val { fill: var(--text); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; paint-order: stroke; stroke: var(--card-solid); stroke-width: 3px; stroke-linejoin: round; }
.c-ref { stroke: var(--line-2); stroke-width: 1; }
.c-ref-t { fill: var(--muted); font-size: 10px; font-weight: 600; paint-order: stroke; stroke: var(--card-solid); stroke-width: 3px; stroke-linejoin: round; }
.c-cell { fill: var(--mark); cursor: pointer; }
.c-cell.on { stroke: var(--text); stroke-width: 1.5; }
.c-empty { fill: var(--cell-empty); }
.c-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.c-line.l1 { stroke: var(--mark); }
.c-line.l2 { stroke: var(--line-2); }
.c-area.l1 { fill: var(--mark); opacity: .1; }
.c-dot { fill: var(--mark); stroke: var(--card-solid); stroke-width: 2; }
.c-cross { stroke: var(--axis); stroke-width: 1; }
.c-over { fill: transparent; cursor: crosshair; outline: none; }
.heat-legend { display: flex; align-items: center; gap: 8px; justify-content: flex-end; font-size: .74rem; color: var(--muted); margin-top: 8px; }
.heat-ramp { width: 120px; height: 9px; border-radius: 999px; background: linear-gradient(90deg, var(--mark-14), var(--mark)); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; font-size: .84rem; color: var(--muted); }
.legend.lines { margin: 0 0 8px; }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg b { color: var(--text); font-weight: 700; }
.sw { width: 11px; height: 11px; border-radius: 3px; display: inline-block; flex: none; }
.lk { width: 16px; height: 2px; border-radius: 2px; display: inline-block; }
.lk.l1 { background: var(--mark); } .lk.l2 { background: var(--line-2); }
.sw.c1, .seg.c1 { background: var(--c1); } .sw.c2, .seg.c2 { background: var(--c2); } .sw.c3, .seg.c3 { background: var(--c3); }
.sw.c4, .seg.c4 { background: var(--c4); } .sw.c5, .seg.c5 { background: var(--c5); } .sw.c6, .seg.c6 { background: var(--c6); }
.segbar { display: flex; gap: 2px; height: 28px; width: 100%; }
.seg { border-radius: 4px; min-width: 3px; display: flex; align-items: center; padding: 0 8px; color: #fff; font-size: .78rem; font-weight: 750; cursor: pointer; outline-offset: 1px; }
.seg.c6 span { color: #0b0b0b; }
.seg.on { filter: brightness(1.12); }
.rank { display: flex; flex-direction: column; gap: 10px; }
.rank-row { display: grid; grid-template-columns: minmax(84px, 36%) 1fr auto; align-items: center; gap: 10px; cursor: default; border-radius: 8px; }
.rank-name { font-size: .88rem; font-weight: 650; min-width: 0; display: flex; flex-direction: column; }
.rank-name small { color: var(--muted); font-size: .72rem; font-weight: 500; }
.cats-box { margin-top: 16px; }
.rank-track { height: 12px; }
.rank-bar { height: 100%; border-radius: 0 4px 4px 0; background: var(--mark); transition: filter .15s; }
.rank-bar.dim { background: var(--mark-dim); }
.rank-row.on .rank-bar { filter: brightness(1.2); }
.rank-val { font-size: .86rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ring-track { fill: none; stroke: var(--ring-track); }
.ring-fill { fill: none; stroke: var(--mark); stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.spark polyline { fill: none; stroke: var(--line-2); stroke-width: 2; stroke-linejoin: round; }
.spark circle { fill: var(--mark); }

/* Tooltip */
#tip { position: fixed; z-index: 90; pointer-events: none; max-width: 260px; padding: 8px 11px; border-radius: 11px; background: var(--tip-bg); color: var(--tip-text); box-shadow: 0 8px 24px rgba(0,0,0,.28); font-size: .82rem; line-height: 1.35; }
.tip-v { font-weight: 800; font-size: .92rem; font-variant-numeric: tabular-nums; }
.tip-l { color: var(--tip-muted); }
.tip-row { display: flex; align-items: center; gap: 7px; }
.tip-row b { font-variant-numeric: tabular-nums; }
.tip-n { color: var(--tip-muted); }
.tip-key { width: 14px; height: 2px; border-radius: 2px; flex: none; }
.tip-key.l1 { background: var(--mark); } .tip-key.l2 { background: var(--tip-muted); }

/* Franjas */
.franjas { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.franjas li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--card-2); border: 1px solid var(--border); }
.franjas li:first-child { border-color: var(--mark); background: var(--accent-soft); }
.rank-n { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; background: var(--seg-on); flex: none; }
.franjas li:first-child .rank-n { background: linear-gradient(135deg, var(--a1), var(--a2)); color: #fff; }
.franjas li div { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.franjas small { color: var(--muted); font-size: .78rem; }
.fr-v { font-size: 1.1rem; white-space: nowrap; }
.fr-v small { font-size: .74rem; }

/* Reporte */
.report-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.report { padding: 0; overflow: hidden; }
.report > :not(.rep-head) { margin-left: 16px; margin-right: 16px; }
.rep-head { padding: 18px 16px; color: #fff; background: linear-gradient(135deg, var(--a1), var(--a2)); margin-bottom: 14px; }
.rep-head h2 { font-size: 1.35rem; margin: 4px 0 2px; }
.rep-head p { margin: 0; opacity: .9; font-size: .9rem; }
.rep-sec { padding-top: 14px; margin-top: 10px; border-top: 1px solid var(--border); }
.rep-foot { padding: 12px 0 16px; }
.report .stats-grid { margin-top: 4px; }

/* ---------- Hojas (bottom sheets) ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; }
.sheet-backdrop { position: absolute; inset: 0; background: var(--backdrop); opacity: 0; transition: opacity .22s; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column; background: var(--sheet-bg); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border-radius: 24px 24px 0 0; border: 1px solid var(--border); border-bottom: 0; box-shadow: 0 -12px 40px rgba(0,0,0,.3); transform: translateY(102%); transition: transform .26s cubic-bezier(.2,.8,.2,1); outline: none; }
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-grip { width: 42px; height: 5px; border-radius: 999px; background: var(--border-strong); margin: 9px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 8px 16px 10px; flex: none; }
.sheet-head h2 { flex: 1; font-size: 1.15rem; }
.sheet-body { padding: 4px 16px 16px; overflow-y: auto; overscroll-behavior: contain; }
.sheet-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); flex: none; }
.sheet-foot .btn { flex: 1 1 auto; }
.sheet-foot .btn.primary { flex: 2 1 auto; }
@media (min-width: 720px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: min(600px, 92vw); max-height: 86vh; border-radius: 22px; border-bottom: 1px solid var(--border); transform: translate(-50%, -46%) scale(.97); opacity: 0; transition: transform .22s, opacity .22s; }
  .sheet-wrap.open .sheet { transform: translate(-50%, -50%); opacity: 1; }
  .sheet.sheet-sm { width: min(460px, 92vw); }
  .sheet-grip { display: none; }
  .sheet-head { padding-top: 16px; }
}
.opts { display: flex; flex-direction: column; gap: 2px; }
.opt { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 10px; padding: 11px 12px; border-radius: 12px; border: 0; background: transparent; text-align: left; color: var(--text); }
.opt:hover { background: var(--row-hover); }
.opt.on { background: var(--accent-soft); }
.opt-t { font-weight: 650; }
.opt small { grid-column: 1; color: var(--muted); font-size: .78rem; }
.opt .chk { grid-row: 1 / span 2; grid-column: 2; color: var(--accent-text); stroke-width: 3; }
.custom-range { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 12px; }
.lbl { font-weight: 700; font-size: .86rem; color: var(--muted); margin-bottom: 8px; }
.col-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.col-item { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 12px; }
.col-item.on { background: var(--card-2); }
.col-item label { flex: 1; display: flex; align-items: center; gap: 10px; cursor: pointer; min-height: 34px; font-size: .92rem; }
.col-item input { width: 20px; height: 20px; accent-color: var(--a1); }

/* Avisos flotantes */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + 88px + env(safe-area-inset-bottom)); z-index: 80; display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
@media (min-width: 960px) { #toasts { bottom: 28px; left: calc(50% + var(--rail-w) / 2); } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--tip-bg); color: var(--tip-text); box-shadow: 0 10px 30px rgba(0,0,0,.3); font-size: .9rem; font-weight: 600; opacity: 0; transform: translateY(10px); transition: opacity .22s, transform .22s; }
.toast.show { opacity: 1; transform: none; }
.toast span { flex: 1; }
.toast.error { background: #b42324; color: #fff; }
.toast-btn { border: 0; background: none; color: var(--a1); font-weight: 800; padding: 4px 6px; }
body[data-tema="cristal"] .toast-btn, body[data-tema="nocturno"] .toast-btn, body[data-tema="amoled"] .toast-btn { color: #5b21b6; }

/* Vacíos */
.empty { text-align: center; padding: 22px 8px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty > .i { color: var(--accent-text); opacity: .9; }
.empty h3 { font-size: 1.1rem; margin: 4px 0 0; }
.empty p { color: var(--muted); max-width: 420px; }
.empty-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ---------- Bienvenida ---------- */
.ob { max-width: 500px; margin: 0 auto; padding: calc(16px + env(safe-area-inset-top)) 4px 24px; display: flex; flex-direction: column; gap: 16px; }
.ob-steps { display: flex; gap: 6px; justify-content: center; }
.ob-steps i { width: 26px; height: 5px; border-radius: 999px; background: var(--border-strong); }
.ob-steps i.on { background: linear-gradient(90deg, var(--a1), var(--a2)); }
.ob-hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 10px; }
.logo { width: 88px; height: 88px; filter: drop-shadow(0 12px 26px var(--accent-soft)); }
.logo-sm { width: 72px; height: 72px; }
.logo-md { width: 76px; height: 76px; }
.ob-hero h1 { font-size: 2.1rem; font-weight: 800; }
.ob-lead { color: var(--muted); font-size: 1.02rem; margin: 0; }
.ob-hello h1 { font-size: 1.8rem; }
.ob-hello .ob-lead { margin-top: 6px; }
.ob-feats { list-style: none; margin: 0; padding: 14px; display: flex; flex-direction: column; gap: 12px; background: var(--card); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--border); border-radius: 18px; }
.ob-feats li { display: flex; gap: 12px; align-items: center; font-size: .93rem; }
.ob-feats .i { color: var(--accent-text); width: 22px; height: 22px; }
.ob-form { display: flex; flex-direction: column; gap: 12px; }
.ob-form .field { margin: 0; }
.saludo-capa { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: linear-gradient(140deg, var(--a1), var(--a2)); color: #fff; opacity: 0; transition: opacity .4s; }
.saludo-capa.on { opacity: 1; }
.saludo-capa.fuera { opacity: 0; }
.saludo-caja { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; transform: translateY(12px); transition: transform .6s cubic-bezier(.2,.8,.2,1); padding: 20px; }
.saludo-capa.on .saludo-caja { transform: none; }
.saludo-caja h1 { font-size: 2rem; }
.saludo-caja p { opacity: .9; margin: 0; }
.saludo-caja rect { fill: rgba(255,255,255,.2); }

/* Temas y colores */
.theme-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 720px) { .theme-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.theme-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 8px 10px; border-radius: 16px; border: 2px solid var(--border); background: var(--card-2); text-align: left; color: var(--text); }
.theme-card.on { border-color: var(--mark); }
.theme-card b { font-size: .9rem; padding: 0 4px; }
.theme-card small { color: var(--muted); font-size: .74rem; padding: 0 4px; }
.theme-card .chk { position: absolute; top: 12px; right: 12px; color: #fff; background: var(--a1); border-radius: 50%; padding: 3px; width: 22px; height: 22px; stroke-width: 3; }
.theme-prev { position: relative; display: block; width: 100%; height: 78px; border-radius: 11px; overflow: hidden; margin-bottom: 6px; }
.tp-blob { position: absolute; width: 60px; height: 60px; border-radius: 50%; filter: blur(14px); left: -10px; top: -14px; opacity: .8; }
.tp-blob.b { left: auto; right: -14px; top: auto; bottom: -20px; }
.tp-card { position: absolute; left: 14px; right: 14px; top: 16px; bottom: 12px; border-radius: 9px; border: 1px solid; display: flex; flex-direction: column; gap: 5px; padding: 8px; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.tp-bar { height: 12px; border-radius: 4px; width: 70%; }
.tp-line { height: 5px; border-radius: 3px; width: 85%; opacity: .7; }
.tp-line.s { width: 55%; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 44px; height: 44px; border-radius: 14px; border: 2px solid transparent; display: grid; place-items: center; color: #fff; position: relative; box-shadow: 0 3px 10px rgba(0,0,0,.18); cursor: pointer; }
.swatch.on { border-color: var(--text); }
.swatch .i { stroke-width: 3; }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }

/* Más */
.profile { display: flex; align-items: center; gap: 14px; }
.profile > div:nth-child(2) { flex: 1; min-width: 0; }
.profile h2 { font-size: 1.2rem; }
.menu { padding: 6px; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; text-decoration: none; color: var(--text); }
.menu-item:hover { background: var(--row-hover); }
.mi-i { width: 36px; height: 36px; padding: 8px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-text); }
.mi-t { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.mi-t b { font-weight: 650; }
.mi-t small { color: var(--muted); font-size: .8rem; }
.mi-c { color: var(--faint); }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); }

/* Historial */
.timeline { list-style: none; margin: 0; padding: 0; }
.tl-day { font-weight: 750; font-size: .84rem; color: var(--muted); padding: 12px 0 6px; }
.tl-day:first-child { padding-top: 0; }
.tl-item { display: flex; gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); }
.tl-item > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tl-item b { font-weight: 600; font-size: .9rem; overflow-wrap: anywhere; }
.tl-item small { color: var(--muted); font-size: .78rem; }
.tl-item .chg { color: var(--accent-text); overflow-wrap: anywhere; }

/* Guía */
.guide { background: var(--card); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--border); border-radius: 16px; margin-bottom: 10px; box-shadow: var(--shadow); }
.guide summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; font-weight: 700; }
.guide summary::-webkit-details-marker { display: none; }
.guide summary > .i:first-child { color: var(--accent-text); }
.guide summary span { flex: 1; }
.guide-body { padding: 0 16px 14px; font-size: .93rem; line-height: 1.55; }
.guide-body ul, .guide-body ol { padding-left: 20px; margin: 6px 0 10px; }
.guide-body li { margin-bottom: 6px; }
.about { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.about-list { list-style: none; padding: 0; margin: 10px 0 0; text-align: left; display: flex; flex-direction: column; gap: 10px; }
.about-list li { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; }
.about-list .i { color: var(--accent-text); margin-top: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (forced-colors: active) {
  .c-bar, .c-cell, .seg, .rank-bar { forced-color-adjust: none; }
}
