/* --- FINANZAS: MENÚ LATERAL AVANZADO --- */
.advanced-sidebar {
    width: 60px;
    /* Reduced from 210px */
    background: white;
    display: flex;
    flex-direction: column;
    overflow: visible;
    position: relative;
    border-right: 1px solid #ddd;
    align-items: center;
    /* Center icons */
    padding-top: 15px;
}

.advanced-sidebar.expanded {
    width: 210px;
    /* If we ever want to expand it */
}

/* NEW: Header Action Button */
.btn-header-action {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: white;
    border: 1px solid #e0e0e0;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
    font-size: 14px;
}

.btn-header-action:hover {
    background: #f8f9fa;
    color: var(--vino);
    border-color: #ccc;
}

.sidebar-toggle {
    display: none;
}

.sidebar-content {
    padding: 20px 15px;
    opacity: 1;
    pointer-events: all;
    min-width: auto;
}

.advanced-sidebar.expanded .sidebar-content {
    opacity: 1;
    pointer-events: all;
}

/* Sidebar Items: Icon Only Mode */
/* [STANDARDIZED] Styles moved to pos_global.css (.cheesy-sidebar-item)
.side-item {
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    color: #666;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 10px;
    margin-bottom: 10px;
    font-size: 16px;
    transition: 0.2s;
}

.side-item span {
    display: none;
}

.side-item i {
    color: #aaa;
    font-size: 18px;
    margin: 0;
}

.side-item i {
    color: #aaa;
    width: 20px;
    text-align: center;
}

.side-item:hover,
.side-item.active {
    background: #fdf2f2;
    color: var(--vino);
}

.side-item:hover i,
.side-item.active i {
    color: var(--vino);
}
*/

.sidebar-label {
    display: none;
    /* Hide labels */
}

.sidebar-divider {
    height: 1px;
    background: #eee;
    margin: 15px 0;
}

/* --- FINANZAS: PUNTO DE EQUILIBRIO --- */
.breakeven-container {
    background: white;
    padding: 15px 30px;
    border-top: 1px solid #eee;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.05);
    z-index: 50;
}

.breakeven-icon {
    width: 32px;
    height: 32px;
    background: #f3e5f5;
    color: #8e44ad;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.breakeven-text {
    font-size: 11px;
    font-weight: 700;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.breakeven-percent {
    font-size: 16px;
    font-weight: 900;
    color: #5e1c26;
}

.breakeven-bar-bg {
    background: #f0f0f0;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #eee;
}

.breakeven-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #8e44ad, #5e1c26, #27ae60);
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(142, 68, 173, 0.3);
}

/* --- FINANZAS: CONTROLES Y KPI --- */
.table-switch-btn {
    padding: 8px 20px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    color: #666;
    background: transparent;
    transition: all 0.3s ease;
    font-family: 'Montserrat', sans-serif;
}

.table-switch-btn.active {
    background: white;
    color: #5e1c26;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.kpi-card {
    background: white;
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    min-width: 120px;
}

.kpi-label {
    font-size: 10px;
    font-weight: 800;
    color: #999;
    margin-bottom: 5px;
}

.kpi-value {
    font-size: 20px;
    font-weight: 800;
    color: #333;
}

/* --- FINANZAS: SMART DATE PICKER --- */
.smart-date-control {
    display: flex;
    align-items: center;
    gap: 5px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 4px;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    transition: all 0.2s;
}

.smart-date-control:hover {
    border-color: #ccc;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.btn-date-nav {
    width: 36px;
    height: 36px;
    border: none;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    color: #555;
    font-size: 14px;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-date-nav:hover {
    background: #e2e6ea;
    color: var(--vino);
}

.date-display {
    padding: 0 15px;
    font-weight: 700;
    color: #333;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 180px;
    justify-content: center;
    user-select: none;
    border-left: 1px solid #eee;
    border-right: 1px solid #eee;
    height: 24px;
}

.date-display:hover {
    color: var(--vino);
}

.date-picker-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    width: 320px;
    overflow: hidden;
    animation: fadeIn 0.2s ease-out;
}

