:root {
    --bg: #0b1020;
    --card: #11172a;
    --muted: #97a3b6;
    --text: #e6edf7;
    --primary: #5b8cff;
    --primary-600: #4b77e0;
    --danger: #ff5b6b;
    --success: #3ecf8e;
    --warning: #ffb020;
    --border: #1f2940;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: rgba(11,16,32,0.85);
    backdrop-filter: blur(6px);
    z-index: 10;
}
.brand img { height: 28px; display: block; }
.session { display: flex; align-items: center; gap: 12px; color: var(--muted); }
main { max-width: 100%; margin: 24px auto; padding: 0 16px; }

/* Largura máxima do conteúdo */
.layout, .card, .toolbar { max-width: 1200px; }
.layout { margin: 0 auto; }

/* Layout com sidebar */
.layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 16px;
}
.sidebar {
    position: sticky;
    top: 72px;
    align-self: start;
    height: fit-content;
}
.nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sidebar .nav {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
}
.nav-link {
    text-align: left;
    width: 100%;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text);
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
}
.nav-link:hover { background: #0d1426; border-color: var(--border); }
.nav-link.active { background: var(--primary); border-color: var(--primary-600); }

.btn-danger { background: #35141a; border-color: #5e1e29; color: #ff8a99; }
.content { min-width: 0; }

/* Tela de login centralizada e sem header */
body.login .app-header { display: none; }
body.login main { display: grid; place-items: center; min-height: 100vh; margin: 0; padding: 16px; }
body.login #login-section { width: 100%; max-width: 420px; padding: 24px; }
body.login .brand2 { display: flex; justify-content: center; margin-bottom: 16px; }
body.login .brand2 img { height: 44px; }
body.login #login-section .btn.btn-primary[type="submit"] { display: block; margin: 16px auto 0; width: 100%; }
body.login .login-footer { margin-top: 14px; display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 13px; }
body.login .login-footer img { height: 16px; width: 16px; display: inline-block; }
body.login .login-footer a { color: #3ecf8e; text-decoration: none; }

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
}

.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
label { color: var(--muted); font-size: 13px; }
input, select {
    background: #0d1426;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    outline: none;
}
input::placeholder { color: #64708a; }

.btn {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    color: var(--text);
    background: #0d1426;
    cursor: pointer;
}
.btn-primary { background: var(--primary); border-color: var(--primary-600); }
.btn-primary:hover { background: var(--primary-600); }
.btn-secondary { background: #0d1426; }
.btn-danger { background: #35141a; border-color: #5e1e29; color: #ff8a99; }
.btn-success { background: #132a22; border-color: #21483b; color: #56e6ae; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.hint { color: var(--muted); font-size: 12px; margin-top: 8px; }
.error { color: #ff8a99; background: #2c1720; border: 1px solid #5e1e29; padding: 10px 12px; border-radius: 10px; }
.loading, .empty { color: var(--muted); text-align: center; padding: 20px 0; }

.grupo-list { display: flex; flex-direction: column; gap: 10px; }
.grupo-item { background: #0d1426; border: 1px solid var(--border); border-radius: 10px; padding: 10px; display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; }
.grupo-remove { background: #35141a; border-color: #5e1e29; color: #ff8a99; }

.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.filters { display: flex; gap: 10px; }
.meta { color: var(--muted); }

.table-wrapper { width: 100%; overflow: auto; border-radius: 12px; border: 1px solid var(--border); background: var(--card); }
table { width: 100%; border-collapse: collapse; }
thead th {
    text-align: left;
    position: sticky; top: 0; z-index: 1;
    background: #0f1528;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-weight: 600;
    font-size: 13px;
}
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
tbody tr:hover { background: #0e162b; }

.badge { padding: 4px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--border); }
.badge.success { color: #56e6ae; background: #132a22; border-color: #21483b; }
.badge.warning { color: #ffd27a; background: #2c210f; border-color: #5c4a1a; }
.badge.danger { color: #ff8a99; background: #2c1720; border-color: #5e1e29; }

.actions { display: flex; gap: 8px; }

@media (max-width: 900px) {
    thead th:nth-child(5), tbody td:nth-child(5),
    thead th:nth-child(6), tbody td:nth-child(6),
    thead th:nth-child(7), tbody td:nth-child(7),
    thead th:nth-child(8), tbody td:nth-child(8),
    thead th:nth-child(9), tbody td:nth-child(9),
    thead th:nth-child(10), tbody td:nth-child(10),
    thead th:nth-child(11), tbody td:nth-child(11) { display: none; }
}

.modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; z-index: 2000; }
.modal.show { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); z-index: 1000; }
.modal-card { position: relative; z-index: 1001; width: 95%; max-width: 640px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.modal-body { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-body .item { background: #0d1426; border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.modal-body .label { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }


