@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
    --accent: #4f46e5;
    --accent-light: #eef2ff;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --text: #1e2433;
    --text-muted: #6b7280;
    --bg: #f7f8fb;
    --card: #ffffff;
    --border: #e7e9f0;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
    --ease: cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }

h1, h2, h3, h4, h5, h6 { font-weight: 600; margin: 0; }

/* ===== Layout ===== */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--card);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: transform .3s var(--ease);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 24px;
    font-weight: 700;
    font-size: 17px;
}

.sidebar-brand .logo-dot {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 15px;
}

.nav-group-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    padding: 16px 12px 6px;
    font-weight: 600;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background .15s var(--ease), color .15s var(--ease);
}

.nav-link i { font-size: 16px; width: 18px; text-align: center; color: var(--text-muted); }

.nav-link:hover { background: var(--accent-light); color: var(--accent); }
.nav-link:hover i { color: var(--accent); }

.nav-link.active { background: var(--accent-light); color: var(--accent); }
.nav-link.active i { color: var(--accent); }

.main {
    flex: 1;
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-title { font-size: 16px; font-weight: 600; }

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text);
}

.content { padding: 28px; max-width: 1200px; }

/* ===== Cards / componentes ===== */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
}

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.stat-card { display: flex; flex-direction: column; gap: 6px; }
.stat-card .label { color: var(--text-muted); font-size: 12.5px; font-weight: 500; }
.stat-card .value { font-size: 24px; font-weight: 700; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 11px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-success { background: #ecfdf3; color: var(--success); }
.badge-danger { background: #fef2f2; color: var(--danger); }
.badge-warning { background: #fffbeb; color: var(--warning); }
.badge-muted { background: #f2f3f7; color: var(--text-muted); }

/* ===== Botões ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform .12s var(--ease), box-shadow .12s var(--ease), filter .12s var(--ease);
}
.btn:active { transform: scale(.97); }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }

.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }

.btn-whatsapp { background: #25d366; color: #fff; }
.btn-whatsapp:hover { filter: brightness(1.05); }

.btn-block { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 12.5px; }

/* ===== Formulários ===== */
.field { margin-bottom: 16px; }
.field label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}
.field input, .field select, .field textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13.5px;
    background: var(--bg);
    color: var(--text);
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
    background: #fff;
}

/* ===== Alertas ===== */
.alert {
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 9px;
    animation: slideDown .3s var(--ease);
}
.alert-success { background: #ecfdf3; color: #036b3f; border: 1px solid #b7ecd0; }
.alert-danger { background: #fef2f2; color: #a11212; border: 1px solid #f6bcbc; }
.alert-warning { background: #fffbeb; color: #92650a; border: 1px solid #fbe1a8; }
.alert-info { background: var(--accent-light); color: var(--accent); border: 1px solid #d6d9fb; }

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 20, 30, .45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
    opacity: 0;
    transition: opacity .2s var(--ease);
}
.modal-overlay.is-open { display: flex; opacity: 1; }

.modal {
    background: var(--card);
    border-radius: var(--radius);
    max-width: 480px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(16, 24, 40, .25);
    transform: translateY(16px) scale(.98);
    opacity: 0;
    transition: transform .25s var(--ease), opacity .25s var(--ease);
}
.modal-overlay.is-open .modal { transform: translateY(0) scale(1); opacity: 1; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 22px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 15.5px; }
.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    padding: 4px;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 22px; }
.modal-footer {
    padding: 16px 22px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ===== Animações ===== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeInUp .35s var(--ease) both; }
.fade-in-delay-1 { animation: fadeInUp .35s var(--ease) .05s both; }
.fade-in-delay-2 { animation: fadeInUp .35s var(--ease) .1s both; }

/* ===== Login ===== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eef1ff 0%, #f7f8fb 60%);
    padding: 20px;
}
.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--card);
    border-radius: 20px;
    padding: 36px 32px;
    box-shadow: 0 12px 40px rgba(79, 70, 229, .1);
    border: 1px solid var(--border);
}
.auth-brand { text-align: center; margin-bottom: 28px; }
.auth-brand .logo-dot {
    width: 56px; height: 56px; border-radius: 16px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 14px; color: #fff; font-size: 24px;
}
.auth-brand h1 { font-size: 20px; }
.auth-brand p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ===== Tabela ===== */
table.table { width: 100%; border-collapse: collapse; }
table.table th {
    text-align: left; font-size: 12px; font-weight: 600; color: var(--text-muted);
    padding: 10px 12px; border-bottom: 1.5px solid var(--border); white-space: nowrap;
}
table.table td { padding: 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
table.table tr:hover td { background: var(--bg); }

/* ===== Responsivo ===== */
@media (max-width: 860px) {
    .sidebar {
        position: fixed;
        left: 0; top: 0;
        z-index: 40;
        transform: translateX(-100%);
        box-shadow: 0 0 0 2000px rgba(0,0,0,0);
    }
    .sidebar.is-open { transform: translateX(0); box-shadow: 0 0 0 2000px rgba(0,0,0,.35); }
    .menu-toggle { display: inline-flex; }
    .content { padding: 18px; }
}
