:root {
    --bg-color: #0b1120;
    --sidebar-bg: rgba(15, 23, 42, 0.96);
    --surface-color: #1e293b;
    --surface-border: rgba(255, 255, 255, 0.08);
    --card-hover: #243248;
    --primary: #10b981;
    --primary-glow: rgba(16, 185, 129, 0.25);
    --blue-accent: #38bdf8;
    --indigo-accent: #818cf8;
    --indigo-glow: rgba(129, 140, 248, 0.25);
    --gold-accent: #f59e0b;
    --danger-accent: #f87171;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --radius-lg: 16px;
    --radius-md: 10px;
    --sidebar-width: 280px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* ── App Shell / Sidebar Layout ────────────────────── */
.app-shell {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--surface-border);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 24px 18px;
    gap: 24px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 8px;
}

.brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #10b981, #047857);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 20px;
    color: white;
    box-shadow: 0 4px 16px var(--primary-glow);
    flex-shrink: 0;
}

.brand-title h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.badge-pro {
    font-size: 10px;
    padding: 2px 6px;
    background: rgba(16, 185, 129, 0.15);
    color: var(--primary);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 20px;
    font-weight: 700;
}

.brand-title p {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Active User Card in Sidebar */
.sidebar-user-card {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-user-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar-user-select {
    background: #0f172a;
    border: 1px solid var(--surface-border);
    color: var(--text-main);
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    outline: none;
    width: 100%;
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar-user-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

/* Navigation Menu */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.nav-header {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    padding: 6px 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-item.active {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.25);
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.nav-item.active.relevo {
    background: rgba(129, 140, 248, 0.12);
    color: #a5b4fc;
    border-color: rgba(129, 140, 248, 0.25);
}

.nav-item.active.range {
    background: rgba(56, 189, 248, 0.12);
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.25);
}

.nav-item.active.cotizaciones {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.25);
}

.nav-item.active.usuarios {
    background: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.25);
}

.nav-item.active.config {
    background: rgba(168, 85, 247, 0.12);
    color: #c084fc;
    border-color: rgba(168, 85, 247, 0.25);
}

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

.nav-text {
    display: flex;
    flex-direction: column;
}

.nav-title {
    font-size: 14px;
    line-height: 1.2;
}

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

/* Sidebar Footer Status */
.sidebar-footer {
    border-top: 1px solid var(--surface-border);
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    background: rgba(15, 23, 42, 0.6);
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid var(--surface-border);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    transition: all 0.3s;
}

.status-dot.online {
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.server-info {
    font-size: 11px;
    color: #64748b;
    text-align: center;
}

/* ── Backdrop for Mobile Sidebar ──────────────────── */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 999;
}

/* ── Main Workspace ───────────────────────────────── */
.main-workspace {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 24px 32px 60px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-height: 100vh;
    max-width: 1200px;
}

/* Top Mobile / Tablet Bar */
.top-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    backdrop-filter: blur(12px);
}

.menu-toggle-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--surface-border);
    color: var(--text-main);
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Page Views Container */
.page-view {
    display: none;
    flex-direction: column;
    gap: 22px;
    animation: fadeInView 0.2s ease-out;
}

.page-view.active {
    display: flex;
}

@keyframes fadeInView {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Page Headers */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-bottom: 4px;
}

.view-header h2 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-main);
}

.view-header p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Controls Bar ───────────────────────────────── */
.controls-card {
    background: var(--surface-color);
    border: 1px solid var(--surface-border);
    padding: 20px;
    border-radius: var(--radius-lg);
    display: grid;
    grid-template-columns: 1.5fr auto auto;
    gap: 16px;
    align-items: flex-end;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

/* ── Modern DatePicker Component ── */
.datepicker-wrapper {
    position: relative;
    width: 100%;
}

.datepicker-input-box {
    display: flex;
    align-items: center;
    background: #0f172a;
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    padding: 2px 8px 2px 14px;
    cursor: pointer;
    transition: all 0.2s;
    height: 46px;
}

.datepicker-input-box:hover, .datepicker-input-box.open {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.datepicker-input-box.indigo:hover, .datepicker-input-box.indigo.open {
    border-color: var(--indigo-accent);
    box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.2);
}

.datepicker-display {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-main);
    user-select: none;
}

