:root {
    --bg: #f4f7fb;
    --card: #ffffff;
    --border: #e5e7eb;
    --text: #111827;
    --muted: #64748b;
    --primary: #0f766e;
    --primary-light: #14b8a6;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}

header {
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    color: white;
    padding: 24px 20px;
    box-shadow: 0 2px 10px rgba(15, 118, 110, 0.2);
}

.header-container, .container {
    max-width: 900px;
    margin: 0 auto;
}

.container { padding: 30px 16px; }

/* Estados de Carregamento e Erro */
.state-container {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    margin: 0 auto 16px auto;
    animation: spin 1s linear infinite;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Tabela Premium */
.card-tabela {
    background: var(--card);
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.tabela-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.tabela-header h3 { margin: 0; color: #334155; }

.total-badge {
    background: #f0fdf4;
    color: #16a34a;
    padding: 8px 16px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1.1rem;
    border: 1px solid #bbf7d0;
}

.table-responsive { width: 100%; overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

th {
    background: #f8fafc;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 16px 24px;
    text-align: left;
    border-bottom: 2px solid var(--border);
}

td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    color: #334155;
    font-size: 0.95rem;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background-color: #f8fafc; }

/* --- Badges de Estoque para a Tabela de Produtos --- */
.badge-unidade {
    background: #f1f5f9;
    color: #475569;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: bold;
    display: inline-block;
}

.badge-ok { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.badge-critico { background: #fef9c3; color: #a16207; border: 1px solid #fef08a; }
.badge-esgotado { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }