/* =========================================================
   Rivello Accadia — Panel del residente
   Estética: Cálido residencial — arena/oliva, serif suave
   ========================================================= */

#pluggio-root {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}

:root {
    /* — Paleta base (arena/oliva) — */
    --bg: oklch(97.8% 0.012 85);
    /* arena muy claro */
    --bg-2: oklch(95.5% 0.018 85);
    /* arena */
    --bg-3: oklch(92.5% 0.022 82);
    /* arena media */
    --surface: oklch(99.2% 0.006 85);
    /* blanco cálido */
    --surface-2: oklch(98.5% 0.010 85);
    --line: oklch(88% 0.018 82);
    --line-soft: oklch(92% 0.014 82);

    --ink: oklch(24% 0.018 60);
    /* tinta marrón oscura */
    --ink-2: oklch(38% 0.020 60);
    --ink-3: oklch(52% 0.020 65);
    --ink-4: oklch(65% 0.018 70);

    /* Acentos — misma cromaticidad, hue distinta */
    --olive: oklch(52% 0.08 125);
    /* oliva principal */
    --olive-2: oklch(62% 0.08 125);
    --olive-soft: oklch(92% 0.05 125);
    --olive-ink: oklch(32% 0.06 125);

    --terra: oklch(55% 0.10 38);
    /* terracota (alertas) */
    --terra-soft: oklch(93% 0.05 38);
    --terra-ink: oklch(38% 0.09 38);

    --gold: oklch(70% 0.10 80);
    /* dorado suave */
    --gold-soft: oklch(94% 0.05 80);

    /* Tipografía */
    --serif: "Fraunces", "Cormorant Garamond", Georgia, serif;
    --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;

    /* Radios y sombras */
    --r-sm: 6px;
    --r: 10px;
    --r-lg: 16px;
    --r-xl: 22px;

    --shadow-xs: 0 1px 0 0 oklch(88% 0.018 82 / 0.4);
    --shadow-sm: 0 1px 2px oklch(30% 0.02 60 / 0.04), 0 0 0 1px oklch(88% 0.018 82 / 0.5);
    --shadow: 0 2px 8px oklch(30% 0.02 60 / 0.05), 0 0 0 1px oklch(88% 0.018 82 / 0.5);
    --shadow-lg: 0 8px 32px oklch(30% 0.02 60 / 0.10), 0 0 0 1px oklch(88% 0.018 82 / 0.4);

    /* Layout */
    --sidebar-w: 232px;
    --gap: 20px;
    --max: 1440px;
}

/* ========== Contener shortcodes ========== */

/* Forzar que TODO dentro de nuestro .main respete el ancho */
#pluggio-main {
    min-width: 0;
    overflow-x: hidden;
    position: relative;
}

/* Anular cualquier .app anidado (creado por shortcodes) */
#pluggio-main .app {
    display: block !important;
    /* Anula grid */
    grid-template-columns: none !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* Anular cualquier .main anidado */
#pluggio-main .main {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Forzar que elementos del shortcode no se salgan */
#pluggio-main * {
    max-width: 100%;
}

/* Específico para el shortcode de presupuesto */
.plg-budget-breakout {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

.plg-budget-dashboard {
    margin-bottom: 0 !important;
    /* Anula el 24px que se sale */
    width: 100% !important;
}

/* Forzar que cards del shortcode se ajusten */
.plg-budget-admin-dashboard .card,
.plg-budget-breakout .card {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Densidad compacta (Tweak) */
.density-compact {
    --gap: 14px;
}

.density-compact .card {
    padding: 18px;
}

.density-compact .kpi-card {
    padding: 18px;
}

/* Modo 'puro' — más monocromático (Tweak) */
.mode-pure {
    --bg: oklch(98.5% 0.004 85);
    --bg-2: oklch(96.5% 0.006 85);
    --olive: oklch(35% 0.02 85);
    --olive-2: oklch(45% 0.02 85);
    --olive-soft: oklch(93% 0.008 85);
}

/* ========== Reset ========== */
* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-feature-settings: "ss01", "cv11";
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

table {
    border-collapse: collapse;
    width: 100%;
}

/* ========== Tipografía ========== */
.serif {
    font-family: var(--serif);
    font-optical-sizing: auto;
}

.mono {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
}

.num {
    font-variant-numeric: tabular-nums;
}

h1,
h2,
h3,
h4 {
    margin: 0;
    font-weight: 400;
}

.eyebrow {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-3);
    font-weight: 500;
}

/* ========== Layout ========== */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}

