/* =====================================================
   GASMASKE LAB — ERP SYSTEM STYLESHEET
   v2.0 | Editorial Premium + Enterprise Grade
===================================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

/* =====================================================
   TOKENS DE DESIGN
===================================================== */
:root {
    /* Cores Principais */
    --coral:          #E8352D;
    --coral-dark:     #C22922;
    --coral-light:    #fdf0ef;
    --coral-mid:      #f9d0ce;

    /* Neutros Editoriais */
    --ink:            #0F0F0F;
    --ink-soft:       #1C1C1C;
    --ink-muted:      #2e2e2e;

    /* Superfícies */
    --warm-white:     #FAF9F7;
    --paper:          #F4F2EE;
    --paper-dark:     #EBE8E2;
    --surface:        #FFFFFF;

    /* Texto */
    --text-primary:   #141414;
    --text-secondary: #5e5e5e;

    /* Estrutura */
    --sidebar-width:  260px;
    --header-height:  72px;

    /* Sombras e Bordas (Glassmorphism / Soft UI) */
    --shadow-sm:      0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md:      0 4px 12px -2px rgba(0, 0, 0, 0.05);
    --border-color:   #E4DFD6;
}

/* =====================================================
   RESETS E BASE
===================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.erp-body {
    font-family: 'DM Sans', sans-serif;
    background-color: var(--paper);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    overflow: hidden; /* Prevent body scroll, layout handles it */
}

h1, h2, h3, h4 {
    font-family: 'DM Serif Display', serif;
    font-weight: 400;
    color: var(--ink);
    letter-spacing: 0.2px;
}

/* =====================================================
   LAYOUT PRINCIPAL (GRID)
===================================================== */
.erp-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
}

.erp-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    position: relative;
    background-color: var(--paper);
}

.erp-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    padding-bottom: 4rem; /* Spacing for footer */
}

/* =====================================================
   SIDEBAR (MENU LATERAL)
===================================================== */
.erp-sidebar {
    width: var(--sidebar-width);
    background-color: var(--ink);
    color: var(--warm-white);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 50;
}

.sidebar-logo {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-logo-text {
    font-family: 'DM Serif Display', serif;
    font-size: 1.25rem;
    letter-spacing: 2px;
}

.sidebar-logo-text span {
    color: var(--coral);
}

.sidebar-logo-badge {
    margin-left: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    font-size: 0.6rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-weight: 600;
    letter-spacing: 1px;
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-section-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #666;
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    padding-left: 0.75rem;
}

.sidebar-section-label:first-child {
    margin-top: 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    color: #999;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-link:hover {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--warm-white);
}

.sidebar-link.active {
    background-color: var(--ink-soft);
    color: var(--coral);
    font-weight: 600;
}

.sidebar-link-icon {
    width: 20px;
    text-align: center;
    margin-right: 0.75rem;
    font-size: 1.1rem;
    opacity: 0.8;
}

/* User Card Bottom Sidebar */
.sidebar-user {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden;
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--ink-muted);
    color: var(--warm-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.sidebar-user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--warm-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.7rem;
    color: #666;
    text-transform: capitalize;
}

.sidebar-logout {
    color: #666;
    transition: color 0.2s;
    padding: 0.5rem;
}
.sidebar-logout:hover { color: var(--coral); }

/* =====================================================
   HEADER SUPERIOR
===================================================== */
.erp-header {
    height: var(--header-height);
    background-color: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    flex-shrink: 0;
    margin-top: 200px;
}

.header-title h1 {
    font-size: 1.75rem;
    margin-bottom: 0.15rem;
}

.header-title p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.date-badge {
    background: var(--surface);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--ink);
    cursor: pointer;
    margin-right: 1rem;
}

/* =====================================================
   MÉTRICAS (DASHBOARD CARDS)
===================================================== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.metric-label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.metric-value {
    display: block;
    font-family: 'DM Serif Display', serif;
    font-size: 1.8rem;
    color: var(--ink);
    line-height: 1;
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}
.metric-icon.neutral {
    background: var(--paper);
    color: var(--ink-muted);
}

/* =====================================================
   CARDS DE CONTEÚDO E TABELAS
===================================================== */
.dashboard-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .dashboard-columns {
        grid-template-columns: 1fr;
    }
}

.erp-card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    font-size: 1.1rem;
    margin: 0;
}

.card-action {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--coral);
    text-decoration: none;
}
.card-action:hover { text-decoration: underline; }

.card-body {
    padding: 1.5rem;
}

/* Lista de Tarefas */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.task-item {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}
.task-item:hover { background: var(--paper); }

.task-title {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0.2rem;
}

.task-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Tabelas */
.erp-table {
    width: 100%;
    border-collapse: collapse;
}

.erp-table th {
    background-color: rgba(0,0,0,0.02);
    padding: 0.75rem 1.5rem;
    text-align: left;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.erp-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.erp-table tr:last-child td { border-bottom: none; }
.erp-table tr:hover td { background-color: rgba(0,0,0,0.01); }

/* Badges */
.badge {
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-danger { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-warning { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}
.empty-state-icon {
    font-size: 2.5rem;
    color: var(--border-color);
    margin-bottom: 1rem;
}
.empty-state-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* =====================================================
   RODAPÉ (FOOTER)
===================================================== */
.erp-footer {
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.footer-divider {
    margin: 0 0.5rem;
    color: var(--border-color);
}

/* =====================================================
   TAILWIND — CORES LEGADAS (verde → coral)
===================================================== */
.bg-green-500, .bg-green-600     { background-color: var(--coral) !important; }
.hover\:bg-green-600:hover,
.hover\:bg-green-700:hover       { background-color: var(--coral-dark) !important; }
.text-green-500, .text-green-600 { color: var(--coral) !important; }
.border-green-500, .border-green-600 { border-color: var(--coral) !important; }
.bg-green-50, .bg-green-100      { background-color: var(--coral-light) !important; }
.text-green-700, .text-green-800 { color: #a3221c !important; }
.border-green-400                { border-color: var(--coral-mid) !important; }

/* =====================================================
   RESPONSIVIDADE — MOBILE
===================================================== */
@media (max-width: 1024px) {
    .erp-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .erp-sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-md);
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 40;
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }

    .erp-header {
        padding: 0 1.5rem;
    }

    .erp-content {
        padding: 1.5rem;
    }
}