:root {
    --bg-app: #f5f7fb;
    --bg-sidebar: linear-gradient(180deg, #0b1632 0%, #081125 100%);
    --bg-card: rgba(255, 255, 255, 0.92);
    --text-main: #16213d;
    --text-soft: #6d7a96;
    --border-soft: rgba(15, 23, 42, 0.08);
    --shadow-soft: 0 18px 50px rgba(18, 31, 68, 0.08);
    --blue: #3b82f6;
    --purple: #6d5dfc;
    --green: #2ccf8f;
    --orange: #ff9f1c;
    --pink: #ff4d7d;
    --teal: #13b7b7;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background:
        radial-gradient(circle at top left, rgba(109, 93, 252, 0.08), transparent 28%),
        radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.08), transparent 30%),
        var(--bg-app);
    color: var(--text-main);
}

.admin-shell { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }

.sidebar {
    background: var(--bg-sidebar);
    color: #fff;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 24px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 32px; }
.brand-mark {
    width: 46px; height: 46px; border-radius: 14px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, rgba(109, 93, 252, 0.35), rgba(59, 130, 246, 0.18));
    border: 1px solid rgba(255,255,255,.12);
}
.brand h1 { font-size: 30px; margin: 0; }
.brand p { margin: 2px 0 0; color: rgba(255,255,255,.6); font-size: 14px; }

.nav-stack { display: grid; gap: 8px; }
.nav-link-custom {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; border-radius: 16px;
    color: rgba(255,255,255,.82); text-decoration: none;
    transition: .24s ease;
}
.nav-link-custom:hover, .nav-link-custom.active {
    background: linear-gradient(90deg, #4f63ff, #6d5dfc);
    color: #fff;
    box-shadow: 0 18px 40px rgba(79, 99, 255, 0.28);
}

.help-card {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 24px;
    padding: 20px;
}
.help-card h3 { font-size: 22px; margin-bottom: 8px; }
.help-card p { color: rgba(255,255,255,.66); margin-bottom: 18px; }

.main-content { padding: 24px 28px 32px; }

.topbar {
    background: rgba(255,255,255,.74);
    border: 1px solid rgba(255,255,255,.72);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow-soft);
    border-radius: 24px;
    padding: 18px 22px;
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 28px;
}

.topbar-menu, .icon-button {
    border: 0; background: transparent; color: var(--text-main); font-size: 22px;
}

.topbar-actions { display: flex; align-items: center; gap: 18px; }
.search-box {
    width: min(360px, 40vw);
    display: flex; align-items: center; gap: 10px;
    background: #fff; border: 1px solid var(--border-soft);
    border-radius: 16px; padding: 14px 16px;
}
.search-box input { border: 0; outline: 0; width: 100%; background: transparent; }
.icon-button { position: relative; }
.icon-button span {
    position: absolute; top: -6px; right: -4px; width: 18px; height: 18px;
    display: grid; place-items: center; font-size: 11px; color: #fff;
    background: #1d4ed8; border-radius: 999px;
}

.profile-chip { display: flex; align-items: center; gap: 12px; }
.avatar {
    width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center;
    color: #fff; background: linear-gradient(135deg, #ff9f1c, #ff4d7d); font-weight: 700;
}
.profile-chip strong, .profile-chip small { display: block; }
.profile-chip small { color: var(--text-soft); }

.page-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 24px; gap: 16px;
}
.page-header h2 { font-size: 42px; margin: 0 0 6px; }
.page-header p { margin: 0; color: var(--text-soft); }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.stat-card, .panel-card {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,.72);
    box-shadow: var(--shadow-soft);
    border-radius: 24px;
}