.app.with-subnav {
    grid-template-columns: var(--sidebar-w) 208px 1fr;
}

/* ========== Subnav (sección Presupuesto) ========== */
.subnav {
    background: var(--surface-2);
    border-right: 1px solid var(--line-soft);
    padding: 28px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.subnav-section {
    margin-bottom: 14px;
}

.subnav-section+.subnav-section {
    margin-top: 6px;
}

.subnav-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--ink-4);
    font-weight: 500;
    padding: 0 12px;
    margin-bottom: 8px;
}

.subnav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--r-sm);
    color: var(--ink-2);
    font-size: 13px;
    text-decoration: none;
    transition: background 120ms, color 120ms;
    cursor: pointer;
}

.subnav-item:hover {
    background: var(--bg-2);
    color: var(--ink);
}

.subnav-item.active {
    background: var(--ink);
    color: var(--bg);
}

.subnav-item.active .subnav-icon {
    color: var(--bg);
}

.subnav-icon {
    width: 15px;
    height: 15px;
    color: var(--ink-3);
    flex-shrink: 0;
}

.subnav-foot {
    margin-top: auto;
    padding: 14px 12px;
    border-top: 1px solid var(--line-soft);
    font-size: 11px;
    color: var(--ink-4);
    font-family: var(--mono);
    letter-spacing: -0.01em;
    line-height: 1.5;
}

.subnav-foot strong {
    color: var(--ink-2);
    font-weight: 500;
}

@media (max-width: 1100px) {
    .app.with-subnav {
        grid-template-columns: var(--sidebar-w) 1fr;
    }

    .subnav {
        display: none;
    }
}

.sidebar {
    background: var(--bg-2);
    border-right: 1px solid var(--line);
    padding: 28px 20px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.main {
    min-width: 0;
    padding: 28px 36px 60px;
    max-width: var(--max);
}

/* ========== Sidebar ========== */
.brand {
    display: block;
    margin-bottom: 40px;
}

.brand-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 34px;
    max-width: 100%;
}

.brand-logo {
    display: block;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 0;
    object-fit: contain;
    background: transparent;
}

.brand-name {
    display: block;
    min-width: 0;
    font-family: var(--serif);
    font-size: 17px;
    letter-spacing: -0.01em;
    color: var(--ink);
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.brand-sub {
    display: block;
    font-size: 10.5px;
    color: var(--ink-3);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-top: 8px;
    padding-left: 44px;
    line-height: 1.45;
}

.nav-group {
    margin-bottom: 20px;
}

.nav-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-4);
    margin: 0 10px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--r-sm);
    color: var(--ink-2);
    font-size: 13.5px;
    cursor: pointer;
    transition: background 120ms, color 120ms;
    position: relative;
    text-decoration: none;
}

.nav-item:hover {
    background: var(--bg-3);
    color: var(--ink);
}

.nav-item.active {
    background: var(--ink);
    color: var(--bg);
}

.nav-item.active .nav-icon {
    color: var(--bg);
}

.nav-icon {
    width: 16px;
    height: 16px;
    color: var(--ink-3);
    flex-shrink: 0;
}

.nav-icon svg {
    display: block;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-item-logout {
    margin-top: 2px;
    color: #7c3f35;
}

.nav-item-logout .nav-icon {
    color: #9a5a4f;
}

.nav-item-logout:hover {
    background: #f5e8e4;
    color: #5f2d26;
}

.nav-badge {
    margin-left: auto;
    background: var(--terra);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 999px;
    min-width: 18px;
    text-align: center;
}

.nav-item.active .nav-badge {
    background: var(--bg);
    color: var(--ink);
}

.user-card {
    margin-top: auto;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--r);
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--olive-soft), var(--gold-soft));
    display: grid;
    place-items: center;
    font-family: var(--serif);
    font-size: 14px;
    color: var(--olive-ink);
    font-weight: 500;
}

