/* Estilos de la Torre de Control Contable */

:root {
    --bg-main: #080C14;
    --bg-sidebar: #0B101D;
    --bg-card: rgba(16, 22, 38, 0.65);
    --border-color: rgba(255, 255, 255, 0.06);
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    
    --color-cyan: #06B6D4;
    --color-emerald: #10B981;
    --color-purple: #6366F1;
    --color-orange: #F97316;
    --color-red: #EF4444;
    
    --font-outfit: 'Outfit', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --shadow-neon-cyan: 0 0 15px rgba(6, 182, 212, 0.35);
    --shadow-neon-emerald: 0 0 15px rgba(16, 185, 129, 0.35);
    --shadow-neon-purple: 0 0 15px rgba(99, 102, 241, 0.35);
}

/* ================================================================
   MCP 13 · Libro Caja (Formato 1.1)
   ================================================================ */
body.libro-caja-data-focus .content-header { min-height: 54px; padding-bottom: .55rem; }
body.libro-caja-data-focus .header-title { flex: 0 1 390px; min-width: 320px; }
body.libro-caja-data-focus .header-title h2 { font-size: 1.2rem; line-height: 1.1; }
body.libro-caja-data-focus .header-title p { margin-top: .18rem; font-size: .7rem; line-height: 1.15; }
body.libro-caja-data-focus .view-header-actions { flex: 1 1 auto; max-width: none; display: flex; min-width: 0; }
body.libro-caja-data-focus .compras-header-actions-group,
body.libro-caja-data-focus .libro-bancos-header-actions { display: none !important; }

.libro-caja-header-actions { width: 100%; min-width: 0; }
.libro-caja-header-actions .libro-caja-control-bar {
    width: 100%; margin: 0 !important; background: transparent !important;
    border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
}
.libro-caja-header-actions .libro-caja-controls {
    display: grid !important;
    grid-template-columns: minmax(270px, 1.35fr) auto minmax(170px, .75fr) auto;
    align-items: center !important; gap: .55rem !important; padding: 0 !important;
}
.libro-caja-header-actions .libro-caja-controls label { display: contents; }
.libro-caja-header-actions .libro-caja-controls label > select {
    width: 100% !important; min-width: 0 !important; min-height: 40px;
    padding: .45rem .65rem !important; font-size: .72rem !important; border-radius: 9px !important;
}
.libro-caja-header-actions .libro-caja-controls button {
    min-height: 40px; padding: .45rem .7rem !important; font-size: .74rem !important; white-space: nowrap;
}
.libro-caja-view-stack { display: flex; flex-direction: column; gap: .75rem; width: 100%; }
.cash-position-strip {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    border-bottom: 1px solid var(--border-color); background: rgba(6, 182, 212, .025);
}
.cash-position-strip > * { padding: .55rem .85rem; border-right: 1px solid var(--border-color); }
.cash-position-strip > *:last-child { border-right: 0; }
.cash-position-strip span { display: block; color: var(--text-muted); font-size: .6rem; font-weight: 700; }
.cash-position-strip strong { display: block; margin-top: .12rem; color: var(--text-primary); font-size: .88rem; }
.cash-position-strip > *:first-child strong { color: var(--color-emerald); }
.cash-kpi-action {
    appearance: none; width: 100%; margin: 0; border-top: 0; border-bottom: 0; border-left: 0;
    border-right: 1px solid var(--border-color); border-radius: 0; color: inherit;
    text-align: left; font: inherit; background: rgba(249, 115, 22, .035); cursor: pointer;
    transition: background .18s ease, box-shadow .18s ease;
}
.cash-kpi-action:hover, .cash-kpi-action:focus-visible { background: rgba(249, 115, 22, .1); outline: none; }
.cash-kpi-action strong { color: var(--color-orange); }
.cash-kpi-action small {
    display: block; margin-top: .12rem; color: var(--text-muted); font-size: .5rem;
    font-weight: 700; letter-spacing: .05em;
}
.cash-kpi-action.has-pending { box-shadow: inset 0 -2px 0 rgba(249, 115, 22, .75); }
.cash-kpi-action.has-pending small { color: var(--color-orange); }

