:root {
    --bg-dark: #0a0a0f;
    --bg-darker: #050507;
    --panel-bg: rgba(15, 16, 26, 0.78);
    --card-bg: rgba(255, 255, 255, 0.035);
    --card-hover: rgba(255, 255, 255, 0.055);
    --border-color: rgba(255, 255, 255, 0.09);
    --border-highlight: rgba(109, 40, 217, 0.45);
    --primary: #6d28d9;
    --primary-light: #a855f7;
    --secondary: #10b981;
    --insurgency: #ef4444;
    --directory: #3b82f6;
    --neutral: #eab308;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
}

.background-overlay {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 12% 20%, rgba(109, 40, 217, 0.16), transparent 30%),
        radial-gradient(circle at 88% 25%, rgba(16, 185, 129, 0.10), transparent 28%),
        radial-gradient(circle at 50% 90%, rgba(59, 130, 246, 0.08), transparent 35%);
    pointer-events: none;
    z-index: -1;
}

/* =========================================================
   TELA DE LOGIN VIA TELEGRAM
   ========================================================= */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-card {
    width: 100%;
    max-width: 460px;
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 22px;
    padding: 2.75rem 2.25rem;
    text-align: center;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55);
}

.login-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: rgba(109, 40, 217, 0.18);
    border: 1px solid rgba(168, 85, 247, 0.35);
    color: #d8b4fe;
    margin-bottom: 1.25rem;
}

.login-logo {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.login-logo span {
    background: linear-gradient(135deg, #a855f7, #10b981);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.96rem;
    margin-bottom: 1.75rem;
}

.telegram-widget-box {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 54px;
    padding: 1.15rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    margin-bottom: 1.5rem;
}

.alert-box {
    padding: 0.9rem 1.1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    margin-bottom: 1.4rem;
    text-align: left;
}

.alert-error {
    background: rgba(239, 68, 68, 0.13);
    border: 1px solid rgba(239, 68, 68, 0.38);
    color: #fecaca;
}

.login-restriction {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

.back-site-link {
    display: inline-block;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.back-site-link:hover {
    color: var(--text-main);
}

/* =========================================================
   HEADER DO PAINEL ADMINISTRATIVO
   ========================================================= */
.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 4%;
    background: rgba(10, 10, 15, 0.88);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
}

.brand-group {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.brand-title {
    font-size: 1.35rem;
    font-weight: 800;
    text-decoration: none;
    color: var(--text-main);
}

.brand-title span {
    color: var(--primary-light);
}

.cmd-pill {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.14);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #6ee7b7;
}

.era-pill {
    font-size: 0.82rem;
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    background: rgba(109, 40, 217, 0.16);
    border: 1px solid rgba(168, 85, 247, 0.3);
    color: #e9d5ff;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.admin-user-chip {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.admin-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--primary-light);
}

.admin-avatar-fallback {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.48rem 0.95rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-action:hover {
    background: var(--card-hover);
    border-color: rgba(255, 255, 255, 0.22);
}

.btn-logout {
    border-color: rgba(239, 68, 68, 0.32);
    color: #fca5a5;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.55);
}

/* =========================================================
   CONTAINER PRINCIPAL & CARDS DE KPI
   ========================================================= */
.dashboard-container {
    max-width: 1360px;
    margin: 0 auto;
    padding: 2rem 4% 4rem;
}

.dashboard-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(265px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2.25rem;
}

.kpi-card {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 1.4rem 1.5rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.kpi-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-highlight);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.65rem;
}

.kpi-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.kpi-icon {
    font-size: 1.35rem;
}

.kpi-value {
    font-size: 2.35rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 0.7rem;
}

.kpi-sub {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.85rem;
    font-size: 0.83rem;
    color: var(--text-muted);
}

.kpi-sub strong {
    color: var(--text-main);
}

/* =========================================================
   PAINÉIS DE SEÇÃO
   ========================================================= */
.panel-section {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.75rem;
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.section-desc {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-top: 0.2rem;
}

.legend-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.35rem;
}

.dot-ins { background: var(--insurgency); }
.dot-neu { background: var(--neutral); }
.dot-dir { background: var(--directory); }

/* =========================================================
   DOMINAÇÃO DOS SETORES
   ========================================================= */
.sectors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.1rem;
}

.sector-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.15rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sector-card.status-directory_lockdown {
    border-left: 4px solid var(--directory);
}

.sector-card.status-insurgency_sabotage {
    border-left: 4px solid var(--insurgency);
}

.sector-card.status-contested {
    border-left: 4px solid var(--neutral);
}

.sector-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.6rem;
}

.sector-name {
    font-weight: 700;
    font-size: 0.98rem;
}

.sector-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.status-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.22rem 0.6rem;
    border-radius: 999px;
    white-space: nowrap;
}