.datepicker-icon-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    cursor: pointer;
    transition: background 0.2s;
}

.datepicker-icon-btn.indigo {
    color: var(--indigo-accent);
}

.datepicker-icon-btn:hover {
    background: rgba(16, 185, 129, 0.2);
}

/* Calendar Popup */
.calendar-popup {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 330px;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
    z-index: 2000;
    animation: fadeInPopup 0.15s ease-out;
}

@keyframes fadeInPopup {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.calendar-popup.open {
    display: block;
}

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

.cal-nav-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.cal-nav-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.cal-title-selects {
    display: flex;
    gap: 6px;
}

.cal-title-selects select {
    background: #1e293b;
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    padding: 4px 8px;
    cursor: pointer;
    height: 32px;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    margin-bottom: 8px;
}

.cal-weekday {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.cal-weekday.weekend {
    color: #f87171;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text-main);
    border: 1px solid transparent;
    user-select: none;
}

.cal-day:hover:not(.empty) {
    background: rgba(255, 255, 255, 0.1);
}

.cal-day.other-month {
    color: #475569;
}

.cal-day.today {
    border-color: var(--blue-accent);
    color: var(--blue-accent);
    font-weight: 700;
}

.cal-day.selected {
    background: var(--primary) !important;
    color: white !important;
    font-weight: 700;
    box-shadow: 0 0 10px var(--primary-glow);
}

.cal-day.selected.indigo {
    background: var(--indigo-accent) !important;
    box-shadow: 0 0 10px var(--indigo-glow);
}

.calendar-shortcuts {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.cal-shortcut-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    padding: 6px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.cal-shortcut-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.cal-shortcut-btn.highlight {
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.08);
}

/* ── Segmented Controls / Pill Switches ────────────── */
.segmented-group {
    display: flex;
    background: #0f172a;
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--surface-border);
    gap: 4px;
    height: 46px;
    align-items: center;
}

.segment-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.segment-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px var(--primary-glow);
}

.segment-btn.active.indigo {
    background: var(--indigo-accent);
    box-shadow: 0 2px 8px var(--indigo-glow);
}

/* Action Buttons */
.btn-calc {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 0 24px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px var(--primary-glow);
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-calc.indigo {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    box-shadow: 0 4px 15px var(--indigo-glow);
}

.btn-calc:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
}

.calc-btn-group {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.calc-btn-group .btn-calc {
    flex: 1;
}

.btn-pdf-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 48px;
    padding: 0 16px;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    color: #f1f5f9;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: var(--radius-md);
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-pdf-action:hover {
    background: linear-gradient(135deg, #334155, #1e293b);
    border-color: #38bdf8;
    color: #38bdf8;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(56, 189, 248, 0.2);
}

.btn-pdf-action .spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #38bdf8;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-pdf-action.loading .spinner {
    display: block;
}

.btn-pdf-action.loading .btn-text {
    display: none;
}

.btn-pdf-action.loading svg {
    display: none;
}

/* ── Metrics Grid ───────────────────────────────── */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.metric-card {
    background: var(--surface-color);
    border: 1px solid var(--surface-border);
    padding: 22px;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s, border-color 0.2s;
}

.metric-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.metric-card.hero {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(30, 41, 59, 0.8));
    border-color: rgba(16, 185, 129, 0.35);
    grid-column: span 1;
}

.metric-card.hero.indigo {
    background: linear-gradient(135deg, rgba(129, 140, 248, 0.18), rgba(30, 41, 59, 0.8));
    border-color: rgba(129, 140, 248, 0.35);
}

.metric-card.hero::after {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
}

.metric-card.hero.indigo::after {
    background: radial-gradient(circle, var(--indigo-glow) 0%, transparent 70%);
}

.metric-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.metric-card.hero .metric-value {
    color: #34d399;
}

.metric-card.hero.indigo .metric-value {
    color: #a5b4fc;
}

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

/* ── Dual Comparison ────────────────────────────── */
.dual-card {
    background: var(--surface-color);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.method-box {
    background: #0f172a;
    border-radius: var(--radius-md);
    padding: 18px;
    border: 1px solid var(--surface-border);
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.method-box.selected {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.15);
}

.method-tag {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
}

.method-val {
    font-size: 22px;
    font-weight: 700;
}

/* ── Details & Two-Column Grids ─────────────────── */
.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.details-card {
    background: var(--surface-color);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.details-card.full {
    grid-column: span 2;
}

.details-card h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.details-card h3 svg {
    color: var(--primary);
}

.details-card.indigo h3 svg {
    color: var(--indigo-accent);
}

.table-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--surface-border);
    font-size: 13px;
}

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

.table-row span:first-child {
    color: var(--text-muted);
}

.table-row span:last-child {
    font-weight: 600;
    color: var(--text-main);
}

.highlight-warn {
    color: #fbbf24 !important;
    font-weight: 700 !important;
}

.highlight-emerald {
    color: #34d399 !important;
    font-weight: 700 !important;
}

.highlight-indigo {
    color: #a5b4fc !important;
    font-weight: 700 !important;
}

/* ── Relevo Panel Enhancements ──────────────────── */
.card-header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 8px;
}

.card-header-flex h3 {
    margin-bottom: 0;
    font-size: 14.5px;
}