.user-name {
    font-size: 13px;
    color: var(--ink);
    line-height: 1.2;
}

.user-unit {
    font-size: 11px;
    color: var(--ink-3);
    margin-top: 1px;
}

/* ========== Header ========== */
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 28px;
    gap: 20px;
    flex-wrap: wrap;
}

.page-title {
    font-family: var(--serif);
    font-size: 34px;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--ink);
    font-weight: 400;
}

.page-title em {
    font-style: italic;
    color: var(--olive-ink);
}

.page-sub {
    color: var(--ink-3);
    font-size: 13.5px;
    margin-top: 6px;
}

.head-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: var(--r-sm);
    font-size: 13px;
    font-weight: 500;
    transition: all 120ms;
    border: 1px solid transparent;
    white-space: nowrap;
}

.btn-primary {
    background: var(--ink);
    color: var(--bg);
}

.btn-primary:hover {
    background: var(--olive-ink);
}

.btn-ghost {
    background: transparent;
    color: var(--ink-2);
    border-color: var(--line);
}

.btn-ghost:hover {
    background: var(--surface);
    border-color: var(--ink-4);
    color: var(--ink);
}

.btn-olive {
    background: var(--olive);
    color: white;
}

.btn-olive:hover {
    background: var(--olive-ink);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: var(--r-sm);
    border: 1px solid var(--line);
    color: var(--ink-3);
}

.btn-icon:hover {
    background: var(--surface);
    color: var(--ink);
}

/* ========== Card ========== */
.card {
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-lg);
    padding: 24px;
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 18px;
    gap: 12px;
}

.card-title {
    font-family: var(--serif);
    font-size: 20px;
    letter-spacing: -0.01em;
    color: var(--ink);
    line-height: 1.2;
}

.card-sub {
    font-size: 12px;
    color: var(--ink-3);
    margin-top: 4px;
}

/* ========== KPI Row ========== */
.kpi-row {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
    gap: var(--gap);
    margin-bottom: var(--gap);
}

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-lg);
    padding: 22px 24px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 168px;
}

.kpi-hero {
    background: linear-gradient(160deg, oklch(24% 0.018 60) 0%, oklch(30% 0.025 70) 100%);
    color: var(--bg);
    border-color: transparent;
}

.kpi-hero .kpi-label,
.kpi-hero .kpi-meta {
    color: oklch(80% 0.018 70);
}

.kpi-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-3);
    font-weight: 500;
}

.kpi-value {
    font-family: var(--serif);
    font-size: 40px;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin-top: 10px;
    font-variant-numeric: tabular-nums;
    font-weight: 400;
}

.kpi-hero .kpi-value {
    color: var(--bg);
    font-size: 52px;
}

.kpi-value .cents {
    font-size: 0.55em;
    color: var(--ink-3);
    margin-left: 2px;
    letter-spacing: 0;
}

.kpi-hero .kpi-value .cents {
    color: oklch(75% 0.02 70);
}