.date-picker-dropdown.show {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

.dp-header {
    display: flex;
    padding: 10px;
    background: white;
    gap: 5px;
    border-bottom: 1px solid #f0f0f0;
}

.dp-tab {
    flex: 1;
    padding: 8px 0;
    border: none;
    background: transparent;
    font-size: 12px;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.dp-tab:hover {
    background: #f8f9fa;
    color: #555;
}

.dp-tab.active {
    background: #fdf2f4;
    color: var(--vino);
    font-weight: 700;
}

.dp-body {
    padding: 15px;
}

.dp-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.dp-controls button {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #eee;
    background: white;
    cursor: pointer;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.dp-controls button:hover {
    background: var(--vino);
    color: white;
    border-color: var(--vino);
}

#dpCurrentLabel {
    font-weight: 800;
    color: #333;
    font-size: 14px;
}

.dp-footer {
    padding: 12px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    justify-content: center;
    background: #fafafa;
}

#view-finances .btn-text {
    background: white;
    border: 1px solid #ddd;
    color: #555;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 20px;
    transition: all 0.2s;
}

#view-finances .btn-text:hover {
    background: var(--vino);
    color: white;
    border-color: var(--vino);
    box-shadow: 0 4px 10px rgba(94, 28, 38, 0.2);
    text-decoration: none;
}

/* Nuevo */

/* --- LAYOUT PRINCIPAL --- */
#view-finances {
    background-color: #f4f6f8;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: row;
}

/* --- SIDEBAR AVANZADO --- */
.advanced-sidebar {
    width: 60px;
    background: white;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    z-index: 20;
    position: relative;
    align-items: center;
}

.sidebar-toggle {
    display: none;
}

.sidebar-content {
    padding: 20px 10px;
    overflow-y: auto;
    flex: 1;
}

.sidebar-label {
    font-size: 11px;
    font-weight: 800;
    color: #aaa;
    margin-bottom: 10px;
    padding-left: 10px;
    letter-spacing: 1px;
}

.side-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 5px;
    border: none;
    background: none;
    border-radius: 8px;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-family: 'Montserrat', sans-serif;
}

.side-item i {
    width: 25px;
    font-size: 16px;
    text-align: center;
    margin-right: 10px;
}

.side-item:hover {
    background-color: #f5f5f5;
    color: var(--vino);
}

.side-item.active {
    background-color: #fdf2f4;
    /* Tono vino muy claro */
    color: var(--vino);
    font-weight: 600;
}

.sidebar-divider {
    height: 1px;
    background: #eee;
    margin: 15px 0;
}

/* --- CABECERA Y CONTROL DE FECHAS --- */
.fin-header {
    background: white;
    padding: 15px 30px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.fin-title {
    color: var(--vino);
    font-size: 22px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

/* (Bloque duplicado eliminado para evitar conflictos con el Date Picker arriba) */

/* --- KPI CARDS (Restored) --- */
.kpi-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.kpi-card {
    flex: 1;
    min-width: 140px;
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    border: 1px solid #eee;
}

.kpi-label {
    font-size: 10px;
    font-weight: 800;
    color: #999;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.kpi-value {
    font-size: 20px;
    font-weight: 800;
    color: #333;
}

/* --- TABLAS Y SWITCHERS --- */
.table-switch-container {
    display: flex;
    background: #eee;
    border-radius: 25px;
    padding: 4px;
    border: 1px solid #ddd;
}

.table-switch-btn {
    background: none;
    border: none;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.table-switch-btn.active {
    background: white;
    color: var(--vino);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.analysis-trigger-btn {
    display: none;
    /* Ocultamos el botón porque el panel será fijo */
    background: white;
    border: 1px solid #ddd;
    color: #555;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Definición explícita de las cuadrículas por ID */
#dpGridDays,
#dpGridMonths,
#dpGridYears {
    display: none;
    /* Por defecto ocultos, JS los activa como grid */
    width: 100%;
}

#dpGridDays.active-grid,
#dpGridMonths.active-grid,
#dpGridYears.active-grid {
    display: grid;
}

#dpGridDays {
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

#dpGridMonths {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

#dpGridYears {
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

/* Estilos de Celdas (Días, Meses, Años) */
.dp-cell {
    height: 36px;
    border-radius: 50%;
    /* Días circulares */
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: 0.2s;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
    border: 1px solid transparent;
}

.dp-cell:hover {
    background: #f0f0f0;
    border-color: #ddd;
}

.dp-cell.selected {
    background: var(--vino);
    color: white;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(94, 28, 38, 0.3);
}

.dp-cell.in-range {
    background: #fdf2f4;
    color: var(--vino);
    font-weight: 600;
    border-radius: 0;
    /* Rango rectangular */
}

/* Primer y último día del rango redondeados */
.dp-cell.range-start {
    border-radius: 50% 0 0 50%;
}

.dp-cell.range-end {
    border-radius: 0 50% 50% 0;
}

/* Meses y Años (Rectangulares redondeados) */
#dpGridMonths .dp-cell,
#dpGridYears .dp-cell {
    border-radius: 8px;
    height: 45px;
    background: #fafafa;
    border: 1px solid #eee;
}

#dpGridMonths .dp-cell:hover,
#dpGridYears .dp-cell:hover {
    background: white;
    border-color: var(--vino);
}

#dpGridMonths .dp-cell.selected,
#dpGridYears .dp-cell.selected {
    background: var(--vino);
    color: white;
    border-color: var(--vino);
}