.cash-review-tray {
    padding: 1rem; border-bottom: 1px solid rgba(6, 182, 212, .16);
    background: linear-gradient(180deg, rgba(8, 18, 30, .98), rgba(10, 15, 25, .96));
}
.cash-review-tray.hidden { display: none !important; }
.cash-review-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.cash-review-header h3 { margin: .12rem 0 0; font-size: 1rem; color: var(--text-primary); }
.cash-review-header p { margin: .2rem 0 0; max-width: 720px; color: var(--text-secondary); font-size: .68rem; line-height: 1.4; }
.cash-review-eyebrow { color: var(--color-cyan); font-size: .56rem; font-weight: 800; letter-spacing: .09em; }
.cash-review-counters {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem; margin-top: .85rem;
}
.cash-review-counters > div {
    display: flex; align-items: center; justify-content: space-between; gap: .8rem;
    min-height: 38px; padding: .45rem .65rem; border: 1px solid var(--border-color);
    border-radius: 9px; background: rgba(15, 23, 42, .62);
}
.cash-review-counters span { color: var(--text-muted); font-size: .55rem; font-weight: 800; }
.cash-review-counters strong { font: 800 .8rem var(--font-mono); }
.cash-review-counters .is-observed strong { color: var(--color-orange); }
.cash-review-counters .is-ready strong { color: var(--color-cyan); }
.cash-review-counters .is-proposed strong { color: var(--color-emerald); }
.cash-review-status { min-height: 1.2rem; padding-top: .55rem; color: var(--text-secondary); font-size: .65rem; }
.cash-review-status.is-error { color: var(--color-red); }
.cash-review-status.is-success { color: var(--color-emerald); }
.cash-review-list { display: grid; gap: .7rem; max-height: min(58vh, 620px); overflow: auto; padding-right: .18rem; }
.cash-review-card {
    border: 1px solid rgba(148, 163, 184, .13); border-radius: 12px;
    background: rgba(15, 23, 42, .55); overflow: hidden;
}
.cash-review-card.is-observed { border-left: 3px solid var(--color-orange); }
.cash-review-card.is-ready { border-left: 3px solid var(--color-cyan); }
.cash-review-card.is-proposed { border-left: 3px solid var(--color-emerald); }
.cash-review-card-head {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .75rem;
    align-items: start; padding: .72rem .8rem; border-bottom: 1px solid var(--border-color);
}
.cash-review-card-title { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.cash-review-card-title strong { font-size: .8rem; }
.cash-review-card-title small { width: 100%; color: var(--text-muted); font: .56rem var(--font-mono); }
.cash-review-amount { color: var(--text-primary); font: 800 .92rem var(--font-mono); white-space: nowrap; }
.cash-review-badge {
    display: inline-flex; align-items: center; min-height: 21px; padding: .18rem .38rem;
    border-radius: 999px; font-size: .5rem; font-weight: 800; letter-spacing: .04em;
}
.cash-review-badge.is-observed { color: #fdba74; background: rgba(249, 115, 22, .13); }
.cash-review-badge.is-ready { color: #67e8f9; background: rgba(6, 182, 212, .13); }
.cash-review-badge.is-proposed { color: #6ee7b7; background: rgba(16, 185, 129, .13); }
.cash-review-body { padding: .75rem .8rem; }
.cash-review-issues {
    display: grid; gap: .22rem; margin: 0 0 .65rem; padding: .55rem .65rem;
    border-radius: 8px; color: #fed7aa; background: rgba(249, 115, 22, .075); font-size: .64rem;
}
.cash-review-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
.cash-review-fields label { display: grid; gap: .24rem; color: var(--text-muted); font-size: .56rem; font-weight: 700; }
.cash-review-fields .is-wide { grid-column: 1 / -1; }
.cash-review-fields input {
    width: 100%; min-width: 0; min-height: 36px; padding: .42rem .55rem;
    border: 1px solid rgba(148, 163, 184, .15); border-radius: 8px;
    color: var(--text-primary); font: .67rem var(--font-outfit); background: rgba(7, 12, 21, .8);
}
.cash-review-fields input:focus { border-color: rgba(6, 182, 212, .65); outline: none; }
.cash-review-fields input:disabled { opacity: .68; }
.cash-review-evidence {
    display: flex; align-items: center; justify-content: space-between; gap: .6rem;
    margin-top: .65rem; padding-top: .65rem; border-top: 1px solid var(--border-color);
}
.cash-review-evidence-meta { min-width: 0; color: var(--text-secondary); font-size: .62rem; }
.cash-review-evidence-meta strong { display: block; overflow: hidden; color: var(--text-primary); text-overflow: ellipsis; white-space: nowrap; }
.cash-review-evidence-actions, .cash-review-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .45rem; }
.cash-review-evidence-actions input[type="file"] { display: none; }
.cash-review-manual {
    display: flex; align-items: flex-start; gap: .48rem; margin-top: .62rem; padding: .52rem .6rem;
    border: 1px solid rgba(249, 115, 22, .18); border-radius: 8px; color: var(--text-secondary);
    background: rgba(249, 115, 22, .045); font-size: .62rem; line-height: 1.4; cursor: pointer;
}
.cash-review-manual input { flex: 0 0 auto; margin-top: .08rem; accent-color: var(--color-orange); }
.cash-review-actions { margin-top: .65rem; }
.cash-review-actions .btn, .cash-review-evidence-actions .btn { min-height: 34px; padding: .38rem .62rem; font-size: .62rem; }
.cash-review-journal { display: grid; gap: .35rem; margin-top: .6rem; }
.cash-review-journal-line {
    display: grid; grid-template-columns: 48px 86px minmax(0, 1fr); gap: .5rem;
    padding: .42rem .52rem; border-radius: 7px; color: var(--text-secondary);
    background: rgba(7, 12, 21, .72); font-size: .62rem;
}
.cash-review-journal-line b { color: var(--color-cyan); }
.cash-review-rationale { margin-top: .45rem; color: var(--text-secondary); font-size: .62rem; line-height: 1.4; }
.cash-review-empty { padding: 1.4rem; color: var(--text-muted); font-size: .68rem; text-align: center; }
.cash-operation-modal {
    position: fixed; inset: 0; z-index: 1200; display: flex; align-items: center; justify-content: center;
    padding: 1rem; background: rgba(3, 7, 18, .88); backdrop-filter: blur(8px);
}
.cash-operation-modal.hidden { display: none !important; }
.cash-operation-card { width: min(720px, 100%); max-height: calc(100dvh - 2rem); overflow: auto; }
.cash-operation-card .card-header { display: flex; align-items: center; justify-content: space-between; }
.cash-operation-card .card-header h3 { font-size: 1rem; }
.cash-operation-card .card-header p { margin-top: .15rem; color: var(--text-secondary); font-size: .72rem; }
.cash-operation-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; padding: 1rem; }
.cash-operation-form label { display: grid; gap: .3rem; color: var(--text-secondary); font-size: .7rem; font-weight: 700; }
.cash-form-wide, .cash-operation-status, .cash-operation-actions { grid-column: 1 / -1; }
.cash-operation-status { min-height: 1.2rem; color: var(--text-secondary); font-size: .72rem; }
.cash-operation-status.is-error { color: var(--color-red); }
.cash-operation-actions { display: flex; justify-content: flex-end; gap: .6rem; }
.libro-caja-sheet {
    padding: 1rem !important; overflow: visible; color: var(--text-primary);
    background: rgba(8, 12, 20, .6) !important; backdrop-filter: blur(10px);
}
.libro-caja-sheet-meta {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .75rem;
    margin-bottom: .75rem; padding-bottom: .75rem; border-bottom: 1px solid var(--border-color);
    font-family: var(--font-mono); font-size: .7rem; text-transform: uppercase;
}
.libro-caja-sheet-meta span { color: var(--text-secondary); }
.libro-caja-sheet-meta strong { color: var(--text-primary); }
.libro-caja-sheet-meta > div:first-child strong { color: var(--color-cyan); }
.libro-caja-quality strong { color: var(--color-emerald); }
.libro-caja-quality.has-issues strong { color: var(--color-orange); }
.libro-caja-table-wrap {
    width: calc(100% + 2rem) !important; max-width: none !important;
    min-height: 64vh; max-height: calc(100dvh - 190px) !important;
    margin: 0 -1rem -1rem !important; border-radius: 0 0 12px 12px !important;
}
.libro-caja-table { width: 100%; min-width: 1040px !important; border-collapse: collapse; font-size: .75rem; }
.libro-caja-table th, .libro-caja-table td { border: 1px solid var(--border-color); padding: .55rem .65rem; }
.libro-caja-table th { text-align: center; vertical-align: middle; }
.libro-caja-table th:nth-child(3), .libro-caja-table td:nth-child(3),
.libro-caja-table th:nth-child(5), .libro-caja-table td:nth-child(5) { text-align: left; }
.libro-caja-table td:nth-child(6), .libro-caja-table td:nth-child(7) {
    text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums;
}
.libro-caja-table tbody tr:hover { background: rgba(6, 182, 212, .035); }
.libro-caja-table .cash-in { color: var(--color-cyan); font-weight: 700; }
.libro-caja-table .cash-out { color: var(--color-orange); font-weight: 700; }
.libro-caja-table .cash-source { display: block; margin-top: .2rem; color: var(--text-muted); font-size: .62rem; }
.libro-caja-table tfoot { position: sticky; bottom: 0; z-index: 13; background: #0d121f; }
.libro-caja-table tfoot td { padding: .7rem; font-weight: 700; }
.libro-caja-table tfoot td:first-child { text-align: right; }
.libro-caja-table tfoot td:nth-last-child(2) { color: var(--color-cyan); }
.libro-caja-table tfoot td:last-child { color: var(--color-orange); }

@media (min-width: 721px) {
    .libro-caja-control-drawer { display: none !important; }
}

@media (min-width: 721px) and (max-width: 1050px) {
    .libro-caja-header-actions .libro-caja-controls {
        grid-template-columns: minmax(210px, 1fr) auto minmax(150px, .7fr) auto;
    }
    .libro-caja-sheet-meta { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
    body.mobile-data-focus.libro-caja-data-focus .content-header { padding-right: 50px !important; }
    body.mobile-data-focus.libro-caja-data-focus .header-title {
        flex: 0 0 auto !important; min-width: 0 !important; max-width: none !important;
    }
    body.mobile-data-focus.libro-caja-data-focus .header-title h2 {
        overflow: hidden; font-size: clamp(.82rem, 3.9vw, .96rem) !important;
        line-height: 1.08 !important; text-overflow: ellipsis; white-space: nowrap;
    }
    body.mobile-data-focus.libro-caja-data-focus .view-header-actions {
        display: none !important; flex: 0 0 auto !important; padding: 0 !important;
    }
    body.libro-caja-data-focus .mobile-side-config { top: max(10px, env(safe-area-inset-top)); }
    .libro-caja-control-drawer:not([open]) > .libro-caja-control-bar { display: none !important; }
    .libro-caja-control-drawer[open] > .libro-caja-control-bar {
        display: block !important; margin: 0; background: transparent !important;
        border: 0 !important; box-shadow: none !important;
    }
    .libro-caja-control-drawer[open] .libro-caja-controls {
        display: grid !important; grid-template-columns: minmax(0, 1fr) !important;
        gap: .75rem !important; padding: .85rem !important;
    }
    .libro-caja-control-drawer[open] .libro-caja-controls label { display: grid; gap: .35rem; }
    .libro-caja-control-drawer[open] .libro-caja-controls button,
    .libro-caja-control-drawer[open] .libro-caja-controls select { width: 100% !important; min-width: 0 !important; }
    .libro-caja-view-stack { gap: 0 !important; }
    .cash-position-strip { grid-template-columns: repeat(4, minmax(92px, 1fr)); overflow-x: auto; }
    .cash-position-strip > * { padding: .45rem .6rem; }
    .cash-position-strip strong { font-size: .75rem; }
    .cash-kpi-action small { font-size: .46rem; }
    .cash-review-tray { padding: .75rem .7rem; }
    .cash-review-header h3 { font-size: .9rem; }
    .cash-review-header p { font-size: .62rem; }
    .cash-review-counters { grid-template-columns: repeat(3, minmax(92px, 1fr)); overflow-x: auto; }
    .cash-review-counters > div { min-height: 34px; padding: .38rem .48rem; }
    .cash-review-counters span { font-size: .48rem; }
    .cash-review-list { max-height: 64dvh; }
    .cash-review-card-head { padding: .62rem; }
    .cash-review-body { padding: .62rem; }
    .cash-review-fields { grid-template-columns: 1fr; }
    .cash-review-fields .is-wide { grid-column: 1; }
    .cash-review-evidence { align-items: flex-start; flex-direction: column; }
    .cash-review-evidence-actions, .cash-review-actions { width: 100%; }
    .cash-review-actions .btn { flex: 1 1 130px; }
    .cash-review-journal-line { grid-template-columns: 42px 72px minmax(0, 1fr); }
    .cash-operation-modal { align-items: flex-end; padding: 0; }
    .cash-operation-card { width: 100%; max-height: 92dvh; border-radius: 18px 18px 0 0; }
    .cash-operation-form { grid-template-columns: 1fr; }
    .cash-form-wide, .cash-operation-status, .cash-operation-actions { grid-column: 1; }
    .card.libro-caja-sheet {
        width: calc(100% + 2rem) !important; max-width: none !important;
        min-height: 0 !important; height: auto !important; margin: 0 -1rem !important;
        padding: 0 !important; border-left: 0 !important; border-right: 0 !important;
        border-radius: 0 !important;
    }
    .libro-caja-sheet-meta {
        min-height: 42px; display: flex !important; flex-wrap: nowrap; align-items: center;
        gap: .8rem !important; margin: 0 !important; padding: .5rem 1rem !important;
        overflow-x: auto; border-bottom: 1px solid rgba(148, 163, 184, .1) !important;
        scrollbar-width: none;
    }
    .libro-caja-sheet-meta::-webkit-scrollbar { display: none; }
    .libro-caja-sheet-meta > div { flex: 0 0 auto; white-space: nowrap; font-size: .64rem; }
    .libro-caja-table-wrap {
        width: 100% !important; min-height: calc(100dvh - 158px) !important;
        max-height: calc(100dvh - 158px) !important; margin: 0 !important;
        border-radius: 0 !important;
    }
    .libro-caja-table { min-width: 920px !important; }
}

/* ================================================================
   Espacio operativo: navegación superior y datos como protagonistas
   ================================================================ */
.mcp-context-bar { display: grid !important; }

.secondary-controls {
    width: 100%;
    color: var(--text-primary);
    background: rgba(13, 18, 31, .72);
    border: 1px solid rgba(148, 163, 184, .12);
    border-radius: 13px;
    overflow: hidden;
}
.secondary-controls > summary {
    min-height: 52px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: .8rem;
    padding: .75rem 1rem;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.secondary-controls > summary::-webkit-details-marker { display: none; }
.secondary-controls-title { display: inline-flex; align-items: center; gap: .55rem; font-size: .88rem; font-weight: 700; }
.secondary-controls-title svg { width: 17px; height: 17px; color: var(--color-cyan); }
.secondary-controls > summary small { color: var(--text-muted); font-size: .73rem; }
.secondary-controls-chevron { width: 17px; height: 17px; color: var(--text-secondary); transition: transform .2s ease; }
.secondary-controls[open] .secondary-controls-chevron { transform: rotate(180deg); }
.secondary-controls[open] > summary { border-bottom: 1px solid var(--border-color); background: rgba(255,255,255,.018); }
.secondary-controls-grid { padding: 1rem; }

#view-compras-container > div,
#view-bancos-container > div,
#view-libro-bancos-container > div { gap: .8rem !important; }

.operational-table-card { min-height: calc(100dvh - 240px); overflow: hidden; }
.operational-table-card > .card-header { padding: .85rem 1rem !important; min-height: 58px; }
.operational-table-card .card-body { padding: 0 !important; }
.operational-data-scroll {
    width: 100% !important;
    min-height: 500px;
    max-height: calc(100dvh - 275px) !important;
    overflow: auto !important;
    border-left: 0 !important;
    border-right: 0 !important;
    border-bottom: 0 !important;
    border-radius: 0 !important;
    overscroll-behavior: contain;
}
.operational-data-table { min-width: 1120px; }
.operational-data-table thead th { position: sticky !important; top: 0; z-index: 12 !important; background: #0d121f !important; }
.operational-data-table tbody tr { height: 52px; }
.bank-data-filters { flex: 1 1 540px; justify-content: flex-end; }
.bank-company-filter-slot { flex: 1 1 330px; max-width: 440px; }
.bank-company-filter-slot select { width: 100% !important; min-width: 260px; min-height: 40px; padding: .45rem .65rem !important; }
.bank-company-config .form-group > label { color: var(--text-muted) !important; }
.compact-control-bar .card-body { padding: .8rem 1rem !important; }

@media (min-width: 721px) {
    .app-container { display: block; min-height: 100vh; }
    .sidebar {
        position: sticky;
        top: 0;
        z-index: 1000;
        width: 100%;
        height: 72px;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 1.25rem;
        padding: .7rem clamp(1rem, 2vw, 2rem);
        background: rgba(11, 16, 29, .96);
        border-right: 0;
        border-bottom: 1px solid rgba(148, 163, 184, .12);
        box-shadow: 0 12px 30px rgba(0, 0, 0, .22);
        backdrop-filter: blur(18px);
    }
    .brand { flex: 0 0 auto; margin: 0; gap: .6rem; }
    .brand-icon { width: 38px; height: 38px; border-radius: 10px; box-shadow: none; }
    .brand-text { display: block !important; }
    .brand-text h1 { font-size: .95rem; line-height: 1.05; white-space: nowrap; }
    .brand-text span { display: block; margin-top: 2px; font-size: .62rem; white-space: nowrap; }
    .nav-menu { min-width: 0; display: flex; flex-direction: row; align-items: center; gap: .45rem; flex: 1 1 auto; }
    .nav-primary { min-width: 0; display: flex; align-items: center; gap: .25rem; }
    .sidebar .nav-item {
        min-height: 42px;
        display: inline-flex;
        justify-content: center;
        gap: .45rem;
        padding: .55rem .72rem;
        border: 1px solid transparent;
        border-radius: 10px;
        font-size: .82rem;
        white-space: nowrap;
    }
    .sidebar .nav-item span { display: inline !important; }
    .sidebar .nav-item.active {
        color: var(--color-cyan);
        background: rgba(6, 182, 212, .1);
        border: 1px solid rgba(6, 182, 212, .18);
        box-shadow: inset 0 -2px 0 var(--color-cyan);
    }
    .desktop-tools-menu { position: relative; flex: 0 0 auto; }
    .desktop-tools-menu > summary {
        min-height: 42px;
        display: inline-flex;
        align-items: center;
        gap: .45rem;
        padding: .55rem .72rem;
        color: var(--text-secondary);
        font-size: .82rem;
        font-weight: 600;
        cursor: pointer;
        list-style: none;
        background: rgba(255,255,255,.025);
        border: 1px solid var(--border-color);
        border-radius: 10px;
    }
    .desktop-tools-menu > summary::-webkit-details-marker { display: none; }
    .desktop-tools-menu > summary svg { width: 17px; height: 17px; }
    .desktop-tools-menu .tools-chevron { width: 14px; height: 14px; transition: transform .2s ease; }
    .desktop-tools-menu[open] .tools-chevron { transform: rotate(180deg); }
    .desktop-tools-grid {
        position: absolute;
        top: calc(100% + 12px);
        right: 0;
        width: min(680px, calc(100vw - 2rem));
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .35rem;
        padding: .7rem;
        background: #101727;
        border: 1px solid rgba(148, 163, 184, .16);
        border-radius: 14px;
        box-shadow: 0 24px 60px rgba(0,0,0,.5);
    }
    .desktop-tools-grid .nav-item { justify-content: flex-start; width: 100%; }
    .server-status-card {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        padding: .48rem .65rem;
        background: rgba(16,185,129,.045);
        border-color: rgba(16,185,129,.13);
    }
    .server-status-card .status-indicator-group { margin: 0; }
    .server-status-card .status-text { font-size: .72rem; white-space: nowrap; }
    .server-status-card .server-meta { display: none; }
    .main-content {
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 1.1rem clamp(1rem, 2vw, 2rem) 2rem;
        gap: .9rem;
    }
    .content-header { min-height: 60px; padding-bottom: .7rem; }
    .header-title h2 { font-size: 1.55rem; }
    .header-title p { margin-top: .12rem; font-size: .82rem; }
    .view-section { gap: .8rem; }
}

@media (min-width: 721px) and (max-width: 1080px) {
    .brand-text span { display: none; }
    .sidebar .nav-primary .nav-item span { display: none !important; }
    .sidebar .nav-primary .nav-item { width: 42px; padding: .5rem; }
    .server-status-card { display: none; }
}

@media (max-width: 720px) {
    .mcp-context-bar { display: none !important; }
    .secondary-controls > summary { grid-template-columns: minmax(0, 1fr) auto; min-height: 50px; padding: .7rem .85rem; }
    .secondary-controls > summary small { display: none; }
    .secondary-controls-grid { padding: .75rem; }
    .operational-table-card {
        width: calc(100% + 2rem) !important;
        margin-left: -1rem;
        margin-right: -1rem;
        min-height: calc(100dvh - 220px);
        border-left: 0 !important;
        border-right: 0 !important;
        border-radius: 0 !important;
    }
    .operational-table-card > .card-header { padding: .85rem 1rem !important; }
    .operational-data-scroll { min-height: 56vh; max-height: calc(100dvh - 235px) !important; }
    .bank-data-filters { display: grid !important; grid-template-columns: 1fr; width: 100%; }
    .bank-company-filter-slot { width: 100%; max-width: none; }
    .bank-company-filter-slot select { min-width: 0; min-height: 46px; }
    .bank-data-filters input { width: 100% !important; max-width: none !important; min-height: 46px; }
    .compact-control-bar .card-body { display: grid !important; grid-template-columns: 1fr !important; align-items: stretch !important; }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-outfit);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scrollbar personalizado */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Layout General */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.5rem;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.brand-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(6, 182, 212, 0.2));
    border: 1px solid var(--color-cyan);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-neon-cyan);
}

.neon-icon {
    color: var(--color-cyan);
    width: 22px;
    height: 22px;
}

.brand-text h1 {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

.brand-text span {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.25s ease;
}

.nav-item i {
    width: 18px;
    height: 18px;
}

.nav-item:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
    color: var(--color-cyan);
    background-color: rgba(6, 182, 212, 0.08);
    border-left: 3px solid var(--color-cyan);
    font-weight: 500;
}

.server-status-card {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 10px;
}

.status-indicator-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.status-text {
    font-size: 0.85rem;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.pulse-green {
    background-color: var(--color-emerald);
    box-shadow: 0 0 8px var(--color-emerald);
    animation: pulse 2s infinite;
}

.server-meta small {
    display: block;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.mobile-bottom-nav,
.mobile-more-sheet,
.mobile-more-backdrop {
    display: none;
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Header */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.25rem;
}

.header-title { flex: 1 1 420px; min-width: 260px; }
.view-header-actions {
    flex: 1 1 680px;
    min-width: 0;
    max-width: 760px;
}
.view-header-actions.hidden { display: none !important; }
.header-title p:empty { display: none !important; }

.compras-header-config {
    flex: 0 0 auto;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .45rem .7rem;
    color: var(--text-primary);
    font-family: var(--font-outfit);
    font-size: .76rem;
    font-weight: 700;
    background: rgba(6, 182, 212, .08);
    border: 1px solid rgba(6, 182, 212, .24);
    border-radius: 9px;
    cursor: pointer;
    white-space: nowrap;
}
.compras-header-config:hover,
.compras-header-config[aria-expanded="true"] { color: var(--color-cyan); background: rgba(6, 182, 212, .13); }
.compras-header-config svg { width: 15px; height: 15px; }
.compras-header-config-chevron { transition: transform .2s ease; }
.compras-header-config[aria-expanded="true"] .compras-header-config-chevron { transform: rotate(180deg); }

body.compras-data-focus .content-header { min-height: 48px; padding-bottom: .55rem; }
body.compras-data-focus .header-title { flex: 0 0 auto; min-width: 58px; }
body.compras-data-focus .header-title h2 { font-size: 1.35rem; line-height: 1; letter-spacing: .02em; }
body.compras-data-focus .view-header-actions {
    flex: 1 1 auto;
    max-width: none;
    display: flex;
    align-items: center;
    gap: .55rem;
}
body.compras-data-focus .compras-filter-bar { flex: 1 1 auto; min-width: 0; }
.compras-header-actions-group { width: 100%; min-width: 0; display: flex; align-items: center; gap: .55rem; }

body.libro-bancos-data-focus .content-header { min-height: 54px; padding-bottom: .55rem; }
body.libro-bancos-data-focus .header-title { flex: 0 1 370px; min-width: 320px; }
body.libro-bancos-data-focus .header-title h2 { font-size: 1.2rem; line-height: 1.1; letter-spacing: .005em; }
body.libro-bancos-data-focus .header-title p { margin-top: .18rem; font-size: .7rem; line-height: 1.15; letter-spacing: .035em; }
body.libro-bancos-data-focus .view-header-actions { flex: 1 1 auto; max-width: none; display: flex; min-width: 0; }
body.libro-bancos-data-focus .compras-header-actions-group { display: none !important; }
.libro-bancos-header-actions { width: 100%; min-width: 0; }
.libro-bancos-header-actions .libro-control-bar {
    width: 100%;
    margin: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}
.libro-bancos-header-actions .libro-control-bar .card-body {
    display: grid !important;
    grid-template-columns: minmax(270px, 1.35fr) auto minmax(170px, .75fr) auto;
    align-items: center !important;
    gap: .55rem !important;
    padding: 0 !important;
}
.libro-bancos-header-actions .libro-control-bar .card-body > div { display: contents !important; }
.libro-bancos-header-actions .libro-control-bar .card-body > div > div { min-width: 0; display: block !important; }
.libro-bancos-header-actions .libro-control-bar label { display: none !important; }
.libro-bancos-header-actions .libro-control-bar select {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 40px;
    padding: .45rem .65rem !important;
    font-size: .72rem !important;
    border-radius: 9px !important;
}
.libro-bancos-header-actions .libro-control-bar button {
    min-height: 40px;
    padding: .45rem .7rem !important;
    font-size: .74rem !important;
    white-space: nowrap;
}
body.libro-bancos-data-focus .libro-bancos-sheet { padding: .75rem 1rem 1rem !important; }
body.libro-bancos-data-focus .libro-bancos-sheet-meta {
    margin-bottom: .55rem !important;
    padding-bottom: .65rem !important;
}
body.libro-bancos-data-focus #libro-bancos-tabla-wrapper {
    min-height: 68vh;
    max-height: calc(100dvh - 190px) !important;
    margin-top: 0 !important;
}
.libro-bancos-row { transition: background-color .16s ease; }
.libro-bancos-row:hover { background: rgba(255, 255, 255, .025); }
.libro-bancos-row-match { background: rgba(16, 185, 129, .04); }
.libro-bancos-row-match:hover { background: rgba(16, 185, 129, .08); }
.libro-bancos-progress-row td {
    padding: .65rem 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: .72rem;
    letter-spacing: .02em;
    background: rgba(6, 182, 212, .035);
}

@media (min-width: 721px) {
    #view-compras-container { position: relative; }
    body.compras-data-focus #view-compras-container > div { gap: 0 !important; }
    #compras-secondary-controls {
        position: absolute;
        top: 0;
        right: 0;
        z-index: 220;
        width: min(1080px, calc(100vw - 4rem));
        height: 0;
        min-height: 0;
        overflow: visible;
        background: transparent;
        border: 0;
        border-radius: 0;
    }
    #compras-secondary-controls > summary { display: none !important; }
    #compras-secondary-controls:not([open]) > .secondary-controls-grid { display: none !important; }
    #compras-secondary-controls[open] > .secondary-controls-grid {
        position: absolute;
        top: .45rem;
        right: 0;
        width: 100%;
        display: grid !important;
        padding: 1rem;
        background: rgba(13, 20, 34, .985);
        border: 1px solid rgba(6, 182, 212, .2);
        border-radius: 16px;
        box-shadow: 0 22px 60px rgba(0, 0, 0, .52);
        backdrop-filter: blur(18px);
    }
    body.compras-data-focus #compras-tabla-wrapper {
        min-height: 70vh;
        max-height: calc(100dvh - 132px) !important;
    }
    .libro-control-drawer { display: none !important; }
}

@media (min-width: 721px) and (max-width: 1000px) {
    .libro-bancos-header-actions .libro-control-bar .card-body {
        grid-template-columns: minmax(220px, 1fr) auto minmax(155px, .7fr) auto;
    }
    .libro-bancos-header-actions .libro-control-bar button span { display: none; }
    .libro-bancos-header-actions .libro-control-bar button { min-width: 42px; padding-inline: .55rem !important; }
}

.mcp-context-bar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.15rem;
    background: linear-gradient(110deg, rgba(6, 182, 212, .09), rgba(99, 102, 241, .045));
    border: 1px solid rgba(6, 182, 212, .14);
    border-radius: 16px;
}

.mcp-context-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    color: var(--color-cyan);
    background: rgba(6, 182, 212, .1);
    border: 1px solid rgba(6, 182, 212, .2);
    border-radius: 13px;
}

.mcp-context-icon svg { width: 23px; height: 23px; }
.mcp-context-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mcp-context-eyebrow { display: flex; align-items: center; gap: 7px; color: var(--color-cyan); font-size: .68rem; font-weight: 700; letter-spacing: .08em; }
.mcp-live-dot { width: 7px; height: 7px; flex: 0 0 auto; background: var(--color-emerald); border-radius: 50%; box-shadow: 0 0 9px rgba(16, 185, 129, .75); }
.mcp-context-copy strong { font-size: .98rem; line-height: 1.3; }
.mcp-context-copy > span { color: var(--text-secondary); font-size: .78rem; line-height: 1.35; }
.mcp-context-operation { display: flex; align-items: center; justify-content: flex-end; gap: .85rem; min-width: 390px; }
.mcp-context-last { min-width: 0; display: grid; justify-items: end; gap: .12rem; text-align: right; }
.mcp-context-last small { color: var(--text-muted); font-size: .61rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.mcp-context-last strong { max-width: 350px; overflow: hidden; color: var(--text-primary); font-size: .76rem; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.mcp-context-last span { max-width: 350px; overflow: hidden; color: var(--text-secondary); font: 600 .67rem var(--font-mono); text-overflow: ellipsis; white-space: nowrap; }
.mcp-context-trace-button { min-height: 40px; flex: 0 0 auto; padding: .55rem .8rem; border-color: rgba(6, 182, 212, .24); }
.mcp-context-trace-button svg { width: 16px; height: 16px; color: var(--color-cyan); }
.mcp-context-trace-button.is-loading svg { animation: spin 1s linear infinite; }

.compras-filter-bar { width: 100%; display: flex; align-items: center; justify-content: flex-end; gap: .55rem; }
.compras-filter-bar .form-control {
    min-height: 40px;
    padding: .45rem .65rem;
    font-size: .78rem;
    background: rgba(255,255,255,.03);
    border: 1px solid var(--border-color);
    border-radius: 9px;
    color: var(--text-primary);
}
.compras-filter-search { flex: 1 1 210px; min-width: 170px; }
.compras-filter-select { flex: 0 1 175px; min-width: 145px; cursor: pointer; }
.compras-filter-company { flex: 0 1 320px; min-width: 260px; max-width: 340px; }
.compras-filter-period { flex-basis: 150px; }
.compras-filter-toggle {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .65rem;
    color: var(--text-secondary);
    font-size: .76rem;
    font-weight: 600;
    background: rgba(255,255,255,.03);
    border: 1px solid var(--border-color);
    border-radius: 9px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.compras-filter-toggle input { width: 17px; height: 17px; margin: 0; accent-color: var(--color-cyan); cursor: pointer; }
.compras-table-card { border-top-color: rgba(6, 182, 212, .13); }
#compras-tabla-wrapper { min-height: 64vh; max-height: calc(100dvh - 172px) !important; }

.header-title h2 {
    font-size: 1.75rem;
    font-weight: 600;
}

.header-title p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.6rem 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-cyan), var(--color-purple));
    color: #fff;
    box-shadow: var(--shadow-neon-cyan);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.5);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.btn-icon {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
}

.btn-icon:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

.btn-block {
    width: 100%;
}

/* Consola de Skills: distribución adaptable y controles táctiles */
.skills-console-layout {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(0, 1.5fr);
    gap: 1.5rem;
    min-height: 380px;
}

.skills-console-controls {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
    border-right: 1px solid var(--border-color);
    padding-right: 1.5rem;
}

.skill-action {
    min-width: 0;
    padding: 0 0 1.25rem;
}

.skill-action + .skill-action {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 1.25rem;
}

.skill-action-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.65rem;
}

.skill-company-fields {
    display: grid;
    gap: 0.65rem;
    margin-bottom: 0.65rem;
}

.skill-action-button {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    padding: 0.7rem 1rem;
    font-size: 0.85rem;
    line-height: 1.2;
    white-space: normal;
    text-align: center;
}

