/* =========================================
   1. VARIABLES Y RESET
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    /* Paleta de Colores Modern Dark */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-body: #0f172a;       /* Fondo principal muy oscuro */
    --bg-card: #1e293b;       /* Fondo paneles */
    --bg-elevated: #334155;   /* Elementos sobre paneles */
    --bg-input: #020617;      /* Fondo inputs */
    
    --text-main: #f8fafc;     /* Blanco casi puro */
    --text-muted: #94a3b8;    /* Gris azulado */
    
    --success: #10b981;       /* Verde esmeralda */
    --danger: #ef4444;        /* Rojo suave */
    --warning: #f59e0b;       /* Ámbar */
    
    --border: rgba(148, 163, 184, 0.15); /* Bordes sutiles */
    --radius: 12px;           /* Curvatura moderna */
    
    --shadow-card: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    
    --header-height: 64px;
}

* {
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-elevated) var(--bg-body);
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: 'Inter', 'Segoe UI', sans-serif;
    font-size: 13px;
    overflow: hidden; /* Bloquea scroll de la ventana principal */
    line-height: 1.5;
}

/* =========================================
   2. LAYOUT PRINCIPAL
   ========================================= */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh; /* Ocupa exactamente la ventana */
    width: 100%;
    max-width: 100%;
    padding: 0;
}

.full-width { width: 100%; }

/* --- NAVEGACIÓN --- */
.nav-bar {
    height: var(--header-height);
    display: flex;
    gap: 10px;
    padding: 0 20px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0; /* No encoger */
    overflow-x: auto;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-card);
    z-index: 10;
}

.nav-group {
    display: flex;
    gap: 5px;
    height: 100%;
    align-items: center;
}

.nav-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

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

.nav-btn.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    font-weight: 600;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.btn-logout {
    color: var(--danger);
    padding: 8px;
    margin-left: 10px;
    opacity: 0.8;
    cursor: pointer;
    border: none;
    background: transparent;
}
.btn-logout:hover { background: rgba(239, 68, 68, 0.15); color: #fca5a5; opacity: 1; border-radius: 6px; }

/* --- ÁREA DE CONTENIDO --- */
.tab-content {
    display: none;
    flex-grow: 1; /* Ocupa el resto del alto */
    overflow-y: auto; /* Scroll solo aquí dentro */
    padding: 20px;
    min-height: 0;
    animation: fadeIn 0.3s ease-out;
}

.tab-content.active { display: block; }

/* Layouts especiales sin scroll padre */
#tab-history.active, #tab-kanban.active, #tab-calc.active, #tab-dashboard.active {
    display: flex;
    flex-direction: column;
    overflow: hidden; 
}

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

/* Scrollbar Fina */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* =========================================
   3. COMPONENTES UI
   ========================================= */
.card {
    background-color: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    display: flex; flex-direction: column;
    position: relative;
    margin-bottom: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 15px;
}

.section-title {
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    margin: 10px 0 20px 0;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex; align-items: center; gap: 8px;
}

label {
    display: block;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

input, select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: white;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
}

input:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

button { cursor: pointer; }

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 12px;
    width: 100%;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
    margin-top: 15px;
    display: flex; justify-content: center; align-items: center; gap: 8px;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:disabled {
    background: var(--bg-elevated);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-icon {
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    padding: 6px;
    font-size: 1rem;
    transition: 0.2s;
    border-radius: 6px;
    color: var(--text-muted);
    display: flex; align-items: center; justify-content: center;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border-color: var(--border);
}

.btn-trash:hover { color: var(--danger); border-color: rgba(239,68,68,0.3); background: rgba(239,68,68,0.1); }
.btn-pdf:hover { color: #3b82f6; border-color: rgba(59,130,246,0.3); background: rgba(59,130,246,0.1); }

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-style: italic;
    border: 2px dashed var(--border);
    border-radius: 12px;
    margin-top: 10px;
    background: rgba(255,255,255,0.01);
}

.warning-box {
    background: rgba(239, 68, 68, 0.15);
    border: 2px solid var(--danger);
    border-left: 4px solid var(--danger);
    color: #fca5a5;
    padding: 12px 15px;
    border-radius: 8px;
    font-weight: 700;
    text-align: center;
    margin: 15px 0;
    font-size: 0.9rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* =========================================
   4. DASHBOARD
   ========================================= */
#tab-dashboard.active {
    display: grid;
    grid-template-rows: auto auto 1fr;
    gap: 20px;
    overflow-y: auto;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    flex-shrink: 0;
}

.kpi-card {
    background: linear-gradient(160deg, var(--bg-card) 0%, #141c2f 100%);
    padding: 15px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex; flex-direction: column; justify-content: center;
    position: relative; overflow: hidden;
    min-height: 90px;
}

.kpi-card::after {
    content: ''; position: absolute;
    right: -10px; bottom: -10px;
    width: 60px; height: 60px;
    background: var(--primary);
    filter: blur(50px); opacity: 0.15; border-radius: 50%;
}

.kpi-card h3 {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0 0 4px 0;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    margin: 0;
    letter-spacing: -0.5px;
}

.kpi-sub {
    font-size: 0.75rem;
    margin-top: 4px;
    opacity: 0.7;
}

.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    min-height: 320px;
}

@media(max-width: 1100px) {
    .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
    .charts-row { grid-template-columns: 1fr; min-height: auto; }
}

.chart-box {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex; flex-direction: column;
    min-height: 300px;
}

.chart-title {
    margin-bottom: 15px;
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

.chart-box canvas {
    width: 100% !important;
    height: auto !important;
    max-height: 260px;
    margin: auto;
}

.insights-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.insight-card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex; align-items: center; gap: 20px;
}

.insight-icon {
    width: 48px; height: 48px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border-radius: 12px;
    display: flex; justify-content: center; align-items: center;
    font-size: 1.4rem;
}

/* =========================================
   5. CALCULADORA
   ========================================= */
.calc-layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 20px;
    height: 100%;
    overflow: hidden;
}