.cheesy-table {
    min-width: 100%;
    width: max-content;
    /* FORCE EXPANSION so cells don't shrink/collide */
    border-collapse: collapse;
    font-size: 13px;
    /* table-layout: fixed; REMOVED to allow natural expansion */
}

.cheesy-table th {
    background: #f8f9fa;
    color: #666;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
    padding: 12px 15px;
    text-align: left;
    border-bottom: 2px solid #eee;
    white-space: nowrap;
    /* Excel-like header */
}

.cheesy-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    color: #444;
    white-space: nowrap;
    /* Excel-like: No wrap */
}

/* --- TABLE SPECIFIC COLUMN SIZING --- */

/* 1. ORDERS TABLE (7 Cols) */
/* ID, Date, Client, Method, Status, Total, Actions */
.table-orders th:nth-child(1),
.table-orders td:nth-child(1) {
    width: 90px;
    min-width: 90px;
}

/* ID */
.table-orders th:nth-child(2),
.table-orders td:nth-child(2) {
    width: 140px;
    min-width: 140px;
}

/* Date */
.table-orders th:nth-child(3),
.table-orders td:nth-child(3) {
    width: 220px;
    min-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Client */
.table-orders th:nth-child(4),
.table-orders td:nth-child(4) {
    width: 110px;
    min-width: 110px;
}

/* Method */
.table-orders th:nth-child(5),
.table-orders td:nth-child(5) {
    width: 110px;
    min-width: 110px;
}

/* Status */
.table-orders th:nth-child(6),
.table-orders td:nth-child(6) {
    width: 100px;
    min-width: 100px;
}

/* Total */
.table-orders th:nth-child(7),
.table-orders td:nth-child(7) {
    width: 60px;
    min-width: 60px;
}

/* Eye */

/* 2. EXPENSES TABLE (6 Cols) */
/* Status, Date, Concept, Category, Amount, Actions */
.table-expenses th:nth-child(1),
.table-expenses td:nth-child(1) {
    width: 60px;
    min-width: 60px;
}

/* Status Icon */
.table-expenses th:nth-child(2),
.table-expenses td:nth-child(2) {
    width: 140px;
    min-width: 140px;
}

/* Date */
.table-expenses th:nth-child(3),
.table-expenses td:nth-child(3) {
    width: 250px;
    min-width: 250px;
}

/* Concept */
.table-expenses th:nth-child(4),
.table-expenses td:nth-child(4) {
    width: 140px;
    min-width: 140px;
}

/* Category */
.table-expenses th:nth-child(5),
.table-expenses td:nth-child(5) {
    width: 110px;
    min-width: 110px;
}

/* Amount */
.table-expenses th:nth-child(6),
.table-expenses td:nth-child(6) {
    width: 80px;
    min-width: 80px;
}

/* Actions */

/* 3. SESSIONS TABLE (8 Cols) */
/* Date, Staff, Fund, Sales, Expense, Declared, Diff, Status */
.table-sessions th:nth-child(1),
.table-sessions td:nth-child(1) {
    width: 140px;
    min-width: 140px;
}

/* Date */
.table-sessions th:nth-child(2),
.table-sessions td:nth-child(2) {
    width: 200px;
    min-width: 200px;
}

/* Staff */
.table-sessions th:nth-child(n + 3),
.table-sessions td:nth-child(n + 3) {
    width: 100px;
    min-width: 100px;
    text-align: right;
}

/* Numbers */
.table-sessions th:last-child,
.table-sessions td:last-child {
    width: 60px;
    min-width: 60px;
    text-align: center;
}

/* Status Icon */

/* 4. INVOICES TABLE (5 Cols) */
/* Date, RFC, Amount, Status, Actions */
.table-invoices th:nth-child(1),
.table-invoices td:nth-child(1) {
    width: 120px;
    min-width: 120px;
}

/* Date reduced */
.table-invoices th:nth-child(2),
.table-invoices td:nth-child(2) {
    width: 220px;
    min-width: 220px;
}

/* RFC/Name */
.table-invoices th:nth-child(3),
.table-invoices td:nth-child(3) {
    width: 90px;
    min-width: 90px;
    text-align: right;
}

/* Amount */
.table-invoices th:nth-child(4),
.table-invoices td:nth-child(4) {
    width: 60px;
    min-width: 60px;
    text-align: center;
}

/* Status Icon */
.table-invoices th:nth-child(5),
.table-invoices td:nth-child(5) {
    width: 100px;
    min-width: 100px;
    text-align: center;
    padding-left: 15px;
}

/* Actions with Gap */

.table-invoices td:nth-child(2)>div {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Cliente */

/* Badge Styles (Prevent Overlap) */
.badge-fin,
.badge-status-fin {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    text-transform: uppercase;
    margin: 0 auto;
    /* Center in cell */
}

/* Specific Badge Colors if missing */
.status-completed {
    color: #27ae60;
    background: rgba(39, 174, 96, 0.1);
}

.status-refunded {
    color: #c0392b;
    background: rgba(192, 57, 43, 0.1);
}

.status-pending {
    color: #f39c12;
    background: rgba(243, 156, 18, 0.1);
}

.method-cash {
    color: #27ae60;
    border: 1px solid #27ae60;
}

.method-card {
    color: #2980b9;
    border: 1px solid #2980b9;
}

.method-transfer {
    color: #8e44ad;
    border: 1px solid #8e44ad;
}

.cheesy-table th:nth-last-child(2),
.cheesy-table td:nth-last-child(2) {
    min-width: 100px;
    width: 100px;
}

/* Total */

/* --- PANEL LATERAL ANÁLISIS --- */
#analysisPanel {
    background: white;
    /* Forzamos visibilidad permanente */
    width: 340px !important;
    opacity: 1 !important;
    margin-left: 20px;
    /* Scroll interno y altura controlada */
    max-height: 600px;
    overflow-y: auto !important;
    border: 1px solid #eee;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

#analysisPanel::-webkit-scrollbar {
    width: 5px;
}

#analysisPanel::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

/* --- ESTILOS MIGRADOS DE JS (FINANCE UI) --- */

/* KPI Subtext */
.kpi-subtext {
    font-size: 10px;
    color: #888;
    font-weight: 600;
    margin-top: -2px;
    cursor: help;
}

/* Table Header & Search */
.table-header-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
}

