/* casómetro — sistema visual.
   Yeso (fondo), azulejo (marca y acciones), tinta (texto) y la aguja
   amarilla: el único acento fuerte, reservado a la respuesta. Símbolo:
   una casa con un medidor dentro. Tipografía Inter / Inter Display (OFL,
   servida desde /static/fonts — sin CDNs). */

@font-face { font-family: "Inter"; font-weight: 400; font-display: swap;
    src: url("/static/fonts/Inter-Regular.woff") format("woff"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap;
    src: url("/static/fonts/Inter-Medium.woff") format("woff"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap;
    src: url("/static/fonts/Inter-SemiBold.woff") format("woff"); }
@font-face { font-family: "Space Grotesk"; font-weight: 500 700; font-display: swap;
    src: url("/static/fonts/SpaceGrotesk.woff2") format("woff2"); }
@font-face { font-family: "Inter Display"; font-weight: 600; font-display: swap;
    src: url("/static/fonts/InterDisplay-SemiBold.woff") format("woff"); }
@font-face { font-family: "Inter Display"; font-weight: 700; font-display: swap;
    src: url("/static/fonts/InterDisplay-Bold.woff") format("woff"); }

:root {
    color-scheme: light;      /* una sola apariencia, la de la marca */
    /* superficies */
    --bg: #F7F7F4;            /* yeso */
    --bg-panel: #FFFFFF;
    --bg-raised: #EFEEE8;
    --bg-soft: #EFEEE8;
    --card: #FFFFFF;
    --border: #E4E3DC;
    --border-strong: #C9C8C0;
    /* texto */
    --text: #121826;          /* tinta */
    --text-2: #3A4152;        /* texto de lectura */
    --text-dim: #545B6C;
    --muted: #545B6C;
    /* marca y acentos */
    --accent: #1F4FD1;        /* azulejo */
    --accent-ink: #163A9C;
    --accent-dim: rgba(31, 79, 209, .08);
    --albero: #F2B705;        /* la aguja: solo la respuesta */
    --albero-ink: #121826;
    --on-accent: #FFFFFF;
    /* semántica */
    --ok: #1E7F55;
    --ok-dim: rgba(30, 127, 85, .10);
    --danger: #C23B22;
    --neg: #C23B22;
    --danger-dim: rgba(194, 59, 34, .09);
    --warn: #9A6400;
    --warn-dim: rgba(233, 185, 73, .18);
    /* series de gráficos */
    --series-1: #1F4FD1;      /* comprar / vivienda */
    --series-2: #D0901A;      /* alquilar / bolsa */
    --series-3: #1C8C7A;      /* oro / precio */
    --series-4: #B4497E;      /* deuda / ratio */
    /* forma */
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 18px;
    --r-xl: 26px;
    --shadow-pop: 0 12px 32px rgba(18, 24, 38, .14), 0 2px 6px rgba(18, 24, 38, .06);
    --content: 1080px;
    --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-display: "Space Grotesk", "Inter Display", "Inter", system-ui, sans-serif;
    font-size: 15px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* el atributo hidden debe ganar siempre */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-ui);
    font-feature-settings: "cv11", "ss01";
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-underline-offset: 2px; }
a:visited { color: var(--accent); }
a:hover { color: var(--accent-ink); }
strong, b { font-weight: 600; }
code { font-size: .92em; background: var(--bg-raised);
    border-radius: 5px; padding: 1px 5px; }
h3 { font-family: var(--font-display); font-size: 20px; font-weight: 600;
    letter-spacing: -.01em; color: var(--text); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important;
        transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- barra superior ---------- */
.sidebar {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    height: 60px;
    padding: 0 max(20px, calc((100% - var(--content)) / 2));
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
    position: relative;
    z-index: 30;
}
.sidebar::-webkit-scrollbar { display: none; }
.sidebar h1 {
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -.035em;
    color: var(--text);
    margin-right: 22px;
    display: flex;
    align-items: center;
    gap: 9px;
    white-space: nowrap;
}
/* marca: la casa con el medidor */
.sidebar h1::before {
    content: "";
    width: 26px; height: 26px; flex-shrink: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath d='M6 30 L32 8 L58 30 V56 a4 4 0 0 1 -4 4 H10 a4 4 0 0 1 -4 -4 Z' fill='%231F4FD1'/%3E%3Cpath d='M17 47 a15 15 0 0 1 30 0' fill='none' stroke='%23fff' stroke-width='4.5' stroke-linecap='round'/%3E%3Cpath d='M32 47 L41 36' stroke='%23F2B705' stroke-width='5' stroke-linecap='round'/%3E%3Ccircle cx='32' cy='47' r='4' fill='%23F2B705'/%3E%3C/svg%3E") center / contain no-repeat;
}
.sidebar h1 span { display: none; }
.nav-group { display: none; }
.nav-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    font: inherit;
    font-size: 14.5px;
    font-weight: 500;
    padding: 8px 13px;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    transition: color .15s, background .15s;
}
.nav-btn:hover { color: var(--text); background: var(--bg-raised); }
.nav-btn.active { color: var(--accent); background: var(--accent-dim);
    font-weight: 600; }
.nav-user {
    margin-left: auto;
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; color: var(--text-dim); white-space: nowrap;
    padding-left: 16px;
}
.nav-user .nav-btn { font-size: 13.5px; padding: 6px 12px;
    border: 1px solid var(--border); }

/* ---------- vistas ---------- */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden;
    min-height: 0; }
.view { display: none; flex: 1; flex-direction: column; overflow-y: auto;
    overflow-x: hidden; min-height: 0; }
.view.active { display: flex; }
.view-header {
    padding: 40px max(20px, calc((100% - var(--content)) / 2)) 4px;
    display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
}
.view-header h2 {
    font-family: var(--font-display);
    font-size: clamp(28px, 4vw, 38px);
    font-weight: 700;
    letter-spacing: -.025em;
    line-height: 1.1;
    max-width: 22ch;
}
.view-header .section-sub { font-size: 16px; max-width: 62ch; margin: 0; }
.view-header > button { margin-top: 4px; }
.view-body { flex: 1 0 auto;
    padding: 20px max(20px, calc((100% - var(--content)) / 2)) 64px; }
.ori-view { max-width: none; margin: 0; }

.section-sub {
    font-size: 15px; color: var(--text-dim); margin-bottom: 18px;
    max-width: 68ch; line-height: 1.6;
}

/* metodología plegada: el «cómo se calcula» no compite con el resultado */
.method { margin: -6px 0 18px; max-width: 72ch; }
.method summary {
    cursor: pointer; font-size: 14px; font-weight: 500;
    color: var(--accent); list-style: none; display: inline-flex;
    align-items: center; gap: 6px;
}
.method summary::-webkit-details-marker { display: none; }
.method summary::before { content: "+"; font-weight: 600; width: 12px; }
.method[open] summary::before { content: "−"; }
.method p { font-size: 14px; color: var(--text-dim); line-height: 1.65;
    margin-top: 8px; }

/* ---------- botones ---------- */
button, .btn {
    font: inherit;
    font-size: 14.5px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--text);
    background: var(--bg-panel);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    padding: 11px 18px;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    text-decoration: none;
    display: inline-flex; align-items: center; justify-content: center;
    gap: 6px;
}
button:hover, .btn:hover { background: var(--bg-raised); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: default; transform: none; }
button.primary, .btn.primary {
    background: var(--accent); border-color: var(--accent);
    color: var(--on-accent);
}
button.primary:hover { background: var(--accent-ink);
    border-color: var(--accent-ink); }
button.small, .small {
    font-size: 13px; padding: 6px 11px; border-radius: var(--r-sm);
}

/* ---------- formularios ---------- */
.form-row { display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap;
    align-items: center; }
input, select, textarea {
    background: var(--bg-panel);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    color: var(--text);
    padding: 11px 13px;
    font: inherit;
    font-size: 15px;
    min-height: 44px;
    transition: border-color .15s, box-shadow .15s;
    font-variant-numeric: tabular-nums;
}
select { padding-right: 34px; appearance: none; cursor: pointer;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
        linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
    background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%;
    background-size: 5px 5px; background-repeat: no-repeat; }
input::placeholder { color: var(--text-dim); opacity: .75; }
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}
input[type="checkbox"], input[type="radio"] { min-height: 0;
    accent-color: var(--accent); width: 16px; height: 16px; }
label {
    font-size: 14px; font-weight: 500; color: var(--text);
    display: block; margin: 16px 0 6px;
}
label .card-meta { font-weight: 400; }
.settings-grid { max-width: 560px; }
.settings-grid > label:first-child { margin-top: 0; }
.settings-grid input, .settings-grid select { width: 100%; }

.empty { color: var(--text-dim); padding: 36px 0; text-align: center;
    font-size: 15px; }
.notice { font-size: 13.5px; color: var(--warn); margin-top: 10px; }

/* ---------- tarjetas ---------- */
.card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 22px 24px;
    margin-bottom: 14px;
}
.card.rank-card:hover { border-color: var(--border-strong); }
.card .card-title { font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.card-meta, .card .card-meta { font-size: 13px; color: var(--text-dim);
    line-height: 1.5; }
.card .card-meta { margin-top: 6px; }
.card .card-actions { margin-top: 12px; display: flex; gap: 8px;
    flex-wrap: wrap; }

.badge {
    display: inline-block;
    font-size: 12px; font-weight: 500;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--bg-raised);
    color: var(--text-dim);
    margin-right: 4px;
}
.badge.FACT, .badge.done, .badge.active { color: var(--ok); background: var(--ok-dim); }
.badge.INFERENCE, .badge.MODEL_HYPOTHESIS, .badge.open
    { color: var(--warn); background: var(--warn-dim); }
.badge.USER_STATED_BELIEF { color: var(--accent); background: var(--accent-dim); }
.badge.disputed, .badge.deleted { color: var(--danger); background: var(--danger-dim); }

/* ---------- tablas ---------- */
.fin-table { width: 100%; border-collapse: collapse; margin: 12px 0;
    font-size: 14px; font-variant-numeric: tabular-nums; }
.fin-table th, .fin-table td { text-align: right; padding: 10px 12px;
    border-bottom: 1px solid var(--border); }
.fin-table th { font-size: 13px; font-weight: 500; color: var(--text-dim); }
.fin-table th:first-child, .fin-table td:first-child { text-align: left;
    padding-left: 0; }
