/* ========================= */
/* RESET */
/* ========================= */
* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

/* ========================= */
/* BASE */
/* ========================= */
body {
    font-family: 'Segoe UI', sans-serif;
    background: #f1f5f9;
    color: #0f172a;
}

/* ========================= */
/* LAYOUT */
/* ========================= */
.dashboard {
    display: flex;
    min-height: 100vh;
}

/* ========================= */
/* SIDEBAR */
/* ========================= */
.sidebar {
    width: 240px;
    min-width: 240px;
    background: #1e293b;
    padding: 20px;
    display: flex;
    flex-direction: column;
    color: #fff;
    transition: 0.3s;
}

/* MOBILE SIDEBAR */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -240px;
        top: 0;
        height: 100%;
        z-index: 1000;
    }

    .sidebar.open {
        left: 0;
    }
}

/* LOGO */
.logo {
    max-width: 200px;
    height: auto;
}

/* ========================= */
/* MENU */
/* ========================= */
.menu {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    color: #cbd5f5;
    transition: 0.2s;
}

.menu a:hover {
    background: #334155;
}

.menu a.active {
    background: #22c55e;
    color: #fff;
}

/* ========================= */
/* LOGOUT */
/* ========================= */
.logout {
    margin-top: auto;
    padding-top: 20px;
}

.logout a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    color: #f87171;
    font-weight: 500;
    transition: all 0.2s ease;
}

.logout a:hover {
    background: rgba(248, 113, 113, 0.12);
    color: #ef4444;
}

/* ========================= */
/* CONTENT */
/* ========================= */
.content {
    flex: 1;
    padding: 30px;
    background: #f1f5f9;
}

@media (max-width: 768px) {
    .content {
        padding: 15px;
    }
}

/* ========================= */
/* TOPBAR */
/* ========================= */
.topbar {
    margin-bottom: 20px;
}

.topbar h1 {
    font-size: 28px;
    font-weight: 600;
}

/* ========================= */
/* CARDS */
/* ========================= */
.cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.card {
    background: #ffffff;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    color: #0f172a;
}

.card:hover {
    background: #f8fafc;
    transform: translateY(-4px);
}

.card i {
    width: 32px;
    height: 32px;
    margin-bottom: 10px;
    opacity: 0.9;
}

.card h3 {
    margin: 0;
    font-size: 18px;
}

.card a {
    color: inherit;
    text-decoration: none;
}

.card p {
    color: #475569;
}

/* RESPONSIVO CARDS */
@media (max-width: 1024px) {
    .cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .cards {
        grid-template-columns: 1fr;
    }
}

/* ========================= */
/* DROPDOWN */
/* ========================= */
.menu-group {
    display: flex;
    flex-direction: column;
}

.menu-item.toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 8px;
    color: #cbd5f5;
    cursor: pointer;
}

.menu-item.toggle:hover {
    background: #334155;
}

/* submenu */
.submenu {
    display: none;
    flex-direction: column;
    margin-left: 10px;
}

.submenu a {
    padding: 10px;
    font-size: 14px;
    color: #94a3b8;
    border-radius: 6px;
    text-decoration: none;
}

.submenu a:hover {
    background: #334155;
    color: #fff;
}

.menu-group.active .submenu {
    display: flex;
}

/* ========================= */
/* SUBMENU NOVO */
/* ========================= */
.submenu-group {
    margin-left: 10px;
}

.submenu-title {
    padding: 8px 10px;
    cursor: pointer;
    color: #94a3b8;
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.submenu-title:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
}

.submenu-items {
    display: none;
    flex-direction: column;
    margin-left: 10px;
}

.submenu-items a {
    font-size: 14px;
    padding: 8px 10px;
}

.submenu-group.open .submenu-items {
    display: flex;
}

/* SETAS */
.menu-arrow {
    transition: transform 0.3s ease;
}

.menu-group.open > .menu-group-title .menu-arrow {
    transform: rotate(180deg);
}

.submenu-group.open > .submenu-title .menu-arrow {
    transform: rotate(180deg);
}

/* ========================= */
/* KPI / DASHBOARD */
/* ========================= */
.kpis {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.kpi {
    background: #1e293b;
    color: #fff;
    padding: 20px;
    border-radius: 10px;
    font-size: 14px;
}

.kpi strong {
    font-size: 18px;
}

.kpi.green { background: #16a34a; }
.kpi.red { background: #dc2626; }

/* ========================= */
/* TABELAS */
/* ========================= */
.tables {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

.table-card {
    flex: 1;
    background: #fff;
    padding: 20px;
    border-radius: 12px;
}

.row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
}

.green { color: #16a34a; }
.red { color: #dc2626; }

/* ========================= */
/* 🔥 FORMULÁRIOS RESPONSIVOS */
/* ========================= */
.form-section {
    background: #ffffff;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #fff;
}

.form-grid .full {
    grid-column: 1 / -1;
}

/* MOBILE FORM */
@media (max-width: 480px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}