/* AIDA Panel — CSS de produção (sem dependências externas) */

:root {
    --bg-950: #070a14;
    --bg-900: #0a0e1a;
    --bg-800: #111726;
    --bg-700: #1a2236;
    --bg-600: #252f47;
    --line: rgba(148, 163, 184, 0.12);
    --line-strong: rgba(148, 163, 184, 0.22);
    --txt: #f1f5f9;
    --txt-dim: #94a3b8;
    --txt-faint: #64748b;
    --brand: #2563eb;
    --brand-glow: #3b82f6;
    --brand-deep: #1e3a8a;
    --ok: #10b981;
    --ok-soft: #34d399;
    --warn: #f59e0b;
    --warn-soft: #fbbf24;
    --danger: #ef4444;
    --danger-soft: #f87171;
    --glass: rgba(17, 23, 38, 0.62);
    --glass-hi: rgba(37, 47, 71, 0.5);
    --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.7);
    --radius: 18px;
    --radius-sm: 11px;
    --sidebar-w: 270px;
    --font-display: 'Sora', system-ui, sans-serif;
    --font-sans: 'Space Grotesk', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
    background: var(--bg-950);
    color: var(--txt);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* ---------- BACKGROUND ---------- */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(60vw 60vw at 12% 8%, rgba(37, 99, 235, 0.18), transparent 60%),
        radial-gradient(50vw 50vw at 88% 18%, rgba(59, 130, 246, 0.12), transparent 55%),
        radial-gradient(55vw 55vw at 70% 92%, rgba(30, 58, 138, 0.16), transparent 60%),
        radial-gradient(45vw 45vw at 8% 88%, rgba(14, 165, 233, 0.1), transparent 55%);
    animation: meshDrift 24s ease-in-out infinite alternate;
}
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
}
@keyframes meshDrift {
    0% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(-2%, 1.5%, 0) scale(1.05); }
    100% { transform: translate3d(2%, -1.5%, 0) scale(1.02); }
}

/* ---------- BOOT ---------- */
.boot-splash {
    position: fixed; inset: 0; z-index: 9999;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px;
    background: var(--bg-950);
    transition: opacity .5s ease, visibility .5s ease;
}
.boot-splash.hide { opacity: 0; visibility: hidden; }
.boot-orb {
    width: 64px; height: 64px; border-radius: 50%;
    background: conic-gradient(from 0deg, var(--brand), var(--brand-glow), var(--brand-deep), var(--brand));
    filter: blur(2px);
    animation: spin 1s linear infinite;
    box-shadow: 0 0 60px rgba(37, 99, 235, .6);
}
.boot-text { font-family: var(--font-display); font-weight: 800; letter-spacing: .5em; font-size: 14px; color: var(--txt-dim); padding-left: .5em; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- SHELL ---------- */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.app-main { min-width: 0; display: flex; flex-direction: column; }
.app-content { padding: 28px 32px 64px; flex: 1; animation: viewIn .4s cubic-bezier(.16,1,.3,1); }
@keyframes viewIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

[hidden] { display: none !important; }

/* ---------- SIDEBAR ---------- */
.sidebar {
    position: sticky; top: 0; height: 100vh;
    background: linear-gradient(180deg, rgba(17,23,38,.9), rgba(10,14,26,.95));
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--line);
    display: flex; flex-direction: column; overflow: hidden;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 22px 22px 18px; border-bottom: 1px solid var(--line); }