.table-title-text {
    font-weight: 800;
    color: var(--vino);
}

.search-wrapper-fin {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon-fin {
    position: absolute;
    left: 10px;
    color: #999;
    display: flex;
}

.search-input-fin {
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 10px 8px 32px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    width: 200px;
    outline: none;
    color: #555;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
    transition: all 0.2s ease;
}

.search-input-fin:focus {
    border-color: var(--vino);
    box-shadow: 0 0 0 3px rgba(94, 28, 38, 0.1);
}

/* Action Buttons in Header */
.btn-action-fin {
    margin-left: 15px;
    background: #c0392b;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(192, 57, 43, 0.2);
    font-family: 'Montserrat', sans-serif;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-action-fin.blue {
    background: #2c3e50;
    box-shadow: 0 4px 10px rgba(44, 62, 80, 0.2);
}

/* Table Status Badges - REFINED AND ELEGANT */
.badge-status-fin {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.badge-fin {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    white-space: nowrap;
}

/* Method Variants */
.badge-fin.method-cash {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.badge-fin.method-card {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.badge-fin.method-transfer {
    background: #faf5ff;
    color: #7e22ce;
    border: 1px solid #e9d5ff;
}

/* Status Variants */
.badge-status-fin.status-completed {
    background: #e8f5e9;
    color: #27ae60;
    border: 1px solid #c8e6c9;
}

.badge-status-fin.status-pending {
    background: #fff3e0;
    color: #e67e22;
    border: 1px solid #ffe0b2;
}

.badge-status-fin.status-refunded {
    background: #ffebee;
    color: #c0392b;
    border: 1px solid #ffcdd2;
}

/* Legacy support (optional cleanup later) */
.status-badge {
    font-weight: bold;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
}

/* Table Rows */
.tr-refunded {
    background: #fff5f5;
    color: #999;
    text-decoration: line-through;
}

.tr-pending {
    background: #fef9e7;
    opacity: 0.8;
}

.td-id {
    padding: 12px 15px;
    font-family: monospace;
    color: #555;
}

.td-bold {
    font-weight: 600;
}

.td-amount {
    text-align: right;
    font-weight: 800;
}

.td-center {
    text-align: center;
}

/* Breakeven Labels */
.be-label-success {
    color: #27ae60;
    font-weight: 800;
}

.be-label-surplus {
    color: #555;
    margin-left: 10px;
    font-size: 12px;
}

.be-label-progress {
    color: #555;
    font-weight: 600;
}

.be-label-missing {
    color: #d35400;
    font-weight: bold;
    font-size: 13px;
    margin-left: 8px;
}

.be-label-meta {
    color: #999;
    font-size: 10px;
    margin-left: 5px;
}

.be-label-negative {
    color: #c0392b;
    font-weight: bold;
    font-size: 12px;
}

/* Operational Analysis */
.op-row {
    align-items: flex-start;
    margin-bottom: 8px;
    border-bottom: 1px dashed #eee;
    padding-bottom: 5px;
    padding-right: 5px;
    display: flex;
    justify-content: space-between;
}

.op-name {
    font-weight: 600;
    color: #444;
    font-size: 12px;
}

.op-runway {
    font-size: 10px;
    font-weight: bold;
    margin-top: 2px;
}

.op-val {
    color: #333;
    font-size: 12px;
    font-weight: bold;
}

.btn-shop-list {
    width: 100%;
    margin-top: 15px;
    background: #e8f5e9;
    color: #27ae60;
    border: 1px solid #c8e6c9;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Waste Report */
.waste-box {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid;
}

.waste-box.red {
    background: #ffebee;
    border-color: #ffcdd2;
}

.waste-box.orange {
    background: #fff3e0;
    border-color: #ffe0b2;
}

.waste-title {
    font-size: 9px;
    font-weight: bold;
    text-transform: uppercase;
}

.waste-val {
    font-size: 16px;
    font-weight: 900;
}

.waste-row {
    padding: 10px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Shopping List */
.shop-budget-header {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.shop-row {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 5px;
}

.shop-row.covered {
    background: #f9fafb;
    opacity: 0.6;
}

.shop-row.needed {
    background: white;
}

/* Service List */
.svc-item {
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    transition: 0.2s;
}

.svc-item:hover {
    background: #f9f9f9;
}

.svc-tag {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
}

.svc-tag.bill {
    color: #2980b9;
    background: #e3f2fd;
}

.svc-tag.fixed {
    color: #27ae60;
    background: #e8f5e9;
}

.svc-history {
    margin-top: 15px;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

.svc-history-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding: 5px 0;
    border-bottom: 1px dashed #eee;
}

/* Modal Actions */
.modal-btn-group {
    display: flex;
    gap: 10px;
    width: 100%;
}

.modal-btn {
    flex: 1;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.modal-btn.dark {
    background: #333;
    color: white;
}

.modal-btn.red {
    background: #c0392b;
    color: white;
}

.modal-btn.refunded {
    background: #fce4ec;
    color: #c0392b;
    border: 1px solid #c0392b;
    cursor: default;
}

/* --- BREAKEVEN BAR (Bottom) --- */
.breakeven-container {
    background: white;
    padding: 15px 30px;
    border-top: 1px solid #ddd;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

.breakeven-bar-bg {
    height: 10px;
    background: #eee;
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.breakeven-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #f1c40f, #27ae60);
    width: 0%;
    transition: width 1s ease-out;
}

.breakeven-icon {
    width: 30px;
    height: 30px;
    background: #f0f4f8;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--vino);
}

.breakeven-text {
    font-weight: 600;
    color: #555;
    font-size: 13px;
}

.breakeven-percent {
    font-weight: 800;
    color: var(--vino);
    font-size: 16px;
}

/* --- MOBILE RESPONSIVE LAYOUT (ADDED) --- */
@media (max-width: 768px) {

    /* 1. Header Optimization */
    .fin-title {
        display: none !important;
    }

    .fin-header {
        padding: 10px 15px;
        justify-content: center;
        /* Center content since title is gone */
    }

    .smart-date-control {
        flex: 1;
        max-width: 100%;
        justify-content: space-between;
    }

    .date-display {
        flex: 1;
        min-width: 0;
        /* Allow shrinking */
        font-size: 13px;
        padding: 0 5px;
        text-align: center;
    }

    /* 2. Sidebar Mobile Items */
    .mobile-only-item {
        display: flex !important;
    }

    /* 3. View Switching (Table vs Analysis) */
    #financeContentRow {
        display: block !important;
        /* Stack mode, though we hide one or the other */
    }

    /* Default: Show Table, Hide Analysis */
    #analysisPanel {
        display: none !important;
    }

    #financeContentRow>div:first-child {
        display: flex !important;
        /* Table Container */
        width: 100%;
    }

    /* Active Mode: Analysis */
    #financeContentRow.show-mobile-analysis>div:first-child {
        display: none !important;
        /* Hide Table Container */
    }

    #financeContentRow.show-mobile-analysis #analysisPanel {
        display: flex !important;
        width: 100% !important;
        margin-left: 0 !important;
        height: auto;
        min-height: 80vh;
        border: none;
        box-shadow: none;
    }
}

/* Base state for desktop */
.mobile-only-item {
    display: none;
}

/* --- MOBILE SPECIFIC ADDITIONS --- */
@media (max-width: 768px) {

    /* 4. Icon-Only Switch Buttons (Mobile) */
    .desktop-only-text {
        display: none !important;
    }

    .table-switch-btn {
        padding: 8px 12px;
        /* Smaller padding */
        font-size: 16px;
        /* Larger icon */
    }

    /* 5. Collapsible Search Bar (Mobile Optimization) */
    .search-input-container {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        background: white;
        display: flex;
        align-items: center;
        width: 0;
        opacity: 0;
        overflow: hidden;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 5;
        border-radius: 8px;
    }

    .search-wrapper-fin.expanded .search-input-container {
        width: 220px;
        /* Expand Width */
        opacity: 1;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    }

    .search-wrapper-fin.expanded .btn-search-toggle {
        opacity: 0;
        pointer-events: none;
    }

    .search-input-fin {
        width: 100%;
        border: none;
        padding: 5px 10px;
        background: transparent;
        box-shadow: none;
    }

    .btn-search-toggle {
        width: 36px;
        height: 36px;
        border-radius: 8px;
        background: #f0f4f8;
        border: none;
        color: #555;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: 0.2s;
    }
}

/* --- NEW DESKTOP/SHARED STYLES FOR ICON ACTIONS --- */
.btn-action-fin.icon-only {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 14px;
}

.btn-action-fin.gray {
    background: #f0f2f5;
    color: #555;
    box-shadow: none;
    border: 1px solid #ddd;
}

.search-wrapper-fin {
    position: relative;
    height: 36px;
    display: flex;
    align-items: center;
}

.btn-search-toggle {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: white;
    border: 1px solid #e0e0e0;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
    z-index: 2;
}

.btn-search-toggle:hover {
    background: #f8f9fa;
    color: var(--vino);
}

.search-input-container {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    display: flex;
    align-items: center;
    width: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 5;
    border-radius: 8px;
    height: 38px;
}

.search-wrapper-fin.expanded .search-input-container {
    width: 240px;
    opacity: 1;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid #eee;
}

.search-wrapper-fin.expanded .btn-search-toggle {
    opacity: 0;
    pointer-events: none;
}

.search-input-fin {
    width: 100%;
    border: none;
    padding: 0 15px;
    height: 100%;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    outline: none;
    background: transparent;
}

/* --- MOBILE ANALYSIS OVERLAP FIX --- */
@media (max-width: 900px) {

    /* When analysis is active (show-mobile-analysis class on parent row) */
    .finance-content-row.show-mobile-analysis #centerFinancePanel {
        display: none !important;
        /* Hide the table completely */
    }

    .finance-content-row.show-mobile-analysis #analysisPanel {
        display: flex !important;
        position: relative;
        left: 0;
        width: 100% !important;
        max-width: 380px !important;
        /* Limit width for card look */
        margin: 0 auto !important;
        /* Center horizontally */
        height: auto;
        opacity: 1 !important;
        pointer-events: all;
        border-left: none !important;
        /* Remove desktop border */
        border: 1px solid #eee !important;
        border-radius: 12px !important;
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05) !important;
    }
}

/* USER REQUEST: Hide table titles (headers) on all devices */
#financeTableHeader,
.table-title-text {
    display: none !important;
}