.skill-action-button svg {
    flex: 0 0 auto;
}

.skill-action-button-compact {
    width: auto;
}

.skills-console-terminal {
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
}

/* Stats Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-4px);
}

.stat-icon-wrapper {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon-wrapper i {
    width: 24px;
    height: 24px;
}

.stat-icon-wrapper.cyan {
    background-color: rgba(6, 182, 212, 0.08);
    border: 1px solid rgba(6, 182, 212, 0.2);
    color: var(--color-cyan);
}

.stat-icon-wrapper.emerald {
    background-color: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--color-emerald);
}

.stat-icon-wrapper.purple {
    background-color: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: var(--color-purple);
}

.stat-icon-wrapper.orange {
    background-color: rgba(249, 115, 22, 0.08);
    border: 1px solid rgba(249, 115, 22, 0.2);
    color: var(--color-orange);
}

.stat-content h3 {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.85rem;
    font-weight: 700;
    margin: 0.25rem 0;
}

.stat-description {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Card Contenedores */
.card {
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.01);
}

.card-header-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-header-title i {
    width: 20px;
    height: 20px;
    color: var(--color-cyan);
}

.card-header-title h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
    flex-grow: 1;
}

/* Grid del Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 1.5rem;
}

/* Formularios */
.form-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

input[type="text"], input[type="password"], select {
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 0.7rem 0.9rem;
    font-size: 0.9rem;
    font-family: var(--font-outfit);
    outline: none;
    transition: all 0.2s ease;
}

input:focus, select:focus {
    border-color: var(--color-cyan);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.15);
}

/* Switch Checkbox */
.checkbox-group {
    margin-top: 0.25rem;
}

.switch-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.switch-label input {
    display: none;
}

.switch-custom {
    width: 42px;
    height: 22px;
    background-color: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    position: relative;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.switch-custom::after {
    content: '';
    width: 16px;
    height: 16px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.switch-label input:checked + .switch-custom {
    background-color: rgba(6, 182, 212, 0.2);
    border-color: var(--color-cyan);
}

.switch-label input:checked + .switch-custom::after {
    left: 22px;
    background-color: var(--color-cyan);
    box-shadow: 0 0 8px var(--color-cyan);
}

.switch-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Consola de Terminal */
.terminal-body {
    padding: 0;
    background-color: #03060b;
    position: relative;
}

.terminal-screen {
    padding: 1.25rem;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.6;
    overflow-y: auto;
    height: 340px;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.terminal-line {
    word-break: break-all;
    white-space: pre-wrap;
}

.terminal-line.system-msg {
    color: var(--color-purple);
}

.terminal-line.info-msg {
    color: var(--color-cyan);
}

.terminal-line.success-msg {
    color: var(--color-emerald);
    font-weight: 500;
}

.terminal-line.error-msg {
    color: var(--color-red);
    font-weight: 500;
}

/* Badges */
.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

#badge-running-state {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

#badge-running-state.running {
    background-color: rgba(249, 115, 22, 0.15);
    color: var(--color-orange);
    border: 1px solid rgba(249, 115, 22, 0.3);
    animation: glow-pulse-orange 1.5s infinite alternate;
}

/* Tabla de Descargas */
.table-card {
    margin-top: 1.5rem;
}

.table-container {
    overflow-x: auto;
    width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.data-table th, .data-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-weight: 600;
    color: var(--text-secondary);
    background-color: rgba(255, 255, 255, 0.015);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr {
    transition: all 0.2s ease;
}

.data-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.01);
}

.td-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem !important;
}

.period-badge {
    background-color: rgba(6, 182, 212, 0.1);
    color: var(--color-cyan);
    border: 1px solid rgba(6, 182, 212, 0.2);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.8rem;
}