.sidebar-logo {
    width: 38px; height: 38px; border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--brand), var(--brand-deep));
    display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; color: #fff;
    box-shadow: 0 6px 20px -4px rgba(37,99,235,.6); flex-shrink: 0;
}
.sidebar-title { font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.sidebar-title span { color: var(--txt-faint); font-weight: 400; display: block; font-size: 11px; letter-spacing: .05em; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
.nav-group-label { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: var(--txt-faint); padding: 14px 12px 6px; font-weight: 600; }
.nav-item {
    display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius-sm);
    color: var(--txt-dim); cursor: pointer; font-size: 14px; font-weight: 500;
    border: 1px solid transparent; transition: all .18s ease; position: relative; text-decoration: none;
}
.nav-item:hover { background: var(--glass-hi); color: var(--txt); border-color: var(--line); }
.nav-item.active {
    background: linear-gradient(135deg, rgba(37,99,235,.22), rgba(37,99,235,.08));
    color: #fff; border-color: rgba(37,99,235,.4);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.nav-item.active::before {
    content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
    width: 3px; height: 60%; background: var(--brand-glow); border-radius: 0 3px 3px 0;
    box-shadow: 0 0 12px var(--brand-glow);
}
.nav-ico { width: 18px; height: 18px; flex-shrink: 0; }
.nav-lock { width: 13px; height: 13px; margin-left: auto; color: var(--txt-faint); opacity: .6; }
.sidebar-foot { padding: 14px; border-top: 1px solid var(--line); }

/* ---------- HEADER ---------- */
.app-header {
    position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 16px;
    padding: 16px 32px; background: rgba(10,14,26,.65); backdrop-filter: blur(18px); border-bottom: 1px solid var(--line);
}
.header-title { font-family: var(--font-display); font-weight: 700; font-size: 20px; letter-spacing: -.02em; }
.header-crumb { font-size: 12px; color: var(--txt-faint); margin-top: 1px; }
.header-search {
    margin-left: auto; display: flex; align-items: center; gap: 9px;
    background: var(--glass); border: 1px solid var(--line); border-radius: 12px; padding: 9px 14px; width: 280px; color: var(--txt-dim);
}
.header-search input { background: none; border: none; outline: none; color: var(--txt); font-family: inherit; font-size: 13px; width: 100%; }
.header-search input::placeholder { color: var(--txt-faint); }
.header-pill {
    display: flex; align-items: center; gap: 9px; background: var(--glass); border: 1px solid var(--line);
    border-radius: 12px; padding: 7px 9px 7px 12px; cursor: pointer; transition: border-color .18s;
}
.header-pill:hover { border-color: var(--line-strong); }
.header-avatar {
    width: 30px; height: 30px; border-radius: 9px;
    background: linear-gradient(135deg, var(--brand-glow), var(--brand-deep));
    display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff;
}
.header-role { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; padding: 2px 8px; border-radius: 6px; background: rgba(37,99,235,.16); color: var(--brand-glow); font-weight: 600; }

/* ---------- GLASS / CARDS ---------- */
.glass {
    background: var(--glass); backdrop-filter: blur(16px); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.glass::before {
    content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
    background: linear-gradient(135deg, rgba(255,255,255,.1), transparent 40%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none;
}
.card-pad { padding: 22px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 22px; }
.stat-card { padding: 20px 22px; }
.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.stat-ico { width: 40px; height: 40px; border-radius: var(--radius-sm); display: grid; place-items: center; background: rgba(37,99,235,.14); color: var(--brand-glow); }
.stat-ico svg { width: 20px; height: 20px; }
.stat-label { font-size: 12px; color: var(--txt-dim); font-weight: 500; letter-spacing: .02em; }
.stat-value { font-family: var(--font-mono); font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; }

.section-head { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 16px; }
.section-head h2 { font-family: var(--font-display); font-weight: 700; font-size: 17px; margin: 0; }
.section-head p { font-size: 12px; color: var(--txt-faint); margin: 2px 0 0; }

.chart-grid { display: grid; gap: 18px; grid-template-columns: 1fr; }
.chart-grid.cols-2 { grid-template-columns: 1.6fr 1fr; }
@media (max-width: 980px) { .chart-grid.cols-2 { grid-template-columns: 1fr; } }
.chart-box { height: 320px; width: 100%; }
.chart-box.sm { height: 260px; }

/* ---------- SKELETON (shimmer sincronizado) ---------- */
.skeleton {
    background-color: var(--bg-700);
    background-image: linear-gradient(100deg, transparent 30%, rgba(148,163,184,.12) 50%, transparent 70%);
    background-size: 200vw 100%;
    background-attachment: fixed;
    background-repeat: no-repeat;
    border-radius: 8px;
    animation: shimmer 1.6s linear infinite;
    color: transparent !important;
    user-select: none; pointer-events: none;
}
.skeleton * { visibility: hidden; }
@keyframes shimmer { from { background-position: -100vw 0; } to { background-position: 100vw 0; } }
.sk-line { height: 12px; border-radius: 6px; margin: 7px 0; }
.sk-line.lg { height: 28px; }
.sk-line.sm { height: 9px; }
.sk-circle { border-radius: 50%; }
.sk-block { width: 100%; border-radius: 12px; }

/* ---------- TABLE ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--txt-faint); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 13px 16px; border-bottom: 1px solid var(--line); color: var(--txt); }
table.data tbody tr { transition: background .14s; }
table.data tbody tr:hover { background: rgba(37,47,71,.35); }
table.data tbody tr:last-child td { border-bottom: none; }

/* ---------- BADGE ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 7px; letter-spacing: .02em; }
.badge.ok { background: rgba(16,185,129,.14); color: var(--ok-soft); }
.badge.warn { background: rgba(245,158,11,.14); color: var(--warn-soft); }
.badge.danger { background: rgba(239,68,68,.14); color: var(--danger-soft); }
.badge.muted { background: rgba(148,163,184,.12); color: var(--txt-dim); }
.badge.brand { background: rgba(37,99,235,.16); color: var(--brand-glow); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- BUTTONS ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px; font-family: inherit; font-size: 13.5px; font-weight: 600;
    padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line);
    background: var(--glass); color: var(--txt); cursor: pointer; transition: all .16s ease; white-space: nowrap;
}
.btn:hover { border-color: var(--line-strong); background: var(--glass-hi); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: linear-gradient(135deg, var(--brand), var(--brand-deep)); border-color: transparent; color: #fff; box-shadow: 0 8px 22px -8px rgba(37,99,235,.7); }
.btn.primary:hover { box-shadow: 0 10px 28px -8px rgba(37,99,235,.9); transform: translateY(-1px); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger-soft); border-color: rgba(239,68,68,.3); }
.btn.danger:hover { background: rgba(239,68,68,.1); }
.btn.sm { padding: 7px 12px; font-size: 12.5px; }
.btn.icon { padding: 9px; }
.btn.icon svg { margin: 0; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
select.btn { cursor: pointer; -webkit-appearance: none; appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }

/* ---------- LOCKED STATE ---------- */
.locked { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 80px 32px; min-height: 60vh; position: relative; }
.locked-glow { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 380px; height: 380px; background: radial-gradient(circle, rgba(37,99,235,.12), transparent 70%); pointer-events: none; }
.locked-ring { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; background: var(--glass); border: 1px solid var(--line-strong); margin-bottom: 26px; position: relative; box-shadow: var(--shadow); }
.locked-ring::after { content: ''; position: absolute; inset: -8px; border-radius: 50%; border: 1px dashed rgba(37,99,235,.3); animation: spin 18s linear infinite; }
.locked-ring svg { width: 38px; height: 38px; color: var(--brand-glow); }
.locked h2 { font-family: var(--font-display); font-size: 22px; font-weight: 700; margin: 0 0 10px; }
.locked p { color: var(--txt-dim); max-width: 440px; line-height: 1.6; margin: 0 0 8px; font-size: 14.5px; }
.locked .req-role { margin-top: 18px; display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: var(--radius-sm); background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.25); color: var(--warn-soft); font-size: 13px; font-weight: 600; }
.locked .your-role { margin-top: 12px; font-size: 12.5px; color: var(--txt-faint); }

/* ---------- STATES ---------- */
.state-box { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 60px 32px; color: var(--txt-dim); }
.state-box svg { width: 40px; height: 40px; color: var(--txt-faint); margin-bottom: 16px; }
.state-box h3 { font-family: var(--font-display); color: var(--txt); margin: 0 0 6px; font-size: 16px; }
.state-box p { margin: 0; font-size: 13.5px; max-width: 380px; line-height: 1.5; }

/* ---------- LOGIN ---------- */
.auth-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; padding: 40px; animation: viewIn .5s cubic-bezier(.16,1,.3,1); }
.auth-logo { width: 56px; height: 56px; border-radius: 16px; background: linear-gradient(135deg, var(--brand), var(--brand-deep)); display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: 22px; color: #fff; margin-bottom: 24px; box-shadow: 0 10px 30px -6px rgba(37,99,235,.7); }
.auth-card h1 { font-family: var(--font-display); font-size: 25px; font-weight: 700; margin: 0 0 6px; }
.auth-card .sub { color: var(--txt-dim); font-size: 14px; margin: 0 0 30px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--txt-dim); margin-bottom: 7px; letter-spacing: .02em; }
.field input, .field select, .field textarea {
    width: 100%; background: var(--bg-900); border: 1px solid var(--line); border-radius: 12px;
    padding: 13px 15px; color: var(--txt); font-family: inherit; font-size: 14px; outline: none;
    transition: border-color .18s, box-shadow .18s;
}
.field textarea { min-height: 70px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.field.check { display: flex; align-items: center; gap: 9px; }
.field.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.field.check label { margin: 0; }
.auth-error { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.25); color: var(--danger-soft); padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }

/* ---------- MODAL ---------- */
.modal-host { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(7,10,20,.7); backdrop-filter: blur(6px); animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto; padding: 28px; animation: viewIn .3s cubic-bezier(.16,1,.3,1); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.modal-head h3 { font-family: var(--font-display); font-size: 19px; font-weight: 700; margin: 0; }
.modal-head p { font-size: 13px; color: var(--txt-faint); margin: 3px 0 0; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 26px; }

/* ---------- TOAST ---------- */
.toast-host { position: fixed; bottom: 24px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; align-items: center; gap: 11px; background: var(--bg-800); border: 1px solid var(--line-strong); border-radius: 13px; padding: 13px 16px; box-shadow: var(--shadow); font-size: 13.5px; font-weight: 500; min-width: 280px; animation: toastIn .3s cubic-bezier(.16,1,.3,1); }
.toast.out { animation: toastOut .3s ease forwards; }
.toast svg { width: 18px; height: 18px; flex-shrink: 0; }
.toast.ok svg { color: var(--ok); }
.toast.danger svg { color: var(--danger); }
.toast.info svg { color: var(--brand-glow); }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px); } }