.relevo-badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 12px;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.relevo-badge.blue {
    background: rgba(56, 189, 248, 0.12);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.relevo-badge.purple {
    background: rgba(129, 140, 248, 0.12);
    color: #818cf8;
    border: 1px solid rgba(129, 140, 248, 0.3);
}

.relevo-badge.amber {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.card-divider {
    height: 1px;
    background: var(--surface-border);
    margin: 8px 0;
}

.table-row.highlight-total {
    padding-top: 10px;
    padding-bottom: 4px;
}

.table-row.highlight-total span:first-child {
    font-weight: 700;
    color: var(--text-main);
    font-size: 13.5px;
}

.table-row.highlight-total span:last-child {
    font-size: 16px;
    font-weight: 800;
}

.fiscal-audit-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 28px;
    row-gap: 2px;
}

@media (max-width: 768px) {
    .fiscal-audit-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Loading Spinner ────────────────────────────── */
.spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading .spinner { display: block; }
.loading .btn-text { display: none; }

/* ── Range Scenario Comparator Styles ─────────── */
.datepicker-input-box.range:hover, .datepicker-input-box.range.open {
    border-color: var(--blue-accent);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.datepicker-icon-btn.range {
    color: var(--blue-accent);
}

.cal-day.selected.range {
    background: var(--blue-accent) !important;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

.segment-btn.active.range {
    background: #0284c7;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
}

.btn-calc.range {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    box-shadow: 0 4px 15px rgba(2, 132, 199, 0.25);
}

.metric-card.hero.range {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(30, 41, 59, 0.8));
    border-color: rgba(56, 189, 248, 0.35);
}

.metric-card.hero.range .metric-value {
    color: #38bdf8;
}

.metric-card.hero.range::after {
    background: radial-gradient(circle, rgba(56, 189, 248, 0.25) 0%, transparent 70%);
}

.metric-card.hero.cotizaciones {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(30, 41, 59, 0.8));
    border-color: rgba(245, 158, 11, 0.35);
}

.metric-card.hero.cotizaciones .metric-value {
    color: #fbbf24;
}

.metric-card.hero.cotizaciones::after {
    background: radial-gradient(circle, rgba(245, 158, 11, 0.25) 0%, transparent 70%);
}

/* ── Chart & Timeline Components ────────────────── */
.chart-container {
    width: 100%;
    overflow-x: auto;
    padding: 8px 0;
}

.chart-legend {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 11px;
    color: var(--text-muted);
}

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

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

.legend-dot.early-heavy { background: #f87171; }
.legend-dot.early-light { background: #fbbf24; }
.legend-dot.legal { background: #10b981; }
.legend-dot.delayed { background: #38bdf8; }

.chart-bar {
    transition: opacity 0.2s, transform 0.2s;
    cursor: pointer;
}

.chart-bar:hover {
    filter: brightness(1.25);
    stroke: #ffffff;
    stroke-width: 1.5;
}

.chart-bar.selected {
    stroke: #ffffff;
    stroke-width: 2.5;
    filter: brightness(1.3);
}

/* Scenario Callout */
.scenario-callout {
    background: #0f172a;
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    animation: fadeInPopup 0.15s ease-out;
}

.callout-badge {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.callout-grid {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 13px;
}

.callout-lbl {
    color: var(--text-muted);
    font-size: 11px;
    display: block;
    text-transform: uppercase;
    font-weight: 600;
}

/* ── Data Table ─────────────────────────────────── */
.table-scroll-container {
    width: 100%;
    overflow-x: auto;
    max-height: 440px;
    border-radius: 8px;
    border: 1px solid var(--surface-border);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    text-align: left;
}

.data-table th {
    background: #0f172a;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 12px 14px;
    position: sticky;
    top: 0;
    border-bottom: 1px solid var(--surface-border);
    white-space: nowrap;
    z-index: 10;
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    white-space: nowrap;
}

.data-table tbody tr {
    transition: background 0.15s;
    cursor: pointer;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.data-table tbody tr.selected {
    background: rgba(56, 189, 248, 0.12) !important;
}

.data-table tbody tr.legal-row {
    background: rgba(16, 185, 129, 0.08);
}

.data-table tbody tr.legal-row td:first-child {
    font-weight: 700;
    color: #34d399;
}

/* ── Cuadrante de Bases Revalorizadas ────────────── */
.quadrant-summary-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    background: #0f172a;
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    padding: 12px 18px;
    margin-top: 14px;
}

.quadrant-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 110px;
}

.quadrant-stat-lbl {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.quadrant-stat-val {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
}

.quadrant-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    padding: 12px 0 4px 0;
    font-size: 12px;
    color: var(--text-muted);
    align-items: center;
}

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

.q-legend-chip {
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    display: inline-block;
    white-space: nowrap;
}

.chip-ordinaria {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.chip-laguna-100 {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.35);
}

.chip-laguna-50 {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.chip-descarte {
    color: #f87171;
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.35);
}

.chip-empty {
    color: #64748b;
    background: transparent;
}

/* Celdas del cuadrante */
.quadrant-table td {
    padding: 8px 10px;
    font-size: 12px;
    text-align: center;
}

.quadrant-table th {
    text-align: center;
    padding: 10px 10px;
    font-size: 11px;
}

.quadrant-table td:first-child,
.quadrant-table th:first-child {
    font-weight: 800;
    background: #0f172a;
    position: sticky;
    left: 0;
    z-index: 5;
    border-right: 1px solid var(--surface-border);
}

.quadrant-table td:last-child,
.quadrant-table th:last-child {
    font-weight: 700;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.04);
    border-left: 1px solid var(--surface-border);
}

.quadrant-table tfoot td {
    background: #0f172a;
    font-weight: 700;
    color: #38bdf8;
    border-top: 2px solid var(--surface-border);
    padding: 10px 8px;
    font-size: 11px;
}

.quadrant-cell {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    border-radius: 4px;
    padding: 3px 4px;
    transition: all 0.15s;
}

.quadrant-cell.normal {
    color: #e2e8f0;
}

.quadrant-cell.laguna {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.25);
    font-weight: 700;
}

.quadrant-cell.descarte {
    color: #f87171;
    background: rgba(244, 63, 94, 0.12);
    border: 1px solid rgba(244, 63, 94, 0.25);
    text-decoration: line-through;
    opacity: 0.85;
}

.quadrant-cell:hover {
    transform: scale(1.05);
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ── Cotizaciones View & Toolbar ────────────────── */
.btn-primary-action {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #0f172a;
    font-weight: 700;
    font-size: 14px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.25);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
    filter: brightness(1.08);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    font-weight: 600;
    font-size: 14px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--surface-border);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

.cot-toolbar-card {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.cot-filter-group {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.search-input-box {
    position: relative;
    display: flex;
    align-items: center;
    background: #0f172a;
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    padding: 0 12px;
    min-width: 240px;
}

.search-input-box svg {
    color: var(--text-muted);
    flex-shrink: 0;
    margin-right: 8px;
}

.search-input-box input {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 14px;
    padding: 8px 0;
    outline: none;
    width: 100%;
}

.btn-clear-search {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.btn-clear-search:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.1);
}

.filter-chips {
    display: flex;
    gap: 6px;
}

.chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--surface-border);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.chip:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.chip.active {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.35);
    color: #fbbf24;
    font-weight: 600;
}

.cot-toolbar-info {
    font-size: 13px;
    color: var(--text-muted);
}

/* ── Table Action Badges & Buttons ─────────────── */
.badge-cotizado {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-laguna {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.table-actions-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-action-edit, .btn-action-del {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.15s ease;
}

.btn-action-edit {
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.2);
}

.btn-action-edit:hover {
    background: rgba(56, 189, 248, 0.18);
    border-color: #38bdf8;
    transform: scale(1.08);
}

.btn-action-del {
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.2);
}

.btn-action-del:hover {
    background: rgba(248, 113, 113, 0.18);
    border-color: #f87171;
    transform: scale(1.08);
}

/* ── Modal Dialog ───────────────────────────────── */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 17, 32, 0.78);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    overflow: hidden;
    transform: scale(0.94) translateY(12px);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.open .modal-card {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--surface-border);
    background: rgba(15, 23, 42, 0.5);
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-main);
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.15s;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

.modal-body {
    padding: 24px;
}

.modal-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.currency-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.currency-input-wrapper input {
    width: 100%;
    background: #0f172a;
    border: 1px solid var(--surface-border);
    color: var(--text-main);
    padding: 10px 36px 10px 14px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    outline: none;
    transition: all 0.2s;
}

.currency-input-wrapper input:focus {
    border-color: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.currency-symbol {
    position: absolute;
    right: 14px;
    font-weight: 700;
    color: var(--text-muted);
    pointer-events: none;
}

.modal-checkbox-row {
    margin-top: 18px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    padding: 12px 14px;
}

/* ── Switch iOS / Modern Component (Pure CSS) ──── */
.custom-switch-label {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    cursor: pointer;
    user-select: none;
    padding: 6px 4px;
    border-radius: var(--radius-md);
    transition: background-color 0.2s ease;
}

.custom-switch-label:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    margin-top: 1px;
}

.switch input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
    margin: 0;
}

