:root {
    --sb-bg: #16213e;
    --sb-active: #e63946;
    --sb-text: #a0aec0;
    --sb-text-on: #fff;
    --g-bg: #f0f2f5;
    --g-card: #fff;
    --g-accent: #e63946;
    --g-text: #2d3748;
    --g-border: #e2e8f0;
    --g-muted: #718096;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body.gestao-body {
    font-family: 'Roboto', sans-serif;
    background: var(--g-bg);
    color: var(--g-text);
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.g-sidebar {
    width: 230px;
    min-height: 100vh;
    background: var(--sb-bg);
    position: fixed;
    top: 0; left: 0;
    display: flex;
    flex-direction: column;
    z-index: 200;
}

.g-sidebar-header {
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.g-brand {
    color: #fff;
    font-family: 'Oswald', sans-serif;
    font-size: 1.05rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.g-brand i { color: var(--g-accent); }

.g-nav { flex: 1; padding: 12px 0; overflow-y: auto; }

.g-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--sb-text);
    text-decoration: none;
    font-size: .875rem;
    border-left: 3px solid transparent;
    transition: color .15s, background .15s, border-color .15s;
}

.g-nav a:hover, .g-nav a.active {
    color: var(--sb-text-on);
    background: rgba(255,255,255,.06);
    border-left-color: var(--g-accent);
}

.g-nav a i { width: 16px; text-align: center; font-size: .85rem; }

.g-nav-section {
    padding: 16px 20px 4px;
    font-size: .64rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: rgba(255,255,255,.28);
    font-weight: 700;
    border-top: 1px solid rgba(255,255,255,.06);
    margin-top: 4px;
}
.g-nav-section:first-child { border-top: none; margin-top: 0; }

.g-nav a.g-nav-external { color: var(--sb-text); opacity: .8; }
.g-nav a.g-nav-external i.ext { font-size: .6rem; margin-left: auto; color: rgba(255,255,255,.25); }

.g-nav .g-badge {
    margin-left: auto;
    background: var(--g-accent);
    color: #fff;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: .72rem;
    font-weight: 600;
}

.g-sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,.08);
}

.g-sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--sb-text);
    text-decoration: none;
    font-size: .82rem;
    transition: color .15s;
}

.g-sidebar-footer a:hover { color: #fff; }

/* ── Main ── */
.g-main {
    margin-left: 230px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

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

.g-topbar-title {
    font-family: 'Oswald', sans-serif;
    font-size: 1.15rem;
    color: var(--g-text);
}

.g-topbar-user {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .85rem;
    color: var(--g-muted);
}

.g-topbar-user a { color: var(--g-accent); text-decoration: none; }
.g-topbar-user a:hover { text-decoration: underline; }

.g-content { padding: 24px; flex: 1; }

/* ── Cards ── */
.g-card {
    background: var(--g-card);
    border-radius: 8px;
    border: 1px solid var(--g-border);
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.g-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--g-border);
}

.g-card-title {
    font-family: 'Oswald', sans-serif;
    font-size: 1rem;
    color: var(--g-text);
}

.g-card-body { padding: 20px; }

/* ── Stats ── */
.g-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.g-stat {
    background: var(--g-card);
    border: 1px solid var(--g-border);
    border-radius: 8px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.g-stat-icon {
    width: 42px; height: 42px;
    border-radius: 10px;
    background: rgba(230,57,70,.1);
    color: var(--g-accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0;
}

.g-stat h3 { font-size: 1.5rem; font-family: 'Oswald', sans-serif; }
.g-stat p  { font-size: .78rem; color: var(--g-muted); margin-top: 2px; }

/* ── Table ── */
.g-table { width: 100%; border-collapse: collapse; font-size: .875rem; }

.g-table th {
    padding: 10px 14px;
    background: #f7fafc;
    border-bottom: 2px solid var(--g-border);
    text-align: left;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--g-muted);
}

.g-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--g-border);
    vertical-align: middle;
}

.g-table tr:last-child td { border-bottom: none; }
.g-table tbody tr:hover td { background: #fafbfc; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px;
       border-radius: 6px; border: none; cursor: pointer; font-size: .875rem;
       text-decoration: none; font-family: inherit; transition: opacity .15s; }

