/* ==========================================================================
   Naike App · sistema visual
   Mobile-first. Tokens en :root, modo oscuro por sistema o elección manual.
   ========================================================================== */

:root {
    --bg: #F2F1EB;
    --surface: #FFFFFF;
    --surface-2: #F7F6F1;
    --surface-3: #ECEAE2;
    --ink: #121512;
    --ink-2: #3B403C;
    --muted: #767B75;
    --line: #E3E1D8;
    --line-strong: #D3D0C5;

    --brand: #15301F;
    --brand-2: #1F4430;
    --brand-ink: #F2F1EB;
    --meter: #15301F;
    --accent: #C8F15A;
    --accent-ink: #142010;

    --ok: #23804F;      --ok-bg: #E2F1E7;
    --warn: #A86A12;    --warn-bg: #FAEFD9;
    --danger: #BE3B28;  --danger-bg: #FBE5DF;
    --info: #2C5DB0;    --info-bg: #E2EAF8;
    --neutral: #5D625C; --neutral-bg: #ECEBE5;
    --accent-tone: #3F5A0E; --accent-bg: #EDF8CF;

    --r-xl: 26px;
    --r-lg: 20px;
    --r-md: 14px;
    --r-sm: 10px;

    --shadow: 0 1px 0 rgba(18, 21, 18, .03), 0 10px 30px -18px rgba(21, 48, 31, .28);
    --shadow-up: 0 -10px 40px -20px rgba(21, 48, 31, .35);
    --glass: rgba(255, 255, 255, .78);
    --topbar: rgba(242, 241, 235, .82);

    --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

    --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-t: env(safe-area-inset-top, 0px);
    --tabbar-h: 68px;
    --gutter: 16px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0D100E; --surface: #151916; --surface-2: #1B201C; --surface-3: #232A25;
        --ink: #ECEEE7; --ink-2: #C3C8C0; --muted: #8C928A; --line: #252B26; --line-strong: #323A34;
        --brand: #1A3526; --brand-2: #22452F; --brand-ink: #ECEEE7; --meter: #C8F15A;
        --ok: #5CC489; --ok-bg: #16281D; --warn: #E3A94A; --warn-bg: #2C2213;
        --danger: #F07A64; --danger-bg: #2E1915; --info: #7FA6F0; --info-bg: #162035;
        --neutral: #A3A9A1; --neutral-bg: #222823; --accent-tone: #C8F15A; --accent-bg: #222D12;
        --shadow: 0 1px 0 rgba(0,0,0,.2), 0 12px 30px -18px rgba(0,0,0,.7);
        --shadow-up: 0 -10px 40px -18px rgba(0,0,0,.8);
        --glass: rgba(21, 25, 22, .78); --topbar: rgba(13, 16, 14, .8);
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #0D100E; --surface: #151916; --surface-2: #1B201C; --surface-3: #232A25;
    --ink: #ECEEE7; --ink-2: #C3C8C0; --muted: #8C928A; --line: #252B26; --line-strong: #323A34;
    --brand: #1A3526; --brand-2: #22452F; --brand-ink: #ECEEE7; --meter: #C8F15A;
    --ok: #5CC489; --ok-bg: #16281D; --warn: #E3A94A; --warn-bg: #2C2213;
    --danger: #F07A64; --danger-bg: #2E1915; --info: #7FA6F0; --info-bg: #162035;
    --neutral: #A3A9A1; --neutral-bg: #222823; --accent-tone: #C8F15A; --accent-bg: #222D12;
    --shadow: 0 1px 0 rgba(0,0,0,.2), 0 12px 30px -18px rgba(0,0,0,.7);
    --shadow-up: 0 -10px 40px -18px rgba(0,0,0,.8);
    --glass: rgba(21, 25, 22, .78); --topbar: rgba(13, 16, 14, .8);
    color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 400 15px/1.45 var(--font);
    letter-spacing: -0.005em;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
    overflow-x: clip;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.025em; }