.switch-slider {
    position: absolute;
    inset: 0;
    background-color: #334155;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    transition: background-color 0.25s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.25s ease, box-shadow 0.25s ease;
    cursor: pointer;
}

.switch-slider::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: #f8fafc;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Checked state: Emerald green */
.switch input[type="checkbox"]:checked + .switch-slider {
    background-color: var(--primary);
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 0 0 10px var(--primary-glow);
}

/* Checked state: Warning / Amber (para lagunas y cese) */
.switch.warning input[type="checkbox"]:checked + .switch-slider {
    background-color: var(--gold-accent);
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.25);
}

.switch input[type="checkbox"]:checked + .switch-slider::before {
    transform: translateX(20px);
}

.switch input[type="checkbox"]:focus-visible + .switch-slider {
    outline: 2px solid var(--blue-accent);
    outline-offset: 2px;
}

.checkbox-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.checkbox-text strong {
    font-size: 13px;
    color: var(--text-main);
}

.checkbox-text small {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.modal-error-box {
    margin-top: 14px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--surface-border);
    background: rgba(15, 23, 42, 0.4);
}

/* ── Config & Service Mode View ─────────────────── */
.config-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    align-items: start;
}

.config-code-path {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    color: #38bdf8;
    background: #0f172a;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--surface-border);
    word-break: break-all;
    user-select: all;
    display: block;
    width: 100%;
}