/* Animaciones */
@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Instalación PWA: acceso visible, privado y compatible con PC/iOS/Android. */
.pwa-install-button {
    position: fixed;
    right: 1.15rem;
    bottom: 1.15rem;
    z-index: 1280;
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    min-height: 46px;
    padding: .72rem 1rem;
    color: #041018;
    background: linear-gradient(135deg, #22d3ee, #06b6d4);
    border: 1px solid rgba(103, 232, 249, .7);
    border-radius: 14px;
    box-shadow: 0 14px 34px rgba(6, 182, 212, .28), inset 0 1px rgba(255,255,255,.35);
    font: 700 .84rem/1 "Outfit", sans-serif;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
}
.pwa-install-button:hover { transform: translateY(-2px); box-shadow: 0 18px 42px rgba(6,182,212,.34); }
.pwa-install-button svg { width: 18px; height: 18px; stroke-width: 2.4; }
.pwa-install-button[hidden], .pwa-install-overlay[hidden] { display: none !important; }

.pwa-install-overlay {
    position: fixed;
    inset: 0;
    z-index: 1500;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background: rgba(2, 6, 12, .76);
    backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity .18s ease;
}
.pwa-install-overlay.open { opacity: 1; }
.pwa-install-card {
    width: min(560px, 100%);
    overflow: hidden;
    color: #e8f5fb;
    background: linear-gradient(155deg, #0d1727, #070c15 74%);
    border: 1px solid rgba(34, 211, 238, .22);
    border-radius: 24px;
    box-shadow: 0 28px 90px rgba(0,0,0,.55);
    transform: translateY(14px) scale(.985);
    transition: transform .18s ease;
}
.pwa-install-overlay.open .pwa-install-card { transform: translateY(0) scale(1); }
.pwa-install-header {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) 40px;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.3rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, .12);
}
.pwa-install-header img { border-radius: 16px; box-shadow: 0 10px 25px rgba(0,0,0,.35); }
.pwa-install-header small { color: #22d3ee; font-size: .68rem; font-weight: 800; letter-spacing: .12em; }
.pwa-install-header h2 { margin: .18rem 0 0; font-size: 1.42rem; line-height: 1.12; }
.pwa-install-close {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    color: #94a3b8;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(148,163,184,.14);
    border-radius: 12px;
    cursor: pointer;
}
.pwa-install-close svg { width: 18px; }
.pwa-install-body { padding: 1.15rem 1.3rem; }
.pwa-platform-badge {
    display: inline-flex;
    padding: .35rem .62rem;
    color: #a5f3fc;
    background: rgba(6,182,212,.1);
    border: 1px solid rgba(34,211,238,.2);
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
}
.pwa-install-body > p { margin: .8rem 0; color: #b5c3d4; line-height: 1.5; }
.pwa-install-steps { display: grid; gap: .66rem; margin: .9rem 0 1.05rem; padding: 0; list-style: none; counter-reset: pwa-step; }
.pwa-install-steps li {
    position: relative;
    min-height: 34px;
    padding: .42rem .5rem .42rem 2.8rem;
    color: #dbe8f0;
    line-height: 1.42;
    counter-increment: pwa-step;
}
.pwa-install-steps li::before {
    content: counter(pwa-step);
    position: absolute;
    left: 0;
    top: .25rem;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    color: #061019;
    background: #22d3ee;
    border-radius: 10px;
    font-size: .78rem;
    font-weight: 900;
}
.pwa-install-address { padding: .75rem; background: rgba(255,255,255,.025); border: 1px solid rgba(148,163,184,.13); border-radius: 13px; }
.pwa-install-address > span { display: block; margin-bottom: .45rem; color: #7f91a6; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.pwa-install-address > div { display: flex; align-items: center; gap: .5rem; }
.pwa-install-address code { min-width: 0; flex: 1; overflow: hidden; color: #67e8f9; font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.pwa-install-address button { display: grid; place-items: center; width: 34px; height: 34px; color: #a5f3fc; background: rgba(6,182,212,.1); border: 0; border-radius: 9px; cursor: pointer; }
.pwa-install-address button.copied { color: #052e24; background: #34d399; }
.pwa-install-address button svg { width: 16px; }
.pwa-install-note { display: flex; align-items: flex-start; gap: .55rem; margin-bottom: 0 !important; font-size: .78rem; }
.pwa-install-note svg { flex: 0 0 17px; width: 17px; color: #34d399; }
.pwa-install-footer { display: flex; justify-content: flex-end; gap: .7rem; padding: 1rem 1.3rem 1.2rem; background: rgba(0,0,0,.14); border-top: 1px solid rgba(148,163,184,.1); }
.pwa-install-footer .btn { min-height: 42px; }

@media (max-width: 720px) {
    .pwa-install-button {
        right: .8rem;
        bottom: calc(84px + env(safe-area-inset-bottom));
        min-height: 44px;
        border-radius: 13px;
    }
    .pwa-install-overlay { place-items: end center; padding: 0; }
    .pwa-install-card { width: 100%; max-height: min(88dvh, 760px); overflow-y: auto; border-radius: 24px 24px 0 0; }
    .pwa-install-header { position: sticky; top: 0; z-index: 2; grid-template-columns: 54px minmax(0, 1fr) 40px; padding: 1rem; background: rgba(10,18,30,.96); backdrop-filter: blur(14px); }
    .pwa-install-header img { width: 54px; height: 54px; border-radius: 14px; }
    .pwa-install-header h2 { font-size: 1.18rem; }
    .pwa-install-body { padding: 1rem; }
    .pwa-install-footer { position: sticky; bottom: 0; padding: .8rem 1rem calc(.8rem + env(safe-area-inset-bottom)); background: rgba(7,12,21,.96); backdrop-filter: blur(14px); }
    .pwa-install-footer .btn { flex: 1; }
}

@keyframes glow-pulse-orange {
    from {
        box-shadow: 0 0 4px rgba(249, 115, 22, 0.2);
    }
    to {
        box-shadow: 0 0 12px rgba(249, 115, 22, 0.5);
    }
}

/* Diseño Móvil Responsivo */
@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 1.25rem;
    }
    .brand {
        margin-bottom: 1rem;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .skills-console-layout {
        grid-template-columns: 1fr;
    }
    .skills-console-controls {
        border-right: 0;
        border-bottom: 1px solid var(--border-color);
        padding-right: 0;
        padding-bottom: 0.25rem;
    }
}

/* Clases de Soporte para la Cola y Gestión Multi-empresa */
.badge.pending {
    background-color: rgba(245, 158, 11, 0.1);
    color: #F59E0B;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge.running {
    background-color: rgba(99, 102, 241, 0.1);
    color: #6366F1;
    border: 1px solid rgba(99, 102, 241, 0.25);
    animation: glow-pulse-blue 1.5s infinite alternate;
}

.badge.completed {
    background-color: rgba(16, 185, 129, 0.1);
    color: #10B981;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge.failed {
    background-color: rgba(239, 68, 68, 0.1);
    color: #EF4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.disabled {
    cursor: not-allowed;
    opacity: 0.6;
    pointer-events: none;
}

.animate-spin {
    animation: spin 1.5s linear infinite;
    display: inline-block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes glow-pulse-blue {
    from { box-shadow: 0 0 4px rgba(99, 102, 241, 0.2); }
    to { box-shadow: 0 0 10px rgba(99, 102, 241, 0.4); }
}

/* Estilos de botones de acción en tablas */
.btn-action-edit {
    color: var(--color-cyan);
}
.btn-action-edit:hover {
    background-color: rgba(6, 182, 212, 0.1) !important;
}

.btn-action-delete {
    color: var(--color-red);
}
.btn-action-delete:hover {
    background-color: rgba(239, 68, 68, 0.1) !important;
}

.btn-action-sync {
    color: var(--color-emerald);
}
.btn-action-sync:hover {
    background-color: rgba(16, 185, 129, 0.1) !important;
}

.view-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Libro Bancos: la planilla ocupa todo el ancho disponible de su tarjeta. */
.libro-bancos-sheet {
    overflow: visible;
}

.libro-bancos-fullbleed-table {
    width: calc(100% + 5rem) !important;
    max-width: none !important;
    margin-left: -2.5rem !important;
    margin-right: -2.5rem !important;
    margin-bottom: -2.5rem;
    border-left: 0 !important;
    border-right: 0 !important;
    border-bottom: 0 !important;
    border-radius: 0 0 12px 12px !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.libro-bancos-fullbleed-table table {
    min-width: 1260px !important;
}

.hidden {
    display: none !important;
}

/* Forzar visualización correcta de los select options en navegadores de Windows */
select option {
    background-color: #0d121f !important;
    color: #ffffff !important;
}

/* PWA instalable y navegación táctil */
html, body { overscroll-behavior: none; }
button, a, input, select { touch-action: manipulation; }
body.mobile-menu-open { overflow: hidden; }

@media (max-width: 1100px) {
    .app-container { grid-template-columns: 82px minmax(0, 1fr); }
    .sidebar .brand-text, .sidebar .nav-item span { display: none; }
    .sidebar .nav-item { justify-content: center; }
}

@media (min-width: 721px) and (max-width: 1180px) {
    .content-header:has(.view-header-actions:not(.hidden)) {
        flex-wrap: wrap;
        align-items: flex-start;
    }
    .content-header:has(.view-header-actions:not(.hidden)) .header-title { flex-basis: 100%; }
    .view-header-actions { width: 100%; max-width: none; }
}

@media (max-width: 720px) {
    .app-container { display: block; }
    .sidebar { display: none; }
    .main-content { padding: 1.25rem 1rem calc(106px + env(safe-area-inset-bottom)); gap: 1.5rem; }
    .content-header { flex-direction: column; align-items: stretch; gap: .6rem; }
    .header-title { flex: 0 0 auto; min-width: 0; }
    .view-header-actions { flex: 0 0 auto; width: 100%; max-width: none; }
    .header-title h2 { font-size: 1.85rem; line-height: 1.15; }
    .header-title p { font-size: .95rem; line-height: 1.45; }
    .mcp-context-bar {
        grid-template-columns: auto minmax(0, 1fr);
        gap: .8rem;
        padding: .85rem;
        border-radius: 15px;
    }
    .mcp-context-icon { width: 42px; height: 42px; border-radius: 12px; }
    .mcp-context-copy strong { font-size: .91rem; }
    .mcp-context-copy > span { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: .75rem; }
    .mcp-context-operation { grid-column: 1 / -1; min-width: 0; justify-content: stretch; }
    .mcp-context-last { min-width: 0; justify-items: start; text-align: left; }
    .mcp-context-last strong,
    .mcp-context-last span { max-width: 100%; }
    .mcp-context-trace-button { margin-left: auto; }
    .view-section { gap: 1rem; min-width: 0; }
    .card.libro-bancos-sheet {
        width: calc(100% + 2rem) !important;
        max-width: none !important;
        margin-left: -1rem;
        margin-right: -1rem;
        padding: 1.25rem 0 0 !important;
        border-left: 0 !important;
        border-right: 0 !important;
        border-radius: 0 !important;
    }
    .libro-bancos-sheet-title,
    .libro-bancos-sheet-meta {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    .libro-bancos-sheet-title {
        font-size: .92rem !important;
        line-height: 1.35;
        margin-bottom: 1.25rem !important;
    }
    .libro-bancos-sheet-meta {
        margin-bottom: .5rem !important;
        padding-bottom: 1rem !important;
        font-size: .73rem !important;
    }
    .libro-bancos-fullbleed-table {
        width: 100% !important;
        max-width: 100% !important;
        margin: .5rem 0 0 !important;
        max-height: calc(100dvh - 170px) !important;
        border-radius: 0 !important;
    }
    .compras-filter-bar { display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .65rem !important; }
    .compras-filter-search { grid-column: 1 / -1; max-width: none !important; min-height: 48px; }
    .compras-filter-select { width: 100%; min-width: 0; max-width: none !important; min-height: 48px; }
    .compras-filter-toggle { grid-column: 1 / -1; justify-content: flex-start; min-height: 46px; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
    .stat-card { min-width: 0; min-height: 154px; padding: 1rem; flex-direction: column; align-items: flex-start; gap: .75rem; border-radius: 17px; }
    .stat-icon-wrapper { width: 42px; height: 42px; border-radius: 11px; }
    .stat-icon-wrapper i { width: 21px; height: 21px; }
    .stat-content { min-width: 0; width: 100%; }
    .stat-content h3 { font-size: .68rem; line-height: 1.25; letter-spacing: .04em; overflow-wrap: anywhere; }
    .stat-value { margin: .18rem 0; font-size: 1.45rem; line-height: 1.05; overflow-wrap: anywhere; }
    .stat-description { font-size: .69rem; line-height: 1.25; }
    .card { max-width: 100% !important; border-radius: 18px; }
    .card-header { padding: 1rem !important; align-items: flex-start !important; gap: .75rem; }
    .card-header-title { min-width: 0; align-items: flex-start; }
    .card-header-title h3 { font-size: 1rem; line-height: 1.3; overflow-wrap: anywhere; }
    .card-body { min-width: 0; padding: 1rem !important; }
    .dashboard-grid { gap: 1rem; }
    .form-grid { gap: 1rem; margin-bottom: 1rem; }
    .form-row-2 { grid-template-columns: 1fr; gap: .8rem; }
    .form-group { min-width: 0; }
    input[type="text"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
        width: 100%;
        min-width: 0;
        min-height: 48px;
        font-size: .9rem !important;
    }
    .form-grid .btn, .card-body > .btn, .card-body > form > .btn { width: 100%; min-height: 48px; }
    .view-section [style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; }
    .view-section [style*="display: flex"] { max-width: 100%; }
    .table-card { position: relative; }
    .table-container, [id$="tabla-wrapper"], [id$="table-wrapper"] {
        max-width: 100%;
        overflow-x: auto !important;
        overscroll-behavior-inline: contain;
        scrollbar-width: thin;
        border-radius: 0 0 16px 16px;
    }
    .table-container::before, [id$="tabla-wrapper"]::before, [id$="table-wrapper"]::before {
        content: "Desliza para explorar la tabla →";
        position: sticky;
        left: 0;
        display: block;
        width: max-content;
        padding: .55rem 1rem;
        color: var(--text-muted);
        font-size: .7rem;
        font-weight: 600;
        letter-spacing: .02em;
    }
    table { min-width: 680px; }
    th, td { padding: .7rem .75rem !important; font-size: .75rem; }
    .badge { white-space: nowrap; }
    .mobile-bottom-nav {
        position: fixed;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1100;
        min-height: 78px;
        padding: 8px 6px calc(7px + env(safe-area-inset-bottom));
        background: rgba(13, 18, 31, .96);
        border-top: 1px solid rgba(148, 163, 184, .16);
        box-shadow: 0 -14px 34px rgba(0, 0, 0, .42);
        backdrop-filter: blur(20px);
    }
    .mobile-nav-item {
        position: relative;
        min-width: 0;
        min-height: 58px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 5px 2px;
        color: #7f8ca2;
        background: transparent;
        border: 0;
        border-radius: 14px;
        font-family: var(--font-outfit);
        transition: color .2s ease, background .2s ease, transform .2s ease;
    }
    .mobile-nav-item svg { width: 22px; height: 22px; stroke-width: 2; }
    .mobile-nav-item span { max-width: 100%; font-size: .67rem; font-weight: 600; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .mobile-nav-item.active {
        color: var(--color-cyan);
        background: linear-gradient(180deg, rgba(6, 182, 212, .16), rgba(6, 182, 212, .06));
    }
    .mobile-nav-item.active::before {
        content: "";
        position: absolute;
        top: 0;
        width: 28px;
        height: 3px;
        border-radius: 0 0 6px 6px;
        background: var(--color-cyan);
        box-shadow: 0 0 12px rgba(6, 182, 212, .8);
    }
    .mobile-nav-item:active { transform: scale(.94); }
    .mobile-more-backdrop {
        position: fixed;
        display: block;
        inset: 0;
        z-index: 1150;
        background: rgba(2, 6, 15, .7);
        backdrop-filter: blur(4px);
    }
    .mobile-more-backdrop[hidden] { display: none; }
    .mobile-more-sheet {
        position: fixed;
        display: block;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1200;
        max-height: min(78vh, 620px);
        padding: 8px 18px calc(24px + env(safe-area-inset-bottom));
        overflow-y: auto;
        color: var(--text-primary);
        background: #101727;
        border: 1px solid rgba(148, 163, 184, .14);
        border-radius: 26px 26px 0 0;
        box-shadow: 0 -24px 60px rgba(0, 0, 0, .55);
        transform: translateY(105%);
        visibility: hidden;
        transition: transform .25s ease, visibility .25s ease;
    }
    .mobile-more-sheet.open { transform: translateY(0); visibility: visible; }
    .mobile-more-handle { width: 42px; height: 4px; margin: 0 auto 14px; border-radius: 999px; background: #3c475c; }
    .mobile-more-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
    .mobile-more-header small { color: var(--color-cyan); font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
    .mobile-more-header h3 { margin-top: 2px; font-size: 1.35rem; }
    .mobile-more-close { width: 44px; height: 44px; display: grid; place-items: center; color: var(--text-primary); background: rgba(255,255,255,.06); border: 1px solid var(--border-color); border-radius: 50%; }
    .mobile-more-close svg { width: 20px; height: 20px; }
    .mobile-more-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
    .mobile-tool-item {
        min-width: 0;
        min-height: 94px;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: space-between;
        gap: 10px;
        padding: 15px 12px;
        color: var(--text-primary);
        text-align: left;
        font-family: var(--font-outfit);
        background: rgba(255, 255, 255, .045);
        border: 1px solid rgba(148, 163, 184, .1);
        border-radius: 16px;
    }
    .mobile-tool-item svg { width: 23px; height: 23px; color: var(--color-cyan); }
    .mobile-tool-item span { font-size: .78rem; font-weight: 600; line-height: 1.15; overflow-wrap: anywhere; }
    #pwa-install { bottom: calc(90px + env(safe-area-inset-bottom)) !important; }
    table { min-width: 760px; }
    .skills-console-card {
        border-radius: 20px;
        overflow: hidden;
    }
    .skills-console-card .card-header {
        padding: 1.15rem 1rem;
    }
    .skills-console-card .card-header-title {
        align-items: flex-start;
    }
    .skills-console-card .card-header-title h3 {
        font-size: 1.05rem;
        line-height: 1.3;
    }
    .skills-console-layout {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 1.25rem !important;
        min-height: 0 !important;
        padding: 1rem !important;
    }
    .skill-action {
        padding-bottom: 1rem;
    }
    .skill-action + .skill-action {
        padding-top: 1rem;
    }
    .skill-action h4 {
        font-size: 0.95rem !important;
        line-height: 1.35;
    }
    .skill-action p {
        font-size: 0.82rem !important;
        line-height: 1.5 !important;
    }
    .skill-action-row {
        grid-template-columns: 1fr;
    }
    .skill-action .form-control {
        width: 100%;
        min-width: 0;
        min-height: 48px;
        padding: 0.7rem 0.8rem !important;
        font-size: 0.9rem !important;
    }
    .skill-action-button,
    .skill-action-button-compact {
        width: 100%;
        min-height: 50px;
        padding: 0.75rem 1rem !important;
        font-size: 0.9rem !important;
        border-radius: 10px;
    }
    .skills-console-terminal #skill-consola-output {
        min-height: 220px !important;
        max-height: 320px !important;
        padding: 0.85rem !important;
        overflow-wrap: anywhere;
    }
}

/* Overrides finales: la barra superior sustituye definitivamente al sidebar. */
@media (min-width: 721px) {
    .app-container { display: block !important; min-height: 100vh; }
    .sidebar {
        position: sticky !important;
        inset: 0 auto auto 0;
        z-index: 1000;
        width: 100% !important;
        height: 72px !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 1.25rem !important;
        padding: .7rem clamp(1rem, 2vw, 2rem) !important;
        background: rgba(11, 16, 29, .96) !important;
        border: 0 !important;
        border-bottom: 1px solid rgba(148, 163, 184, .12) !important;
    }
    .sidebar .brand { margin: 0 !important; }
    .sidebar .nav-menu { display: flex !important; flex-direction: row !important; align-items: center !important; }
    .sidebar .nav-primary { display: flex !important; flex-direction: row !important; align-items: center !important; }
    .sidebar .server-status-card { margin: 0 !important; }
    .main-content {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 1.1rem clamp(1rem, 2vw, 2rem) 2rem !important;
        gap: .9rem !important;
    }
    .content-header { min-height: 60px; padding-bottom: .7rem; }
    .view-section { gap: .8rem !important; }
}

@media (max-width: 720px) {
    .sidebar { display: none !important; }
}

/* Libro Bancos: la identidad del libro se mantiene visible sin desplazar los datos. */
@media (min-width: 1101px) {
    .libro-bancos-sheet { padding: 1rem !important; }
    .libro-bancos-sheet-title {
        margin-bottom: .75rem !important;
        font-size: .95rem !important;
        text-decoration: none !important;
    }
    .libro-bancos-sheet-meta {
        grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
        gap: .75rem !important;
        margin-bottom: .75rem !important;
        padding-bottom: .75rem !important;
        font-size: .72rem !important;
    }
    .libro-bancos-fullbleed-table {
        width: calc(100% + 2rem) !important;
        margin: 0 -1rem -1rem !important;
    }
}

@media (min-width: 721px) and (max-width: 1100px) {
    .libro-bancos-sheet { padding: 1rem !important; }
    .libro-bancos-sheet-title { margin-bottom: .75rem !important; }
    .libro-bancos-sheet-meta {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        margin-bottom: .75rem !important;
        padding-bottom: .75rem !important;
    }
    .libro-bancos-fullbleed-table {
        width: calc(100% + 2rem) !important;
        margin: 0 -1rem -1rem !important;
    }
}

@media (max-width: 720px) {
    .libro-control-bar .card-body {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: .7rem !important;
        padding: .8rem !important;
    }
    .libro-control-bar .card-body > div { display: contents !important; }
    .libro-control-bar .card-body > div > div {
        min-width: 0;
        display: flex !important;
        flex-direction: column;
        align-items: stretch !important;
        gap: .3rem !important;
    }
    .libro-control-bar label { font-size: .66rem !important; }
    .libro-control-bar select {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 42px;
        font-size: .68rem !important;
    }
    .libro-control-bar button {
        width: 100%;
        min-width: 0;
        min-height: 42px;
        align-self: end;
        justify-content: center;
        padding: .55rem .45rem !important;
        font-size: .72rem !important;
    }
    .view-section .libro-bancos-sheet-meta {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: .55rem .75rem !important;
        margin-bottom: .5rem !important;
        padding-bottom: .75rem !important;
    }
    .view-section .libro-bancos-sheet-meta > div:last-child { grid-column: 1 / -1; }
}

/* Gobierno de identidad y acceso */
.auth-login-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background:
        radial-gradient(circle at 20% 10%, rgba(6, 182, 212, .14), transparent 34%),
        radial-gradient(circle at 80% 90%, rgba(16, 185, 129, .09), transparent 32%),
        #070b14;
    transition: opacity .22s ease, visibility .22s ease;
}
.auth-login-overlay.authenticated { opacity: 0; visibility: hidden; pointer-events: none; }
.auth-login-card {
    width: min(420px, 100%);
    display: grid;
    gap: 1rem;
    padding: clamp(1.4rem, 4vw, 2.2rem);
    border: 1px solid rgba(34, 211, 238, .18);
    border-radius: 24px;
    background: rgba(13, 18, 31, .94);
    box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
}
.auth-login-brand { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 15px; color: var(--color-cyan); background: rgba(6, 182, 212, .1); border: 1px solid rgba(6, 182, 212, .25); }
.auth-login-brand svg { width: 27px; height: 27px; }
.auth-login-kicker { color: var(--color-cyan); font-size: .7rem; font-weight: 800; letter-spacing: .12em; }
.auth-login-card h1 { margin: -.35rem 0 0; font-size: 2rem; }
.auth-login-card p { margin: -.45rem 0 .25rem; color: var(--text-secondary); line-height: 1.5; }
.auth-login-card label { display: grid; gap: .4rem; color: var(--text-secondary); font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.auth-login-card input { min-height: 50px; padding: .75rem .9rem; color: var(--text-primary); background: #0a0f1b; border: 1px solid var(--border-color); border-radius: 11px; font: inherit; text-transform: none; }
.auth-login-card input:focus { outline: 0; border-color: var(--color-cyan); box-shadow: 0 0 0 3px rgba(6, 182, 212, .1); }
.auth-login-card button { min-height: 50px; justify-content: center; }
.auth-login-status { min-height: 1.1rem; color: #fb7185; font-size: .78rem; }

.auth-user-chip { display: flex; align-items: center; gap: .55rem; margin-left: auto; min-width: 0; }
.auth-user-avatar { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; color: var(--color-cyan); background: rgba(6, 182, 212, .1); border: 1px solid rgba(6, 182, 212, .2); font-size: .68rem; font-weight: 800; }
.auth-user-copy { min-width: 0; display: grid; line-height: 1.1; }
.auth-user-copy strong { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .75rem; }
.auth-user-copy small { color: var(--text-secondary); font-size: .62rem; text-transform: uppercase; }
.auth-user-chip button { width: 34px; height: 34px; display: grid; place-items: center; color: var(--text-secondary); background: rgba(255,255,255,.03); border: 1px solid var(--border-color); border-radius: 9px; cursor: pointer; }
.auth-user-chip button:hover { color: #fff; border-color: rgba(6, 182, 212, .35); }
.auth-user-chip svg { width: 15px; height: 15px; }

.mcp-monitor-card { overflow: hidden; }
.mcp-monitor-card > summary { list-style: none; cursor: pointer; }
.mcp-monitor-card > summary::-webkit-details-marker { display: none; }
.mcp-monitor-summary .card-header-title small { display: block; margin-top: .2rem; color: var(--text-secondary); font-size: .72rem; font-weight: 400; }
.mcp-monitor-summary-status { display: flex; align-items: center; gap: .75rem; color: var(--text-secondary); font: 700 .72rem var(--font-mono); letter-spacing: .04em; }
.mcp-monitor-summary-status svg { width: 17px; height: 17px; transition: transform .2s ease; }
.mcp-monitor-card[open] .mcp-monitor-summary-status svg { transform: rotate(180deg); }
.mcp-monitor-actions { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; }
.mcp-monitor-actions .btn { min-height: 28px; padding: .25rem .45rem; font-size: .68rem; border-radius: 6px; }
.mcp-monitor-actions svg { width: 12px; height: 12px; }

.compras-amount-cell {
    text-align: right;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: .82rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    color: var(--text-primary);
}
.compras-amount-other { color: var(--color-orange); }
.compras-amount-total { color: #f8fafc; font-size: .82rem; font-weight: 700; }
.compras-totals-row td {
    position: sticky;
    bottom: 0;
    z-index: 11;
    height: 62px;
    padding: .7rem .85rem !important;
    background: #0a101c !important;
    border-top: 1px solid rgba(6, 182, 212, .3) !important;
    box-shadow: 0 -10px 24px rgba(0, 0, 0, .28);
}
.compras-totals-label { text-align: left; }
.compras-totals-label strong { display: block; color: var(--text-primary); font-size: .8rem; }
.compras-totals-label small { display: block; margin-top: .18rem; color: var(--text-secondary); font-size: .67rem; font-weight: 500; }
.compras-totals-value {
    text-align: right;
    white-space: nowrap;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: .82rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.compras-totals-other { color: var(--color-orange) !important; }
.compras-totals-grand { color: var(--color-emerald) !important; }
.compras-totals-scope { text-align: center; color: var(--text-muted); font-size: .65rem; font-weight: 600; }

.access-overview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .85rem; }
.access-kpi { display: flex; align-items: center; gap: .9rem; min-height: 84px; padding: 1rem 1.15rem; border: 1px solid var(--border-color); border-radius: 15px; background: rgba(13, 18, 31, .72); }
.access-kpi > svg { width: 25px; height: 25px; color: var(--color-cyan); }
.access-kpi > div { display: grid; }
.access-kpi small { color: var(--text-secondary); font-size: .7rem; }
.access-kpi strong { font-size: 1.25rem; }
.access-admin-layout { display: grid; grid-template-columns: minmax(320px, .62fr) minmax(0, 1.38fr); gap: 1rem; align-items: start; }
.access-user-form { position: sticky; top: 88px; }
.access-form-body { display: grid; gap: .85rem; }
.access-form-body > label { display: grid; gap: .35rem; color: var(--text-secondary); font-size: .72rem; font-weight: 700; }
.access-form-body .form-control { width: 100%; min-height: 44px; }
.access-switches { display: flex; gap: 1rem; padding: .2rem 0; }
.access-switches label, .access-all-toggle { display: flex; align-items: center; gap: .45rem; font-size: .75rem; color: var(--text-secondary); cursor: pointer; }
.access-companies-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-top: .4rem; border-top: 1px solid rgba(148,163,184,.1); }
.access-companies-heading > div { display: grid; }
.access-companies-heading strong { font-size: .8rem; }
.access-companies-heading small { color: var(--text-secondary); font-size: .67rem; }
.access-company-list { display: grid; gap: .5rem; max-height: 230px; overflow-y: auto; padding-right: .2rem; }
.access-company-option { display: flex; align-items: center; gap: .65rem; padding: .65rem .7rem; border: 1px solid rgba(148,163,184,.1); border-radius: 10px; background: rgba(255,255,255,.018); cursor: pointer; }
.access-company-option > span { min-width: 0; display: grid; }
.access-company-option strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .72rem; }
.access-company-option small { color: var(--text-secondary); font: .65rem var(--font-mono); }
.access-form-actions { display: flex; justify-content: flex-end; gap: .65rem; }
.access-form-status { min-height: 1rem; color: var(--color-orange); font-size: .72rem; }
.access-users-card { min-width: 0; }
.access-users-table-wrap { max-height: calc(100dvh - 255px); overflow: auto; }
.access-users-table { min-width: 820px; }
.access-users-table thead th { position: sticky; top: 0; z-index: 2; background: #0d121f; }
.access-user-identity { display: flex; align-items: center; gap: .65rem; }
.access-user-identity > span { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 9px; color: var(--color-cyan); background: rgba(6,182,212,.08); font-size: .65rem; font-weight: 800; }
.access-user-identity > div { min-width: 0; display: grid; }
.access-user-identity strong { font-size: .78rem; }
.access-user-identity small { color: var(--text-secondary); font-size: .66rem; }
.access-role-badge, .access-state, .access-company-chip, .access-scope-all, .access-scope-none { display: inline-flex; padding: .28rem .5rem; border-radius: 999px; font-size: .65rem; font-weight: 700; }
.access-role-badge { color: #cbd5e1; background: rgba(148,163,184,.08); border: 1px solid rgba(148,163,184,.12); }
.access-role-badge.role-admin { color: #67e8f9; background: rgba(6,182,212,.09); border-color: rgba(6,182,212,.2); }
.access-role-badge.role-accountant { color: #6ee7b7; background: rgba(16,185,129,.08); border-color: rgba(16,185,129,.18); }
.access-company-chips { display: flex; flex-wrap: wrap; gap: .35rem; max-width: 420px; }
.access-company-chip { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #cbd5e1; background: rgba(255,255,255,.035); border: 1px solid rgba(148,163,184,.1); }
.access-scope-all { color: var(--color-cyan); background: rgba(6,182,212,.08); }
.access-scope-none { color: #fb7185; background: rgba(244,63,94,.08); }
.access-state.active { color: #6ee7b7; background: rgba(16,185,129,.09); }
.access-state.inactive { color: #fda4af; background: rgba(244,63,94,.09); }
.access-row-actions { display: flex; justify-content: center; gap: .4rem; }
.access-row-actions button { width: 34px; height: 34px; padding: 0 !important; display: grid; place-items: center; }
.access-row-actions svg { width: 14px; height: 14px; }

@media (max-width: 1400px) and (min-width: 721px) {
    .sidebar {
        gap: .65rem !important;
        padding-inline: 1rem !important;
    }
    .brand-text span { display: none; }
    .nav-menu { gap: .2rem !important; }
    .sidebar .nav-item,
    .desktop-tools-menu > summary {
        gap: .35rem;
        padding-inline: .58rem;
        font-size: .76rem;
    }
    .auth-user-copy { display: none; }
    .server-status-card { display: none !important; }
}

@media (max-width: 1220px) and (min-width: 721px) {
    .sidebar .nav-primary .nav-item span { display: none !important; }
    .sidebar .nav-primary .nav-item { width: 42px; padding-inline: .5rem; }
}

@media (max-width: 820px) {
    .access-overview-grid { grid-template-columns: 1fr; }
    .access-admin-layout { grid-template-columns: 1fr; }
    .access-user-form { position: static; }
    .access-users-card { width: calc(100% + 2rem) !important; margin-left: -1rem; margin-right: -1rem; border-left: 0; border-right: 0; border-radius: 0; }
    .access-users-table-wrap { max-height: 62dvh; }
    .mcp-monitor-summary { align-items: flex-start !important; gap: .75rem; }
    .mcp-monitor-summary-status span { display: none; }
}

/* ================================================================
   Modo seguimiento movil: datos primero y configuracion lateral
   ================================================================ */
@media (min-width: 721px) {
    .libro-control-drawer > summary { display: none !important; }
    .libro-control-drawer > .libro-control-bar { display: block !important; }
}

@media (max-width: 720px) {
    body:has(.mobile-side-config[open]) { overflow: hidden; }

    body.compras-data-focus .compras-header-config { display: none !important; }
    /*
       Libro Bancos en celular: la base flexible de escritorio (370px) se
       transformaba en altura al apilar la cabecera y dejaba un gran vacio.
       La cabecera vuelve a medir solo lo que ocupa su contenido.
    */
    body.mobile-data-focus.libro-bancos-data-focus .content-header {
        padding-right: 50px !important;
    }
    body.mobile-data-focus.libro-bancos-data-focus .header-title {
        flex: 0 0 auto !important;
        min-width: 0 !important;
        max-width: none !important;
    }
    body.mobile-data-focus.libro-bancos-data-focus .header-title h2 {
        overflow: hidden;
        font-size: clamp(.82rem, 3.9vw, .96rem) !important;
        line-height: 1.08 !important;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    body.mobile-data-focus.libro-bancos-data-focus .view-header-actions {
        display: none !important;
        flex: 0 0 auto !important;
        padding: 0 !important;
    }
    body.mobile-data-focus .main-content {
        padding: .55rem 1rem calc(92px + env(safe-area-inset-bottom)) !important;
        gap: .35rem !important;
    }
    body.mobile-data-focus .content-header {
        min-height: 0 !important;
        flex-direction: column;
        align-items: stretch;
        gap: .45rem;
        padding: .2rem 0 .55rem !important;
        border-bottom-color: rgba(148, 163, 184, .08);
    }
    body.mobile-data-focus .view-header-actions { padding-right: 42px; }
    body.mobile-data-focus .header-title h2 {
        font-size: 1.28rem !important;
        line-height: 1.12 !important;
        letter-spacing: -.015em;
    }
    body.mobile-data-focus .header-title p { display: none !important; }
    body.mobile-data-focus .view-section { gap: 0 !important; }
    body.mobile-data-focus .view-section > div { gap: 0 !important; }

    .mobile-side-config {
        position: fixed !important;
        top: 76px;
        right: 0;
        z-index: 1240;
        width: 46px !important;
        max-width: none !important;
        color: var(--text-primary);
        background: linear-gradient(180deg, rgba(6, 182, 212, .96), rgba(8, 145, 178, .96)) !important;
        border: 1px solid rgba(103, 232, 249, .35) !important;
        border-right: 0 !important;
        border-radius: 14px 0 0 14px !important;
        overflow: visible !important;
        box-shadow: 0 12px 32px rgba(0, 0, 0, .38), 0 0 18px rgba(6, 182, 212, .18);
    }
    body.libro-bancos-data-focus .mobile-side-config {
        top: max(10px, env(safe-area-inset-top));
    }
    .mobile-side-config > summary {
        width: 46px;
        min-height: 50px;
        display: flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0;
        padding: .45rem !important;
        color: #031018;
        border: 0 !important;
        background: transparent !important;
    }
    .mobile-side-config > summary .secondary-controls-title {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: .35rem;
        font-size: 0;
    }
    .mobile-side-config > summary .secondary-controls-title::after {
        display: none;
    }
    .mobile-side-config > summary .secondary-controls-title svg {
        width: 19px;
        height: 19px;
        color: #031018 !important;
    }
    .mobile-side-config > summary small,
    .mobile-side-config > summary .secondary-controls-chevron { display: none !important; }

    .mobile-side-config[open] {
        top: max(10px, env(safe-area-inset-top));
        right: 0;
        bottom: calc(86px + env(safe-area-inset-bottom));
        width: min(88vw, 390px) !important;
        height: auto;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        overscroll-behavior: contain;
        background: #0d1422 !important;
        border-color: rgba(103, 232, 249, .22) !important;
        border-radius: 22px 0 0 22px !important;
        box-shadow: -100vw 0 0 100vw rgba(2, 6, 15, .72), -24px 0 60px rgba(0, 0, 0, .52);
    }
    .mobile-side-config[open] > summary {
        position: sticky;
        top: 0;
        z-index: 3;
        width: 100%;
        min-height: 58px;
        flex-direction: row;
        justify-content: space-between;
        padding: .85rem 1rem !important;
        color: var(--text-primary);
        background: rgba(13, 20, 34, .97) !important;
        border-bottom: 1px solid rgba(148, 163, 184, .12) !important;
        backdrop-filter: blur(16px);
    }
    .mobile-side-config[open] > summary .secondary-controls-title {
        flex-direction: row;
        justify-content: flex-start;
        font-size: .9rem;
        text-align: left;
    }
    .mobile-side-config[open] > summary .secondary-controls-title::after { display: none; }
    .mobile-side-config[open] > summary .secondary-controls-title svg { color: var(--color-cyan) !important; }
    .mobile-side-config[open] > summary .secondary-controls-chevron {
        display: block !important;
        flex: 0 0 auto;
        color: var(--text-secondary);
        transform: rotate(-90deg);
    }
    .mobile-side-config[open] > .secondary-controls-grid {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: .75rem !important;
        padding: .75rem !important;
    }
    .mobile-side-config[open] .card {
        border-radius: 15px !important;
        background: rgba(255, 255, 255, .025) !important;
    }
    .mobile-side-config[open] .card-header { padding: .85rem !important; }
    .mobile-side-config[open] .card-body { padding: .85rem !important; }

    .libro-control-drawer:not([open]) > .libro-control-bar { display: none !important; }
    .libro-control-drawer[open] > .libro-control-bar {
        display: block !important;
        margin: 0;
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
    }
    .libro-control-drawer[open] .libro-control-bar .card-body {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: .75rem !important;
        padding: .85rem !important;
    }
    .libro-control-drawer[open] .libro-control-bar button,
    .libro-control-drawer[open] .libro-control-bar select { width: 100% !important; min-width: 0 !important; }

    body.mobile-data-focus .operational-table-card {
        width: calc(100% + 2rem) !important;
        max-width: none !important;
        min-height: calc(100dvh - 142px) !important;
        margin-top: 0 !important;
        border-top: 1px solid rgba(148, 163, 184, .1) !important;
    }
    body.mobile-data-focus .operational-table-card > .card-header {
        min-height: 88px !important;
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: .45rem !important;
        padding: .55rem .75rem !important;
    }
    body.mobile-data-focus .operational-table-card .card-header-title {
        min-height: 28px;
        align-items: center !important;
    }
    body.mobile-data-focus .operational-table-card .card-header-title svg { width: 17px; height: 17px; }
    body.mobile-data-focus .operational-table-card .card-header-title h3 {
        overflow: hidden;
        font-size: .82rem !important;
        line-height: 1.1 !important;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    body.mobile-data-focus .compras-filter-bar,
    body.mobile-data-focus .bank-data-filters {
        width: 100%;
        max-width: 100%;
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center;
        justify-content: flex-start;
        gap: .45rem !important;
        padding: 0 0 .2rem;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        scrollbar-width: none;
    }
    body.mobile-data-focus .compras-filter-bar::-webkit-scrollbar,
    body.mobile-data-focus .bank-data-filters::-webkit-scrollbar { display: none; }
    body.mobile-data-focus .compras-filter-search {
        grid-column: auto;
        flex: 0 0 180px;
        max-width: 180px !important;
        min-height: 42px;
    }
    body.mobile-data-focus .compras-filter-select {
        flex: 0 0 165px;
        width: 165px !important;
        min-height: 42px;
    }
    body.mobile-data-focus .compras-filter-toggle {
        grid-column: auto;
        flex: 0 0 auto;
        min-height: 42px;
        padding: 0 .7rem;
        white-space: nowrap;
        background: rgba(255,255,255,.03);
        border: 1px solid var(--border-color);
        border-radius: 9px;
    }
    body.mobile-data-focus .bank-company-filter-slot {
        flex: 0 0 220px;
        width: 220px;
        max-width: 220px;
    }
    body.mobile-data-focus .bank-company-filter-slot select {
        width: 220px !important;
        min-width: 220px !important;
        min-height: 42px;
    }
    body.mobile-data-focus .bank-data-filters input {
        flex: 0 0 180px;
        width: 180px !important;
        max-width: 180px !important;
        min-height: 42px;
    }
    body.mobile-data-focus .operational-data-scroll {
        min-height: calc(100dvh - 248px) !important;
        max-height: calc(100dvh - 248px) !important;
    }
    body.mobile-data-focus #compras-tabla-wrapper {
        min-height: calc(100dvh - 188px) !important;
        max-height: calc(100dvh - 188px) !important;
    }

    body.mobile-data-focus .card.libro-bancos-sheet {
        min-height: 0 !important;
        height: auto !important;
        justify-content: flex-start !important;
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
    body.mobile-data-focus .libro-bancos-sheet-title { display: none !important; }
    body.mobile-data-focus .libro-bancos-sheet-meta {
        min-height: 42px;
        display: flex !important;
        grid-template-columns: none !important;
        flex-wrap: nowrap;
        align-items: center;
        gap: .8rem !important;
        margin: 0 !important;
        padding: .5rem 1rem !important;
        overflow-x: auto;
        border-bottom: 1px solid rgba(148, 163, 184, .1) !important;
        scrollbar-width: none;
    }
    body.mobile-data-focus .libro-bancos-sheet-meta::-webkit-scrollbar { display: none; }
    body.mobile-data-focus .libro-bancos-sheet-meta > div {
        flex: 0 0 auto;
        grid-column: auto !important;
        white-space: nowrap;
        font-size: .64rem;
    }
    body.mobile-data-focus #libro-bancos-tabla-wrapper {
        min-height: calc(100dvh - 158px) !important;
        max-height: calc(100dvh - 158px) !important;
        margin-top: 0 !important;
        scroll-padding-top: 72px;
    }
}

/* Prioridad final del layout MCP 13 frente a las reglas operativas globales. */
@media (min-width: 721px) {
    body.libro-caja-data-focus .libro-caja-table-wrap {
        min-height: 64vh !important;
        max-height: calc(100dvh - 190px) !important;
    }
}

@media (max-width: 720px) {
    body.mobile-data-focus.libro-caja-data-focus .libro-caja-table-wrap {
        min-height: calc(100dvh - 158px) !important;
        max-height: calc(100dvh - 158px) !important;
    }
}

/* Diagnóstico operativo: estado legible, avance y evidencia visual por empresa. */
.company-operation-flows {
    min-width: 430px;
    display: grid;
    grid-template-columns: repeat(2, minmax(195px, 1fr));
    gap: .55rem;
}

.company-operation-status {
    min-width: 210px;
    display: grid;
    gap: .35rem;
    align-content: start;
    padding: .65rem;
    border: 1px solid rgba(148, 163, 184, .12);
    border-radius: 10px;
    background: rgba(15, 23, 42, .36);
}

.operation-flow-title {
    color: var(--color-cyan);
    font-size: .67rem;
    font-weight: 800;
    letter-spacing: .055em;
    line-height: 1.2;
    text-transform: uppercase;
}

.company-operation-status .badge {
    width: fit-content;
    min-width: 94px;
    justify-content: center;
}

.company-operation-status .badge.running {
    color: var(--color-cyan);
    border-color: rgba(6, 182, 212, .34);
    background: rgba(6, 182, 212, .10);
}

.company-operation-status .badge.retrying {
    color: #f59e0b;
    border-color: rgba(245, 158, 11, .34);
    background: rgba(245, 158, 11, .10);
}

.operation-stage {
    max-width: 260px;
    overflow: hidden;
    color: var(--text-primary);
    font-size: .75rem;
    font-weight: 700;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.operation-code {
    max-width: 260px;
    color: #fb7185;
    font-size: .69rem;
    font-weight: 700;
    line-height: 1.25;
}

.operation-explanation {
    max-width: 320px;
    color: var(--text-secondary);
    font-size: .66rem;
    line-height: 1.35;
}

.operation-sunat-live {
    min-width: 0;
    display: grid;
    grid-template-columns: 9px minmax(0, 1fr);
    gap: .45rem;
    align-items: start;
    padding: .5rem;
    border: 1px solid rgba(6, 182, 212, .16);
    border-radius: 8px;
    background: rgba(6, 182, 212, .045);
}

.operation-sunat-dot {
    width: 8px;
    height: 8px;
    margin-top: .22rem;
    border-radius: 50%;
    background: #64748b;
}

.operation-sunat-live.is-live .operation-sunat-dot {
    background: var(--color-emerald);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, .11);
    animation: sunat-live-pulse 1.4s ease-in-out infinite;
}

@keyframes sunat-live-pulse {
    50% { opacity: .45; transform: scale(.78); }
}

.operation-sunat-live div {
    min-width: 0;
    display: grid;
    gap: .16rem;
}

.operation-sunat-live strong,
.operation-sunat-live span,
.operation-sunat-live small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.operation-sunat-live strong {
    color: var(--text-primary);
    font-size: .7rem;
    line-height: 1.25;
}

.operation-sunat-live span {
    color: var(--color-cyan);
    font-size: .64rem;
}

.operation-sunat-live small {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: .58rem;
}

.operation-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem .65rem;
    color: var(--text-muted);
    font-size: .67rem;
}

.operation-progress {
    width: min(230px, 100%);
    display: grid;
    gap: .22rem;
}

.operation-progress-copy {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    color: var(--text-secondary);
    font-size: .67rem;
}

.operation-progress-track {
    width: 100%;
    height: 6px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, .14);
    border-radius: 999px;
    background: rgba(15, 23, 42, .76);
}

.operation-progress-track > span {
    width: 0;
    height: 100%;
    display: block;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--color-cyan), var(--color-emerald));
    transition: width .25s ease;
}

.btn-action-diagnostic {
    width: fit-content;
    min-height: 30px;
    padding: .35rem .55rem;
    gap: .35rem;
    color: var(--color-cyan);
    font-size: .68rem;
}

.btn-action-diagnostic svg {
    width: 14px;
    height: 14px;
}

@media (max-width: 1100px) {
    .company-operation-flows {
        min-width: 230px;
        grid-template-columns: 1fr;
    }
}

.diagnostic-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background: rgba(3, 7, 18, .88);
    backdrop-filter: blur(10px);
}

.diagnostic-dialog {
    width: min(1280px, 100%);
    max-height: min(900px, 92dvh);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(34, 211, 238, .22);
    border-radius: 18px;
    background: #090f1d;
    box-shadow: 0 28px 80px rgba(0, 0, 0, .5);
}

.diagnostic-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.15rem 1.3rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(6, 182, 212, .09), rgba(15, 23, 42, .22));
}

.diagnostic-heading {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: .85rem;
}

.diagnostic-heading-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    color: #fb7185;
    border: 1px solid rgba(244, 63, 94, .24);
    border-radius: 12px;
    background: rgba(244, 63, 94, .08);
}

.diagnostic-heading-icon svg {
    width: 20px;
    height: 20px;
}

.diagnostic-eyebrow,
.diagnostic-summary span,
.diagnostic-evidence-title span {
    color: var(--text-muted);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.diagnostic-heading h3 {
    margin: .14rem 0;
    font-size: 1.05rem;
}

.diagnostic-heading p,
.diagnostic-evidence-title p {
    margin: 0;
    color: var(--text-secondary);
    font-size: .74rem;
}

.diagnostic-close {
    flex: 0 0 auto;
    color: var(--text-secondary);
}

.diagnostic-body {
    min-height: 0;
    overflow: auto;
    display: grid;
    grid-template-columns: minmax(330px, 420px) minmax(250px, 315px) minmax(0, 1fr);
}

.sunat-trace-panel {
    min-width: 0;
    align-content: start;
    display: grid;
    gap: .8rem;
    padding: 1.15rem;
    border-right: 1px solid var(--border-color);
    background: rgba(6, 182, 212, .025);
}

.sunat-trace-timeline {
    display: grid;
    gap: .55rem;
}

.sunat-trace-step {
    min-width: 0;
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr);
    gap: .65rem;
    padding: .7rem;
    border: 1px solid rgba(148, 163, 184, .14);
    border-radius: 10px;
    background: rgba(8, 15, 29, .72);
}

.sunat-trace-step.completed {
    border-color: rgba(16, 185, 129, .2);
}

.sunat-trace-step.waiting,
.sunat-trace-step.active {
    border-color: rgba(6, 182, 212, .28);
}

.sunat-trace-step.error {
    border-color: rgba(244, 63, 94, .34);
}

.sunat-trace-index {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    color: var(--color-cyan);
    border: 1px solid rgba(6, 182, 212, .25);
    border-radius: 50%;
    background: rgba(6, 182, 212, .08);
    font-family: var(--font-mono);
    font-size: .65rem;
    font-weight: 800;
}

.sunat-trace-step > div {
    min-width: 0;
    display: grid;
    gap: .22rem;
}

.sunat-trace-heading {
    min-width: 0;
    display: flex;
    justify-content: space-between;
    gap: .75rem;
}

.sunat-trace-heading strong {
    color: var(--text-primary);
    font-size: .73rem;
    line-height: 1.3;
}

.sunat-trace-heading time {
    flex: 0 0 auto;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: .57rem;
}

.sunat-trace-step p,
.sunat-trace-step small {
    margin: 0;
    overflow-wrap: anywhere;
}

.sunat-trace-step p {
    color: var(--color-cyan);
    font-size: .66rem;
    line-height: 1.4;
}

.sunat-trace-step small {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: .58rem;
    line-height: 1.35;
}

.sunat-trace-attempt,
.sunat-trace-detail {
    width: fit-content;
    color: var(--text-secondary);
    font-size: .59rem;
}

.sunat-trace-attempt {
    padding: .16rem .35rem;
    border-radius: 999px;
    background: rgba(245, 158, 11, .1);
}

.sunat-trace-empty {
    padding: 1rem;
    color: var(--text-muted);
    border: 1px dashed rgba(148, 163, 184, .2);
    border-radius: 10px;
    font-size: .72rem;
    text-align: center;
}

.diagnostic-summary {
    align-content: start;
    display: grid;
    gap: .85rem;
    padding: 1.15rem;
    border-right: 1px solid var(--border-color);
    background: rgba(15, 23, 42, .30);
}

.diagnostic-code-block,
.diagnostic-progress-block,
.diagnostic-message-block {
    display: grid;
    gap: .45rem;
    padding: .9rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: rgba(8, 15, 29, .74);
}

.diagnostic-code-block strong {
    color: #fb7185;
    font-size: .82rem;
    line-height: 1.35;
}

.diagnostic-progress-copy {
    display: grid;
    gap: .2rem;
}

.diagnostic-progress-copy strong {
    font-size: .79rem;
}

.diagnostic-message-block p {
    max-height: 260px;
    overflow: auto;
    margin: 0;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: .72rem;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.diagnostic-evidence {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    padding: 1.15rem;
}

.diagnostic-evidence-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.diagnostic-counter {
    flex: 0 0 auto;
    padding: .35rem .55rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: rgba(255, 255, 255, .03);
}

.diagnostic-gallery {
    display: flex;
    gap: .5rem;
    overflow-x: auto;
    padding-bottom: .2rem;
}

.diagnostic-gallery button {
    flex: 0 0 auto;
    max-width: 190px;
    overflow: hidden;
    padding: .45rem .65rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(255, 255, 255, .025);
    font: inherit;
    font-size: .7rem;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.diagnostic-gallery button.active {
    color: var(--color-cyan);
    border-color: rgba(6, 182, 212, .42);
    background: rgba(6, 182, 212, .09);
}

.diagnostic-image-wrap {
    min-height: 320px;
    flex: 1 1 auto;
    overflow: auto;
    display: grid;
    place-items: start center;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background:
        linear-gradient(45deg, rgba(148, 163, 184, .04) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(148, 163, 184, .04) 25%, transparent 25%),
        #050a13;
    background-position: 0 0, 8px 8px;
    background-size: 16px 16px;
}

.diagnostic-image-wrap img {
    width: auto;
    max-width: 100%;
    height: auto;
    display: block;
}

.diagnostic-empty {
    min-height: 320px;
    flex: 1 1 auto;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: .5rem;
    padding: 2rem;
    color: var(--text-muted);
    border: 1px dashed rgba(148, 163, 184, .22);
    border-radius: 12px;
    text-align: center;
}

.diagnostic-empty svg {
    width: 28px;
    height: 28px;
}

.diagnostic-empty strong {
    color: var(--text-primary);
    font-size: .82rem;
}

.diagnostic-empty span {
    max-width: 430px;
    font-size: .73rem;
    line-height: 1.5;
}

@media (max-width: 720px) {
    .diagnostic-modal {
        align-items: end;
        padding: 0;
    }

    .diagnostic-dialog {
        width: 100%;
        max-height: 94dvh;
        border-right: 0;
        border-bottom: 0;
        border-left: 0;
        border-radius: 18px 18px 0 0;
    }

    .diagnostic-header {
        padding: .9rem 1rem;
    }

    .diagnostic-heading-icon {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
    }

    .diagnostic-body {
        display: block;
    }

    .diagnostic-summary {
        border-right: 0;
        border-bottom: 1px solid var(--border-color);
        padding: .85rem;
    }

    .sunat-trace-panel {
        border-right: 0;
        border-bottom: 1px solid var(--border-color);
        padding: .85rem;
    }

    .diagnostic-message-block p {
        max-height: 150px;
    }

    .diagnostic-evidence {
        min-height: 390px;
        padding: .85rem;
    }

    .diagnostic-image-wrap,
    .diagnostic-empty {
        min-height: 300px;
    }
}

/* SIRE: cabecera operativa y monitoreo con prioridad absoluta a la información útil. */
/* Control Plane: trazabilidad accionable y compacta para cada panel MCP. */
.mcp-trace-modal {
    position: fixed;
    inset: 0;
    z-index: 1250;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: rgba(3, 7, 18, .88);
    backdrop-filter: blur(10px);
}
.mcp-trace-dialog {
    width: min(1420px, 100%);
    height: min(850px, calc(100dvh - 4rem));
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    overflow: hidden;
    background: #09111f;
    border: 1px solid rgba(6, 182, 212, .25);
    border-radius: 20px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .55);
}
.mcp-trace-header,
.mcp-trace-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--border-color);
}
.mcp-trace-heading { min-width: 0; display: flex; align-items: center; gap: .85rem; }
.mcp-trace-icon { width: 44px; height: 44px; flex: 0 0 auto; display: grid; place-items: center; color: var(--color-cyan); background: rgba(6, 182, 212, .1); border: 1px solid rgba(6, 182, 212, .22); border-radius: 13px; }
.mcp-trace-icon svg { width: 22px; height: 22px; }
.mcp-trace-heading > div { min-width: 0; display: grid; gap: .1rem; }
.mcp-trace-eyebrow { color: var(--color-cyan); font-size: .64rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.mcp-trace-heading h3 { margin: 0; font-size: 1.08rem; }
.mcp-trace-heading p { margin: 0; overflow: hidden; color: var(--text-secondary); font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.mcp-trace-close { color: var(--text-secondary); }
.mcp-trace-toolbar { justify-content: flex-end; padding-block: .75rem; background: rgba(255,255,255,.015); }
.mcp-trace-toolbar label { display: flex; align-items: center; gap: .55rem; color: var(--text-secondary); font-size: .68rem; font-weight: 700; }
.mcp-trace-toolbar select { min-width: 300px; min-height: 40px; }
.mcp-trace-layout { min-height: 0; display: grid; grid-template-columns: minmax(370px, .82fr) minmax(0, 1.18fr); }
.mcp-trace-runs,
.mcp-trace-events { min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.mcp-trace-runs { border-right: 1px solid var(--border-color); }
.mcp-trace-section-title { display: flex; align-items: end; justify-content: space-between; gap: 1rem; padding: .9rem 1rem; border-bottom: 1px solid var(--border-color); }
.mcp-trace-section-title > div { display: grid; gap: .14rem; }
.mcp-trace-section-title small { color: var(--text-muted); font-size: .6rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.mcp-trace-section-title strong { font-size: .86rem; }
.mcp-trace-section-title > span { color: var(--text-secondary); font: 600 .65rem var(--font-mono); }
.mcp-trace-run-list,
.mcp-trace-event-list { min-height: 0; overflow: auto; padding: .75rem; }
.mcp-trace-run-list { display: grid; align-content: start; gap: .55rem; }
.mcp-trace-run {
    width: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: .7rem;
    padding: .8rem;
    color: var(--text-primary);
    text-align: left;
    background: rgba(255,255,255,.025);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
}
.mcp-trace-run:hover,
.mcp-trace-run.active { border-color: rgba(6, 182, 212, .42); background: rgba(6, 182, 212, .07); }
.mcp-trace-run-state { width: 10px; height: 10px; border-radius: 50%; background: #94a3b8; box-shadow: 0 0 0 4px rgba(148,163,184,.08); }
.mcp-trace-run-state.completed { background: var(--color-emerald); box-shadow: 0 0 0 4px rgba(16,185,129,.09); }
.mcp-trace-run-state.failed { background: #fb7185; box-shadow: 0 0 0 4px rgba(251,113,133,.09); }
.mcp-trace-run-state.running { background: var(--color-orange); box-shadow: 0 0 0 4px rgba(245,158,11,.09); }
.mcp-trace-run-copy { min-width: 0; display: grid; gap: .16rem; }
.mcp-trace-run-copy strong,
.mcp-trace-run-copy span,
.mcp-trace-run-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcp-trace-run-copy strong { font-size: .78rem; }
.mcp-trace-run-copy span { color: var(--text-secondary); font-size: .69rem; }
.mcp-trace-run-copy small { color: var(--text-muted); font: 500 .61rem var(--font-mono); }
.mcp-trace-run-meta { display: grid; justify-items: end; gap: .16rem; }
.mcp-trace-run-meta b { color: var(--color-cyan); font: 700 .65rem var(--font-mono); }
.mcp-trace-run-meta small { color: var(--text-muted); font-size: .58rem; }
.mcp-trace-event-list { display: grid; align-content: start; gap: .6rem; }
.mcp-trace-event { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .8rem; padding: .78rem .85rem; border: 1px solid var(--border-color); border-radius: 12px; background: rgba(255,255,255,.018); }
.mcp-trace-event-index { width: 30px; height: 30px; display: grid; place-items: center; color: var(--color-cyan); background: rgba(6,182,212,.08); border: 1px solid rgba(6,182,212,.18); border-radius: 9px; font: 700 .67rem var(--font-mono); }
.mcp-trace-event-copy { min-width: 0; display: grid; gap: .18rem; }
.mcp-trace-event-copy strong { font-size: .76rem; }
.mcp-trace-event-copy span { color: var(--text-secondary); font-size: .67rem; line-height: 1.4; overflow-wrap: anywhere; }
.mcp-trace-event-copy small { color: var(--text-muted); font: 500 .59rem var(--font-mono); }
.mcp-trace-empty { min-height: 140px; display: grid; place-items: center; padding: 2rem; color: var(--text-muted); text-align: center; border: 1px dashed rgba(148,163,184,.18); border-radius: 12px; font-size: .74rem; }
.mcp-trace-error { color: #fb7185 !important; }

@media (max-width: 1100px) {
    .mcp-context-operation { min-width: 0; }
    .mcp-context-last { display: none; }
    .mcp-trace-layout { grid-template-columns: minmax(320px, .72fr) minmax(0, 1.28fr); }
}

@media (max-width: 720px) {
    .mcp-trace-modal { align-items: stretch; padding: 0; }
    .mcp-trace-dialog { width: 100%; height: 100dvh; border: 0; border-radius: 0; }
    .mcp-trace-heading p { display: none; }
    .mcp-trace-toolbar { align-items: stretch; }
    .mcp-trace-toolbar label { min-width: 0; flex: 1; align-items: stretch; flex-direction: column; gap: .25rem; }
    .mcp-trace-toolbar select { width: 100%; min-width: 0; }
    .mcp-trace-layout { grid-template-columns: 1fr; grid-template-rows: minmax(230px, .9fr) minmax(300px, 1.1fr); }
    .mcp-trace-runs { border-right: 0; border-bottom: 1px solid var(--border-color); }
}

body.sire-data-focus .mcp-context-bar {
    display: none !important;
}

body.sire-data-focus .content-header {
    position: relative;
    z-index: 80;
    min-height: 58px;
    padding-top: .65rem;
    padding-bottom: .65rem;
    overflow: visible;
}

body.sire-data-focus .header-title {
    flex: 0 1 330px;
    min-width: 190px;
}

body.sire-data-focus .header-title h2 {
    font-size: 1.22rem;
    line-height: 1.1;
}

body.sire-data-focus .header-title p {
    margin-top: .15rem;
    font-size: .72rem;
}

body.sire-data-focus .view-header-actions {
    flex: 1 1 auto;
    max-width: none;
    overflow: visible;
}

body.sire-data-focus .compras-header-actions-group,
body.sire-data-focus .libro-bancos-header-actions,
body.sire-data-focus .libro-caja-header-actions {
    display: none !important;
}

.sire-header-actions {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: .55rem;
    overflow: visible;
}

.sire-header-actions.hidden {
    display: none !important;
}

.sire-action-menu {
    position: relative;
}

.sire-action-menu > summary {
    list-style: none;
}

.sire-action-menu > summary::-webkit-details-marker {
    display: none;
}

.sire-header-button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .48rem;
    padding: .55rem .8rem;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: rgba(15, 23, 42, .72);
    font-size: .75rem;
    font-weight: 750;
    cursor: pointer;
    user-select: none;
}

.sire-header-button-primary {
    color: #021019;
    border-color: rgba(34, 211, 238, .56);
    background: linear-gradient(135deg, #22d3ee, #38bdf8);
}

.sire-header-button svg {
    width: 16px;
    height: 16px;
}

.sire-header-chevron {
    width: 13px !important;
    height: 13px !important;
    transition: transform .18s ease;
}

.sire-action-menu[open] > summary {
    border-color: rgba(34, 211, 238, .52);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, .08);
}

.sire-action-menu[open] .sire-header-chevron {
    transform: rotate(180deg);
}

.sire-action-popover {
    position: absolute;
    top: calc(100% + .65rem);
    right: 0;
    z-index: 1600;
    width: min(680px, calc(100vw - 2rem));
    max-height: calc(100dvh - 105px);
    overflow: auto;
    padding: 1rem;
    border: 1px solid rgba(34, 211, 238, .22);
    border-radius: 14px;
    background: #0b1221;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .52);
}

.sire-company-popover {
    width: min(610px, calc(100vw - 2rem));
}

.sire-action-popover-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .85rem;
}

.sire-action-popover-heading span {
    color: var(--color-cyan);
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.sire-action-popover-heading h3 {
    margin: .16rem 0 0;
    font-size: .94rem;
}

.sire-panel-close {
    flex: 0 0 auto;
    color: var(--text-secondary);
}

.sire-compact-form {
    display: grid;
    grid-template-columns: minmax(210px, 1.4fr) 125px 175px 82px 120px auto;
    gap: .6rem;
    align-items: end;
}

.sire-company-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .7rem;
}

.sire-compact-form .form-group,
.sire-company-form .form-group {
    display: grid;
    gap: .32rem;
}

.sire-compact-form label,
.sire-company-form label {
    color: var(--text-secondary);
    font-size: .65rem;
    font-weight: 700;
}

.sire-compact-form select,
.sire-company-form input {
    width: 100%;
    min-height: 40px;
    padding: .55rem .65rem;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 9px;
    outline: none;
    background: rgba(15, 23, 42, .76);
}

.sire-compact-form select:focus,
.sire-company-form input:focus {
    border-color: rgba(34, 211, 238, .58);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, .08);
}

.sire-submit-action {
    min-height: 40px;
    padding-inline: .85rem;
    white-space: nowrap;
}

.sire-company-watcher,
.sire-company-form-actions,
.sire-company-form > .sire-api-help {
    grid-column: 1 / -1;
}

.sire-company-watcher {
    min-height: 42px;
    justify-content: flex-start;
    padding: .45rem .6rem;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    background: rgba(15, 23, 42, .44);
}

.sire-company-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: .55rem;
}

body.sire-data-focus #view-descargador-sire-container {
    gap: .7rem;
}

.sire-monitor-card,
.sire-archives-card {
    min-width: 0;
    overflow: hidden;
}

.sire-monitor-header {
    min-height: 54px;
    padding: .65rem 1rem;
}

.sire-monitor-header .card-header-title {
    align-items: center;
}

.sire-monitor-header .card-header-title > div {
    display: grid;
    gap: .1rem;
}

.sire-monitor-header h3 {
    font-size: .92rem;
}

.sire-monitor-header p {
    margin: 0;
    color: var(--text-muted);
    font-size: .67rem;
}

.sire-company-count {
    padding: .3rem .55rem;
    color: var(--color-cyan);
    border: 1px solid rgba(34, 211, 238, .2);
    border-radius: 999px;
    background: rgba(34, 211, 238, .06);
    font-size: .66rem;
    font-weight: 750;
}

.sire-company-name {
    font-weight: 700;
    line-height: 1.25;
}

.sire-company-ruc {
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.sire-api-state {
    display: block;
    margin-top: .2rem;
    font-size: .67rem;
    font-weight: 700;
}

.sire-api-state-ready {
    color: var(--color-cyan);
}

.sire-api-state-missing {
    color: #f59e0b;
}

.sire-companies-table-wrap {
    min-height: 56vh;
    max-height: calc(100dvh - 215px);
    overflow: auto;
}

.sire-companies-table-wrap thead th,
.sire-archives-table-wrap thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #101827;
}

#tabla-empresas th:nth-child(1) {
    width: 22%;
}

#tabla-empresas th:nth-child(2) {
    width: 8%;
    text-align: center;
}

#tabla-empresas th:nth-child(3) {
    width: auto;
}

#tabla-empresas th:nth-child(4) {
    width: 128px;
}

.sire-company-row > td {
    padding-top: .7rem;
    padding-bottom: .7rem;
    vertical-align: middle;
}

.sire-row-actions {
    display: flex;
    justify-content: flex-end;
    gap: .42rem;
}

.sire-archives-card .card-header {
    min-height: 48px;
    padding-top: .6rem;
    padding-bottom: .6rem;
}

.sire-archives-table-wrap {
    max-height: 260px;
    overflow: auto;
}

body.sire-data-focus .company-operation-flows {
    min-width: 0;
    grid-template-columns: repeat(2, minmax(190px, 1fr));
}

body.sire-data-focus .company-operation-status {
    min-width: 0;
    gap: .27rem;
    padding: .52rem;
}

body.sire-data-focus .company-operation-status .badge {
    min-width: 76px;
}

body.sire-data-focus .operation-stage,
body.sire-data-focus .operation-code,
body.sire-data-focus .operation-explanation {
    max-width: 100%;
}

/* Una incidencia se entiende de un vistazo: resumen corto arriba y captura completa debajo. */
.diagnostic-dialog {
    width: min(1500px, calc(100vw - 24px));
    height: min(930px, 94dvh);
    max-height: 94dvh;
}

.diagnostic-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.diagnostic-summary {
    flex: 0 0 auto;
    align-content: stretch;
    display: grid;
    grid-template-columns: minmax(180px, .75fr) minmax(230px, 1fr) minmax(340px, 1.8fr);
    gap: .65rem;
    padding: .75rem;
    border-right: 0;
    border-bottom: 1px solid var(--border-color);
}

.diagnostic-code-block,
.diagnostic-progress-block,
.diagnostic-message-block {
    min-width: 0;
    padding: .62rem .72rem;
}

.diagnostic-message-block p {
    max-height: 64px;
    font-family: inherit;
    font-size: .71rem;
    line-height: 1.35;
}

.diagnostic-evidence {
    flex: 1 1 auto;
    min-height: 0;
    padding: .8rem;
}

.diagnostic-evidence-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.diagnostic-open-image {
    min-height: 32px;
    padding: .35rem .55rem;
    gap: .35rem;
    color: var(--color-cyan);
    font-size: .68rem;
}

.diagnostic-open-image svg {
    width: 14px;
    height: 14px;
}

.diagnostic-image-wrap,
.diagnostic-empty {
    min-height: 0;
    flex: 1 1 auto;
}

.diagnostic-image-wrap {
    overflow: hidden;
    place-items: center;
    padding: .3rem;
}

.diagnostic-image-wrap img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

@media (max-width: 900px) {
    body.sire-data-focus .content-header {
        align-items: center;
        gap: .55rem;
    }

    body.sire-data-focus .header-title {
        flex-basis: 210px;
    }

    body.sire-data-focus .header-title p {
        display: none;
    }

    .sire-header-button span {
        max-width: 90px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .sire-compact-form {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .sire-submit-action {
        grid-column: 1 / -1;
    }

    body.sire-data-focus .company-operation-flows {
        grid-template-columns: 1fr;
    }

    .diagnostic-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .diagnostic-message-block {
        grid-column: 1 / -1;
    }
}

@media (max-width: 720px) {
    body.sire-data-focus .main-content {
        padding-top: 0;
    }

    body.sire-data-focus .content-header {
        min-height: 62px;
        padding: .55rem .75rem;
    }

    body.sire-data-focus .header-title {
        min-width: 0;
        flex: 1 1 auto;
    }

    body.sire-data-focus .header-title h2 {
        font-size: 1.08rem;
    }

    body.sire-data-focus .view-header-actions {
        flex: 0 0 auto;
    }

    .sire-header-actions {
        width: auto;
        gap: .38rem;
    }

    .sire-header-button {
        width: 40px;
        height: 40px;
        min-height: 40px;
        padding: 0;
    }

    .sire-header-button span,
    .sire-header-chevron {
        display: none;
    }

    .sire-action-popover {
        position: fixed;
        inset: 70px .65rem auto .65rem;
        width: auto;
        max-height: calc(100dvh - 155px);
    }

    .sire-compact-form,
    .sire-company-form {
        grid-template-columns: 1fr;
    }

    .sire-submit-action,
    .sire-company-watcher,
    .sire-company-form-actions {
        grid-column: 1;
    }

    .sire-company-form-actions > .btn {
        flex: 1 1 0;
    }

    #view-descargador-sire-container {
        padding-inline: .55rem;
    }

    .sire-monitor-header p {
        display: none;
    }

    .sire-companies-table-wrap {
        min-height: 0;
        max-height: none;
        padding: .55rem;
        overflow-x: hidden;
        overflow-y: visible;
    }

    #tabla-empresas {
        display: block;
        width: 100%;
        min-width: 0;
    }

    #tabla-empresas thead {
        display: none;
    }

    #tabla-empresas tbody {
        display: grid;
        gap: .65rem;
    }

    #tabla-empresas .sire-company-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "identity auto"
            "process process"
            "actions actions";
        gap: .65rem;
        padding: .8rem;
        border: 1px solid rgba(148, 163, 184, .15);
        border-radius: 14px;
        background: rgba(10, 18, 33, .76);
    }

    #tabla-empresas .sire-company-row > td {
        display: block;
        width: auto;
        padding: 0;
        border: 0;
    }

    #tabla-empresas .sire-company-identity {
        grid-area: identity;
        min-width: 0;
    }

    #tabla-empresas .sire-auto-cell {
        grid-area: auto;
        align-self: start;
        padding-top: .12rem;
    }

    #tabla-empresas .sire-process-cell {
        grid-area: process;
        min-width: 0;
    }

    #tabla-empresas .sire-actions-cell {
        grid-area: actions;
        padding-top: .1rem;
        border-top: 1px solid rgba(148, 163, 184, .1);
    }

    #tabla-empresas .sire-row-actions {
        justify-content: flex-end;
        padding-top: .55rem;
    }

    body.sire-data-focus .company-operation-flows {
        min-width: 0;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .45rem;
    }

    body.sire-data-focus .company-operation-status {
        min-width: 0;
        padding: .55rem;
        gap: .28rem;
    }

    body.sire-data-focus .operation-stage,
    body.sire-data-focus .operation-code,
    body.sire-data-focus .operation-explanation {
        white-space: normal;
        overflow-wrap: anywhere;
    }

    body.sire-data-focus .operation-explanation {
        display: none;
    }

    body.sire-data-focus .operation-sunat-live {
        padding: .4rem;
    }

    body.sire-data-focus .operation-sunat-live small {
        display: none;
    }

    body.sire-data-focus .operation-meta {
        gap: .18rem .38rem;
    }

    body.sire-data-focus .operation-meta span {
        font-size: .58rem;
    }

    .sire-archives-card {
        display: none;
    }

    .diagnostic-dialog {
        width: 100%;
        height: 96dvh;
        max-height: 96dvh;
    }

    .diagnostic-header {
        flex: 0 0 auto;
    }

    .diagnostic-body {
        display: flex;
    }

    .diagnostic-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .45rem;
        padding: .55rem;
    }

    .diagnostic-code-block,
    .diagnostic-progress-block,
    .diagnostic-message-block {
        padding: .52rem;
    }

    .diagnostic-message-block {
        grid-column: 1 / -1;
    }

    .diagnostic-message-block p {
        max-height: 56px;
    }

    .diagnostic-evidence {
        min-height: 0;
        padding: .55rem;
    }

    .diagnostic-evidence-title p {
        display: none;
    }

    .diagnostic-evidence-actions {
        gap: .3rem;
    }

    .diagnostic-open-image span {
        display: none;
    }

    .diagnostic-empty {
        min-height: 0;
    }

    .btn-action-diagnostic {
        width: 100%;
        justify-content: center;
    }
}
.extractor-sales-controls {
    display: grid;
    gap: 0.75rem;
    padding: 1.25rem;
}

.extractor-sales-controls p {
    margin: 0 0 0.25rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.45;
}

.extractor-sales-controls .btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    min-height: 42px;
    margin-top: 0.25rem;
}

