/* ── Self-hosted fonts (Bauhaus / Option B) ────────────────────
   Poppins (geometric UI) + JetBrains Mono (tabular numbers).
   Self-hosted under static/fonts/ and served from 'self' so the strict
   CSP (style-src/font-src 'self') actually loads them — the old Google
   Fonts <link> was CSP-blocked and silently fell back to system fonts.
   Subsets: latin + latin-ext (covers Spanish accents). Regenerate via
   scripts/fetch_fonts.py. */
@font-face{font-family:'Poppins';font-style:normal;font-weight:300;font-display:swap;src:url('/static/fonts/poppins-300-latin-ext.woff2') format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;}
@font-face{font-family:'Poppins';font-style:normal;font-weight:300;font-display:swap;src:url('/static/fonts/poppins-300-latin.woff2') format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}
@font-face{font-family:'Poppins';font-style:normal;font-weight:400;font-display:swap;src:url('/static/fonts/poppins-400-latin-ext.woff2') format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;}
@font-face{font-family:'Poppins';font-style:normal;font-weight:400;font-display:swap;src:url('/static/fonts/poppins-400-latin.woff2') format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}
@font-face{font-family:'Poppins';font-style:normal;font-weight:500;font-display:swap;src:url('/static/fonts/poppins-500-latin-ext.woff2') format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;}
@font-face{font-family:'Poppins';font-style:normal;font-weight:500;font-display:swap;src:url('/static/fonts/poppins-500-latin.woff2') format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}
@font-face{font-family:'Poppins';font-style:normal;font-weight:600;font-display:swap;src:url('/static/fonts/poppins-600-latin-ext.woff2') format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;}
@font-face{font-family:'Poppins';font-style:normal;font-weight:600;font-display:swap;src:url('/static/fonts/poppins-600-latin.woff2') format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}
@font-face{font-family:'Poppins';font-style:normal;font-weight:700;font-display:swap;src:url('/static/fonts/poppins-700-latin-ext.woff2') format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;}
@font-face{font-family:'Poppins';font-style:normal;font-weight:700;font-display:swap;src:url('/static/fonts/poppins-700-latin.woff2') format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:400;font-display:swap;src:url('/static/fonts/jetbrains-mono-400-latin-ext.woff2') format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:400;font-display:swap;src:url('/static/fonts/jetbrains-mono-400-latin.woff2') format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:500;font-display:swap;src:url('/static/fonts/jetbrains-mono-500-latin-ext.woff2') format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:500;font-display:swap;src:url('/static/fonts/jetbrains-mono-500-latin.woff2') format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:700;font-display:swap;src:url('/static/fonts/jetbrains-mono-700-latin-ext.woff2') format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:700;font-display:swap;src:url('/static/fonts/jetbrains-mono-700-latin.woff2') format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* Brand */
    --green-primary: #3D4630;
    --green-light: #EFF4EB;
    --green-dark: #2B3122;
    --lime: #AEC911;
    --lime-light: #C7DF5D;
    --lime-muted: rgba(174, 201, 17, 0.15);

    /* Neutrals */
    /* Page background. Was #F5F6F3 — G>R>B, i.e. a green cast — which made every
       white card read as a slab floating on tinted paper. Neutral and a touch
       lighter: the cards still separate, but as a clean step rather than a
       colour clash. House style is "no tinted backgrounds; colour lives in the
       accents", and this token was quietly breaking it.
       Only three consumers: body, the login container, the page loader. */
    --bg: #F7F7F7;
    --white: #ffffff;
    --gray-25: #FAFBF9;
    --gray-50: #F0F1EE;
    --gray-100: #E4E5E2;
    --gray-200: #D1D3CE;
    --gray-300: #B8BAB5;
    --gray-400: #9A9C97;
    --gray-500: #6E706B;
    --gray-600: #55575E;
    --gray-700: #3C3E38;
    --gray-800: #2A2C26;
    --gray-900: #1A1C17;

    /* Semantic */
    --red: #d32f2f;
    --red-light: #ffeaea;
    --coral: #FF5757;
    --blue: #1976d2;
    --blue-light: #e3f2fd;
    --blue-accent: #60CAFF;
    --yellow: #F4CD29;
    --yellow-light: #FFF8E1;

    /* Sidebar */
    --sidebar-bg: #2B3122;
    /* Contrast: 0.65 on #2B3122 = ~3.2:1 (fails WCAG AA). 0.85 = ~4.8:1 ✓. */
    --sidebar-text: rgba(255,255,255,0.85);
    --sidebar-text-hover: rgba(255,255,255,1);
    --sidebar-text-active: #ffffff;
    --sidebar-hover: rgba(255,255,255,0.06);
    --sidebar-active-bg: rgba(174,201,17,0.15);
    --sidebar-active-accent: var(--lime);
    --sidebar-width: 208px;
    --sidebar-collapsed-width: 52px;

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;

    /* Radii */
    --radius-sm: 4px;
    --radius: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;

    /* Card / panel padding — token so desktop + mobile stay in sync. */
    --card-padding: 14px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);

    /* Typography — Bauhaus / Option B. Swap a font here and it propagates
       everywhere; every rule references these vars, never a literal family. */
    --font-ui: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', ui-monospace, monospace;

    /* Bauhaus primaries — used for geometric accents (rule bars, motifs).
       The green/lime brand + semantic data colors above stay authoritative. */
    --bh-red: #E63A27;
    --bh-blue: #1A4FA0;
    --bh-yellow: #F2C200;
}

body {
    font-family: var(--font-ui);
    background: var(--bg);
    color: var(--gray-900);
    line-height: 1.5;
    /* Fluid font sizing for laptops: ~13.5px @ 1280, 14px @ 1440, 15px @ 1700,
       16px @ 1920+. Tablet/mobile clamp to 14px floor so tap targets stay sane. */
    font-size: clamp(13.5px, 0.7vw + 8px, 16px);
}

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

/* ── App Layout ──────────────────────────────────────────── */
.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}
.app-layout.sidebar-collapsed {
    grid-template-columns: var(--sidebar-collapsed-width) 1fr;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.2s ease, min-width 0.2s ease;
    z-index: 200;
}
/* Hide the scrollbar entirely — still scrollable via wheel/touch. The sidebar
   can overflow when both invoice groups are expanded; a visible track on the
   dark green chrome reads as visual noise. */
.sidebar { scrollbar-width: none; }              /* Firefox */
.sidebar { -ms-overflow-style: none; }           /* IE/Edge legacy */
.sidebar::-webkit-scrollbar { width: 0; height: 0; }
.sidebar::-webkit-scrollbar-thumb { background: transparent; }

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 16px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}
.sidebar-logo { height: 28px; flex-shrink: 0; }
.sidebar-title {
    font-weight: 600;
    font-size: 16px;
    color: var(--sidebar-text-active);
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-toggle {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s, background 0.2s;
}
.sidebar-toggle:hover { color: var(--sidebar-text-active); background: var(--sidebar-hover); }

/* Collapsed sidebar */
.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
    min-width: var(--sidebar-collapsed-width);
}
.sidebar-collapsed .sidebar-logo,
.sidebar-collapsed .sidebar-title,
.sidebar-collapsed .nav-group-label,
.sidebar-collapsed .nav-chevron,
.sidebar-collapsed .nav-item span,
.sidebar-collapsed .user-name,
.sidebar-collapsed .nav-footer-link span { display: none; }

.sidebar-collapsed .sidebar-header { justify-content: center; padding: 16px 8px 12px; }
.sidebar-collapsed .sidebar-toggle {
    margin-left: 0;
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    background: var(--sidebar-hover);
}
.sidebar-collapsed .sidebar-toggle:hover {
    background: rgba(255,255,255,0.15);
}
.sidebar-collapsed .sidebar-toggle svg { transform: rotate(180deg); }
.sidebar-collapsed .nav-group-header { justify-content: center; padding: 8px; }
.sidebar-collapsed .nav-item { justify-content: center; padding: 8px; }
.sidebar-collapsed .nav-footer-link { justify-content: center; padding: 8px; }
.sidebar-collapsed .sidebar-user { justify-content: center; }
.sidebar-collapsed .sidebar-footer { padding: 12px 8px; }

/* Sidebar Nav */
.sidebar-nav {
    flex: 1;
    padding: 8px 0;
    overflow-y: auto;
}

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

.nav-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 16px;
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    cursor: pointer;
    transition: color 0.2s;
}
.nav-group-header:hover { color: var(--sidebar-text-hover); }
.nav-chevron { margin-left: auto; transition: transform 0.2s; flex-shrink: 0; }
.nav-group-header[aria-expanded="false"] .nav-chevron { transform: rotate(-90deg); }

.nav-group-items {
    list-style: none;
    overflow: hidden;
    transition: max-height 0.2s ease;
}
.nav-group-header[aria-expanded="false"] + .nav-group-items {
    max-height: 0 !important;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 16px 7px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 400;
    border-left: 3px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-hover);
}
.nav-item.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-text-active);
    border-left-color: var(--sidebar-active-accent);
    font-weight: 500;
}
.nav-item svg { flex-shrink: 0; opacity: 0.7; }
.nav-item.active svg { opacity: 1; }

.nav-standalone-group {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.nav-standalone-group--top {
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-top: none;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

/* Sidebar Footer */
.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 12px 12px;
    flex-shrink: 0;
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 4px;
    margin-bottom: 4px;
}
.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--lime);
    color: var(--green-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}
.user-name {
    font-size: 13px;
    color: var(--sidebar-text-active);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-footer-link {
    padding: 6px 8px !important;
    font-size: 12px !important;
    border-left: none !important;
}
.nav-logout { color: var(--coral) !important; }
.nav-logout:hover { background: rgba(255, 87, 87, 0.1) !important; color: var(--coral) !important; }

/* ── Content Area ────────────────────────────────────────── */
.content-area {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    height: 48px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-100);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--gray-700);
    cursor: pointer;
    padding: 4px;
}

.topbar-breadcrumb {
    font-size: 13px;
    color: var(--gray-500);
    flex: 1;
}
.topbar-breadcrumb a {
    color: var(--gray-500);
    text-decoration: none;
}
.topbar-breadcrumb a:hover { color: var(--green-primary); }
.topbar-breadcrumb .bc-sep { margin: 0 6px; color: var(--gray-300); }
.topbar-breadcrumb .bc-current { color: var(--gray-700); font-weight: 500; }

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

/* EN/ES language switcher — flat segmented control */
.lang-switcher { display: inline-flex; gap: 0; margin: 0; }
.lang-switcher .lang-btn {
    border: 1px solid var(--gray-200);
    background: var(--white);
    color: var(--gray-600);
    font: 600 11px/1 var(--font-mono);
    letter-spacing: 0.5px;
    padding: 6px 9px;
    cursor: pointer;
}
.lang-switcher .lang-btn:first-child { border-radius: 3px 0 0 3px; border-right: 0; }
.lang-switcher .lang-btn:last-child  { border-radius: 0 3px 3px 0; }
.lang-switcher .lang-btn:hover { background: var(--gray-100); color: var(--gray-800); }
.lang-switcher .lang-btn.active { background: var(--green-primary); color: var(--white); border-color: var(--green-primary); }
.lang-switcher--login { display: inline-flex; }

.topbar-cmd-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 12px;
    color: var(--gray-500);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.topbar-cmd-btn:hover { border-color: var(--gray-300); background: var(--gray-100); }
.cmd-label-short { display: none; }
.cmd-label-full { display: inline; }
.topbar-cmd-btn kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 3px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-600);
}

/* ── Content ─────────────────────────────────────────────── */
.content {
    flex: 1;
    /* Fluid horizontal padding: 18px @ 1280, 26px @ 1920+. */
    padding: clamp(14px, 1.2vw, 22px) clamp(18px, 1.6vw, 28px);
    /* Capped max-width prevents content from sprawling on ultrawide
       monitors. The wrapper is centered (margin-inline: auto in tab-shell
       override below) so 1920px+ shows a comfortable column instead of a
       desert of empty space. */
    max-width: 1680px;
    width: 100%;
    margin-inline: auto;
}

/* ── Flash Messages ───────────────────────────────────────── */
.flash-messages { margin-bottom: 16px; }
/* Unauth pages (login/reset): float the flash top-center OVER the full-bleed
   dark field — in-flow it renders as a white band above the background.
   Styled like the login card: white elevated surface, deep soft shadow, flat
   radius, category color as a top rule (mirrors the card's lime cap rule). */
.flash-messages--overlay {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9800;
    width: min(420px, calc(100vw - 32px));
    margin: 0;
}
.flash-messages--overlay .flash {
    background: var(--white);
    border-top: 3px solid var(--gray-300);
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 48px rgba(0,0,0,.35), 0 4px 12px rgba(0,0,0,.22);
    padding: 13px 16px;
    animation: flashFloatIn 0.3s ease-out;
}
.flash-messages--overlay .flash-success { background: var(--white); color: var(--green-dark); border-top-color: var(--lime); }
.flash-messages--overlay .flash-error   { background: var(--white); color: var(--red);        border-top-color: var(--red); }
.flash-messages--overlay .flash-info    { background: var(--white); color: var(--gray-700);   border-top-color: var(--blue); }
@keyframes flashFloatIn {
    from { opacity: 0; transform: translateY(-14px); }
    to   { opacity: 1; transform: translateY(0); }
}
.flash {
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}
.flash-success { background: var(--green-light); color: var(--green-dark); }
.flash-error { background: var(--red-light); color: var(--red); }
.flash-info { background: var(--blue-light); color: var(--blue); }
.flash-close { background: none; border: none; font-size: 18px; cursor: pointer; opacity: 0.6; }
.flash-close:hover { opacity: 1; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: var(--card-padding);
    margin-bottom: 16px;
}

/* ── Page Header ──────────────────────────────────────────── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.page-header h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }

/* ── Stat Strip (Bloomberg-style) ────────────────────────── */
.stat-strip {
    display: flex;
    gap: 1px;
    background: var(--gray-200);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 16px;
}
.stat-cell {
    flex: 1;
    background: var(--white);
    padding: 13px 14px 12px;
    min-width: 0;
}
.stat-cell-label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-500);
    display: block;
    margin-bottom: 4px;
}
.stat-cell-value {
    font-family: var(--font-mono);
    font-size: 19px;
    font-weight: 700;
    color: var(--green-primary);
    display: block;
    line-height: 1.15;
    letter-spacing: -0.01em;
}
.stat-cell-amount {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--gray-500);
    display: block;
    margin-top: 3px;
}