.badge-contested {
    background: rgba(234, 179, 8, 0.14);
    color: #fde047;
    border: 1px solid rgba(234, 179, 8, 0.32);
}

.badge-directory {
    background: rgba(59, 130, 246, 0.16);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.38);
}

.badge-insurgency {
    background: rgba(239, 68, 68, 0.16);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.38);
}

.control-bar {
    display: flex;
    width: 100%;
    height: 11px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
}

.bar-seg-ins { background: linear-gradient(90deg, #dc2626, #ef4444); }
.bar-seg-neu { background: linear-gradient(90deg, #ca8a04, #eab308); }
.bar-seg-dir { background: linear-gradient(90deg, #2563eb, #3b82f6); }

.sector-percentages {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 600;
}

.txt-ins { color: #f87171; }
.txt-neu { color: #facc15; }
.txt-dir { color: #60a5fa; }

/* =========================================================
   PERSONAGENS POR NÍVEL
   ========================================================= */
.brackets-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}

.bracket-pill {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.bracket-pill span {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.bracket-pill strong {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-main);
}

.levels-list {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.level-row {
    display: grid;
    grid-template-columns: 95px 1fr 220px;
    align-items: center;
    gap: 1rem;
    padding: 0.7rem 1rem;
    border-radius: 12px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

.level-tag {
    font-weight: 700;
    font-size: 0.9rem;
    color: #e2e8f0;
}

.level-track {
    width: 100%;
    height: 14px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 999px;
    overflow: hidden;
    display: flex;
}

.level-fill-ins {
    height: 100%;
    background: linear-gradient(90deg, #dc2626, #ef4444);
}

.level-fill-dir {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #3b82f6);
}

.level-numbers {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.84rem;
    white-space: nowrap;
}

.level-total-badge {
    font-weight: 700;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.08);
    padding: 0.18rem 0.55rem;
    border-radius: 6px;
}

/* =========================================================
   TABELA DE CONTAS VIP ATIVAS
   ========================================================= */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.admin-table th,
.admin-table td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.admin-table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.025);
}

.tier-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.tier-patrono {
    background: rgba(168, 85, 247, 0.2);
    color: #e9d5ff;
    border: 1px solid rgba(168, 85, 247, 0.45);
}

.tier-ouro {
    background: rgba(234, 179, 8, 0.18);
    color: #fef08a;
    border: 1px solid rgba(234, 179, 8, 0.4);
}

.tier-prata {
    background: rgba(148, 163, 184, 0.2);
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.4);
}

.empty-state {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.empty-state-sm {
    padding: 1.25rem 0.75rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.txt-ok {
    color: #34d399;
}

/* =========================================================
   DIAGNÓSTICO DE SAÚDE, ECONOMIA & AUDITORIA DE COMBATE
   ========================================================= */
.diagnostics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 1rem;
}

.diag-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.15rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.diag-card.diag-ok {
    border-left: 4px solid var(--secondary);
}

.diag-card.diag-warn {
    border-left: 4px solid var(--neutral);
}

.diag-card.diag-alert {
    border-left: 4px solid var(--insurgency);
}

.diag-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.65rem;
}

.diag-title {
    font-size: 0.94rem;
    font-weight: 700;
}

.diag-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    white-space: nowrap;
}

.diag-badge-ok {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.diag-badge-warn {
    background: rgba(234, 179, 8, 0.15);
    color: #fde047;
    border: 1px solid rgba(234, 179, 8, 0.35);
}

.diag-badge-alert {
    background: rgba(239, 68, 68, 0.16);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.diag-detail {
    font-size: 0.83rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.dual-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.subpanel-box {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.25rem;
}

.subpanel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--border-color);
}

.subpanel-head h3 {
    font-size: 0.96rem;
    font-weight: 700;
}

.subsection-heading {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.85rem;
    color: #e2e8f0;
}

.flow-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.flow-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.flow-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.84rem;
}

.mini-bar {
    width: 100%;
    height: 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.mini-bar-fill {
    height: 100%;
    border-radius: 999px;
}

.fill-faucet {
    background: linear-gradient(90deg, #059669, #34d399);
}

.fill-sink {
    background: linear-gradient(90deg, #dc2626, #f87171);
}

.compact-table th,
.compact-table td {
    padding: 0.65rem 0.75rem;
    font-size: 0.83rem;
}

.stat-chip {
    display: inline-block;
    padding: 0.16rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(168, 85, 247, 0.16);
    border: 1px solid rgba(168, 85, 247, 0.35);
    color: #e9d5ff;
    white-space: nowrap;
}

@media (max-width: 960px) {
    .dual-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .level-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .level-numbers {
        justify-content: space-between;
    }

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