.kpi-meta {
    font-size: 12px;
    color: var(--ink-3);
    margin-top: auto;
    padding-top: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.kpi-delta {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.kpi-delta.up {
    background: var(--olive-soft);
    color: var(--olive-ink);
}

.kpi-delta.down {
    background: var(--terra-soft);
    color: var(--terra-ink);
}

.kpi-delta.neutral {
    background: var(--bg-2);
    color: var(--ink-3);
}

.kpi-spark {
    position: absolute;
    inset: auto 0 0 0;
    height: 48px;
    opacity: 0.5;
    pointer-events: none;
}

.kpi-hero .kpi-spark {
    opacity: 0.35;
}

/* Alert banner dentro del hero */
.hero-pills {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.hero-pill {
    font-size: 11.5px;
    padding: 4px 10px;
    border-radius: 999px;
    background: oklch(100% 0 0 / 0.12);
    color: var(--bg);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.hero-pill.warn {
    background: var(--terra);
    color: white;
}

.kpi-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.kpi-hero .btn-primary {
    background: var(--bg);
    color: var(--ink);
}

.kpi-hero .btn-primary:hover {
    background: oklch(98% 0.02 85);
}

.kpi-hero .btn-ghost {
    color: var(--bg);
    border-color: oklch(100% 0 0 / 0.2);
}

.kpi-hero .btn-ghost:hover {
    background: oklch(100% 0 0 / 0.08);
    border-color: oklch(100% 0 0 / 0.4);
}

/* KPI puntualidad */
.punct-ring {
    width: 64px;
    height: 64px;
    position: absolute;
    right: 22px;
    top: 22px;
}

/* ========== Charts Row ========== */
.charts-row {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: var(--gap);
    margin-bottom: var(--gap);
}

.chart-wrap {
    position: relative;
    width: 100%;
}

/* Legend */
.legend {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--ink-3);
    flex-wrap: wrap;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    display: inline-block;
}

/* Tabs */
.tabs {
    display: inline-flex;
    background: var(--bg-2);
    border-radius: var(--r-sm);
    padding: 3px;
    gap: 2px;
}

.tab {
    padding: 6px 12px;
    font-size: 12px;
    color: var(--ink-3);
    border-radius: 5px;
    font-weight: 500;
}

.tab:hover {
    color: var(--ink);
}

.tab.active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-xs);
}

/* ========== Donut ========== */
.donut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.donut-value {
    font-family: var(--serif);
    font-size: 28px;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.donut-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-3);
    margin-top: 2px;
}

.donut-legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 18px;
}

.donut-legend-item {
    display: grid;
    grid-template-columns: 10px 1fr auto;
    gap: 10px;
    align-items: center;
    font-size: 12.5px;
    padding: 6px 0;
    border-top: 1px solid var(--line-soft);
}

.donut-legend-item:first-child {
    border-top: 0;
    padding-top: 2px;
}

.donut-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.donut-legend-value {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    color: var(--ink);
}

/* ========== Heatmap ========== */
.heatmap {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 6px;
}

.heatmap-month {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.heatmap-cell {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 100ms;
}

.heatmap-cell:hover {
    transform: scale(1.15);
}

.heatmap-label {
    font-size: 10px;
    color: var(--ink-4);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
}

/* ========== Table ========== */
.ledger {
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-lg);
    overflow: hidden;
}

.ledger-head {
    padding: 20px 24px 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    border-bottom: 1px solid var(--line-soft);
}

.ledger-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.search {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-2);
    border-radius: var(--r-sm);
    padding: 6px 12px;
    font-size: 12.5px;
    color: var(--ink-3);
    min-width: 220px;
    border: 1px solid transparent;
}

.search:focus-within {
    border-color: var(--line);
    background: var(--surface);
    color: var(--ink);
}

.search input {
    border: 0;
    background: transparent;
    outline: none;
    font: inherit;
    color: inherit;
    flex: 1;
    min-width: 0;
}

table.table {
    font-size: 13px;
}

.table th {
    text-align: left;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-4);
    font-weight: 500;
    padding: 12px 16px;
    background: var(--bg-2);
    border-bottom: 1px solid var(--line-soft);
}

.table th:first-child {
    padding-left: 24px;
}

.table th:last-child {
    padding-right: 24px;
    text-align: right;
}

.table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: top;
    color: var(--ink-2);
}

.table td:first-child {
    padding-left: 24px;
}

.table td:last-child {
    padding-right: 24px;
    text-align: right;
}

.table tr:last-child td {
    border-bottom: 0;
}

.table tr:hover td {
    background: oklch(97% 0.012 85 / 0.6);
}

.td-concept {
    color: var(--ink);
    font-weight: 500;
}

.td-desc {
    color: var(--ink-3);
    font-size: 12px;
    margin-top: 2px;
}

.td-amount {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--ink);
}

.td-amount.charge {
    color: var(--terra-ink);
}

.td-amount.payment {
    color: var(--olive-ink);
}

.td-folio {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--ink-4);
}

.td-date-mono {
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--ink-3);
    letter-spacing: -0.02em;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 999px;
    font-weight: 500;
    white-space: nowrap;
}