/* ---------- PAGER + TABS ---------- */
.pager { display: flex; align-items: center; gap: 12px; justify-content: flex-end; margin-top: 18px; }
.pager .info { font-size: 12.5px; color: var(--txt-faint); }
.tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }

/* ---------- DETAIL ROWS ---------- */
.detail-row { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line); }
.detail-row:last-child { border-bottom: none; }
.detail-row .k { font-size: 13px; color: var(--txt-faint); }
.detail-row .v { font-weight: 500; }

/* ---------- KEY REVEAL ---------- */
.key-box { background: var(--bg-900); border: 1px solid var(--brand); border-radius: 12px; padding: 16px; display: flex; align-items: center; gap: 12px; }
.key-box code { flex: 1; word-break: break-all; color: var(--brand-glow); font-size: 13px; font-family: var(--font-mono); }
.notice-warn { margin-top: 16px; background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.25); color: var(--warn-soft); padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.notice-warn svg { width: 16px; height: 16px; }

/* ---------- UTILITIES (próprias, prefixo u-) ---------- */
.u-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.u-flex { display: flex; }
.u-items-center { align-items: center; }
.u-gap-2 { gap: 8px; }
.u-gap-3 { gap: 12px; }
.u-mt-4 { margin-top: 16px; }
.u-mb-3 { margin-bottom: 12px; }
.u-mb-4 { margin-bottom: 16px; }
.u-ml-auto { margin-left: auto; }
.u-wrap { flex-wrap: wrap; }
.u-actions { display: flex; gap: 8px; justify-content: flex-end; }
.u-w-160 { width: 160px; }
.u-w-220 { width: 220px; }
.u-w-300 { width: 300px; }
.mono { font-family: var(--font-mono); }
.dim { color: var(--txt-dim); }
.faint { color: var(--txt-faint); }
.txt-ok { color: var(--ok-soft); }
.txt-danger { color: var(--danger-soft); }
.link { color: #fff; font-weight: 600; cursor: pointer; text-decoration: none; }
.link:hover { color: var(--brand-glow); }

/* ---------- RESPONSIVE ---------- */
.menu-toggle { display: none; }
@media (max-width: 880px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; left: 0; top: 0; width: var(--sidebar-w); z-index: 150; transform: translateX(-100%); transition: transform .3s cubic-bezier(.16,1,.3,1); }
    .sidebar.open { transform: translateX(0); }
    .menu-toggle { display: grid; }
    .header-search { display: none; }
    .app-content { padding: 20px 18px 48px; }
    .u-grid-2 { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
    body::before { animation: none; }
    .skeleton { animation: none; background-image: none; }
}