/* =====================================================================
   Onyx Labs — design system do painel mestre.
   Paleta: roxo (#6C4DFF) sobre fundo quase-preto, com leves efeitos de
   brilho/elevação (gradientes sutis, glow no hover) — propositalmente mais
   "vivo" que um painel puramente flat.
   ===================================================================== */

:root {
    --primary: #6C4DFF;
    --primary-light: #9B8CFF;
    --bg: #0B0B0F;
    --surface: #131318;
    --surface-2: #1A1A22;
    --surface-3: #222230;
    --border: #28282F;
    --white: #F7F7FA;
    --gray: #8B8B98;
    --success: #22C55E;
    --danger: #EF4444;
    --radius: 14px;
    --radius-sm: 9px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    background-image: radial-gradient(circle at 15% 0%, rgba(108, 77, 255, .12), transparent 40%),
        radial-gradient(circle at 85% 100%, rgba(155, 140, 255, .08), transparent 45%);
    background-attachment: fixed;
    color: var(--white);
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
}

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

a:hover {
    color: var(--white);
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--surface-3);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

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

.onyx-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #121217 0%, #0E0E13 100%);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.onyx-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 24px 22px;
    font-family: Consolas, monospace;
    font-weight: 700;
    font-size: 17px;
    border-bottom: 1px solid var(--border);
}

.onyx-brand .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 12px 2px rgba(108, 77, 255, .7);
    flex-shrink: 0;
}

.onyx-brand b {
    color: var(--primary-light);
}

.onyx-nav {
    flex: 1;
    padding: 18px 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.onyx-nav-section {
    color: var(--gray);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 700;
    padding: 16px 12px 8px;
}

.onyx-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--gray);
    font-size: 14.5px;
    font-weight: 500;
    transition: background .15s ease, color .15s ease;
    border-left: 3px solid transparent;
}

.onyx-nav a svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.onyx-nav a:hover {
    background: var(--surface-2);
    color: var(--white);
}

.onyx-nav a.active {
    background: linear-gradient(90deg, rgba(108, 77, 255, .18), rgba(108, 77, 255, .02));
    color: var(--white);
    border-left-color: var(--primary);
}

.onyx-sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.onyx-sair {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--gray);
    padding: 10px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
}

.onyx-sair:hover {
    background: rgba(239, 68, 68, .12);
    border-color: var(--danger);
    color: #fca5a5;
}

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

.onyx-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 32px;
    border-bottom: 1px solid var(--border);
    background: rgba(11, 11, 15, .6);
    backdrop-filter: blur(6px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.onyx-topbar h1 {
    font-size: 20px;
    margin: 0;
    font-weight: 700;
}

.onyx-topbar p {
    margin: 2px 0 0;
    color: var(--gray);
    font-size: 13.5px;
}

.onyx-content {
    padding: 28px 32px 60px;
    max-width: 1280px;
}

/* ---------- Botões ---------- */
.onyx-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--primary);
    border: none;
    color: #fff;
    padding: 11px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 20px -4px rgba(108, 77, 255, .55);
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

.onyx-btn:hover {
    background: #7C5DFF;
    box-shadow: 0 6px 24px -2px rgba(108, 77, 255, .75);
    transform: translateY(-1px);
}

.onyx-btn-sm {
    padding: 7px 14px;
    font-size: 13px;
    box-shadow: none;
}

.onyx-btn-ghost {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--white);
    box-shadow: none;
}

.onyx-btn-ghost:hover {
    background: var(--surface-3);
    box-shadow: none;
    transform: none;
}

.onyx-btn-danger {
    background: rgba(239, 68, 68, .14);
    border: 1px solid rgba(239, 68, 68, .4);
    color: #fca5a5;
    box-shadow: none;
}

.onyx-btn-danger:hover {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 4px 16px -4px rgba(239, 68, 68, .6);
    transform: translateY(-1px);
}

/* ---------- Cards ---------- */
.onyx-card {
    background: linear-gradient(180deg, var(--surface) 0%, #101015 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 24px;
}

.onyx-card h2 {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 700;
}

.onyx-card .sub {
    color: var(--gray);
    font-size: 13px;
    margin: 0 0 18px;
}

.onyx-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 18px;
    margin-bottom: 26px;
}

