/* ═══════════════════════════════════════════════════════════════
   WINLEDGER CLS — app.css v2.1
   ═══════════════════════════════════════════════════════════════ */

/* ── Variables: OSCURO (default) ────────────────────────────── */
:root,
html.theme-dark {
    --bg: #0d1117;
    --surface: #161b22;
    --surface-2: #21262d;
    --surface-3: #2d333b;
    --border: #30363d;
    --border-2: #444c56;
    --accent: #0078D4;
    --accent-h: #005a9e;
    --accent-soft: rgba(0,120,212,0.12);
    --text: #cdd9e5;
    --text-muted: #768390;
    --text-faint: #4d5566;
    --green: #2ea043;
    --green-soft: rgba(46,160,67,0.15);
    --amber: #d29922;
    --amber-soft: rgba(210,153,34,0.15);
    --red: #da3633;
    --red-soft: rgba(218,54,51,0.15);
    --blue-soft: rgba(0,120,212,0.15);
    --gray-soft: rgba(120,131,144,0.15);
    --code: #79c0ff;
    --shadow: 0 4px 24px rgba(0,0,0,0.45);
}

/* ── Variables: CLARO ──────────────────────────────────────── */
html.theme-light {
    --bg: #f3f4f6;
    --surface: #ffffff;
    --surface-2: #f0f2f5;
    --surface-3: #e4e7ec;
    --border: #d1d5db;
    --border-2: #9ca3af;
    --accent: #0078D4;
    --accent-h: #005a9e;
    --accent-soft: rgba(0,120,212,0.10);
    --text: #111827;
    --text-muted: #6b7280;
    --text-faint: #9ca3af;
    --green: #16a34a;
    --green-soft: rgba(22,163,74,0.12);
    --amber: #d97706;
    --amber-soft: rgba(217,119,6,0.12);
    --red: #dc2626;
    --red-soft: rgba(220,38,38,0.12);
    --blue-soft: rgba(0,120,212,0.10);
    --gray-soft: rgba(107,114,128,0.12);
    --code: var(--accent);
    --shadow: 0 4px 24px rgba(0,0,0,0.10);
}

/* ── Tokens base ────────────────────────────────────────────── */
:root {
    --radius: 8px;
    --radius-lg: 12px;
    --topbar-h: 52px;
    --sidebar-w-expanded: 230px;
    --sidebar-w-collapsed: 48px;
    --sidebar-transition: width 0.22s cubic-bezier(0.4,0,0.2,1);
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'Consolas', 'Cascadia Code', monospace;
}

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

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background 0.25s, color 0.25s;
}

a {
    color: var(--accent);
    text-decoration: none;
}

    a:hover {
        text-decoration: underline;
    }

/* ═══════════════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════════════ */
.layout-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w-expanded);
    min-width: var(--sidebar-w-expanded);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
    transition: var(--sidebar-transition), background 0.25s, border-color 0.25s;
}

.sidebar-collapsed .sidebar {
    width: var(--sidebar-w-collapsed);
    min-width: var(--sidebar-w-collapsed);
}

/* ── Sidebar brand ──────────────────────────────────────────── */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    overflow: hidden;
    white-space: nowrap;
    height: var(--topbar-h);
    min-height: var(--topbar-h);
    flex-shrink: 0;
    user-select: none;
    transition: background 0.15s;
}

    .sidebar-brand:hover {
        background: var(--surface-2);
    }

.brand-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
    display: none;
}

.brand-logo {
    height: 30px;
    max-width: 150px;
    object-fit: contain;
    flex: 1;
    min-width: 0;
    display: block;
}

html.theme-light .brand-logo {
    content: url('/images/logo-color.png');
}

.brand-toggle {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-faint);
    flex-shrink: 0;
    margin-left: auto;
    font-family: monospace;
}

.sidebar-collapsed .brand-icon {
    display: block;
}

.sidebar-collapsed .brand-logo {
    display: none;
}

.sidebar-collapsed .brand-toggle {
    display: none;
}

.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    padding: 12px 0;
}

/* ── Nav links ──────────────────────────────────────────────── */
.nav-links {
    padding: 8px 6px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-decoration: none;
    position: relative;
    transition: background 0.12s, color 0.12s;
}

    .nav-link:hover {
        background: var(--surface-2);
        color: var(--text);
        text-decoration: none;
    }

    .nav-link.active {
        background: var(--accent-soft);
        color: var(--accent);
    }

.nav-icon {
    flex-shrink: 0;
    width: 24px;
    text-align: center;
    font-size: 16px;
}

.nav-icon-svg {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
}

/* Ícono de sección: oculto en expandido, visible solo al colapsar el sidebar */
.nav-section-icon {
    display: none;
    flex-shrink: 0;
}

.sidebar-collapsed .nav-section-icon {
    display: block;
    width: 18px;
    height: 18px;
}

.nav-label {
    overflow: hidden;
    white-space: nowrap;
}

/* ── v19 — Badges del menú lateral (Tickets, Panel SLA, Alertas) ──────────── */
.nav-badge {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--amber);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    flex-shrink: 0;
}

    .nav-badge.nav-badge--red {
        background: var(--red);
    }

/* En modo colapsado el badge se oculta — el ícono solo no debe empujar nada */
.sidebar-collapsed .nav-badge {
    display: none;
}

.nav-section-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 12px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-faint);
    white-space: nowrap;
    overflow: hidden;
}

/* v17.1: secciones colapsables — el label clicable */
.nav-section-toggle {
    cursor: pointer;
    user-select: none;
    transition: color 0.12s;
}

    .nav-section-toggle:hover {
        color: var(--text-muted);
    }

.nav-section-arrow {
    font-size: 9px;
    width: 10px;
    text-align: center;
    opacity: 0.55;
    transition: opacity 0.12s;
    line-height: 1;
}

.nav-section-toggle:hover .nav-section-arrow {
    opacity: 1;
}

/* En sidebar colapsado (texto oculto), no mostrar la flecha */
.sidebar-collapsed .nav-section-arrow {
    display: none;
}

.nav-section-items {
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow: hidden;
    transition: max-height 0.18s ease;
}

    .nav-section-items.collapsed {
        max-height: 0 !important;
        margin: 0;
    }

.sidebar-collapsed .nav-links {
    overflow: visible;
}

.sidebar-collapsed .nav-link {
    justify-content: center;
    padding: 10px 0;
    overflow: visible;
}

.sidebar-collapsed .nav-label {
    display: none;
}

.sidebar-collapsed .nav-section-label {
    padding: 8px 0;
    justify-content: center;
}

    .sidebar-collapsed .nav-section-label span:not(.nav-tooltip) {
        display: none;
    }

    .sidebar-collapsed .nav-section-label::after {
        display: none;
    }

/* ── Nav footer ─────────────────────────────────────────────── */
.nav-footer {
    padding: 12px 10px;
    border-top: 1px solid var(--border);
    overflow: hidden;
}

.nav-version {
    font-size: 11px;
    color: var(--text-faint);
    white-space: nowrap;
}

.sidebar-collapsed .nav-footer {
    padding: 12px 0;
    text-align: center;
}

.sidebar-collapsed .nav-version {
    display: none;
}

/* ── Tooltip (colapsado desktop) ────────────────────────────── */
.nav-tooltip {
    display: none;
}

.sidebar-collapsed .nav-link .nav-tooltip,
.sidebar-collapsed .nav-section-label .nav-tooltip {
    display: block;
    position: fixed;
    left: calc(var(--sidebar-w-collapsed) + 12px);
    background: var(--surface-3);
    color: var(--text);
    font-size: 12.5px;
    font-weight: 500;
    padding: 7px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border-2);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.35);
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 9999;
    transform: translateX(-8px);
}

    .sidebar-collapsed .nav-link .nav-tooltip::before,
    .sidebar-collapsed .nav-section-label .nav-tooltip::before {
        content: '';
        position: absolute;
        left: -6px;
        top: 50%;
        transform: translateY(-50%);
        border: 6px solid transparent;
        border-left: 0;
        border-right-color: var(--border-2);
    }

    .sidebar-collapsed .nav-link .nav-tooltip::after,
    .sidebar-collapsed .nav-section-label .nav-tooltip::after {
        content: '';
        position: absolute;
        left: -4px;
        top: 50%;
        transform: translateY(-50%);
        border: 5px solid transparent;
        border-left: 0;
        border-right-color: var(--surface-3);
    }