@media(max-width: 900px) {
    .calc-layout { grid-template-columns: 1fr; overflow-y: auto; }
    .calc-left { overflow: visible; height: auto; }
    .ticket-card { height: auto; }
}

.calc-left {
    display: flex; flex-direction: column; gap: 15px;
    overflow-y: auto; padding-right: 5px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

/* TICKET DERECHO */
.ticket-card {
    background: #111827;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex; flex-direction: column;
    height: 100%;
    overflow: hidden;
    box-shadow: -5px 0 20px rgba(0,0,0,0.2);
}

.ticket-header {
    background: var(--gradient-primary);
    padding: 25px;
    text-align: center;
    color: white;
    flex-shrink: 0;
}

.ticket-header h2 {
    margin: 0; font-size: 0.8rem; opacity: 0.9; letter-spacing: 2px; font-weight: 700;
}

.big-price {
    font-size: 3.5rem;
    font-weight: 800; margin: 5px 0 0 0; line-height: 1;
    text-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.ticket-body {
    padding: 25px;
    flex-grow: 1;
    display: flex; flex-direction: column;
    overflow-y: auto;
}

.details-list { list-style: none; padding: 0; margin: 0; flex-grow: 1; }
.details-list li {
    display: flex; justify-content: space-between; padding: 12px 0;
    border-bottom: 1px dashed rgba(255,255,255,0.1);
    font-size: 0.9rem; color: var(--text-muted);
}
.val { font-weight: 600; color: white; }
.val-highlight { color: var(--success); font-weight: 800; font-size: 1.1rem; }

/* Input Mode Toggle */
.input-mode-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    background: var(--bg-elevated);
    padding: 4px;
    border-radius: 8px;
}

.mode-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.mode-btn.active {
    background: var(--primary);
    color: white;
}

.input-mode-container {
    animation: fadeIn 0.3s ease;
}

.manual-input-info {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-left: 4px solid var(--primary);
    padding: 12px 15px;
    border-radius: 8px;
    color: var(--text-main);
    font-size: 0.85rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.manual-input-info i {
    color: var(--primary);
    font-size: 1.2rem;
}

/* Drag & Drop */
.file-drop-area {
    border: 2px dashed var(--border);
    border-radius: 10px; padding: 20px;
    text-align: center; cursor: pointer; background: rgba(255,255,255,0.01);
    margin: 10px 0; position: relative; min-height: 120px;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    transition: 0.2s;
}
.file-drop-area:hover { border-color: var(--primary); background: rgba(99, 102, 241, 0.08); }
.file-drop-area i { font-size: 2rem; color: var(--text-muted); margin-bottom: 10px; z-index: 2; }
.file-msg { z-index: 2; font-size: 0.85rem; font-weight: 500; }

.gcode-preview-box {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: #000; display: none; z-index: 1;
}
.gcode-preview-box img { width: 100%; height: 100%; object-fit: contain; opacity: 0.6; }

/* Extras */
.extras-container {
    background: rgba(255,255,255,0.02);
    padding: 15px; border-radius: 8px;
    border: 1px solid var(--border);
    margin-top: 10px;
}

.extras-row {
    display: grid;
    grid-template-columns: 1.2fr 2fr 1fr 0.8fr auto;
    gap: 8px; margin-bottom: 8px;
}

.btn-add-extra {
    background: var(--bg-elevated); font-size: 0.75rem;
    padding: 6px 12px; width: auto; margin: 0;
}
.btn-remove-extra {
    color: var(--danger); font-size: 1.1rem; padding: 0 5px;
    background: none; border: none; cursor: pointer;
}

/* Controles Margen */
.control-group {
    background: rgba(255,255,255,0.03);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid rgba(255,255,255,0.05);
}
.control-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.range-wrapper { display: flex; align-items: center; gap: 10px; }
input[type=range] { flex-grow: 1; height: 5px; background: var(--bg-body); border-radius: 3px; appearance: none; }
input[type=range]::-webkit-slider-thumb { appearance: none; width: 16px; height: 16px; background: var(--primary); border-radius: 50%; cursor: pointer; box-shadow: 0 0 8px rgba(99,102,241,0.5); }
.margin-input { width: 60px; text-align: center; padding: 6px; }

/* =========================================
   6. KANBAN (Full Height)
   ========================================= */
.kanban-container {
    flex-grow: 1;
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 10px;
    height: 100%;
    min-height: 0;
}

.kanban-col {
    flex: 1;
    min-width: 240px;
    max-width: 320px;
    background: #111827;
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex; flex-direction: column;
    height: 100%;
}

.kanban-header {
    padding: 12px;
    text-align: center;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.kanban-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    scrollbar-width: thin;
}

.kanban-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 8px;
    cursor: grab;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.2s;
    font-size: 0.85rem;
    border-left: 3px solid transparent;
}

.kanban-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
}