.fin-table td:first-child { color: var(--text-dim); }
.fin-table th:last-child, .fin-table td:last-child { padding-right: 0; }
.fin-table tr:last-child td { font-weight: 600; border-bottom: none; }
.zonas-table td, .zonas-table th { font-size: 13px; padding: 8px 10px; }
.zonas-table td:nth-child(2), .zonas-table td:nth-child(3),
.zonas-table th:nth-child(2), .zonas-table th:nth-child(3) { text-align: left; }
tr.zona-vigilada td { background: var(--accent-dim); }
.ori-table-wrap .fin-table { margin: 0; }
.ori-table-wrap .fin-table th, .ori-table-wrap .fin-table td { white-space: nowrap; }
.ori-table-wrap .fin-table th:first-child, .ori-table-wrap .fin-table td:first-child { padding-left: 18px; }
.ori-table-wrap .fin-table th:last-child, .ori-table-wrap .fin-table td:last-child { padding-right: 18px; }
.esp-table th:nth-child(2), .esp-table td:nth-child(2) { text-align: left; }
.esp-table tr:last-child td { font-weight: 400; }
/* formulario a dos columnas: cada campo es etiqueta + control */
.fld-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px;
    max-width: 760px; }
.fld-grid .fld label { margin-top: 14px; }
.fld-grid .fld input, .fld-grid .fld select { width: 100%; }
.fld-grid .form-row { grid-column: 1 / -1; }
@media (max-width: 640px) { .fld-grid { grid-template-columns: 1fr; } }

/* ---------- toast ---------- */
.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: var(--text); color: var(--bg);
    border-radius: 999px; padding: 11px 20px;
    font-size: 14px; font-weight: 500;
    z-index: 3000; max-width: min(420px, 92vw);
    box-shadow: var(--shadow-pop);
    animation: toastIn .25s ease both;
}
.toast.err { background: var(--danger); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } }

/* =================== ORIENTACIÓN =================== */

/* veredicto — el único momento fuerte de la interfaz */
.ori-hero {
    position: relative; overflow: hidden;
    background: var(--albero);
    color: var(--albero-ink);
    border-radius: var(--r-xl);
    padding: 34px 38px 28px;
    margin: 8px 0 28px;
    animation: heroIn .5s cubic-bezier(.2, .8, .3, 1) both;
}
@keyframes heroIn { from { opacity: 0; transform: translateY(12px); } }
/* el medidor, muy tenue, en la esquina */
.ori-hero::after {
    content: ""; position: absolute; right: -30px; top: -20px;
    width: 240px; height: 240px; pointer-events: none; opacity: .12;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 240'%3E%3Cpath d='M30 200 A90 90 0 0 1 210 200' fill='none' stroke='%23121826' stroke-width='22' stroke-linecap='round'/%3E%3Cpath d='M120 200 L176 124' stroke='%23121826' stroke-width='14' stroke-linecap='round'/%3E%3Ccircle cx='120' cy='200' r='16' fill='%23121826'/%3E%3C/svg%3E") center / contain no-repeat;
}
.ori-hero > * { position: relative; z-index: 1; }
.ori-hero-k { font-size: 15px; font-weight: 500; opacity: .8;
    margin-bottom: 10px; }
.ori-hero-v {
    font-family: var(--font-display);
    font-size: clamp(26px, 3.6vw, 36px); font-weight: 700;
    letter-spacing: -.02em; line-height: 1.12; margin-bottom: 18px;
    max-width: 24ch;
}
.ori-hero-num {
    font-family: var(--font-display);
    font-size: clamp(48px, 8vw, 84px); font-weight: 700;
    letter-spacing: -.04em; line-height: .95;
    font-variant-numeric: tabular-nums;
    color: #14307F;
}
.ori-hero-num.neg { color: #7A2410; }
.ori-hero-numlb { font-size: 16px; font-weight: 500; margin-top: 10px;
    max-width: 52ch; }
.ori-hero-sub { font-size: 15px; line-height: 1.6; margin-top: 14px;
    max-width: 62ch; }
.ori-hero-sub strong { font-weight: 600; }
.ori-hero-warn {
    margin-top: 16px; display: inline-block;
    background: rgba(58, 44, 5, .09); border-radius: var(--r-md);
    padding: 10px 14px; font-size: 14.5px; font-weight: 500;
}
.ori-hero-stats {
    display: flex; gap: 12px 40px; flex-wrap: wrap; margin-top: 26px;
    padding-top: 18px; border-top: 1px solid rgba(58, 44, 5, .16);
}
.ori-hero-stat .k { font-size: 13.5px; opacity: .78; }
.ori-hero-stat .v { font-family: var(--font-display); font-size: 22px;
    font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.ori-hero-stat .v small { font-family: var(--font-ui); font-size: 13px;
    font-weight: 500; opacity: .75; margin-left: 4px; }
.ori-hero-v em { font-style: normal; }

/* navegación por pasos (sticky) */
.ori-stepper {
    position: sticky; top: 0; z-index: 20;
    display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
    padding: 12px 0; margin: 0 0 18px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.ori-stepper::-webkit-scrollbar { display: none; }
.ori-sp {
    display: inline-flex; align-items: center; gap: 8px;
    background: transparent; border: 1px solid transparent;
    border-radius: 999px; padding: 7px 14px 7px 8px;
    font-size: 14px; font-weight: 500; color: var(--text-dim);
    white-space: nowrap;
}
.ori-sp i {
    font-style: normal; width: 22px; height: 22px; border-radius: 50%;
    background: var(--bg-raised); color: var(--text-dim);
    font-size: 12px; font-weight: 600;
    display: inline-flex; align-items: center; justify-content: center;
}
.ori-sp:hover { background: var(--bg-panel); color: var(--text); }
.ori-sp.done { color: var(--text); }
.ori-sp.done i { background: var(--text); color: var(--bg); }
.ori-sp.on { background: var(--bg-panel); border-color: var(--border);
    color: var(--text); }
.ori-sp.on i { background: var(--accent); color: var(--on-accent); }

/* pasos */
.ori-step { margin-bottom: 52px; scroll-margin-top: 76px; }
.ori-step-head { display: flex; gap: 14px; align-items: flex-start;
    margin-bottom: 18px; }
.ori-num {
    width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
    background: var(--bg-panel); border: 1px solid var(--border-strong);
    color: var(--text); font-size: 14px; font-weight: 600;
    display: flex; align-items: center; justify-content: center;
    margin-top: 2px;
}
.ori-step.done .ori-num { background: var(--text); border-color: var(--text);
    color: var(--bg); }
.ori-step-head strong { font-family: var(--font-display); font-size: 24px;
    font-weight: 600; letter-spacing: -.015em; line-height: 1.25;
    display: block; }
.ori-step-head .card-meta { display: block; font-size: 15px; margin-top: 3px; }
.ori-form { max-width: 760px; }
.ori-form .ori-actions { margin-top: 16px; display: flex; gap: 10px; }
.ori-form .ori-actions .primary { flex: 1; }

/* cuestionario */
.quiz { max-width: 680px; padding: 28px 30px 24px; }
.quiz-progress { display: flex; align-items: center; gap: 14px;
    margin-bottom: 26px; }
.quiz-bar { flex: 1; height: 6px; border-radius: 3px;
    background: var(--bg-raised); overflow: hidden; }
.quiz-bar i { display: block; height: 100%; width: 25%;
    background: var(--accent); border-radius: 3px;
    transition: width .35s ease; }
.quiz-progress .card-meta { font-size: 13px; white-space: nowrap; }
.quiz-panel[hidden] { display: none; }
.quiz-panel { animation: panelIn .25s ease both; }
@keyframes panelIn { from { opacity: 0; transform: translateX(8px); } }
.quiz-q { font-family: var(--font-display); font-size: 24px; font-weight: 600;
    letter-spacing: -.015em; line-height: 1.25; margin: 0 0 6px;
    color: var(--text); }
.quiz-q .card-meta { font-family: var(--font-ui); font-size: 14px;
    font-weight: 400; letter-spacing: 0; }
.quiz-hint { font-size: 15px; color: var(--text-dim); margin: 0 0 18px; }
.quiz-opts { display: grid; gap: 10px; }
.quiz-opt {
    display: flex; flex-direction: column; align-items: flex-start;
    gap: 2px; text-align: left; padding: 16px 18px; cursor: pointer;
    background: var(--bg-panel); border: 1.5px solid var(--border);
    border-radius: var(--r-md); color: var(--text);
}
.quiz-opt:hover { border-color: var(--border-strong); background: var(--bg-panel); }
.quiz-opt strong { font-size: 16px; font-weight: 600; }
.quiz-opt span { font-size: 14px; font-weight: 400; color: var(--text-dim); }
.quiz-opt.sel { border-color: var(--accent); background: var(--accent-dim);
    box-shadow: inset 0 0 0 1px var(--accent); }
.quiz-opt.sel strong { color: var(--accent); }
.quiz .settings-grid { margin-top: 4px; max-width: none; }
#ori-region { width: 100%; }
.quiz-nav { display: flex; gap: 10px; margin-top: 28px; align-items: center;
    flex-wrap: wrap; }
.quiz-nav .primary { flex: 1; min-width: 180px; padding: 13px 18px;
    font-size: 15.5px; }
.quiz-nav button:not(.primary) { padding: 13px 18px; }

/* perfil plegado tras el resultado */
.ori-summary {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; flex-wrap: wrap; max-width: 760px;
    background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: var(--r-lg); padding: 14px 16px 14px 20px;
}
.ori-summary-txt { display: flex; flex-wrap: wrap; gap: 6px;
    font-size: 14px; }
.ori-summary-txt span { background: var(--bg); border-radius: 999px;
    padding: 4px 11px; }

/* skeletons */
.skel {
    border-radius: var(--r-md); margin: 8px 0;
    background: linear-gradient(90deg, var(--bg-raised) 25%,
        var(--bg-panel) 50%, var(--bg-raised) 75%);
    background-size: 200% 100%;
    animation: skel 1.3s infinite;
}
@keyframes skel { to { background-position: -200% 0; } }
.skel-line { height: 14px; }
.skel-card { height: 96px; border-radius: var(--r-lg); }
.skel-table { height: 240px; border-radius: var(--r-lg); }
.skel-chart { height: 180px; border-radius: var(--r-lg); }

/* estado vacío */
.ori-empty {
    border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg);
    padding: 34px 26px; text-align: center; color: var(--text-dim);
    background: transparent;
}
.ori-empty .big { font-size: 17px; color: var(--text); margin-bottom: 6px;
    font-weight: 600; }
.ori-empty .hint { font-size: 14.5px; max-width: 52ch; margin: 0 auto; }

/* tabla de municipios */
.ori-table-wrap { position: relative; overflow-x: auto;
    background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: var(--r-lg); }
.ori-table { width: 100%; border-collapse: collapse; font-size: 14px;
    font-variant-numeric: tabular-nums; }
.ori-table th {
    text-align: left; font-size: 13px; font-weight: 500;
    color: var(--text-dim); padding: 14px 14px 12px;
    border-bottom: 1px solid var(--border); white-space: nowrap;
    background: var(--bg-panel); position: sticky; top: 0;
}
.ori-table td { padding: 13px 14px; border-bottom: 1px solid var(--border);
    vertical-align: middle; white-space: nowrap; }
.ori-table tbody tr:last-child td { border-bottom: none; }
.ori-table tbody tr.ori-row { cursor: pointer; transition: background .12s; }
.ori-table tbody tr.ori-row:hover { background: var(--bg); }
.ori-table tbody tr.ori-row.open { background: var(--accent-dim); }
.ori-table th:first-child, .ori-table td:first-child {
    position: sticky; left: 0; background: inherit; z-index: 1;
}
.ori-table tbody tr td:first-child { background: var(--bg-panel); }
.ori-table tbody tr.ori-row:hover td:first-child { background: var(--bg); }
.ori-row .mun { font-weight: 600; }
.ori-row .mun .sub { font-size: 12.5px; color: var(--text-dim);
    font-weight: 400; margin-top: 1px; }
.ori-row .price { font-weight: 600; }
.ori-row .ok { color: var(--ok); font-weight: 600; }
.ori-row .no { color: var(--text-dim); font-size: 13.5px; }
.ori-row td.num { text-align: right; }
.ori-det-cell { background: var(--bg) !important; padding: 0 !important;
    white-space: normal !important; position: static !important; }
.ori-det-cell > div { padding: 18px 22px; }

/* gráficas */
.chart-card {
    background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: var(--r-lg); padding: 22px 24px 16px; margin: 12px 0;
}
.chart-head { display: flex; align-items: baseline; justify-content:
    space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.chart-title { font-size: 16px; font-weight: 600; }
.chart-meta { font-size: 13px; color: var(--text-dim); }
.bars {
    display: flex; align-items: flex-end; gap: 8px;
    height: 170px; padding: 18px 2px 0; position: relative;
}
.bar-col { flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: flex-end; height: 100%;
    min-width: 0; position: relative; }
.bar-col .bar-tip {
    position: absolute; top: -6px; left: 50%; transform: translateX(-50%);
    background: var(--text); color: var(--bg); border-radius: 6px;
    padding: 3px 8px; font-size: 12px; white-space: nowrap;
    opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 5;
}
.bar-col:hover .bar-tip { opacity: 1; }
.bar-col:nth-last-child(-n+2) .bar-tip { left: auto; right: 0; transform: none; }
.bar-col:nth-child(-n+2) .bar-tip { left: 0; transform: none; }
.bar {
    width: 100%; max-width: 44px; min-height: 4px;
    background: color-mix(in srgb, var(--series-1) 30%, var(--bg-panel));
    border-radius: 6px 6px 2px 2px;
    transform-origin: bottom;
    animation: barGrow .6s cubic-bezier(.2, .8, .3, 1) both;
}
.bar-col:hover .bar { background: color-mix(in srgb, var(--series-1) 55%, var(--bg-panel)); }
@keyframes barGrow { from { transform: scaleY(0); } }
.bar-col .bar-lb { font-size: 12px; color: var(--text-dim); margin-top: 6px;
    white-space: nowrap; }
.bar-col .bar-val { font-size: 11px; color: var(--text-dim);
    font-variant-numeric: tabular-nums; }
.bar-col.latest .bar { background: var(--series-1); }
.bar-col.latest .bar-lb { color: var(--text); font-weight: 600; }

/* escenarios */
.esc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
    margin-top: 16px; }
@media (max-width: 760px) { .esc-grid { grid-template-columns: 1fr; } }
.esc-card { background: var(--bg); border-radius: var(--r-md);
    padding: 14px 16px; }
.esc-card .k { font-size: 13px; color: var(--text-dim); }
.esc-card .v { font-family: var(--font-display); font-size: 21px;
    font-weight: 600; margin-top: 3px; font-variant-numeric: tabular-nums; }
.esc-card .v.up { color: var(--ok); }
.esc-card .v.flat { color: var(--text-dim); }
.esc-card .v.down { color: var(--danger); }
.esc-card .s { font-size: 13px; color: var(--text-dim); margin-top: 3px; }

/* comprar vs alquilar / ahora vs esperar */
.vs-wrap { position: relative; }
.vs-verdict {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--bg-panel); border: 1px solid var(--border);
    color: var(--text); border-radius: 999px; padding: 8px 16px;
    font-size: 14.5px; font-weight: 500; margin-bottom: 14px;
}
.vs-verdict .delta { font-weight: 700; color: var(--ok); }
.vs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
    margin: 8px 0; }
@media (max-width: 860px) { .vs-grid { grid-template-columns: 1fr; } }
.vs-card {
    position: relative; background: var(--bg-panel);
    border: 1px solid var(--border); border-radius: var(--r-lg);
    padding: 22px 24px;
}
.vs-card.win { border: 2px solid var(--series-1); padding: 21px 23px; }
.vs-card.lose { background: transparent; }
.vs-card .tag {
    position: absolute; top: -12px; left: 22px;
    background: var(--series-1); color: var(--on-accent); font-size: 12.5px;
    font-weight: 600; padding: 3px 11px; border-radius: 999px;
}
.vs-card.lose .tag { background: var(--bg-raised); color: var(--text-dim); }
.vs-k { font-size: 14px; color: var(--text-dim); font-weight: 500; }
.vs-v { font-family: var(--font-display); font-size: 34px; font-weight: 700;
    letter-spacing: -.025em; margin-top: 4px;
    font-variant-numeric: tabular-nums; line-height: 1.1; }
.vs-card.lose .vs-v { color: var(--text-dim); }
.vs-v small { font-family: var(--font-ui); font-size: 14px; font-weight: 500;
    color: var(--text-dim); letter-spacing: 0; }
.vs-sub { font-size: 13.5px; color: var(--text-dim); margin-top: 6px;
    line-height: 1.55; }
.vs-sub b { color: var(--text); font-weight: 600; }
.vs-note { font-size: 13.5px; color: var(--text-dim); margin-top: 14px;
    line-height: 1.6; max-width: 80ch; }