.sidebar-collapsed .nav-link:hover .nav-tooltip,
.sidebar-collapsed .nav-section-label:hover .nav-tooltip {
    opacity: 1;
    transform: translateX(0);
}

.sidebar-expanded .nav-tooltip {
    display: none !important;
}

/* ── Botones sidebar ────────────────────────────────────────── */
.sidebar-close {
    display: none !important;
}

.hamburger {
    display: none !important;
}

/* ── Main content ───────────────────────────────────────────── */
.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    min-height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    transition: background 0.25s, border-color 0.25s;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.topbar-user {
    font-size: 13px;
    color: var(--text-muted);
}

.theme-toggle {
    font-size: 16px !important;
    width: 32px !important;
    height: 32px !important;
}

.btn-logout {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: var(--radius);
    padding: 5px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    font-family: var(--font);
}

    .btn-logout:hover {
        border-color: var(--border-2);
        color: var(--text);
    }

/* ── Page body ──────────────────────────────────────────────── */
.page-body {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
}

/* ── Overlay móvil ──────────────────────────────────────────── */
.sidebar-overlay {
    display: none;
}

/* ═══════════════════════════════════════════════════════════════
   COMPONENTES
   ═══════════════════════════════════════════════════════════════ */

/* ── Page header ────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.page-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}

.page-subtitle {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* ── Cards ──────────────────────────────────────────────────── */
.section-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    transition: background 0.25s, border-color 0.25s;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

/* ── Stats ──────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: background 0.25s, border-color 0.25s;
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.stat-blue {
    background: var(--blue-soft);
    color: var(--accent);
}

.stat-green {
    background: var(--green-soft);
    color: var(--green);
}

.stat-amber {
    background: var(--amber-soft);
    color: var(--amber);
}

.stat-red {
    background: var(--red-soft);
    color: var(--red);
}

.stat-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Table ──────────────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

    .data-table th {
        text-align: left;
        padding: 10px 14px;
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.6px;
        color: var(--text-muted);
        border-bottom: 1px solid var(--border);
    }

    .data-table td {
        padding: 11px 14px;
        border-bottom: 1px solid var(--border);
        vertical-align: middle;
    }

    .data-table tbody tr:hover td {
        background: var(--surface-2);
    }

    .data-table tbody tr:last-child td {
        border-bottom: none;
    }

.row-revocada td {
    opacity: 0.5;
}

.table-info {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.actions-cell {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ── Forms ──────────────────────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
}

.form-input {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font);
    font-size: 13.5px;
    padding: 9px 12px;
    width: 100%;
    outline: none;
    appearance: none;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.25s;
}

    .form-input:focus {
        border-color: var(--accent);
        box-shadow: 0 0 0 3px rgba(0,120,212,0.15);
    }

    .form-input::placeholder {
        color: var(--text-faint);
    }

    .form-input[type="date"]::-webkit-calendar-picker-indicator {
        filter: invert(0.6);
        cursor: pointer;
    }

html.theme-light .form-input[type="date"]::-webkit-calendar-picker-indicator {
    filter: none;
}

textarea.form-input {
    resize: vertical;
    min-height: 70px;
}

.form-hint {
    font-size: 11.5px;
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.validation-msg {
    font-size: 11.5px;
    color: var(--red);
    margin-top: 2px;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 9px 18px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s;
    font-family: var(--font);
}

    .btn-primary:hover {
        background: var(--accent-h);
        text-decoration: none;
        color: #fff;
    }

    .btn-primary:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 9px 18px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    font-family: var(--font);
}

    .btn-ghost:hover {
        background: var(--surface-2);
        color: var(--text);
        border-color: var(--border-2);
        text-decoration: none;
    }

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--red);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 9px 18px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
    font-family: var(--font);
}

    .btn-danger:hover {
        opacity: 0.85;
    }

.btn-icon {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    width: 30px;
    height: 30px;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, color 0.12s;
    text-decoration: none;
}

    .btn-icon:hover {
        background: var(--surface-2);
        color: var(--text);
        border-color: var(--border-2);
        text-decoration: none;
    }

.btn-danger-icon:hover {
    background: var(--red-soft);
    color: var(--red);
    border-color: var(--red);
}

.btn-copy {
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    padding: 5px 12px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.12s, color 0.12s;
    font-family: var(--font);
}

    .btn-copy:hover {
        background: var(--border);
        color: var(--text);
    }

.btn-chip {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-muted);
    padding: 3px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    font-family: var(--font);
}

    .btn-chip:hover {
        background: var(--accent-soft);
        color: var(--accent);
        border-color: var(--accent);
    }

/* ── Botón pequeño ──────────────────────────────────────────── */
.btn-sm {
    font-size: 12.5px;
    padding: 6px 14px;
}

.w-full {
    width: 100%;
}

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-green {
    background: var(--green-soft);
    color: #3fb950;
}

.badge-amber {
    background: var(--amber-soft);
    color: #e3b341;
}

.badge-red {
    background: var(--red-soft);
    color: #f85149;
}

.badge-blue {
    background: var(--blue-soft);
    color: #79c0ff;
}

.badge-gray {
    background: var(--gray-soft);
    color: var(--text-muted);
}

html.theme-light .badge-green {
    color: #16a34a;
}

html.theme-light .badge-amber {
    color: #d97706;
}

html.theme-light .badge-red {
    color: #dc2626;
}

html.theme-light .badge-blue {
    color: #0078D4;
}

/* ── Modals ─────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(1,4,9,0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
    padding: 20px;
}

html.theme-light .modal-overlay {
    background: rgba(0,0,0,0.45);
}

.modal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: var(--shadow);
}

.modal-sm {
    max-width: 380px;
}

.modal-lg {
    max-width: 860px;
    width: 90vw;
}

.modal-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 18px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}


/* ── Modal header: título arriba, acciones centradas abajo ─── */
.modal-header-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 18px;
    gap: 10px;
}

.modal-header-row__actions {
    width: 100%;
    display: flex;
    justify-content: center;
}
/* ── Pestañas dentro del modal ──────────────────────────────── */
.modal-tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    margin-top: -4px;
}

.modal-tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-family: var(--font);
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: -1px;
    padding: 8px 16px;
    transition: color 0.15s, border-color 0.15s;
}

    .modal-tab-btn:hover {
        color: var(--text);
    }

    .modal-tab-btn.active {
        border-bottom-color: var(--accent);
        color: var(--accent);
        font-weight: 600;
    }

/* ── Toolbar sección contactos ──────────────────────────────── */
.contactos-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

/* ── Toggle / checkbox label ────────────────────────────────── */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13.5px;
    color: var(--text);
    padding: 8px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.15s;
    user-select: none;
}

    .toggle-label:hover {
        border-color: var(--accent);
    }

    .toggle-label input[type="checkbox"] {
        width: 16px;
        height: 16px;
        accent-color: var(--accent);
        cursor: pointer;
        flex-shrink: 0;
    }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert-error {
    background: var(--red-soft);
    border: 1px solid rgba(218,54,51,0.3);
    border-radius: var(--radius);
    color: #f85149;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 12px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.alert-success {
    background: var(--green-soft);
    border: 1px solid rgba(46,160,67,0.3);
    border-radius: var(--radius);
    color: #3fb950;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 12px;
    display: flex;
    gap: 8px;
    align-items: center;
}

    /* El botón X dentro de un alert va al final del flex, vertical-centrado */
    .alert-error > .btn-icon,
    .alert-success > .btn-icon,
    .alert-info > .btn-icon {
        margin-left: auto;
        flex-shrink: 0;
        color: inherit;
        opacity: 0.7;
    }

        .alert-error > .btn-icon:hover,
        .alert-success > .btn-icon:hover,
        .alert-info > .btn-icon:hover {
            opacity: 1;
        }

/* ── Error boundary ─────────────────────────────────────────── */
.error-boundary-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 32px;
    text-align: center;
    max-width: 500px;
    margin: 40px auto;
}

.error-boundary-icon {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--amber);
}

.error-boundary-panel h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.error-boundary-panel p {
    color: var(--text-muted);
    margin-bottom: 20px;
    font-size: 13px;
}

/* ── Reconnect modal ────────────────────────────────────────── */
.reconnect-overlay {
    position: fixed;
    inset: 0;
    background: rgba(1,4,9,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.reconnect-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 48px;
    text-align: center;
    box-shadow: var(--shadow);
    max-width: 360px;
    width: 100%;
}

    .reconnect-card h3 {
        font-size: 17px;
        font-weight: 600;
        color: var(--text);
        margin: 16px 0 8px;
    }

    .reconnect-card p {
        font-size: 13px;
        color: var(--text-muted);
        margin-bottom: 20px;
    }

.reconnect-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto;
    border: 3px solid var(--border-2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: wl-spin 0.9s linear infinite;
}

@keyframes wl-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── 404 ────────────────────────────────────────────────────── */
.not-found {
    text-align: center;
    padding: 80px 20px;
}

.not-found-code {
    font-size: 72px;
    font-weight: 800;
    color: var(--border-2);
    line-height: 1;
    margin-bottom: 16px;
}

.not-found h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.not-found p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* ── Login ──────────────────────────────────────────────────── */
.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 20px;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 42px 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}

.login-brand {
    margin-bottom: 6px;
}

.login-logo {
    height: 34px;
    max-width: 180px;
    object-fit: contain;
}

html.theme-light .login-logo {
    content: url('/images/logo-color.png');
}

.login-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin: 16px 0 4px;
}

.login-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* ── Campo de contraseña con botón ver/ocultar ──────────────── */
.password-wrap {
    position: relative;
    display: block;
    width: 100%;
}

    /* El input necesita espacio a la derecha para no chocar con el ojito */
    .password-wrap .form-input {
        padding-right: 42px;
        width: 100%;
        display: block;
    }

.password-toggle {
    position: absolute;
    top: 50%;
    right: 4px;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 6px;
    transition: color 0.12s, background 0.12s;
    z-index: 2;
}

    .password-toggle:hover {
        color: var(--text);
        background: var(--surface-3, rgba(255,255,255,0.05));
    }

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

    .password-toggle svg {
        display: block;
        pointer-events: none;
    }

/* ── v19 — Checklist en vivo de la política de contraseñas ──────── */
.password-rules {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-top: 4px;
    margin-bottom: 14px;
}

.password-rules-title {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 8px;
}

.password-rules-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

    .password-rules-list li {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 12.5px;
        color: var(--text-muted);
        transition: color 0.15s;
    }

        .password-rules-list li.ok {
            color: var(--green, #2ea043);
        }

        /* El SVG dentro del li hereda el color del padre via currentColor */
        .password-rules-list li svg {
            flex-shrink: 0;
        }

/* ═══════════════════════════════════════════════════════════════════════════
   v19 — Módulo de Reportes (/reportes)
   ═══════════════════════════════════════════════════════════════════════════ */

.reportes-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 16px;
    align-items: flex-start;
}

@media (max-width: 900px) {
    .reportes-layout {
        grid-template-columns: 1fr;
    }
}

/* ── Sidebar de catálogo ─────────────────────────────────────── */
.reportes-sidebar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
}

.reportes-group-title {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    padding: 8px 4px 4px;
    margin-top: 4px;
}

    .reportes-group-title:first-child {
        margin-top: 0;
    }

.reportes-list {
    list-style: none;
    padding: 0;
    margin: 0 0 4px 0;
}

    .reportes-list li {
        list-style: none;
        margin: 0;
        padding: 0;
    }

.reportes-item {
    width: 100%;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: var(--text);
    font-size: 13px;
    padding: 8px 10px;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    font-family: inherit;
}

    .reportes-item:hover {
        background: var(--surface-2);
    }

    .reportes-item.active {
        background: var(--accent-soft, rgba(0,120,212,0.12));
        border-color: var(--accent);
        color: var(--accent);
        font-weight: 600;
    }

/* ── Panel principal ─────────────────────────────────────────── */
.reportes-main {
    min-width: 0;
}

.reportes-empty {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

    .reportes-empty h3 {
        font-size: 16px;
        font-weight: 600;
        color: var(--text);
        margin: 12px 0 4px 0;
    }

    .reportes-empty p {
        font-size: 13px;
        margin: 0;
    }

.reportes-filtros {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.reportes-acciones {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* Range de fechas en filtros */
.rango-fechas {
    display: flex;
    align-items: center;
    gap: 8px;
}

    .rango-fechas .form-input {
        flex: 1;
    }

/* ═══════════════════════════════════════════════════════════════════════════
   v19 — Módulo Desempeño de Agentes (/monitoreo/desempeno-agentes)
   ═══════════════════════════════════════════════════════════════════════════ */

.desempeno-filtros {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    justify-content: space-between;
}

.quick-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.rango-custom {
    display: flex;
    align-items: center;
    gap: 6px;
}

    .rango-custom .form-input {
        width: 150px;
    }

/* Chip activo cuando se selecciona un período rápido */
.btn-chip.chip-active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Filas clickeables de la tabla */
.row-clickable {
    cursor: pointer;
    transition: background 0.12s;
}

    .row-clickable:hover {
        background: var(--surface-2);
    }

/* Variantes de stat-card por estado del SLA */
.stat-card.stat-warn {
    border-left: 3px solid var(--amber, #f59e0b);
}

.stat-card.stat-alert {
    border-left: 3px solid var(--red, #ef4444);
    background: rgba(239, 68, 68, 0.05);
}

.stat-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Modal más ancho para el drilldown de tickets */
.modal-card.modal-lg {
    max-width: 1100px;
    width: 95vw;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

/* Mensaje de carga genérico */
.loading-message {
    text-align: center;
    color: var(--text-muted);
    padding: 32px 16px;
    font-size: 14px;
}

/* Tabla del módulo — texto un poco más compacto */
.desempeno-table th,
.desempeno-table td {
    padding: 8px 10px;
    font-size: 13px;
}

/* ── Licencias / HW ID ──────────────────────────────────────── */
.hw-id {
    font-family: var(--font-mono);
    font-size: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 7px;
    color: #79c0ff;
    letter-spacing: 1.2px;
}

html.theme-light .hw-id {
    color: var(--accent);
}

.hw-input {
    font-family: var(--font-mono) !important;
    letter-spacing: 2px;
}

/* ── Key display ────────────────────────────────────────────── */
.key-display {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

    .key-display code {
        font-family: var(--font-mono);
        font-size: 11px;
        color: #79c0ff;
        word-break: break-all;
        line-height: 1.7;
        flex: 1;
    }

html.theme-light .key-display code {
    color: var(--accent);
}

.key-display-label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

/* ── Generar licencia ───────────────────────────────────────── */
.gen-layout {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 24px;
    align-items: start;
}

.gen-result-panel {
    position: sticky;
    top: 0;
}

.result-placeholder {
    background: var(--surface);
    border: 1px dashed var(--border-2);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
}

.result-placeholder-icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.result-detail {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    gap: 12px;
}

    .detail-row:last-child {
        border-bottom: none;
    }

.detail-label {
    font-size: 11.5px;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ── Filters ────────────────────────────────────────────────── */
.filters-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 16px;
}

.quick-dates {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* ── Modules ────────────────────────────────────────────────── */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 8px;
}

.module-check {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    padding: 7px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.12s;
}

    .module-check:hover {
        border-color: var(--accent);
    }

    .module-check input[type="checkbox"] {
        width: 15px;
        height: 15px;
        accent-color: var(--accent);
        cursor: pointer;
    }

/* ── Misc ───────────────────────────────────────────────────── */
.text-muted {
    color: var(--text-muted);
}

.text-amber {
    color: var(--amber);
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
    font-size: 13.5px;
}

.loading-spinner {
    text-align: center;
    color: var(--text-muted);
    padding: 32px;
    font-size: 13.5px;
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-2);
    border-radius: 3px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: var(--text-faint);
    }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
    .hamburger {
        display: flex !important;
    }

    .sidebar-close {
        display: flex !important;
        position: absolute;
        top: 12px;
        right: 12px;
        z-index: 10;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: var(--sidebar-w-expanded) !important;
        min-width: var(--sidebar-w-expanded) !important;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
        box-shadow: 4px 0 24px rgba(0,0,0,0.35);
        overflow: hidden;
    }

    .sidebar-mobile-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.55);
        z-index: 199;
        backdrop-filter: blur(2px);
    }

    .sidebar-mobile-open .sidebar-overlay {
        display: block;
    }

    .sidebar-collapsed .nav-label {
        display: block !important;
    }

    .sidebar-collapsed .nav-link {
        justify-content: flex-start !important;
        padding: 8px 10px !important;
        overflow: hidden !important;
    }

    .sidebar-collapsed .brand-logo {
        display: block !important;
    }

    .sidebar-collapsed .brand-icon {
        display: none !important;
    }

    .sidebar-collapsed .brand-toggle {
        display: block !important;
    }

    .sidebar-collapsed .sidebar-brand {
        justify-content: flex-start !important;
        padding: 12px 10px !important;
    }

    .sidebar-collapsed .nav-section-label::after {
        display: none !important;
    }

    .sidebar-collapsed .nav-section-icon {
        display: none !important;
    }

    .sidebar-collapsed .nav-section-label .nav-label {
        display: block !important;
    }

    .sidebar-collapsed .nav-version {
        display: block !important;
    }

    .nav-tooltip {
        display: none !important;
    }

    .stats-grid {
        grid-template-columns: repeat(2,1fr);
    }

    .gen-layout {
        grid-template-columns: 1fr;
    }

    .topbar-user-hide {
        display: none;
    }
}

@media (max-width: 767px) {
    .page-body {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 14px;
        gap: 10px;
    }

    .stat-value {
        font-size: 22px;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 15px;
    }

    .section-card {
        padding: 14px;
        overflow-x: auto;
    }

    .data-table {
        min-width: 580px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .modal-card {
        max-width: 100%;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-height: 92vh;
        padding: 24px 20px;
    }

    .modal-sm {
        max-width: 100%;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

        .page-header .btn-primary {
            width: 100%;
            justify-content: center;
        }

    .filters-bar {
        flex-direction: column;
        gap: 8px;
    }

        .filters-bar .form-input {
            width: 100% !important;
            max-width: 100% !important;
        }

    .topbar {
        padding: 0 14px;
    }

    .topbar-title {
        font-size: 13px;
    }

    .login-card {
        padding: 32px 24px;
    }

    .gen-result-panel {
        position: static;
    }

    .gen-layout {
        gap: 16px;
    }

    .actions-cell {
        gap: 4px;
    }
}

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

    .page-body {
        padding: 12px;
    }
}

@media (hover: none) and (pointer: coarse) {
    .btn-icon {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }

    .nav-link {
        padding: 11px 12px;
    }

    /* v17.1: header de sección colapsable más cómodo para touch */
    .nav-section-toggle {
        padding-top: 16px;
        padding-bottom: 10px;
    }

    .nav-section-arrow {
        font-size: 11px;
    }

    .form-input {
        padding: 11px 12px;
        font-size: 15px;
    }

    .btn-primary, .btn-ghost, .btn-danger {
        padding: 11px 18px;
        font-size: 14px;
    }

    .data-table td {
        padding: 13px 14px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   SELECT NATIVO MEJORADO
   ═══════════════════════════════════════════════════════════════ */

select.form-input {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23768390' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

html.theme-light select.form-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

select.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0,120,212,0.15);
    outline: none;
}

select.form-input:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

select.form-input option {
    background: var(--surface-2);
    color: var(--text);
    padding: 6px 12px;
}

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

.select-down[size]:not([size="1"]) {
    appearance: auto;
    -webkit-appearance: auto;
    background-image: none;
    padding-right: 12px;
    height: auto;
    overflow-y: auto;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0,120,212,0.15);
    border-radius: var(--radius);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 500;
    background: var(--surface);
    max-height: 220px;
}

.select-down[size="1"] {
    position: static;
}

/* ── Input number ───────────────────────────────────────────── */
input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

    input[type="number"]::-webkit-outer-spin-button,
    input[type="number"]::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }

/* ── Input pequeño ──────────────────────────────────────────── */
.form-input-sm {
    padding: 6px 10px;
    font-size: 12.5px;
}

/* ── Blazor EditForm ────────────────────────────────────────── */
.valid.modified {
    outline: none;
}

.invalid {
    border-color: var(--red) !important;
}

/* ── FocusOnNavigate — quitar outline del h1 al navegar ────── */
h1:focus, h1:focus-visible {
    outline: none;
}

/* ── SvgIcon ────────────────────────────────────────────────── */
.svg-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    flex-shrink: 0;
    pointer-events: none;
    line-height: 1;
}

/* ═══════════════════════════════════════════════════════════════
   SISTEMAS LICENCIADOS
   ═══════════════════════════════════════════════════════════════ */
.sistemas-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.sistema-row {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.15s;
}

.sistema-row--active {
    border-color: var(--accent);
}

.sistema-row__header {
    padding: 10px 14px;
    background: var(--surface-2);
}

.sistema-check {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13.5px;
    color: var(--text);
    user-select: none;
}

    .sistema-check input[type="checkbox"] {
        width: 16px;
        height: 16px;
        accent-color: var(--accent);
        cursor: pointer;
        flex-shrink: 0;
    }

.sistema-row__config {
    padding: 12px 14px;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 12px;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

@media (max-width: 600px) {
    .sistema-row__config {
        grid-template-columns: 1fr 1fr;
    }
}

/* ═══════════════════════════════════════════════════════════════
   DETALLE CONTRATO — Tarjetas de licenciamiento
   ═══════════════════════════════════════════════════════════════ */
.lic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 4px;
}

.lic-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: border-color 0.15s;
}

    .lic-card:hover {
        border-color: var(--border-2);
    }

.lic-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    gap: 10px;
}

.lic-card__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    overflow: hidden;
}

    .lic-card__title strong {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

.lic-card__body {
    padding: 14px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lic-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    padding: 4px 0;
    border-bottom: 1px solid var(--border);
}

    .lic-stat:last-of-type {
        border-bottom: none;
    }

.lic-stat__label {
    color: var(--text-muted);
    font-size: 12px;
}

.lic-stat__value {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.lic-card__footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}

    .lic-card__footer .btn-primary {
        flex: 1;
        text-align: center;
    }

/* ═══════════════════════════════════════════════════════════════
   TIPOS LICENCIA — Reglas
   ═══════════════════════════════════════════════════════════════ */
.reglas-base-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.reglas-extra-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
}

.regla-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
}

.regla-card--base {
    border-left: 3px solid var(--accent);
}

.regla-card__clave {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.regla-card__valor {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
}

.reglas-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.reglas-section__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
}

.regla-extra-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

/* ═══════════════════════════════════════════════════════════════
   ALERT BANNER — Dashboard
   ═══════════════════════════════════════════════════════════════ */
.alert-banner {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alert-banner__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13.5px;
    border: 1px solid;
}

.alert-banner--amber {
    background: var(--amber-soft);
    border-color: rgba(210,153,34,0.35);
    color: var(--amber);
}

.alert-banner--red {
    background: var(--red-soft);
    border-color: rgba(218,54,51,0.35);
    color: #f85149;
}

.alert-banner__item span {
    flex: 1;
    color: var(--text);
}

.alert-banner__item strong {
    color: inherit;
}

.alert-banner__link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12.5px;
    font-weight: 600;
    color: inherit;
    white-space: nowrap;
    text-decoration: none;
    opacity: 0.9;
}

    .alert-banner__link:hover {
        opacity: 1;
        text-decoration: underline;
    }

.row-urgente td {
    background: rgba(218,54,51,0.04);
}

.row-urgente:hover td {
    background: rgba(218,54,51,0.08) !important;
}

.btn-refresh {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    font-family: var(--font);
}

    .btn-refresh:hover {
        background: var(--accent-h);
    }

/* ═══════════════════════════════════════════════════════════════
   PAGINADOR
   ═══════════════════════════════════════════════════════════════ */
.paginador {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 4px;
    flex-wrap: wrap;
}

.paginador__info {
    font-size: 12.5px;
    color: var(--text-muted);
    white-space: nowrap;
}

.paginador__controles {
    display: flex;
    align-items: center;
    gap: 3px;
}

.paginador__btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-muted);
    font-size: 12.5px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    font-family: var(--font);
}

    .paginador__btn:hover {
        background: var(--surface-2);
        color: var(--text);
        border-color: var(--border-2);
    }