.btn:hover { opacity: .85; }
.btn-primary { background: var(--g-accent); color: #fff; }
.btn-secondary { background: #718096; color: #fff; }
.btn-danger { background: #e53e3e; color: #fff; }
.btn-sm { padding: 5px 12px; font-size: .8rem; }
.btn-outline { background: transparent; border: 1px solid var(--g-border); color: var(--g-text); }
.btn-outline:hover { background: #f7fafc; opacity: 1; }

/* ── Forms ── */
.g-form .fg { margin-bottom: 16px; }
.g-form label { display: block; font-size: .84rem; font-weight: 500;
                 color: var(--g-muted); margin-bottom: 5px; }

.g-form input:not([type=checkbox]),
.g-form select,
.g-form textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: .875rem;
    color: var(--g-text);
    background: #fff;
    font-family: inherit;
    transition: border-color .15s;
}

.g-form input:focus, .g-form select:focus, .g-form textarea:focus {
    border-color: var(--g-accent); outline: none;
    box-shadow: 0 0 0 3px rgba(230,57,70,.1);
}

.g-form .form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.g-form .form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.g-form .errorlist { list-style: none; color: #e53e3e; font-size: .8rem; margin-top: 4px; }

.g-form .checkbox-wrap {
    display: flex; align-items: center; gap: 8px; font-size: .875rem;
}

/* ── Alerts ── */
.g-alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px;
           font-size: .875rem; display: flex; align-items: center; gap: 8px; }
.g-alert-success { background: #f0fff4; color: #276749; border: 1px solid #9ae6b4; }
.g-alert-error   { background: #fff5f5; color: #c53030; border: 1px solid #feb2b2; }
.g-alert-warning { background: #fffbeb; color: #975a16; border: 1px solid #fbd38d; }

/* ── Badges ── */
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: .75rem; font-weight: 500; }
.tag-green  { background: #c6f6d5; color: #276749; }
.tag-gray   { background: #edf2f7; color: #4a5568; }
.tag-red    { background: #fed7d7; color: #c53030; }
.tag-blue   { background: #bee3f8; color: #2b6cb0; }
.tag-yellow { background: #fefcbf; color: #744210; }

/* ── Login ── */
.g-login-wrap {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: var(--sb-bg);
}

.g-login-card {
    background: #fff; border-radius: 12px;
    padding: 40px; width: 100%; max-width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,.4);
}

.g-login-logo { text-align: center; margin-bottom: 28px; }
.g-login-logo i { font-size: 2.2rem; color: var(--g-accent); }
.g-login-logo h2 { font-family: 'Oswald', sans-serif; font-size: 1.4rem; margin-top: 8px; }
.g-login-logo p  { color: var(--g-muted); font-size: .85rem; margin-top: 4px; }

/* ── Confirm delete ── */
.g-confirm { text-align: center; padding: 40px; }
.g-confirm i { font-size: 3rem; color: #e53e3e; margin-bottom: 16px; }
.g-confirm h2 { font-family: 'Oswald', sans-serif; font-size: 1.4rem; margin-bottom: 8px; }
.g-confirm p  { color: var(--g-muted); margin-bottom: 24px; }

/* ── Mobile drawer toggle ── */
.g-mobile-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--g-border);
    color: var(--g-muted);
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: .9rem;
    line-height: 1;
    min-height: 36px;
    transition: color .15s, background .15s;
}
.g-mobile-toggle:hover { color: var(--g-text); background: var(--g-bg); }

/* ── Sidebar overlay (mobile) ── */
.g-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 299;
    cursor: pointer;
}
.g-sidebar-overlay.active { display: block; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .g-sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform .22s ease;
        z-index: 300;
    }
    .g-sidebar.mobile-open { transform: translateX(0); }
    .g-mobile-toggle { display: flex; }
    .g-main { margin-left: 0; }
    .g-topbar { padding: 12px 16px; gap: 10px; }
    .g-form .form-row, .g-form .form-row-3 { grid-template-columns: 1fr; }
    .g-stats { grid-template-columns: 1fr 1fr; }
    .g-content { padding: 16px; }
    .g-card-header { flex-wrap: wrap; gap: 8px; }
    .g-list-header { flex-wrap: wrap; gap: 8px; }
}