.mode-switch-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: #0f172a;
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 20px;
    transition: all 0.2s ease;
}

.mode-switch-card:hover {
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(15, 23, 42, 0.85);
}

.mode-switch-info {
    flex: 1;
}

.mode-switch-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.mode-switch-icon {
    font-size: 24px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid var(--surface-border);
    flex-shrink: 0;
}

.mode-switch-header strong {
    display: block;
    font-size: 14.5px;
    color: var(--text-main);
    font-weight: 600;
    margin-bottom: 3px;
}

.mode-switch-sub {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
}

.mode-switch-control {
    flex-shrink: 0;
}

.btn-shutdown-action {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    color: #ffffff;
    font-weight: 700;
    font-size: 14px;
    padding: 11px 20px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
    transition: all 0.2s ease;
}

.btn-shutdown-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.45);
    filter: brightness(1.1);
}

/* ── Subpestañas del Expediente (Estilo Panel con Línea Horizontal) ──── */
.subtabs-bar {
    display: flex;
    gap: 32px;
    border-bottom: 1px solid var(--surface-border);
    margin: 24px 0 24px 0;
    padding: 0 4px;
    background: transparent;
    max-width: 100%;
    overflow-x: auto;
}

.subtab-btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 12px 2px 14px 2px;
    font-size: 14.5px;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
    position: relative;
}

.subtab-btn svg {
    color: var(--text-muted);
    transition: color 0.15s ease;
    flex-shrink: 0;
}

.subtab-btn:hover {
    color: var(--text-main);
    border-bottom-color: rgba(255, 255, 255, 0.25);
}

.subtab-btn:hover svg {
    color: var(--text-main);
}

.subtab-btn.active {
    color: #ffffff;
    font-weight: 600;
    border-bottom: 2px solid var(--blue-accent);
    background: transparent;
    box-shadow: none;
}

.subtab-btn.active svg {
    color: var(--blue-accent);
}

.subtab-panel {
    display: none;
}

.subtab-panel.active {
    display: block;
    animation: fadeInSubtab 0.2s ease;
}

@keyframes fadeInSubtab {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Módulo de Gestión de Titulares y Perfiles ──── */
.user-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 20px;
    margin-top: 8px;
}

.user-card {
    background: var(--surface-color);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.user-card:hover {
    border-color: rgba(255, 255, 255, 0.16);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.user-card.active-user {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary), 0 8px 24px var(--primary-glow);
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.06) 0%, rgba(30, 41, 59, 0.98) 100%);
}

.user-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.user-avatar-circle {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, #1e3a8a, #3b82f6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.user-card.active-user .user-avatar-circle {
    background: linear-gradient(135deg, #059669, #10b981);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.user-header-info {
    flex: 1;
    min-width: 0;
}

.user-card-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-card-badge-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 5px;
}

.badge-active-user {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(16, 185, 129, 0.15);
    color: var(--primary);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 2px 8px;
    border-radius: 20px;
}

.badge-involuntario {
    font-size: 11px;
    font-weight: 600;
    background: rgba(245, 158, 11, 0.15);
    color: var(--gold-accent);
    border: 1px solid rgba(245, 158, 11, 0.3);
    padding: 2px 8px;
    border-radius: 20px;
}

.user-details-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    background: rgba(15, 23, 42, 0.55);
    border-radius: var(--radius-md);
    border: 1px solid var(--surface-border);
    font-size: 13px;
}