p { margin: 0; }
.i { flex: none; display: block; }
.num { font-family: var(--mono); font-feature-settings: "tnum" 1; letter-spacing: -0.02em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xsmall { font-size: 12px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.stack { display: grid; gap: 12px; }
.stack-lg { display: grid; gap: 22px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.mt { margin-top: 12px; } .mt-lg { margin-top: 24px; }
.center { text-align: center; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* ---------- Estructura de app ---------- */
.app { min-height: 100dvh; }
.screen {
    min-width: 0;
    padding: 0 var(--gutter) calc(var(--tabbar-h) + var(--safe-b) + 40px);
    max-width: 760px;
    margin: 0 auto;
    animation: entrar .28s ease-out both;
}
body.no-tabbar .screen { padding-bottom: calc(110px + var(--safe-b)); }
@keyframes entrar { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.topbar {
    position: sticky; top: 0; z-index: 30;
    margin: 0 calc(var(--gutter) * -1);
    padding: calc(var(--safe-t) + 10px) var(--gutter) 10px;
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px;
    background: transparent;
    transition: background .2s, box-shadow .2s;
}
.topbar.scrolled {
    background: var(--topbar);
    -webkit-backdrop-filter: saturate(1.6) blur(18px);
    backdrop-filter: saturate(1.6) blur(18px);
    box-shadow: 0 1px 0 var(--line);
}
.topbar-title {
    font-weight: 600; font-size: 16px; letter-spacing: -0.02em; text-align: center;
    opacity: 0; transform: translateY(4px); transition: .2s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.topbar.scrolled .topbar-title { opacity: 1; transform: none; }
.topbar-start, .topbar-end { display: flex; align-items: center; gap: 6px; }
.topbar-end { justify-content: flex-end; }

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -0.03em; font-size: 17px; }
.brand-mark { width: 32px; height: 32px; flex: none; }

.hero-title { padding: 6px 2px 18px; }
.hero-title .eyebrow { margin-bottom: 6px; }
.hero-title h1 { overflow-wrap: anywhere; font-size: 32px; line-height: 1.05; letter-spacing: -0.04em; font-weight: 650; }
.hero-title p { margin-top: 8px; color: var(--muted); max-width: 52ch; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* ---------- Barra de pestañas ---------- */
.tabbar {
    position: fixed; z-index: 40;
    left: 12px; right: 12px; bottom: calc(10px + var(--safe-b));
    height: var(--tabbar-h);
    display: grid; grid-template-columns: repeat(5, 1fr);
    padding: 7px;
    background: var(--glass);
    -webkit-backdrop-filter: saturate(1.8) blur(22px);
    backdrop-filter: saturate(1.8) blur(22px);
    border: 1px solid var(--line);
    border-radius: 26px;
    box-shadow: var(--shadow-up);
    max-width: 520px; margin: 0 auto;
}
body.no-tabbar .tabbar, body.no-tabbar .fab { display: none; }
.tab {
    display: grid; place-items: center; align-content: center; gap: 3px;
    border-radius: 19px; color: var(--muted);
    font-size: 11px; font-weight: 550; letter-spacing: -0.01em;
    position: relative; transition: color .2s;
}
.tab-ico { width: 46px; height: 30px; display: grid; place-items: center; border-radius: 999px; transition: background .25s, color .25s, transform .2s; }
.tab:active .tab-ico { transform: scale(.92); }
.tab.active { color: var(--ink); }
.tab.active .tab-ico { background: var(--accent); color: var(--accent-ink); }
.tab .dot {
    position: absolute; top: 4px; left: calc(50% + 8px);
    min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px;
    background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center;
    border: 2px solid var(--surface);
}

.fab {
    position: fixed; z-index: 41;
    right: 18px; bottom: calc(var(--tabbar-h) + 24px + var(--safe-b));
    width: 56px; height: 56px; border-radius: 20px; border: 0;
    background: var(--brand); color: var(--accent);
    display: grid; place-items: center; cursor: pointer;
    box-shadow: 0 14px 30px -12px rgba(21, 48, 31, .6), inset 0 1px 0 rgba(255,255,255,.08);
    transition: transform .18s, border-radius .25s;
}
.fab:active { transform: scale(.94); border-radius: 26px; }

.desk-main, .desk-2, .desk-3 { display: grid; gap: 22px; min-width: 0; }
.desk-main > *, .desk-2 > * { min-width: 0; }

/* Riel lateral en escritorio */
.rail { display: none; }

@media (min-width: 1024px) {
    :root { --gutter: 32px; }
    .app { display: grid; grid-template-columns: 264px 1fr; }
    .rail {
        display: flex; flex-direction: column; gap: 4px;
        position: sticky; top: 0; height: 100dvh; overflow-y: auto;
        padding: 26px 16px 20px;
        border-right: 1px solid var(--line);
        background: var(--surface-2);
    }
    .rail .brand { padding: 0 10px 22px; }
    .rail-group { margin: 14px 10px 6px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
    .rail a.rail-link {
        display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 12px;
        color: var(--ink-2); font-weight: 500; font-size: 14px;
    }
    .rail a.rail-link:hover { background: var(--surface-3); }
    .rail a.rail-link.active { background: var(--brand); color: var(--brand-ink); }
    .rail a.rail-link.active .i { color: var(--accent); }
    .rail .badge { margin-left: auto; }
    .rail-foot { margin-top: auto; padding: 18px 10px 0; font-size: 12px; color: var(--muted); }
    .rail-new { margin: 0 4px 10px; }
    .screen { max-width: 1080px; padding-bottom: 60px; }
    body.no-tabbar .screen { padding-bottom: 120px; }
    .tabbar { display: none; }
    .fab { display: none; }
    .topbar { grid-template-columns: auto 1fr auto; }
    .topbar-start .brand { display: none !important; }
    .topbar-title { text-align: left; }
    .hero-title h1 { font-size: 38px; }
    .desk-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
    .desk-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
    .desk-main { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 22px; align-items: start; }
}

/* ---------- Botones ---------- */
.btn {
    --h: 48px;
    height: var(--h); padding: 0 18px; border-radius: 15px; border: 1px solid transparent;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-weight: 600; font-size: 15px; cursor: pointer; white-space: nowrap;
    background: var(--surface-3); color: var(--ink);
    transition: transform .15s, background .2s, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary .i { color: var(--accent); }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: transparent; border-color: var(--line-strong); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-sm { --h: 38px; padding: 0 13px; font-size: 13.5px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-loading { opacity: .6; pointer-events: none; }
.btn.is-loading::after {
    content: ""; width: 15px; height: 15px; border-radius: 50%;
    border: 2px solid currentColor; border-right-color: transparent; animation: girar .7s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

.icon-btn {
    width: 42px; height: 42px; border-radius: 14px; border: 1px solid var(--line);
    display: inline-grid; place-items: center; background: var(--surface); color: var(--ink);
    cursor: pointer; position: relative; transition: transform .15s;
}
.icon-btn:active { transform: scale(.94); }
.icon-btn.plain { border-color: transparent; background: transparent; }
.icon-btn .dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--surface); }

.link { color: var(--ink); font-weight: 600; font-size: 13.5px; display: inline-flex; align-items: center; gap: 4px; }
.link .i { color: var(--muted); }

/* ---------- Tarjetas ---------- */
.card {
    background: var(--surface); border-radius: var(--r-lg); padding: 18px;
    box-shadow: var(--shadow); border: 1px solid var(--line);
}
.card-flat { box-shadow: none; }
.card-tight { padding: 14px; }
.card-hero {
    position: relative; overflow: hidden;
    background: var(--brand); color: var(--brand-ink);
    border-radius: var(--r-xl); padding: 22px; border: 0;
    box-shadow: 0 20px 40px -24px rgba(21, 48, 31, .7);
}
.card-hero::after {
    content: ""; position: absolute; inset: auto -40px -70px auto; width: 240px; height: 240px; border-radius: 50%;
    background: radial-gradient(closest-side, rgba(200, 241, 90, .22), transparent);
    pointer-events: none;
}
.card-hero .muted { color: rgba(242, 241, 235, .62); }
.card-hero .eyebrow { color: rgba(242, 241, 235, .62); }
.furrows { position: absolute; right: -10px; top: 0; height: 100%; opacity: .14; pointer-events: none; }

.section { margin-top: 28px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 2px 12px; }
.section-head h2 { font-size: 19px; letter-spacing: -0.03em; }
.section-head .count { color: var(--muted); font-weight: 500; margin-left: 6px; font-size: 15px; }

/* ---------- Indicadores ---------- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
    padding: 14px 14px 13px; display: grid; gap: 10px; box-shadow: var(--shadow); position: relative;
}
.stat-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stat-val { font-family: var(--mono); font-size: 26px; font-weight: 500; letter-spacing: -0.04em; line-height: 1; }
.stat-val small { font-size: 13px; color: var(--muted); font-family: var(--font); letter-spacing: 0; margin-left: 3px; }
.stat.tone-danger .stat-val { color: var(--danger); }
.stat.tone-warn .stat-val { color: var(--warn); }
.stat.tone-ok .stat-val { color: var(--ok); }

.tile-ico {
    width: 40px; height: 40px; border-radius: 13px; flex: none;
    display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2);
}
.tile-ico.sm { width: 34px; height: 34px; border-radius: 11px; }
.tile-ico.lg { width: 48px; height: 48px; border-radius: 15px; }
.tile-ico.tone-ok { background: var(--ok-bg); color: var(--ok); }
.tile-ico.tone-warn { background: var(--warn-bg); color: var(--warn); }
.tile-ico.tone-danger { background: var(--danger-bg); color: var(--danger); }
.tile-ico.tone-info { background: var(--info-bg); color: var(--info); }
.tile-ico.tone-accent { background: var(--accent-bg); color: var(--accent-tone); }
.tile-ico.tone-brand { background: var(--brand); color: var(--accent); }
.tile-ico.tone-neutral { background: var(--neutral-bg); color: var(--neutral); }

.progress { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--meter); transition: width .6s cubic-bezier(.2,.8,.2,1); }
.progress.tone-warn > span { background: var(--warn); }
.progress.tone-danger > span { background: var(--danger); }
.progress.tone-ok > span { background: var(--ok); }
.card-hero .progress { background: rgba(255,255,255,.12); }
.card-hero .progress > span { background: var(--accent); }

.ring { --v: 0; --size: 64px; width: var(--size); height: var(--size); position: relative; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; }
.ring .bg { stroke: var(--surface-3); }
.ring .fg { stroke: var(--meter); stroke-linecap: round; transition: stroke-dashoffset .8s cubic-bezier(.2,.8,.2,1); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font: 500 15px var(--mono); letter-spacing: -0.04em; }
.card-hero .ring .bg { stroke: rgba(255,255,255,.12); }
.card-hero .ring .fg { stroke: var(--accent); }

/* ---------- Pastillas ---------- */
.pill {
    display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
    border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap;
    background: var(--neutral-bg); color: var(--neutral);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.no-dot::before { display: none; }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-danger { background: var(--danger-bg); color: var(--danger); }
.pill-info { background: var(--info-bg); color: var(--info); }
.pill-accent { background: var(--accent-bg); color: var(--accent-tone); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--danger); color: #fff; }
.badge.soft { background: var(--surface-3); color: var(--ink-2); }

/* ---------- Listas ---------- */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); }
.list-row {
    display: flex; align-items: center; gap: 13px; padding: 13px 14px; min-height: 64px;
    position: relative; transition: background .15s;
}
.list-row + .list-row::before { content: ""; position: absolute; top: 0; right: 0; left: 67px; height: 1px; background: var(--line); }
.list-row.no-ico + .list-row::before, .list-row.no-ico::before { left: 14px; }
a.list-row:active, button.list-row:active { background: var(--surface-2); }
@media (hover: hover) { a.list-row:hover { background: var(--surface-2); } }
.list-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.list-title { font-weight: 550; letter-spacing: -0.015em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-meta { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; text-align: right; }
.list-end .chev { color: var(--line-strong); }
.list-row .chev { color: var(--line-strong); flex: none; }
.list-foot { padding: 12px 14px; border-top: 1px solid var(--line); display: flex; justify-content: center; }
button.list-row { width: 100%; border: 0; background: none; text-align: left; cursor: pointer; }

/* ---------- Filtros ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--gutter) * -1); padding: 2px var(--gutter) 4px; scroll-snap-type: x proximity; }
.chips::-webkit-scrollbar { display: none; }
.chip {
    flex: none; height: 36px; padding: 0 14px; border-radius: 99px; scroll-snap-align: start;
    display: inline-flex; align-items: center; gap: 7px;
    border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
    font-size: 13.5px; font-weight: 550; cursor: pointer; white-space: nowrap; transition: .15s;
}
.chip .n { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip.active .n { color: inherit; opacity: .7; }
.chip input { display: none; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; gap: 4px; background: var(--surface-3); border-radius: 15px; }
.seg a, .seg label {
    height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 13.5px; font-weight: 600;
    color: var(--muted); cursor: pointer; transition: .2s; text-align: center; padding: 0 6px;
}
.seg .active, .seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg label { position: relative; padding: 0; }
.seg label input { position: absolute; opacity: 0; pointer-events: none; }
.seg label span { width: 100%; height: 100%; border-radius: 11px; display: grid; place-items: center; }

.searchbar {
    display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 15px; color: var(--muted);
}
.searchbar input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); height: 100%; min-width: 0; }

/* ---------- Formularios ---------- */
.form { display: grid; gap: 16px; }
.form-group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: grid; gap: 16px; box-shadow: var(--shadow); }
.form-group > h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-2 > .full { grid-column: 1 / -1; }
@media (max-width: 380px) { .grid-2 { grid-template-columns: 1fr; } }
.field { display: grid; gap: 7px; min-width: 0; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.field .req { color: var(--danger); }
.input, .select, .textarea {
    width: 100%; height: 50px; padding: 0 14px;
    background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md);
    outline: none; transition: border-color .15s, box-shadow .15s, background .15s; font-size: 16px;
    -webkit-appearance: none; appearance: none; min-width: 0;
}
.textarea { height: auto; min-height: 104px; padding: 13px 14px; resize: vertical; line-height: 1.45; }
.select {
    padding-right: 40px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23767B75' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--ink); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 45%, transparent); }
.input[type="date"] { line-height: 50px; }
.input-wrap { position: relative; }
.input-wrap .suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 14px; pointer-events: none; }
.input-wrap .input { padding-right: 64px; }
.hint { font-size: 12.5px; color: var(--muted); }
.error { font-size: 12.5px; color: var(--danger); font-weight: 500; display: flex; gap: 5px; align-items: center; }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--danger); }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; cursor: pointer; }
.switch-row .grow { display: grid; gap: 2px; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line-strong); transition: .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: .22s cubic-bezier(.3,.7,.3,1.2); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(20px); background: var(--accent); }

.range { width: 100%; accent-color: var(--brand); height: 28px; }

.drop {
    display: grid; place-items: center; gap: 6px; padding: 20px; text-align: center; cursor: pointer;
    border: 1.5px dashed var(--line-strong); border-radius: var(--r-md); background: var(--surface-2); color: var(--muted);
}
.drop strong { color: var(--ink); font-weight: 600; }
.drop input { display: none; }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.previews:empty { display: none; }
.preview { aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-3); display: grid; place-items: center; font-size: 11px; color: var(--muted); padding: 6px; text-align: center; word-break: break-all; }
.preview img { width: 100%; height: 100%; object-fit: cover; }

.actionbar {
    position: fixed; z-index: 45; left: 0; right: 0; bottom: 0;
    padding: 12px var(--gutter) calc(12px + var(--safe-b));
    background: var(--glass); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
    border-top: 1px solid var(--line);
    display: flex; gap: 10px;
}
.actionbar .btn { flex: 1; }
.actionbar .btn-ghost { flex: 0 0 auto; }
@media (min-width: 1024px) {
    .actionbar { left: 264px; justify-content: flex-end; padding-left: 32px; padding-right: 32px; }
    .actionbar .btn { flex: 0 0 auto; min-width: 180px; }
}

/* ---------- Detalle ---------- */
.kv { display: grid; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.kv > div:last-child { border-bottom: 0; }
.kv dt, .kv .k { color: var(--muted); flex: none; }
.kv dd, .kv .v { margin: 0; text-align: right; font-weight: 550; min-width: 0; overflow-wrap: anywhere; }

.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.quick a, .quick button {
    display: grid; justify-items: center; gap: 8px; padding: 14px 4px 12px; border-radius: 18px;
    background: var(--surface); border: 1px solid var(--line); font-size: 12px; font-weight: 600; text-align: center; color: var(--ink-2); cursor: pointer;
}
.quick a:active, .quick button:active { transform: scale(.97); }

.note { padding: 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); white-space: pre-line; font-size: 14.5px; color: var(--ink-2); }
.callout { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--r-md); font-size: 14px; }
.callout.tone-warn { background: var(--warn-bg); color: var(--warn); }
.callout.tone-danger { background: var(--danger-bg); color: var(--danger); }
.callout.tone-info { background: var(--info-bg); color: var(--info); }
.callout.tone-ok { background: var(--ok-bg); color: var(--ok); }
.callout p { color: var(--ink-2); }

.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
@media (min-width: 640px) { .gallery { grid-template-columns: repeat(5, 1fr); } }
.g-item { aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--surface-3); position: relative; }
.g-item a { display: block; width: 100%; height: 100%; }
.g-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.g-item a:active img { transform: scale(1.04); }
.g-del {
    position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 10px; border: 0; cursor: pointer;
    display: grid; place-items: center; color: #fff; background: rgba(10, 14, 11, .5);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.list-plain { border: 0; box-shadow: none; background: transparent; margin: -4px -4px 0; }

.timeline { position: relative; display: grid; gap: 18px; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line); border-radius: 2px; }
.tl-item { position: relative; display: grid; gap: 4px; }
.tl-item::before { content: ""; position: absolute; left: -26px; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
.tl-item:first-child::before { background: var(--accent); border-color: var(--brand); }

.empty { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 34px 20px; color: var(--muted); }
.empty .tile-ico { width: 56px; height: 56px; border-radius: 18px; }
.empty h3 { color: var(--ink); font-size: 16px; }
.empty p { max-width: 34ch; font-size: 14px; }

.avatar { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; font-weight: 700; font-size: 14px; background: var(--accent-bg); color: var(--accent-tone); flex: none; letter-spacing: 0; }

.datebox { width: 46px; flex: none; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--line); text-align: center; padding: 5px 0; line-height: 1.1; }
.datebox b { display: block; font: 600 17px var(--mono); letter-spacing: -0.04em; }
.datebox span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.datebox.today { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.datebox.today span { color: var(--accent); }

.table-wrap { overflow-x: auto; margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 520px; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .r { text-align: right; }

/* ---------- Hoja inferior ---------- */
.sheet-backdrop {
    position: fixed; inset: 0; z-index: 80; background: rgba(8, 12, 9, .42);
    opacity: 0; pointer-events: none; transition: opacity .25s;
}
.sheet {
    position: fixed; z-index: 81; left: 0; right: 0; bottom: 0;
    max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain;
    background: var(--surface); border-radius: 28px 28px 0 0;
    padding: 10px 18px calc(22px + var(--safe-b));
    transform: translateY(105%); transition: transform .34s cubic-bezier(.2, .9, .25, 1);
    box-shadow: var(--shadow-up);
    max-width: 640px; margin: 0 auto;
}
.sheet.open { transform: none; }
.sheet.open + .sheet-backdrop, .sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet-handle { width: 40px; height: 5px; border-radius: 99px; background: var(--line-strong); margin: 0 auto 14px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.sheet-head h3 { font-size: 20px; letter-spacing: -0.03em; }
@media (min-width: 1024px) {
    .sheet { left: 50%; right: auto; bottom: 50%; width: 560px; border-radius: 28px; transform: translate(-50%, calc(50% + 30px)); opacity: 0; pointer-events: none; transition: transform .3s cubic-bezier(.2,.9,.25,1), opacity .2s; }
    .sheet.open { transform: translate(-50%, 50%); opacity: 1; pointer-events: auto; }
    .sheet-handle { display: none; }
}
.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.quick-grid a {
    display: flex; flex-direction: column; gap: 14px; padding: 16px; border-radius: 20px;
    background: var(--surface-2); border: 1px solid var(--line); font-weight: 600; font-size: 14.5px; letter-spacing: -0.015em;
}
.quick-grid a span { font-weight: 400; font-size: 12.5px; color: var(--muted); display: block; margin-top: 2px; }
.quick-grid a:active { transform: scale(.98); }
.quick-grid a.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.quick-grid a.primary span { color: rgba(242,241,235,.62); }
.quick-grid a.primary .tile-ico { background: rgba(255,255,255,.08); color: var(--accent); }

/* ---------- Avisos ---------- */
.toast {
    position: fixed; z-index: 90; left: 12px; right: 12px; top: calc(12px + var(--safe-t));
    max-width: 480px; margin: 0 auto;
    display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 12px;
    background: var(--ink); color: var(--bg); border-radius: 18px;
    box-shadow: 0 20px 40px -16px rgba(0,0,0,.45);
    animation: toast-in .4s cubic-bezier(.2,.9,.25,1.2) both;
    font-size: 14px; font-weight: 500;
}
.toast .tile-ico { background: var(--accent); color: var(--accent-ink); width: 32px; height: 32px; border-radius: 10px; }
.toast.error .tile-ico { background: var(--danger); color: #fff; }
.toast.hide { animation: toast-out .3s ease-in both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-20px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-16px); } }

/* ---------- Casillas del plan ---------- */
.check {
    width: 30px; height: 30px; flex: none; border-radius: 10px; cursor: pointer;
    border: 1.5px solid var(--line-strong); background: var(--surface); color: transparent;
    display: grid; place-items: center; transition: background .2s, border-color .2s, color .2s, transform .15s;
}
.check:active { transform: scale(.9); }
.check.done { background: var(--brand); border-color: var(--brand); color: var(--accent); }
.check.done + .list-body .list-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }

.hint .i, p .i, .link .i { display: inline-block; vertical-align: -2px; }
.callout > .i { margin-top: 1px; }
@media (min-width: 1024px) {
    .desk-main .stats, .desk-2 .stats { grid-template-columns: 1fr 1fr; }
}

/* ---------- Paginación ---------- */
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 16px; }