.paginador__btn--active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    font-weight: 600;
}

.paginador__ellipsis {
    padding: 0 4px;
    color: var(--text-faint);
    font-size: 13px;
    user-select: none;
}

.paginador__size {
    width: 130px !important;
    font-size: 12.5px;
    padding: 6px 10px;
}

/* ═══════════════════════════════════════════════════════════════
   ROLES — Chips de permisos
   ═══════════════════════════════════════════════════════════════ */
.permiso-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 12px;
}

.permiso-chip__modulo {
    font-weight: 600;
    color: var(--accent);
}

.permiso-chip__acciones {
    color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   PERFIL DE USUARIO — v9.0 (MFA + Tabs + Detalle)
   ═══════════════════════════════════════════════════════════════════════════ */

.perfil-wrapper {
    max-width: 860px;
    margin: 0 auto;
}

.perfil-card {
    margin-top: 16px;
    width: 100%;
}

.perfil-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border);
}

.tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    padding: 10px 18px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font);
    transition: color .15s,border-color .15s;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: -1px;
}

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

    .tab-btn.active {
        color: var(--accent);
        border-bottom-color: var(--accent);
    }

.detail-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
    gap: 16px;
}

    .detail-item:last-child {
        border-bottom: none;
    }

.detail-label {
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
    min-width: 140px;
}

.detail-value {
    font-size: 13.5px;
    color: var(--text);
    text-align: right;
}

.alert-success {
    background: var(--green-soft);
    border: 1px solid rgba(46,160,67,.3);
    border-radius: var(--radius);
    color: #3fb950;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 12px;
}

.mfa-setup-steps {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.mfa-step {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.mfa-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 2px;
}

.mfa-step-body {
    flex: 1;
}

.mfa-step-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MÓDULO SOPORTE — v10.0
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Layout detalle de ticket ────────────────────────────────────────────── */
.ticket-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    align-items: start;
}

@media (max-width: 1100px) {
    .ticket-layout {
        grid-template-columns: 1fr;
    }
}

.ticket-main {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ticket-sidebar {
    position: sticky;
    top: 0;
}

/* ── Comentarios ─────────────────────────────────────────────────────────── */
.ticket-comment {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 10px;
}

.comment-interno {
    background: rgba(210, 153, 34, 0.06);
    border-color: rgba(210, 153, 34, 0.25);
}

.comment-agente .comment-autor {
    color: var(--accent);
}

.comment-cliente .comment-autor {
    color: #3fb950;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.comment-autor {
    font-weight: 600;
    font-size: 13px;
}

.comment-fecha {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: auto;
}

.comment-body {
    font-size: 13.5px;
    color: var(--text);
    line-height: 1.7;
    white-space: pre-wrap;
}

/* ── Colores utilitarios para reporte ────────────────────────────────────── */
.text-red {
    color: var(--red) !important;
    font-weight: 600;
}

.text-amber {
    color: var(--amber) !important;
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PANEL SLA — v11.0
   ═══════════════════════════════════════════════════════════════════════════ */

/* Filas con estado crítico */
.row-sla-vencido td {
    background: rgba(218, 54, 51, 0.06);
}

.row-sla-riesgo td {
    background: rgba(210, 153, 34, 0.06);
}

/* Barra de progreso SLA */
.sla-bar-bg {
    height: 6px;
    background: var(--surface-3);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 2px;
}

.sla-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.sla-bar-green {
    background: var(--green);
}

.sla-bar-amber {
    background: var(--amber);
}

.sla-bar-red {
    background: var(--red);
}

/* Chip de filtro activo */
.chip-activo {
    background: var(--accent-soft) !important;
    color: var(--accent) !important;
    border-color: var(--accent) !important;
}

/* ── Tabla de contactos dentro de modal ─────────────────────────────────── */
.contactos-table-wrap {
    overflow-x: auto;
    margin: 0 -28px;
    padding: 0 28px;
}

.contactos-table {
    min-width: 700px;
}

.modal-lg .modal-body-scroll {
    overflow-x: auto;
}

/* ═══════════════════════════════════════════════════════════════
   v16 área 3 (extra) — Portado del portal cliente
   Conversación tipo chat + Timeline de historial
   ═══════════════════════════════════════════════════════════════ */

/* ── Caja de comentario nuevo ─────────────────────────────────── */
.comment-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 16px;
}

    .comment-box textarea {
        width: 100%;
        background: var(--surface-2);
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        padding: 10px 12px;
        color: var(--text);
        font-family: inherit;
        font-size: 13.5px;
        line-height: 1.5;
        resize: vertical;
        min-height: 80px;
    }

        .comment-box textarea:focus {
            outline: none;
            border-color: var(--accent);
        }

/* ── Chat (conversación tipo Slack/WhatsApp) ──────────────────────── */
.chat {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.chat-msg {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 88%;
}

    .chat-msg.is-cliente {
        align-self: flex-start;
        align-items: flex-start;
    }

    .chat-msg.is-agente {
        align-self: flex-end;
        align-items: flex-end;
    }

.chat-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
}

.chat-author {
    font-weight: 600;
    color: var(--text);
}

.chat-role {
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 10.5px;
    font-weight: 600;
}

.chat-msg.is-agente .chat-role {
    background: var(--accent-soft);
    color: var(--accent);
}

.chat-msg.is-cliente .chat-role {
    background: rgba(125, 133, 144, 0.18);
    color: var(--text-secondary);
}

.chat-fecha {
    color: var(--text-muted);
    font-size: 11px;
}

.chat-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-width: 100%;
}

.chat-msg.is-agente .chat-bubble {
    background: var(--accent-soft);
    border: 1px solid rgba(47, 129, 247, 0.3);
    color: var(--text);
    border-bottom-right-radius: 4px;
}

.chat-msg.is-cliente .chat-bubble {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-bottom-left-radius: 4px;
}

/* Comentario interno (visible solo entre agentes) — fondo amarillento */
.chat-msg.is-interno .chat-bubble {
    background: rgba(210, 153, 34, 0.10);
    border: 1px dashed var(--amber);
}

.chat-msg.is-interno .chat-role {
    background: rgba(210, 153, 34, 0.18);
    color: var(--amber);
}

/* ── Timeline compacto (Historial estilo línea de tiempo) ── */
.sidebar-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    padding-left: 18px;
}

    .sidebar-timeline::before {
        content: '';
        position: absolute;
        left: 5px;
        top: 6px;
        bottom: 6px;
        width: 2px;
        background: var(--border);
    }

.sidebar-timeline-item {
    position: relative;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
}

    .sidebar-timeline-item:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

    .sidebar-timeline-item:first-child {
        padding-top: 0;
    }

.sidebar-timeline-dot {
    position: absolute;
    left: -18px;
    top: 11px;
    width: 10px;
    height: 10px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 50%;
}

/* En interno invertimos los roles vs cliente:
   - is-agente usa accent (azul) — el agente es "nosotros"
   - is-cliente usa neutro — el cliente es "el otro"  */
.sidebar-timeline-item.is-agente .sidebar-timeline-dot {
    border-color: var(--accent);
}

.sidebar-timeline-item.is-cliente .sidebar-timeline-dot {
    border-color: var(--text-secondary);
}

.sidebar-timeline-item.is-sistema .sidebar-timeline-dot {
    border-color: var(--text-faint);
}

.sidebar-timeline-actor {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
}

.sidebar-timeline-item.is-agente .sidebar-timeline-actor {
    color: var(--accent);
}

.sidebar-timeline-item.is-cliente .sidebar-timeline-actor {
    color: var(--text-secondary);
}

.sidebar-timeline-item.is-sistema .sidebar-timeline-actor {
    color: var(--text-faint);
    font-style: italic;
}

.sidebar-timeline-cambio {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.4;
}

    .sidebar-timeline-cambio strong {
        color: var(--text);
        font-weight: 600;
    }

.sidebar-timeline-from {
    color: var(--text-faint);
    font-size: 11px;
    margin-left: 4px;
}

.sidebar-timeline-fecha {
    font-size: 11px;
    color: var(--text-faint);
    margin-top: 3px;
    font-variant-numeric: tabular-nums;
}