.status-pending {
    background: var(--gold-soft);
    color: oklch(40% 0.08 70);
}

.status-overdue {
    background: var(--terra-soft);
    color: var(--terra-ink);
}

.status-paid {
    background: var(--olive-soft);
    color: var(--olive-ink);
}

.status-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}

/* ========== Side column sections ========== */
.side-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: var(--gap);
    margin-top: var(--gap);
}

.notice {
    padding: 16px 0;
    border-bottom: 1px solid var(--line-soft);
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 14px;
}

.notice:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.notice:first-child {
    padding-top: 0;
}

.notice-date {
    font-family: var(--serif);
    font-size: 22px;
    line-height: 1;
    color: var(--ink);
    text-align: center;
    padding-top: 2px;
}

.notice-month {
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-3);
    margin-top: 3px;
}

.notice-title {
    font-size: 13.5px;
    color: var(--ink);
    font-weight: 500;
    margin-bottom: 3px;
}

.notice-body {
    font-size: 12.5px;
    color: var(--ink-3);
    line-height: 1.5;
}

/* Amenities */
.amenity {
    display: grid;
    grid-template-columns: 38px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--line-soft);
}

.amenity:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.amenity:first-child {
    padding-top: 0;
}

.amenity-ico {
    width: 38px;
    height: 38px;
    border-radius: var(--r-sm);
    background: var(--bg-2);
    display: grid;
    place-items: center;
    color: var(--ink-2);
}

.amenity-name {
    font-size: 13px;
    color: var(--ink);
    font-weight: 500;
}

.amenity-meta {
    font-size: 11.5px;
    color: var(--ink-3);
    margin-top: 1px;
}

.amenity-cta {
    font-size: 11.5px;
    color: var(--olive-ink);
    padding: 4px 10px;
    border-radius: var(--r-sm);
    background: var(--olive-soft);
    font-weight: 500;
}

.amenity-cta.busy {
    background: var(--bg-2);
    color: var(--ink-4);
}

/* ========== Modal ========== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: oklch(24% 0.018 60 / 0.35);
    backdrop-filter: blur(4px);
    display: grid;
    place-items: center;
    z-index: 100;
    animation: fadeIn 180ms ease;
}

.modal {
    background: var(--surface);
    border-radius: var(--r-xl);
    width: min(520px, 92vw);
    max-height: 92vh;
    overflow: auto;
    box-shadow: 0 32px 80px oklch(20% 0.02 60 / 0.2);
    animation: slideUp 240ms cubic-bezier(0.2, 0.9, 0.3, 1);
}

.modal-head {
    padding: 24px 28px 16px;
    border-bottom: 1px solid var(--line-soft);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.modal-body {
    padding: 20px 28px;
}

.modal-foot {
    padding: 16px 28px 24px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px solid var(--line-soft);
}

.amount-display {
    text-align: center;
    padding: 20px 0 24px;
}

.amount-display .eyebrow {
    margin-bottom: 8px;
}

.amount-display .big {
    font-family: var(--serif);
    font-size: 48px;
    letter-spacing: -0.02em;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.amount-display .big .cents {
    font-size: 0.5em;
    color: var(--ink-3);
}

.pay-option {
    display: grid;
    grid-template-columns: 20px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    margin-bottom: 10px;
    cursor: pointer;
    transition: border-color 120ms, background 120ms;
}

.pay-option:hover {
    border-color: var(--ink-4);
}

.pay-option.selected {
    border-color: var(--ink);
    background: var(--bg-2);
}

.radio-dot {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--line);
    border-radius: 50%;
    display: grid;
    place-items: center;
}

.pay-option.selected .radio-dot {
    border-color: var(--ink);
}

.pay-option.selected .radio-dot::after {
    content: "";
    width: 8px;
    height: 8px;
    background: var(--ink);
    border-radius: 50%;
}

.pay-name {
    font-size: 13px;
    color: var(--ink);
    font-weight: 500;
}

.pay-detail {
    font-size: 11.5px;
    color: var(--ink-3);
    margin-top: 1px;
}

.pay-toggle {
    display: flex;
    gap: 8px;
    padding: 4px;
    background: var(--bg-2);
    border-radius: var(--r);
    margin-bottom: 18px;
}

.pay-toggle-opt {
    flex: 1;
    padding: 10px;
    text-align: center;
    font-size: 12.5px;
    border-radius: 6px;
    color: var(--ink-3);
    font-weight: 500;
}

.pay-toggle-opt.active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-xs);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== Tweaks Panel ========== */
.tweaks {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 280px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    padding: 18px;
    z-index: 200;
    font-size: 12.5px;
}