.stat-card {
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform .25s ease, box-shadow .25s ease;
}
.stat-card:hover, .panel-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 60px rgba(18, 31, 68, 0.12);
}
.stat-card span, .stat-card small { display: block; }
.stat-card span { color: var(--text-soft); margin-bottom: 6px; }
.stat-card strong { font-size: 40px; line-height: 1; display: block; }
.stat-card small { margin-top: 12px; color: #14b86a; font-weight: 600; }

.stat-icon {
    width: 60px; height: 60px; border-radius: 20px; color: #fff; display: grid; place-items: center; font-size: 28px;
}
.stat-icon.blue { background: linear-gradient(135deg, #3b82f6, #4f63ff); }
.stat-icon.purple { background: linear-gradient(135deg, #6d5dfc, #8678ff); }
.stat-icon.green { background: linear-gradient(135deg, #21c780, #3fd49a); }
.stat-icon.orange { background: linear-gradient(135deg, #ff9f1c, #ffb347); }
.stat-icon.pink { background: linear-gradient(135deg, #ff4d7d, #ff7a59); }
.stat-icon.teal { background: linear-gradient(135deg, #13b7b7, #25d6c8); }

.dashboard-grid, .reports-grid {
    display: grid;
    grid-template-columns: 1.2fr 1.4fr 1.1fr;
    gap: 20px;
}
.panel-card { padding: 22px; }
.panel-card-wide { grid-column: span 2; }

.panel-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.panel-head h3 { margin: 0 0 4px; font-size: 28px; }
.panel-head p { margin: 0; color: var(--text-soft); }

.chart-wrap { min-height: 280px; }
.doughnut-wrap { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 18px; }
.legend-list, .simple-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.legend-list li, .simple-list li { color: var(--text-soft); display: flex; align-items: center; gap: 10px; }
.legend-list strong { color: var(--text-main); margin-left: auto; }
.dot { width: 12px; height: 12px; border-radius: 999px; display: inline-block; }
.dot.online { background: #2ccf8f; }
.dot.offline { background: #ff4d7d; }

.stack-list, .activity-list { display: grid; gap: 14px; }
.stack-item, .activity-item {
    display: flex; justify-content: space-between; align-items: center; gap: 14px;
    padding: 14px 16px; background: rgba(245, 247, 251, 0.9); border-radius: 18px;
}
.stack-item p, .activity-item p, .stack-item span, .activity-item small { margin: 0; color: var(--text-soft); }

.status-chip {
    padding: 9px 12px; border-radius: 999px; font-size: 13px; font-weight: 700;
    background: #eef2ff; color: #4338ca; white-space: nowrap;
}
.status-chip.success { background: #e7fbf2; color: #14945d; }
.status-chip.warning { background: #fff4e6; color: #d97706; }
.status-chip.neutral { background: #eef2ff; color: #4f46e5; }

.activity-item { justify-content: flex-start; align-items: flex-start; }
.activity-icon {
    width: 42px; height: 42px; border-radius: 16px; display: grid; place-items: center;
    background: linear-gradient(135deg, rgba(109,93,252,.15), rgba(59,130,246,.12)); color: #4f46e5; flex-shrink: 0;
}

.storage-meter { display: grid; gap: 14px; margin-bottom: 18px; }
.storage-meter .progress { height: 16px; border-radius: 999px; background: #ebeff7; }
.storage-meter .progress-bar { border-radius: 999px; background: linear-gradient(90deg, #4f63ff, #25d6c8); }

.table-clean { margin-bottom: 0; }
.table-clean th {
    border-bottom: 1px solid rgba(15,23,42,.08);
    color: var(--text-soft); font-weight: 600;
}
.table-clean td {
    border-bottom: 1px solid rgba(15,23,42,.06);
    color: var(--text-main); vertical-align: middle;
}

.module-layout, .reports-grid { margin-top: 8px; }
.header-actions .btn, .card-action { border-radius: 999px; }
.table-actions { display: inline-flex; gap: 8px; align-items: center; justify-content: flex-end; }
.empty-state {
    min-height: 280px;
    display: grid;
    place-items: center;
    text-align: center;
    color: var(--text-soft);
    gap: 12px;
}
.empty-state i { font-size: 44px; color: #94a3b8; }
.empty-state h4 { margin: 0; color: var(--text-main); }
.crud-form { display: grid; gap: 28px; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 18px;
}
.form-field { display: grid; gap: 8px; }
.span-1 { grid-column: span 1; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-6 { grid-column: span 6; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; }
.form-control, .form-select {
    border-radius: 16px;
    border-color: rgba(15, 23, 42, 0.12);
    min-height: 52px;
    padding: 12px 16px;
}
.form-control:focus, .form-select:focus {
    border-color: #6d5dfc;
    box-shadow: 0 0 0 0.2rem rgba(109, 93, 252, 0.15);
}
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    padding: 6px 12px;
}

.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    font-family: 'Manrope', sans-serif;
    background:
        linear-gradient(180deg, rgba(4, 10, 28, 0.3), rgba(4, 10, 28, 0.72)),
        url('../logos/fundo.webp') center center / cover no-repeat,
        #040918;
}
.auth-body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 50% 0%, rgba(42, 114, 255, 0.24), transparent 24%),
        radial-gradient(circle at 50% 100%, rgba(21, 88, 255, 0.16), transparent 20%);
    pointer-events: none;
}
.auth-shell { width: min(620px, 100%); position: relative; z-index: 1; }
.auth-panel {
    display: grid; grid-template-columns: 1.2fr .9fr; gap: 24px;
    align-items: stretch;
}
.auth-panel-single { grid-template-columns: 1fr; justify-items: center; }
.auth-card {
    background: rgba(12, 18, 38, 0.76);
    color: #fff;
    border: 1px solid rgba(169, 188, 255, 0.14);
    box-shadow:
        0 30px 80px rgba(2, 8, 24, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(18px);
}
.auth-card-premium {
    position: relative;
    width: min(100%, 620px);
    overflow: hidden;
    border-radius: 30px;
    padding: 28px 32px 22px;
}
.auth-card-premium::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
        radial-gradient(circle at top center, rgba(37, 99, 235, 0.18), transparent 30%);
    pointer-events: none;
}
.auth-brand,
.auth-copy,
.auth-form,
.auth-footer { position: relative; z-index: 1; }
.auth-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}
.auth-brand-logo {
    width: min(156px, 42vw);
    display: block;
    filter: drop-shadow(0 16px 24px rgba(16, 92, 255, 0.22));
}
.auth-copy-centered {
    text-align: center;
    margin: 0 auto 20px;
    max-width: 390px;
    color: #fff;
}
.auth-copy-centered h1 {
    margin: 0 0 10px;
    font-size: clamp(1.9rem, 4vw, 2.9rem);
    line-height: 1.04;
    font-weight: 800;
    letter-spacing: -0.04em;
}
.auth-copy-centered h1 span {
    color: #4da1ff;
    text-shadow: 0 0 24px rgba(77, 161, 255, 0.36);
}
.auth-copy-centered p {
    margin: 0;
    color: rgba(233, 239, 255, 0.72);
    font-size: 0.95rem;
    line-height: 1.55;
}
.auth-form-premium {
    display: grid;
    gap: 14px;
    margin-top: 6px;
}
.auth-alert {
    border-radius: 18px;
    border: 1px solid rgba(255, 107, 129, 0.24);
    background: rgba(79, 18, 30, 0.72);
    color: #ffd4dc;
    margin-bottom: 2px;
}
.auth-field { display: grid; gap: 10px; }
.auth-label {
    margin: 0;
    color: #eef3ff;
    font-size: 0.95rem;
    font-weight: 600;
}
.auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 56px;
    border-radius: 16px;
    border: 1px solid rgba(123, 144, 195, 0.24);
    background: rgba(14, 22, 42, 0.62);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.auth-input-wrap:focus-within {
    border-color: rgba(76, 141, 255, 0.72);
    box-shadow: 0 0 0 4px rgba(47, 109, 255, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transform: translateY(-1px);
}
.auth-input-icon,
.auth-visibility-toggle {
    width: 48px;
    display: grid;
    place-items: center;
    color: rgba(197, 206, 228, 0.72);
    flex-shrink: 0;
}
.auth-input-icon svg,
.auth-visibility-toggle svg,
.auth-submit svg,
.auth-footer svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.9;
}
.auth-input {
    border: 0;
    min-height: 54px;
    padding: 0 4px 0 0;
    color: #fff;
    background: transparent;
    box-shadow: none;
    font-size: 0.98rem;
}
.auth-input::placeholder { color: rgba(176, 186, 210, 0.52); }
.auth-input:focus {
    background: transparent;
    color: #fff;
    box-shadow: none;
}
.auth-visibility-toggle {
    border: 0;
    background: transparent;
    cursor: pointer;
    padding: 0;
}
.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 2px;
    color: rgba(229, 235, 248, 0.9);
}
.auth-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.92rem;
    cursor: pointer;
}
.auth-check input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.auth-check-box {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1px solid rgba(82, 136, 255, 0.72);
    background: rgba(13, 22, 46, 0.55);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.auth-check input:checked + .auth-check-box {
    background: linear-gradient(135deg, #1f8cff, #3457ff);
    border-color: transparent;
    box-shadow: 0 0 0 4px rgba(52, 87, 255, 0.14);
}
.auth-link {
    color: #45a0ff;
    font-weight: 700;
    font-size: 0.92rem;
}
.auth-submit {
    min-height: 58px;
    border: 0;
    border-radius: 18px;
    margin-top: 6px;
    background: linear-gradient(90deg, #42a5ff 0%, #395bff 100%);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 20px 50px rgba(45, 104, 255, 0.34);
    transition: transform .22s ease, box-shadow .22s ease, filter .22s ease;
}
.auth-submit:hover,
.auth-submit:focus {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 24px 56px rgba(45, 104, 255, 0.42);
    filter: brightness(1.03);
}
.auth-footer {
    margin: 20px -32px -22px;
    padding: 18px 24px 20px;
    border-top: 1px solid rgba(161, 177, 221, 0.11);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: rgba(219, 227, 245, 0.74);
    text-align: center;
}
.auth-footer strong {
    display: block;
    margin-top: 2px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.56);
    font-size: 0.8rem;
}
.auth-glow {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 72%;
    height: 12px;
    background: radial-gradient(circle, rgba(64, 142, 255, 0.95) 0%, rgba(64, 142, 255, 0) 72%);
    pointer-events: none;
    filter: blur(10px);
}
.auth-glow-top { top: -2px; }
.auth-glow-bottom { bottom: -2px; }

@media (max-width: 1440px) {
    .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
    .admin-shell, .auth-panel, .dashboard-grid, .reports-grid { grid-template-columns: 1fr; }
    .sidebar { position: relative; height: auto; }
    .panel-card-wide { grid-column: span 1; }
}

@media (max-width: 768px) {
    .main-content, .sidebar { padding: 18px; }
    .topbar, .page-header { flex-direction: column; align-items: stretch; }
    .topbar-actions, .auth-metrics, .doughnut-wrap, .stats-grid { grid-template-columns: 1fr; display: grid; }
    .search-box { width: 100%; }
    .page-header h2 { font-size: 34px; }
    .auth-body { padding: 14px; align-items: stretch; }
    .auth-shell { width: 100%; display: flex; align-items: center; }
    .auth-card-premium { width: 100%; padding: 22px 18px 16px; border-radius: 22px; }
    .auth-brand-logo { width: min(132px, 42vw); }
    .auth-copy-centered { margin-bottom: 16px; max-width: 100%; }
    .auth-copy-centered h1 { font-size: 2rem; }
    .auth-copy-centered p { font-size: 0.9rem; }
    .auth-input-wrap { min-height: 52px; }
    .auth-input { min-height: 50px; font-size: 0.95rem; }
    .auth-row { flex-direction: column; align-items: flex-start; }
    .auth-submit { min-height: 54px; }
    .auth-footer { margin: 18px -18px -16px; padding: 16px 14px 18px; }
    .form-grid { grid-template-columns: 1fr; }
    .span-1, .span-2, .span-3, .span-4, .span-6 { grid-column: span 1; }
    .form-actions { flex-direction: column-reverse; }
}

@media (max-width: 420px) {
    .auth-body { padding: 10px; }
    .auth-card-premium { padding: 18px 14px 14px; border-radius: 20px; }
    .auth-copy-centered h1 { font-size: 1.72rem; }
    .auth-copy-centered p { line-height: 1.45; }
    .auth-row { gap: 10px; }
    .auth-check,
    .auth-link { font-size: 0.88rem; }
    .auth-footer {
        flex-direction: column;
        gap: 8px;
        margin: 16px -14px -14px;
        padding: 14px 12px 16px;
    }
}