.kanban-card:active { cursor: grabbing; }

.kc-title { font-weight: 700; display: block; margin-bottom: 4px; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kc-client { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 8px; display: flex; align-items: center; gap: 5px; }
.kc-footer { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border); padding-top: 8px; margin-top: 5px; }
.kc-price { font-weight: 700; color: var(--success); font-size: 1rem; }

/* Colores Kanban */
.col-borrador .kanban-header { border-top: 3px solid #94a3b8; color: #94a3b8; }
.col-pendiente .kanban-header { border-top: 3px solid #eab308; color: #eab308; }
.col-impreso .kanban-header { border-top: 3px solid #3b82f6; color: #3b82f6; }
.col-entregado .kanban-header { border-top: 3px solid #a855f7; color: #a855f7; }
.col-pagado .kanban-header { border-top: 3px solid #22c55e; color: #22c55e; }
.drag-over { background: rgba(99, 102, 241, 0.1); }

/* =========================================
   7. TABLAS (COMPACTAS)
   ========================================= */
.table-wrapper {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    flex-grow: 1;
    overflow-y: auto;
}

.data-table, .history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

th {
    position: sticky; top: 0;
    background: var(--bg-card); z-index: 1;
    text-align: left; padding: 12px 15px;
    color: var(--text-muted); font-weight: 600;
    font-size: 0.75rem; text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 10px 15px;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
}
tr:last-child td { border-bottom: none; }
tr:hover { background: rgba(255,255,255,0.03); }
.price-cell { color: var(--success); font-weight: 700; font-size: 1.05rem; }
.badge { background: var(--bg-elevated); padding: 3px 8px; border-radius: 6px; font-size: 0.75rem; font-weight: 600; display: inline-block; }

.status-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.7em;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    min-width: 85px;
    text-align: center;
    border: 1px solid transparent;
    cursor: pointer;
    user-select: none;
}
.status-badge:hover { filter: brightness(1.2); }
.st-borrador { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; border-color: #475569; }
.st-pendiente { background: rgba(234, 179, 8, 0.15); color: #fcd34d; border-color: #b45309; }
.st-impreso { background: rgba(59, 130, 246, 0.15); color: #93c5fd; border-color: #1d4ed8; }
.st-entregado { background: rgba(168, 85, 247, 0.15); color: #d8b4fe; border-color: #7e22ce; }
.st-pagado { background: rgba(34, 197, 94, 0.15); color: #86efac; border-color: #15803d; }

/* =========================================
   8. OTROS
   ========================================= */
/* Stock */
.stock-list { margin-top: 15px; overflow-y: auto; flex-grow: 1; padding-right: 5px; }
.stock-item {
    background: rgba(255,255,255,0.02); padding: 10px 12px; border-radius: 8px;
    margin-bottom: 6px; display: flex; align-items: center; justify-content: space-between;
    border: 1px solid transparent; font-size: 0.85rem;
}
.stock-item:hover { border-color: var(--border); }
.stock-bar-bg { width: 100px; height: 6px; background: #334155; border-radius: 3px; overflow: hidden; margin-top: 4px; }
.stock-bar-fill { height: 100%; background: var(--success); transition: width 0.5s; }
.stock-low .stock-bar-fill { background: var(--warning); }
.stock-crit .stock-bar-fill { background: var(--danger); }
.stock-alert-dash { background: rgba(239, 68, 68, 0.1); border: 1px solid var(--danger); border-left: 4px solid var(--danger); padding: 12px 15px; border-radius: 8px; color: #fca5a5; margin-bottom: 20px; display: none; font-size: 0.9rem; font-weight: 600; }
.stock-alert-dash strong { color: #ef4444; }

/* PDF */
#hidden-pdf-wrapper { position: fixed; left: -9999px; top: 0; }
#invoice-container { width: 210mm; background: white; color: #1f2937; padding: 12mm; font-family: 'Arial', sans-serif; font-size: 10px; line-height: 1.4; box-sizing: border-box; }

/* Header */
.inv-header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #6366f1; padding-bottom: 10px; margin-bottom: 15px; }
.inv-logo-box { display: flex; flex-direction: column; gap: 5px; }
.inv-logo-img { max-height: 40px; max-width: 120px; object-fit: contain; }
.inv-shop-name { font-size: 16px; font-weight: 800; color: #1f2937; letter-spacing: 0.5px; }
.inv-meta { text-align: right; }
.inv-meta-title { font-size: 20px; font-weight: 800; color: #6366f1; letter-spacing: 1px; margin-bottom: 6px; }
.inv-meta-row { font-size: 9px; color: #4b5563; margin-bottom: 3px; }

/* Company Data */
.inv-company-data { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 4px; padding: 8px 10px; margin-bottom: 12px; font-size: 8px; color: #4b5563; line-height: 1.5; }
.inv-company-data strong { color: #1f2937; }

/* Info Grid */
.inv-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 15px; }
.inv-col h4 { font-size: 9px; font-weight: 700; color: #6366f1; text-transform: uppercase; margin: 0 0 6px 0; border-bottom: 1px solid #e5e7eb; padding-bottom: 3px; }
.inv-address { background: #f9fafb; padding: 8px; border-radius: 4px; border: 1px solid #e5e7eb; font-size: 9px; line-height: 1.5; }
.inv-tech-details { background: #eff6ff; padding: 8px; border-radius: 4px; border: 1px solid #dbeafe; font-size: 8px; line-height: 1.6; color: #1e40af; }

/* Table */
.inv-table { width: 100%; border-collapse: collapse; margin-bottom: 15px; font-size: 9px; }
.inv-table thead { background: #1f2937; }
.inv-table th { color: white; padding: 6px 5px; text-align: left; font-weight: 600; font-size: 8px; text-transform: uppercase; letter-spacing: 0.3px; }
.inv-table td { padding: 6px 5px; border-bottom: 1px solid #e5e7eb; vertical-align: top; }
.inv-table tbody tr:hover { background: #f9fafb; }
.inv-table td strong { color: #1f2937; font-size: 9px; display: block; margin-bottom: 2px; }
.inv-table td small { color: #6b7280; font-size: 7px; display: block; line-height: 1.3; }

/* Totals */
.inv-totals-box { width: 45%; margin-left: auto; border: 1px solid #e5e7eb; border-radius: 4px; padding: 10px; background: #f9fafb; }
.inv-row { display: flex; justify-content: space-between; margin-bottom: 5px; font-size: 10px; color: #4b5563; }
.inv-row span:first-child { font-weight: 600; }
.inv-row span:last-child { font-weight: 700; color: #1f2937; }
.inv-row.final { font-size: 13px; font-weight: 800; color: #1f2937; border-top: 2px solid #1f2937; padding-top: 8px; margin-top: 6px; }
.inv-row.final span { color: #6366f1; }

/* Conditions */
.inv-conditions { background: #fffbeb; border: 1px solid #fcd34d; border-radius: 4px; padding: 10px; margin: 15px 0 10px 0; }
.inv-conditions h4 { font-size: 9px; font-weight: 700; color: #92400e; margin: 0 0 6px 0; text-transform: uppercase; }
.inv-conditions ul { margin: 0; padding-left: 16px; }
.inv-conditions li { font-size: 8px; color: #78350f; margin-bottom: 3px; line-height: 1.4; }

/* Footer */
.inv-footer { margin-top: 15px; padding-top: 10px; border-top: 1px solid #e5e7eb; font-size: 8px; text-align: center; color: #6b7280; }

/* Loader */
.loading-overlay { display: none; position: fixed; top:0; left:0; width:100%; height:100%; background: rgba(15,23,42,0.95); z-index: 9999; flex-direction: column; justify-content: center; align-items: center; backdrop-filter: blur(4px); }
.spinner { width: 50px; height: 50px; border: 4px solid rgba(255,255,255,0.1); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.logo-preview { max-width: 120px; max-height: 60px; border: 1px solid var(--border); display: none; margin-top: 10px; border-radius: 4px; }