.tweaks-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.tweaks-title {
    font-family: var(--serif);
    font-size: 16px;
    color: var(--ink);
}

.tweak-row {
    margin-bottom: 12px;
}

.tweak-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-3);
    margin-bottom: 6px;
}

.seg {
    display: flex;
    background: var(--bg-2);
    border-radius: var(--r-sm);
    padding: 3px;
    gap: 2px;
}

.seg-opt {
    flex: 1;
    padding: 6px 8px;
    font-size: 11.5px;
    text-align: center;
    border-radius: 5px;
    color: var(--ink-3);
    cursor: pointer;
    font-weight: 500;
}

.seg-opt.active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-xs);
}

/* Tooltip */
.tip {
    position: absolute;
    background: var(--ink);
    color: var(--bg);
    font-size: 11px;
    padding: 6px 10px;
    border-radius: 6px;
    pointer-events: none;
    white-space: nowrap;
    transform: translate(-50%, -130%);
    box-shadow: 0 4px 12px oklch(20% 0.02 60 / 0.2);
    z-index: 50;
    font-variant-numeric: tabular-nums;
}

.tip::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -4px;
    transform: translateX(-50%) rotate(45deg);
    width: 8px;
    height: 8px;
    background: var(--ink);
}

.tip strong {
    color: var(--bg);
    font-weight: 600;
}

.tip .tip-label {
    color: oklch(75% 0.02 70);
    margin-right: 6px;
}

/* ========== Section header ========== */
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin: 8px 0 16px;
    gap: 16px;
    flex-wrap: wrap;
}

.section-title {
    font-family: var(--serif);
    font-size: 22px;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.section-rule {
    flex: 1;
    height: 1px;
    background: var(--line-soft);
    align-self: center;
    margin: 0 4px;
}

/* ========== Mobile ========== */
.mobile-header {
    display: none;
}

.mobile-nav {
    display: none;
}

@media (max-width: 960px) {
    .app {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 14px 18px;
        background: var(--surface);
        border-bottom: 1px solid var(--line-soft);
        position: sticky;
        top: 0;
        z-index: 20;
    }

    .main {
        padding: 20px 18px 100px;
    }

    .page-title {
        font-size: 26px;
    }

    .kpi-row {
        grid-template-columns: 1fr;
    }

    .charts-row {
        grid-template-columns: 1fr;
    }

    .side-grid {
        grid-template-columns: 1fr;
    }

    .kpi-value {
        font-size: 34px;
    }

    .kpi-hero .kpi-value {
        font-size: 42px;
    }

    .heatmap {
        grid-template-columns: repeat(6, 1fr);
    }

    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--surface);
        border-top: 1px solid var(--line);
        padding: 8px;
        z-index: 30;
        justify-content: space-around;
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        padding: 6px 10px;
        font-size: 10px;
        color: var(--ink-3);
        border-radius: var(--r-sm);
    }

    .mobile-nav-item.active {
        color: var(--ink);
        background: var(--bg-2);
    }

    .tweaks {
        right: 12px;
        bottom: 80px;
        width: calc(100% - 24px);
        max-width: 320px;
    }

    .table th,
    .table td {
        padding: 10px 12px;
        font-size: 12px;
    }

    .table th:first-child,
    .table td:first-child {
        padding-left: 16px;
    }

    .table th:last-child,
    .table td:last-child {
        padding-right: 16px;
    }

    .table .hide-mobile {
        display: none;
    }
}

@media (max-width: 600px) {
    .ledger-head {
        flex-direction: column;
        align-items: stretch;
    }

    .search {
        min-width: 0;
    }
}