.vs-break { margin-top: 16px; border-top: 1px solid var(--border);
    padding-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.vs-break > div { display: flex; justify-content: space-between;
    align-items: baseline; gap: 8px; font-size: 13.5px; }
.vs-break > div > span:first-child { color: var(--text-dim); }
.vs-break > div > b { font-weight: 600; font-variant-numeric: tabular-nums;
    white-space: nowrap; }
.vs-break .neg { color: var(--danger); }
.vs-break .vs-eq { border-top: 1px dashed var(--border-strong);
    padding-top: 8px; margin-top: 2px; }
.vs-break .vs-eq > span { color: var(--text); font-weight: 600; }
.vs-break .vs-eq > b { color: var(--ok); }

/* ayudas */
.ayuda-card { border-left: 4px solid var(--accent); }
.ayuda-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.ayuda-item:last-child { border-bottom: none; }
.ayuda-name { font-weight: 600; font-size: 15px; }
.ayuda-badge { font-size: 12px; font-weight: 600; margin-left: 8px;
    padding: 2px 9px; border-radius: 999px; }
.ayuda-badge.si { background: var(--ok-dim); color: var(--ok); }
.ayuda-badge.no { background: var(--danger-dim); color: var(--danger); }
.ayuda-badge.quiz { background: var(--warn-dim); color: var(--warn); }

/* pisos */
.piso-card {
    display: flex; gap: 16px; align-items: flex-start;
    background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: var(--r-md); padding: 16px 18px; margin-bottom: 8px;
}
.piso-card:hover { border-color: var(--border-strong); }
.piso-price { font-family: var(--font-display); font-size: 19px;
    font-weight: 700; min-width: 100px; font-variant-numeric: tabular-nums; }
.piso-meta { font-size: 13.5px; color: var(--text-dim); margin-top: 3px; }
.piso-flag { color: var(--warn); font-size: 13px; }

[data-count] { font-variant-numeric: tabular-nums; }
.det-grid { transition: none; }
@media (max-width: 820px) { .det-grid { grid-template-columns: 1fr !important; } }

/* ---------- gráfico de líneas (mk-chart) ---------- */
.mk-tip { box-shadow: var(--shadow-pop); }

/* ---------- análisis / ranking (vistas personales) ---------- */
.stat-strip { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.stat { background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: var(--r-md); padding: 12px 16px; min-width: 150px; flex: 1; }
.stat-k { font-size: 13px; color: var(--text-dim); }
.stat-v { font-size: 17px; font-weight: 600; margin-top: 2px;
    font-variant-numeric: tabular-nums; }

.rank-card { padding: 18px 20px; }
.rank-card.is-low { border-left: 4px solid var(--danger); }
.floor-warn {
    margin: -18px -20px 12px; padding: 7px 18px;
    background: var(--danger-dim); color: var(--danger);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    font-size: 13px; font-weight: 600;
}
.rank-head { display: flex; align-items: baseline; gap: 10px; }
.rank-pos { font-size: 16px; color: var(--text-dim); }
.rank-name { font-size: 16px; font-weight: 600; flex: 1; color: var(--text);
    text-decoration: none; }
.rank-name:visited { color: var(--text); }
.rank-name:hover { color: var(--accent); }
.rank-score { font-size: 18px; font-weight: 700; color: var(--accent); }
.score-bar { height: 6px; background: var(--bg-raised); border-radius: 3px;
    margin: 10px 0 12px; overflow: hidden; }
.score-bar div { height: 100%; border-radius: 3px; background: var(--accent); }
.rank-stats { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px;
    color: var(--text-dim); }
.rank-stats .hl { color: var(--ok); }
.price-line { display: flex; align-items: baseline; gap: 10px;
    flex-wrap: wrap; margin-bottom: 8px; }
.price-hero { font-family: var(--font-display); font-size: 22px;
    font-weight: 700; letter-spacing: -.01em; }
.price-sub { font-size: 13.5px; color: var(--text-dim); }
.specs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.spec { font-size: 12.5px; background: var(--bg-raised); border-radius: 999px;
    padding: 3px 10px; }
.chip { font-size: 12px; font-weight: 600; border-radius: 999px;
    padding: 2px 9px; }
.chip-ok { color: var(--ok); background: var(--ok-dim); }
.chip-warn { color: var(--warn); background: var(--warn-dim); }
.chip-new { color: var(--accent); background: var(--accent-dim); }
.rio-more { text-align: center; margin: 4px 0 14px; }
.rank-links { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.rank-links a { font-size: 13px; color: var(--accent);
    background: var(--accent-dim); border-radius: 999px;
    padding: 3px 10px; text-decoration: none; }
.an-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 900px) { .an-grid { grid-template-columns: 1fr; } }

/* ciclo / riesgo */
.ciclo-head { font-size: 14px; }
.ciclo-ind { margin-bottom: 8px !important; font-size: 14px; }
.ciclo-dot { display: inline-block; width: 10px; height: 10px;
    border-radius: 50%; margin-right: 6px; }
.ciclo-dot.r0 { background: var(--ok); }
.ciclo-dot.r1 { background: #D9B54A; }
.ciclo-dot.r2 { background: #DC8A3E; }
.ciclo-dot.r3 { background: var(--danger); }
.ciclo-dot.rna { background: var(--border-strong); }
.rzone { margin: 10px 0; padding: 12px 14px; font-size: 14px;
    border-radius: var(--r-md); background: var(--bg-raised); }
.rzone-on { background: var(--danger-dim); }
.rzone-on strong:first-child { color: var(--danger); }
.rzone-off { background: var(--ok-dim); }
.rzone-off strong:first-child { color: var(--ok); }

/* dossier (modo personal) */
.rank-card[data-lid] { cursor: pointer; }
.card-foot { margin-top: 10px; align-items: center; }
.card-foot .a-dossier, .card-foot .a-vendido { margin-left: auto; }
.card-foot .a-descartar + .a-dossier,
.card-foot .a-vendido + .a-descartar { margin-left: 6px; }
.dossier { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
    cursor: default; font-size: 13.5px; color: var(--text-dim); line-height: 1.55; }
.dossier-title { font-size: 14px; font-weight: 600; color: var(--text);
    margin-bottom: 8px; }
.dossier-tabs { display: flex; gap: 4px; margin-bottom: 10px; flex-wrap: wrap; }
.dossier-tab { background: none; border: 1px solid var(--border);
    border-radius: 999px; color: var(--text-dim); font-size: 13px;
    font-weight: 500; padding: 5px 12px; }
.dossier-tab.active { border-color: var(--accent); color: var(--accent);
    background: var(--accent-dim); }
.dossier h5 { font-size: 13px; font-weight: 600; color: var(--text);
    margin: 12px 0 4px; }
.dossier-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; }
.dossier-grid > div { min-width: 0; }
@media (max-width: 900px) { .dossier-grid { grid-template-columns: 1fr; } }
.dossier ul { list-style: none; }
.dossier li { margin: 3px 0; }
.dossier-levers li { padding-left: 14px; position: relative; }
.dossier-levers li::before { content: "▸"; position: absolute; left: 0;
    color: var(--warn); }
.dossier-check li { padding-left: 18px; position: relative; }
.dossier-check li::before { content: ""; position: absolute; left: 0; top: 5px;
    width: 10px; height: 10px; border: 1.5px solid var(--border-strong);
    border-radius: 3px; }
.docs li { padding-left: 0; }
.docs li::before { display: none; }
.doc-row { margin-bottom: 8px !important; }
.doc-head { display: flex; gap: 8px; align-items: center; }
.doc-estado { font: inherit; font-size: 12px; padding: 2px 6px; min-height: 0;
    border-radius: 6px; }
.doc-estado.doc-pedido, .doc-estado.doc-recibido { color: var(--warn); }
.doc-estado.doc-verificado { color: var(--ok); }
.doc-estado.doc-problema { color: var(--danger); }
.dossier .fin-table { margin: 6px 0; font-size: 13px; }
.dossier .neg { color: var(--ok); }
.dossier .pos { color: var(--warn); }
.dossier-map { height: 240px; margin-top: 8px; border-radius: var(--r-md);
    overflow: hidden; background: var(--bg-raised); }
.dossier-map-cap { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.dossier-map .leaflet-control-attribution { font-size: 9px; }
.dossier-call ol { counter-reset: call; list-style: none; }
.dossier-call ol li { counter-increment: call; }
.dossier-call ol li::before { content: counter(call); border: none; top: 1px;
    font-size: 11px; color: var(--text-dim); width: auto; height: auto; }
.barrio-toggle { cursor: pointer; user-select: none; }
.barrio-toggle:hover { text-decoration: underline; }
.barrio-items { display: none; margin-top: 8px; padding-top: 8px;
    border-top: 1px solid var(--border); }
.barrio-items.open { display: block; }
.barrio-item { display: block; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.barrio-item:hover { background: var(--bg-raised); }
.barrio-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline;
    font-size: 13.5px; }
.barrio-line .wrn { color: var(--warn); }
.barrio-item .dossier { margin-top: 6px; }
.pipe-cols { display: grid; gap: 12px; align-items: start;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.pipe-col .card-title { display: flex; justify-content: space-between;
    align-items: baseline; }
.pipe-item { padding: 10px 12px; margin-bottom: 6px; background: var(--bg);
    border-radius: var(--r-sm); cursor: pointer; }
.pipe-item a { font-size: 13.5px; }
.pipe-item .dossier { margin-top: 8px; }
.pipe-item.dragging { opacity: .45; }
.pipe-col.drop-ok { outline: 1px dashed var(--accent); outline-offset: 3px; }
.pipe-col.drop-no { opacity: .55; }
.pipe-col.drop-target { outline: 2px solid var(--accent); outline-offset: 3px; }

/* comparador de hipotecas */
.mc-offer .form-row { gap: 8px; align-items: center; }
.mc-fld { font-size: 13px; color: var(--text-dim); display: flex;
    align-items: center; gap: 6px; margin: 0; }
.mc-offer input, .mc-offer select { font-size: 14px; min-height: 38px;
    padding: 7px 10px; }
.mc-sec { display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
    padding: 8px 0; border-top: 1px solid var(--border); }
.mc-sec:first-of-type { border-top: none; }
.mc-sec-t { font-size: 13px; font-weight: 600; color: var(--text); min-width: 100px; }
.mc-bonifs .form-row { gap: 6px; }
.offer-bar { position: relative; height: 6px; margin: 10px 2px 8px;
    background: var(--bg-raised); border-radius: 3px; }
.offer-bar .zone { position: absolute; top: 0; bottom: 0;
    background: var(--accent-dim); border: 1px solid var(--accent); border-radius: 3px; }
.offer-bar .ask { position: absolute; top: -3px; right: 0; width: 2px; height: 12px;
    background: var(--warn); border-radius: 1px; }

/* simulación: desplegable multi-barrio */
#sim-barrios { position: relative; }
#sim-barrios summary { cursor: pointer; padding: 9px 12px;
    border: 1px solid var(--border-strong); border-radius: var(--r-md);
    background: var(--bg-panel); user-select: none; list-style: none; min-width: 160px; }
#sim-barrios summary::after { content: " ▾"; }
#sim-barrios[open] summary { border-color: var(--accent); }
.sim-multi-list { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0;
    max-height: 260px; overflow-y: auto; column-width: 180px;
    background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: var(--r-md); padding: 8px; box-shadow: var(--shadow-pop); }
.sim-multi-list label { display: flex; gap: 6px; align-items: center;
    padding: 3px 5px; font-size: 14px; font-weight: 400; cursor: pointer;
    break-inside: avoid; margin: 0; }
.sim-multi-list label:hover { background: var(--accent-dim); }

.bub-bar { height: 8px; background: var(--bg-raised); border-radius: 4px;
    overflow: hidden; min-width: 60px; }
.bub-bar i { display: block; height: 100%; border-radius: 4px;
    background: linear-gradient(90deg, var(--ok) 0%, #D9B54A 55%, var(--danger) 100%);
    background-size: 200px 100%; }

.estudio-btn.active { border-color: var(--accent); color: var(--accent); }
mark.est-hit { background: var(--albero); color: var(--albero-ink);
    padding: 0 2px; border-radius: 3px; }

/* filtros en línea (España, Seguimiento) */
.lst-filter { display: flex; gap: 10px 14px; align-items: flex-end;
    flex-wrap: wrap; margin-bottom: 14px; }
.lst-filter label { margin: 0; display: flex; flex-direction: column;
    gap: 6px; font-size: 13px; color: var(--text-dim); font-weight: 500; }
.lst-filter select, .lst-filter input { width: auto; min-width: 150px; }

/* modal del dossier */
.dossier-overlay { position: fixed; inset: 0; z-index: 2000;
    background: rgba(14, 20, 32, .55); display: flex; align-items: flex-start;
    justify-content: center; padding: 4vh 16px; overflow-y: auto; }
.dossier-modal { position: relative; width: min(980px, 96vw);
    background: var(--bg-panel); border-radius: var(--r-lg); padding: 22px 24px;
    color: var(--text-dim); font-size: 13.5px; line-height: 1.55;
    box-shadow: var(--shadow-pop); }
.dossier-close { position: absolute; top: 10px; right: 12px; z-index: 1;
    border-radius: 999px; width: 34px; height: 34px; padding: 0; font-size: 18px; }
.dfields { display: grid; grid-template-columns: 2fr 1.4fr 1fr 1.2fr 1.2fr;
    gap: 8px; align-items: end; }
.dfields label { font-size: 12px; color: var(--text-dim); margin: 0; }
.dfields input { width: 100%; font-size: 14px; padding: 7px 9px; min-height: 38px; }
@media (max-width: 760px) { .dfields { grid-template-columns: 1fr 1fr; } }
.dossier-notes { list-style: none; padding: 0; margin: 0; }
.note-item { border-left: 3px solid var(--accent); padding: 6px 10px;
    margin-bottom: 6px; background: var(--bg); border-radius: 0 6px 6px 0; }
.note-del { float: right; background: none; border: none; color: var(--text-dim);
    font-size: 15px; padding: 0 4px; }
.note-del:hover { color: var(--danger); background: none; }
.pager { display: flex; align-items: center; gap: 12px; margin-top: 12px; }

/* filas clicables de la vista España */
.esp-row { cursor: pointer; }
.esp-row:hover { background: var(--bg); }

/* inicio (dashboard personal) */
.kpi-strip { display: grid; gap: 12px; margin-bottom: 22px;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kpi { background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: var(--r-lg); padding: 16px 18px; }
.kpi-k { font-size: 13px; font-weight: 500; color: var(--text-dim); }
.kpi-v { font-family: var(--font-display); font-size: 26px; font-weight: 700;
    margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi-s { font-size: 12.5px; color: var(--text-dim); margin-top: 4px; }
.dash-grid { display: grid; grid-template-columns: 1.65fr 1fr; gap: 20px;
    align-items: start; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }
.dash-title { font-size: 16px; font-weight: 600; margin-bottom: 12px;
    display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.dash-more { font-size: 13.5px; font-weight: 500; color: var(--accent);
    cursor: pointer; }
.dash-more:hover { text-decoration: underline; }
.dash-main .rank-card { margin-bottom: 12px; }
.evt { display: flex; gap: 10px; align-items: baseline; padding: 9px 2px;
    border-bottom: 1px solid var(--border); font-size: 14px; }
.evt:last-child { border-bottom: none; }
.evt .badge { flex-shrink: 0; min-width: 74px; text-align: center; }
.evt-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; color: var(--text); text-decoration: none; }
.evt-t:hover { color: var(--accent); }
.evt .card-meta { flex-shrink: 0; }
.evt-seen { opacity: .5; }
.evt-seen:hover { opacity: .85; }
.evt-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
    flex-shrink: 0; align-self: center; }
.seg-toggle { display: inline-flex; background: var(--bg-raised);
    border-radius: 999px; padding: 3px; gap: 2px; }
.seg-toggle .small { border: none; border-radius: 999px; background: none;
    color: var(--text-dim); padding: 6px 14px; }
.seg-toggle .small.active { background: var(--bg-panel); color: var(--text); }
.notif { padding: 14px 18px; }
.notif-body { white-space: pre-line; font-size: 13.5px; line-height: 1.55;
    color: var(--text); word-break: break-word; }
.notif-fail { border-color: var(--danger); }

/* mapa */
#mapa-big { height: calc(100vh - 230px); min-height: 420px;
    border-radius: var(--r-lg); border: 1px solid var(--border);
    background: var(--bg-raised); }
.mapa-pin { background: none; border: none; }
.mapa-pin-dot { width: 28px; height: 28px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; font-size: 12px;
    font-weight: 700; color: #fff; border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .35); cursor: pointer; }
.mapa-pin-dot.aprox { opacity: .8; border-style: dashed; }
.mapa-pop { min-width: 190px; }
.mapa-pop .lnk { font-size: 14px; }
.mapa-pop-price { font-size: 17px; font-weight: 700; margin: 4px 0 2px; }

.lnk { color: var(--text); cursor: pointer; }
.lnk:hover { color: var(--accent); text-decoration: underline; }
.lnk-ext { color: var(--text-dim); text-decoration: none; font-size: 13px;
    border: 1px solid var(--border); border-radius: 6px; padding: 0 6px;
    flex-shrink: 0; }
.lnk-ext:hover { color: var(--accent); border-color: var(--accent); }
.btn-portal { display: inline-block; margin: 2px 8px 4px 0; padding: 4px 12px;
    border-radius: 999px; background: var(--accent-dim); color: var(--accent);
    font-size: 13px; font-weight: 600; text-decoration: none; }

/* ---------- modo personal / login ---------- */
body:not(.personal) [data-personal] { display: none !important; }
body:not(.auth) .auth-only { display: none !important; }
body:not(.anon) .anon-only { display: none !important; }
.nav-login { margin-left: auto; color: var(--accent); font-weight: 600;
    border: 1px solid var(--border); }

#login-gate[hidden] { display: none; }
#login-gate {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    background: rgba(14, 20, 32, .45); padding: 20px;
    animation: fadeIn .15s ease both;
}
@keyframes fadeIn { from { opacity: 0; } }
.login-card {
    position: relative;
    background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: var(--r-xl); padding: 36px 34px; width: 100%;
    max-width: 420px; display: flex; flex-direction: column; gap: 14px;
    box-shadow: var(--shadow-pop);
}
.login-close { position: absolute; top: 12px; right: 12px; width: 36px;
    height: 36px; padding: 0; border-radius: 999px; font-size: 20px;
    font-weight: 400; border-color: transparent; color: var(--text-dim); }
.login-card h2 { font-family: var(--font-display); font-size: 28px;
    font-weight: 700; letter-spacing: -.02em; line-height: 1.15;
    display: flex; flex-direction: column; gap: 18px; }
.login-card h2::before {
    content: ""; width: 40px; height: 40px; border-radius: 10px;
    background:
        linear-gradient(45deg, transparent 38%, var(--bg-panel) 38%,
            var(--bg-panel) 62%, transparent 62%),
        linear-gradient(-45deg, transparent 38%, var(--bg-panel) 38%,
            var(--bg-panel) 62%, transparent 62%),
        var(--accent);
    background-size: 20px 20px;
}
.login-card p { margin: 0; font-size: 15px; color: var(--text-dim); }
.login-card input { width: 100%; margin-top: 4px; }
.login-card button { width: 100%; padding: 13px 18px; font-size: 15.5px; }
.login-card .card-meta { font-size: 14px; min-height: 1.5em; }

/* ---------- móvil ---------- */
@media (max-width: 720px) {
    :root { font-size: 15px; }
    .sidebar { height: 56px; padding: 0 14px; }
    .sidebar h1 { font-size: 17px; margin-right: 12px; }
    .sidebar h1::before { width: 24px; height: 24px; }
    .nav-btn { padding: 7px 11px; font-size: 14px; }
    .nav-user #auth-email { display: none; }
    .view-header { padding: 26px 16px 2px; }
    .view-body { padding: 16px 16px 56px; }
    .card { padding: 18px; border-radius: var(--r-md); }
    .quiz { padding: 22px 18px 18px; }
    .ori-hero { padding: 26px 22px 22px; border-radius: var(--r-lg); }
    .ori-hero::after { width: 160px; height: 160px; }
    .ori-hero-stats { gap: 12px 26px; }
    .ori-step-head strong { font-size: 20px; }
    .vs-v { font-size: 28px; }
    .lst-filter select, .lst-filter input { min-width: 0; width: 100%; }
    .lst-filter label { flex: 1 1 140px; }
}

/* ---------- panorama (portada) ---------- */
.pan-kpis { display: grid; gap: 1px; margin: 4px 0 22px;
    grid-template-columns: repeat(5, 1fr);
    background: var(--border); border: 1px solid var(--border);
    border-radius: var(--r-lg); overflow: hidden; }
.pan-kpi { background: var(--bg-panel); padding: 18px 20px; }
.pan-kpi .k { font-size: 13.5px; color: var(--text-dim); }
.pan-kpi .v { font-family: var(--font-display); font-size: 30px;
    font-weight: 700; letter-spacing: -.02em; margin-top: 4px;
    font-variant-numeric: tabular-nums; line-height: 1.15; }
.pan-kpi .v small { font-family: var(--font-ui); font-size: 14px;
    font-weight: 500; color: var(--text-dim); margin-left: 2px; letter-spacing: 0; }
.pan-kpi .s { font-size: 13px; color: var(--text-dim); margin-top: 4px; }
@media (max-width: 1000px) { .pan-kpis { grid-template-columns: repeat(2, 1fr); }
    .pan-kpi:last-child { grid-column: 1 / -1; } }
.pan-chart .card-meta { margin-top: 8px; }
.pan-h { margin: 34px 0 14px; }
.pan-facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
    margin-bottom: 14px; }
.pan-facts > div { background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: var(--r-md); padding: 14px 16px; display: flex;
    flex-direction: column; gap: 2px; }
.pan-facts span { font-size: 13px; color: var(--text-dim); }
.pan-facts b { font-size: 16px; font-weight: 600; }
.pan-facts em { font-style: normal; font-size: 14px; color: var(--text-dim);
    font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .pan-facts { grid-template-columns: 1fr 1fr; } }
.th-sort { background: none; border: none; padding: 0; font: inherit;
    font-size: 13px; font-weight: 500; color: var(--text-dim); border-radius: 4px; }
.th-sort:hover { background: none; color: var(--text); }
.th-sort.on { color: var(--text); font-weight: 600; }
.ori-table th.num, .ori-table td.num { text-align: right; }
.pan-cta { margin-top: 30px; display: flex; align-items: center;
    justify-content: space-between; gap: 18px 28px; flex-wrap: wrap;
    background: var(--accent); color: #fff; border-radius: var(--r-xl);
    padding: 28px 32px; }
.pan-cta-t { font-family: var(--font-display); font-size: 24px; font-weight: 700;
    letter-spacing: -.015em; }
.pan-cta-s { font-size: 15px; opacity: .88; margin-top: 4px; max-width: 56ch; }
.pan-cta-b { background: #fff; color: #18338F; border-color: #fff;
    padding: 13px 22px; font-size: 15.5px; }
.pan-cta-b:hover { background: #EEF1F5; }
/* ---------- inversión (historia y activos) ---------- */
.mk-sec { margin-bottom: 44px; }
.mk-sec > h3 { margin-bottom: 6px; }
.ind-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (max-width: 820px) { .ind-grid { grid-template-columns: 1fr; } }
.ind-card { background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: var(--r-lg); padding: 20px 22px; color: var(--series-1);
    border-top: 4px solid var(--border); }
.ind-card.alto { border-top-color: var(--danger); color: var(--danger); }
.ind-card.medio { border-top-color: var(--albero); color: var(--warn); }
.ind-card.bajo { border-top-color: var(--ok); color: var(--ok); }
.ind-n { font-size: 14px; font-weight: 500; color: var(--text-dim); }
.ind-v { font-family: var(--font-display); font-size: 32px; font-weight: 700;
    letter-spacing: -.02em; color: var(--text); margin: 2px 0 8px;
    font-variant-numeric: tabular-nums; }
.ind-v small { font-family: var(--font-ui); font-size: 14px; font-weight: 500;
    color: var(--text-dim); letter-spacing: 0; }
.ind-l { font-size: 14px; color: var(--text-dim); line-height: 1.55;
    margin-top: 10px; }
.spark { width: 100%; height: 46px; display: block; }
.spark-x { display: flex; justify-content: space-between; font-size: 11.5px;
    color: var(--text-dim); margin-top: 2px; }
.chart-ctl { display: flex; flex-wrap: wrap; gap: 10px 16px;
    justify-content: space-between; margin-bottom: 12px; }
.chips { display: inline-flex; flex-wrap: wrap; gap: 2px; background: var(--bg-raised);
    border-radius: 999px; padding: 3px; }
.chip-btn { border: none; background: none; border-radius: 999px;
    padding: 6px 12px; font-size: 13px; font-weight: 500; color: var(--text-dim); }
.chip-btn:hover { background: none; color: var(--text); }
.chip-btn.on { background: var(--bg-panel); color: var(--text); font-weight: 600;
    box-shadow: 0 1px 2px rgba(20, 30, 55, .08); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px 24px; margin-top: 18px; padding-top: 16px;
    border-top: 1px solid var(--border); }
.mk-sec > .facts { border-top: none; padding-top: 0; }
.facts > div { display: flex; flex-direction: column; gap: 2px; }
.facts b { font-family: var(--font-display); font-size: 24px; font-weight: 700;
    letter-spacing: -.015em; font-variant-numeric: tabular-nums; }
.facts span { font-size: 13.5px; color: var(--text-dim); line-height: 1.45; }
.dinero-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 12px; }
@media (max-width: 820px) { .dinero-grid { grid-template-columns: 1fr; } }
.dinero-grid .card { margin-bottom: 0; }
.calc-t { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.calc-row { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 10px; }
.calc-row label { margin: 0; font-size: 13px; color: var(--text-dim);
    display: flex; flex-direction: column; gap: 6px; }
.calc-row input, .calc-row select { width: 100%; }
@media (max-width: 480px) { .calc-row { grid-template-columns: 1fr 1fr; }
    .calc-row label:first-child { grid-column: 1 / -1; } }
.calc-out { margin-top: 18px; font-size: 15px; }
.calc-out b { display: block; font-family: var(--font-display); font-size: 40px;
    font-weight: 700; letter-spacing: -.02em; color: var(--accent);
    font-variant-numeric: tabular-nums; line-height: 1.1; }
.calc-out span { display: block; color: var(--text-dim); font-size: 13.5px;
    margin-top: 6px; }
.dec-bars { display: flex; flex-direction: column; gap: 7px; }
.dec-row { display: grid; grid-template-columns: 56px 1fr 62px; gap: 10px;
    align-items: center; font-size: 13.5px; }
.dec-row span { color: var(--text-dim); }
.dec-row i { display: block; height: 10px; border-radius: 3px;
    background: var(--albero); }
.dec-row i.neg { background: var(--series-3); }
.dec-row b { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.act-table .dot { display: inline-block; width: 9px; height: 9px;
    border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.act-table td .sub { font-size: 12px; color: var(--text-dim); }
.pan-chart .chart-link { font-weight: 500; cursor: pointer; }

/* ---------- subnavegación (Mi resultado · Calculadoras, …) ---------- */
.subnav { display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 14px;
    background: var(--bg-raised); border-radius: 999px; }
.subnav-btn { border: 0; background: transparent; border-radius: 999px;
    padding: 7px 14px; font-size: 13.5px; color: var(--text-dim); }
.subnav-btn:hover { background: transparent; color: var(--text); }
.subnav-btn.on { background: var(--bg-panel); color: var(--text);
    box-shadow: 0 1px 3px rgba(20, 30, 55, .12); }
button.linkish { border: 0; background: none; padding: 0; color: var(--accent);
    font: inherit; font-weight: 500; text-decoration: underline;
    text-underline-offset: 2px; display: inline; }
button.linkish:hover { background: none; color: var(--accent-ink); }

/* ---------- comparar ---------- */
.cmp-add { position: relative; max-width: 560px; }
.cmp-add input { width: 100%; }
.cmp-sug { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20;
    background: var(--bg-panel); border: 1px solid var(--border-strong);
    border-radius: var(--r-md); box-shadow: var(--shadow-pop); overflow: hidden; }
.cmp-sug-item { display: flex; flex-direction: column; align-items: flex-start;
    width: 100%; border: 0; border-radius: 0; padding: 10px 14px; gap: 1px;
    font-weight: 400; text-align: left; }
.cmp-sug-item b { font-weight: 600; }
.cmp-sug-item span { font-size: 12.5px; color: var(--text-dim); }
.cmp-sug-item + .cmp-sug-item { border-top: 1px solid var(--border); }
.cmp-sug-empty { padding: 12px 14px; color: var(--text-dim); font-size: 14px; }
.cmp-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.cmp-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 14px;
    font-weight: 500; background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: 999px; padding: 4px 4px 4px 12px; }
.cmp-chip i { width: 9px; height: 9px; border-radius: 50%; }
.cmp-chip button { border: 0; padding: 2px 8px; border-radius: 999px;
    font-size: 16px; line-height: 1; color: var(--text-dim); }
.cmp-empty { padding: 26px 0; }
.cmp-table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.cmp-table th, .cmp-table td { padding: 10px 12px; border-bottom: 1px solid var(--border);
    text-align: left; vertical-align: top; }
.cmp-table thead th { font-size: 14px; }
.cmp-table tbody th { font-weight: 500; font-size: 14px; min-width: 180px; }
.cmp-table .num { text-align: right; white-space: nowrap; }
.cmp-table .sub { font-size: 12px; color: var(--text-dim); font-weight: 400;
    white-space: normal; }
.cmp-table td.best { color: var(--ok); font-weight: 600; }
.cmp-table .dot { display: inline-block; width: 9px; height: 9px;
    border-radius: 50%; margin-right: 6px; }
.cmp-links { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; }

/* ---------- pie legal en cada vista ---------- */
.app-legal { margin: 48px 0 8px; font-size: 12.5px; color: var(--text-dim);
    border-top: 1px solid var(--border); padding-top: 14px; }
.app-legal a { color: var(--text-dim); }
.table-wrap { overflow-x: auto; }
@media (max-width: 640px) {
    .cmp-table tbody th { min-width: 120px; position: sticky; left: 0;
        background: var(--bg-panel); z-index: 1; }
    .cmp-table thead th:first-child { position: sticky; left: 0;
        background: var(--bg-panel); z-index: 1; }
    .cmp-table tbody th .sub { display: none; }
    .cmp-table th, .cmp-table td { padding: 9px 8px; }
}

/* ---------- Mi compra: acciones, informe y escenarios ---------- */
.ori-acciones { display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
    margin: -4px 0 18px; }
.ori-escenarios { display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
    width: 100%; margin-top: 4px; }
.ori-escenarios:empty { display: none; }
.esc-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px;
    background: var(--bg-panel); border: 1px solid var(--border); border-radius: 999px;
    padding: 3px 4px 3px 12px; }
.esc-x { border: 0; padding: 2px 8px; border-radius: 999px; font-size: 16px;
    line-height: 1; color: var(--text-dim); background: transparent; }
.ori-compartido { display: flex; gap: 12px; align-items: center; justify-content: space-between;
    flex-wrap: wrap; background: var(--warn-dim); border-radius: var(--r-md);
    padding: 10px 14px; margin-bottom: 14px; font-size: 14px; }
.print-head { display: none; }
button.on { border-color: var(--accent); color: var(--accent); }

/* ---------- seguimiento ---------- */
.seg-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start;
    flex-wrap: wrap; margin-bottom: 8px; }
.seg-delta { display: block; font-size: 12px; font-weight: 600; }
.seg-delta.up { color: var(--danger); }
.seg-delta.down { color: var(--ok); }

/* ---------- impresión / PDF del informe ---------- */
@media print {
    @page { margin: 14mm; }
    html, body { height: auto !important; overflow: visible !important;
        display: block !important; background: #fff !important; color: #000; }
    .sidebar, .subnav, .view:not(.active), .ori-acciones, .ori-stepper,
    #ori-quiz, .ori-compartido, .toast, #login-gate, button, .app-legal a,
    .view-header { display: none !important; }
    .main, .view.active, .view-body { overflow: visible !important; height: auto !important;
        display: block !important; position: static !important; }
    .print-head { display: flex !important; justify-content: space-between;
        border-bottom: 1px solid #999; padding-bottom: 6px; margin-bottom: 14px;
        font-size: 12px; }
    .card { break-inside: avoid; box-shadow: none !important; border-color: #ccc !important; }
    .app-legal { display: block !important; }
}

/* ---------- prueba de estrés de la hipoteca ---------- */
.st-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.st-box { border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px; }
.st-box .k { font-size: 13px; color: var(--text-dim); }
.st-box .v { font-family: var(--font-display); font-size: 28px; font-weight: 700;
    font-variant-numeric: tabular-nums; }
.st-box .v small { font-size: 14px; font-weight: 500; color: var(--text-dim); }
.st-box .s { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.st-table tr.st-alerta td, .st-table tr.st-alerta th { background: var(--danger-dim); }

/* ---------- Mi compra: cifra que falta ---------- */
.ori-falta { padding: 16px 18px; }
.ori-falta p { margin: 0 0 10px; }
.ori-falta-campos { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.ori-falta-campos label { margin: 0; flex: 1 1 220px; }
.ori-falta-campos input { width: 100%; margin-top: 6px; }
.esp-ficha-links { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 12px; }

/* ---------- calculadoras: índice ---------- */
.calc-toc { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 18px; }
.calc-toc .chip-btn { text-decoration: none; color: var(--text) !important;
    background: var(--bg-panel); border: 1px solid var(--border); display: inline-block; }
.calc-toc .chip-btn:hover { border-color: var(--accent); }
.calc-prefill { margin: -6px 0 16px; }
#view-finance h3[id] { scroll-margin-top: 16px; }
tr.ori-row[tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- Mi compra: alternativas asequibles ---------- */
.ori-alt { margin-top: 18px; padding-top: 16px; border-top: 1px solid rgba(58, 44, 5, .18); }
.ori-alt-t { font-weight: 600; margin-bottom: 10px; }
.ori-alt-list { display: flex; gap: 8px; flex-wrap: wrap; }
.ori-alt-b { flex-direction: column; align-items: flex-start; gap: 2px; padding: 9px 14px;
    background: rgba(255, 255, 255, .55); border-color: rgba(58, 44, 5, .2); color: var(--albero-ink); }
.ori-alt-b:hover { background: rgba(255, 255, 255, .85); }
.ori-alt-b span { font-size: 12.5px; font-weight: 500; opacity: .8; }

/* ---------- ficha de municipio: dimensiones de calidad de vida ---------- */
.dims { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 6px 18px; margin: 6px 0 12px; }
.dim { display: grid; grid-template-columns: 92px 1fr 28px; align-items: center; gap: 8px;
    font-size: 13px; }
.dim span { color: var(--text-dim); }
.dim i { display: block; height: 6px; border-radius: 3px; background: var(--bg-raised);
    position: relative; overflow: hidden; }
.dim i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w);
    background: var(--accent); border-radius: 3px; }
.dim b { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- teléfono: navegación y pasos sin cortes ---------- */
@media (max-width: 480px) {
    .sidebar { gap: 0; padding: 0 10px;
        -webkit-mask-image: linear-gradient(to right, #000 88%, transparent);
                mask-image: linear-gradient(to right, #000 88%, transparent); }
    .sidebar h1 { font-size: 0; margin-right: 6px; gap: 0; }
    .nav-btn { padding: 7px 9px; font-size: 13.5px; }
    .ori-sp { font-size: 0; gap: 0; padding: 6px; }
    .ori-sp i { font-size: 12px; }
    .ori-sp.on { font-size: 13px; gap: 6px; padding: 6px 10px; }
}
@media (max-width: 480px) {
    .cmp-table { font-size: 13px; }
    .cmp-table tbody th { min-width: 96px; max-width: 120px; }
    .cmp-table th, .cmp-table td { padding: 8px 6px; }
}
@media (max-width: 480px) {
    .cmp-card { padding: 10px 6px; }
    .cmp-table tbody th { min-width: 84px; }
    .cmp-table th, .cmp-table td { padding: 8px 4px; }
}
@media (max-width: 480px) {
    .cmp-table thead th { white-space: normal; }
    .cmp-table tbody th { min-width: 78px; }
}
.solo-movil { display: none !important; }
@media (max-width: 600px) {
    .solo-movil { display: inline !important; }
    .ori-compacta th:nth-child(n+6), .ori-compacta tr.ori-row td:nth-child(n+6) { display: none; }
}

/* ======================================================================
   Inicio, barra de pestañas (teléfono) y marca
   ====================================================================== */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.sidebar h1 .brand { color: inherit; text-decoration: none; display: inline-flex;
    align-items: center; gap: inherit; }

.home { padding-top: 28px; }
.home-hero { background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: var(--r-lg); padding: clamp(24px, 5vw, 56px);
    position: relative; overflow: hidden; }
.home-hero::after { content: ""; position: absolute; right: -40px; top: -30px;
    width: 260px; height: 260px; opacity: .09; pointer-events: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 240'%3E%3Cpath d='M30 200 A90 90 0 0 1 210 200' fill='none' stroke='%231F4FD1' stroke-width='22' stroke-linecap='round'/%3E%3Cpath d='M120 200 L176 124' stroke='%231F4FD1' stroke-width='14' stroke-linecap='round'/%3E%3Ccircle cx='120' cy='200' r='16' fill='%231F4FD1'/%3E%3C/svg%3E") center / contain no-repeat; }
.home-hero > * { position: relative; z-index: 1; }
.home-kicker { font-size: 13px; font-weight: 600; color: var(--accent);
    letter-spacing: .02em; margin: 0 0 10px; }
.home-hero h2 { font-family: var(--font-display); font-size: clamp(32px, 6vw, 56px);
    line-height: 1.04; letter-spacing: -.025em; margin: 0 0 14px; max-width: 14ch; }
.home-lead { font-size: clamp(16px, 2vw, 19px); color: var(--text-dim); max-width: 46ch;
    margin: 0 0 22px; line-height: 1.5; }
.home-start { display: flex; gap: 8px; flex-wrap: wrap; max-width: 620px; }
.home-start input { flex: 1 1 260px; font-size: 16px; padding: 13px 16px; }
.home-start button { font-size: 16px; padding: 13px 22px; }
.home-proof { font-size: 13px; color: var(--text-dim); margin: 14px 0 0; }
.home-h { margin: 40px 0 12px; font-size: 20px; }
.home-tasks { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.home-task { display: flex; flex-direction: column; gap: 6px; padding: 18px 18px 20px;
    background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--r-md);
    color: var(--text) !important; text-decoration: none;
    transition: border-color .15s, transform .15s, box-shadow .15s; }
.home-task:hover { border-color: var(--accent); transform: translateY(-2px);
    box-shadow: var(--shadow-pop); }
.home-task b { font-size: 16px; }
.home-task span:not(.ht-ic) { font-size: 13.5px; color: var(--text-dim); line-height: 1.45; }
.ht-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-dim);
    display: grid; place-items: center; margin-bottom: 4px; }
.ht-ic svg, .tab-btn svg { width: 22px; height: 22px; fill: none; stroke: var(--accent);
    stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.home-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.home-tile { background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: var(--r-md); padding: 14px 16px; }
.home-tile .k { font-size: 13px; color: var(--text-dim); }
.home-tile .v { font-family: var(--font-display); font-size: 26px; font-weight: 700;
    font-variant-numeric: tabular-nums; margin: 2px 0; }
.home-tile .v.up { color: var(--danger); }
.home-tile .v.down { color: var(--ok); }
.home-tile .s { font-size: 12.5px; color: var(--text-dim); }
.home-busca, .pan-busca { max-width: 560px; }
.pan-busca { margin-bottom: 18px; }
#home-seg:not(:empty) { margin-top: 24px; }
a.cmp-sug-item { text-decoration: none; color: var(--text) !important; }
a.cmp-sug-item:hover, a.cmp-sug-item:focus { background: var(--bg-raised); }

/* barra de pestañas inferior: solo en el teléfono */
.tabbar { display: none; }
@media (max-width: 720px) {
    .sidebar .nav-btn[data-view] { display: none; }
    .sidebar { -webkit-mask-image: none; mask-image: none; justify-content: space-between; }
    .sidebar h1 { font-size: 18px !important; }
    .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed;
        left: 0; right: 0; bottom: 0; z-index: 50; background: var(--bg-panel);
        border-top: 1px solid var(--border);
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
    .tab-btn { display: flex; flex-direction: column; align-items: center; gap: 3px;
        border: 0; background: transparent; padding: 4px 0; font-size: 11.5px;
        font-weight: 500; color: var(--text-dim); border-radius: 10px; }
    .tab-btn svg { stroke: var(--text-dim); }
    .tab-btn.active { color: var(--accent); }
    .tab-btn.active svg { stroke: var(--accent); }
    .tab-btn:hover { background: transparent; }
    .main { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
    .toast { bottom: calc(76px + env(safe-area-inset-bottom)) !important; }
    .home { padding-top: 16px; }
}
@media (max-width: 720px) {
    .sidebar h1 { gap: 9px !important; margin-right: 0 !important; }
    .home-start button { flex: 1 1 100%; }
    .home-tasks { gap: 8px; }
    .home-task { display: grid; grid-template-columns: 40px 1fr; column-gap: 14px;
        row-gap: 2px; padding: 14px; align-items: start; }
    .home-task .ht-ic { grid-row: 1 / span 2; margin: 0; }
    .home-tiles { grid-template-columns: 1fr 1fr; gap: 8px; }
    .home-tile { padding: 12px; }
    .home-tile .v { font-size: 21px; }
    .home-h { margin-top: 32px; }
}
.ori-summary-top { margin-bottom: 14px; }
.ori-summary-txt span.ori-sum-k { background: none; padding-left: 0; font-weight: 600; color: var(--text); }
.pan-busca-row { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 18px; }
.pan-busca-row .pan-busca { flex: 1 1 280px; margin: 0; }
.pan-busca-row .btn { padding: 11px 16px; }
@media (max-width: 720px) { .tabbar { grid-template-columns: repeat(5, 1fr); } .tab-btn { font-size: 11px; } }
.pan-conv { display: block; font-size: 12px; margin-top: 2px; }

/* ---------- Invertir: piso en alquiler o bolsa ---------- */
.ai-card { padding: 20px 22px; }
.ai-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px 14px; margin-bottom: 12px; }
.ai-form .fld label, .ai-zona label { display: block; font-size: 13px; font-weight: 500;
    margin-bottom: 6px; color: var(--text-dim); }
.ai-form input { width: 100%; }
.ai-zona { grid-column: span 2; }
.ai-mas { margin: 0 0 14px; }
.ai-mas summary { cursor: pointer; color: var(--accent); font-size: 14px; margin-bottom: 10px; }
.ai-verdict { margin-top: 18px; border-radius: var(--r-md); padding: 16px 18px;
    background: var(--albero); color: var(--albero-ink); }
.ai-verdict.bolsa { background: var(--accent-dim); color: var(--text); }
.ai-verdict .k { font-size: 13px; font-weight: 600; }
.ai-verdict .v { font-family: var(--font-display); font-size: clamp(22px, 3.5vw, 30px);
    font-weight: 700; line-height: 1.15; margin: 4px 0; }
.ai-verdict .s { font-size: 14px; }
@media (max-width: 560px) { .ai-zona { grid-column: auto; } .ai-card { padding: 16px 14px; } }
a.ori-alt-b { display: inline-flex; flex-direction: column; align-items: flex-start; text-decoration: none; color: var(--albero-ink) !important; }

/* ---- trayecto al trabajo (Comprar) ---- */
.geo-campo { position: relative; }
.geo-campo input { width: 100%; }
.geo-modos { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.geo-modos label { display: inline-flex; align-items: center; gap: 6px; margin: 0;
    font-size: 14.5px; font-weight: 500; cursor: pointer; }
.geo-modos input { width: auto !important; margin: 0; }
.geo-mas { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.geo-mas summary { cursor: pointer; color: var(--accent); font-size: 14.5px; font-weight: 500; }
.geo-priv { margin-top: 12px !important; }
.tray-card { margin-bottom: 16px; }
.tray-head { display: flex; justify-content: space-between; align-items: flex-start;
    gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.tray-head strong { display: block; font-size: 17px; }
.tray-lead { margin: 6px 0 12px; }
.tray-ops { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.tray-op { display: flex; flex-direction: column; align-items: stretch; gap: 6px;
    text-align: left; font-weight: 400; padding: 12px 14px; border-radius: var(--r-md);
    border: 1px solid var(--border); background: var(--bg-panel); }
.tray-op:hover { border-color: var(--accent); background: var(--bg-panel); }
.tray-op-h { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.tray-op-h b { font-size: 15.5px; }
.tray-op-p { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.tray-ts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tray-t { font-size: 13px; padding: 2px 8px; border-radius: 999px; background: var(--bg-raised);
    color: var(--text-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tray-t.on { background: var(--accent-dim); color: var(--accent); font-weight: 600; }
.tray-vs { font-size: 13px; color: var(--text); }
.tray-hoy { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px;
    border-radius: var(--r-md); background: var(--bg-raised); margin-bottom: 10px; }
.tray-inter { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.tray-fr { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.tray-fr span { font-size: 13px; padding: 4px 9px; border: 1px solid var(--border);
    border-radius: 999px; font-variant-numeric: tabular-nums; }
td.tray-lento { color: var(--warn); }
@media (max-width: 560px) { .tray-ops { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
    .ori-hero::after { width: 150px; height: 150px; right: -36px; top: -36px; }
    .home-hero::after { width: 170px; height: 170px; right: -50px; top: -40px; }
}


/* =================== capa casómetro (marca nov-2026) ===================
   Titulares y cifras en Space Grotesk, interlineado apretado; tarjetas
   con radio amplio y borde cálido; el veredicto en tinta con la aguja
   amarilla; Inicio con el medidor de ejemplo a la derecha. */
:root { --r-md: 14px; --r-lg: 20px; --r-xl: 26px; }
h2, h3, .view-header h2, .quiz-q, .ori-step-head strong, .home-h, .tray-head strong {
    letter-spacing: -.03em; }
.view-header h2 { font-size: clamp(30px, 4.4vw, 44px); line-height: 1.04; }
.card, .chart-card { border-radius: var(--r-lg); }
button.primary, .btn.primary { border-radius: 12px; min-height: 46px; }
.chip { border-radius: 999px; }

/* veredicto: tinta, cifra en amarillo, medidor */
.ori-hero { background: #121826; color: #F7F7F4;
    display: grid; grid-template-columns: minmax(0, 1fr) 220px; column-gap: 32px; }
.ori-hero > * { grid-column: 1; }
.ori-hero::after { display: none; }
.ori-hero-gauge { grid-column: 2; grid-row: 1 / span 4; align-self: start;
    width: 220px; height: auto; margin-top: 6px; }
.ori-hero-stats { grid-column: 1 / -1; border-top-color: rgba(255, 255, 255, .14); }
.ori-hero-k, .ori-hero-stat .k { color: #C9CEDA; opacity: 1; }
.ori-hero-num { color: #F2B705; }
.ori-hero-num.neg { color: #FFB4A2; }
.ori-hero-warn { background: rgba(255, 255, 255, .08); }
.ori-hero .ori-alt { border-top-color: rgba(255, 255, 255, .14); }
.ori-hero a.ori-alt-b { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .18);
    color: #F7F7F4 !important; }
.ori-hero a.ori-alt-b:hover { background: rgba(255, 255, 255, .16); }
.ori-hero a { color: #F2B705; }
@media (max-width: 720px) {
    .ori-hero { grid-template-columns: minmax(0, 1fr); }
    .ori-hero-gauge { grid-column: 1; grid-row: auto; width: 170px; margin: 0 0 6px; order: -1; }
}

/* Inicio: texto a la izquierda, medidor de ejemplo a la derecha */
.home-hero { display: flex; flex-wrap: wrap; align-items: center; gap: 32px 48px; }
.home-hero::after { display: none; }
.home-hero-txt { flex: 999 1 440px; min-width: 0; }
.home-hero-demo { flex: 1 1 300px; min-width: 0; background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--r-lg); padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.home-hero-demo svg { width: 100%; height: auto; }
.home-hero-demo ul { list-style: none; display: flex; flex-direction: column; gap: 8px; margin: 0; }
.home-hero-demo li { display: flex; gap: 10px; align-items: baseline; font-size: 15px; }
.home-hero-demo li b { font-family: var(--font-display); color: var(--accent); min-width: 18px; }
.home-pill { display: inline-block; padding: 6px 12px; border-radius: 999px; background: #F2B705;
    color: #121826; font-size: 13.5px; font-weight: 600; margin: 0 0 14px; }
.home-hero h2 { letter-spacing: -.04em; line-height: 1.02; }
.home-task b, .home-tile .v { font-family: var(--font-display); letter-spacing: -.02em; }
.home-task { border-radius: var(--r-lg); }


/* ---- capa casómetro, 2: más cerca de la maqueta ----
   Inicio sin caja: el titular respira sobre el yeso; la tarjeta del
   medidor es la única caja. Tareas sin iconos, título en Space Grotesk.
   Formularios: campos altos con borde de 1,5 px. */
.home-hero { background: transparent; border: 0; border-radius: 0;
    padding: clamp(28px, 6vw, 72px) 0 clamp(20px, 4vw, 48px); }
.home-hero h2 { font-size: clamp(42px, 6.4vw, 66px); line-height: 1.0; margin: 0 0 22px; }
.home-lead { font-size: clamp(17px, 1.6vw, 20px); color: var(--text-2); max-width: 34em; }
.home-hero-demo { background: var(--bg-panel); border-radius: 24px; padding: 26px 26px 22px;
    box-shadow: 0 1px 0 rgba(18, 24, 38, .02); }
.home-demo-k { font-size: 13.5px; color: var(--text-dim); }
.home-proof { font-size: 14px; }
.home-h { font-size: 24px; margin: 28px 0 14px; }
.home-tasks { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.home-task { padding: 22px; gap: 8px; }
.home-task .ht-ic { display: none; }
.home-task b { font-size: 19px; line-height: 1.2; }
.home-task span:not(.ht-ic) { font-size: 14.5px; line-height: 1.5; color: var(--text-2); }
.home-task:hover { transform: none; box-shadow: none; border-color: var(--accent); }

input, select, textarea { border-width: 1.5px; border-radius: 12px; min-height: 48px; }
textarea { min-height: 96px; }
input[type="checkbox"], input[type="radio"] { min-height: 0; border-width: 1px; }
button, .btn { border-radius: 12px; }
button.primary, .btn.primary { min-height: 48px; font-size: 15.5px; padding-left: 22px; padding-right: 22px; }
.card { border-radius: 20px; padding: 26px; }
.view-header { padding-top: 48px; }
.view-header .section-sub { font-size: 17px; color: var(--text-2); }
.quiz-opt { border-radius: 14px; }
.quiz-opt.on, .quiz-opt[aria-pressed="true"] { border-color: var(--accent); }
.ori-sp.on i, .nav-btn.active { font-weight: 600; }
@media (max-width: 720px) {
    .home-hero { padding-top: 22px; gap: 24px; }
    .home-hero-demo { padding: 20px; }
    .card { padding: 20px; }
    .view-header { padding-top: 28px; }
}
.home-tasks { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
@media (max-width: 720px) {
    .home-hero-demo svg { max-width: 260px; align-self: center; }
    .home-tasks { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .home-task { padding: 16px; display: flex; flex-direction: column; }
    .home-task b { font-size: 16.5px; }
}
@media (max-width: 380px) { .home-tasks { grid-template-columns: 1fr; } }

/* ---- capa casómetro, 3: detalles de la maqueta ---- */
.sidebar { height: 68px; border-bottom-color: #E4E3DC; }
.sidebar h1 { font-size: 24px; gap: 10px; margin-right: 28px; }
.sidebar h1::before { width: 30px; height: 30px; }
.nav-btn { font-size: 15px; color: var(--text-2); padding: 8px 14px; }
.nav-btn.active { background: #E8EEFC; color: var(--accent); }
.home-start input, .home-start button { min-height: 52px; }
.home-proof { color: var(--text-dim); }
.home-hero-demo { border-radius: 24px; padding: 28px; }
.home-task { border-radius: 18px; }
.home-task b { font-size: 20px; }
@media (max-width: 720px) {
    .sidebar { height: 58px; }
    .sidebar h1 { font-size: 21px !important; }
    .sidebar h1::before { width: 26px; height: 26px; }
    .home-task b { font-size: 16.5px; }
}


/* ---- el relojito: tiempo máximo de ida ---- */
.reloj { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 26px; margin-top: 4px; }
.reloj-dial { position: relative; width: 180px; height: 180px; flex-shrink: 0; }
.reloj-dial svg { width: 100%; height: 100%; touch-action: none; cursor: grab; user-select: none; }
.reloj-dial svg:active { cursor: grabbing; }
.reloj-fondo { fill: var(--bg-panel); stroke: var(--border-strong); stroke-width: 1.5; }
.reloj-arco { fill: none; stroke: var(--accent); stroke-width: 7; stroke-linecap: round; opacity: .9; }
.reloj-tick { stroke: var(--text-dim); stroke-width: 2; stroke-linecap: round; }
.reloj-h { font: 600 10px var(--font-ui); fill: var(--text-dim); text-anchor: middle; }
.reloj-aguja { stroke: var(--text); stroke-width: 4; stroke-linecap: round; }
.reloj-eje { fill: var(--albero); stroke: var(--text); stroke-width: 2.5; }
.reloj-asa { fill: var(--albero); stroke: var(--text); stroke-width: 2.5; }
.reloj-valor { position: absolute; left: 0; right: 0; top: 112px; text-align: center;
    font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: -.02em;
    pointer-events: none; }
.reloj-ctrl { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.reloj-pasos { display: flex; align-items: center; gap: 10px; }
.reloj-pasos input[type="range"] { flex: 1; min-height: 0; padding: 0; border: 0; background: none;
    accent-color: var(--accent); }
.reloj-btn { width: 44px; height: 44px; padding: 0; border-radius: 50%; font-size: 22px; line-height: 1; }
.reloj-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.reloj-chips button { min-height: 36px; padding: 6px 12px; border-radius: 999px; font-size: 13.5px;
    font-weight: 500; }
.reloj-chips button.on { background: #E8EEFC; border-color: var(--accent); color: var(--accent); font-weight: 600; }
.reloj-nota { margin: 0 !important; }
.ori-hero-supuesto { display: block; margin-top: 6px; font-size: 14px; font-weight: 400; color: #C9CEDA; }
.ori-hero .ori-alt-b { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .18);
    color: #F7F7F4 !important; }
.ori-hero .ori-alt-b:hover { background: rgba(255, 255, 255, .16); }
.ori-hero .ori-alt-b span { color: #C9CEDA; opacity: 1; }
