:root {
    --bg: #070b14;
    --bg-soft: #0b1220;
    --sidebar: #080f1d;
    --panel: rgba(11, 18, 32, 0.92);
    --text: #eef4ff;
    --muted: #94a3b8;
    --border: rgba(148, 163, 184, 0.18);
    --input: #0f172a;
    --primary: #35c8ff;
    --primary-2: #7657ff;
    --danger: #ef4444;
    --success: #22c55e;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
    --glow: 0 0 22px rgba(53, 200, 255, 0.32), 0 0 42px rgba(118, 87, 255, 0.18);
}

[data-theme="light"] {
    --bg: #f4f7fb;
    --bg-soft: #eef3fa;
    --sidebar: #ffffff;
    --panel: rgba(255, 255, 255, 0.96);
    --text: #0f172a;
    --muted: #536174;
    --border: rgba(15, 23, 42, 0.12);
    --input: #ffffff;
    --primary: #0969da;
    --primary-2: #6d28d9;
    --shadow: 0 22px 60px rgba(15, 23, 42, 0.10);
    --glow: 0 0 22px rgba(9, 105, 218, 0.16);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; max-width: 100%; overflow-x: hidden; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    background:
        radial-gradient(circle at 20% 10%, rgba(53, 200, 255, 0.14), transparent 28%),
        radial-gradient(circle at 80% 0%, rgba(118, 87, 255, 0.20), transparent 30%),
        linear-gradient(135deg, var(--bg), var(--bg-soft));
    color: var(--text);
}
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,.75), transparent);
}
a { color: var(--primary); text-decoration: none; }
button, .button {
    border: 0;
    border-radius: 14px;
    padding: 12px 18px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    cursor: pointer;
    box-shadow: var(--glow);
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}
button:hover, .button:hover { transform: translateY(-1px); opacity: .96; }
.button-muted { background: transparent; border: 1px solid var(--border); color: var(--text); box-shadow: none; }
.button-danger { background: linear-gradient(135deg, #ef4444, #be123c); box-shadow: 0 0 18px rgba(239,68,68,.24); }
.inline-form { display:inline-flex; margin:0; }
input, textarea, select {
    width: 100%;
    min-height: 44px;
    display: block;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--input);
    color: var(--text);
    outline: none;
    transition: border .18s ease, box-shadow .18s ease;
}
input:focus, textarea:focus, select:focus { border-color: rgba(53, 200, 255, .75); box-shadow: 0 0 0 4px rgba(53, 200, 255, .12); }
label { display: block; margin: 12px 0 7px; color: var(--muted); font-weight: 600; }
textarea { min-height: 96px; resize: vertical; }
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { text-align: left; padding: 14px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
code { display: inline-block; padding: 5px 9px; border-radius: 10px; color: var(--primary); background: rgba(53, 200, 255, .10); border: 1px solid rgba(53, 200, 255, .18); max-width: 100%; word-break: break-word; }
.shell { display: flex; min-height: 100vh; width: 100%; max-width: 100vw; position: relative; }
.sidebar { width: 275px; flex: 0 0 275px; min-height: 100vh; padding: 26px 22px; background: linear-gradient(180deg, var(--sidebar), rgba(8,15,29,.92)); border-right: 1px solid var(--border); position: sticky; top: 0; box-shadow: 10px 0 50px rgba(0,0,0,.18); }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 34px; }
.brand-logo { width: 52px; height: 52px; border-radius: 16px; object-fit: contain; background: rgba(255,255,255,.05); border: 1px solid var(--border); box-shadow: var(--glow); }
.brand-title { display: grid; gap: 2px; }
.brand-title strong { font-size: 19px; line-height: 1.05; }
.brand-title span { color: var(--primary); font-weight: 800; }
.sidebar nav { display: grid; gap: 8px; }
.sidebar nav a { display: flex; align-items: center; min-height: 46px; padding: 12px 14px; color: var(--muted); border-radius: 14px; border: 1px solid transparent; transition: all .18s ease; }
.sidebar nav a:hover, .sidebar nav a.active { color: var(--text); background: linear-gradient(135deg, rgba(53,200,255,.13), rgba(118,87,255,.10)); border-color: rgba(53,200,255,.20); box-shadow: inset 0 0 0 1px rgba(255,255,255,.03), 0 0 22px rgba(53,200,255,.08); }
.content { flex: 1; min-width: 0; width: calc(100% - 275px); padding: 28px; }
.topbar { background: var(--panel); border: 1px solid var(--border); border-radius: 24px; padding: 20px 24px; margin-bottom: 28px; display: flex; justify-content: space-between; align-items: center; box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.topbar strong { font-size: 18px; }
.topbar small { display: block; color: var(--muted); margin-top: 5px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.theme-toggle { width: 44px; height: 44px; padding: 0; border-radius: 14px; }
h1 { font-size: clamp(28px, 3vw, 42px); margin: 0 0 22px; letter-spacing: -0.03em; }
h2 { margin: 0 0 16px; font-size: 22px; }
p { color: var(--muted); line-height: 1.6; }
.grid { display: grid; gap: 20px; }
.cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card, .panel { min-width: 0; background: var(--panel); border: 1px solid var(--border); border-radius: 24px; padding: 22px; box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.card { position: relative; overflow: hidden; }
.card::after { content: ""; position: absolute; inset: auto -30px -50px auto; width: 120px; height: 120px; background: radial-gradient(circle, rgba(53,200,255,.22), transparent 70%); }
.card span { color: var(--muted); display: block; margin-bottom: 10px; }
.card strong { font-size: 34px; letter-spacing: -0.04em; }
.panel + .panel, .grid + .panel, .panel + .grid { margin-top: 20px; }
.actions { margin: 0 0 16px; display: flex; gap: 10px; flex-wrap: wrap; }
.chart-wrap { height: 260px; position: relative; width: 100%; overflow: hidden; }
.alert { padding: 14px 16px; border-radius: 14px; margin: 12px 0 16px; background: rgba(239, 68, 68, .12); color: #fecaca; border: 1px solid rgba(239, 68, 68, .28); }
.success { background: rgba(34,197,94,.12); color: #bbf7d0; border-color: rgba(34,197,94,.28); }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(100%, 460px); background: var(--panel); border: 1px solid var(--border); border-radius: 28px; padding: 34px; box-shadow: var(--shadow), var(--glow); backdrop-filter: blur(18px); animation: floatIn .45s ease both; }
.login-brand { text-align: center; margin-bottom: 26px; }
.login-logo { width: 86px; height: 86px; border-radius: 22px; object-fit: contain; display: block; margin: 0 auto 14px; background: rgba(255,255,255,.05); border: 1px solid var(--border); box-shadow: var(--glow); }
.login-brand h1 { font-size: 29px; margin-bottom: 8px; }
.login-brand p { margin: 0; }
.login-card button { width: 100%; margin-top: 10px; min-height: 48px; }
.login-meta { margin-top: 18px; text-align: center; color: var(--muted); font-size: 13px; }
.loader-overlay { position: fixed; inset: 0; display: none; place-items: center; background: rgba(7, 11, 20, .76); z-index: 9999; backdrop-filter: blur(8px); }
.loader-overlay.show { display: grid; }
.neon-loader { width: 74px; height: 74px; border-radius: 50%; border: 4px solid rgba(53,200,255,.18); border-top-color: var(--primary); border-right-color: var(--primary-2); animation: spin .75s linear infinite; box-shadow: var(--glow); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes floatIn { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@media (max-width: 1100px) { .cards, .two { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .shell { display: block; } .sidebar { width: 100%; flex: none; min-height: auto; position: relative; } .content { width: 100%; padding: 18px; } .cards, .two { grid-template-columns: 1fr; } .topbar { align-items: flex-start; gap: 16px; flex-direction: column; } table { min-width: 620px; } }


/* Correção definitiva para não forçar rolagem horizontal da página */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

.shell, .content, .topbar, .panel, .card {
    min-width: 0;
    max-width: 100%;
}

.grid, .cards, .two {
    min-width: 0;
}

.table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
}

.panel table {
    min-width: 620px;
}

@media (max-width: 760px) {
    .panel table {
        min-width: 560px;
    }
}