.user-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.user-detail-label {
    color: var(--text-muted);
}

.user-detail-val {
    font-weight: 600;
    color: var(--text-main);
    text-align: right;
}

.user-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 6px;
}

.btn-user-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 1px solid var(--surface-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    transition: all 0.2s ease;
}

.btn-user-action:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-user-action.select-active {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.35);
    flex: 1;
}

.btn-user-action.select-active:hover {
    background: rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 130, 246, 0.5);
}

.btn-user-action.is-active-btn {
    background: rgba(16, 185, 129, 0.15);
    color: var(--primary);
    border-color: rgba(16, 185, 129, 0.35);
    cursor: default;
    flex: 1;
}

.btn-user-action.danger:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.35);
}

/* ── Responsive Rules ───────────────────────────── */
@media (max-width: 1080px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-backdrop.open {
        display: block;
    }
    .main-workspace {
        margin-left: 0;
        padding: 16px;
        width: 100%;
    }
    .top-bar {
        display: flex;
    }
    .controls-card {
        grid-template-columns: 1fr;
    }
    .dual-card, .details-grid, .config-grid {
        grid-template-columns: 1fr;
    }
    .details-card.full {
        grid-column: span 1;
    }
}

/* ── Estilos para el Wizard de Extracción PDF ─────────────────────── */
.file-dropzone:hover {
    border-color: #38bdf8 !important;
    background: rgba(56, 189, 248, 0.05) !important;
}

.file-dropzone.dragover {
    border-color: #38bdf8 !important;
    background: rgba(56, 189, 248, 0.12) !important;
    transform: scale(1.01);
}

.recipient-option-card {
    transition: all 0.2s ease;
}

.recipient-option-card:hover {
    border-color: #38bdf8 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.recipient-option-card.active {
    border-color: #38bdf8 !important;
    background: rgba(56, 189, 248, 0.12) !important;
}

/* ── Estilos Premium para Configuración de IRPF y Fiscalidad ───────── */
.irpf-header-card {
    background: var(--surface-color);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.irpf-header-left {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    flex: 1 1 450px;
}

.irpf-header-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #38bdf8;
    flex-shrink: 0;
}

.irpf-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.irpf-title {
    margin: 0;
    font-size: 16.5px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.2px;
}

.irpf-mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: 0.2px;
    transition: all 0.2s ease;
}

.irpf-mode-badge.dual {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.28);
}

.irpf-mode-badge.clasico {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.28);
}

.irpf-desc {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.irpf-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.irpf-mode-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.irpf-select-wrapper {
    position: relative;
}

.irpf-mode-select {
    appearance: none;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    padding: 9px 36px 9px 14px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.irpf-mode-select:hover, .irpf-mode-select:focus {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: #38bdf8;
    outline: none;
}

/* ── Segmented Control Pill Bar para Solapas IRPF ──────────────────── */
.irpf-segmented-bar {
    display: inline-flex;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(10px);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    padding: 4px;
    gap: 5px;
    margin-bottom: 20px;
    max-width: 100%;
    overflow-x: auto;
}

.irpf-seg-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
}

.irpf-seg-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.06);
}

.irpf-seg-btn.active {
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary) 0%, #2563eb 100%);
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.35);
    font-weight: 600;
}

.irpf-seg-btn svg {
    flex-shrink: 0;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.irpf-seg-btn.active svg {
    opacity: 1;
}

/* ── Pantalla de Acceso Restringido (Login Overlay) ────────── */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 50% 25%, #1e293b 0%, #0b1120 100%);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.login-modal-card {
    background: rgba(30, 41, 59, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7), 0 0 45px rgba(37, 99, 235, 0.15);
    width: 100%;
    max-width: 420px;
    padding: 38px 32px;
    text-align: center;
    box-sizing: border-box;
    animation: loginCardPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginCardPop {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(12px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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