.extractor-sales-controls .btn svg {
    width: 16px;
    height: 16px;
}

.extractor-sales-status {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(34, 211, 238, 0.05);
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.4;
}

.extractor-sales-status.is-complete {
    border-color: rgba(16, 185, 129, 0.35);
    color: var(--color-emerald);
}

.extractor-sales-status.is-error {
    border-color: rgba(239, 68, 68, 0.35);
    color: var(--color-red);
}

.extractor-sales-recent {
    display: grid;
    gap: 0.4rem;
}

.extractor-sales-document {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.extractor-sales-document strong {
    color: var(--text-primary);
}

@media (max-width: 900px) {
    #view-extractor-e001-container .dashboard-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }
}

/* ================================================================
   CONTA.STUDIO - operacion contable canonica
   ================================================================ */
body.conta-studio-data-focus .content-header {
    min-height: 58px;
    padding-bottom: 0.65rem;
}
body.conta-studio-data-focus .header-title h2 {
    font-size: 1.28rem;
    letter-spacing: -0.025em;
}
body.conta-studio-data-focus .header-title p {
    margin-top: 0.16rem;
    font-size: 0.72rem;
}

.conta-studio-view {
    display: flex;
    flex-direction: column;
    gap: 0.72rem;
    min-width: 0;
}
.conta-studio-view.hidden { display: none !important; }

.conta-studio-toolbar {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(150px, 190px) auto;
    align-items: end;
    gap: 0.68rem;
    padding: 0.72rem;
    border: 1px solid rgba(148, 163, 184, 0.13);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(8, 17, 29, 0.96));
}
.conta-studio-filter { min-width: 0; }
.conta-studio-filter label {
    display: block;
    margin: 0 0 0.32rem 0.1rem;
    color: var(--text-muted);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}
