:root {
    --primary: #2563EB; /* Azul confiável, estimula foco */
    --primary-hover: #1D4ED8;
    --bg-color: #F3F4F6;
    --surface: #FFFFFF;
    --text-main: #111827;
    --text-muted: #6B7280;
    --error: #EF4444;
    --success: #10B981;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }

body {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-color);
}

.main-container {
    display: flex;
    width: 900px;
    height: 550px;
    background: var(--surface);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

/* Lado Esquerdo - Branding */
.brand-panel {
    flex: 1;
    background: linear-gradient(135deg, var(--primary) 0%, #1e40af 100%);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.brand-panel h1 { font-size: 2.5rem; letter-spacing: -1px; }
.brand-panel p { opacity: 0.8; font-weight: 300; margin-top: 0.5rem; }

/* Lado Direito - Formulário */
.form-panel {
    flex: 1.2;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.form-header { margin-bottom: 2rem; }
.form-header h2 { color: var(--text-main); font-size: 1.5rem; margin-bottom: 0.5rem; }
.form-header p { color: var(--text-muted); font-size: 0.875rem; }

.input-group { margin-bottom: 1rem; }
.input-group label { display: block; font-size: 0.875rem; color: var(--text-main); margin-bottom: 0.5rem; font-weight: 500; }
.input-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }

button#submit-btn {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    transition: background-color 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}

button#submit-btn:hover { background-color: var(--primary-hover); }

/* Toggle (Login/Registro) */
.toggle-action {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.5rem;
    font-size: 0.875rem;
    justify-content: center;
}
.toggle-action button { background: none; border: none; color: var(--primary); font-weight: 600; cursor: pointer; }

/* Utilitários */
.hidden { display: none; }
.feedback { margin-top: 1rem; padding: 0.75rem; border-radius: 6px; font-size: 0.875rem; text-align: center; }
.feedback.error { background-color: #FEF2F2; color: var(--error); border: 1px solid #FECACA; }
.feedback.success { background-color: #ECFDF5; color: var(--success); border: 1px solid #A7F3D0; }

/* Loader simples */
.loader { border: 2px solid #f3f3f3; border-top: 2px solid white; border-radius: 50%; width: 16px; height: 16px; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Adicione isso ao final do seu style.css existente */

.dashboard-container {
    display: flex;
    height: 100vh;
    background-color: #F8FAFC; /* Fundo cinza muito claro, descansa a vista */
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: #FFFFFF;
    border-right: 1px solid #E2E8F0;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.sidebar .brand h2 { color: var(--primary); margin-bottom: 2rem; font-size: 1.5rem; }

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: all 0.2s;
    font-weight: 500;
}

.sidebar nav a:hover, .sidebar nav a.active {
    background-color: #EFF6FF;
    color: var(--primary);
}

.sidebar .badge {
    margin-left: auto;
    background: var(--error);
    color: white;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
}

.user-profile {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 1rem;
    border-top: 1px solid #E2E8F0;
}

#btn-logout {
    transition: all 0.2s ease;
}

#btn-logout:hover {
    background-color: #FEF2F2; /* Fundo vermelho bem claro */
    border-color: #FECACA;
}

#btn-logout:hover .info span, 
#btn-logout:hover i {
    color: var(--danger); /* Vermelho */
}

.info span{
    display: flex;
     flex-direction: row;
     justify-content: space-between;
     align-items: center;
}

.avatar {
    width: 40px; height: 40px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold;
}

/* Main Content */
.content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

header h1 { color: var(--text-main); font-size: 1.8rem; }
.subtitle { color: var(--text-muted); }

/* Cards & Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid #E2E8F0;
}

.kpi-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.kpi-header span { color: var(--text-muted); font-size: 0.9rem; font-weight: 500; }

.icon-bg {
    padding: 8px;
    border-radius: 8px;
    width: 36px; height: 36px;
}
.icon-bg.green { background: #ECFDF5; color: #10B981; }
.icon-bg.blue { background: #EFF6FF; color: #2563EB; }
.icon-bg.purple { background: #F3E8FF; color: #9333EA; }

.kpi h3 { font-size: 2rem; color: var(--text-main); margin-bottom: 0.5rem; }
.trend { font-size: 0.85rem; color: #10B981; font-weight: 500; }

/* Dashboard Split Layout */
.dashboard-split {
    display: grid;
    grid-template-columns: 1.5fr 1fr; /* 60% SKUs, 40% Calc */
    gap: 1.5rem;
}

/* SKU List Styling */
.card-header { display: flex; justify-content: space-between; margin-bottom: 1rem; }
.sku-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid #F1F5F9;
}
.sku-item:last-child { border-bottom: none; }
.sku-thumb {
    width: 48px; height: 48px;
    background: #E2E8F0;
    border-radius: 8px;
    object-fit: cover;
}
.sku-details { flex: 1; }
.sku-name { font-weight: 600; display: block; color: var(--text-main); }
.sku-sales { font-size: 0.85rem; color: var(--text-muted); }
.sku-rank { font-size: 1.2rem; font-weight: bold; color: #CBD5E1; }
.sku-item:nth-child(1) .sku-rank { color: #F59E0B; } /* Ouro */
.sku-item:nth-child(2) .sku-rank { color: #94A3B8; } /* Prata */
.sku-item:nth-child(3) .sku-rank { color: #B45309; } /* Bronze */

/* Calculator Styling */
.calculator { background: linear-gradient(to bottom right, #ffffff, #f8fafc); }
.input-row { display: flex; gap: 1rem; margin-bottom: 1rem; }
.field { flex: 1; }
.field label { display: block; font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px; font-weight: 600; }
.field input, .field select {
    width: 100%;
    padding: 8px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 0.9rem;
}
.calc-result {
    background: var(--primary);
    color: white;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    margin-top: 1rem;
}
.calc-result span { font-size: 0.85rem; opacity: 0.9; }
.calc-note { font-size: 0.75rem; color: var(--text-muted); text-align: center; margin-top: 0.5rem; }

/* Adicione ao style.css */

/* Breakdown Card (O Raio-X) */
.cost-breakdown-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    border-left: 5px solid var(--primary);
}

.breakdown-visual {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-top: 1.5rem;
}

.cost-stack {
    display: flex;
    gap: 1rem;
    flex: 1;
    flex-wrap: wrap;
}

.stack-item {
    background: #F1F5F9;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    min-width: 120px;
    border: 1px solid #E2E8F0;
}

.stack-item span.label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; font-weight: 600; }
.stack-item span.value { font-size: 1.1rem; color: var(--text-main); font-weight: 700; }

.equals { font-size: 2rem; color: var(--text-muted); }

.final-cost {
    text-align: right;
    background: #EFF6FF;
    padding: 1rem 2rem;
    border-radius: 12px;
    border: 1px solid #DBEAFE;
}
.final-cost .currency { font-size: 1.5rem; color: var(--primary); vertical-align: top; }
.final-cost .value { font-size: 3rem; font-weight: 800; color: var(--primary); line-height: 1; }
.final-cost .label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-top: 0.5rem; }

/* Inventory Grid */
.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.inv-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #E2E8F0;
    transition: transform 0.2s;
}
.inv-card:hover { transform: translateY(-3px); box-shadow: 0 4px 6px rgba(0,0,0,0.05); }

.inv-header { display: flex; justify-content: space-between; margin-bottom: 1rem; }
.inv-icon { width: 40px; height: 40px; background: #F8FAFC; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); }

.inv-stat { margin-bottom: 1rem; }
.inv-stat .big-number { font-size: 2rem; font-weight: 700; color: var(--text-main); }
.inv-stat .unit { font-size: 0.9rem; color: var(--text-muted); }

.progress-bar { height: 6px; background: #E2E8F0; border-radius: 3px; overflow: hidden; margin-top: 0.5rem; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width 0.5s ease; }
.progress-fill.low { background: #EF4444; } /* Vermelho se baixo */
.progress-fill.med { background: #F59E0B; } /* Laranja se médio */

.inv-cost-detail { font-size: 0.85rem; color: var(--text-muted); margin-top: 1rem; padding-top: 0.5rem; border-top: 1px dashed #E2E8F0; }

/* Table Styles */
.data-table { width: 100%; border-collapse: collapse; background: white; border-radius: 8px; overflow: hidden; }
.data-table th, .data-table td { padding: 1rem; text-align: left; border-bottom: 1px solid #E2E8F0; }
.data-table th { background: #F8FAFC; font-weight: 600; color: var(--text-muted); font-size: 0.85rem; }
.data-table td { font-size: 0.9rem; color: var(--text-main); }

/* Adicione no final do style.css */

.date-filter {
    display: flex;
    align-items: center;
    background: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.date-filter select {
    border: none;
    background: transparent;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    outline: none;
    padding-right: 1.5rem; /* Espaço para a seta nativa */
    appearance: none; /* Remove estilo padrão do browser */
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 0 center;
    background-size: 0.65em;
}

/* --- PRINT HUB STYLES --- */

.print-workspace {
    display: flex;
    gap: 20px;
    height: calc(100vh - 140px); /* Ocupa altura restante */
    margin-top: 1rem;
}

/* Coluna da Esquerda: Biblioteca */
.library-panel {
    width: 280px;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border);
    display: flex; flex-direction: column;
    overflow: hidden;
}

.library-header {
    padding: 1rem; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
    background: #F8FAFC;
}

.library-grid {
    padding: 1rem;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    flex: 1;
}

.lib-item {
    cursor: grab;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px;
    background: white;
    transition: all 0.2s;
}
.lib-item:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.lib-item img { width: 100%; height: 80px; object-fit: contain; background: #f1f5f9; border-radius: 4px; }
.lib-item span { display: block; font-size: 0.75rem; text-align: center; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Coluna da Direita: A Folha */
.sheet-panel {
    flex: 1;
    background: #E2E8F0; /* Fundo cinza da mesa */
    border-radius: 8px;
    padding: 20px;
    overflow: auto; /* Scroll se a folha for grande */
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

/* A Folha em si (Canvas) */
.print-sheet {
    /* Simulando 60cm x 100cm */
    /* Vamos usar proporção de pixels para tela. */
    /* Se 1cm = 10px, então 60cm = 600px e 100cm = 1000px */
    width: 600px; 
    height: 1000px;
    background: white;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden; /* Itens não saem da folha */
    transition: transform 0.2s;
}

/* Grid de Fundo (10x10cm visualmente) */
.grid-lines {
    position: absolute; top:0; left:0; right:0; bottom:0;
    background-image: 
        linear-gradient(to right, #f1f5f9 1px, transparent 1px),
        linear-gradient(to bottom, #f1f5f9 1px, transparent 1px);
    background-size: 100px 100px; /* Grades maiores */
    pointer-events: none;
}

.sheet-info {
    margin-top: 10px; font-size: 0.8rem; color: #64748B;
}

/* Itens Soltos na Folha */
.sheet-item {
    position: absolute;
    cursor: grab;
    /* Tamanho padrão da estampa na folha (ex: 20x20cm = 200x200px) */
    width: 200px; 
    height: 200px; 
    padding: 5px;
    box-sizing: border-box;
}

.sheet-item:active { cursor: grabbing; }
.sheet-item img {
    width: 100%; height: 100%; object-fit: contain;
    border: 1px dashed #CBD5E1; /* Borda pontilhada para corte */
}
.sheet-item:hover img { border-color: var(--primary); border-style: solid; }

/* Botão de excluir item da folha */
.item-remove-btn {
    position: absolute; top: -10px; right: -10px;
    background: red; color: white; border: none;
    border-radius: 50%; width: 20px; height: 20px;
    font-size: 12px; cursor: pointer; display: none;
    align-items: center; justify-content: center;
}
.sheet-item:hover .item-remove-btn { display: flex; }

.kpi-grid {
    display: flex !important;
    flex-wrap: wrap;
    gap: 1.5rem;
}
.kpi-grid .card.kpi {
    flex: 1 1 240px !important; /* Faz os cartões esticarem para preencher o vazio */
    min-width: 220px;
}