.onyx-stat {
    background: linear-gradient(145deg, var(--surface) 0%, #0F0F14 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.onyx-stat::before {
    content: "";
    position: absolute;
    top: -40px;
    right: -40px;
    width: 110px;
    height: 110px;
    background: radial-gradient(circle, rgba(108, 77, 255, .22), transparent 70%);
}

.onyx-stat .label {
    color: var(--gray);
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 600;
    position: relative;
}

.onyx-stat .value {
    font-size: 26px;
    font-weight: 800;
    margin-top: 8px;
    position: relative;
}

.onyx-stat .value.accent {
    color: var(--primary-light);
}

/* ---------- Formulários ---------- */
.onyx-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.onyx-grid .full {
    grid-column: 1 / -1;
}

.onyx-field label {
    display: block;
    color: var(--gray);
    font-size: 13px;
    margin-bottom: 6px;
    font-weight: 500;
}

.onyx-field input,
.onyx-field select {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--white);
    padding: 11px 13px;
    font-size: 14px;
    transition: border-color .12s ease, box-shadow .12s ease;
}

.onyx-field input:focus,
.onyx-field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 77, 255, .22);
}

/* ---------- Tabela ---------- */
.onyx-table-wrap {
    overflow-x: auto;
}

table.onyx-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.onyx-table th,
.onyx-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

.onyx-table th {
    color: var(--gray);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 700;
}

.onyx-table tbody tr {
    cursor: pointer;
    transition: background .12s ease;
}

.onyx-table tbody tr:hover {
    background: var(--surface-2);
}

.onyx-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(34, 197, 94, .14);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, .3);
}

/* ---------- Alertas ---------- */
.onyx-alert {
    padding: 13px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
}

.onyx-alert-erro {
    background: rgba(239, 68, 68, .1);
    border: 1px solid rgba(239, 68, 68, .4);
    color: #fca5a5;
}

.onyx-alert-sucesso {
    background: rgba(34, 197, 94, .1);
    border: 1px solid rgba(34, 197, 94, .4);
    color: #86efac;
}

/* ---------- Modal ---------- */
.onyx-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(5, 5, 8, .72);
    backdrop-filter: blur(2px);
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.onyx-modal-backdrop.show {
    display: flex;
}

.onyx-modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    overflow: auto;
    box-shadow: 0 20px 60px -10px rgba(0, 0, 0, .6);
}

.onyx-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}

.onyx-modal-header h3 {
    margin: 0;
    font-size: 16px;
}

.onyx-modal-header button {
    background: transparent;
    border: none;
    color: var(--gray);
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
}

.onyx-modal-header button:hover {
    color: var(--white);
}

.onyx-modal-body {
    padding: 18px 22px;
}

.onyx-modal-body table th {
    width: 160px;
    color: var(--gray);
    font-weight: 500;
    text-transform: none;
    font-size: 13.5px;
    vertical-align: top;
    padding: 9px 0;
}

.onyx-modal-body table td {
    padding: 9px 0;
}

/* ---------- Login ---------- */
.onyx-login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.onyx-login-card {
    background: linear-gradient(180deg, var(--surface) 0%, #0E0E13 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px 32px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 0 60px -10px rgba(108, 77, 255, .18);
}

.onyx-login-card .onyx-brand {
    justify-content: center;
    border-bottom: none;
    padding: 0 0 28px;
    font-size: 19px;
}

.onyx-login-card input {
    width: 100%;
    box-sizing: border-box;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--white);
    padding: 12px 14px;
    margin-bottom: 14px;
    font-size: 14px;
}

.onyx-login-card input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 77, 255, .22);
}

.onyx-login-card button {
    width: 100%;
}

.onyx-login-erro {
    color: #fca5a5;
    background: rgba(239, 68, 68, .1);
    border: 1px solid rgba(239, 68, 68, .35);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 16px;
}

/* ---------- Responsivo ---------- */
@media (max-width: 860px) {
    .onyx-sidebar {
        position: fixed;
        left: -240px;
        transition: left .2s ease;
        z-index: 50;
    }

    .onyx-sidebar.open {
        left: 0;
    }

    .onyx-grid {
        grid-template-columns: 1fr;
    }

    .onyx-content {
        padding: 20px 16px 48px;
    }

    .onyx-topbar {
        padding: 16px 18px;
    }
}