.conta-studio-filter .form-control {
    width: 100%;
    height: 40px;
    min-width: 0;
    padding: 0 0.72rem;
    border-radius: 9px;
    font-size: 0.76rem;
}
.conta-studio-filter select option {
    color: #f1f5f9;
    background: #0b101d;
}
.conta-studio-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.48rem;
}
.conta-studio-toolbar-actions .btn {
    min-height: 40px;
    padding: 0.48rem 0.72rem;
    white-space: nowrap;
}
.conta-studio-toolbar-actions .btn svg { width: 16px; height: 16px; }

.conta-studio-status {
    min-height: 32px;
    display: flex;
    align-items: center;
    padding: 0.45rem 0.72rem;
    border-left: 2px solid rgba(100, 116, 139, 0.65);
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary);
    background: rgba(15, 23, 42, 0.42);
    font-size: 0.7rem;
}
.conta-studio-status.is-loading { border-color: var(--color-cyan); color: #bae6fd; }
.conta-studio-status.is-ok { border-color: var(--color-emerald); color: #a7f3d0; }
.conta-studio-status.is-error { border-color: var(--color-red); color: #fecaca; }

.conta-studio-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.11);
    border-radius: 12px;
    background: rgba(11, 16, 29, 0.7);
}
.conta-studio-kpis article {
    min-width: 0;
    padding: 0.62rem 0.82rem;
    border-right: 1px solid rgba(148, 163, 184, 0.1);
}
.conta-studio-kpis article:last-child { border-right: 0; }
.conta-studio-kpis span,
.conta-studio-kpis small {
    display: block;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.58rem;
    font-weight: 650;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.conta-studio-kpis strong {
    display: block;
    margin: 0.12rem 0;
    color: var(--text-primary);
    font: 700 1.16rem/1 var(--font-mono);
}
.conta-studio-kpis article:nth-child(2) strong { color: #fbbf24; }
.conta-studio-kpis article:nth-child(3) strong { color: #fb7185; }
.conta-studio-kpis article:nth-child(4) strong { color: #34d399; }

.conta-studio-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.72rem;
    min-width: 0;
}
.conta-studio-workspace.has-detail {
    grid-template-columns: minmax(0, 1.72fr) minmax(330px, 0.88fr);
}
.conta-studio-operations,
.conta-studio-detail {
    min-width: 0;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 14px;
    background: rgba(8, 13, 24, 0.86);
}
.conta-studio-section-head,
.conta-studio-detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    min-height: 58px;
    padding: 0.62rem 0.8rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    background: rgba(15, 23, 42, 0.76);
}
.conta-studio-section-head span,
.conta-studio-detail-head span {
    display: block;
    color: var(--color-cyan);
    font-size: 0.57rem;
    font-weight: 750;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}
.conta-studio-section-head h3,
.conta-studio-detail-head h3 {
    margin: 0.1rem 0 0;
    color: var(--text-primary);
    font-size: 0.88rem;
}
.conta-studio-service-state { display: flex; align-items: center; gap: 0.38rem; }
.conta-studio-service-state > span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}
.conta-studio-service-state > span.is-ready { background: var(--color-emerald); box-shadow: 0 0 10px rgba(16, 185, 129, 0.55); }
.conta-studio-service-state > span.is-degraded { background: var(--color-red); }
.conta-studio-service-state strong { color: var(--text-secondary); font-size: 0.65rem; }

.conta-studio-table-shell {
    min-height: 260px;
    max-height: calc(100vh - 400px);
    overflow: auto;
    overscroll-behavior: contain;
}
.conta-studio-table {
    width: 100%;
    min-width: 900px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.68rem;
}
.conta-studio-table thead { position: sticky; top: 0; z-index: 3; }
.conta-studio-table th {
    padding: 0.62rem 0.72rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.13);
    color: #a5b4cc;
    background: #0d1423;
    font-size: 0.57rem;
    font-weight: 750;
    letter-spacing: 0.055em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}
.conta-studio-table td {
    height: 56px;
    padding: 0.52rem 0.72rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.075);
    color: var(--text-secondary);
    vertical-align: middle;
}
.conta-studio-table tbody tr { transition: background 0.16s ease; }
.conta-studio-table tbody tr:hover,
.conta-studio-table tbody tr.is-selected { background: rgba(6, 182, 212, 0.07); }
.conta-studio-table td strong,
.conta-studio-table td small { display: block; }
.conta-studio-table td strong { color: var(--text-primary); font-size: 0.7rem; }
.conta-studio-table td small { margin-top: 0.12rem; color: var(--text-muted); font: 0.55rem var(--font-mono); }
.conta-studio-table .is-number { text-align: right; font-family: var(--font-mono); white-space: nowrap; }
.conta-studio-empty { height: 220px !important; color: var(--text-muted) !important; text-align: center; }
.conta-studio-open,
.conta-studio-detail-head button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(6, 182, 212, 0.18);
    border-radius: 9px;
    color: var(--color-cyan);
    background: rgba(6, 182, 212, 0.06);
    cursor: pointer;
}
.conta-studio-open svg,
.conta-studio-detail-head button svg { width: 16px; height: 16px; }

