/* ================================================
   VARIÁVEIS (estilo do CSS antigo)
================================================= */
:root {
    --primary-color: #00C4A7;
    --primary-dark: #006D7A;
    --secondary-color: #5d7189;
    --success-color: #00A884;
    --danger-color: #dc2626;
    --warning-color: #ea580c;
    --bg-color: #f4f7fa;
    --card-bg: #ffffff;
    --border-color: #dce5ee;
    --text-color: #0D1323;
    --text-light: #607086;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --brand-navy: #0D1323;
    --brand-blue: #1A2E4D;
    --brand-teal: #00C4A7;
    --brand-cyan: #006D7A;
    --brand-light: #E6E8EB;
}

/* RESET */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* ================================================
   LAYOUT GERAL
================================================= */
body {
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
}

/* Container */
.container { display: flex; height: 100vh; }

/* Sidebar */
.sidebar {
    width: 250px;
    background:
        radial-gradient(circle at 0% 0%, rgba(0, 196, 167, 0.18), transparent 32%),
        linear-gradient(180deg, #0D1323 0%, #10213a 56%, #08111f 100%);
    border-right: 1px solid rgba(230, 232, 235, 0.12);
    padding: 20px;
    overflow-y: auto;
    box-shadow: 14px 0 38px rgba(13, 19, 35, 0.22);
}

.sidebar h1 {
    color: #ffffff;
    font-size: 18px;
    letter-spacing: 0;
}

.brand {
    margin-bottom: 24px;
    text-align: center;
}

.brand small {
    color: #94a9bd;
    display: block;
    margin-top: 4px;
}

.brand img {
    width: 100%;
    max-width: 180px;
    max-height: 96px;
    object-fit: contain;
    margin-bottom: 10px;
}

/* Menu */
.menu { list-style: none; }
.menu li { margin-bottom: 10px; }

.menu button {
    width: 100%;
    padding: 12px;
    background: rgba(230, 232, 235, 0.045);
    border: 1px solid rgba(230, 232, 235, 0.1);
    color: #dce8f4;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    text-align: left;
}

.menu button:hover {
    background: rgba(0, 196, 167, 0.12);
    border-color: rgba(0, 196, 167, 0.32);
    color: #ffffff;
}

.menu button.active {
    background: linear-gradient(90deg, var(--brand-cyan), var(--brand-teal));
    border-color: rgba(0, 196, 167, 0.8);
    color: #ffffff;
    box-shadow: 0 14px 30px rgba(0, 196, 167, 0.18);
}

/* ================================================
   MAIN
================================================= */
.main { flex: 1; display: flex; flex-direction: column; }

/* Header */
.header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

.header h2 {
    color: var(--text-color);
}

.header span {
    color: var(--text-light);
}

/* Content */
.content { flex: 1; overflow-y: auto; padding: 20px; }

.page { display: none; }
.page.active { display: block; }

/* Alerts */
#alert { 
    margin-bottom: 20px; 
    padding: 15px; 
    border-radius: 6px; 
}

.error { 
    background: #fee2e2; 
    border: 1px solid var(--danger-color); 
    color: var(--danger-color); 
}

.success { 
    background: #dcfce7;
    border: 1px solid var(--success-color); 
    color: var(--success-color); 
}

/* ================================================
   DASHBOARD CARDS
================================================= */
.grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
    gap: 20px; 
    margin-bottom: 30px; 
}

.executive-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-card h4 {
    color: var(--text-light);
    margin-bottom: 10px;
}

.stat-card .value {
    font-size: 28px;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-card .value.money {
    font-size: 22px;
}

.dashboard-charts,
.dashboard-tables {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.chart-card {
    min-height: 320px;
}

.chart-card canvas {
    width: 100% !important;
    height: 240px !important;
}

/* ================================================
   CARDS
================================================= */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.card h3 { 
    color: var(--text-color); 
    margin-bottom: 15px; 
}

/* ================================================
   TABELAS
================================================= */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.table th {
    background: var(--bg-color);
    color: var(--text-color);
    padding: 12px;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
}

.table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.table tr:hover {
    background: var(--bg-color);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 10px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
    text-transform: capitalize;
}

.status-ativa {
    background: #dcfce7;
    color: #166534;
}

.status-agendada {
    background: #dbeafe;
    color: #1d4ed8;
}

.status-pausada,
.status-rascunho {
    background: #fef3c7;
    color: #92400e;
}

.status-encerrada,
.status-arquivada {
    background: #fee2e2;
    color: #991b1b;
}

/* ================================================
   BOTÕES
================================================= */
.btn {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    margin-right: 10px;
    transition: 0.2s;
}

.btn:hover { background: var(--primary-dark); }

.btn-danger {
    background: var(--danger-color);
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-small {
    padding: 6px 10px;
    font-size: 12px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 4px;
}

.btn-small:hover {
    background: #475569;
}

.toolbar {
    margin-bottom: 20px;
}

.muted {
    color: var(--text-light);
    font-size: 13px;
    margin-bottom: 12px;
}

/* ================================================
   SEARCH BOX
================================================= */
.search-box {
    margin-bottom: 20px; 
    display: flex; 
    gap: 10px; 
}

.search-box input {
    flex: 1;
    padding: 10px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 6px;
}

.search-box input::placeholder {
    color: var(--text-light);
}

/* ================================================
   MODALS
================================================= */
.modal { 
    display: none; 
    position: fixed; 
    top: 0; left: 0; 
    width: 100%; height: 100%; 
    background: rgba(0, 0, 0, 0.5); 
    z-index: 1000; 
    align-items: center; 
    justify-content: center; 
}

.modal.active,
.modal.show { display: flex; }

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 30px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-content.wide {
    max-width: 760px;
}

.modal-content h2 { 
    color: var(--text-color); 
    margin-bottom: 20px; 
}

/* Formulários */
.form-group { margin-bottom: 15px; }

.form-group label { 
    display: block; 
    color: var(--text-color); 
    margin-bottom: 5px; 
    font-weight: bold; 
}

.form-group input, 
.form-group textarea, 
.form-group select {
    width: 100%;
    padding: 10px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 6px;
}

.form-group input::placeholder {
    color: var(--text-light);
}

.license-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.license-modules {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-color);
}

.license-modules label {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 0;
    font-weight: 500;
}

.license-modules input {
    width: auto;
}

.settings-row {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.settings-row.stack {
    display: block;
}

.admin-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    margin: 12px 0;
}

.admin-form-grid input,
.admin-form-grid select,
#email-templates {
    width: 100%;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font: inherit;
}

#logo-preview {
    max-width: 220px;
    max-height: 120px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
}

.status-ativa,
.status-nao-ativada,
.status-expirada {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.status-ativa {
    background: #dcfce7;
    color: var(--success-color);
}

.status-nao-ativada {
    background: #fef3c7;
    color: #92400e;
}

.status-expirada {
    background: #fee2e2;
    color: var(--danger-color);
}

/* Status */
.status {
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.status.active {
    background: #dcfce7;
    color: var(--success-color);
}

.status.inactive {
    background: #fee2e2;
    color: var(--danger-color);
}

/* ================================================
   RESPONSIVE
================================================= */
@media (max-width: 768px) {
    .container { flex-direction: column; }
    .sidebar { width: 100%; height: auto; }
    .menu { display: flex; flex-wrap: wrap; }
    .menu li { flex: 1; min-width: 100px; }
    .grid { grid-template-columns: 1fr; }
    .dashboard-charts,
    .dashboard-tables { grid-template-columns: 1fr; }
    .table { font-size: 12px; }
    .table th, .table td { padding: 8px; }
}