/* Timeline scrollable cuando hay > 5 eventos */
.sidebar-timeline.is-scrollable {
    max-height: 360px;
    overflow-y: auto;
    padding-right: 6px;
    mask-image: linear-gradient( to bottom, transparent 0, #000 8px, #000 calc(100% - 8px), transparent 100% );
}

    .sidebar-timeline.is-scrollable::-webkit-scrollbar {
        width: 4px;
    }

    .sidebar-timeline.is-scrollable::-webkit-scrollbar-track {
        background: transparent;
    }

    .sidebar-timeline.is-scrollable::-webkit-scrollbar-thumb {
        background: var(--border);
        border-radius: 2px;
    }

        .sidebar-timeline.is-scrollable::-webkit-scrollbar-thumb:hover {
            background: var(--border-2);
        }

/* ═══════════════════════════════════════════════════════════════════════════
   v18 — UPLOAD ZONE + ADJUNTOS
   Estilos para el componente FileUploadZone (drag & drop sin JS) y para los
   chips de adjuntos en formularios + en mensajes del chat. Replicado del
   portal cliente para mantener uniformidad visual.

   Estructura HTML esperada por FileUploadZone:
     <div class="upload-zone">                ← .upload-zone-compact opcional
       <InputFile class="upload-zone-input"/> ← Invisible, cubre todo
       <div class="upload-zone-content">      ← Visible, pointer-events:none
         <div class="upload-zone-icon">...</div>
         <div class="upload-zone-title">...</div>
         <div class="upload-zone-hint">...</div>
       </div>
     </div>
   ═══════════════════════════════════════════════════════════════════════════ */

.upload-zone {
    position: relative;
    border: 1.5px dashed var(--border-2);
    border-radius: 10px;
    padding: 28px 20px;
    text-align: center;
    background: rgba(120, 131, 144, 0.04);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    overflow: hidden;
}

    .upload-zone:hover {
        border-color: #0078D4;
        background: rgba(0, 120, 212, 0.05);
    }

        .upload-zone:hover .upload-zone-icon {
            background: rgba(0, 120, 212, 0.18);
        }

    /* Estado disabled — atenuado, sin cursor pointer ni hover */
    .upload-zone:has(.upload-zone-input:disabled),
    .upload-zone-disabled {
        opacity: 0.55;
        cursor: not-allowed;
        pointer-events: none;
    }

/* InputFile invisible cubriendo TODA la zona — el navegador acepta el drop aquí */
.upload-zone-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
    border: 0;
    padding: 0;
    font-size: 0;
    box-sizing: border-box;
}

/* Contenido visible — pointer-events:none para que el click pase al input */
.upload-zone-content {
    position: relative;
    z-index: 1;
    pointer-events: none;
}

.upload-zone-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(0, 120, 212, 0.12);
    color: #0078D4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    transition: background 0.15s;
}

.upload-zone-title {
    font-size: 13.5px;
    color: var(--text);
    margin-bottom: 4px;
    line-height: 1.4;
}

    .upload-zone-title strong {
        color: #0078D4;
        font-weight: 600;
    }

.upload-zone-hint {
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Variante compacta — para adjuntos secundarios en formularios largos */
.upload-zone.upload-zone-compact {
    padding: 14px 16px;
    border-radius: 8px;
}

    .upload-zone.upload-zone-compact .upload-zone-icon {
        width: 30px;
        height: 30px;
        margin-bottom: 6px;
    }

    .upload-zone.upload-zone-compact .upload-zone-title {
        font-size: 13px;
        margin-bottom: 2px;
    }

    .upload-zone.upload-zone-compact .upload-zone-hint {
        font-size: 11px;
    }

/* ═══════════════════════════════════════════════════════════════════════════
   ADJUNTOS — Chips reutilizables para mostrar archivos antes/después de subir
   ═══════════════════════════════════════════════════════════════════════════ */

.adjuntos-preview {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.adjunto-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text);
}

.adjunto-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.adjunto-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: Consolas, Monaco, monospace;
    font-size: 12.5px;
}

.adjunto-size {
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
    white-space: nowrap;
}

.adjunto-remove {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, color 0.12s;
    flex-shrink: 0;
}

    .adjunto-remove:hover {
        background: rgba(218, 54, 51, 0.15);
        color: #f85149;
    }

/* ═══════════════════════════════════════════════════════════════════════════
   CHAT ADJUNTOS — Para mensajes ya enviados con link descargable
   Sin botón quitar; el chip entero es clickeable. Reservado para uso futuro
   en caso de querer mostrar adjuntos siempre visibles en el chat.
   ═══════════════════════════════════════════════════════════════════════════ */

.chat-adjuntos {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}

.chat-adjunto-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(0, 120, 212, 0.08);
    border: 1px solid rgba(0, 120, 212, 0.25);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text);
    text-decoration: none;
    max-width: 100%;
    transition: background 0.12s, border-color 0.12s;
}

    .chat-adjunto-chip:hover {
        background: rgba(0, 120, 212, 0.15);
        border-color: #0078D4;
        text-decoration: none;
        color: var(--text);
    }

    .chat-adjunto-chip .adjunto-icon {
        font-size: 13px;
    }

    .chat-adjunto-chip .adjunto-name {
        font-size: 12px;
        color: #0078D4;
        font-family: var(--font); /* override del font-mono base */
    }

    .chat-adjunto-chip .adjunto-size {
        font-size: 10.5px;
    }

/* ═══════════════════════════════════════════════════════════════════════════
   v19 — Módulo Catálogo de Precios (/configuracion/catalogo-precios)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Tarjeta de familia (acordeón) */
.catalogo-familia {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
    transition: border-color 0.12s;
}

    .catalogo-familia.inactivo {
        opacity: 0.55;
    }

    .catalogo-familia:hover {
        border-color: var(--accent);
    }

.familia-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    cursor: pointer;
    background: var(--surface-2);
    border-bottom: 1px solid transparent;
    user-select: none;
}

    .familia-header:hover {
        background: var(--surface-3);
    }

.familia-titulo {
    display: flex;
    align-items: center;
    flex: 1;
    font-size: 15px;
}

    .familia-titulo .chevron {
        display: inline-block;
        width: 16px;
        margin-right: 8px;
        color: var(--text-muted);
        font-size: 11px;
    }

.familia-acciones {
    display: flex;
    align-items: center;
    gap: 4px;
}

.familia-body {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.familia-descripcion {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0 0 12px 0;
    font-style: italic;
}

/* Tabla de planes dentro del acordeón */
.planes-table {
    margin: 0;
}

    .planes-table th {
        font-size: 12px;
        padding: 6px 10px;
    }

    .planes-table td {
        font-size: 13px;
        padding: 8px 10px;
        vertical-align: top;
    }

/* Fila inactiva (familia/plan/concepto/regla) */
.row-inactivo {
    opacity: 0.5;
}

/* Botón ghost chico para acciones inline (ej. "+ Plan") */
.btn-ghost-sm {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-2);
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.12s;
}

    .btn-ghost-sm:hover {
        background: var(--surface-3);
        color: var(--text-1);
        border-color: var(--accent);
    }

/* Empty state pequeño para secciones internas */
.empty-state-sm {
    text-align: center;
    color: var(--text-muted);
    padding: 16px;
    font-size: 13px;
    font-style: italic;
}

/* Modal medio (más ancho que default pero menos que modal-lg) */
.modal-card.modal-md {
    max-width: 720px;
    width: 90vw;
}

/* Alertas inline en la página */
.alert {
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 13px;
}