.conta-studio-state {
    display: inline-flex;
    max-width: 190px;
    padding: 0.3rem 0.46rem;
    overflow: hidden;
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 7px;
    color: #c7d2fe;
    background: rgba(99, 102, 241, 0.09);
    font: 650 0.55rem/1 var(--font-mono);
    text-overflow: ellipsis;
    white-space: nowrap;
}
.conta-studio-state.is-observado { border-color: rgba(239, 68, 68, 0.32); color: #fda4af; background: rgba(239, 68, 68, 0.09); }
.conta-studio-state.is-listo-para-aprobar { border-color: rgba(249, 115, 22, 0.35); color: #fdba74; background: rgba(249, 115, 22, 0.09); }
.conta-studio-state.is-aprobado,
.conta-studio-state.is-registrado,
.conta-studio-state.is-libros-actualizados,
.conta-studio-state.is-auditado { border-color: rgba(16, 185, 129, 0.32); color: #6ee7b7; background: rgba(16, 185, 129, 0.08); }

.conta-studio-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    min-height: 54px;
    padding: 0.55rem 0.75rem;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    color: var(--text-muted);
    font-size: 0.62rem;
}
.conta-studio-pagination > div { display: flex; gap: 0.4rem; }
.conta-studio-pagination .btn { min-height: 34px; padding: 0.38rem 0.55rem; font-size: 0.62rem; }
.conta-studio-pagination .btn svg { width: 14px; height: 14px; }

.conta-studio-detail {
    position: sticky;
    top: 0.65rem;
    align-self: start;
    max-height: calc(100vh - 160px);
    overflow: auto;
}
.conta-studio-detail.hidden { display: none !important; }
.conta-studio-detail-head { position: sticky; top: 0; z-index: 4; }
.conta-studio-detail-content { padding: 0.75rem; }
.conta-studio-detail-loading,
.conta-studio-detail-error { padding: 2.5rem 1rem; color: var(--text-muted); text-align: center; }
.conta-studio-detail-error { color: #fca5a5; }
.conta-studio-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.48rem; margin: 0; }
.conta-studio-facts div { min-width: 0; padding: 0.52rem; border-radius: 8px; background: rgba(15, 23, 42, 0.72); }
.conta-studio-facts dt { color: var(--text-muted); font-size: 0.54rem; font-weight: 700; text-transform: uppercase; }
.conta-studio-facts dd { margin: 0.2rem 0 0; overflow: hidden; color: var(--text-primary); font: 0.66rem var(--font-mono); text-overflow: ellipsis; }
.conta-studio-subhead { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin: 0.9rem 0 0.42rem; }
.conta-studio-subhead h4 { margin: 0; color: var(--text-primary); font-size: 0.72rem; }
.conta-studio-subhead span { color: var(--text-muted); font: 0.54rem var(--font-mono); }
.conta-studio-lines-shell { overflow-x: auto; border: 1px solid rgba(148, 163, 184, 0.1); border-radius: 9px; }
.conta-studio-lines { width: 100%; min-width: 590px; border-collapse: collapse; font-size: 0.61rem; }
.conta-studio-lines th,
.conta-studio-lines td { padding: 0.44rem 0.5rem; border-bottom: 1px solid rgba(148, 163, 184, 0.08); text-align: left; }
.conta-studio-lines th { color: var(--text-muted); background: rgba(15, 23, 42, 0.82); font-size: 0.53rem; text-transform: uppercase; }
.conta-studio-lines td { color: var(--text-secondary); }
.conta-studio-lines td:nth-last-child(-n+2) { font-family: var(--font-mono); text-align: right; white-space: nowrap; }
.conta-studio-hashes { margin-top: 0.7rem; padding: 0.55rem; border: 1px solid rgba(148, 163, 184, 0.1); border-radius: 9px; }
.conta-studio-hashes summary { color: var(--text-secondary); font-size: 0.62rem; cursor: pointer; }
.conta-studio-hashes div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 0.45rem; margin-top: 0.38rem; }
.conta-studio-hashes span { color: var(--text-muted); font-size: 0.52rem; }
.conta-studio-hashes code { overflow: hidden; color: #67e8f9; font-size: 0.5rem; text-overflow: ellipsis; white-space: nowrap; }
.conta-studio-timeline-section { padding: 0 0.75rem 0.8rem; }
.conta-studio-timeline { display: grid; gap: 0.48rem; margin: 0; padding: 0; list-style: none; }
.conta-studio-timeline li { display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 0.5rem; color: var(--text-secondary); font-size: 0.61rem; }
.conta-studio-timeline-dot { width: 7px; height: 7px; margin-top: 0.2rem; border-radius: 50%; background: var(--color-cyan); }
.conta-studio-timeline strong,
.conta-studio-timeline small { display: block; }
.conta-studio-timeline strong { color: var(--text-primary); font-size: 0.61rem; }
.conta-studio-timeline small { margin-top: 0.12rem; color: var(--text-muted); font: 0.5rem var(--font-mono); }
.conta-studio-actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 0.48rem; padding: 0.66rem 0.75rem; border-top: 1px solid rgba(148, 163, 184, 0.1); background: rgba(8, 13, 24, 0.97); }
.conta-studio-actions.hidden { display: none !important; }

@media (max-width: 1180px) and (min-width: 721px) {
    .conta-studio-workspace.has-detail { grid-template-columns: minmax(0, 1.35fr) minmax(310px, 0.9fr); }
    .conta-studio-table { min-width: 820px; }
}

@media (max-width: 720px) {
    body.conta-studio-data-focus .main-content { padding-top: 0.35rem; }
    body.conta-studio-data-focus .content-header { min-height: 44px; margin-bottom: 0.35rem; padding: 0 0.15rem 0.42rem; }
    body.conta-studio-data-focus .header-title h2 { font-size: 1.05rem; }
    body.conta-studio-data-focus .header-title p { max-width: 95vw; font-size: 0.6rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .conta-studio-view { gap: 0.48rem; }
    .conta-studio-toolbar { grid-template-columns: minmax(0, 1fr) 118px; gap: 0.46rem; padding: 0.5rem; border-radius: 11px; }
    .conta-studio-filter:first-child { grid-column: 1 / -1; }
    .conta-studio-filter .form-control { height: 38px; font-size: 0.68rem; }
    .conta-studio-toolbar-actions { align-self: end; }
    .conta-studio-toolbar-actions .btn { width: 38px; min-width: 38px; height: 38px; padding: 0; }
    .conta-studio-toolbar-actions .btn span { display: none; }
    .conta-studio-status { min-height: 28px; padding: 0.36rem 0.55rem; font-size: 0.61rem; }
    .conta-studio-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .conta-studio-kpis article { padding: 0.5rem 0.62rem; border-bottom: 1px solid rgba(148, 163, 184, 0.1); }
    .conta-studio-kpis article:nth-child(2) { border-right: 0; }
    .conta-studio-kpis article:nth-child(n+3) { border-bottom: 0; }
    .conta-studio-kpis strong { font-size: 0.95rem; }
    .conta-studio-section-head { min-height: 50px; padding: 0.5rem 0.62rem; }
    .conta-studio-section-head h3 { font-size: 0.78rem; }
    .conta-studio-service-state strong { display: none; }
    .conta-studio-table-shell { min-height: 360px; max-height: calc(100vh - 410px); }
    .conta-studio-table { min-width: 860px; font-size: 0.62rem; }
    .conta-studio-table th { padding: 0.5rem 0.56rem; }
    .conta-studio-table td { height: 52px; padding: 0.46rem 0.56rem; }
    .conta-studio-pagination { padding: 0.46rem 0.55rem; }
    .conta-studio-pagination .btn span { display: none; }
    .conta-studio-pagination .btn { width: 34px; min-width: 34px; padding: 0; }
    .conta-studio-workspace.has-detail { grid-template-columns: minmax(0, 1fr); }
    .conta-studio-detail {
        position: fixed;
        z-index: 1200;
        inset: max(8px, env(safe-area-inset-top)) 8px calc(76px + env(safe-area-inset-bottom)) 8px;
        max-height: none;
        border-color: rgba(6, 182, 212, 0.26);
        border-radius: 14px;
        background: #080d18;
        box-shadow: 0 24px 80px rgba(0, 0, 0, 0.72);
    }
    body.conta-studio-detail-open { overflow: hidden; }
    .conta-studio-detail-head { min-height: 54px; }
    .conta-studio-detail-content { padding: 0.62rem; }
    .conta-studio-timeline-section { padding: 0 0.62rem 0.72rem; }
}
/* AIONTA institutional governance: compact, visible and non-authoritative. */
.conta-institution-governance {
    position: relative;
    display: grid;
    grid-template-columns: minmax(250px, 0.82fr) minmax(420px, 1.65fr);
    gap: 0.8rem 1rem;
    padding: 0.95rem;
    overflow: hidden;
    border: 1px solid rgba(6, 182, 212, 0.22);
    border-radius: 14px;
    background:
        radial-gradient(circle at 100% 0, rgba(6, 182, 212, 0.12), transparent 38%),
        linear-gradient(135deg, rgba(10, 20, 36, 0.98), rgba(8, 13, 24, 0.96));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}
.conta-institution-governance::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: linear-gradient(180deg, var(--color-cyan), #10b981);
}
.conta-institution-copy {
    min-width: 0;
    padding-left: 0.35rem;
}
.conta-institution-copy > span {
    color: #67e8f9;
    font: 750 0.55rem/1 var(--font-mono);
    letter-spacing: 0.12em;
}
.conta-institution-copy h2 {
    margin: 0.38rem 0 0;
    color: var(--text-primary);
    font-size: clamp(0.88rem, 1.35vw, 1.08rem);
    line-height: 1.25;
}
.conta-institution-copy p {
    margin: 0.38rem 0 0;
    color: var(--text-secondary);
    font-size: 0.64rem;
    line-height: 1.55;
}
.conta-institution-flow {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.48rem;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: institution-flow;
}
.conta-institution-flow li {
    position: relative;
    min-width: 0;
    padding: 0.62rem 0.56rem 0.58rem 1.9rem;
    border: 1px solid rgba(148, 163, 184, 0.11);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.62);
    counter-increment: institution-flow;
}
.conta-institution-flow li::before {
    content: counter(institution-flow);
    position: absolute;
    top: 0.58rem;
    left: 0.55rem;
    display: grid;
    width: 1rem;
    height: 1rem;
    place-items: center;
    border: 1px solid rgba(6, 182, 212, 0.3);
    border-radius: 50%;
    color: #67e8f9;
    background: rgba(6, 182, 212, 0.08);
    font: 700 0.5rem/1 var(--font-mono);
}
.conta-institution-flow strong,
.conta-institution-flow span {
    display: block;
}
.conta-institution-flow strong {
    color: var(--text-primary);
    font-size: 0.61rem;
    line-height: 1.2;
}
.conta-institution-flow span {
    margin-top: 0.22rem;
    color: var(--text-muted);
    font-size: 0.54rem;
    line-height: 1.35;
}
.conta-institution-legacy {
    grid-column: 1 / -1;
    margin: 0;
    padding: 0.48rem 0.62rem;
    border: 1px solid rgba(249, 115, 22, 0.16);
    border-radius: 9px;
    color: #fdba74;
    background: rgba(249, 115, 22, 0.055);
    font-size: 0.56rem;
    line-height: 1.4;
}

@media (max-width: 1080px) {
    .conta-institution-governance {
        grid-template-columns: minmax(0, 1fr);
    }
    .conta-institution-flow {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .conta-institution-governance {
        gap: 0.62rem;
        padding: 0.72rem;
        border-radius: 12px;
    }
    .conta-institution-copy {
        padding-left: 0.2rem;
    }
    .conta-institution-copy h2 {
        font-size: 0.9rem;
    }
    .conta-institution-copy p {
        font-size: 0.6rem;
    }
    .conta-institution-flow {
        display: flex;
        gap: 0.45rem;
        overflow-x: auto;
        scroll-snap-type: x proximity;
        scrollbar-width: thin;
    }
    .conta-institution-flow li {
        flex: 0 0 min(72vw, 190px);
        scroll-snap-align: start;
    }
    .conta-institution-legacy {
        font-size: 0.52rem;
    }
}

/* AIONTA.FORCE: sala operativa de trabajadores distribuidos. */
.aionta-force-view,
.force-control-room {
    min-width: 0;
}

.force-control-room {
    display: grid;
    gap: 0.72rem;
}

.force-hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 92px;
    padding: 0.88rem 1rem;
    overflow: hidden;
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-radius: 14px;
    background:
        radial-gradient(circle at 86% 0, rgba(59, 130, 246, 0.16), transparent 38%),
        linear-gradient(135deg, rgba(9, 20, 36, 0.98), rgba(8, 13, 24, 0.97));
}

.force-hero::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: linear-gradient(180deg, var(--color-cyan), #10b981);
}

.force-hero-copy {
    min-width: 0;
    padding-left: 0.25rem;
}

.force-hero-copy > span,
.force-section-head > div > span {
    color: #67e8f9;
    font: 750 0.55rem/1 var(--font-mono);
    letter-spacing: 0.12em;
}

.force-hero-copy h2 {
    margin: 0.34rem 0 0;
    color: var(--text-primary);
    font-size: clamp(1.08rem, 2vw, 1.45rem);
}

.force-hero-copy p {
    margin: 0.3rem 0 0;
    color: var(--text-secondary);
    font-size: 0.66rem;
}

.force-hero-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.5rem;
}