/* ========== Budget Topbar (sin sidebars) ========== */
.app-full {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--surface);
    border-bottom: 1px solid var(--line-soft);
    backdrop-filter: saturate(140%) blur(6px);
}

.topbar-inner {
    max-width: var(--max);
    margin: 0 auto;
    padding: 14px 36px;
    display: flex;
    align-items: center;
    gap: 18px;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--ink);
    text-decoration: none;
}

.topbar-brand:hover .brand-name {
    color: var(--olive-ink);
}

.topbar-brand-text {
    line-height: 1.15;
}

.topbar-brand .brand-name {
    font-family: var(--serif);
    font-size: 16px;
    letter-spacing: -0.01em;
    color: var(--ink);
    transition: color 120ms;
}

.topbar-brand .brand-sub {
    font-size: 11px;
    color: var(--ink-3);
    font-family: var(--mono);
    letter-spacing: -0.01em;
    margin-top: 1px;
}

.topbar-divider {
    width: 1px;
    height: 28px;
    background: var(--line-soft);
}

.topbar-menu-wrap {
    position: relative;
}

.topbar-menu {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px 8px 12px;
    border-radius: var(--r-sm);
    border: 1px solid var(--line-soft);
    background: var(--bg-2);
    color: var(--ink);
    font-size: 13px;
    font-weight: 500;
    transition: background 120ms, border-color 120ms;
}

.topbar-menu:hover {
    background: var(--bg-3);
    border-color: var(--line);
}

.topbar-menu.open {
    background: var(--ink);
    color: var(--bg);
    border-color: var(--ink);
}

.topbar-menu.open .topbar-menu-chev {
    transform: rotate(90deg);
}

.topbar-menu-chev {
    transition: transform 160ms ease;
}

.topbar-pop {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 320px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    padding: 10px;
    z-index: 200;
    animation: btbPopIn 140ms ease-out;
}

@keyframes btbPopIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btb-section-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-4);
    font-weight: 500;
    padding: 8px 12px 6px;
}

.btb-row {
    display: grid;
    grid-template-columns: 26px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 8px 12px;
    border-radius: var(--r-sm);
    text-decoration: none;
    color: var(--ink-2);
    transition: background 100ms;
}

.btb-row:hover {
    background: var(--bg-2);
    color: var(--ink);
}

.btb-row.active {
    background: var(--bg-2);
}

.btb-row-ico {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: var(--bg-3);
    display: grid;
    place-items: center;
    color: var(--ink-2);
}

.btb-row.active .btb-row-ico {
    background: var(--ink);
    color: var(--bg);
}

.btb-row-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.btb-row-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
}

.btb-row-desc {
    font-size: 11.5px;
    color: var(--ink-4);
}

.btb-row-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--olive);
}

.btb-divider {
    height: 1px;
    background: var(--line-soft);
    margin: 6px 4px;
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-cycle {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.2;
}

.topbar-cycle-lbl {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-4);
    font-weight: 500;
}

.topbar-cycle-val {
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--ink-2);
    letter-spacing: -0.01em;
}

.topbar-back {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: var(--r-sm);
    color: var(--ink-3);
    border: 1px solid var(--line-soft);
    transition: background 120ms, color 120ms;
}

.topbar-back:hover {
    background: var(--bg-2);
    color: var(--ink);
}

.topbar-avatar {
    width: 34px;
    height: 34px;
    font-size: 12px;
}

.main-full {
    max-width: var(--max);
    margin: 0 auto;
    width: 100%;
    padding: 28px 36px 60px;
}

@media (max-width: 760px) {
    .topbar-inner {
        padding: 12px 18px;
        gap: 12px;
        flex-wrap: wrap;
    }

    .topbar-brand-text .brand-sub {
        display: none;
    }

    .topbar-divider {
        display: none;
    }

    .topbar-cycle {
        display: none;
    }

    .topbar-pop {
        min-width: calc(100vw - 36px);
        left: auto;
        right: 0;
    }

    .main-full {
        padding: 20px 18px 40px;
    }
}