/* ---------- Créditos ---------- */
.credits {
    margin: 44px 0 0; padding-top: 18px; border-top: 1px solid var(--line);
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-size: 12px; color: var(--muted); text-align: center;
}
.credits b { color: var(--ink-2); font-weight: 600; }
.credits .star { width: 14px; height: 14px; color: var(--ink-2); }

/* ---------- Ingreso ---------- */
.auth {
    min-height: 100dvh; display: grid; grid-template-rows: 1fr auto;
    padding: calc(28px + var(--safe-t)) 22px calc(22px + var(--safe-b));
    background: var(--brand); color: var(--brand-ink); position: relative; overflow: hidden;
}
.auth::before {
    content: ""; position: absolute; width: 520px; height: 520px; right: -220px; top: -180px; border-radius: 50%;
    background: radial-gradient(closest-side, rgba(200, 241, 90, .2), transparent);
}
.auth-inner { width: 100%; max-width: 400px; margin: 0 auto; display: flex; flex-direction: column; justify-content: center; gap: 28px; position: relative; z-index: 1; }
.auth h1 { font-size: 40px; line-height: 1; letter-spacing: -0.05em; font-weight: 650; }
.auth h1 em { font-style: normal; color: var(--accent); }
.auth p.lead { color: rgba(242,241,235,.66); margin-top: 12px; font-size: 15.5px; max-width: 30ch; }
.auth .card { background: var(--surface); color: var(--ink); border: 0; border-radius: 26px; padding: 20px; }
.auth .credits { border-top-color: rgba(255,255,255,.1); color: rgba(242,241,235,.55); position: relative; z-index: 1; }
.auth .credits b, .auth .credits .star { color: var(--brand-ink); }
.auth .furrows { opacity: .1; height: 60%; top: auto; bottom: 0; right: -40px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.auth .btn-primary { background: var(--accent); color: var(--accent-ink); }
.auth .btn-primary .i { color: inherit; }

/* ---------- Recorrido guiado ---------- */
.tour { position: fixed; inset: 0; z-index: 200; opacity: 0; transition: opacity .25s; }
.tour.visible { opacity: 1; }
.tour.saliendo { opacity: 0; }
.tour-block { position: absolute; inset: 0; }
.tour.sin-objetivo .tour-block { background: rgba(8, 12, 9, .62); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.tour-spot {
    position: fixed; border-radius: 18px; pointer-events: none;
    box-shadow: 0 0 0 9999px rgba(8, 12, 9, .62), 0 0 0 3px var(--accent), 0 0 30px 6px rgba(200, 241, 90, .35);
    transition: top .35s cubic-bezier(.2,.9,.25,1), left .35s cubic-bezier(.2,.9,.25,1), width .35s cubic-bezier(.2,.9,.25,1), height .35s cubic-bezier(.2,.9,.25,1), opacity .2s;
}
.tour-card {
    position: fixed; z-index: 1; outline: none;
    background: var(--surface); color: var(--ink);
    border-radius: 24px; padding: 16px 18px 16px;
    box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .55), 0 0 0 1px var(--line);
    max-height: min(62dvh, 520px); overflow-y: auto; overscroll-behavior: contain;
    animation: tour-in .32s cubic-bezier(.2,.9,.25,1.1) both;
}
@keyframes tour-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.tour-card.abajo { left: 12px; right: 12px; bottom: calc(12px + var(--safe-b)); }
.tour-card.arriba { left: 12px; right: 12px; top: calc(12px + var(--safe-t)); }
.tour-card.centro { left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(460px, calc(100vw - 24px)); animation: none; }
.tour-top { display: flex; align-items: center; gap: 10px; }
.tour-mod { height: 24px; padding: 0 10px; border-radius: 99px; display: inline-flex; align-items: center; font-size: 12px; font-weight: 650; background: var(--accent); color: var(--accent-ink); }
.tour-count { font-size: 12.5px; color: var(--muted); margin-left: auto; }
.tour-x { width: 32px; height: 32px; border-radius: 10px; border: 0; background: var(--surface-3); color: var(--ink-2); display: grid; place-items: center; cursor: pointer; }
.tour-bar { height: 4px; border-radius: 99px; background: var(--surface-3); margin: 12px 0 14px; overflow: hidden; }
.tour-bar span { display: block; height: 100%; background: var(--meter); border-radius: inherit; transition: width .4s; }
.tour-title { font-size: 19px; letter-spacing: -0.03em; margin-bottom: 8px; }
.tour-body { font-size: 14.5px; color: var(--ink-2); line-height: 1.5; }
.tour-body p + p { margin-top: 8px; }
.tour-body ul, .tour-body ol { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.tour-body b { color: var(--ink); font-weight: 600; }
.tour-actions { display: flex; gap: 10px; margin-top: 16px; }
.tour-actions .tour-next { flex: 1; }
.tour-actions .tour-next .i { color: var(--accent); }
html.tour-activo .toast { z-index: 210; }

/* ---------- Guía de uso ---------- */
.guia-item + .guia-item { border-top: 1px solid var(--line); }
.guia-item summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px;
    padding: 15px 14px; font-weight: 550;
}
.guia-item summary::-webkit-details-marker { display: none; }
.guia-item summary .list-title { flex: 1; }
.guia-item summary .chev { transition: transform .2s; color: var(--muted); }
.guia-item[open] summary .chev { transform: rotate(180deg); }
.guia-item[open] summary { color: var(--ink); }
.guia-pasos { margin: 0; padding: 0 14px 14px 14px; list-style: none; counter-reset: paso; display: grid; gap: 10px; }
.guia-pasos li { counter-increment: paso; display: grid; grid-template-columns: 26px 1fr; gap: 10px; font-size: 14.5px; color: var(--ink-2); line-height: 1.45; }
.guia-pasos li::before {
    content: counter(paso); width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center;
    background: var(--accent-bg); color: var(--accent-tone); font: 600 12px var(--mono);
}
.guia-pasos b { color: var(--ink); font-weight: 600; }