.force-service-state {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    min-height: 36px;
    padding: 0.42rem 0.62rem;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 10px;
    color: var(--text-secondary);
    background: rgba(15, 23, 42, 0.65);
    font-size: 0.59rem;
}

.force-service-state > span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #64748b;
}

.force-service-state[data-state="online"] {
    border-color: rgba(16, 185, 129, 0.25);
    color: #a7f3d0;
}

.force-service-state[data-state="online"] > span {
    background: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.65);
}

.force-service-state[data-state="checking"] > span {
    background: var(--color-cyan);
    animation: pulse 1.4s ease-in-out infinite;
}

.force-service-state[data-state="error"] {
    border-color: rgba(239, 68, 68, 0.25);
    color: #fda4af;
}

.force-service-state[data-state="error"] > span {
    background: #ef4444;
}

#force-refresh {
    min-height: 36px;
    padding: 0.42rem 0.62rem;
    font-size: 0.59rem;
}

#force-refresh svg {
    width: 14px;
    height: 14px;
}

#force-refresh.is-loading svg {
    animation: spin 0.9s linear infinite;
}

.force-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.11);
    border-radius: 13px;
    background: rgba(11, 18, 32, 0.82);
}

.force-kpi {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
    padding: 0.72rem 0.85rem;
    border-right: 1px solid rgba(148, 163, 184, 0.1);
}

.force-kpi:last-child {
    border-right: 0;
}

.force-kpi > svg {
    width: 24px;
    height: 24px;
    padding: 0.35rem;
    overflow: visible;
    border-radius: 9px;
    color: #67e8f9;
    background: rgba(6, 182, 212, 0.09);
}

.force-kpi-queue > svg {
    color: #c4b5fd;
    background: rgba(139, 92, 246, 0.09);
}

.force-kpi-failed > svg {
    color: #fda4af;
    background: rgba(239, 68, 68, 0.08);
}

.force-kpi small,
.force-kpi strong,
.force-kpi span {
    display: block;
}

.force-kpi small {
    color: var(--text-muted);
    font-size: 0.54rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.force-kpi strong {
    margin-top: 0.15rem;
    color: var(--text-primary);
    font: 750 1.2rem/1 var(--font-mono);
}

.force-kpi span {
    margin-top: 0.2rem;
    color: var(--text-muted);
    font-size: 0.53rem;
}

.force-safety-rail {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.72rem;
    border: 1px solid rgba(16, 185, 129, 0.16);
    border-radius: 10px;
    color: var(--text-secondary);
    background: rgba(16, 185, 129, 0.045);
}

.force-safety-rail > svg {
    flex: 0 0 auto;
    width: 17px;
    color: #34d399;
}

.force-safety-rail strong,
.force-safety-rail span {
    display: block;
}

.force-safety-rail strong {
    color: #a7f3d0;
    font-size: 0.61rem;
}

.force-safety-rail span {
    margin-top: 0.12rem;
    color: var(--text-muted);
    font-size: 0.55rem;
}

.force-workers-section,
.force-jobs-panel {
    min-width: 0;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.11);
    border-radius: 14px;
    background: rgba(8, 14, 26, 0.78);
}

.force-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    min-height: 54px;
    padding: 0.66rem 0.8rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.force-section-head h3 {
    margin: 0.25rem 0 0;
    color: var(--text-primary);
    font-size: 0.78rem;
}

.force-section-head > small {
    color: var(--text-muted);
    font: 0.53rem var(--font-mono);
}

.force-node-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
    padding: 0.72rem;
}

.force-node-card {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 254px;
    flex-direction: column;
    padding: 0.72rem;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 12px;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.83), rgba(8, 13, 24, 0.9));
}

.force-node-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 2px;
    background: #475569;
}

.force-node-card[data-state="online"]::before {
    background: linear-gradient(90deg, #10b981, #22d3ee);
}

.force-node-card[data-state="busy"]::before {
    background: linear-gradient(90deg, #8b5cf6, #22d3ee);
}

.force-node-card[data-state="warning"]::before {
    background: #f59e0b;
}

.force-node-card[data-state="failed"]::before {
    background: #ef4444;
}

.force-node-head {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.55rem;
}

.force-node-icon {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-radius: 10px;
    color: #67e8f9;
    background: rgba(6, 182, 212, 0.07);
}

.force-node-icon svg {
    width: 17px;
    height: 17px;
}

.force-node-identity {
    min-width: 0;
}

.force-node-identity span {
    color: #67e8f9;
    font: 720 0.52rem/1 var(--font-mono);
    letter-spacing: 0.1em;
}

.force-node-identity h4 {
    margin: 0.25rem 0 0;
    color: var(--text-primary);
    font-size: 0.74rem;
    letter-spacing: 0.035em;
}

.force-node-state {
    padding: 0.28rem 0.42rem;
    border: 1px solid rgba(100, 116, 139, 0.22);
    border-radius: 999px;
    color: var(--text-muted);
    background: rgba(15, 23, 42, 0.65);
    font: 700 0.48rem/1 var(--font-mono);
    white-space: nowrap;
}

.force-node-state[data-state="online"] {
    border-color: rgba(16, 185, 129, 0.25);
    color: #6ee7b7;
    background: rgba(16, 185, 129, 0.08);
}

.force-node-state[data-state="busy"] {
    border-color: rgba(139, 92, 246, 0.28);
    color: #c4b5fd;
    background: rgba(139, 92, 246, 0.08);
}

.force-node-state[data-state="warning"] {
    border-color: rgba(245, 158, 11, 0.28);
    color: #fcd34d;
    background: rgba(245, 158, 11, 0.08);
}

.force-node-state[data-state="failed"] {
    border-color: rgba(239, 68, 68, 0.28);
    color: #fda4af;
    background: rgba(239, 68, 68, 0.08);
}

.force-node-purpose {
    min-height: 28px;
    margin: 0.62rem 0 0;
    color: var(--text-secondary);
    font-size: 0.58rem;
    line-height: 1.45;
}

.force-node-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.38rem;
    margin: 0.56rem 0 0;
}

.force-node-facts div {
    min-width: 0;
    padding: 0.42rem 0.46rem;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.58);
}

.force-node-facts dt {
    color: var(--text-muted);
    font-size: 0.47rem;
    font-weight: 700;
    text-transform: uppercase;
}

.force-node-facts dd {
    margin: 0.2rem 0 0;
    overflow: hidden;
    color: var(--text-secondary);
    font: 0.52rem var(--font-mono);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.force-node-activity {
    margin-top: 0.5rem;
    padding: 0.48rem;
    border: 1px solid rgba(16, 185, 129, 0.14);
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.045);
}

.force-node-activity[data-state="running"] {
    border-color: rgba(139, 92, 246, 0.2);
    background: rgba(139, 92, 246, 0.05);
}

.force-node-activity[data-state="failed"] {
    border-color: rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.05);
}

.force-node-activity > div {
    display: flex;
    justify-content: space-between;
    gap: 0.45rem;
}

.force-node-activity strong {
    color: var(--text-primary);
    font-size: 0.55rem;
}

.force-node-activity span {
    color: #67e8f9;
    font: 700 0.48rem var(--font-mono);
}

.force-node-activity small {
    display: block;
    margin-top: 0.2rem;
    color: var(--text-muted);
    font-size: 0.5rem;
}

.force-node-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 34px;
    margin-top: auto;
    padding-top: 0.55rem;
}

.force-node-action {
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    gap: 0.32rem;
    padding: 0.36rem 0.48rem;
    border: 1px solid rgba(6, 182, 212, 0.22);
    border-radius: 8px;
    color: #a5f3fc;
    background: rgba(6, 182, 212, 0.065);
    font: 700 0.52rem var(--font-primary);
    cursor: pointer;
}

.force-node-action:hover {
    border-color: rgba(6, 182, 212, 0.45);
    background: rgba(6, 182, 212, 0.12);
}

.force-node-action:disabled {
    cursor: wait;
    opacity: 0.55;
}

.force-node-action svg {
    width: 13px;
    height: 13px;
}

.force-readonly-note {
    color: var(--text-muted);
    font-size: 0.5rem;
}

.force-job-list {
    display: grid;
}

.force-job-row {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) minmax(180px, 0.45fr);
    align-items: center;
    gap: 0.58rem;
    min-height: 58px;
    padding: 0.5rem 0.72rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.force-job-row:last-child {
    border-bottom: 0;
}

.force-job-marker {
    display: grid;
    width: 27px;
    height: 27px;
    place-items: center;
    border-radius: 8px;
    color: #6ee7b7;
    background: rgba(16, 185, 129, 0.08);
}

.force-job-row[data-state="running"] .force-job-marker {
    color: #c4b5fd;
    background: rgba(139, 92, 246, 0.08);
}

.force-job-row[data-state="running"] .force-job-marker svg {
    animation: spin 1.1s linear infinite;
}

.force-job-row[data-state="failed"] .force-job-marker {
    color: #fda4af;
    background: rgba(239, 68, 68, 0.08);
}

.force-job-marker svg {
    width: 14px;
    height: 14px;
}

.force-job-copy,
.force-job-meta {
    min-width: 0;
}

.force-job-copy strong,
.force-job-copy span,
.force-job-meta strong,
.force-job-meta span,
.force-job-meta small {
    display: block;
}

.force-job-copy strong {
    color: var(--text-primary);
    font-size: 0.6rem;
}

.force-job-copy span {
    margin-top: 0.16rem;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.53rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.force-job-meta {
    display: grid;
    grid-template-columns: auto auto;
    align-items: center;
    justify-content: end;
    gap: 0.22rem 0.5rem;
    text-align: right;
}

.force-job-meta strong {
    color: #67e8f9;
    font: 700 0.5rem var(--font-mono);
}

.force-job-meta span {
    color: var(--text-secondary);
    font-size: 0.52rem;
}

.force-job-meta small {
    grid-column: 1 / -1;
    color: var(--text-muted);
    font: 0.48rem var(--font-mono);
}

.force-empty-state {
    display: flex;
    min-height: 86px;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    color: var(--text-muted);
    font-size: 0.58rem;
}

.force-empty-state svg {
    width: 16px;
    height: 16px;
}

.force-action-status {
    display: none;
    min-height: 34px;
    align-items: center;
    padding: 0.42rem 0.62rem;
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 9px;
    color: var(--text-secondary);
    font-size: 0.56rem;
}

.force-action-status:not(:empty) {
    display: flex;
}

.force-action-status[data-state="success"] {
    border-color: rgba(16, 185, 129, 0.22);
    color: #a7f3d0;
}

.force-action-status[data-state="error"] {
    border-color: rgba(239, 68, 68, 0.22);
    color: #fda4af;
}

@media (max-width: 1050px) {
    .force-node-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .force-node-card:last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 720px) {
    body.aionta-force-data-focus .main-content {
        padding-top: 0.35rem;
    }

    body.aionta-force-data-focus .content-header {
        min-height: 44px;
        margin-bottom: 0.35rem;
        padding: 0 0.15rem 0.42rem;
    }

    body.aionta-force-data-focus .header-title h2 {
        font-size: 1.05rem;
    }

    body.aionta-force-data-focus .header-title p {
        font-size: 0.58rem;
    }

    .force-control-room {
        gap: 0.48rem;
    }

    .force-hero {
        min-height: 72px;
        padding: 0.65rem 0.7rem;
        border-radius: 11px;
    }

    .force-hero-copy p {
        display: none;
    }

    .force-hero-copy h2 {
        font-size: 0.96rem;
    }

    .force-service-state {
        min-height: 34px;
        max-width: 132px;
        padding: 0.38rem 0.48rem;
    }

    .force-service-state strong {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #force-refresh {
        width: 34px;
        min-width: 34px;
        min-height: 34px;
        padding: 0;
    }

    #force-refresh span {
        display: none;
    }

    .force-kpi {
        gap: 0;
        padding: 0.55rem 0.42rem;
        text-align: center;
    }

    .force-kpi > svg {
        display: none;
    }

    .force-kpi > div {
        width: 100%;
    }

    .force-kpi strong {
        font-size: 1rem;
    }

    .force-kpi span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .force-safety-rail {
        align-items: flex-start;
        padding: 0.48rem 0.55rem;
    }

    .force-safety-rail span {
        line-height: 1.4;
    }

    .force-section-head {
        min-height: 48px;
        padding: 0.52rem 0.6rem;
    }

    .force-section-head > small {
        max-width: 42vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .force-node-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.48rem;
        padding: 0.5rem;
    }

    .force-node-card,
    .force-node-card:last-child {
        grid-column: auto;
        min-height: 232px;
        padding: 0.62rem;
    }

    .force-node-actions {
        min-height: 44px;
    }

    .force-node-action {
        min-height: 40px;
    }

    .force-job-row {
        grid-template-columns: 26px minmax(0, 1fr);
        min-height: 68px;
        padding: 0.48rem 0.58rem;
    }

    .force-job-meta {
        grid-column: 2;
        grid-template-columns: auto auto minmax(0, 1fr);
        justify-content: start;
        text-align: left;
    }

    .force-job-meta small {
        grid-column: auto;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}