.alert-success {
    background: rgba(46, 160, 67, 0.1);
    color: var(--green, #2ea043);
    border: 1px solid rgba(46, 160, 67, 0.3);
}

.alert-error {
    background: rgba(218, 54, 51, 0.1);
    color: var(--red, #da3633);
    border: 1px solid rgba(218, 54, 51, 0.3);
}

/* Form hint chico (texto pequeño bajo un campo) */
.form-hint {
    display: block;
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 4px;
}

/* Page actions wrapper */
.page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Botón tipo link */
.btn-link {
    background: transparent;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 13px;
    padding: 2px 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
}

    .btn-link:hover {
        text-decoration: underline;
    }

/* ═══════════════════════════════════════════════════════════════════════════
   v19 — Modal de configuración por tipo (Topes de descuento)
   ═══════════════════════════════════════════════════════════════════════════ */

.niveles-config {
    margin-top: 8px;
}

.niveles-titulo {
    font-size: 14px;
    color: var(--text-2);
    margin: 16px 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nivel-card {
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 8px;
    background: var(--surface-2);
    transition: all 0.12s;
    overflow: hidden;
}

    .nivel-card.nivel-on {
        border-color: var(--accent);
        background: var(--surface-1);
    }

.nivel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
}

    .nivel-header input[type="checkbox"] {
        cursor: pointer;
    }

    .nivel-header strong {
        font-weight: 600;
    }

.nivel-body {
    padding: 0 14px 14px 14px;
    border-top: 1px dashed var(--border);
    padding-top: 12px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   v19 — Listado de Presupuestos (Fase 3A)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Barra de filtros (chips + buscar) */
.filtros-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filtros-chips {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: 16px;
    color: var(--text-2);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.12s;
    user-select: none;
}

    .chip:hover {
        background: var(--surface-3);
        color: var(--text-1);
    }

    .chip.chip-active {
        background: var(--accent);
        color: #fff;
        border-color: var(--accent);
    }

.chip-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 9px;
    font-size: 10px;
    font-weight: 600;
}

.chip:not(.chip-active) .chip-count {
    background: var(--surface-3);
    color: var(--text-muted);
}

/* Input buscar */
.filtros-buscar {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    min-width: 280px;
}

.filtros-input {
    border: none;
    background: transparent;
    padding: 4px 0;
    flex: 1;
    color: var(--text-1);
    font-size: 13px;
    outline: none;
}

/* Filas clickables (toda la fila es interactiva) */
.row-clickable {
    cursor: pointer;
    transition: background 0.08s;
}

    .row-clickable:hover {
        background: var(--surface-2);
    }

/* Badges adicionales del workflow */
.badge-amber {
    background: rgba(201, 162, 39, 0.15);
    color: #C9A227;
}

.badge-orange {
    background: rgba(234, 119, 56, 0.15);
    color: #ea7738;
}

.badge-green-soft {
    background: rgba(46, 160, 67, 0.12);
    color: #2ea043;
}

.badge-blue {
    background: rgba(31, 102, 214, 0.15);
    color: #1f66d6;
}

.badge-gray-dark {
    background: rgba(107, 114, 128, 0.25);
    color: #6b7280;
}

/* Footer del listado con totales */
.lista-footer {
    display: flex;
    align-items: center;
    padding: 12px 4px;
    font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   v19 — Editor de Presupuestos (Fase 3B)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Grid del editor: contenido principal + sidebar resumen */
.editor-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 16px;
    align-items: flex-start;
}

.editor-main {
    min-width: 0;
}

.editor-sidebar {
    position: sticky;
    top: 16px;
}

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

    .editor-sidebar {
        position: static;
    }
}

/* Secciones colapsables del editor */
.editor-section {
    margin-bottom: 16px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
    cursor: pointer;
    user-select: none;
}

.section-arrow {
    display: inline-block;
    width: 16px;
    margin-right: 4px;
    color: var(--text-muted);
    font-size: 10px;
}

.section-body {
    padding-top: 16px;
}

/* Labels y valores de info (modo solo lectura del editor) */
.info-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.info-value {
    font-size: 14px;
    color: var(--text-1);
    line-height: 1.4;
}

/* Panel lateral de resumen */
.resumen-card {
    padding: 20px;
}

.resumen-grupo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

    .resumen-grupo:last-of-type {
        border-bottom: none;
    }

.resumen-grupo-label {
    font-size: 13px;
    color: var(--text-2);
}

.resumen-grupo-monto {
    font-weight: 600;
    color: var(--text-1);
    font-size: 14px;
}

.resumen-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 13px;
}

.resumen-total {
    border-top: 2px solid var(--accent);
    padding-top: 12px;
    margin-top: 8px;
    font-size: 15px;
    color: var(--accent);
}

/* Selector de cliente (tipeahead) */
.selector-cliente {
    width: 100%;
}

.cliente-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 14px;
}

.cliente-buscar {
    position: relative;
}

.cliente-input-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
}

.cliente-input {
    border: none;
    background: transparent;
    padding: 4px 0;
    flex: 1;
    color: var(--text-1);
    font-size: 14px;
    outline: none;
}

.cliente-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    max-height: 320px;
    overflow-y: auto;
    z-index: 100;
}

.cliente-dropdown-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.08s;
    background: var(--surface-2);
}

    .cliente-dropdown-item:last-child {
        border-bottom: none;
    }

    .cliente-dropdown-item:hover {
        background: var(--surface-3);
    }

    .cliente-dropdown-item.disabled {
        cursor: not-allowed;
        color: var(--text-muted);
        font-style: italic;
    }

.cliente-dropdown-empty {
    padding: 16px;
    background: var(--surface-2);
}

/* Modal del selector de concepto */
.modal-lg {
    max-width: 720px;
}

.modo-toggle {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    padding: 4px;
    background: var(--surface-2);
    border-radius: 6px;
    width: fit-content;
}

.modo-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-2);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.1s;
}

    .modo-btn:hover {
        color: var(--text-1);
    }

    .modo-btn.modo-active {
        background: var(--accent);
        color: #fff;
    }

/* Resultados de búsqueda de conceptos */
.conceptos-resultados {
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-top: 8px;
}

.concepto-resultado {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.08s;
}

    .concepto-resultado:last-child {
        border-bottom: none;
    }

    .concepto-resultado:hover {
        background: var(--surface-2);
    }

    .concepto-resultado.concepto-active {
        background: rgba(31, 102, 214, 0.12);
        border-left: 3px solid var(--accent);
    }

/* Preview de cálculo del item */
.concepto-preview {
    margin-top: 16px;
    padding: 16px;
    background: var(--surface-2);
    border-radius: 8px;
    border-left: 3px solid var(--accent);
}

.concepto-preview-titulo {
    margin: 0 0 8px 0;
    color: var(--text-1);
    font-size: 15px;
}

.preview-card {
    margin-top: 12px;
    padding: 12px 14px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.preview-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 13px;
}

.preview-total {
    border-top: 1px solid var(--border);
    padding-top: 8px;
    margin-top: 4px;
    color: var(--accent);
    font-size: 15px;
}

/* Botón pequeño / variante ghost */
.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-ghost-sm {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-2);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.1s;
}

    .btn-ghost-sm:hover {
        background: var(--surface-2);
        color: var(--text-1);
    }

/* Alert info (azul) */
.alert-info {
    background: rgba(31, 102, 214, 0.1);
    border: 1px solid rgba(31, 102, 214, 0.3);
    color: var(--text-1);
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 13px;
}

.alert-success {
    background: rgba(46, 160, 67, 0.12);
    border: 1px solid rgba(46, 160, 67, 0.3);
    color: var(--text-1);
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 13px;
}

/* Hint de formulario */
.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   v19 — ConfirmDialog (modal de confirmación reutilizable)
   ═══════════════════════════════════════════════════════════════════════════ */

.confirm-dialog {
    max-width: 460px;
    padding: 28px;
    text-align: center;
}

.confirm-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border-radius: 50%;
}

.confirm-icon-danger {
    background: rgba(218, 54, 51, 0.15);
    color: #da3633;
}

.confirm-icon-info {
    background: rgba(31, 102, 214, 0.15);
    color: var(--accent);
}

.confirm-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: var(--text-1);
}

.confirm-message {
    color: var(--text-2);
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 24px 0;
}

.confirm-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* Botón destructivo (rojo) */
.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: #da3633;
    color: #fff;
    border: 1px solid #da3633;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.1s;
}

    .btn-danger:hover {
        background: #b62826;
        border-color: #b62826;
    }

    .btn-danger:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

/* ═══════════════════════════════════════════════════════════════════════════
   v19 — Resumen con toggle de equivalencias (Editor de Presupuestos)
   ═══════════════════════════════════════════════════════════════════════════ */

.resumen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

/* Toggle "Proyección anual" en el header del Resumen */
.resumen-equiv-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 4px 4px 4px;
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
    user-select: none;
    transition: color 0.1s;
}

    .resumen-equiv-toggle:hover {
        color: var(--text-1);
    }

    .resumen-equiv-toggle:has(input:checked) {
        color: var(--accent);
        font-weight: 600;
    }

/* Switch I/O reutilizable (estilo iOS) */
.switch {
    position: relative;
    display: inline-block;
    width: 30px;
    height: 16px;
    flex-shrink: 0;
}

    .switch input {
        opacity: 0;
        width: 0;
        height: 0;
    }

.switch-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: 16px;
    transition: background 0.18s, border-color 0.18s;
}

    .switch-slider::before {
        position: absolute;
        content: "";
        height: 12px;
        width: 12px;
        left: 1px;
        top: 1px;
        background: var(--text-muted);
        border-radius: 50%;
        transition: transform 0.18s, background 0.18s;
    }

.switch input:checked + .switch-slider {
    background: var(--accent);
    border-color: var(--accent);
}

    .switch input:checked + .switch-slider::before {
        transform: translateX(14px);
        background: #fff;
    }

/* Agrupador por periodicidad */
.resumen-periodicidad {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

    .resumen-periodicidad:last-of-type {
        border-bottom: none;
    }

.resumen-periodicidad-titulo {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
}

/* Item detalle (concepto + cantidad × precio = subtotal) */
.resumen-item-detalle {
    padding: 6px 0;
}

    .resumen-item-detalle .resumen-item-nombre {
        font-size: 12px;
        margin-bottom: 2px;
        font-weight: 500;
        color: var(--text-1);
    }

.resumen-item-calculo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    padding-left: 8px;
}

/* Total por periodicidad (footer del grupo) */
.resumen-periodicidad-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 6px;
    margin-top: 4px;
    border-top: 1px dashed var(--border);
    font-size: 12px;
    color: var(--accent);
    font-weight: 600;
}

/* Línea de equivalencia (muestra el cálculo cruzado) */
.resumen-equivalencia {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    margin-top: 6px;
    background: rgba(31, 102, 214, 0.08);
    border-left: 2px solid var(--accent);
    border-radius: 3px;
    font-size: 10px;
    color: var(--text-2);
    font-style: italic;
}

.resumen-equivalencia-total {
    margin-top: 8px;
    font-weight: 600;
    color: var(--accent);
    font-style: normal;
    font-size: 11px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   v19 — Descuentos + Adjuntos + Panel Evaluación (Fase 3C)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Preview del modal de descuento */
.descuento-preview {
    margin-top: 16px;
    padding: 12px 14px;
    background: var(--surface-2);
    border-radius: 6px;
}

/* Banners de nivel de aprobación (warning/danger personalizados) */
.descuento-nivel-warning {
    background: rgba(201, 162, 39, 0.12);
    border: 1px solid rgba(201, 162, 39, 0.35);
    color: var(--text-1);
}

.descuento-nivel-danger {
    background: rgba(234, 119, 56, 0.12);
    border: 1px solid rgba(234, 119, 56, 0.35);
    color: var(--text-1);
}

/* Modal vincular adjunto - lista del catálogo */
.lista-adjuntos-catalogo {
    max-height: 420px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-top: 8px;
}

.catalogo-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}

    .catalogo-item:last-child {
        border-bottom: none;
    }

    .catalogo-item:hover {
        background: var(--surface-2);
    }

/* Grid de adjuntos del presupuesto */
.adjuntos-grid {
    display: grid;
    gap: 8px;
}

.adjunto-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: background 0.08s;
}

    .adjunto-item:hover {
        background: var(--surface-3);
    }

.adjunto-info {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.adjunto-acciones {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* Panel lateral de Evaluación */
.panel-evaluacion {
    margin-top: 12px;
    padding: 16px;
}

.evaluacion-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

    .evaluacion-header h4 {
        font-size: 14px;
    }

.evaluacion-mensaje {
    font-size: 12px;
    color: var(--text-2);
    margin: 0 0 12px 0;
    line-height: 1.5;
}

.evaluacion-detalles {
    border-top: 1px solid var(--border);
    padding-top: 10px;
    margin-top: 10px;
}

.evaluacion-detalles-titulo {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
}

.evaluacion-descuento {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
    font-size: 12px;
    border-bottom: 1px dashed var(--border);
}

    .evaluacion-descuento:last-of-type {
        border-bottom: none;
    }

.evaluacion-descuento-info {
    flex: 1;
    min-width: 0;
}

.evaluacion-motivo {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 10px;
    padding: 8px 10px;
    background: rgba(31, 102, 214, 0.08);
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-2);
    font-style: italic;
}

/* Fondos según nivel del panel */
.panel-eval-ok {
    border-left: 4px solid #2ea043;
}

    .panel-eval-ok .evaluacion-header {
        color: #2ea043;
    }

.panel-eval-warning {
    border-left: 4px solid #C9A227;
}

    .panel-eval-warning .evaluacion-header {
        color: #C9A227;
    }

.panel-eval-danger {
    border-left: 4px solid #ea7738;
}

    .panel-eval-danger .evaluacion-header {
        color: #ea7738;
    }

/* ═══════════════════════════════════════════════════════════════════════════
   v19 — Workflow + Timeline + Aprobaciones Pendientes (Fase 3D)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Tarjeta de acciones del workflow (sidebar) */
.acciones-card {
    margin-top: 12px;
    padding: 12px;
}

.acciones-titulo {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.acciones-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Botón de acción del workflow */
.btn-accion {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    width: 100%;
    font-size: 13px;
    font-weight: 500;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.12s;
    border: 1px solid transparent;
    text-align: left;
}

.btn-accion-label {
    flex: 1;
}

.btn-accion:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Variantes del botón de acción */
.btn-accion-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

    .btn-accion-primary:hover:not(:disabled) {
        background: #1a5cbf;
        border-color: #1a5cbf;
    }

.btn-accion-success {
    background: rgba(46, 160, 67, 0.12);
    color: #3fb950;
    border-color: rgba(46, 160, 67, 0.4);
}

    .btn-accion-success:hover:not(:disabled) {
        background: #2ea043;
        color: #fff;
        border-color: #2ea043;
    }

.btn-accion-danger {
    background: rgba(218, 54, 51, 0.10);
    color: #f85149;
    border-color: rgba(218, 54, 51, 0.35);
}

    .btn-accion-danger:hover:not(:disabled) {
        background: #da3633;
        color: #fff;
        border-color: #da3633;
    }

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

    .btn-accion-ghost:hover:not(:disabled) {
        background: var(--surface-2);
        color: var(--text-1);
    }

/* Card de estado terminal */
.acciones-terminal {
    margin-top: 12px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    font-size: 12px;
    color: var(--text-muted);
}

/* Timeline vertical de aprobaciones */
.timeline {
    position: relative;
    padding-left: 28px;
}

    .timeline::before {
        content: "";
        position: absolute;
        left: 11px;
        top: 8px;
        bottom: 8px;
        width: 2px;
        background: var(--border);
    }

.timeline-item {
    position: relative;
    padding-bottom: 18px;
    padding-left: 4px;
}

    .timeline-item:last-child {
        padding-bottom: 0;
    }

.timeline-item-pending .timeline-content {
    background: rgba(201, 162, 39, 0.06);
    padding: 8px 10px;
    border-radius: 4px;
    margin: -4px -10px;
    border-left: 2px solid #C9A227;
}

.timeline-dot {
    position: absolute;
    left: -28px;
    top: 2px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--surface-1);
    z-index: 1;
}

.timeline-dot-ok {
    background: #2ea043;
    color: #fff;
}

.timeline-dot-fail {
    background: #da3633;
    color: #fff;
}

.timeline-dot-pending {
    background: #C9A227;
    color: #fff;
}

.timeline-dot-info {
    background: var(--accent);
    color: #fff;
}

.timeline-content {
    font-size: 13px;
}

.timeline-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.timeline-meta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-2);
}

.timeline-comentario {
    margin-top: 8px;
    padding: 8px 10px;
    background: var(--surface-2);
    border-left: 2px solid var(--border);
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-2);
    white-space: pre-wrap;
}

/* Pantalla aprobaciones pendientes */
.tiempo-critico {
    color: #da3633;
    font-weight: 600;
}

.tiempo-warning {
    color: #C9A227;
    font-weight: 500;
}

/* Badge del NavMenu (contador de pendientes) */
.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 6px;
    background: #C9A227;
    color: #fff;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 700;
}