/* Stat cell color accents — Bloomberg: flat cells, color lives in numbers + thin rules */
.stat-cell--yellow { border-top: 3px solid var(--yellow); }
.stat-cell--yellow .stat-cell-value { color: #B8860B; }
.stat-cell--yellow .stat-cell-label { color: #B8860B; }

.stat-cell--blue { border-top: 3px solid var(--blue-accent); }
.stat-cell--blue .stat-cell-value { color: var(--blue); }
.stat-cell--blue .stat-cell-label { color: var(--blue); }

.stat-cell--coral { border-top: 3px solid var(--coral); }
.stat-cell--coral .stat-cell-value { color: var(--coral); }
.stat-cell--coral .stat-cell-label { color: var(--coral); }

.stat-cell--green { border-top: 3px solid var(--lime); }
.stat-cell--green .stat-cell-value { color: var(--green-primary); }
.stat-cell--green .stat-cell-label { color: var(--green-primary); }

/* Neutral graphite — for headline counts where color would compete with the
   semantic cells (En Cobro = amber, Recaudado = green, etc.). */
.stat-cell--neutral { border-top: 3px solid var(--gray-700); }
.stat-cell--neutral .stat-cell-value { color: var(--gray-900); }
.stat-cell--neutral .stat-cell-label { color: var(--gray-700); }

/* Violet — for Generadas (issued FVs awaiting collection). Distinct from
   Pipeline (blue) so the dashboard reads as 5 different states at a glance. */
.stat-cell--violet { border-top: 3px solid #7B61C9; }
.stat-cell--violet .stat-cell-value { color: #5C45A1; }
.stat-cell--violet .stat-cell-label { color: #5C45A1; }

/* FV KPI cells tied to a payment status — accent matches the status tag so the
   dashboard tile and its badge read as the same color (Generada = blue,
   Recaudo Parcial = purple). Mirrors .tag-fv-generada / .tag-fv-recaudo-parcial. */
.stat-cell--fv-generada { border-top: 3px solid #1565c0; }
.stat-cell--fv-generada .stat-cell-value,
.stat-cell--fv-generada .stat-cell-label { color: #1565c0; }

.stat-cell--fv-parcial { border-top: 3px solid #7b1fa2; }
.stat-cell--fv-parcial .stat-cell-value,
.stat-cell--fv-parcial .stat-cell-label { color: #7b1fa2; }

/* ── Inicio A — Command Center home ─────────────────────────────────────── */
.home-grid7 { display: grid; grid-template-columns: 7fr 5fr; gap: 12px; margin-bottom: 16px; }
@media (max-width: 900px) { .home-grid7 { grid-template-columns: 1fr; } }

/* compact cash projection panel — KPI row with hairline dividers */
.home-cash-stats { display: flex; gap: 0; margin: 2px 0 14px; flex-wrap: wrap; }
.home-cash-stats > div { padding: 4px 28px 2px 0; }
.home-cash-stats > div + div { padding-left: 28px; border-left: 1px solid var(--gray-100); }
.home-cash-stats .l { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-500); font-weight: 600; margin-bottom: 2px; }
.home-cash-stats .v { font-size: 24px; font-weight: 700; font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; color: var(--gray-900); line-height: 1.15; }
.home-cash-stats .v--neg { color: var(--coral); }
.home-cash-spark { display: block; width: 100%; height: 88px; }
.home-cash-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; align-items: start; margin-top: 4px; }
@media (max-width: 860px) { .home-cash-charts { grid-template-columns: 1fr; } }
.home-chart-cap { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-700); margin: 4px 0 10px; border-left: 3px solid var(--lime); padding-left: 8px; line-height: 1.3; }

/* compact flows — cobros / pagos, two columns */
.home-flows { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 560px) { .home-flows { grid-template-columns: 1fr; } }
.home-flow-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.home-flow-head .t { font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.home-flow-head .t--in { color: #2f7d32; }
.home-flow-head .t--out { color: var(--coral); }
.home-flow-row { display: flex; gap: 8px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--gray-50); font-size: 12px; cursor: pointer; }
.home-flow-row:hover { background: var(--gray-25); }
.home-flow-row .d { flex: 0 0 40px; color: var(--gray-400); font-family: var(--font-mono); font-size: 11px; }
.home-flow-row .n { flex: 1; color: var(--gray-700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-flow-row .a { font-family: var(--font-mono); font-weight: 600; }
.home-flow-row .a--in { color: #2f7d32; }
.home-flow-row .a--out { color: var(--coral); }
.home-flow-empty { color: var(--gray-400); font-size: 12px; padding: 8px 0; }

/* tabbed activity panel */
.home-tabs { display: inline-flex; gap: 2px; background: var(--gray-100); border-radius: 7px; padding: 3px; }
.home-tab { padding: 5px 14px; border: none; background: transparent; border-radius: 5px; font: inherit; font-size: 12px; font-weight: 600; color: var(--gray-600); cursor: pointer; }
.home-tab.on { background: var(--white); color: var(--green-primary); box-shadow: var(--shadow); }
.home-tab-panel { display: none; }
.home-tab-panel.on { display: block; }

/* ── Inicio C — Digest (non-admin) ──────────────────────────────────────── */
.home-dchips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.home-dchip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 13px; border-radius: 8px; border: 1px solid var(--gray-200); background: var(--white); font-size: 12px; font-weight: 600; color: var(--gray-700); text-decoration: none; }
.home-dchip:hover { border-color: var(--gray-300); }
.home-dchip .b { font-family: var(--font-mono); font-weight: 700; }
.home-dchip--warn { border-color: #f3d24d; background: #fffdf3; }
.home-dchip--warn .b { color: #B8860B; }
.home-dchip--go { color: var(--green-primary); }
.home-feed-dir { width: 20px; text-align: center; font-weight: 700; }
.home-feed-dir--in { color: #2f7d32; }
.home-feed-dir--out { color: var(--coral); }

/* KPI cell with sparkline — extends .stat-cell, used in the home strip. */
.stat-strip--kpi .stat-cell { padding: 9px 12px 7px; position: relative; }
.kpi-cell { display: flex; flex-direction: column; cursor: pointer; transition: background 0.1s; }
a.kpi-cell:hover { background: var(--gray-25); }
.kpi-cell-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 2px;
}
.kpi-cell-head .stat-cell-label { margin-bottom: 0; }
.kpi-delta {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.kpi-delta--up { color: #2e7d32; }
.kpi-delta--down { color: var(--coral); }
.kpi-spark {
    width: 100%;
    height: 22px;
    margin-top: 4px;
    color: var(--gray-500);
    opacity: 0.85;
    pointer-events: none;
}
.stat-cell--green .kpi-spark { color: var(--green-primary); }
.stat-cell--yellow .kpi-spark { color: #B8860B; }
.stat-cell--violet .kpi-spark { color: #5C45A1; }
.stat-cell--coral .kpi-spark { color: var(--coral); }

/* Home board — 12-col grid for the new dashboard rows. */
.home-board {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.home-board-cash { grid-column: span 7; min-width: 0; }
.home-board-events { grid-column: span 5; min-width: 0; }
.home-board--twin .home-board-fv,
.home-board--twin .home-board-fg { grid-column: span 6; min-width: 0; }
@media (max-width: 1100px) {
    .home-board-cash, .home-board-events,
    .home-board--twin .home-board-fv, .home-board--twin .home-board-fg {
        grid-column: span 12;
    }
}

/* Próximos eventos panel — AR / AP stacked lists. */
.events-panel { padding: 12px 14px; height: 100%; display: flex; flex-direction: column; }
.events-block + .events-block { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--gray-100); }
.events-block-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}
.events-block-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.events-block-label--in { color: #2e7d32; }
.events-block-label--out { color: var(--coral); }
.events-block-count {
    font-size: 11px;
    color: var(--gray-600);
    font-family: var(--font-mono);
}
.events-list { list-style: none; padding: 0; margin: 0; }
.events-row {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    gap: 10px;
    padding: 5px 0;
    border-bottom: 1px solid var(--gray-50);
    font-size: 12px;
    cursor: pointer;
}
.events-row:hover { background: var(--gray-25); }
.events-date { color: var(--gray-400); font-size: 11px; }
.events-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--gray-900);
}
.events-amount { color: #2e7d32; font-weight: 600; }
.events-amount--out { color: var(--coral); }
.events-empty {
    font-size: 12px;
    color: var(--gray-500);
    margin: 6px 0;
    padding: 4px 0;
}

/* Detail fold — collapses legacy panels. */
.home-detail-fold {
    margin-top: 18px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0 14px;
}
.home-detail-fold[open] { padding-bottom: 12px; }
.home-detail-summary {
    cursor: pointer;
    padding: 10px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    list-style: none;
    user-select: none;
}
.home-detail-summary::-webkit-details-marker { display: none; }
.home-detail-summary::before {
    content: '▸ ';
    color: var(--gray-500);
    margin-right: 6px;
}
.home-detail-fold[open] > .home-detail-summary::before { content: '▾ '; }

/* .mobile-only / .desktop-only / .mobile-home* / .mobile-action* CSS removed
   2026-05-20 — replaced by server-side template branching via render_responsive().
   Mobile-specific styles now live in static/mobile.css, loaded only by
   templates/mobile/base.html. */

/* Year pill row — used on /admin/siigo/reconcile and other year-scoped pages. */
.year-pills { display: inline-flex; gap: 4px; }
.year-pill {
    padding: 4px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    background: var(--white);
    color: var(--gray-700);
    font-family: var(--font-mono);
    font-size: 12px;
    text-decoration: none;
    transition: border-color 0.1s, background 0.1s, color 0.1s;
}
.year-pill:hover { border-color: var(--gray-500); color: var(--gray-900); }
.year-pill.is-active {
    background: var(--green-primary);
    border-color: var(--green-primary);
    color: var(--white);
    font-weight: 600;
}

/* Cash projection chart — pure SVG, server-rendered. */
.cash-chart-card { padding: 14px 16px 12px; }
.cash-chart-svg {
    width: 100%;
    height: auto;
    max-height: 240px;
    display: block;
    margin-top: 4px;
}
.cash-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 11px;
    color: var(--gray-600);
    margin-top: 10px;
    font-family: var(--font-mono);
}
.cash-chart-legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    margin-right: 5px;
    vertical-align: middle;
}

/* Legacy stat cards (keep for compatibility during transition) */
.stats-row { display: flex; gap: 12px; margin-bottom: 16px; }
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 14px 20px;
    text-align: center;
    border-top: 3px solid var(--green-primary);
    flex: 1;
}
.stat-card-ap { border-top-color: var(--yellow); }
.stat-card-tc { border-top-color: var(--blue-accent); }
.stat-card-ad { border-top-color: var(--coral); }
.stat-number { font-family: var(--font-mono); font-size: 26px; font-weight: 700; color: var(--green-primary); }
.stat-label { font-size: 12px; color: var(--gray-500); margin-top: 2px; }
.stat-amount { font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--gray-700); margin-top: 4px; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    border: none;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--green-primary); color: white; }
.btn-primary:hover { background: var(--lime); color: var(--green-primary); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #b71c1c; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-600);
    margin-bottom: 4px;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 13px;
    transition: border-color 0.2s;
    background: var(--white);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--lime);
    box-shadow: 0 0 0 3px rgba(174, 201, 17, 0.2);
}

.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 120px; }
.form-actions { display: flex; gap: 12px; margin-top: 16px; }

.form-group-checkbox { display: flex; align-items: center; flex: 0 0 auto; }
.form-group-checkbox label { display: flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; }

/* ── Tables ───────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left;
    padding: 8px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}
.data-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--gray-200);
    font-size: 13px;
}
.data-table tbody tr { cursor: pointer; transition: background 0.1s; }
.data-table tbody tr:hover { background: var(--green-light); }
.data-table tbody tr:nth-child(even) { background: var(--gray-25); }
.data-table tbody tr:nth-child(even):hover { background: var(--green-light); }

/* Dense table variant */
.data-table--dense th { padding: 6px 10px; font-size: 10px; }
.data-table--dense td { padding: 5px 10px; font-size: 12px; line-height: 1.35; }

/* Sticky-header variant — keep the column labels anchored while rows scroll. */
.data-table--sticky thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--white);
    box-shadow: 0 1px 0 var(--gray-200);
}

/* Numeric column alignment */
.col-numeric {
    font-family: var(--font-mono);
    text-align: right !important;
    font-variant-numeric: tabular-nums;
}

/* Sortable headers */
.sortable { cursor: pointer; user-select: none; }
.sortable:hover { color: var(--green-primary); }
.sort-arrow { font-size: 10px; margin-left: 2px; opacity: 0.4; }
.sort-arrow.asc::after { content: '\25B2'; }
.sort-arrow.desc::after { content: '\25BC'; }
.sortable.active .sort-arrow { opacity: 1; }

/* Row keyboard focus */
.data-table tbody tr.row-focus {
    background: var(--lime-muted) !important;
    outline: 2px solid var(--lime);
    outline-offset: -2px;
}

.filename { font-family: var(--font-mono); font-size: 11px; color: var(--gray-500); }
.empty-cell { text-align: center; color: var(--gray-500); padding: 24px !important; }
.text-muted { color: var(--gray-500); font-size: 12px; }

/* ── Tags ─────────────────────────────────────────────────── */
.tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
}
.tag-cc { background: var(--blue-light); color: var(--blue); }
.tag-particular { background: #fff3e0; color: #e65100; }
.tag-a-pagar { background: var(--yellow-light); color: #8a4a00; }
.tag-recurrente { background: var(--green-light); color: var(--green-dark); }
.tag-no-recurrente { background: #f3e5f5; color: #7b1fa2; }

/* FV payment status tags */
.tag-fv-generada { background: #e3f2fd; color: #1565c0; }
.tag-fv-notificada { background: #e8eaf6; color: #283593; }
.tag-fv-en-cobro { background: var(--yellow-light); color: #8a4a00; }
.tag-fv-recaudo-parcial { background: #f3e5f5; color: #7b1fa2; }
.tag-fv-recaudado { background: var(--green-light); color: var(--green-dark); }
.tag-fv-conciliar { background: #fce4ec; color: #c62828; }
.tag-fv-revisar { background: #fff3e0; color: #e65100; }
.tag-fv-anulada { background: #ffebee; color: #8b0000; }

/* Reconciliation badges + month group separator — /admin/siigo/reconcile detail. */
.pill {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 3px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.2px;
    background: var(--gray-200, #e8e8e8);
    color: var(--gray-700, #444);
    vertical-align: middle;
}
.pill--green  { background: var(--green-light); color: var(--green-dark); }
.pill--coral  { background: #ffe3e3; color: #b02020; }
.pill--violet { background: #ece7f7; color: #5C45A1; }
tr.group-row td {
    background: var(--green-light);
    color: var(--green-dark);
    font-size: 11px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    padding-top: 6px;
    padding-bottom: 6px;
}

/* Generic ingest-preview status tags */
.tag-info { background: var(--blue-light); color: var(--blue); }
.tag-success { background: var(--green-light); color: var(--green-dark); }
.tag-warn { background: var(--yellow-light); color: #8a4a00; }
.tag-danger { background: #ffebee; color: #8b0000; }

/* Bloomberg-style maintenance status pill — sits in the topbar's right-side
   action cluster. No background fill; color lives in the border + dot. */
.topbar-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border: 1px solid currentColor;
    border-radius: 3px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-decoration: none;
    line-height: 1.1;
    margin-right: 8px;
}
.topbar-status--active  { color: #B8860B; }
.topbar-status--pending { color: var(--gray-500); }
.topbar-status .status-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 2px rgba(184,134,11,0.15);
    flex-shrink: 0;
}
.topbar-status--active .status-dot { animation: maint-pulse 2.4s ease-in-out infinite; }
@keyframes maint-pulse { 50% { opacity: 0.35; } }
.topbar-status-times { opacity: 0.85; }
@media (max-width: 768px) {
    .topbar-status-times { display: none; }
}

/* Coming-soon card — Bloomberg-clean placeholder. */
.coming-soon-card {
    position: relative; overflow: hidden;
    text-align: center; padding: 52px 36px 40px;
    max-width: 580px; margin: 40px auto 0;
    border: 1px solid var(--gray-200);
}
/* Bauhaus primary stripe across the top of the card. */
.coming-soon-stripe {
    position: absolute; top: 0; left: 0; right: 0; height: 6px;
    background: linear-gradient(90deg,
        var(--bh-red) 0 25%, var(--bh-yellow) 25% 50%,
        var(--bh-blue) 50% 75%, var(--gray-900) 75% 100%);
}
/* Big Kandinsky shape-trio hero (red square · blue circle · yellow triangle). */
.coming-soon-trio { display: flex; justify-content: center; align-items: flex-end; gap: 16px; margin-bottom: 24px; }
.coming-soon-trio .sq { width: 40px; height: 40px; background: var(--bh-red); }
.coming-soon-trio .ci { width: 40px; height: 40px; border-radius: 50%; background: var(--bh-blue); }
.coming-soon-trio .tr { width: 0; height: 0; border-left: 22px solid transparent; border-right: 22px solid transparent; border-bottom: 40px solid var(--bh-yellow); }
.coming-soon-icon { color: var(--gray-400); margin-bottom: 16px; }
.coming-soon-mark {
    display: inline-block; font-family: var(--font-mono);
    font-size: 11px; font-weight: 700; letter-spacing: 0.22em;
    color: var(--green-dark); background: var(--lime);
    padding: 4px 12px; border-radius: 0; margin-bottom: 16px;
}
.coming-soon-card h3 { margin: 0 0 10px; font-size: 20px; font-weight: 700; letter-spacing: 0.01em; }
.coming-soon-blurb { color: var(--gray-600); font-size: 14px; line-height: 1.6; margin: 0 auto 24px; max-width: 420px; }
.coming-soon-meta {
    display: inline-flex; flex-direction: column; gap: 6px;
    margin: 8px auto 0; padding: 12px 18px;
    border: 1px solid var(--gray-200); border-radius: var(--radius);
    background: var(--gray-25, #fafafa);
    text-align: left; min-width: 280px;
}
.coming-soon-meta-row { display: flex; justify-content: space-between; gap: 24px; align-items: center; }
.coming-soon-meta-row .meta-label {
    font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--gray-500);
}
.coming-soon-meta-row .meta-value { font-size: 12px; color: var(--gray-800); display: inline-flex; align-items: center; gap: 6px; }
.coming-soon-meta-row .mono { font-family: var(--font-mono); }
.status-dot--pending {
    width: 7px; height: 7px; border-radius: 50%;
    background: #B8860B;
    box-shadow: 0 0 0 2px rgba(184,134,11,0.18);
    display: inline-block;
    animation: maint-pulse 2.4s ease-in-out infinite;
}

/* "Soon" badge in sidebar items */
.nav-soon {
    font-size: 9px; padding: 1px 5px; background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.65); border-radius: 2px;
    margin-left: auto; letter-spacing: 0.06em; font-weight: 600;
    text-transform: uppercase;
    flex-shrink: 0;
}
/* Dim coming-soon items uniformly — per-item only. The FG and FV group
   headers themselves render at full strength and identical structure
   (icon · label · chevron). Status is conveyed by the per-item soon badge. */
.nav-item--soon { opacity: 0.55; }
.nav-item--soon:hover { opacity: 0.85; }

/* Visual divider between active ADS sub-items and the soon-dimmed AP/TC. */
.nav-group .nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 6px 12px;
    list-style: none;
}

/* Persistent in-progress ingest indicator (admin-only, shown via base.html). */
.ingest-banner {
    background: var(--green-light, #e8f5e9);
    color: var(--green-dark, #1b5e20);
    padding: 4px 12px; font-size: 11px; font-weight: 600;
    line-height: 1.4; letter-spacing: 0.02em;
    border-bottom: 1px solid rgba(27,94,32,0.2);
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    margin: -12px -16px 12px;
}
.ingest-banner .ingest-meta { font-weight: 500; opacity: 0.85; font-family: var(--font-mono); }
.ingest-banner a { margin-left: auto; color: inherit; text-decoration: underline; }
.ingest-banner-cancel {
    background: transparent; border: 1px solid currentColor; color: inherit;
    padding: 1px 8px; font-size: 11px; font-weight: 600; border-radius: 3px;
    cursor: pointer; text-transform: lowercase; letter-spacing: 0.02em;
}
.ingest-banner-cancel:hover { background: rgba(0,0,0,0.06); }
.ingest-banner .ingest-spinner {
    width: 10px; height: 10px;
    border: 2px solid currentColor; border-right-color: transparent;
    border-radius: 50%; display: inline-block;
    animation: ingest-spin 0.9s linear infinite;
}
@keyframes ingest-spin { to { transform: rotate(360deg); } }
@media (max-width: 768px) {
    .ingest-banner { margin: -10px -12px 10px; }
}

/* ─── Layout polish: prevent squish/overlap in tight widths ─── */

/* Page headers wrap their action buttons instead of crushing the h1 */
.page-header { flex-wrap: wrap; gap: 8px 12px; }
.page-header > * { min-width: 0; }

/* Any data-table living inside a card/section gets safe horizontal scroll so
   long provider/client names or extra columns don't blow out the card width. */
.card, .section, .home-panel { min-width: 0; }
.card > .data-table,
.section > .data-table,
.home-panel > .data-table { display: block; overflow-x: auto; }

/* Stat strip: wrap earlier when cells would collapse below a readable width */
.stat-strip { flex-wrap: wrap; }
.stat-cell { flex: 1 1 180px; }

/* Form rows: enforce a sane min-width so inputs don't squash to 60px and overlap */
.form-row { row-gap: 12px; }
.form-row .form-group { min-width: 160px; }
.form-group { min-width: 0; }
.form-group input, .form-group select, .form-group textarea { max-width: 100%; box-sizing: border-box; }

/* Home actions wrap on tablet widths */
.home-header-actions { flex-wrap: wrap; }
.home-header-actions .btn { white-space: nowrap; }

/* Quick-range button cluster on exports */
.quick-range { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* UNSP hint on the ADS upload form */
.unsp-hint {
    margin: 8px 0 12px; padding: 8px 12px;
    background: var(--yellow-light, #fff8e1); border-left: 3px solid #B8860B;
    color: var(--gray-800); font-size: 12px; border-radius: 3px;
}
.unsp-hint code { font-family: var(--font-mono); font-size: 11px; }

/* Subtle alert tone for pending-review section */
section.section--alert { border-left: 3px solid #B8860B; }

/* Roadmap teaser cards on the home page */
.roadmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}
.roadmap-card {
    position: relative;
    display: flex; flex-direction: column; gap: 4px;
    padding: 14px 16px 16px;
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius);
    text-decoration: none; color: var(--gray-800);
    transition: border-color 0.15s, transform 0.15s;
    opacity: 0.85;
}
.roadmap-card:hover {
    border-color: #B8860B;
    transform: translateY(-1px);
    opacity: 1;
}
.roadmap-mark {
    font-family: var(--font-mono); font-size: 10px;
    font-weight: 700; letter-spacing: 0.12em;
    color: var(--gray-500);
    margin-bottom: 4px;
}
.roadmap-label { font-weight: 600; font-size: 14px; color: var(--gray-900); }
.roadmap-desc { font-size: 12px; color: var(--gray-500); line-height: 1.45; }
.roadmap-soon {
    position: absolute; top: 12px; right: 12px;
    font-family: var(--font-mono); font-size: 9px; font-weight: 700;
    letter-spacing: 0.15em;
    color: #B8860B; border: 1px solid #B8860B;
    padding: 1px 6px; border-radius: 2px;
}

/* Filter bar breathing room */
.filter-bar { row-gap: 10px; }
.filter-bar .form-group { min-width: 140px; }

/* Home grid collapses one column earlier so panels don't compress at 1024-ish */
@media (max-width: 1200px) {
    .home-grid { grid-template-columns: 1fr; }
}

/* Sticky PDF preview on desktop detail/edit layouts so scrolling the form
   doesn't lose sight of the invoice image. Disabled on narrow widths where the
   layout already stacks. */
@media (min-width: 1025px) {
    .review-layout > .review-preview,
    .detail-layout > .detail-preview,
    .review-layout > .card.review-preview,
    .detail-layout > .card.detail-preview {
        position: sticky;
        top: 16px;
        max-height: calc(100vh - 32px);
        overflow: auto;
    }
}

/* ── Login ────────────────────────────────────────────────── */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: var(--bg);
}
.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 380px;
    text-align: center;
}
.login-logo { height: 48px; margin-bottom: 16px; }
.login-card h2 { font-size: 18px; color: var(--gray-700); margin-bottom: 24px; }
.login-subtitle { font-family: var(--font-ui); font-size: 13px; color: var(--gray-500); }

/* ── Login B — elevated centered card ─────────────────────────────────────
   Soft light background with subtle floating Bauhaus geometry + a polished
   white card. Familiar and clean (replaces the dark immersive concept). */
.login-soft {
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: center;
    overflow: hidden;
    padding: 24px;
    /* Dark-green brand field: nested lime chevrons (« motif, shared with the
       corporate sign-in) over a softly lit green — CSP-safe data-URI. */
    background:
        url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='760' height='1520' viewBox='0 0 760 1520'><g fill='none' stroke-linejoin='miter' stroke-linecap='square'><polyline points='710,290 410,760 710,1230' stroke='%23C7DF5D' stroke-width='9' stroke-opacity='.75'/><polyline points='590,360 350,760 590,1160' stroke='%23AEC911' stroke-width='6' stroke-opacity='.42'/><polyline points='480,430 295,760 480,1090' stroke='%23AEC911' stroke-width='4' stroke-opacity='.26'/><polyline points='380,495 250,760 380,1025' stroke='%23AEC911' stroke-width='3' stroke-opacity='.15'/><polyline points='295,550 215,760 295,970' stroke='%23AEC911' stroke-width='2.5' stroke-opacity='.08'/></g></svg>") no-repeat right -150px center / auto 115%,
        radial-gradient(1100px 700px at 22% 16%, rgba(174,201,17,.10) 0%, rgba(174,201,17,0) 65%),
        radial-gradient(140% 120% at 30% 20%, #3D4630 0%, #2B3122 52%, #20261A 100%);
}
.login-soft__geo { position: absolute; display: block; pointer-events: none; }
.login-elev {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 400px;
    text-align: center;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 64px rgba(0,0,0,.45), 0 4px 16px rgba(0,0,0,.28);
    overflow: hidden;
    animation: cardSlideUp 0.5s ease-out;
}
/* Dark-green cap carrying the white Prisier logo — lime rule ties the
   Prisier green+lime palette into the card. */
.login-elev__cap { background: var(--green-dark); padding: 30px 44px 26px; border-bottom: 3px solid var(--lime); }
.login-elev__logo { height: 40px; width: auto; display: block; margin: 0 auto; }
.login-elev__body { padding: 30px 40px 34px; }
.login-elev__brand { display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.login-elev .brand-osol { font-size: 36px; color: var(--green-dark); letter-spacing: .01em; }
.login-elev .brand-osol .brand-disc { width: 0.56em; height: 0.56em; }
.login-elev__sub { margin: 2px 0 28px; color: var(--green-primary); font-size: 13px; font-weight: 400; letter-spacing: .06em; }
.login-elev .form-group { text-align: left; margin-bottom: 15px; }
.login-elev label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--gray-600);
    margin-bottom: 6px;
}
.login-elev input {
    width: 100%;
    padding: 11px 12px;
    font: inherit;
    font-size: 14px;
    background: var(--gray-25);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
}
.login-elev input:focus {
    outline: none;
    border-color: var(--lime);
    box-shadow: 0 0 0 3px var(--lime-light);
}
.login-elev .btn-login {
    width: 100%;
    justify-content: center;
    padding: 12px;
    margin-top: 4px;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .02em;
    color: #fff;
    background: var(--green-dark);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.login-elev .btn-login:hover { background: var(--lime); color: var(--green-dark); }
/* Microsoft Entra sign-in — follows MS brand guidance (white field, the
   four-square logo at 18px). The edge is carried by a soft shadow rather than a
   hard #8C8C8C stroke, so the button reads as a raised surface next to the
   elevated login card instead of a flat outline. Self-contained literals so the
   same block drops into mobile.css unchanged. */
.btn-ms {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #1b1b1b;
    background: #fff;
    border: 1px solid #d6d6d6;
    border-radius: var(--radius, 6px);
    box-shadow: 0 1px 2px rgba(0,0,0,.10), 0 1px 3px rgba(0,0,0,.06);
    text-decoration: none;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease,
                box-shadow .15s ease, transform .15s ease;
}
.btn-ms:hover {
    background: #fafafa;
    border-color: #c2c2c2;
    box-shadow: 0 3px 6px rgba(0,0,0,.12), 0 1px 3px rgba(0,0,0,.08);
    transform: translateY(-1px);
}
/* Press: drop back to the resting plane and collapse the shadow into the edge. */
.btn-ms:active {
    background: #f3f3f3;
    box-shadow: inset 0 1px 2px rgba(0,0,0,.10);
    transform: translateY(0);
}
.btn-ms:focus-visible { outline: 2px solid #2b3122; outline-offset: 2px; }
.btn-ms__logo { flex: 0 0 auto; display: block; }
.login-ms-hint {
    margin: 8px 0 0;
    font-size: 11.5px;
    color: #6b6b6b;
    text-align: center;
}
/* Rule with the label knocked out of the middle. */
.login-sep {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0 16px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #8c8c8c;
}
.login-sep::before,
.login-sep::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e0e0e0;
}
.login-elev__forgot { margin-top: 16px; font-size: 12.5px; }
.login-elev__forgot a { color: var(--green-primary); text-decoration: none; }
.login-elev__forgot a:hover { text-decoration: underline; }
.login-elev .lang-switcher--login { margin-top: 18px; justify-content: center; }
@media (max-width: 480px) {
    .login-elev { padding: 32px 24px; }
}
@keyframes cardSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes bopsFloat1 { 0%,100% { transform: translate(0,0) rotate(0); } 50% { transform: translate(14px,-18px) rotate(8deg); } }
@keyframes bopsFloat2 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(-16px,12px); } }
.floatA { animation: bopsFloat1 7s ease-in-out infinite; }
.floatB { animation: bopsFloat2 9s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
    .floatA, .floatB, .login-elev { animation: none; }
}

/* ── Drop Zone ────────────────────────────────────────────── */
.drop-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
}
.drop-zone.drag-over { border-color: var(--lime); background: var(--green-light); }
.drop-zone-content svg { color: var(--gray-300); margin-bottom: 12px; }
.drop-zone-content p { color: var(--gray-700); margin-bottom: 4px; font-size: 14px; }
.drop-zone-hint { font-size: 12px; color: var(--gray-500); margin-bottom: 12px !important; }

/* ── File Preview ─────────────────────────────────────────── */
.file-preview { text-align: center; }
.file-info { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 12px 0; font-size: 13px; }
.preview-img { display: block; margin-inline: auto; max-width: 100%; max-height: 400px; border-radius: var(--radius); border: 1px solid var(--gray-200); }
.preview-pdf { width: 100%; height: 500px; border-radius: var(--radius); border: 1px solid var(--gray-200); }

/* ── Loading ──────────────────────────────────────────────── */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 32px;
    color: var(--gray-500);
}
.spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--lime);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Progress Bar ────────────────────────────────────────── */
.progress-bar {
    width: 100%;
    max-width: 320px;
    height: 5px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: var(--lime);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}
.progress-bar-fill.indeterminate {
    width: 40%;
    animation: indeterminate 1.4s ease-in-out infinite;
}
@keyframes indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}
.progress-label { font-size: 12px; color: var(--gray-500); margin-top: 4px; }
.btn.btn-loading { pointer-events: none; opacity: 0.7; }
.btn-spinner {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ── Review Layout ────────────────────────────────────────── */
.review-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.review-preview { max-height: 600px; overflow: auto; }
.filename-preview { margin: 10px 0; }
.filename-preview label { font-size: 11px; color: var(--gray-500); display: block; }
.filename-preview code {
    display: block;
    padding: 6px 10px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 12px;
    word-break: break-all;
    font-family: var(--font-mono);
}

/* ── Detail Layout ────────────────────────────────────────── */
/* minmax(0,1fr): without it a 1fr column's min-width is `auto`, so a long
   unbreakable value (filename / path) forces the column wider than the card. */
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.detail-preview { overflow: auto; min-width: 0; }
.detail-meta { min-width: 0; }
.detail-list { margin: 12px 0; min-width: 0; }
.detail-list dt { font-size: 11px; color: var(--gray-500); font-weight: 500; margin-top: 8px; }
.detail-list dd { font-size: 13px; margin-top: 1px; overflow-wrap: anywhere; }
/* Filenames / storage paths have no spaces — break anywhere so they wrap
   inside the card instead of spilling past its right edge. Override the
   table-oriented mobile `.filename` truncation (120px + ellipsis) so the full
   path is readable on the detail page. */
.detail-list dd.filename {
    word-break: break-all;
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
}
.detail-actions { margin-top: 16px; display: flex; gap: 10px; }

/* ─── FV Recibo de Caja (RC) block ─── */
.rc-block { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.rc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rc-inline-form { margin: 0; display: inline; }
.rc-meta { font-size: 11px; color: var(--gray-500); }
/* Upload row: styled file picker + RC number + button, matched to the flat UI */
.rc-upload {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    margin-top: 4px; padding: 10px 12px;
    border: 1px solid var(--gray-200); border-radius: 4px;
}
.rc-file { font-size: 12px; color: var(--gray-700); min-width: 0; flex: 1 1 200px; }
.rc-file::file-selector-button {
    font: inherit; font-weight: 600; font-size: 12px;
    padding: 5px 10px; margin-right: 10px;
    background: var(--gray-100); color: var(--gray-700);
    border: 1px solid var(--gray-200); border-radius: 3px; cursor: pointer;
}
.rc-file::file-selector-button:hover { background: var(--gray-200); }

/* Cobros (installments): one dated collection per row, each with its own RC.
   Flat and dense to match the surrounding tables — no tinted panels. */
.cobro-form {
    margin: 10px 0 14px; padding: 12px;
    border: 1px solid var(--gray-200); border-radius: 4px;
}
.cobro-form-grid {
    display: grid; gap: 10px 14px; margin-bottom: 10px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.cobro-form-grid label {
    display: flex; flex-direction: column; gap: 4px;
    font-size: 11px; font-weight: 600; letter-spacing: .04em;
    text-transform: uppercase; color: var(--gray-600);
}
.cobro-form-grid input {
    font: inherit; font-size: 13px; padding: 7px 9px;
    border: 1px solid var(--gray-300); border-radius: 3px; background: #fff;
}
.cobro-form-grid input[type="file"] { font-size: 12px; padding: 5px 0; border: none; }
.cobro-form-grid .cobro-note { grid-column: 1 / -1; }
.cobros-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* Inline links inside detail text: brand green, not browser blue. */
.link-accent { color: var(--green-primary); text-decoration: underline; }
.link-accent:hover { color: var(--green-dark); }
/* Sits under the single-RC uploader as the alternative route, with the
   consequence spelled out next to it. */
.rc-toggle-form {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 8px 0 0;
}
.cobros-table td, .cobros-table th { vertical-align: middle; }
.cobros-table .rc-upload { margin: 0; padding: 4px 6px; gap: 6px; }
.cobros-table .rc-file { flex: 1 1 120px; font-size: 11px; }
.cobros-table tfoot td { border-top: 2px solid var(--gray-300); padding-top: 8px; }
/* Inline edit row: one hidden <tr> after each cobro. It interleaves with the
   data rows, so nth-child zebra would stripe by pair instead of by cobro —
   drop the striping here rather than let it read as random shading. */
.cobros-table tbody tr, .cobros-table tbody tr:nth-child(even) { background: transparent; }
.cobros-table tbody tr.cobro-edit-row { cursor: default; }
.cobros-table tbody tr.cobro-edit-row:hover { background: transparent; }
.cobros-table tbody tr.cobro-edit-row > td { padding: 0 0 10px; border-bottom: none; }
/* Keep the columns at their natural width and let .table-scroll scroll instead:
   without this the extra TRM column squeezes narrow screens until headers wrap
   one letter per line. Two-class selector on purpose — the mobile media query
   further down sets `.data-table { display: block; min-width: 100% }` to make
   plain tables self-scroll, and this one already scrolls via its wrapper. */
.table-scroll .cobros-table { display: table; min-width: 780px; }
/* The mobile query below sets `.data-table th, td { white-space: normal }`,
   which breaks headers and dates a letter at a time ("28/1 1/20 25"). The table
   scrolls, so it has the room — two-class selectors to outrank that query. */
.table-scroll .cobros-table th,
.table-scroll .cobros-table td.col-date { white-space: nowrap; }
/* The edit form lives in a cell as wide as that min-width, so on a phone it
   would run off behind the horizontal scroll. Cap it to the viewport and let it
   sit flush left, where the cell starts — reachable without scrolling sideways. */
.cobros-table tbody tr.cobro-edit-row > td > .cobro-form {
    width: min(100%, calc(100vw - 48px));
}
@media (max-width: 768px) {
    .cobro-form-grid { grid-template-columns: 1fr; }
}
.rc-num {
    font-size: 12px; padding: 6px 8px; max-width: 150px;
    border: 1px solid var(--gray-200); border-radius: 3px;
    background: var(--white); color: var(--gray-800);
}

/* ─── FV Bitácora de gestión de cobro ─── */
.bitacora-card { margin-top: 16px; }
.bitacora-card h3 { margin: 0 0 12px; }
.bitacora-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.bitacora-form textarea {
    width: 100%; font: inherit; font-size: 13px; resize: vertical;
    padding: 8px 10px; border: 1px solid var(--gray-200); border-radius: 4px;
    background: var(--white); color: var(--gray-800);
}
.bitacora-form button { align-self: flex-end; }
.bitacora-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.bitacora-item { padding: 10px 0; border-top: 1px solid var(--gray-200); }
.bitacora-item:first-child { border-top: none; }
.bitacora-meta {
    display: flex; gap: 10px; align-items: baseline;
    font-size: 11px; color: var(--gray-500); margin-bottom: 3px;
}
.bitacora-author { font-weight: 600; color: var(--gray-700); }
.bitacora-body { font-size: 13px; color: var(--gray-800); white-space: pre-wrap; word-break: break-word; }
.bitacora-edited { font-style: italic; color: var(--gray-400); }
/* Action row under each note: reply / edit / delete as compact text buttons */
.bitacora-actions { display: flex; gap: 12px; align-items: center; margin-top: 5px; }
.bitacora-inline-form { display: inline; margin: 0; }
.btn-link {
    background: none; border: none; padding: 0; cursor: pointer;
    font: inherit; font-size: 11px; color: var(--blue, #1976d2); text-decoration: none;
}
.btn-link:hover { text-decoration: underline; }
.btn-link--danger { color: var(--coral, #d32f2f); }
/* Inline edit / reply forms (toggled open via data-action="bitacora-toggle") */
.bitacora-edit-form, .bitacora-reply-form {
    display: flex; flex-direction: column; gap: 6px; margin: 8px 0 4px;
}
.bitacora-edit-form textarea, .bitacora-reply-form textarea {
    width: 100%; font: inherit; font-size: 13px; resize: vertical;
    padding: 6px 8px; border: 1px solid var(--gray-200); border-radius: 4px;
    background: var(--white); color: var(--gray-800);
}
.bitacora-edit-form button, .bitacora-reply-form button { align-self: flex-end; }
/* Replies — indented thread under a note */
.bitacora-replies { list-style: none; margin: 6px 0 0; padding: 0 0 0 16px;
    border-left: 2px solid var(--gray-200); display: flex; flex-direction: column; gap: 8px; }
.bitacora-reply .bitacora-body { font-size: 12px; }
/* "Has notes" badge in lists */
.has-notes-badge { font-size: 11px; vertical-align: baseline; opacity: .85; }
/* Section head with a trailing action (entry page line-items) */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.section-head h2 { margin: 0; }
.col-actions { white-space: nowrap; text-align: right; }
.col-actions .btn-link { margin-left: 10px; }
/* Inline single-row form (project number on the client entry) */
.form-inline { display: flex; align-items: flex-end; gap: 12px; }
.form-inline .form-group { margin-bottom: 0; }

/* ─── FV Review calls ("solicitar revisión") ─── */
/* Top-center banner stack, shown after login until each is marked reviewed. */
.review-banner-stack { display: flex; flex-direction: column; gap: 8px; max-width: 860px; margin: 0 auto 14px; }
.review-banner {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 10px 14px; border: 1px solid var(--gray-200); border-left: 3px solid var(--blue, #1976d2);
    border-radius: 4px; background: var(--white); font-size: 13px;
}
.review-banner-icon { font-size: 16px; }
.review-banner-body { flex: 1; min-width: 200px; }
.review-banner-link { font-weight: 600; }
.review-banner-msg { color: var(--gray-500); }
.review-banner-actions { display: flex; gap: 8px; align-items: center; }

/* Request card on the FV detail */
.review-request-card { margin-top: 16px; }
.review-picker { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
.review-picker-users { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.review-picker-user { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--gray-800); }
.review-picker textarea {
    width: 100%; font: inherit; font-size: 13px; resize: vertical;
    padding: 6px 8px; border: 1px solid var(--gray-200); border-radius: 4px;
    background: var(--white); color: var(--gray-800);
}
.review-picker button { align-self: flex-end; }
.review-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; }
.review-item {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
    padding: 8px 0; border-top: 1px solid var(--gray-200); font-size: 12px;
}
.review-item:first-child { border-top: none; }
.review-item-meta { color: var(--gray-500); }
.review-item-msg { color: var(--gray-700); font-style: italic; }
.review-item-actions { margin-left: auto; display: flex; gap: 12px; }

/* ─── FV replace-document control ─── */
.replace-doc { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.replace-doc-form {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    padding: 10px 12px; border: 1px solid var(--gray-200); border-radius: 4px;
}

/* ─── Treasury tabs + entry forms ─── */
.tre-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--gray-200); margin-bottom: 16px; flex-wrap: wrap; }
.tre-tab { padding: 8px 14px; font-size: 14px; color: var(--gray-600); text-decoration: none; border-bottom: 2px solid transparent; }
.tre-tab:hover { color: var(--gray-900); }
.tre-tab.active { color: var(--gray-900); font-weight: 600; border-bottom-color: var(--green-primary, #2B3122); }
.tre-entry-form {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    padding: 10px 12px; border: 1px solid var(--gray-200); border-radius: 4px;
    background: var(--white); margin-top: 4px;
}
.tre-entry-form input, .tre-entry-form select {
    font-size: 13px; padding: 6px 8px; border: 1px solid var(--gray-200);
    border-radius: 3px; background: var(--white); color: var(--gray-800);
}
.tre-entry-form input[type="text"] { min-width: 120px; }

/* ─── FV Review call modal (centered, acknowledge-to-continue) ─── */
.review-modal-overlay {
    display: none;  /* shown via .is-open by review_modal.js */
    position: fixed; inset: 0; z-index: 2000;
    align-items: center; justify-content: center; padding: 16px;
    background: rgba(20, 24, 16, 0.55);
}
.review-modal-overlay.is-open { display: flex; }
body.modal-open { overflow: hidden; }
.review-modal {
    background: var(--white); border-radius: 8px; width: 100%; max-width: 520px;
    max-height: 85vh; overflow-y: auto; padding: 22px 24px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.35);
}
.review-modal h2 { margin: 0 0 16px; font-size: 18px; }
.review-modal-list { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.review-modal-item {
    padding: 12px 14px; border: 1px solid var(--gray-200);
    border-left: 3px solid var(--blue, #1976d2); border-radius: 4px;
}
.review-modal-item-body { font-size: 14px; }
.review-modal-item-body a { font-weight: 600; }
.review-modal-msg { color: var(--gray-600); font-style: italic; margin-top: 5px; }
.review-modal-item-actions { display: flex; gap: 8px; margin-top: 10px; }
.review-modal-actions { display: flex; justify-content: flex-end; }

/* ── Success State ────────────────────────────────────────── */
.success-state { text-align: center; padding: 16px; }
.success-state h3 { margin: 12px 0 6px; color: var(--green-primary); font-size: 16px; }
.success-state p { font-size: 13px; color: var(--gray-500); }
.success-state .form-actions { justify-content: center; }

/* ── Empty State ──────────────────────────────────────────── */
.empty-state { text-align: center; padding: 32px; color: var(--gray-500); }
.empty-state p { margin-bottom: 12px; }

/* ── Command Filter (Bloomberg-style) ────────────────────── */
.cmd-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: 12px;
    transition: border-color 0.2s;
}
.cmd-filter:focus-within { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(174,201,17,0.15); }
.cmd-filter svg { color: var(--gray-400); flex-shrink: 0; }
.cmd-filter-input {
    flex: 1;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 13px;
    background: transparent;
    color: var(--gray-900);
}
.cmd-filter-input::placeholder { color: var(--gray-400); }
.cmd-filter kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 3px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    flex-shrink: 0;
}

/* Advanced filters (collapsible) */
.filter-details { margin-bottom: 12px; }
.filter-details summary {
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    padding: 6px 0;
    user-select: none;
}
.filter-details summary:hover { color: var(--gray-700); }
.filter-details[open] summary { margin-bottom: 8px; }

/* Legacy filter bar (compatibility) */
.filter-bar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.filter-bar .form-group { flex: 1; min-width: 120px; margin-bottom: 0; }
.filter-bar .btn { margin-bottom: 0; }
.filter-bar label,
.cmd-filter label,
.quick-range > label { font-weight: 600; color: var(--gray-900); }

/* ── Pagination ───────────────────────────────────────────── */
.pagination { display: flex; gap: 4px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.pagination-info { font-size: 12px; color: var(--gray-500); margin-left: 8px; }

/* ── Inline Forms (Admin) ─────────────────────────────────── */
.inline-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--gray-100); }
.inline-form h4 { font-size: 13px; margin-bottom: 10px; color: var(--gray-700); }

/* ── Section ──────────────────────────────────────────────── */
.section { margin-bottom: 20px; }
.section h2 { font-size: 16px; margin-bottom: 12px; font-weight: 600; }

/* ── Command Palette ─────────────────────────────────────── */
.cmd-palette {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 20vh;
}
.cmd-backdrop {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
}
.cmd-panel {
    position: relative;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    overflow: hidden;
}
.cmd-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
}
.cmd-input-wrapper svg { color: var(--gray-400); flex-shrink: 0; }
.cmd-input {
    flex: 1;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 15px;
    background: transparent;
}
.cmd-results {
    list-style: none;
    max-height: 320px;
    overflow-y: auto;
}
.cmd-results li {
    padding: 10px 16px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.1s;
}
.cmd-results li:hover,
.cmd-results li.cmd-active { background: var(--green-light); }
.cmd-results li .cmd-section {
    font-size: 11px;
    color: var(--gray-400);
    margin-left: auto;
}
.cmd-footer {
    display: flex;
    gap: 16px;
    padding: 8px 16px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
    font-size: 11px;
    color: var(--gray-500);
}
.cmd-footer kbd {
    display: inline-block;
    padding: 1px 4px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
}

/* ── Keyboard Shortcuts Help ─────────────────────────────── */
.shortcuts-help {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.shortcuts-panel {
    position: relative;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 24px;
    width: 100%;
    max-width: 480px;
}
.shortcuts-panel h3 { font-size: 16px; margin-bottom: 16px; }
.shortcuts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 16px; }
.shortcut-section h4 { font-size: 12px; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.shortcut-row { display: flex; align-items: center; gap: 6px; font-size: 13px; margin-bottom: 6px; }
.shortcut-row kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
}
.shortcut-row span { color: var(--gray-600); }

/* ── Sidebar Overlay (mobile) ────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 150;
}
.sidebar-overlay.visible { display: block; }

/* Table scroll container — used on all browse pages so the table can scroll
   inside the card while the page chrome (header, filter bar) stays fixed. */
.table-scroll {
    width: 100%;
    overflow: auto;
    max-height: calc(100vh - 280px);
}
.table-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--white);
    box-shadow: inset 0 -1px 0 var(--gray-200);
}

/* ── Responsive ───────────────────────────────────────────── */

/* Desktop fluid scaling: sidebar width grows with viewport. */
@media (min-width: 1025px) {
    :root { --sidebar-width: clamp(196px, 13vw, 232px); }
    .brand-bar { padding: 8px clamp(14px, 1.2vw, 22px); }
    .page-header h1 { font-size: clamp(18px, 1.1vw + 8px, 22px); }
    /* Stat strip uses adaptive grid so it wraps gracefully at narrow laptops
       (6-up at 1500+, 3-up at 1280, 2-up at 1024) without hard breakpoints. */
    .stat-strip {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 1px;
    }
    .stat-cell { min-width: 0; padding: clamp(8px, 0.7vw, 12px) clamp(11px, 0.9vw, 16px); }
    /* Cash chart card centers + caps so 1920px doesn't stretch the SVG too thin. */
    .cash-chart-card .cash-chart-svg { max-width: 1100px; margin-inline: auto; }
    /* Browse tables: keep header sticky + cap height so we don't double-scroll. */
    .table-scroll {
        max-height: calc(100vh - 320px);
        overflow: auto;
    }
    .table-scroll thead th {
        position: sticky; top: 0; z-index: 1;
        background: var(--white);
        box-shadow: inset 0 -1px 0 var(--gray-100);
    }
    /* Existing charts cap vertically. */
    .fv-chart svg, .home-chart svg { max-height: clamp(240px, 22vw, 320px); height: auto; width: 100%; }
}

/* Wider laptops (1500+) — slightly looser density. */
@media (min-width: 1500px) {
    .data-table--dense td, .data-table--dense th { padding: 6px 12px; }
    .home-board { gap: 16px; }
}

/* Tablet */
@media (max-width: 1024px) {
    .app-layout { grid-template-columns: var(--sidebar-collapsed-width) 1fr; }
    .sidebar { width: var(--sidebar-collapsed-width); }

    /* Collapsed by default on tablet */
    .sidebar .sidebar-title,
    .sidebar .nav-group-label,
    .sidebar .nav-chevron,
    .sidebar .nav-item span,
    .sidebar .user-name,
    .sidebar .nav-footer-link span { display: none; }
    .sidebar .sidebar-header { justify-content: center; padding: 16px 8px 12px; }
    .sidebar .sidebar-toggle { margin-left: 0; }
    .sidebar .sidebar-toggle svg { transform: rotate(180deg); }
    .sidebar .nav-group-header { justify-content: center; padding: 8px; }
    .sidebar .nav-item { justify-content: center; padding: 8px; border-left: none; }
    .sidebar .nav-item.active { border-left: none; border-right: 3px solid var(--sidebar-active-accent); }
    .sidebar .nav-footer-link { justify-content: center; padding: 8px !important; }
    .sidebar .sidebar-user { justify-content: center; }
    .sidebar .sidebar-footer { padding: 12px 8px; }

    .stat-strip { flex-wrap: wrap; }
    .stat-cell { min-width: calc(50% - 1px); }
}

/* Mobile */
@media (max-width: 768px) {
    .app-layout { grid-template-columns: 1fr; }

    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        width: 260px !important;
        min-width: 260px !important;
        height: 100vh;
        height: 100dvh;
        transition: left 0.25s ease;
        z-index: 200;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }
    .sidebar.sidebar-open { left: 0; }

    /* Restore full sidebar appearance on mobile when open */
    .sidebar.sidebar-open .sidebar-title,
    .sidebar.sidebar-open .nav-group-label,
    .sidebar.sidebar-open .nav-chevron,
    .sidebar.sidebar-open .nav-item span,
    .sidebar.sidebar-open .user-name,
    .sidebar.sidebar-open .nav-footer-link span { display: inline; }
    .sidebar.sidebar-open .sidebar-header { justify-content: flex-start; padding: 16px 16px 12px; }
    .sidebar.sidebar-open .nav-group-header { justify-content: flex-start; padding: 8px 16px; }
    .sidebar.sidebar-open .nav-item { justify-content: flex-start; padding: 10px 16px 10px 20px; min-height: 40px; border-left: 3px solid transparent; border-right: none; }
    .sidebar.sidebar-open .nav-item.active { border-left-color: var(--sidebar-active-accent); }
    .sidebar.sidebar-open .nav-footer-link { justify-content: flex-start; padding: 8px !important; }
    .sidebar.sidebar-open .sidebar-user { justify-content: flex-start; }
    .sidebar.sidebar-open .sidebar-footer { padding: 12px; }

    .sidebar-toggle { display: none !important; }
    .topbar-hamburger { display: flex !important; }

    .content { padding: 12px; }
    .topbar { padding: 0 12px; }

    .page-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .page-header h1 { font-size: 18px; }

    /* 2-up grid instead of 1-up vertical stack — saves ~50% vertical space
       on phones so the chart + events are reachable without scrolling 6
       full screens of KPI cells. */
    .stat-strip {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1px;
        margin-bottom: 12px;
        flex-direction: initial;
    }
    .stat-cell { min-width: unset; padding: 8px 10px; }
    .stat-cell-value { font-size: 15px; line-height: 1.2; }
    .stat-cell-label { font-size: 9px; letter-spacing: 0.4px; }
    .stat-cell-amount { font-size: 10px; }
    .kpi-spark { height: 18px; }
    /* Dates must NOT wrap mid-string. */
    .data-table td, .events-row { white-space: nowrap; }
    .data-table td.filename, .events-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 0; }
    /* Section pills: compact padding + smaller font; the container scrolls
       horizontally. No mask-image — broke rendering on iOS Safari. */
    .section-pill { padding: 4px 8px; font-size: 10.5px; letter-spacing: 0.3px; }
    .section-pill .section-pill-icon { width: 14px; height: 14px; }
    .brand-bar { gap: 4px; padding: 6px 8px; }
    .brand-mark { flex-shrink: 0; }
    /* Tab strip closer to comfortable touch target. */
    .tab-strip-item { min-height: 36px; }
    /* Table-scroll: explicit horizontal scroll + min-width on the inner table
       so cells don't collapse to one-character-per-row. */
    .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table-scroll table { min-width: 640px; }
    /* Default data tables also need min-width to avoid char-by-char wrap. */
    .data-table { min-width: 100%; table-layout: auto; }
    .data-table td { word-break: normal; overflow-wrap: normal; }
    .stat-cell-amount { font-size: 11px; }

    .stats-row { flex-direction: column; gap: 8px; }

    .card { padding: 12px; }

    .review-layout, .detail-layout { grid-template-columns: 1fr; }

    .filter-bar { flex-direction: column; align-items: stretch; gap: 8px; }
    .filter-bar .form-group { min-width: unset; width: 100%; }
    .filter-bar .btn { width: 100%; }

    .form-row { flex-direction: column; }
    .form-row .form-group { min-width: unset; width: 100%; }

    .data-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    /* Numeric/date columns stay on one line so digits don't break across rows;
       text columns (provider, client, account) are allowed to wrap so the
       table doesn't have to scroll horizontally just to reveal a clipped
       provider name. */
    .data-table th, .data-table td { white-space: normal; word-break: break-word; }
    .data-table .col-numeric, .data-table .col-date, .data-table .mono,
    .data-table th.col-numeric, .data-table th.col-date { white-space: nowrap; }
    .filename { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }

    /* Stat strip → single column on phones so cards don't stretch to match
       a taller sibling's height (and don't split awkwardly into 2-per-row). */
    .stat-strip { flex-direction: column; }
    .stat-cell { flex: 1 1 auto; }

    .preview-pdf { height: 300px; }
    .preview-img { max-height: 250px; }

    .btn { padding: 10px 16px; min-height: 40px; font-size: 13px; }
    .btn-sm { padding: 6px 12px; min-height: 32px; }

    .cmd-label-full { display: none !important; }
    .cmd-label-short { display: inline !important; }
    .topbar-cmd-btn { padding: 6px 10px; font-size: 11px; }
    .topbar-cmd-btn kbd { display: none; }

    .drop-zone { padding: 28px 16px; }
    .login-card { padding: 28px 20px; }
    .detail-actions { flex-wrap: wrap; }
    .form-actions { flex-wrap: wrap; gap: 8px; }
    .form-actions .btn { flex: 1; min-width: 0; }

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

/* Small phones */
@media (max-width: 400px) {
    .content { padding: 8px; }
    .card { padding: 10px; }
    .page-header h1 { font-size: 16px; }
    .stat-cell { padding: 6px 10px; }
    .stat-cell-value { font-size: 16px; }
    .stat-cell-label { font-size: 9px; }
}

/* ── Home (Bloomberg-style landing) ──────────────────────── */
.home-period {
    color: var(--gray-500);
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0.02em;
}
.home-header-actions { display: flex; gap: 8px; }

.home-alert {
    background: var(--yellow-light);
    border-left: 3px solid var(--yellow);
    color: var(--gray-800);
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 16px;
    border-radius: var(--radius-sm);
}
.home-alert a { color: var(--gray-900); font-weight: 600; text-decoration: underline; }

.home-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}
.home-panel {
    margin-bottom: 0;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: var(--card-padding);
}
/* When a full-width home section wraps content that would otherwise float on
   the page background (tables, empty states), give it the same card chrome. */
section.section { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: var(--card-padding); }
section.section h2 { margin-top: 0; }
.home-panel-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}
.home-panel-head h2 { margin-bottom: 0; }
.home-panel-link {
    font-size: 12px;
    color: var(--gray-500);
    text-decoration: none;
    font-weight: 500;
}
.home-panel-link:hover { color: var(--green-primary); }
.home-subtle { color: var(--gray-400); font-weight: 400; font-size: 12px; }

/* Reporte-Ventas-style ruled panel head: lime underline + uppercase title,
   while keeping the right-aligned "Ver todas" link. */
.home-panel-head--ruled {
    border-bottom: 2px solid var(--lime);
    padding-bottom: 5px;
}
.home-panel-head--ruled h2,
.home-panel-head--ruled h3 {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--green-dark);
    margin: 0;
}
.home-panel-head--ruled small { text-transform: none; letter-spacing: 0; font-weight: 400; }

.home-chip {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 600;
    border-radius: 10px;
    letter-spacing: 0.02em;
}
.home-chip--warn {
    background: var(--coral);
    color: var(--white);
}

.home-quick-rail {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}
.home-quick-card {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 14px;
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--gray-800);
    transition: border-color 0.15s, transform 0.15s;
}
.home-quick-card:hover {
    border-color: var(--lime);
    transform: translateY(-1px);
}
.home-quick-label { font-weight: 600; font-size: 14px; color: var(--gray-900); }
.home-quick-desc { font-size: 12px; color: var(--gray-500); }

.home-shortcut-hint {
    margin-top: 12px;
    font-size: 11px;
    color: var(--gray-500);
}
.home-shortcut-hint kbd {
    padding: 1px 5px;
    font-size: 10px;
}

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

/* Home — mobile refinements */
@media (max-width: 768px) {
    /* Buttons: stretch to row, wrap instead of overflow */
    .home-header-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    .home-header-actions .btn { flex: 1; min-width: 140px; }

    /* Break title and period onto separate lines */
    .home-period { display: block; font-size: 12px; margin-top: 2px; }

    /* Panel head: wrap so the "Ver todas" link never clips */
    .home-panel-head { flex-wrap: wrap; row-gap: 2px; }
    .home-panel-head h2 { font-size: 14px; }
    .home-panel-link { font-size: 11px; }

    /* Stat strip: re-introduce spacing between stacked cells */
    .stat-strip { gap: 6px !important; }
    .stat-cell {
        border-radius: var(--radius-sm);
        border: 1px solid var(--gray-100);
    }

    /* Home tables: horizontal scroll is handled globally, but clip inside the
       panel so the scrollbar doesn't push the "Ver todas" link off-screen */
    .home-panel { overflow: hidden; }
    .home-panel .data-table { margin: 0 -2px; }

    /* Quick rail: single column on phones */
    .home-quick-rail { grid-template-columns: 1fr; }
    .home-quick-card { padding: 10px 12px; }

    /* Shortcut hint: wrap freely, smaller gaps */
    .home-shortcut-hint { line-height: 1.8; }
}

/* ── Login animation ─────────────────────────────────────── */
@keyframes logoFadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes cardSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Workbook match panel (FV upload diff) ───────────────── */
.wb-match {
    margin: 16px 0;
    padding: 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--gray-50);
}
.wb-match[data-state="matches"]         { border-left: 3px solid #2D7A2D; }
.wb-match[data-state="differs"]         { border-left: 3px solid #C48A00; }
.wb-match[data-state="anomaly_revisar"] { border-left: 3px solid #C48A00; }
.wb-match[data-state="not_in_workbook"] { border-left: 3px solid #B22222; }
.wb-match[data-state="ambiguous"]       { border-left: 3px solid #6B7280; }

.wb-match-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}
.wb-match-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--gray-600);
}
.match-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-family: var(--font-mono);
}
.match-badge--matches         { background: #E6F2E6; color: #2D7A2D; }
.match-badge--differs         { background: #FFF4D6; color: #8A6100; }
.match-badge--anomaly-revisar { background: #FFF4D6; color: #8A6100; }
.match-badge--not-in-workbook { background: #FFE0E0; color: #B22222; }
.match-badge--ambiguous       { background: var(--gray-100); color: var(--gray-700); }

.wb-match-warnings {
    margin: 6px 0 8px;
    font-size: 12px;
    color: #8A6100;
}
.wb-match-warning {
    padding: 4px 0;
}
.wb-match[data-state="not_in_workbook"] .wb-match-warning { color: #B22222; }

.wb-match-diff {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 12px;
}
.wb-match-diff th,
.wb-match-diff td {
    padding: 4px 8px;
    border-bottom: 1px solid var(--gray-100);
    text-align: left;
}
.wb-match-diff th {
    font-weight: 600;
    color: var(--gray-600);
    background: var(--gray-50);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 10px;
}
.diff-row.diff-eq  .diff-mark { color: #2D7A2D; }
.diff-row.diff-neq .diff-mark { color: #B22222; font-weight: 600; }
.diff-row.diff-neq .diff-extracted,
.diff-row.diff-neq .diff-workbook { background: #FFF4D6; }

/* FV period filter — chip-style year/month selectors above each FV view. */
.fv-period-filter {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    padding: 10px 14px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.fv-period-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.fv-period-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    min-width: 50px;
    margin-right: 4px;
}
.fv-period-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border: 1px solid var(--gray-300);
    border-radius: 12px;
    background: var(--white);
    color: var(--gray-700);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.fv-period-chip input { display: none; }
.fv-period-chip:hover { border-color: var(--gray-500); color: var(--gray-900); }
.fv-period-chip.is-active {
    background: var(--green-primary);
    border-color: var(--green-primary);
    color: var(--white);
}
.fv-period-chip--sm { padding: 3px 8px; font-size: 11px; }
.fv-period-clear {
    margin-left: auto;
    font-size: 11px;
    color: var(--gray-600);
    text-decoration: underline;
}
.fv-period-clear:hover { color: var(--gray-900); }

/* Compact dropdown variant — single-line filter using <details>. */
.fv-period-filter--compact { padding: 8px 12px; flex-direction: row; gap: 8px; align-items: center; }
.fv-period-filter--compact .fv-period-row { flex-wrap: nowrap; }
.fv-period-dropdown { position: relative; }
.fv-period-dropdown > summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    background: var(--white);
    font-size: 12px;
    color: var(--gray-700);
    user-select: none;
    transition: border-color 0.1s, background 0.1s;
}
.fv-period-dropdown > summary::-webkit-details-marker { display: none; }
.fv-period-dropdown > summary:hover { border-color: var(--gray-500); }
.fv-period-dropdown[open] > summary { border-color: var(--green-primary); background: var(--gray-25); }
.fv-period-dropdown .fv-period-label {
    margin-right: 0;
    min-width: 0;
}
.fv-period-value {
    color: var(--gray-900);
    font-weight: 600;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fv-period-caret { color: var(--gray-500); font-size: 10px; }
.fv-period-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 30;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    box-shadow: var(--shadow);
    padding: 6px;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 280px;
    overflow-y: auto;
}
.fv-period-menu--grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    min-width: 220px;
    gap: 2px;
}
.fv-period-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    color: var(--gray-700);
    cursor: pointer;
}
.fv-period-option:hover { background: var(--gray-50); }
.fv-period-option input[type=checkbox] { margin: 0; }

/* In-row horizontal bar (top clients / status mix) */
.fv-bar {
    background: var(--gray-100); height: 12px; border-radius: 2px; overflow: hidden;
}
.fv-bar-fill {
    background: var(--green-primary); height: 100%; border-radius: 2px;
    transition: width 0.2s ease;
}
/* Un ajuste que RESTA (Notas Crédito): barra en óxido, tono 3 de chart_theme. */
.fv-bar-fill--neg { background: #9C3D1B; }

/* Version-drift banner — appears when /api/version reports a newer ASSET_VERSION
   than the page was rendered with. Non-modal, dismiss-per-session. */
.bops-version-banner {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 20px;
    /* Floating white card — same elevated language as the login card. */
    background: var(--white);
    color: var(--gray-900);
    border-radius: var(--radius-lg);
    overflow: hidden;            /* clip the primary stripe to the radius */
    box-shadow: 0 16px 48px rgba(0,0,0,.30), 0 4px 12px rgba(0,0,0,.18);
    font-size: 14px;
    min-width: 360px;
    max-width: 560px;
    animation: bops-version-slide 0.25s ease-out;
}
/* Bauhaus primary stripe across the top — same red/yellow/blue/black as the
   brand bar, so the update toast reads as part of the system, not a stray pill. */
.bops-version-banner::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        var(--bh-red) 0 25%, var(--bh-yellow) 25% 50%,
        var(--bh-blue) 50% 75%, var(--gray-900) 75% 100%);
}
@keyframes bops-version-slide {
    from { transform: translate(-50%, -16px); opacity: 0; }
    to   { transform: translate(-50%, 0);     opacity: 1; }
}
.bops-version-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--lime);
    flex-shrink: 0;
    box-shadow: 0 0 0 0 rgba(174, 201, 17, 0.7);
    animation: bops-version-pulse 2s infinite;
}
@keyframes bops-version-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(174, 201, 17, 0.7); }
    70%  { box-shadow: 0 0 0 8px rgba(174, 201, 17, 0); }
    100% { box-shadow: 0 0 0 0 rgba(174, 201, 17, 0); }
}
.bops-version-text { flex: 1; line-height: 1.35; }
.bops-version-reload {
    background: var(--lime);
    color: var(--green-dark);
    border: none;
    padding: 7px 14px;
    border-radius: 0;
    font-weight: 700;
    cursor: pointer;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-family: var(--font-ui);
    flex-shrink: 0;
}
.bops-version-reload:hover { background: var(--lime-light); }
.bops-version-close {
    background: transparent;
    color: var(--gray-400);
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 0 4px;
    line-height: 1;
}
.bops-version-close:hover { color: var(--gray-700); }

/* Loading-state UX — slim top progress bar + opt-in overlay. CSP-clean (no JS animations). */
.bops-progress {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 4px;
    z-index: 10000;
    background: rgba(174, 201, 17, 0.12);
    overflow: hidden;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s ease;
    box-shadow: 0 1px 3px rgba(174, 201, 17, 0.35);
}
.bops-progress.is-active { opacity: 1; }
.bops-progress-fill {
    width: 28%;
    height: 100%;
    background: var(--lime);
    border-radius: 0 4px 4px 0;
    animation: bops-progress-slide 1.0s ease-in-out infinite;
}
@keyframes bops-progress-slide {
    0%   { transform: translateX(-100%); }
    50%  { transform: translateX(180%); }
    100% { transform: translateX(360%); }
}

.bops-loading-overlay {
    position: fixed; inset: 0;
    z-index: 9998;
    background: rgba(43, 49, 34, 0.55);
    backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.15s ease;
}
.bops-loading-overlay.is-active { opacity: 1; pointer-events: auto; }
.bops-loading-card {
    background: var(--white);
    border-radius: 8px;
    padding: 32px 40px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    min-width: 280px;
    max-width: 420px;
}
.bops-loading-spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--green-primary);
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: bops-spin 0.8s linear infinite;
}
@keyframes bops-spin { to { transform: rotate(360deg); } }
.bops-loading-message {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 6px;
}
.bops-loading-hint {
    font-size: 12px;
    color: var(--gray-600);
}

/* Tiny version label in sidebar footer — lets users see what version their tab loaded. */
.sidebar-version-tag {
    font-family: var(--font-mono);
    font-size: 10px;
    color: rgba(255,255,255,0.35);
    text-align: center;
    padding: 8px 4px 0;
    letter-spacing: 0.5px;
}
.sidebar-collapsed .sidebar-version-tag { display: none; }

/* Full-page loader — server-rendered into base.html so it's already in the DOM
   when a new page starts arriving. CSS-only via a [data-page-loading] attr on
   <html> that JS removes when DOMContentLoaded fires. The 200ms delay means
   fast pages don't flash. */
.bops-page-loader {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    background: var(--bg);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s ease, visibility 0s linear 0.18s;
    pointer-events: none;
}
html[data-page-loading] .bops-page-loader {
    opacity: 1;
    visibility: visible;
    /* 200 ms delay before fade-in: pages that render under that threshold
       never even reach opacity 1, so users don't see a stutter on fast pages. */
    transition: opacity 0.18s ease 0.2s, visibility 0s;
    pointer-events: auto;
}
.bops-page-loader-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--green-primary);
    border-right-color: var(--lime);
    border-radius: 50%;
    animation: bops-spin 0.85s linear infinite;
}
.bops-page-loader-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

/* ──────────────────────────────────────────────────────────────────────
   Sidebar hover-expand (desktop) — when collapsed, hovering the rail
   expands it as an overlay above content rather than pushing layout.
   Less intrusive default while keeping discoverability.
   ────────────────────────────────────────────────────────────────────── */
@media (min-width: 1025px) {
    .sidebar-collapsed .sidebar { transition: width 0.18s ease, box-shadow 0.18s ease; }
    .sidebar-collapsed .sidebar:hover {
        width: var(--sidebar-width);
        min-width: var(--sidebar-width);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
        z-index: 250;
    }
    .sidebar-collapsed .sidebar:hover .sidebar-logo,
    .sidebar-collapsed .sidebar:hover .sidebar-title,
    .sidebar-collapsed .sidebar:hover .nav-group-label,
    .sidebar-collapsed .sidebar:hover .nav-chevron,
    .sidebar-collapsed .sidebar:hover .nav-item span,
    .sidebar-collapsed .sidebar:hover .user-name,
    .sidebar-collapsed .sidebar:hover .nav-footer-link span,
    .sidebar-collapsed .sidebar:hover .sidebar-version-tag {
        display: inline;
    }
    .sidebar-collapsed .sidebar:hover .sidebar-header { justify-content: flex-start; padding: 16px 16px 12px; }
    .sidebar-collapsed .sidebar:hover .nav-group-header { justify-content: flex-start; padding: 8px 16px; }
    .sidebar-collapsed .sidebar:hover .nav-item { justify-content: flex-start; padding: 7px 16px 7px 20px; }
    .sidebar-collapsed .sidebar:hover .nav-footer-link { justify-content: flex-start; padding: 7px 16px 7px 20px; }
    /* Don't shift the content grid when expanded-on-hover — overlay only. */
    .sidebar-collapsed .sidebar:hover ~ .main-content { margin-left: 0; }
}

/* ──────────────────────────────────────────────────────────────────────
   Mobile sidebar — off-canvas drawer + scrim. Below 1024 px the sidebar
   slides off-screen by default; the top-bar burger button (#mobile-menu-btn)
   slides it back in. Tap-the-scrim or any nav-item click closes it.
   ────────────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .app-layout {
        grid-template-columns: 1fr !important;
    }
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 264px;
        min-width: 264px;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        box-shadow: 4px 0 32px rgba(0, 0, 0, 0.18);
    }
    .sidebar.sidebar-open { transform: translateX(0); }
    .sidebar-overlay {
        position: fixed; inset: 0;
        background: rgba(43, 49, 34, 0.45);
        opacity: 0; visibility: hidden;
        transition: opacity 0.18s ease;
        z-index: 195;
    }
    .sidebar-overlay.visible { opacity: 1; visibility: visible; }
    /* Hide the desktop collapse toggle on mobile — replaced by the burger. */
    .sidebar-toggle { display: none; }
}

/* Mobile burger button — appears in topbar below 1024px (already in DOM as
   #mobile-menu-btn but was hidden on desktop). */
.topbar-mobile-btn {
    display: none;
    background: none;
    border: none;
    color: var(--gray-700);
    cursor: pointer;
    padding: 8px;
    margin-right: 4px;
    border-radius: var(--radius-sm);
}
.topbar-mobile-btn:hover { background: var(--gray-100); }
@media (max-width: 1024px) {
    .topbar-mobile-btn { display: inline-flex; align-items: center; }
}

/* Mobile content padding — on narrow screens the dense Bloomberg padding fights
   the user. Trim the gutters a bit. */
@media (max-width: 768px) {
    .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .page-header h1 { font-size: 20px; }
    .home-grid { grid-template-columns: 1fr; gap: 16px; }
    .stat-strip { flex-direction: column; gap: 0; }
    .stat-cell { width: 100%; min-width: 0; flex: none; }
    .fv-period-filter { padding: 8px 10px; }
    .fv-period-row { gap: 4px; }
    .fv-chart-legend { flex-wrap: wrap; }
    .fv-chart { padding: 6px; }
    /* Make tables horizontally scrollable on narrow screens */
    .data-table { font-size: 12px; }
    .section { padding: 12px; overflow-x: auto; }
    .section table { min-width: 520px; }
    /* Topbar reflow */
    .topbar { padding: 8px 12px; }
    .topbar .lang-switcher { display: none; }
    .topbar .quick-nav-btn { padding: 6px 10px; font-size: 12px; }
    /* Banner narrower on mobile */
    .bops-version-banner { min-width: 0; left: 8px; right: 8px; transform: none; max-width: none; }
    @keyframes bops-version-slide-mobile { from { top: -8px; opacity: 0; } to { top: 8px; opacity: 1; } }
}

/* Show burger up to 1024px (matches the off-canvas drawer breakpoint above). */
@media (max-width: 1024px) {
    .topbar-hamburger { display: flex !important; align-items: center; }
}

/* i18n freeze (2026-05-07) — language switcher hidden until a dedicated bilingual
   pass ships. The forms remain in markup so /auth/set-language route is harmless
   if hit directly; toggle UI is invisible. */
/* Re-enabled 2026-05-07 — see feedback_i18n_freeze: i18n is now best-effort
   bilingual. Untranslated strings under EN will show in Spanish; that's
   acceptable since the user explicitly asked to retry the toggle. */
.user-menu .lang-switcher {
    display: flex !important;
    gap: 4px;
    padding: 8px;
    margin: 0 -8px 6px;
    border-bottom: 1px solid var(--gray-100);
}
.user-menu .lang-btn {
    flex: 1;
    background: var(--gray-100);
    border: 1px solid transparent;
    color: var(--gray-700);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    letter-spacing: 0.5px;
}
.user-menu .lang-btn.active {
    background: var(--lime);
    color: var(--green-dark);
}
.user-menu .lang-btn:hover:not(.active) {
    background: var(--gray-200);
    color: var(--gray-900);
}
/* Topbar/login switcher remains hidden — language now lives in user menu only. */
.topbar .lang-switcher,
.lang-switcher--login {
    display: none !important;
}

/* i18n freeze companion — neutralize the v66 hover-expand. When the sidebar is
   collapsed (user choice via toggle button), it stays collapsed; no surprise
   expansion on hover. Reverts hover state to the same width as the collapsed
   width so nothing peeks out. */
@media (min-width: 1025px) {
    .sidebar-collapsed .sidebar:hover {
        width: var(--sidebar-collapsed-width) !important;
        min-width: var(--sidebar-collapsed-width) !important;
        box-shadow: none !important;
    }
    .sidebar-collapsed .sidebar:hover .sidebar-logo,
    .sidebar-collapsed .sidebar:hover .sidebar-title,
    .sidebar-collapsed .sidebar:hover .nav-group-label,
    .sidebar-collapsed .sidebar:hover .nav-chevron,
    .sidebar-collapsed .sidebar:hover .nav-item span,
    .sidebar-collapsed .sidebar:hover .user-name,
    .sidebar-collapsed .sidebar:hover .nav-footer-link span,
    .sidebar-collapsed .sidebar:hover .sidebar-version-tag {
        display: none !important;
    }
}

/* ──────────────────────────────────────────────────────────────────────
   Phase 2: Bloomberg-style multi-tab shell
   ────────────────────────────────────────────────────────────────────── */
body.uses-tab-shell .sidebar { display: none !important; }
body.uses-tab-shell .app-layout { grid-template-columns: 1fr !important; }
body.uses-tab-shell .topbar { display: none; }

/* Stacked report sections (Reporte de Ventas S1-S4). */
.section-heading {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--green-dark);
    border-bottom: 2px solid var(--lime);
    padding-bottom: 4px;
    margin-bottom: 10px;
}
.section-heading small { text-transform: none; letter-spacing: 0; font-weight: 400; }

/* ── Reporte de Ventas redesign ── */
.rv-switch { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 6px; }
.rv-seg {
    font-size: 12px; font-weight: 600; letter-spacing: 0.4px;
    padding: 6px 14px; border-radius: 6px; cursor: pointer;
    border: 1px solid var(--gray-200); background: transparent; color: var(--gray-600);
}
.rv-seg:hover { background: var(--gray-100); color: var(--green-dark); }
.rv-seg.is-active { background: var(--lime); color: var(--green-dark); border-color: var(--lime); }
.rv-kpis { margin-top: 10px; }
.rv-kpi-ring { display: flex; align-items: center; gap: 12px; }
.rv-sec th:first-child, .rv-sec td:first-child { white-space: nowrap; }
.rv-cell { position: relative; }
.rv-bar { display: block; height: 3px; background: var(--lime); opacity: .5; margin-top: 3px; border-radius: 0; }
.rv-spark { vertical-align: middle; opacity: .85; }
.rv-neg, .rv-neg .rv-v { color: var(--coral); }
.rv-warn { color: #b06d00; vertical-align: -2px; margin-left: 3px; }
.rv-editable .rv-flag .rv-warn { cursor: pointer; padding: 2px; }
.rv-editable .rv-flag .rv-warn:hover { color: #8a5400; }
.rv-flash { animation: rvflash 1.3s ease; }
@keyframes rvflash { 0%, 100% { box-shadow: none; } 25% { box-shadow: inset 0 0 0 2px #d99411; } }
.rv-flag { border-left: 2px solid #d99411; }
.rv-flag .rv-v { color: #b06d00; }
/* Manually-edited cell — subtle corner marker; hover the cell for "Editado por X · fecha". */
.rv-edited::after { content: ""; position: absolute; top: 2px; right: 2px; width: 4px; height: 4px; border-radius: 50%; background: #1565C0; opacity: 0.8; }
.rv-flag.rv-edited::after { background: #d99411; }
.rv-banner {
    display: flex; align-items: center; gap: 10px; justify-content: center;
    margin: 10px auto; max-width: 560px; padding: 8px 14px; font-size: 13px;
    color: #8a5400; border: 1px solid #e7c98a; border-radius: 6px; background: #fdf6e9;
}
.rv-banner button { border-color: #e7c98a; color: #8a5400; }
.rv-editable .rv-cell { cursor: pointer; }
.rv-editable .rv-cell:hover { outline: 1px dashed var(--gray-300); outline-offset: -1px; }
.rv-editable .rv-cond:hover { outline: 1px dashed var(--gray-300); outline-offset: -1px; cursor: pointer; }
.rv-cell input.rv-edit {
    width: 64px; height: 24px; padding: 1px 4px; font-family: var(--font-mono);
    font-size: 12px; text-align: right; border: 1px solid var(--lime); border-radius: 3px;
}
.rv-cond input.rv-edit { width: 100%; height: 26px; text-align: left; font-family: inherit; }
/* Edited cells are clickable for everyone (editors edit; viewers see the bitácora). */
.rv-cell.rv-edited { cursor: pointer; }

/* ── Editor popover: value + descripción + bitácora de cambios ── */
.rv-pop {
    position: absolute; z-index: 1200; width: 280px; max-width: calc(100vw - 16px);
    background: #fff; border: 1px solid var(--gray-300); border-radius: 6px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.18); padding: 12px; font-size: 12px;
}
.rv-pop-head { font-weight: 600; color: var(--gray-800, #2B2D27); margin-bottom: 8px; font-size: 13px; }
.rv-pop-label { display: block; font-size: 11px; color: var(--gray-600); margin: 6px 0 2px; }
.rv-pop-opt { color: var(--gray-500); font-weight: 400; }
.rv-pop-val {
    width: 100%; height: 28px; padding: 2px 6px; font-family: var(--font-mono);
    font-size: 13px; text-align: right; border: 1px solid var(--lime); border-radius: 3px; box-sizing: border-box;
}
/* Read-only twin of .rv-pop-val (mes real): same box, but muted instead of the
   lime edit border, so it never reads as a field you can type into. */
.tre-pop-ro {
    display: flex; align-items: center; justify-content: flex-end;
    border-color: var(--gray-300); background: var(--gray-25); color: var(--gray-700);
}
.rv-pop-note {
    width: 100%; padding: 4px 6px; font-family: inherit; font-size: 12px;
    border: 1px solid var(--gray-300); border-radius: 3px; box-sizing: border-box; resize: vertical;
}
.rv-pop-actions { display: flex; gap: 6px; margin: 10px 0 4px; }
/* Save feedback inside the cell popover. Without these a save gave no sign it
   was running and a failure closed the popover silently. */
.rv-pop-err {
    margin: 8px 0 0; padding: 6px 8px; font-size: 12px; line-height: 1.35;
    border-left: 3px solid var(--coral, #c0392b);
    background: var(--gray-25); color: var(--gray-800);
}
.rv-pop.is-saving { opacity: .85; }
.rv-pop.is-saving .rv-pop-val,
.rv-pop.is-saving .rv-pop-note { pointer-events: none; opacity: .7; }
.rv-pop .btn[disabled] { opacity: .6; cursor: progress; }
.rv-pop-hist-title {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gray-500);
    border-top: 1px solid var(--gray-200); padding-top: 8px; margin-top: 8px; margin-bottom: 6px;
}
.rv-pop-hist { max-height: 200px; overflow-y: auto; }
.rv-pop-empty { color: var(--gray-500); font-style: italic; }
.rv-hist-item { padding: 6px 0; border-bottom: 1px solid var(--gray-100); }
.rv-hist-item:last-child { border-bottom: none; }
.rv-hist-meta { color: var(--gray-600); font-size: 11px; }
.rv-hist-change { font-family: var(--font-mono); font-size: 12px; color: var(--gray-700); }
.rv-hist-note { color: var(--gray-700); margin-top: 2px; line-height: 1.4; white-space: pre-wrap; }

/* Pipeline bitácora (read-only) shown in the Reporte de Ventas pipeline section. */
.rv-bitacora-note { display: block; font-size: 12px; color: var(--gray-700); line-height: 1.4; }
.rv-bitacora-link { display: inline-block; margin-top: 3px; font-size: 11px; color: var(--gray-500); text-decoration: none; }
.rv-bitacora-link:hover { color: var(--green-primary); }

/* Scope-locked users (User.view_scope) see ONLY the sections they can reach.
   The pills DO render now — a scoped user can hold Reporte de Ventas plus a
   Prisier Nexus grant, so base.html renders a reduced pill set rather than this
   hiding the nav wholesale. The command/search button and tab strip stay hidden;
   the sidebar is already hidden by the tab-shell rules above. Server-side
   before_request (app.enforce_view_scope) is still the real enforcement. */
body.scoped-view .brand-search,
body.scoped-view .tab-strip { display: none !important; }


/* Brand bar — top of viewport, contains logo, section pills, user menu */
.brand-bar {
    position: sticky;
    top: 0;
    z-index: 220;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 18px;
    background: var(--green-dark);
    color: rgba(255,255,255,0.92);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    height: 48px;
}
.brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #fff;
    flex-shrink: 0;
}
.brand-logo { height: 24px; width: auto; }
/* O-Sol "BOps" wordmark — the "o" is a filled disc (Prisier isotype DNA).
   Used in place of the plain "BOps" text in the brand bar + sidebar. */
.brand-osol { display: inline-flex; align-items: center; gap: 0.05em; letter-spacing: 0; }
.brand-osol .brand-disc {
    width: 0.6em; height: 0.6em; border-radius: 50%;
    background: #1565C0; flex: 0 0 auto; transform: translateY(0.03em);
}
.brand-name {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.5px;
    color: #fff;
}
.section-pills {
    display: flex;
    gap: 2px;
    flex: 1;
    min-width: 0;          /* allow the nav to shrink/scroll instead of pushing
                              the right-side actions (search + avatar) off-screen.
                              Without this, flex min-width:auto = pills' full width,
                              which overflowed the viewport once the wider Poppins
                              font widened the row, clipping the avatar. */
    margin-left: 12px;
    overflow-x: auto;
    scrollbar-width: none;
}
.section-pills::-webkit-scrollbar { display: none; }
.section-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    color: rgba(255,255,255,0.88);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.4px;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    border: none;
    background: none;
    cursor: pointer;
}
.section-pill:hover { color: #fff; background: rgba(255,255,255,0.06); }
.section-pill.is-active {
    color: var(--green-dark);
    background: var(--lime);
}
.brand-bar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.brand-bar-actions .topbar-cmd-btn {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.75);
    border: 1px solid rgba(255,255,255,0.12);
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.brand-bar-actions .topbar-cmd-btn svg { width: 16px; height: 16px; }
.brand-bar-actions .topbar-cmd-btn:hover { background: rgba(255,255,255,0.14); color: #fff; }
.brand-bar-actions .topbar-cmd-btn kbd {
    background: rgba(255,255,255,0.12);
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 10px;
    font-family: var(--font-mono);
}

/* User menu (avatar dropdown) */
.user-menu { position: relative; }
.user-menu-summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}
.user-menu-summary::-webkit-details-marker { display: none; }
.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--lime);
    color: var(--green-dark);
    font-weight: 700;
    font-size: 13px;
}
.user-menu-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 260px;
    max-width: 320px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    padding: 12px;
    z-index: 230;
}
.user-menu-name { font-weight: 600; font-size: 13px; color: var(--gray-900); }
.user-menu-username { font-size: 11px; color: var(--gray-500); margin-bottom: 10px; }
.user-menu-link {
    display: block;
    padding: 6px 8px;
    margin: 0 -8px;
    color: var(--gray-700);
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
}
.user-menu-link:hover { background: var(--gray-100); color: var(--gray-900); }
.user-menu-logout { color: var(--coral); }
.user-menu-version {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--gray-400);
    text-align: right;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--gray-100);
}

/* Tab strip — opened panes accumulate here */
.tab-strip {
    position: sticky;
    top: 48px;
    z-index: 210;
    display: flex;
    align-items: stretch;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    padding: 0 12px;
    gap: 1px;
    overflow-x: auto;
    scrollbar-width: thin;
    min-height: 36px;
}
.tab-strip::-webkit-scrollbar { height: 4px; }
.tab-strip::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 2px; }
.tab-strip-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px 6px;
    background: transparent;
    border-right: 1px solid var(--gray-200);
    border-top: 3px solid transparent;
    font-size: 13px;
    color: var(--gray-700);
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    max-width: 240px;
    transition: background 0.1s, color 0.1s, border-color 0.1s;
    user-select: none;
}
.tab-strip-item:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}
/* Active tab — strong lime top accent + raised white surface so the eye lands
   on it instantly. Inactive tabs render dim/gray for contrast. */
.tab-strip-item.is-active {
    background: #fff;
    color: var(--gray-900);
    font-weight: 600;
    border-top-color: var(--lime);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    margin-bottom: -1px;
    z-index: 1;
}
.tab-strip-item[data-tab-pinned="1"]::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 4px;
    border-radius: 50%;
    background: var(--lime);
    flex-shrink: 0;
}
.tab-strip-label {
    overflow: hidden;
    text-overflow: ellipsis;
}
.tab-strip-close {
    background: none;
    border: none;
    color: var(--gray-500);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    border-radius: 3px;
}
.tab-strip-close:hover,
.tab-strip-close:focus,
.tab-strip-close:active { background: var(--gray-300); color: var(--gray-900); outline: none; }

/* Tab panes — the active one is in <main>, others are kept in detached refs */
body.uses-tab-shell .content { padding-top: 0; }
.tab-pane { animation: tab-pane-fade 0.12s ease-out; }
@keyframes tab-pane-fade { from { opacity: 0; } to { opacity: 1; } }

/* Mobile: hide the desktop chrome entirely. The mobile home in home.html
   serves as the primary nav; the only top-bar elements kept are a tiny
   user-menu bubble for logout/change-password (top-right corner). */
@media (max-width: 768px) {
    .brand-bar .section-pills,
    .brand-bar .brand-name,
    .brand-bar .brand-search,
    .tab-strip {
        display: none !important;
    }
    .brand-bar {
        padding: 6px 14px;
        min-height: 44px;
        justify-content: space-between;
    }
    .brand-mark { flex: 0 0 auto; }
    .brand-bar-actions { margin-left: auto; }
    .brand-bar-actions .topbar-cmd-btn { display: none; }
    /* Avatar / user menu stays visible for logout access. */
    .user-menu-summary .user-avatar { width: 32px; height: 32px; }
    /* Pad content the same way the desktop did before .brand-bar hid stuff. */
    body.uses-tab-shell .content { padding-top: 12px; }
}

/* Tab-shell layout: cap content max-width at 1680px and center it. Ultrawide
   monitors get a comfortable column instead of edge-to-edge sprawl that's
   hard to scan. */
body.uses-tab-shell .content {
    max-width: 1680px;
    margin-inline: auto;
}
body.uses-tab-shell .content-area {
    width: 100%;
}

/* ── TOOLS dropdown pill ──────────────────────────────────────── */
.section-pill-dropdown {
    position: relative;
    display: inline-block;
}
.section-pill-dropdown summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}
.section-pill-dropdown summary::-webkit-details-marker { display: none; }
.section-pill-dropdown[open] summary {
    color: var(--green-dark);
    background: var(--lime);
}
.section-pill-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 180px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 240;
}
.section-pill-menu-link {
    display: block;
    padding: 7px 12px;
    color: var(--gray-800);
    text-decoration: none;
    font-size: 13px;
    border-radius: 4px;
    font-weight: 500;
}
.section-pill-menu-link:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

/* ── Brand-bar FX ticker ──────────────────────────────────────── */
.brand-fx {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    padding: 0 10px;
    margin-right: 4px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: rgba(255,255,255,0.65);
    border-left: 1px solid rgba(255,255,255,0.08);
    border-right: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}
.brand-fx-pair {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
}
.brand-fx-cur {
    font-size: 10px;
    color: rgba(255,255,255,0.45);
    letter-spacing: 0.6px;
}
.brand-fx-rate {
    color: var(--lime);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
@media (max-width: 1024px) {
    .brand-fx { display: none; }
}

/* User menu panel — make sure it lifts above any sticky FX/quote-bar
   neighbours and home-page content. */
.user-menu-panel { z-index: 260; }

/* Form-heavy single-column pages need a max-width so they don't sprawl on wide
   monitors. Apply a class .narrow-content on the page-header wrapper or section. */
body.uses-tab-shell .narrow-content,
body.uses-tab-shell .upload-wrapper,
body.uses-tab-shell .review-layout {
    max-width: 980px;
    margin-left: auto;
    margin-right: auto;
}

/* Version-update banner — center the text inside, ensure clear visual centering */
.bops-version-banner {
    text-align: center;
    justify-content: center;
}
.bops-version-text {
    text-align: center;
    flex: 1 1 auto;
}

/* Better breathing room between tabs and brand-bar items — was cramped/touching. */
.tab-strip {
    gap: 4px !important;
    padding: 0 16px !important;
}
.tab-strip-item {
    border-right: none !important;
    margin-right: 2px;
}
.tab-strip-item + .tab-strip-item {
    margin-left: 2px;
}
.brand-bar { gap: 18px !important; }
.section-pills { gap: 4px !important; }
.brand-bar-actions { gap: 12px !important; }

/* Section-pill dropdown menu — divider + "soon" tag */
.section-pill-menu-divider {
    height: 1px;
    background: var(--gray-200);
    margin: 4px 0;
}
.section-pill-menu-link--soon {
    color: var(--gray-500);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.menu-soon-tag {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    background: var(--gray-100);
    color: var(--gray-600);
    padding: 2px 6px;
    border-radius: 8px;
    font-weight: 600;
}

/* Language toggle removed entirely 2026-05-07 (second rollback).
   Any leftover .lang-switcher in unauth templates stays hidden. */
.lang-switcher,
.lang-switcher--login,
.user-menu .lang-switcher,
.topbar .lang-switcher {
    display: none !important;
}

/* Brand-bar buffer zones — prevent dropdowns / FX widget / tabs from butting up
   against the page content. */
.brand-bar {
    padding: 8px 18px !important;
    gap: 12px !important;             /* tightened so the full pill row (incl. Tesorería) + search fit */
}
.section-pills {
    gap: 6px !important;
    /* No right border/padding here: .section-pills is flex:1 and grows to fill
       the bar, so a right border floats far from the last pill (Herramientas),
       creating an empty gap + a stray vertical line. The single divider before
       the search box (.brand-bar-actions border-left) is the only one we keep. */
}
.brand-fx {
    padding: 0 16px !important;       /* more whitespace around the rates */
    margin: 0 6px !important;
}
.brand-bar-actions {
    gap: 14px !important;
    padding-left: 12px;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
}

/* Buffer between brand bar and tab strip so dropdowns can land without
   visually colliding with the active tab. */
.tab-strip {
    margin-top: 0;
    padding: 0 24px !important;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
}

/* Make sure dropdowns and the user menu always sit ABOVE tabs and content. */
.section-pill-menu { z-index: 250 !important; }
.user-menu-panel { z-index: 260 !important; }

/* Small breathing room between content area and the sticky tab strip */
body.uses-tab-shell .content { padding-top: 16px !important; }

/* Z-INDEX HIERARCHY — when dropdowns open they MUST sit above everything.
   Pages with position:relative / sticky tables can create stacking contexts
   that fight low z-index values; raise these so it's never ambiguous. */
.brand-bar { z-index: 9000 !important; }
.tab-strip { z-index: 8000 !important; }
.section-pill-menu { z-index: 9500 !important; }
.user-menu-panel { z-index: 9500 !important; }
.bops-version-banner { z-index: 9800 !important; }
.bops-loading-overlay { z-index: 9700 !important; }
.bops-page-loader { z-index: 9900 !important; }

/* Home page — demoted ADS section as a collapsible details block */
.home-secondary-section {
    margin-top: 28px;
    border-top: 1px solid var(--gray-200);
    padding-top: 16px;
}
.home-secondary-summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    padding: 6px 0;
    font-size: 13px;
    color: var(--gray-700);
}
.home-secondary-summary::-webkit-details-marker { display: none; }
.home-secondary-summary::before {
    content: '▸';
    font-size: 11px;
    color: var(--gray-500);
    transition: transform 0.15s;
    margin-right: 4px;
}
.home-secondary-section[open] .home-secondary-summary::before {
    transform: rotate(90deg);
    display: inline-block;
}
.home-secondary-title {
    font-weight: 600;
    color: var(--gray-900);
    font-size: 14px;
}
.home-secondary-stats {
    flex: 1;
    color: var(--gray-600);
}
.home-secondary-stats strong { color: var(--gray-900); }
.home-secondary-warn { color: var(--coral); font-weight: 600; }

/* DROPDOWN OVERFLOW FIX — `.section-pills` had `overflow-x: auto` which the
   spec promotes the y-axis to `auto` too, clipping the dropdown menus and
   producing a tiny scroll/expand instead of a clean overlay. Remove the
   horizontal scroll on desktop; on mobile we use a different layout. */
.section-pills {
    overflow-x: visible !important;
    overflow-y: visible !important;
    flex-wrap: wrap;
}
.brand-bar {
    overflow: visible !important;
}
.section-pill-dropdown {
    position: relative;
    z-index: 1;
}
.section-pill-dropdown[open] {
    z-index: 9500;
}
/* Ensure menus float above sticky tab strip and any siblings */
.section-pill-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 9500 !important;
}

/* ── BIGGER BRAND BAR LETTERING ──────────────────────────────────
   Yahoo-developer-inspired: chunkier, more readable. Pills go from
   12px/uppercase-tight to 15px with comfortable padding. */
.brand-bar { height: 56px !important; padding: 10px 24px !important; }
.brand-name { font-size: 18px !important; letter-spacing: 0.3px; }
.brand-logo { height: 32px !important; }
.section-pill {
    padding: 8px 16px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    letter-spacing: 0.4px !important;
}
.brand-fx { font-size: 12px !important; }
.brand-fx-cur { font-size: 11px !important; }
.brand-fx-rate { font-size: 13px !important; }
.tab-strip { top: 56px !important; min-height: 38px; }
.tab-strip-item { font-size: 13px !important; padding: 8px 14px 7px !important; }

/* ── CONFIDENTIALITY FOOTER ──────────────────────────────────────
   Persistent disclaimer + helpdesk contact at bottom of every page. */
.bops-confidentiality {
    margin-top: 48px;
    padding: 18px 24px 22px;
    background: var(--gray-50);
    border-top: 2px solid var(--green-dark);
    font-size: 12px;
    line-height: 1.55;
    color: var(--gray-700);
    text-align: center;
}
.bops-confidentiality strong {
    color: var(--green-dark);
    font-weight: 700;
    letter-spacing: 0.3px;
}
.bops-confidentiality .bops-conf-line {
    display: block;
    margin-bottom: 6px;
}
.bops-confidentiality a {
    color: var(--green-primary);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px dotted var(--green-primary);
}
.bops-confidentiality a:hover { color: var(--lime); border-bottom-color: var(--lime); }
.bops-confidentiality .bops-conf-mark {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--lime);
    margin-right: 6px;
    vertical-align: middle;
}

/* Section pill icons */
.section-pill-icon {
    width: 16px;
    height: 16px;
    margin-right: 7px;
    opacity: 0.85;
    flex-shrink: 0;
}
.section-pill { text-transform: none !important; letter-spacing: 0.2px !important; }
.section-pill.is-active .section-pill-icon,
.section-pill[open] .section-pill-icon { opacity: 1; }
.section-pill-dropdown[open] summary .section-pill-icon { opacity: 1; }

/* Brand search bar — replaces the small icon button. Pill-style input that
   opens the command palette on click and shows the / shortcut hint. */
.brand-search {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 6px 10px;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    min-width: 170px;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    font-family: inherit;
}
.brand-search:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.22);
    color: rgba(255, 255, 255, 0.9);
}
.brand-search-icon { width: 14px; height: 14px; flex-shrink: 0; }
.brand-search-label { flex: 1; text-align: left; font-size: 13px; }
.brand-search-kbd {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 3px;
    padding: 1px 7px;
    font-size: 11px;
    font-family: var(--font-mono);
    color: rgba(255, 255, 255, 0.85);
}
@media (max-width: 1024px) {
    .brand-search { min-width: 0; padding: 6px; }
    .brand-search-label, .brand-search-kbd { display: none; }
}

/* Section-pill focus styling — when a dropdown summary is clicked it gets the
   default browser focus outline ON TOP of the active lime background, which
   reads as a double border. Drop the outline on mouse-click only; keep it
   for :focus-visible so keyboard navigation still works. */
.section-pill:focus,
.section-pill:focus-within,
summary.section-pill:focus,
.section-pill-dropdown summary:focus {
    outline: none !important;
    box-shadow: none !important;
}
.section-pill:focus-visible,
summary.section-pill:focus-visible {
    outline: 2px solid var(--lime) !important;
    outline-offset: 2px;
}

/* ── 13-inch laptop fit (≤1366px viewport) ─────────────────────────
   Compress pills + hide FX so the brand bar always fits on ONE row.
   Below this threshold flex-wrap was producing a 2-row header that
   broke the dropdown's anchored position. */
.section-pills { flex-wrap: nowrap !important; }

/* 11–13" laptops (≤1366px, e.g. 1366×768 / 1280-wide windows). Re-tuned for the
   Poppins era: the old 13.5px pills read heavy/cramped now that the UI font is
   wider, so pills drop to 12px with tighter padding and the search is compacted —
   the nav gets noticeably more breathing room while still fitting on one row. */
@media (max-width: 1366px) {
    .brand-bar { padding: 9px 18px !important; gap: 18px !important; }
    .brand-name { font-size: 16px !important; }
    .brand-logo { height: 28px !important; }
    .section-pill {
        padding: 6px 10px !important;
        font-size: 12px !important;
        letter-spacing: 0.1px !important;
    }
    .section-pill-icon { width: 14px !important; height: 14px !important; margin-right: 5px !important; }
    .brand-fx { padding: 0 10px !important; gap: 10px !important; }
    .brand-fx-cur { font-size: 9px !important; }
    .brand-fx-rate { font-size: 12px !important; }
    .brand-search { min-width: 150px !important; padding: 5px 9px !important; }
    .brand-search-label { font-size: 12px !important; }
}

@media (max-width: 1180px) {
    .brand-name { display: none; }
    .section-pill { padding: 6px 9px !important; font-size: 12.5px !important; }
    .section-pill-icon { display: none !important; }
    .brand-fx { display: none !important; }
    .brand-search { min-width: 130px !important; }
    .brand-search-kbd { display: none; }
}

/* ── Responsive tiers for the brand bar ──────────────────────────
   Goal: brand bar always fits on ONE row across realistic viewports
   without dropdowns getting clipped or stat-strip wrapping awkwardly.
   The tab strip already scrolls horizontally on small screens. */

/* Tier 1 — Ultrawide / large desktop ≥1600px: a touch more breathing room.
   Re-tuned 2026-06-24: 6 section pills (incl. Tesorería) + the search box overflowed
   ~1600px screens and the search collided with "Herramientas". The bar can't clip
   (dropdowns need overflow:visible), so the pills must stay compact even here. */
@media (min-width: 1600px) {
    .brand-bar { padding: 11px 26px !important; gap: 18px !important; }
    .brand-name { font-size: 18px !important; }
    .section-pill { padding: 7px 12px !important; font-size: 13.5px !important; }
    .brand-search { min-width: 210px !important; }
}

/* Ultrawide ≥1800px: the full row fits with room to spare — restore comfort. */
@media (min-width: 1800px) {
    .section-pill { padding: 8px 15px !important; font-size: 14.5px !important; }
    .brand-search { min-width: 260px !important; }
}

/* This used to collapse the search below 1500px, because the section pills
   needed the room the "Buscar acciones…" label took and the bar can't clip
   (dropdowns force overflow:visible). The pills are icon-first now and expand
   only on hover, so that room exists again and the search keeps its label far
   further down. Below 900px it still collapses to an icon — the "/" shortcut
   opens the palette either way. */
@media (max-width: 899px) {
    .brand-search { min-width: 0 !important; padding: 6px 8px !important; }
    .brand-search-label,
    .brand-search-kbd { display: none !important; }
}

/* Tier 2 — Standard desktop 1367–1599px: default sizes (already in :root) */

/* Tier 3 — 13-inch laptop 1180–1366px (defined above; keep) */

/* Tier 4 — Small laptop / large tablet 1025–1179px */
@media (max-width: 1179px) and (min-width: 1025px) {
    .brand-bar { padding: 8px 12px !important; gap: 10px !important; }
    .section-pill { padding: 5px 9px !important; font-size: 12.5px !important; }
    .section-pill-icon { display: none !important; }
    .brand-name { display: none; }
    .brand-fx { display: none !important; }
    .brand-search { min-width: 140px !important; }
    .brand-search-label { font-size: 11px !important; }
    .brand-search-kbd { display: none; }
}

/* Tier 5 — Tablet ≤1024px: hide brand bar nav, the existing burger from
   the old sidebar pattern reappears as the entry point. The tab strip
   stays at the top. Mobile drawer rules already exist below 1024px. */
@media (max-width: 1024px) {
    .brand-bar {
        padding: 8px 10px !important;
        gap: 8px !important;
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .brand-bar::-webkit-scrollbar { display: none; }
    .section-pills {
        gap: 2px !important;
        flex-shrink: 0;
    }
    .section-pill {
        padding: 5px 8px !important;
        font-size: 12px !important;
    }
    .section-pill-icon { display: none !important; }
    .brand-name, .brand-fx { display: none !important; }
    .brand-search { min-width: 0 !important; padding: 5px 7px !important; }
    .brand-search-label, .brand-search-kbd { display: none; }
    .user-avatar { width: 28px; height: 28px; font-size: 12px; }
}

/* Tier 6 — Phone ≤640px: only show brand mark + avatar, the section pills
   horizontally scroll under finger, search collapses to icon-only. */
@media (max-width: 640px) {
    .brand-bar { padding: 6px 8px !important; height: 48px !important; }
    .tab-strip { top: 48px !important; padding: 0 8px !important; }
    .section-pill { padding: 4px 7px !important; font-size: 11.5px !important; }
    .brand-search { padding: 4px 6px !important; }
    .brand-search-icon { width: 13px !important; height: 13px !important; }
    /* Footer reads tighter on phones */
    .bops-confidentiality { font-size: 11px; padding: 14px 16px 18px; }
}

/* Make sure the dropdown menus reposition responsibly on narrow viewports —
   if a menu would overflow off-screen to the right, anchor it to the right
   edge instead. */
@media (max-width: 1024px) {
    .section-pill-menu { left: auto; right: 0; min-width: 200px; }
}

/* Stat strip wraps cleanly on intermediate sizes (was forcing all on one
   line then collapsing too late). */
@media (max-width: 1366px) {
    .stat-strip { flex-wrap: wrap; }
    .stat-cell { flex: 1 1 calc(33% - 4px); min-width: 200px; }
}
@media (max-width: 768px) {
    .stat-cell { flex: 1 1 100%; }
}

/* Invoice detail page — give the PDF preview more room and make it taller.
   Was 1fr/1fr columns + 500px iframe → felt cramped. Now 1.4/1 and tall. */
.review-layout {
    grid-template-columns: 1.4fr 1fr !important;
    gap: 24px !important;
}
.preview-pdf {
    height: 75vh !important;
    min-height: 620px !important;
}
@media (max-width: 1024px) {
    .review-layout { grid-template-columns: 1fr !important; }
    .preview-pdf { height: 60vh !important; min-height: 420px !important; }
}
/* Tighten dt/dd spacing in the details column so more fits without scrolling */
.review-layout dl dt {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    margin-top: 12px;
}
.review-layout dl dd {
    font-size: 14px;
    color: var(--gray-900);
    margin: 2px 0 0;
    font-variant-numeric: tabular-nums;
}

/* ══ Bauhaus accent layer — DIALED UP (Option B) ════════════════════
   Full geometric language layered over the green/Bloomberg base. Reversible:
   delete this block to revert. Changes are radius / border / color / motif
   only — box dimensions are unchanged, EXCEPT the panel-head rule which adds
   a deliberate ~8px of header height. */

/* 1 — Squared geometry everywhere. Re-declaring the radius tokens overrides
   the rounded defaults globally (cards, panels, inputs, buttons, modals,
   command palette). Circular avatars + status dots use explicit 50% and stay
   round on purpose — the circle is a primary Bauhaus form. */
:root {
    --radius-sm: 0px;
    --radius: 0px;
    --radius-md: 0px;
    --radius-lg: 2px;
}
.tag, .badge, .kpi-delta, .home-chip { border-radius: 0; }
.btn { border-radius: 0; }

/* 2 — Constructivist weight: heavy dark rules under headers. */
.data-table th { border-bottom-color: var(--gray-900); }
.home-panel-head,
section.section > h2:first-child {
    border-bottom: 2px solid var(--gray-900);
    padding-bottom: 6px;
}

/* 3 — Geometric uppercase headings (subtitles stay sentence-case). */
.home-panel-head h2, .home-panel-head h3,
section.section > h2:first-child,
.page-header h1, .m-upload-title, .m-home-title {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
}
.home-subtle, .home-panel-head small { text-transform: none; letter-spacing: 0; }

/* 4 — Kandinsky trio motif (red square · blue circle · yellow triangle) on
   panel/section/mobile-page headers — the Bauhaus signature. Inline SVG
   data-URI background (allowed by CSP img-src 'data:'). */
.home-panel-head h2::before,
.home-panel-head h3::before,
section.section > h2:first-child::before,
.m-upload-title::before, .m-home-title::before {
    content: "";
    display: inline-block;
    width: 46px; height: 14px;
    margin-right: 9px;
    vertical-align: -2px;
    background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='46' height='14' viewBox='0 0 46 14'><rect x='0' y='0.5' width='13' height='13' fill='%23E63A27'/><circle cx='22.5' cy='7' r='6.5' fill='%231A4FA0'/><polygon points='32,13.5 39,0.5 46,13.5' fill='%23F2C200'/></svg>") no-repeat center / contain;
}

/* 5 — Bauhaus primary stripe across the top of the brand bar (Kandinsky
   red/yellow/blue + black). Pseudo-element overlays the top 3px — adds no
   height, so the sticky bar and everything below stay put. */
.brand-bar::before {
    content: "";
    position: absolute;
    left: 0; right: 0; top: 0;
    height: 4px;
    background: linear-gradient(90deg,
        var(--bh-red) 0 25%, var(--bh-yellow) 25% 50%,
        var(--bh-blue) 50% 75%, var(--gray-900) 75% 100%);
    z-index: 1;
}

/* ── Fluid brand-bar typography (kills the full-screen vs floating-window jump) ──
   The per-tier font sizes stepped from 12px (≤1366) up to 15.5px (≥1600), so the
   nav read noticeably bigger full-screen than in a smaller/floating window.
   Replace those steps with smooth clamp() scaling — the bar grows/shrinks
   continuously with the viewport instead of snapping at the 1366/1600px breaks.
   Appended last so it overrides every earlier per-tier font-size; the padding
   tiers (which help the row fit) are left intact. */
.section-pill { font-size: clamp(12px, 0.45vw + 6.6px, 14px) !important; }
.brand-name   { font-size: clamp(16px, 0.35vw + 11px, 18px) !important; }

/* ── Bauhaus section titles on secondary screens ──────────────────────
   Card/section headings (admin, exports, invoice detail/edit) get the same
   uppercase geometric treatment as the dashboard panel heads, for a
   consistent look. No trio/heavy-rule here (kept as a top-level accent), and
   the coming-soon card's sentence-style h3 is explicitly excluded. */
.card > h3, .section > h3, .card > h4 {
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 700;
}
.coming-soon-card h3 { text-transform: none; letter-spacing: normal; }

/* ============================================================
   TREASURY — blended Economist / OWID chart cards + projection
   ============================================================ */

/* Editorial card: title / subtitle stack, accent rule, chart, source. */
:root { --chart-olive: #7A8F0C; }   /* series slot 1 — mirror of chart_theme.py */
.section-pill-menu-note {
    max-width: 240px; padding: 10px 14px; font-size: 11.5px; line-height: 1.6;
    color: var(--gray-600);
}
.section-pill-menu-note a { color: var(--green-primary); font-weight: 600; }

.tchart-card {
    background: var(--white);
    border: 1px solid var(--gray-100);            /* OWID: airy, no top accent */
    padding: 18px 22px 16px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.tchart-card__head {
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--gray-100);     /* OWID header rule */
}
.tchart-card__title {
    font-family: var(--font-ui, 'Poppins', sans-serif);
    font-size: 17px;
    font-weight: 600;
    color: var(--gray-900);
    letter-spacing: -0.01em;
    margin: 0;
    line-height: 1.25;
}
.tchart-card__sub {
    font-size: 12.5px;
    color: var(--gray-500);
    margin: 4px 0 0;
    line-height: 1.4;
}
.tchart-card__source {
    font-size: 10.5px;
    color: var(--gray-400);
    margin-top: 8px;
    border-top: 1px solid var(--gray-50);
    padding-top: 7px;
    letter-spacing: 0.01em;
}
.tchart-card__source strong { color: var(--gray-600); font-weight: 600; }

/* Dashboard charts row — responsive 2-up that collapses to 1 on narrow screens. */
.home-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 12px;
    align-items: start;  /* each card snug to its own content — no stretch gap */
}
.home-charts .tchart-card { margin-bottom: 16px; }
@media (max-width: 760px) {
    .home-charts { grid-template-columns: 1fr; }
}

/* The chart canvas wrapper (holds the SVG + floating tooltip). */
.tchart {
    position: relative;
    width: 100%;
}
.tchart-svg {
    width: 100%;
    height: auto;
    display: block;
    overflow: visible;
}
.tchart-empty {
    text-align: center;
    color: var(--gray-400);
    font-size: 13px;
    padding: 40px 0;
}

/* Fluid draw-in: line strokes sweep in, area fades up. */
@keyframes tchart-draw { to { stroke-dashoffset: 0; } }
@keyframes tchart-fade { from { opacity: 0; } to { opacity: 1; } }
.tchart-line {
    stroke-dasharray: 2600;
    stroke-dashoffset: 2600;
    animation: tchart-draw 1.1s cubic-bezier(.22,.61,.36,1) forwards;
}
.tchart-bar {
    transform-box: fill-box;
    transform-origin: bottom;
    animation: tchart-fade .6s ease forwards;
}
.tchart-svg path[fill^="url"] { animation: tchart-fade 1.2s ease forwards; }
@media (prefers-reduced-motion: reduce) {
    .tchart-line { stroke-dasharray: none; stroke-dashoffset: 0; animation: none; }
    .tchart-bar, .tchart-svg path[fill^="url"] { animation: none; }
}

/* Hover affordances — smooth, OWID-like. */
.tchart-focus-line { transition: opacity .12s ease; pointer-events: none; }
.tchart-focus-dot { transition: opacity .12s ease; pointer-events: none; }
.tchart-capture { cursor: crosshair; }

/* Floating tooltip. */
.tchart-tip {
    position: absolute;
    top: 0; left: 0;
    min-width: 150px;
    max-width: 220px;
    background: var(--gray-900);
    color: #fff;
    padding: 9px 11px;
    font-family: var(--font-ui, 'Poppins', sans-serif);
    font-size: 12px;
    pointer-events: none;
    opacity: 0;
    transition: opacity .12s ease;
    z-index: 20;
    box-shadow: 0 6px 22px rgba(0,0,0,.22);
}
.tchart-tip-hd {
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.02em;
    color: var(--lime-light);
    margin-bottom: 5px;
}
.tchart-tip-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 1px 0;
}
.tchart-tip-key { display: flex; align-items: center; gap: 6px; color: rgba(255,255,255,.82); }
.tchart-tip-key i { width: 9px; height: 9px; flex: 0 0 auto; display: inline-block; }
.tchart-tip-val { font-family: var(--font-mono, 'JetBrains Mono', monospace); font-weight: 600; }
.tchart-tip-sub { font-size: 10.5px; color: rgba(255,255,255,.55); margin-top: 2px; }
.tchart-tip-total {
    margin-top: 4px;
    padding-top: 5px;
    border-top: 1px solid rgba(255,255,255,.18);
    font-weight: 700;
}
.tchart-tip-total .tchart-tip-key { color: var(--lime-light); }
.tchart-tip-total .tchart-tip-val { color: var(--lime-light); }

/* On-card KPI strip — dense numerical header above a chart. Bloomberg-flat,
   no tinted backgrounds; numbers live in the typography. */
.tchart-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px 18px;
    margin: 4px 0 12px;
    padding: 8px 0 10px;
    border-top: 1px solid var(--gray-50);
    border-bottom: 1px solid var(--gray-50);
}
.tchart-kpi {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.tchart-kpi__label {
    font-family: var(--font-ui, 'Poppins', sans-serif);
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tchart-kpi__value {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 17px;
    font-weight: 600;
    color: var(--gray-900);
    line-height: 1.15;
    letter-spacing: -0.01em;
}
.tchart-kpi__delta {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    margin-top: 1px;
}
.tchart-kpi__delta--up   { color: #2C7A4B; }
.tchart-kpi__delta--down { color: #B23A48; }
.tchart-kpi__delta--flat { color: var(--gray-500); }
.tchart-kpi__sub {
    font-family: var(--font-ui, 'Poppins', sans-serif);
    font-size: 10.5px;
    color: var(--gray-400);
    line-height: 1.2;
}

/* ---- Treasury page layout ---- */
.tre-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

/* ── Treasury matrix (full-2026 cash-flow ledger) ─────────────────────────── */
.tre-gran-toggle { display: inline-flex; border: 1px solid var(--gray-200); border-radius: 6px; overflow: hidden; }
.tre-gran-toggle a {
    padding: 5px 14px; font-size: 12px; font-weight: 600; color: var(--gray-600);
    text-decoration: none; background: var(--white);
}
.tre-gran-toggle a.is-active { background: var(--green-dark); color: var(--white); }
/* Dashboard row: charts (capped) on the left, an indicator rail filling the
   space that the width-cap frees up on wide monitors. */
.tre-dash { display: grid; grid-template-columns: minmax(0, 1080px) 1fr; gap: 16px; margin: 16px 0; align-items: start; }
.tre-charts { display: grid; grid-template-columns: 1fr; gap: 16px; margin: 0; align-items: start; }
.tchart-card--wide { grid-column: 1 / -1; }   /* the dash column caps the width */

.tre-rail { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 12px; }
.tre-rail-card { background: var(--white); border: 1px solid var(--gray-200); border-radius: 8px; padding: 13px 16px; }
.tre-rail-card__label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--gray-500); font-weight: 600; }
.tre-rail-card__value { font-family: var(--font-mono, 'JetBrains Mono', monospace); font-size: 21px; font-weight: 700; margin-top: 4px; color: var(--gray-800); line-height: 1.1; }
.tre-rail-card__value--pos { color: var(--green-primary); }
.tre-rail-card__value--neg { color: var(--red); }
.tre-rail-card__sub { font-size: 11px; color: var(--gray-500); margin-top: 3px; }
/* Below the two-column threshold the rail drops under the charts and flows as a
   wrapping row of cards instead of a tall sidebar. */
@media (max-width: 1400px) {
    .tre-dash { grid-template-columns: 1fr; }
    .tre-rail { position: static; flex-direction: row; flex-wrap: wrap; }
    .tre-rail-card { flex: 1 1 200px; }
}
@media (max-width: 1024px) { .tre-charts { grid-template-columns: 1fr; } }

.tre-matrix-wrap { margin: 8px 0 20px; max-height: 70vh; overflow: auto; border: 1px solid var(--gray-200); }
.tre-matrix { margin: 0; border-collapse: separate; border-spacing: 0; white-space: nowrap; }
.tre-matrix thead th { position: sticky; top: 0; z-index: 3; background: var(--green-dark); color: var(--white); font-size: 11px; }
.tre-matrix__rowlabel {
    position: sticky; left: 0; z-index: 2; background: var(--white);
    text-align: left; min-width: 190px; box-shadow: 1px 0 0 var(--gray-200);
}
.tre-matrix thead .tre-matrix__rowlabel { z-index: 4; background: var(--green-dark); }
.tre-matrix td, .tre-matrix th { padding: 5px 10px; }
.tre-col--hoy { background: var(--lime-muted) !important; box-shadow: inset 1px 0 0 var(--lime), inset -1px 0 0 var(--lime); }
.tre-matrix thead th.tre-col--hoy { background: var(--lime) !important; color: var(--green-dark); }
.tre-matrix thead th.tre-col--hoy .tre-hoy-tag { background: var(--green-dark); color: var(--lime); }
/* Matriz de caja: columnas de semana angostas → el badge HOY inline se recortaba.
   Apílalo en su propia línea, centrado y legible (en Recurrentes las columnas son
   anchas y el badge inline se ve bien, así que ese caso se deja igual). */
.tre-grid-root:not(.tre-exp-root) .tre-matrix thead th.tre-col--hoy { text-align: center; }
.tre-grid-root:not(.tre-exp-root) .tre-matrix thead th.tre-col--hoy .tre-hoy-tag { display: block; width: fit-content; margin: 2px auto 0; font-size: 9px; font-weight: 700; letter-spacing: .04em; padding: 1px 5px; }
.tre-hoy-tag { font-size: 8px; background: var(--lime); color: var(--green-dark); padding: 0 3px; border-radius: 2px; vertical-align: middle; }
.tre-section-row td {
    background: var(--green-light); color: var(--green-dark); font-weight: 700;
    font-size: 11px; letter-spacing: 0.5px; cursor: pointer; position: sticky; left: 0;
}
.tre-section-row.is-collapsed td::first-letter { color: var(--gray-500); }
.tre-section--collapsed { display: none; }
.tre-subtotal td { font-weight: 700; border-top: 1px solid var(--gray-300); background: var(--gray-50); }
.tre-subtotal .tre-matrix__rowlabel { background: var(--gray-50); }
.tre-saldo-row td { font-weight: 800; background: var(--green-dark); color: var(--white); border-top: 2px solid var(--lime); }
.tre-saldo-row .tre-matrix__rowlabel { background: var(--green-dark); color: var(--white); }
.tre-saldo-row td.tre-neg { color: #FFB3B3; }
.tre-saldo-row td.tre-col--hoy { background: #3a4a1f !important; }
/* Projected (future) saldo cells read lighter than the real (past) ones, so the
   real-vs-projection split is visible in the row itself. */
.tre-saldo-row td.tre-saldo--proj { color: rgba(255,255,255,.72); font-weight: 600; }
/* Bank-balance row: the real anchor line, styled quieter than the bold SALDO
   row but clearly a summary row. Blank cells after HOY show the past ends here. */
/* Δ row: change in the projected balance per period. A quiet flow-summary row
   (lighter than the bold SALDO line) sitting just under Total Egresos. */
.tre-delta-row td { background: var(--gray-50); font-weight: 700; border-top: 1px solid var(--gray-300); }
.tre-delta-row .tre-matrix__rowlabel { background: var(--gray-50); }
.tre-delta-row td.tre-delta--pos { color: var(--green-primary); }
.tre-delta-row td.tre-delta--neg { color: var(--red); }
.tre-delta-row td.tre-col--hoy { background: var(--lime-muted) !important; }
.tre-bank-row td { background: var(--gray-100); font-weight: 600; border-top: 2px solid var(--gray-300); }
.tre-bank-row .tre-matrix__rowlabel { background: var(--gray-100); }
.tre-bank-row td.tre-col--hoy { background: #eef0e6 !important; }
.tre-bank-edit { font-size: 10px; font-weight: 600; color: var(--green-primary); text-decoration: none; margin-left: 6px; }
.tre-bank-edit:hover { text-decoration: underline; }
.tre-past-note { max-width: 1080px; margin: 10px 0 0; padding: 10px 14px; font-size: 12.5px; line-height: 1.5; color: var(--gray-700); background: var(--gray-50, #f7f8f4); border: 1px solid var(--gray-200); border-left: 3px solid var(--lime); border-radius: 4px; }
.tre-past-note a { color: var(--green-primary); }

/* Data-trust layer: bank-balance freshness banner, stale dates, conciliation dots */
.tre-bankwarn {
    display: flex; align-items: flex-start; gap: 10px;
    background: #FFF8E1; border: 1px solid #F0D274; border-left: 3px solid #E0A800;
    color: #6b5200; padding: 10px 14px; border-radius: 4px; margin-bottom: 16px;
    font-size: 13px; line-height: 1.45;
}
.tre-bankwarn__icon { font-size: 15px; line-height: 1.2; }
.tre-bankwarn a { color: var(--green-dark); font-weight: 600; white-space: nowrap; margin-left: 6px; }
.tre-stale { color: #C0392B; font-weight: 600; }
.tre-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: middle; }
.tre-dot--ok { background: var(--lime); }
.tre-dot--drift { background: #E0A800; }
.tre-dot--na { background: var(--gray-300); }
.tre-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    border: 1px solid var(--gray-100);
    background: var(--white);
    margin-bottom: 16px;
}
.tre-kpi {
    padding: 14px 16px;
    border-left: 1px solid var(--gray-100);
}
.tre-kpi:first-child { border-left: none; }
.tre-kpi__label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-500);
    font-weight: 600;
}
.tre-kpi__value {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 22px;
    font-weight: 600;
    color: var(--gray-900);
    margin-top: 3px;
    line-height: 1.1;
}
.tre-kpi__value--pos { color: var(--green-primary); }
.tre-kpi__value--neg { color: var(--red); }
.tre-kpi__sub { font-size: 11px; color: var(--gray-400); margin-top: 3px; }

/* (Legacy v2 `.tre-grid` two-column page layout removed 2026-07-17: no template
   uses it anymore and `display: grid` collided with the v3 matriz TABLE, which
   also carries the class — it split thead/tbody into side-by-side grid items.) */
.tre-panel {
    background: var(--white);
    border: 1px solid var(--gray-100);
    padding: 16px 18px;
    min-width: 0;
}
.tre-panel__title {
    font-size: 13px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 12px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.tre-panel__title small { font-weight: 400; color: var(--gray-400); font-size: 11px; }
.tre-bar-row { margin-bottom: 10px; }
.tre-bar-row__head {
    display: flex; justify-content: space-between; align-items: baseline;
    font-size: 12px; margin-bottom: 3px;
}
.tre-bar-row__name { color: var(--gray-700); }
.tre-bar-row__val { font-family: var(--font-mono, 'JetBrains Mono', monospace); color: var(--gray-900); font-weight: 600; }
.tre-bar-track { height: 7px; background: var(--gray-50); overflow: hidden; }
.tre-bar-fill { height: 100%; background: var(--lime); }
.tre-bar-fill--out { background: var(--coral); }

@media (max-width: 1024px) {
    .tre-kpis { grid-template-columns: repeat(2, 1fr); }
    .tre-kpi:nth-child(odd) { border-left: none; }
    .tre-kpi:nth-child(3), .tre-kpi:nth-child(4) { border-top: 1px solid var(--gray-100); }
    .tre-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
    .tre-kpi__value { font-size: 18px; }
    .tchart-card { padding: 14px 14px 12px; }
}

/* ---- Home: liquidity rail (under the projection hero) ---- */
.home-liq-rail {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    border-top: 1px solid var(--gray-100);
    border-bottom: 1px solid var(--gray-100);
    margin: 4px 0 12px;
}
.home-liq {
    padding: 9px 14px;
    border-left: 1px solid var(--gray-100);
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.home-liq:first-child { border-left: none; padding-left: 2px; }
.home-liq__label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    font-weight: 600;
}
.home-liq__value {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-900);
    line-height: 1.1;
}
.home-liq__value.is-pos { color: var(--green-primary); }
.home-liq__value.is-neg { color: var(--red); }
.home-liq__value.is-warn { color: #C2410C; }
.home-liq__sub { font-size: 10.5px; color: var(--gray-400); }

/* ---- Home: próximos movimientos (cobros / pagos) ---- */
.home-flows { display: flex; flex-direction: column; height: 100%; }
.home-flows__split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 18px;
}
.home-flows__col { min-width: 0; }
.home-flows__col + .home-flows__col {
    border-left: 1px solid var(--gray-100);
    padding-left: 18px;
}
.home-flows__hd {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-bottom: 6px;
    margin-bottom: 4px;
    border-bottom: 2px solid var(--gray-900);
}
.home-flows__title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.home-flows__title--in { color: var(--green-primary); }
.home-flows__title--out { color: var(--red); }
.home-flows__sum { font-size: 12px; font-weight: 600; color: var(--gray-700); }
.home-flow {
    display: grid;
    grid-template-columns: 38px 1fr auto;
    gap: 8px;
    align-items: baseline;
    padding: 4px 0;
    border-bottom: 1px solid var(--gray-50);
    font-size: 12px;
}
.home-flow__wk { color: var(--gray-400); font-size: 11px; }
.home-flow__name {
    color: var(--gray-800);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.home-flow__amt { color: var(--gray-900); font-weight: 600; }

@media (max-width: 1024px) {
    .home-liq-rail { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
    .home-liq-rail { grid-template-columns: 1fr; }
    .home-liq { border-left: none; border-top: 1px solid var(--gray-100); padding-left: 2px; }
    .home-liq:first-child { border-top: none; }
    .home-liq__value { font-size: 17px; }
    .home-flows__split { grid-template-columns: 1fr; gap: 16px; }
    .home-flows__col + .home-flows__col { border-left: none; padding-left: 0; border-top: 1px solid var(--gray-100); padding-top: 12px; }
}

/* ---- FV ⇄ Excel reconciliation strip ---- */
.fv-recon {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-left: 3px solid var(--lime);
    padding: 12px 16px;
    margin-bottom: 16px;
}
.fv-recon__main { min-width: 0; flex: 1 1 320px; }
.fv-recon__title { font-size: 13px; font-weight: 700; color: var(--gray-900); margin: 0 0 3px; }
.fv-recon__hint { font-size: 12px; color: var(--gray-500); margin: 0; line-height: 1.45; max-width: 64ch; }
.fv-recon__side { display: flex; align-items: center; gap: 14px; flex: 0 0 auto; }
.fv-recon__flag {
    display: flex; flex-direction: column; align-items: center; gap: 0;
    text-decoration: none; padding: 4px 12px;
    border: 1px solid var(--gray-200); background: var(--gray-25);
}
.fv-recon__flag:hover { border-color: var(--coral); }
.fv-recon__flag-num { font-family: var(--font-mono, monospace); font-size: 18px; font-weight: 700; color: var(--coral); line-height: 1.1; }
.fv-recon__flag-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gray-500); }
.fv-recon__btn { white-space: nowrap; }
@media (max-width: 640px) {
    .fv-recon { align-items: stretch; }
    .fv-recon__side { justify-content: space-between; width: 100%; }
    .fv-recon__btn { flex: 1 1 auto; }
}

/* Multi-series legend for charts.js */
.tchart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin: 0 0 8px;
    padding-left: 2px;
}
.tchart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-ui, 'Poppins', sans-serif);
    font-size: 12px;
    color: var(--gray-600);
}
.tchart-legend-item i { width: 11px; height: 11px; flex: 0 0 auto; display: inline-block; }
.tchart-legend-val { font-family: var(--font-mono, 'JetBrains Mono', monospace); font-weight: 600; color: var(--gray-800); }
/* Donut: fixed-size ring + a column legend beside it */
.tchart-donut-row { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.tchart-donut-svg { width: 172px; height: 172px; flex: 0 0 auto; }
.tchart-legend--col { flex-direction: column; align-items: flex-start; gap: 8px; margin: 0; }
/* Pair: two aligned panels, one timeline */
.tchart-pair__panel + .tchart-pair__panel { margin-top: 2px; }

/* ============================================================
   Light design-language polish (v1.4.07) — flat/Bloomberg kept;
   elevated via hierarchy, breathing room, crisper pills & cleaner
   tables. One reversible block. No shadows, no rounding.
   ============================================================ */

/* Section hierarchy + breathing room */
.section { margin-bottom: 22px; }
.section h2 { letter-spacing: -0.01em; }

/* Tables: drop zebra for a cleaner read; stronger header label; no
   trailing border. Keeps the heavy header rule + row hover. */
.data-table tbody tr:nth-child(even) { background: transparent; }
.data-table tbody tr:hover,
.data-table tbody tr:nth-child(even):hover { background: var(--green-light); }
.data-table th { color: var(--gray-600); letter-spacing: 0.05em; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* Status pills: crisper and consistent (still tinted, still square). */
.tag { padding: 2px 9px; font-weight: 700; letter-spacing: 0.02em; line-height: 1.5; }

/* KPI strip: subtle hover affordance on the linked cells. */
a.stat-cell { transition: background 0.12s ease; }
a.stat-cell:hover { background: var(--gray-25); }

/* ── Treasury · Detalle por concepto (itemized view) ────────────────────────── */
.tre-det-group { font-size: 11px; font-weight: 700; letter-spacing: .05em; color: var(--gray-600); margin: 14px 0 6px; }
.tre-det-concept { border: 1px solid var(--gray-100); border-radius: 8px; margin-bottom: 8px; background: var(--white); overflow: hidden; }
.tre-det-head { padding: 9px 14px; font-weight: 600; font-size: 13px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.tre-det-head:hover { background: var(--gray-25); }
.tre-det-body { border-top: 1px solid var(--gray-100); }
.tre-det-period td { background: var(--gray-50); font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; padding: 4px 12px; }
.tre-det-item { cursor: pointer; }
.tre-det-item:hover td { background: var(--lime-muted); }
.tre-det-item td { font-size: 12.5px; padding: 5px 12px; }
.tre-det-overdue { color: var(--coral); font-weight: 600; }
.tre-det-ok { background: var(--green-light); border: 1px solid var(--lime); border-radius: 8px; padding: 10px 14px; font-size: 12.5px; margin-bottom: 10px; }
.tre-alert-item { padding: 4px 0; font-size: 12.5px; border-bottom: 1px dashed var(--gray-100); }
#tre-alerts details { margin-top: 6px; }
#tre-alerts summary { cursor: pointer; font-weight: 600; font-size: 12px; }
.tre-reload-hint { margin-left: 10px; }

/* ── Treasury · Escenarios ──────────────────────────────────────────────────── */
.tre-scenario-bar { display: flex; align-items: center; gap: 10px; margin: 10px 0; flex-wrap: wrap; }
.tre-scenario-bar__label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-600); }
.tre-scenario-bar select { padding: 6px 10px; border: 1px solid var(--gray-200); border-radius: 8px; font: inherit; font-size: 12.5px; background: var(--white); }
.tre-scenario-banner { background: #f4f0fb; border: 1px solid var(--violet, #7B61C9); border-radius: 8px; padding: 9px 14px; font-size: 12.5px; margin-bottom: 12px; }
.tre-delta td { font-size: 11.5px; color: var(--gray-500); border-top: 1px dashed var(--gray-200); }
.tre-delta--pos { color: #2f7d32 !important; }
.tre-delta--neg { color: var(--coral) !important; }
.tre-det-addform { background: #f4f0fb; border: 1px dashed var(--violet, #7B61C9); border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; font-size: 12.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tre-det-addform input, .tre-det-addform select { padding: 5px 8px; border: 1px solid var(--gray-200); border-radius: 6px; font: inherit; font-size: 12.5px; }

/* ── Tesorería v3 · la matriz gigante editable ──────────────────────────────── */
.tre-grid-wrap { max-height: 75vh; }
/* Fixed layout: uniform aligned columns (empty cells no longer collapse), and a
   much faster browser layout pass on ~15k cells. */
.tre-grid { table-layout: fixed; width: max-content; }
/* Perf: skip layout/paint for off-screen data rows on the ~7,700-cell weekly
   grid — big scroll/interaction win, no visual change. Safe under table-layout:
   fixed (column widths are fixed, so hidden rows can't shift them). */
.tre-grid tbody tr.tre-row { content-visibility: auto; contain-intrinsic-size: auto 22px; }
.tre-grid th, .tre-grid td { font-size: 11.5px; padding: 3px 8px; width: 96px;
    overflow: hidden; text-overflow: ellipsis; }
/* Pin the week columns' min AND max width (not just `width`, which fixed-layout
   treats as a hint). Without this, the egreso row-group — whose numbers are
   wider by the leading "−" — overran to 99px while the header/ingreso stayed
   96px, shifting the HOY column right. Mirrors how the rowlabel col is pinned.
   Targets .col-numeric only, so section/month colspan cells are left to span. */
.tre-grid .col-numeric { min-width: 96px; max-width: 96px; }
.tre-grid .tre-matrix__rowlabel { width: 280px; min-width: 280px; max-width: 280px; }
/* Subtle vertical gridlines so the eye can track a column across 275 rows. */
.tre-grid td { border-right: 1px solid var(--gray-50); }
/* Zebra stripe — but never on the summary rows (saldo / bank / subtotal /
   section), whose backgrounds are deliberate. Without :not(), an even-indexed
   saldo row got repainted gray-25 here (later + equal specificity wins),
   leaving its white text on gray = invisible. */
.tre-grid tbody tr:nth-child(even):not(.tre-saldo-row):not(.tre-bank-row):not(.tre-delta-row):not(.tre-subtotal):not(.tre-section-row) td { background: var(--gray-25); }
.tre-grid tbody tr:nth-child(even):not(.tre-saldo-row):not(.tre-bank-row):not(.tre-delta-row):not(.tre-subtotal):not(.tre-section-row) td.tre-col--hoy { background: var(--lime-muted) !important; }
/* Section headers: the label lives in a normal sticky-left cell (the v2
   colspan+sticky trick floats mid-grid on a 6000px-wide table). */
.tre-grid .tre-section-row td { position: static; }
.tre-grid .tre-section-row .tre-matrix__rowlabel { position: sticky; left: 0; z-index: 2;
    background: var(--green-light); }
.tre-grid .tre-section-row td:not(.tre-matrix__rowlabel) { background: var(--green-light); border-right: none; }
.tre-grid .tre-subtotal td, .tre-grid .tre-saldo-row td { border-right: none; }
.tre-grid tbody tr:nth-child(even) td.tre-detail__cell,
.tre-grid .tre-detail td { background: var(--gray-25); }
.tre-grid__months th { position: sticky; top: 0; z-index: 3; background: var(--gray-50); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-600); border-left: 2px solid var(--gray-200); text-align: left; padding: 2px 8px; height: 20px; }
.tre-grid__months th.tre-matrix__rowlabel { z-index: 4; border-left: none; }
/* second header row offsets below the month-group row ONLY when it exists (weekly view) */
.tre-grid .tre-grid__months + tr th { top: 24px; }
.tre-grid--editable .tre-cell { cursor: pointer; }
.tre-grid--editable .tre-cell:hover { background: var(--lime-muted); }
.tre-grid-root:not(.tre-grid--editable) .tre-cell { cursor: zoom-in; }
.tre-cell { position: relative; }
.tre-cell--flag { box-shadow: inset 2px 0 0 #E0A800; background: #FFFDF3; }
.tre-cell--flag .tre-warn { color: #B8860B; vertical-align: -1px; margin-left: 3px; cursor: pointer; }
/* Un mes cerrado de una deuda donde la factura registrada reemplazó a la cuota
   tecleada. Discreto a propósito: no es un error, es la cifra real ganándole a
   una proyección — pero tiene que verse que ahí había un número escrito. */
.tre-superseded { color: var(--gray-400, #9aa0a6); margin-left: 3px; cursor: help; }
.tre-cell--edited::after { content: ""; position: absolute; top: 2px; right: 2px; width: 5px; height: 5px; border-radius: 50%; background: var(--blue-accent); }
.tre-rowlabel { display: flex; align-items: center; gap: 6px; }
.tre-caret { border: none; background: none; cursor: pointer; color: var(--gray-400); font-size: 10px; padding: 0 2px; flex: 0 0 auto; }
.tre-caret:hover { color: var(--gray-700); }
.tre-rowname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; }
.tre-rowtag { flex: 0 0 auto; font-size: 9px; font-weight: 700; background: #e9eafc; color: #5C45A1; border-radius: 3px; padding: 0 4px; }
/* Gasto proyectado sin ninguna factura FG que lo respalde (n_fact == 0). */
.tre-noflag { flex: 0 0 auto; font-size: 9px; font-weight: 700; background: #fdecc8; color: #8a5200; border-radius: 3px; padding: 0 4px; white-space: nowrap; }
/* Eliminar deuda (columna × en la pestaña Deudas). */
.tre-del-btn { border: none; background: none; color: var(--gray-400); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 6px; }
.tre-del-btn:hover { color: #c0392b; }
.tre-rowtotal { flex: 0 0 auto; font-size: 10px; color: var(--gray-500); }
/* Year-total column: the subtotal/saldo rows reuse the .tre-rowlabel flex so
   their total lands in the SAME x as the data rows' (hidden caret + arch spacers
   reserve identical edge space). Emphasize the subtotal grand totals; mute the
   saldo placeholder on the dark row. */
.tre-subtotal .tre-rowtotal { color: var(--gray-700); font-weight: 700; }
.tre-saldo-row .tre-rowtotal { color: rgba(255,255,255,.45); }
.tre-arch { border: none; background: none; color: var(--gray-300); cursor: pointer; font-size: 12px; padding: 0 2px; flex: 0 0 auto; visibility: hidden; }
.tre-row:hover .tre-arch { visibility: visible; }
.tre-arch:hover { color: var(--coral); }
/* Trash for hand-added rows — hidden until row hover, same as the move control. */
.tre-del { border: none; background: none; color: var(--gray-300); cursor: pointer; font-size: 12px; padding: 0 2px; flex: 0 0 auto; visibility: hidden; }
.tre-row:hover .tre-del { visibility: visible; }
.tre-del:hover { color: var(--coral); }
/* Two-step delete confirmation — fixed top-center so the second, deliberate
   action is visually separated from the row where the first click happened. */
.tre-del-banner {
    /* z-index matches .flash-messages--overlay so it clears the fixed top nav
       (the sticky topbar and tab strip sit far below this). */
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    z-index: 9850; max-width: min(560px, 92vw);
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    padding: 12px 16px; background: #fff;
    border: 1px solid var(--coral, #e06955); border-left: 4px solid var(--coral, #e06955);
    border-radius: 6px; box-shadow: 0 8px 28px rgba(0, 0, 0, .18);
    animation: treDelIn .12s ease-out;
}
@keyframes treDelIn { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.tre-del-banner__msg { font-size: 13px; line-height: 1.4; flex: 1 1 260px; }
.tre-del-banner__warn { color: var(--coral, #c0392b); font-weight: 600; }
.tre-del-banner__actions { display: flex; gap: 8px; flex: 0 0 auto; }
.tre-row--archived .tre-rowname { text-decoration: line-through; color: var(--gray-400); }
.tre-addbtn { font-size: 11px; margin-left: 8px; text-transform: none; letter-spacing: 0; }
.tre-detail td { background: var(--gray-25); font-size: 10.5px; color: var(--gray-600); border-bottom: 1px dotted var(--gray-100); padding: 2px 8px; }
.tre-detail__label { padding-left: 26px !important; font-family: var(--font-mono, monospace); }
.tre-detail__cell { color: var(--gray-500); }
.tre-grid-foot { display: flex; align-items: center; gap: 16px; margin-top: 8px; }
.tre-grid-toolbar { display: flex; align-items: center; gap: 10px; margin: 8px 0 0; }
.tre-grid-toolbar input { padding: 6px 12px; border: 1px solid var(--gray-200); border-radius: 8px; font: inherit; font-size: 12.5px; width: 320px; background: var(--white); }
#tre-filter-count { font-size: 12px; }

/* Tesorería · pestañas Recurrentes / No recurrentes — matriz mensual editable.
   Meses pasados y el actual son reales (solo lectura); los futuros se editan. */
.tre-exp-root .tre-grid .tre-matrix__rowlabel { width: 300px; min-width: 300px; max-width: 300px; }
.tre-exp-root .tre-cell--past { cursor: default; color: var(--gray-600); }
.tre-exp-root.tre-grid--editable .tre-cell--past:hover { background: inherit; }
.tre-exp-root.tre-grid--editable .tre-cell--past.tre-col--hoy { cursor: zoom-in; }
.tre-exp-root.tre-grid--editable .tre-cell--past.tre-col--hoy:hover { background: var(--lime-muted); }
.tre-exp-total { margin-left: auto; font-size: 12px; color: var(--gray-700); }

/* ── Inicio for scope-locked (Reporte de Ventas) users ───────────────────────
   Bar row is plain CSS rather than a chart config so this page ships no JS of
   its own. Flat, no tinted panels — accents carry the colour. */
.rvh-bars {
    display: flex; align-items: flex-end; gap: 6px;
    height: 168px; padding: 8px 2px 0;
}
.rvh-bar {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: flex-end; height: 100%; min-width: 0;
}
.rvh-bar-val {
    font-size: 10.5px; color: var(--gray-500); margin-bottom: 3px;
    white-space: nowrap; font-variant-numeric: tabular-nums;
}
.rvh-bar-fill {
    width: 100%; max-width: 46px; background: var(--lime);
    min-height: 2px; transition: height .2s ease;
}
.rvh-bar.is-current .rvh-bar-fill { background: var(--green-dark); }
.rvh-bar.is-current .rvh-bar-val { color: var(--green-dark); font-weight: 700; }
.rvh-bar-lbl {
    font-size: 10.5px; color: var(--gray-500); margin-top: 6px;
    text-transform: uppercase; letter-spacing: .04em;
}

.rvh-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.rvh-card {
    display: block; padding: 18px 20px; background: var(--white);
    border: 1px solid var(--gray-100); border-left: 3px solid var(--lime);
    text-decoration: none; transition: border-color .15s ease, transform .15s ease;
}
.rvh-card:hover { border-left-color: var(--green-dark); transform: translateY(-1px); }
.rvh-card svg { width: 20px; height: 20px; color: var(--green-primary); display: block; margin-bottom: 10px; }
.rvh-card-title { display: block; font-size: 15px; font-weight: 700; color: var(--gray-900); }
.rvh-card-sub { display: block; margin-top: 4px; font-size: 12.5px; color: var(--gray-600); line-height: 1.5; }
@media (max-width: 768px) {
    .rvh-cards { grid-template-columns: 1fr; }
    .rvh-bars { height: 132px; }
    .rvh-bar-val { display: none; }
}

/* ── Section pills: icon-first, name on demand ───────────────────────────────
   The row had grown past the width available and was clipping under the search
   button. Labels now collapse to their icon and expand only for the pill you're
   pointing at (plus the section you're actually in, so you never lose your
   place). Width is animated rather than toggling display, so the row doesn't
   jump — and it degrades to "always shown" if a browser ignores the transition. */
.section-pill .pill-label {
    display: inline-block;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
    vertical-align: middle;
    transition: max-width .22s ease, opacity .16s ease, margin-left .22s ease;
}
.section-pill:hover .pill-label,
.section-pill:focus-visible .pill-label,
.section-pill.is-active .pill-label,
.section-pill[aria-current="page"] .pill-label,
.section-pill-dropdown[open] > .section-pill .pill-label {
    max-width: 220px;
    opacity: 1;
    margin-left: 7px;
}
/* Keyboard users get the same reveal when tabbing through. */
.section-pill:focus-within .pill-label { max-width: 220px; opacity: 1; margin-left: 7px; }
/* The icon carries the meaning while collapsed, so it must not shrink away. */
.section-pill .section-pill-icon { margin-right: 0; flex: 0 0 auto; }
/* Native tooltip as the accessible fallback — set from the label in app.js. */
.section-pill { position: relative; }

@media (max-width: 640px) {
    /* Too narrow for hover to be a real interaction; keep the icons only. */
    .section-pill:hover .pill-label { max-width: 0; opacity: 0; margin-left: 0; }
    .section-pill.is-active .pill-label { max-width: 160px; opacity: 1; margin-left: 6px; }
}

/* Toast for actions that don't navigate (the Nexus ficha editor). Top-center,
   like the other BOps advisories. Lives outside .nexus-root because it is
   appended to <body>, so it must not depend on the panel's scoped tokens. */
.nx-toast {
    position: fixed;
    top: 14px; left: 50%;
    transform: translate(-50%, -14px);
    /* Above the Nexus modals (9997–9999). At 9800 it painted UNDER an open
       modal's backdrop, so every message raised from inside a modal — including
       "completa nombre, documento y email" — was invisible, and the button
       looked dead. */
    z-index: 10050;
    max-width: min(560px, 92vw);
    padding: 11px 20px;
    /* White, not the brand dark-green it used to be: the toast lands at the top
       of the window, which is exactly where the dark brand bar is, so a dark
       card on a dark bar read as part of the chrome instead of as a message.
       A white card with a coloured edge separates from both the bar and the
       page below it. */
    background: #fff;
    color: #1A1C17;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    border: 1px solid #D1D3CE;
    border-left: 4px solid var(--lime);
    box-shadow: 0 10px 30px rgba(0,0,0,.28);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
}
.nx-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.nx-toast.is-bad { border-left-color: #d32f2f; color: #8a1c13; }
.nx-toast.is-ok  { border-left-color: var(--lime); }

/* Nexus · Solicitudes queue action cluster */
.nxq-actions { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.nxq-note { width: 120px; font-size: 11px; padding: 4px 7px; border: 1px solid var(--gray-200); }
.nxq-actions button[disabled] { opacity: .55; cursor: progress; }


/* ── Error pages (templates/error.html) ─────────────────────────────────────
   Left-anchored white type straight on the brand field — no card. An error is
   something to READ, and the white panel that used to sit in the middle boxed
   three sentences into a column narrower than the sentences. Anchoring left
   also keeps the reading column clear of the lime chevrons, which live on the
   right of the same background. */
.err-body { margin: 0; }
.err-field {
    place-items: center start;          /* the field itself is shared with login */
    padding: 40px clamp(24px, 9vw, 140px);
}
.err-panel {
    position: relative; z-index: 2;
    max-width: 560px; width: 100%;
    background: transparent;            /* deliberately: the field shows through */
    color: var(--white);
    animation: cardSlideUp .5s ease-out;
}
.err-logo { height: 30px; width: auto; display: block; margin-bottom: 34px; opacity: .95; }
.err-code {
    font-family: var(--font-mono); font-size: 62px; font-weight: 700;
    line-height: 1; color: var(--lime); letter-spacing: -.03em;
}
.err-title {
    font-size: 27px; font-weight: 800; color: var(--white);
    margin: 12px 0 10px; letter-spacing: -.015em; line-height: 1.2;
}
.err-text {
    font-size: 14.5px; line-height: 1.75; color: rgba(255,255,255,.78);
    margin: 0; max-width: 52ch;
}
.err-hint, .err-back {
    border-left: 2px solid rgba(174,201,17,.55);
    padding: 2px 0 2px 16px; margin: 26px 0 0;
    max-width: 52ch;
}
.err-hint-t, .err-back-t {
    font-size: 10.5px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .1em; color: var(--lime); margin-bottom: 6px;
}
.err-hint-d, .err-back-d {
    font-size: 13px; line-height: 1.7; color: rgba(255,255,255,.66);
}
.err-hint-d b, .err-back-d b { color: rgba(255,255,255,.92); font-weight: 700; }
.err-hint kbd {
    display: inline-block; padding: 1px 7px;
    background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.22);
    border-bottom-width: 2px; border-radius: 3px;
    font: 600 11.5px/1.6 var(--font-mono); color: var(--white); white-space: nowrap;
}
.err-actions {
    margin-top: 32px; display: flex; flex-wrap: wrap;
    align-items: center; gap: 22px;
}
.err-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 26px; background: var(--lime); color: var(--green-dark);
    font-family: var(--font-ui); font-size: 13px; font-weight: 700;
    text-decoration: none; border-radius: 2px;
    transition: transform .12s ease, box-shadow .12s ease;
}
.err-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(0,0,0,.35); }
.err-link {
    font-size: 12.5px; color: rgba(255,255,255,.62);
    text-decoration: underline; text-underline-offset: 3px;
}
.err-link:hover { color: var(--white); }
.err-ref {
    margin-top: 30px; padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,.12);
    font-size: 11px; color: rgba(255,255,255,.42);
}
.err-ref code { font-family: var(--font-mono); color: rgba(255,255,255,.62); }

@media (max-width: 640px) {
    .err-code { font-size: 48px; }
    .err-title { font-size: 22px; }
    .err-logo { margin-bottom: 26px; }
}

/* Tesorería · Deudas — gastos bancarios en tres capas (banco › sub-cuenta ›
   factura). El <details> por banco mantiene la pantalla legible cuando hay
   decenas de facturas, sin esconder que la decisión es una por una. */
.tre-banco { border: 1px solid var(--gray-200, #e5e7eb); border-radius: 6px; margin-bottom: 10px; }
.tre-banco > summary { padding: 8px 12px; cursor: pointer; background: var(--gray-50, #f9fafb); border-radius: 6px; }
.tre-banco[open] > summary { border-bottom: 1px solid var(--gray-200, #e5e7eb); border-radius: 6px 6px 0 0; }
.tre-subcuenta { padding: 8px 12px 12px; }
.tre-subcuenta__head { font-weight: 600; font-size: 13px; margin: 6px 0 4px; }
