:root {
    --bg-color: #070d18;
    --card-bg: rgba(15, 23, 42, 0.75);
    --card-border: rgba(56, 189, 248, 0.16);
    --primary: #0ea5e9;
    --primary-hover: #0284c7;
    --primary-glow: rgba(14, 165, 233, 0.45);
    --secondary: #6366f1;
    --accent-cyan: #06b6d4;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --danger: #f43f5e;
    --danger-hover: #e11d48;
    --success: #10b981;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --border: #1e293b;
    --sidebar-width: 270px;
    --font-main: 'Plus Jakarta Sans', 'Inter', -apple-system, sans-serif;
}

body.light-mode {
    --bg-color: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.95);
    --card-border: rgba(2, 132, 199, 0.2);
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    background: radial-gradient(circle at 80% 20%, #e0f2fe 0%, #f1f5f9 60%, #f8fafc 100%) !important;
}

/* Base Body Styles */
body {
    font-family: var(--font-main);
    background: radial-gradient(circle at 85% 15%, #0f2b48 0%, #081226 50%, #030712 100%) !important;
    background-attachment: fixed !important;
    color: var(--text);
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    letter-spacing: -0.01em;
}

/* Evita que larguras e espaçamentos internos façam o painel ultrapassar a tela. */
*, *::before, *::after {
    box-sizing: border-box;
}

/* App Layout */
.app-container {
    display: flex;
    height: 100vh;
    background: transparent;
}

/* Sidebar (NOC Console Style) */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(8, 14, 26, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(56, 189, 248, 0.15);
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    flex-shrink: 0;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
    z-index: 50;
}

.sidebar.collapsed {
    width: 64px;
    padding: 20px 8px;
}

.sidebar.collapsed .brand-text-block,
.sidebar.collapsed .sidebar-status-row,
.sidebar.collapsed .nav-group-title,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .arrow-icon,
.sidebar.collapsed .sidebar-footer,
.sidebar.collapsed .badge-count {
    display: none !important;
}

.sidebar.collapsed .nav-btn {
    justify-content: center;
    padding: 12px 0;
}

.sidebar.collapsed .nav-icon {
    font-size: 1.3rem;
    margin: 0;
}

/* Brand Container */
.brand-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-badge-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 0 16px rgba(14, 165, 233, 0.5);
    position: relative;
    flex-shrink: 0;
}

.brand-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 10px;
    border: 1px solid rgba(56, 189, 248, 0.8);
    animation: brandPulseRing 2.5s infinite;
}

@keyframes brandPulseRing {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 0; }
    100% { transform: scale(1); opacity: 0; }
}

.brand-text-block {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.brand-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-subtitle {
    font-size: 0.7rem;
    font-weight: 700;
    color: #38bdf8;
    letter-spacing: 0.12em;
    opacity: 0.85;
}

.btn-toggle-sidebar {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    border-radius: 6px;
    padding: 6px 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-toggle-sidebar:hover {
    background: rgba(14, 165, 233, 0.15);
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.3);
}

.sidebar-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 14px;
    gap: 8px;
}

.isp-version-chip {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #38bdf8;
    background: rgba(14, 165, 233, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.3);
    padding: 3px 8px;
    border-radius: 12px;
}

.sidebar-tenant-box {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Nav Menu */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    padding-right: 4px;
    margin-top: 15px;
}

.nav-group-title {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #38bdf8;
    margin: 16px 8px 6px 8px;
    opacity: 0.9;
}

.nav-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #94a3b8;
    padding: 10px 14px;
    text-align: left;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    outline: none;
}

.nav-btn:hover {
    background: rgba(14, 165, 233, 0.08);
    border-color: rgba(56, 189, 248, 0.2);
    color: #f1f5f9;
    transform: translateX(2px);
}

.nav-btn.active {
    background: linear-gradient(90deg, rgba(14, 165, 233, 0.2) 0%, rgba(99, 102, 241, 0.05) 100%);
    border-color: rgba(56, 189, 248, 0.35);
    color: #ffffff;
    font-weight: 700;
    box-shadow: inset 3px 0 0 #00d2ff, 0 4px 14px rgba(14, 165, 233, 0.15);
}

.nav-btn.active .nav-icon {
    filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.6));
}

.nav-icon {
    font-size: 1.1rem;
    transition: transform 0.2s;
}

.nav-btn:hover .nav-icon {
    transform: scale(1.1);
}

.btn-nav-logout {
    margin-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 8px;
    color: #f43f5e !important;
}

.btn-nav-logout:hover {
    background: rgba(244, 63, 94, 0.1) !important;
    border-color: rgba(244, 63, 94, 0.3) !important;
    color: #fda4af !important;
}

/* Submenu container */
.submenu-container {
    display: none;
    flex-direction: column;
    gap: 3px;
    padding-left: 20px;
    margin: 4px 0;
    border-left: 1px dashed rgba(56, 189, 248, 0.25);
    margin-left: 18px;
}

.nav-btn-sub {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 7px 12px;
    text-align: left;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.86rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.nav-btn-sub:hover,
.nav-btn-sub.active {
    background: rgba(14, 165, 233, 0.12);
    color: #38bdf8;
}

/* Top Bar (NOC Telemetry Console) */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.top-bar {
    height: 72px;
    border-bottom: 1px solid rgba(56, 189, 248, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    background: rgba(8, 14, 26, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 40;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.top-bar-title-block {
    display: flex;
    flex-direction: column;
}

.top-bar-title-block h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.top-bar-isp-tag {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #38bdf8;
    opacity: 0.85;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Telemetry Pills */
.telemetry-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(56, 189, 248, 0.2);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.telemetry-pill.estoque-status-pill {
    background: rgba(16, 185, 129, 0.12) !important;
    border: 1px solid rgba(16, 185, 129, 0.4) !important;
    color: #10b981 !important;
    font-weight: 700;
}

.telemetry-pill.estoque-lastlogin-pill {
    background: rgba(15, 23, 42, 0.75) !important;
    border: 1px solid rgba(56, 189, 248, 0.3) !important;
}

.telemetry-pill.estoque-uptime-pill {
    background: rgba(15, 23, 42, 0.75) !important;
    border: 1px solid rgba(245, 158, 11, 0.3) !important;
}

.pulse-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    position: relative;
}

.pulse-green {
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.pulse-amber {
    background: #f59e0b;
    box-shadow: 0 0 8px #f59e0b;
}

.pulse-red {
    background: #f43f5e;
    box-shadow: 0 0 8px #f43f5e;
}

.telemetry-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(56, 189, 248, 0.25);
    padding: 5px 12px;
    border-radius: 24px;
}

.user-avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0284c7 0%, #6366f1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.4);
}

.user-info-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.user-name-display {
    font-weight: 700;
    font-size: 12px;
    color: #ffffff;
}

.user-role-tag {
    font-size: 9px;
    font-weight: 800;
    color: #38bdf8;
    letter-spacing: 0.08em;
}

.btn-theme-switch {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
    border-radius: 10px;
    padding: 7px 11px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.btn-theme-switch:hover {
    background: rgba(14, 165, 233, 0.15);
    border-color: rgba(56, 189, 248, 0.3);
}

.view-section {
    flex: 1;
    overflow-y: auto;
    padding: 30px 40px;
    display: none;
    /* Hide by default */
}

.view-section.active {
    display: block !important;
}

/*
 * Layout compacto para notebooks e monitores menores.  Não reduz o zoom do
 * navegador: reorganiza os componentes para que as ações continuem visíveis.
 */
@media (min-width: 769px) and (max-width: 1280px) {
    :root {
        --sidebar-width: 220px;
    }

    .sidebar {
        padding: 14px 10px;
    }

    .brand-container {
        gap: 8px;
    }

    .brand-title {
        font-size: 1rem;
    }

    .nav-menu {
        margin-top: 10px;
    }

    .nav-group-title {
        margin-top: 12px;
    }

    .nav-btn {
        padding: 8px 10px;
        font-size: 0.84rem;
        gap: 8px;
    }

    .top-bar {
        height: 62px;
        padding: 0 20px;
    }

    .top-bar-right {
        gap: 8px;
    }

    .telemetry-pill {
        padding: 5px 9px;
        font-size: 11px;
    }

    .view-section {
        padding: 20px 24px;
    }

    .stats-grid,
    .stats-grid-isp {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 12px;
        margin-bottom: 18px;
    }

    .chart-container-grid {
        gap: 14px;
        margin-bottom: 18px;
    }

    .glass-modal-content {
        max-height: calc(100vh - 32px);
        max-width: min(760px, calc(100vw - 32px));
    }
}

@media (min-width: 769px) and (max-width: 1050px) {
    :root {
        --sidebar-width: 196px;
    }

    .top-bar-title-block h2 {
        font-size: 1rem;
    }

    .top-bar-isp-tag,
    .ftth-status-pill,
    .estoque-lastlogin-pill {
        display: none;
    }

    .view-section {
        padding: 16px;
    }

    .stats-grid,
    .stats-grid-isp {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }
}

@media (min-width: 769px) and (max-height: 800px) {
    .sidebar {
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .sidebar-status-row {
        margin-top: 8px;
    }

    .nav-group-title {
        margin-top: 9px;
        margin-bottom: 3px;
    }

    .nav-btn {
        padding-top: 7px;
        padding-bottom: 7px;
    }

    .view-section {
        padding-top: 16px;
        padding-bottom: 16px;
    }

    .chart-wrapper {
        height: 240px;
    }
}

#content-monitoramento.active {
    display: flex !important;
}

#content-crm.active {
    display: flex !important;
    flex-direction: column !important;
}

/* Grid Systems */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.grid-2-1 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

/* ISP Telecom KPI Grid & Cards */
.stats-grid-isp {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 18px;
}

.isp-stat-card {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(56, 189, 248, 0.16);
    border-radius: 14px;
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.isp-stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    opacity: 0.85;
}

.isp-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4), 0 0 16px rgba(14, 165, 233, 0.15);
    border-color: rgba(56, 189, 248, 0.35);
}

/* Card Accent Colors */
.card-amber::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.card-emerald::before { background: linear-gradient(90deg, #10b981, #34d399); }
.card-cyan::before { background: linear-gradient(90deg, #06b6d4, #38bdf8); }
.card-blue::before { background: linear-gradient(90deg, #3b82f6, #6366f1); }

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.stat-card-title {
    font-size: 13px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-icon-wrapper {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
}

.icon-amber { background: rgba(245, 158, 11, 0.15); border: 1px solid rgba(245, 158, 11, 0.3); }
.icon-emerald { background: rgba(16, 185, 129, 0.15); border: 1px solid rgba(16, 185, 129, 0.3); }
.icon-cyan { background: rgba(6, 182, 212, 0.15); border: 1px solid rgba(6, 182, 212, 0.3); }
.icon-blue { background: rgba(59, 130, 246, 0.15); border: 1px solid rgba(59, 130, 246, 0.3); }

.stat-number-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 6px;
}

.stat-number {
    margin: 0;
    font-size: 32px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: #ffffff;
}

.card-amber .stat-number { color: #fbbf24; text-shadow: 0 0 16px rgba(245, 158, 11, 0.3); }
.card-emerald .stat-number { color: #34d399; text-shadow: 0 0 16px rgba(16, 185, 129, 0.3); }
.card-cyan .stat-number { color: #38bdf8; text-shadow: 0 0 16px rgba(6, 182, 212, 0.3); }
.card-blue .stat-number { color: #60a5fa; text-shadow: 0 0 16px rgba(59, 130, 246, 0.3); }

.stat-status-text {
    margin: 0;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: #f43f5e;
}

.stat-badge-trend {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-trend-active {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.3);
}

.stat-card-subtitle {
    font-size: 11px;
    color: #64748b;
    font-weight: 500;
}

/* Glass Card & Glass Table Component */
.card, .glass-card {
    background: rgba(15, 23, 42, 0.75) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid rgba(56, 189, 248, 0.16) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.card.full-height {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    height: 600px;
}

.telecom-badge-pulse {
    font-size: 11px;
    font-weight: 700;
    color: #10b981;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 4px 10px;
    border-radius: 14px;
    letter-spacing: 0.04em;
}

.glass-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 0.92rem;
}

.glass-table th {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.08em;
    color: #38bdf8;
    padding: 12px 16px;
    border-bottom: 2px solid rgba(56, 189, 248, 0.2);
    text-align: left;
    background: rgba(8, 14, 26, 0.4);
}

.glass-table td {
    padding: 14px 16px;
    color: #f1f5f9;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

.glass-table tr:hover td {
    background: rgba(14, 165, 233, 0.05);
}

h2,
h3 {
    margin-top: 0;
    color: var(--text);
}

h3 {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* Dynamic City Manager */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.tab-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(0px);
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
}

.tab-btn.active {
    background: rgba(59, 130, 246, 0.2) !important;
    color: #60a5fa !important;
    border-color: rgba(59, 130, 246, 0.6) !important;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

body.light-mode .tab-btn {
    border-color: rgba(0, 0, 0, 0.15);
    color: #475569;
}

body.light-mode .tab-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #0f172a;
    border-color: rgba(0, 0, 0, 0.25);
}

body.light-mode .tab-btn.active {
    background: rgba(37, 99, 235, 0.1) !important;
    color: #1d4ed8 !important;
    border-color: rgba(37, 99, 235, 0.4) !important;
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.15);
}


/* Forms & Controls */
.control-group {
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 16px 20px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.control-group:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

body.light-mode .control-group {
    background: rgba(0, 0, 0, 0.02) !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

body.light-mode .control-group:hover {
    background: rgba(0, 0, 0, 0.04) !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
}

.control-group

input[type="text"],
input[type="password"],
input[type="number"],
input[type="time"],
select,
textarea {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="time"]:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    background: rgba(15, 23, 42, 0.85);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* Premium Table Styling */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    font-size: 0.92rem;
}

th {
    font-weight: 600;
    color: var(--text-muted);
    padding: 12px 16px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.08);
}

td {
    padding: 14px 16px;
    color: var(--text);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

body.light-mode th {
    border-bottom: 2px solid rgba(0, 0, 0, 0.08);
}

body.light-mode td {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

body.light-mode tr:hover td {
    background: rgba(0, 0, 0, 0.01);
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #334155;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:checked+.slider.danger {
    background-color: var(--danger);
}

input:checked+.slider.warning {
    background-color: #f59e0b;
}

input:checked+.slider:before {
    transform: translateX(22px);
}

/* Buttons (Vibrant ISP Style) */
.btn-primary {
    background: linear-gradient(135deg, #0284c7 0%, #0ea5e9 100%) !important;
    color: #ffffff !important;
    border: 1px solid rgba(56, 189, 248, 0.4) !important;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.01em;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0369a1 0%, #0284c7 100%) !important;
    border-color: rgba(56, 189, 248, 0.7) !important;
    box-shadow: 0 6px 20px rgba(14, 165, 233, 0.55);
    transform: translateY(-1px);
    color: #ffffff !important;
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-save {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%) !important;
    color: #ffffff !important;
    border: 1px solid rgba(52, 211, 153, 0.4) !important;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    font-weight: 800;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.02em;
}

.btn-save:hover {
    background: linear-gradient(135deg, #047857 0%, #059669 100%) !important;
    border-color: rgba(52, 211, 153, 0.7) !important;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.55);
    transform: translateY(-1px);
    color: #ffffff !important;
}

.btn-save:active {
    transform: translateY(0);
}

.btn-danger {
    background: linear-gradient(135deg, #e11d48 0%, #f43f5e 100%) !important;
    border: 1px solid rgba(251, 113, 133, 0.4) !important;
    color: #ffffff !important;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(244, 63, 94, 0.3);
    transition: all 0.25s ease;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #be123c 0%, #e11d48 100%) !important;
    border-color: rgba(251, 113, 133, 0.7) !important;
    box-shadow: 0 5px 16px rgba(244, 63, 94, 0.5);
    color: white;
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(15, 23, 42, 0.8) !important;
    border: 1px solid rgba(56, 189, 248, 0.2) !important;
    color: #cbd5e1 !important;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.25s ease;
}

.btn-secondary:hover {
    background: rgba(14, 165, 233, 0.12) !important;
    border-color: rgba(56, 189, 248, 0.4) !important;
    color: #ffffff !important;
    transform: translateY(-1px);
}

body.light-mode .btn-primary {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(29, 78, 216, 0.08)) !important;
    color: #1d4ed8 !important;
    border: 1px solid rgba(37, 99, 235, 0.3) !important;
}

body.light-mode .btn-primary:hover {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.15), rgba(29, 78, 216, 0.15)) !important;
    border-color: rgba(37, 99, 235, 0.5) !important;
}

body.light-mode .btn-save {
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.08), rgba(4, 120, 87, 0.08)) !important;
    color: #047857 !important;
    border: 1px solid rgba(5, 150, 105, 0.3) !important;
}

body.light-mode .btn-save:hover {
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.15), rgba(4, 120, 87, 0.15)) !important;
    border-color: rgba(5, 150, 105, 0.5) !important;
}

/* Status Badges */
.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
}

.status-online {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.status-offline {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

/* Chat UI */
.chat-wrapper {
    flex: 1;
    display: flex;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    height: 100%;
}

.chat-sidebar {
    width: 250px;
    background: rgba(0, 0, 0, 0.2);
    border-right: 1px solid var(--border);
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.1);
    min-width: 0;
}

.chat-header {
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    display: flex;
    justify-content: space-between;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-input-area {
    padding: 15px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
}

.chat-bubble {
    max-width: 75%;
    padding: 10px 15px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-break: break-word;
}

.msg-bot {
    background: var(--primary);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.msg-client {
    background: #334155;
    color: white;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.chat-item {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.chat-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.chat-item.active {
    background: var(--primary);
    color: white;
}

.chat-item .name {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
}

.chat-item .msg {
    display: block;
    font-size: 0.8rem;
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Plan Items */
.plan-item {
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr 2fr 1.2fr auto;
    gap: 10px;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.plan-item:hover {
    background: rgba(0, 0, 0, 0.35);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    transform: translateY(-1px);
}

body.light-mode .plan-item {
    background: rgba(255, 255, 255, 0.7) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
}

body.light-mode .plan-item:hover {
    background: rgba(255, 255, 255, 0.9) !important;
    border-color: rgba(0, 0, 0, 0.15) !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08) !important;
}
.plan-item .glass-input,
.plan-item .glass-select {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    padding: 6px 12px !important;
    font-size: 0.88rem !important;
    border-radius: 6px !important;
}

.remove-plan-btn {
    color: var(--danger);
    font-size: 1.2rem;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0 10px;
}

/* Queue Table */
.queue-table {
    width: 100%;
    border-collapse: collapse;
}

.queue-table th {
    text-align: left;
    color: var(--text-muted);
    padding: 10px;
    border-bottom: 1px solid var(--border);
}

.queue-table td {
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* --- UI REFACTOR: SUBMENU & FORMS --- */
.submenu {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 15px;
    overflow-x: auto;
    white-space: nowrap;
}

.submenu::-webkit-scrollbar {
    height: 4px;
}

.submenu::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.submenu-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
}

.submenu-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.submenu-btn.active {
    background: var(--primary);
    color: white;
}

/* Tab Content Visibility */
.config-tab {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tech Form Grid Fix */
.tech-form-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 15px;
    align-items: center;
}

.tech-form-grid input,
.tech-form-grid select {
    margin-bottom: 0;
}

/* Responsive Adjusments */
@media (max-width: 768px) {
    .tech-form-grid {
        grid-template-columns: 1fr;
    }

    .submenu-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
    }

    .plan-headers-row {
        display: none !important;
    }

    .plan-item {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        padding: 18px !important;
    }
}

/* Submenu Vertical Accordion UI Refactor (Premium Dark Design) */
/* --- UI REFACTOR: SUBMENU REDUNDANTE OCULTADO --- */
.submenu {
    display: none !important; /* Remove o círculo branco de botões horizontais redundantes */
}

/* --- UI REFACTOR: ACORDEÃO VERTICAL DESLIZANTE --- */
.submenu-container {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-left: 10px;
    flex-shrink: 0;
}

.submenu-container.open {
    max-height: 500px; /* Suficiente para os sub-botões */
    opacity: 1;
    margin-top: 4px;
    margin-bottom: 8px;
}

.nav-btn-sub {
    background: transparent !important;
    border: none !important;
    color: #94a3b8 !important; /* Cor de texto discreta cinza */
    padding: 8px 12px 8px 36px !important; /* Recuo perfeito de sub-item */
    text-align: left;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    outline: none;
    border-left: 2px solid transparent !important; /* Indicador inativo */
}

.nav-btn-sub:hover {
    background: rgba(255, 255, 255, 0.03) !important;
    color: #f8fafc !important;
    border-left: 2px solid rgba(59, 130, 246, 0.3) !important; /* Indicador sutil de hover */
}

.nav-btn-sub.active {
    background: rgba(59, 130, 246, 0.1) !important; /* Fundo azul transparente profissional */
    color: #3b82f6 !important; /* Texto azul premium */
    font-weight: 600 !important;
    border-left: 2px solid #3b82f6 !important; /* Indicador ativo azul de alta usabilidade */
}

/* --- PREMIUM GENERAL CONFIG & PAIRING UI STYLES --- */
.glass-card {
    background: rgba(30, 41, 59, 0.45) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.light-mode .glass-card {
    background: rgba(255, 255, 255, 0.65) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.08);
}

/* QR Scanner Animation */
@keyframes scan {
    0% {
        top: 0%;
        opacity: 0.8;
    }
    50% {
        top: 100%;
        opacity: 1;
    }
    100% {
        top: 0%;
        opacity: 0.8;
    }
}

/* Pairing Code Box Animation */
@keyframes popIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
        box-shadow: 0 0 0 rgba(245, 158, 11, 0);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
    }
    100% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    }
}

.pairing-char-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 52px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #f59e0b;
    font-size: 1.6rem;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
    box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.03), 0 4px 6px rgba(0, 0, 0, 0.2);
    animation: popIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

body.light-mode .pairing-char-box {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.12);
    color: #d97706;
    text-shadow: none;
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.02), 0 2px 4px rgba(0, 0, 0, 0.05);
}

.pairing-separator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 4px;
    user-select: none;
}

/* --- GLASSMORPHISM SYSTEM ADDITIONS --- */

/* Classes Utilitárias */
.mt-5 { margin-top: 20px !important; }
.mb-3 { margin-bottom: 12px !important; }
.mb-1 { margin-bottom: 4px !important; }
.ml-2 { margin-left: 10px !important; }
.mr-1 { margin-right: 4px !important; }
.h-24 { height: 96px !important; }
.flex-1 { flex: 1 !important; }
.w-full { width: 100% !important; }
.py-1 { padding-top: 4px !important; padding-bottom: 4px !important; }
.px-2 { padding-left: 8px !important; padding-right: 8px !important; }
.py-2 { padding-top: 8px !important; padding-bottom: 8px !important; }
.p-2 { padding: 8px !important; }
.text-xs { font-size: 0.75rem !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.whitespace-nowrap { white-space: nowrap !important; }
.text-muted { color: var(--text-muted) !important; }

/* Badges */
.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}
.badge-primary {
    background: rgba(59, 130, 246, 0.2) !important;
    color: #60a5fa !important;
    border: 1px solid rgba(59, 130, 246, 0.3) !important;
}
body.light-mode .badge-primary {
    background: rgba(59, 130, 246, 0.1) !important;
    color: #2563eb !important;
    border: 1px solid rgba(59, 130, 246, 0.2) !important;
}

/* Subcards translúcidos */
.glass-subcard {
    background: rgba(0, 0, 0, 0.25) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 12px;
}

body.light-mode .glass-subcard {
    background: rgba(0, 0, 0, 0.03) !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
}

/* Inputs, Textareas e Selects com efeito Glass */
.glass-input, .glass-textarea, .glass-select {
    background: rgba(15, 23, 42, 0.45) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #f8fafc !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-input:focus, .glass-textarea:focus, .glass-select:focus {
    background: rgba(15, 23, 42, 0.7) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.25) !important;
}

body.light-mode .glass-input,
body.light-mode .glass-textarea,
body.light-mode .glass-select {
    background: rgba(255, 255, 255, 0.65) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    color: #0f172a !important;
}

body.light-mode .glass-input:focus,
body.light-mode .glass-textarea:focus,
body.light-mode .glass-select:focus {
    background: #ffffff !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.15) !important;
}

/* Tabelas Glassmorphism */
.glass-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(15, 23, 42, 0.2) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 8px;
    overflow: hidden;
}

.glass-table th {
    background: rgba(255, 255, 255, 0.02) !important;
    border-bottom: 2px solid rgba(255, 255, 255, 0.06);
    padding: 12px 16px;
    color: var(--text-muted);
    font-weight: 600;
}

.glass-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text);
}

.glass-table tr:hover td {
    background: rgba(255, 255, 255, 0.03) !important;
}

body.light-mode .glass-table {
    background: rgba(255, 255, 255, 0.35) !important;
}

body.light-mode .glass-table th {
    background: rgba(0, 0, 0, 0.01) !important;
    border-bottom: 2px solid rgba(0, 0, 0, 0.05);
}

body.light-mode .glass-table td {
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

body.light-mode .glass-table tr:hover td {
    background: rgba(0, 0, 0, 0.01) !important;
}

/* Botões Customizados do Sistema */
.btn-glass-action {
    border: none;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-glass-action.btn-edit {
    background: rgba(59, 130, 246, 0.25) !important;
    color: #60a5fa !important;
}
.btn-glass-action.btn-edit:hover {
    background: var(--primary) !important;
    color: #fff !important;
}

.btn-glass-action.btn-reset {
    background: rgba(245, 158, 11, 0.2) !important;
    color: #fbbf24 !important;
}
.btn-glass-action.btn-reset:hover {
    background: #f59e0b !important;
    color: #000 !important;
}

.btn-glass-action.btn-delete {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #fca5a5 !important;
}
.btn-glass-action.btn-delete:hover {
    background: var(--danger) !important;
    color: #fff !important;
}

/* Adaptive Utility and Semantic Classes for Glassmorphism Redesign */
.config-footer-separator {
    margin-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 15px;
}
body.light-mode .config-footer-separator {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.small-muted {
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.tech-form-grid-adaptive {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    align-items: center;
}

.control-group-column {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.flex-gap-10 {
    display: flex;
    gap: 10px;
}

.flex-gap-10-w-full {
    display: flex;
    gap: 10px;
    width: 100%;
}

.control-group-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.grid-2-col-align {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    align-items: center;
}

.table-responsive-wrapper {
    margin: 20px 0;
    overflow-x: auto;
}

.warning-heading {
    color: #f59e0b;
    margin-bottom: 10px;
}

.actions-container {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.mt-15 { margin-top: 15px; }
.mb-10 { margin-bottom: 10px; }
.mb-15 { margin-bottom: 15px; }
.mb-20 { margin-bottom: 20px; }
.ml-10 { margin-left: 10px; }
.w-15-pct { width: 15%; }
.w-35-pct { width: 35%; }

.pairing-code-container-layout {
    margin-top: 20px;
    justify-content: center;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.block-mt-10 {
    display: block;
    margin-top: 10px;
}

.card-subtitle-adaptive {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--text);
}

.flex-space-between-align-center-mb-15 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

/* Light Mode Submenu Buttons Contrast */
body.light-mode .nav-btn-sub {
    color: #64748b !important;
}
body.light-mode .nav-btn-sub:hover {
    background: rgba(0, 0, 0, 0.05) !important;
    color: #0f172a !important;
}

/* Warning Glassmorphism Button */
.btn-warning-glass {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.15), rgba(202, 138, 4, 0.15)) !important;
    border: 1px solid rgba(234, 179, 8, 0.3) !important;
    color: #eab308 !important;
}
.btn-warning-glass:hover {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.25), rgba(202, 138, 4, 0.25)) !important;
    box-shadow: 0 0 12px rgba(234, 179, 8, 0.2);
}

/* Light Mode Warning Button Contrast Override */
body.light-mode .btn-warning-glass {
    background: linear-gradient(135deg, rgba(202, 138, 4, 0.08), rgba(161, 98, 7, 0.08)) !important;
    border: 1px solid rgba(202, 138, 4, 0.35) !important;
    color: #854d0e !important;
}
body.light-mode .btn-warning-glass:hover {
    background: linear-gradient(135deg, rgba(202, 138, 4, 0.15), rgba(161, 98, 7, 0.15)) !important;
    box-shadow: 0 0 10px rgba(202, 138, 4, 0.15);
}

/* Glass Card Form Labels Styling */
.glass-card label {
    font-size: 0.75rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.08em !important;
    color: var(--text-muted) !important;
    display: block !important;
    margin-bottom: 8px !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

body.light-mode .glass-card label {
    color: #475569 !important;
    text-shadow: none !important;
}

/* Glassmorphism Modals and Cidades & Planos styling */
.glass-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 15000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    overflow-y: auto;
}

.glass-modal-content {
    position: relative;
    background: #1e293b !important;
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.98)) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 16px;
    padding: 20px 24px;
    width: 100%;
    max-width: 540px;
    max-height: calc(100vh - 36px);
    max-height: calc(100dvh - 36px);
    overflow-y: auto;
    box-sizing: border-box;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    animation: modalFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    margin: auto;
}

/* Scrollbar moderno e sutil para o conteúdo dos modais */
.glass-modal-content::-webkit-scrollbar {
    width: 6px;
}
.glass-modal-content::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 4px;
}
.glass-modal-content::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 4px;
}
.glass-modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}

.modal-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.modal-header-row h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
}
.modal-close-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-left: 10px;
}
.modal-close-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
    color: #ef4444;
}

.modal-actions-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    bottom: -20px;
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.88) 0%, rgba(15, 23, 42, 0.98) 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding-bottom: 2px;
    z-index: 10;
    border-radius: 0 0 12px 12px;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.plan-headers-row {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr 1.2fr auto;
    gap: 10px;
    margin-bottom: 8px;
    padding: 0 15px;
    border: 1px solid transparent;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
}

/* ==========================================================================
   REPORTS DASHBOARD STYLES
   ========================================================================== */

/* Filter Bar */
.reports-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    padding: 12px 20px;
    background: rgba(15, 23, 42, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    margin-bottom: 25px;
    transition: all 0.3s ease;
}

body.light-mode .reports-filter-bar {
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* KPI Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(15, 23, 42, 0.35) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    border-radius: 12px;
    padding: 20px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card:hover {
    transform: translateY(-2px);
    background: rgba(15, 23, 42, 0.55) !important;
    border-color: rgba(59, 130, 246, 0.3) !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

body.light-mode .stat-card {
    background: rgba(255, 255, 255, 0.65) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04) !important;
}

body.light-mode .stat-card:hover {
    background: rgba(255, 255, 255, 0.85) !important;
    border-color: rgba(59, 130, 246, 0.4) !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08) !important;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-header h3 {
    margin: 0;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: var(--text-muted);
}

.stat-icon {
    font-size: 1.25rem;
    opacity: 0.9;
}

.stat-value {
    margin: 5px 0 0 0;
    font-size: 2rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

body.light-mode .stat-value {
    color: #0f172a;
}

.stat-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Charts Containers */
.chart-container-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 992px) {
    .chart-container-grid {
        grid-template-columns: 1fr;
    }
}

.chart-card {
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 20px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

body.light-mode .chart-card {
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.chart-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #f8fafc;
}

body.light-mode .chart-title {
    color: #0f172a;
}

.chart-wrapper {
    position: relative;
    width: 100%;
    height: 300px;
}

/* Table Container & Custom Glass Table */
.reports-table-container {
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 20px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-top: 30px;
}

body.light-mode .reports-table-container {
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.glass-table {
    width: 100%;
    border-collapse: collapse;
    color: #cbd5e1;
    font-size: 0.88rem;
}

body.light-mode .glass-table {
    color: #334155;
}

.glass-table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px 16px;
    text-align: left;
}

body.light-mode .glass-table th {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.glass-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
}

body.light-mode .glass-table td {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.glass-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
    color: #ffffff;
}

body.light-mode .glass-table tr:hover td {
    background: rgba(0, 0, 0, 0.01);
    color: #000000;
}

/* ========================================================================= */
/* ESTILOS DO MÓDULO DE ESTOQUE & COMPRAS */
/* ========================================================================= */

.estoque-tabs-header {
    background: rgba(8, 14, 26, 0.7);
    border: 1px solid rgba(56, 189, 248, 0.2);
    padding: 6px;
    border-radius: 12px;
    display: inline-flex;
    gap: 6px;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.estoque-tab-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #94a3b8;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.estoque-tab-btn:hover {
    background: rgba(14, 165, 233, 0.1);
    color: #38bdf8;
    transform: translateY(-1px);
}

.estoque-tab-btn.active {
    background: linear-gradient(135deg, #0284c7 0%, #0ea5e9 100%);
    color: #ffffff;
    border: 1px solid rgba(56, 189, 248, 0.5);
    box-shadow: 0 4px 14px rgba(14, 165, 233, 0.4);
}

body.light-mode .estoque-tab-btn.active {
    background: #0284c7;
    color: #ffffff;
    border: 1px solid #0369a1;
}

/* Badges de Categorias de Provedor */
.badge-cat-radio { background: rgba(6, 182, 212, 0.2); color: #38bdf8; border: 1px solid rgba(6, 182, 212, 0.4); padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; }
.badge-cat-fibra { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.4); padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; }
.badge-cat-onu { background: rgba(139, 92, 246, 0.2); color: #c084fc; border: 1px solid rgba(139, 92, 246, 0.4); padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; }
.badge-cat-ferragem { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.4); padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; }

/* Badges de Status de Seriais / Equipamentos */
.badge-serial {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-serial-em_estoque { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-serial-emprestado_cliente { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-serial-com_tecnico { background: rgba(139, 92, 246, 0.15); color: #a78bfa; border: 1px solid rgba(139, 92, 246, 0.3); }
.badge-serial-em_manutencao { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-serial-baixado_queimado { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-serial-baixado_danificado { background: rgba(249, 115, 22, 0.15); color: #fb923c; border: 1px solid rgba(249, 115, 22, 0.3); }
.badge-serial-perdido { background: rgba(100, 116, 139, 0.2); color: #94a3b8; border: 1px solid rgba(100, 116, 139, 0.4); }
.badge-serial-vendido_balcao { background: rgba(6, 182, 212, 0.15); color: #22d3ee; border: 1px solid rgba(6, 182, 212, 0.3); }

/* Badges de Status de Compras */
.badge-compra {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}

.badge-compra-solicitacao { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-compra-cotacao { background: rgba(139, 92, 246, 0.15); color: #a78bfa; border: 1px solid rgba(139, 92, 246, 0.3); }
.badge-compra-aprovada { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-compra-pedido_realizado { background: rgba(14, 165, 233, 0.15); color: #38bdf8; border: 1px solid rgba(14, 165, 233, 0.3); }
.badge-compra-recebido { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-compra-entrada_estoque { background: rgba(5, 150, 105, 0.18); color: #6ee7b7; border: 1px solid rgba(5, 150, 105, 0.35); }
.badge-compra-cancelado { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }

/* Barra visual de progresso do estoque */
.progress-bar-estoque {
    width: 100%;
    height: 6px;
    background: #1e293b;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.fill-verde { background: #10b981; }
.fill-amarelo { background: #f59e0b; }
.fill-vermelho { background: #ef4444; }

/* Timeline de Rastreabilidade */
.timeline-item {
    position: relative;
    padding-left: 24px;
    border-left: 2px solid #334155;
    padding-bottom: 12px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #38bdf8;
    border: 2px solid #0f172a;
}

/* ========================================================================= */
/* RESPONSIVIDADE COMPLETA PARA SMARTPHONES & DISPOSITIVOS MÓVEIS            */
/* ========================================================================= */

.mobile-toggle-btn {
    display: none;
    background: #1e293b;
    border: 1px solid #334155;
    color: #f8fafc;
    font-size: 1.3rem;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.mobile-toggle-btn:hover {
    background: #334155;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-backdrop.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* Badges para Cargos de Funcionários */
.badge-cargo-admin { background: #8b5cf6; color: #fff; padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; }
.badge-cargo-estoque { background: #3b82f6; color: #fff; padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; }
.badge-cargo-noc { background: #06b6d4; color: #0f172a; padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; }
.badge-cargo-atendente { background: #10b981; color: #fff; padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; }

@media (max-width: 768px) {
    /* Base Viewport & Containers */
    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
        height: 100% !important;
    }

    .mobile-toggle-btn {
        display: flex !important;
    }

    .app-container {
        position: relative !important;
        overflow: hidden !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
    }

    /* Sidebar Drawer Off-Canvas */
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        height: 100dvh !important;
        width: 280px !important;
        max-width: 85vw !important;
        z-index: 999 !important;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        box-shadow: 4px 0 25px rgba(0, 0, 0, 0.7);
        overflow-y: auto !important;
        background: #090e1a !important;
    }

    .sidebar.mobile-open {
        transform: translateX(0) !important;
    }

    /* Conteúdo Principal */
    .main-content {
        width: 100vw !important;
        min-width: 0 !important;
        flex: 1 !important;
        overflow: hidden !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        display: flex !important;
        flex-direction: column !important;
    }

    /* Top Bar rígida - anti-sobreposição */
    .top-bar {
        height: 56px !important;
        min-height: 56px !important;
        max-height: 56px !important;
        padding: 0 12px !important;
        gap: 8px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: nowrap !important;
        overflow: hidden !important;
        z-index: 50 !important;
        flex-shrink: 0 !important;
    }

    .top-bar-left {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        min-width: 0 !important;
        flex-shrink: 1 !important;
        overflow: hidden !important;
    }

    .top-bar-title-block {
        min-width: 0 !important;
        overflow: hidden !important;
    }

    .top-bar-title-block h2 {
        font-size: 0.95rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 140px !important;
        margin: 0 !important;
    }

    .top-bar-isp-tag {
        display: none !important;
    }

    .top-bar-right {
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        flex-shrink: 0 !important;
    }

    .ftth-status-pill {
        display: none !important;
    }

    .telemetry-pill.bot-status-pill {
        padding: 4px 8px !important;
        font-size: 11px !important;
        gap: 5px !important;
    }

    .estoque-lastlogin-pill {
        display: none !important;
    }

    .telemetry-pill.estoque-status-pill,
    .telemetry-pill.estoque-uptime-pill {
        padding: 4px 8px !important;
        font-size: 11px !important;
        gap: 5px !important;
    }

    .telemetry-user-card {
        padding: 0 !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }

    .telemetry-user-card .user-info-text {
        display: none !important;
    }

    .user-avatar-circle {
        width: 28px !important;
        height: 28px !important;
        font-size: 12px !important;
    }

    .btn-theme-switch {
        padding: 4px 8px !important;
        font-size: 0.85rem !important;
    }

    /* Seções e Viewports de Conteúdo */
    .view-section {
        height: calc(100vh - 56px) !important;
        height: calc(100dvh - 56px) !important;
        max-height: calc(100dvh - 56px) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 12px 10px !important;
        box-sizing: border-box !important;
        width: 100% !important;
    }

    #content-crm, #content-monitoramento {
        height: calc(100vh - 56px) !important;
        height: calc(100dvh - 56px) !important;
        max-height: calc(100dvh - 56px) !important;
        padding: 0 !important;
        overflow: hidden !important;
    }

    /* CRM Adaptativo para Smartphone */
    .crm-mobile-nav {
        display: flex !important;
        flex-shrink: 0 !important;
        padding: 6px 10px !important;
        gap: 6px !important;
        background: #0f172a !important;
        border-bottom: 1px solid #1e293b !important;
    }

    .crm-mobile-tab {
        padding: 6px 4px !important;
        font-size: 11px !important;
    }

    .crm-3-cols {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }

    .crm-col-queue,
    .crm-col-mychats,
    .crm-col-chat {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        border-right: none !important;
        flex: 1 !important;
        height: 100% !important;
        min-height: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    .crm-col-queue.mobile-hidden,
    .crm-col-mychats.mobile-hidden,
    .crm-col-chat.mobile-hidden {
        display: none !important;
    }

    .mobile-only {
        display: inline-flex !important;
    }

    .crm-back-btn {
        display: inline-flex !important;
        padding: 4px 8px !important;
        font-size: 11px !important;
    }

    #crmChatMessages {
        flex: 1 !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 10px 12px !important;
    }

    .crm-col-chat > div:last-child {
        padding: 8px 10px !important;
        flex-shrink: 0 !important;
        gap: 8px !important;
        background: #0f172a !important;
    }

    #crmAttachBtn {
        padding: 8px 10px !important;
        font-size: 14px !important;
    }

    #crmChatInput {
        min-height: 38px !important;
        padding: 8px 10px !important;
        font-size: 13px !important;
    }

    #crmSendBtn {
        padding: 8px 14px !important;
        font-size: 13px !important;
    }

    /* Grids & Cards do Painel Geral (Home) */
    .stats-grid-isp {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

    .isp-stat-card {
        padding: 12px 10px !important;
        border-radius: 10px !important;
    }

    .isp-stat-card .stat-card-title {
        font-size: 10px !important;
    }

    .isp-stat-card .stat-number {
        font-size: 1.25rem !important;
    }

    .isp-stat-card .stat-card-subtitle,
    .isp-stat-card .stat-badge-trend {
        display: none !important;
    }

    .telecom-grid-2 {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    /* Estoque e Almoxarifado em Smartphone */
    .estoque-action-buttons {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 6px !important;
        width: 100% !important;
    }

    .estoque-action-buttons button {
        width: 100% !important;
        padding: 8px 6px !important;
        font-size: 11px !important;
        justify-content: center !important;
    }

    .estoque-subnav,
    .estoque-tabs-header {
        display: flex !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: 8px !important;
        margin-bottom: 15px !important;
        gap: 6px !important;
        border-bottom: 1px solid #334155 !important;
    }

    .estoque-subnav .estoque-tab-btn,
    .estoque-tab-btn {
        flex-shrink: 0 !important;
        white-space: nowrap !important;
        padding: 7px 11px !important;
        font-size: 12px !important;
    }

    .estoque-kpis-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

    .estoque-kpis-grid .stat-card {
        padding: 12px 8px !important;
    }

    .estoque-kpis-grid .stat-card h3 {
        font-size: 11px !important;
    }

    .estoque-kpis-grid .stat-card p {
        font-size: 18px !important;
        margin-top: 6px !important;
    }

    .telecom-counters-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

    .telecom-counters-grid > div {
        padding: 8px 10px !important;
        gap: 8px !important;
    }

    .telecom-counters-grid span {
        font-size: 18px !important;
    }

    .telecom-counters-grid div div:last-child {
        font-size: 15px !important;
    }

    /* Correção do overflow 450px do grid duplo */
    .estoque-grid-double,
    [style*="minmax(450px"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        width: 100% !important;
    }

    .estoque-grid-double > div {
        min-width: 0 !important;
        overflow: hidden !important;
    }

    /* Grids e formulários gerais */
    .stats-grid,
    .grid,
    .grid-2-1,
    .tech-form-grid,
    .tech-form-grid-adaptive {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    /* Tabelas com rolagem horizontal suave */
    .table-responsive-wrapper,
    .card[style*="overflow-x: auto"],
    div[style*="overflow-x: auto"] {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        margin-bottom: 12px;
    }

    .glass-table {
        min-width: 500px;
    }

    /* Modais responsivos para smartphone */
    .glass-modal-content {
        width: 95vw !important;
        max-width: 95vw !important;
        max-height: 90vh !important;
        max-height: 90dvh !important;
        padding: 16px 12px !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .glass-modal-content div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    /* Submenu horizontal em Configurações */
    .submenu {
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: 8px !important;
        margin-bottom: 15px !important;
        gap: 6px !important;
    }

    .submenu-btn {
        flex-shrink: 0 !important;
        padding: 6px 12px !important;
        font-size: 12px !important;
    }
}

/* ==========================================
   MODERN CRM & CHAT INTERFACE STYLES
   ========================================== */

#crmChatMessages {
    background-color: #0c1524 !important;
    background-image: radial-gradient(#1e293b 1px, transparent 1px) !important;
    background-size: 24px 24px !important;
    scroll-behavior: smooth;
}

#crmChatMessages::-webkit-scrollbar {
    width: 6px;
}

#crmChatMessages::-webkit-scrollbar-track {
    background: transparent;
}

#crmChatMessages::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.2);
    border-radius: 6px;
}

#crmChatMessages::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.4);
}

.crm-date-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 16px 0 10px 0;
    position: relative;
}

.crm-date-chip {
    background: #1e293b;
    color: #94a3b8;
    padding: 4px 14px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid #334155;
    box-shadow: 0 2px 5px rgba(0,0,0,0.25);
    letter-spacing: 0.02em;
}

.crm-msg-wrapper {
    display: flex;
    flex-direction: column;
    margin-bottom: 8px;
}

.crm-msg-wrapper.crm-msg-new {
    animation: crmMsgFadeIn 0.2s ease-out;
}

@keyframes crmMsgFadeIn {
    from { opacity: 0; transform: translateY(3px); }
    to { opacity: 1; transform: translateY(0); }
}

.crm-msg-bubble {
    position: relative;
    max-width: 78%;
    padding: 10px 14px;
    font-size: 13.5px;
    line-height: 1.5;
    word-wrap: break-word;
    word-break: break-word;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

@media (max-width: 768px) {
    .crm-msg-bubble {
        max-width: 90%;
        padding: 9px 12px;
        font-size: 13px;
    }
}

/* Cliente (Incoming / Left) */
.crm-msg-user {
    align-self: flex-start;
    background: #1e293b;
    color: #f8fafc;
    border: 1px solid #334155;
    border-radius: 16px 16px 16px 3px;
}

/* Atendente Humano (Outgoing / Right - WhatsApp Dark Green) */
.crm-msg-agent {
    align-self: flex-end;
    background: #005c4b;
    color: #f0fdf4;
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 16px 16px 3px 16px;
}

/* Bot Automático (Outgoing / Right - Deep Indigo/Navy) */
.crm-msg-bot {
    align-self: flex-end;
    background: #1e293b;
    border-left: 3px solid #6366f1;
    color: #e2e8f0;
    border-radius: 16px 16px 3px 16px;
    border-top: 1px solid #334155;
    border-right: 1px solid #334155;
    border-bottom: 1px solid #334155;
}

.crm-sender-tag {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10.5px;
    font-weight: 700;
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.crm-msg-time-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 4px;
    font-size: 10.5px;
}

.crm-checkmarks {
    font-size: 12px;
    line-height: 1;
    color: #38bdf8;
    letter-spacing: -1px;
}

.crm-audio-player {
    border-radius: 20px;
    height: 38px;
    max-width: 240px;
    outline: none;
    margin-top: 2px;
}

/* Responsividade do Módulo de Ordem de Serviço (O.S.) */
@media (max-width: 900px) {
    #os-main-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Estilos do Módulo de Recolhimento de Comodato */
.btn-filter-comodato {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid #334155;
    color: #94a3b8;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-filter-comodato:hover {
    background: rgba(51, 65, 85, 0.8);
    color: #f8fafc;
}

.btn-filter-comodato.active {
    background: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
    color: #60a5fa;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.25);
}

.badge-faixa-gravissimo {
    background: rgba(124, 58, 237, 0.2);
    color: #c084fc;
    border: 1px solid rgba(124, 58, 237, 0.4);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-faixa-critico {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-faixa-atencao {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-faixa-recente {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.4);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Performance Optimizations: DOM Virtualization & Fast Rendering */
#crmQueueList li,
#crmMyChatsList li,
#tbl-produtos-estoque-body tr,
#tbl-seriais-estoque-body tr,
#tbl-movimentacoes-estoque-body tr,
#os-table-body tr,
#comodato-table-body tr {
    content-visibility: auto;
    contain-intrinsic-size: 0 50px;
}

.crm-queue-item {
    padding: 12px 14px;
    border-bottom: 1px solid #1e293b;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: transparent;
    transition: background 0.15s;
    content-visibility: auto;
    contain-intrinsic-size: 0 95px;
}
.crm-queue-item:hover {
    background: #0f172a;
}
.crm-avatar-amber {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #000;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(245, 158, 11, 0.25);
}
.crm-btn-pull {
    flex: 1.2;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #000;
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: opacity 0.15s;
}
.crm-btn-pull:hover {
    opacity: 0.9;
}
.crm-btn-end {
    flex: 1;
    background: #1e293b;
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    transition: all 0.15s;
}
.crm-btn-end:hover {
    background: #064e3b;
    color: #fff;
}
.crm-btn-del {
    flex: 1;
    background: #1e293b;
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    transition: all 0.15s;
}
.crm-btn-del:hover {
    background: #7f1d1d;
    color: #fff;
}

.crm-chat-item {
    cursor: pointer;
    padding: 12px 16px;
    border-bottom: 1px solid #1e293b;
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border-left: 3px solid transparent;
    transition: background 0.15s;
    content-visibility: auto;
    contain-intrinsic-size: 0 65px;
}
.crm-chat-item:hover {
    background: #0f172a;
}
.crm-chat-item.active-chat {
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid #3b82f6;
}
.crm-chat-item.active-chat:hover {
    background: rgba(59, 130, 246, 0.15);
}
.crm-avatar-emerald {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #059669);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(16, 185, 129, 0.25);
}




/* Maintenance Mode Animations & Overlay */
@keyframes pulseGlow {
    0% {
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 25px rgba(245, 158, 11, 0.15);
    }
    100% {
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 50px rgba(245, 158, 11, 0.35);
    }
}

@keyframes bounceDot {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.3;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}


/* =========================================================
   MÓDULO DE MONITORAMENTO DOWNDETECTOR (NOC) - SCOPED .dd-*
   ========================================================= */
.dd-root-container {
    max-width: 1420px;
    margin: 0 auto;
    color: #f1f5f9;
    font-family: var(--font-main);
    padding-bottom: 40px;
}

.dd-hero-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.dd-hero-left {
    flex: 1;
    min-width: 280px;
}

.dd-badges-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.dd-pill-badge {
    font-size: 11px;
    font-family: monospace;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid transparent;
}

.dd-pill-cyan {
    background: rgba(59, 130, 246, 0.12);
    color: #67e8f9;
    border-color: rgba(59, 130, 246, 0.32);
}

.dd-pill-emerald {
    background: rgba(16, 185, 129, 0.12);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.32);
}

.dd-main-title {
    margin: 0;
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -0.02em;
    color: #ffffff;
}

.dd-main-subtitle {
    margin: 6px 0 0 0;
    font-size: 13px;
    line-height: 1.5;
    color: #94a3b8;
    max-width: 820px;
}

.dd-main-subtitle strong {
    color: #e2e8f0;
}

.dd-hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.dd-btn {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 11px;
    font-family: monospace;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.dd-btn-subagent {
    background: linear-gradient(90deg, rgba(49, 46, 129, 0.65), rgba(88, 28, 135, 0.65));
    border-color: rgba(99, 102, 241, 0.45);
    color: #a5f3fc;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.18);
}

.dd-btn-subagent:hover:not(:disabled) {
    background: linear-gradient(90deg, rgba(55, 48, 163, 0.85), rgba(107, 33, 168, 0.85));
    box-shadow: 0 0 16px rgba(99, 102, 241, 0.35);
    transform: translateY(-1px);
}

.dd-btn-subagent:disabled {
    opacity: 0.7;
    cursor: wait;
}

.dd-btn-autoscan {
    background: rgba(15, 23, 42, 0.85);
    border-color: #1e293b;
    color: #94a3b8;
}

.dd-btn-autoscan.active {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.35);
    color: #6ee7b7;
}

.dd-dot-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #64748b;
}

.dd-btn-autoscan.active .dd-dot-pulse {
    background: #34d399;
    box-shadow: 0 0 8px #34d399;
}

.dd-countdown-chip {
    background: rgba(0, 0, 0, 0.35);
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 10px;
    color: #a7f3d0;
}

.dd-btn-refresh {
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    border-color: rgba(96, 165, 250, 0.3);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.dd-btn-refresh:hover:not(:disabled) {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    transform: translateY(-1px);
}

/* Toast Banner */
.dd-toast-banner {
    margin-bottom: 18px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(99, 102, 241, 0.45);
    background: rgba(30, 27, 75, 0.6);
    color: #c7d2fe;
    font-size: 12px;
    font-family: monospace;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.dd-toast-banner.dd-toast-success {
    background: rgba(6, 78, 59, 0.55);
    border-color: rgba(16, 185, 129, 0.5);
    color: #a7f3d0;
}

.dd-toast-banner.dd-toast-error {
    background: rgba(136, 19, 55, 0.55);
    border-color: rgba(244, 63, 94, 0.5);
    color: #fecdd3;
}

.dd-toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dd-toast-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 13px;
    opacity: 0.75;
}

/* Subagents HUD Panel */
.dd-hud-panel {
    margin-bottom: 20px;
    padding: 16px;
    border-radius: 16px;
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.95), rgba(11, 18, 34, 0.98), rgba(15, 23, 42, 0.95));
    border: 1px solid rgba(30, 41, 59, 0.9);
}

.dd-hud-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.dd-hud-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.dd-hud-title {
    font-size: 12px;
    font-family: monospace;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #67e8f9;
}

.dd-hud-chip {
    font-size: 10px;
    font-family: monospace;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.2);
    color: #67e8f9;
    border: 1px solid rgba(59, 130, 246, 0.35);
}

.dd-hud-tag {
    font-size: 11px;
    font-family: monospace;
    color: #94a3b8;
}

.dd-hud-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px;
}

.dd-hud-card {
    padding: 12px;
    border-radius: 12px;
    background: rgba(2, 6, 23, 0.6);
    border: 1px solid #1e293b;
}

.dd-hud-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.dd-hud-card-name {
    font-size: 12px;
    font-family: monospace;
    font-weight: 700;
}

.dd-hud-card-desc {
    margin: 0;
    font-size: 11px;
    line-height: 1.45;
    color: #94a3b8;
}

.dd-text-indigo { color: #818cf8; }
.dd-text-emerald { color: #34d399; }
.dd-text-amber { color: #fbbf24; }
.dd-text-cyan { color: #22d3ee; }
.dd-text-rose { color: #f43f5e; }

/* Incidents Radar */
.dd-incidents-radar {
    margin-bottom: 20px;
    padding: 16px;
    border-radius: 16px;
    background: linear-gradient(90deg, rgba(120, 53, 15, 0.35), rgba(15, 23, 42, 0.92));
    border: 1px solid rgba(245, 158, 11, 0.45);
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.1);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.dd-radar-left {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 1;
    min-width: 260px;
}

.dd-radar-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid rgba(245, 158, 11, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.dd-radar-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.dd-radar-title {
    font-size: 12px;
    font-family: monospace;
    font-weight: 800;
    text-transform: uppercase;
    color: #fcd34d;
}

.dd-radar-chip {
    font-size: 10px;
    font-family: monospace;
    background: rgba(245, 158, 11, 0.2);
    color: #fde68a;
    padding: 2px 8px;
    border-radius: 6px;
}

.dd-radar-list {
    margin-top: 6px;
    font-size: 12px;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dd-radar-btn {
    padding: 7px 14px;
    border-radius: 10px;
    font-size: 12px;
    font-family: monospace;
    font-weight: 700;
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.45);
    cursor: pointer;
    transition: all 0.2s;
}

.dd-radar-btn:hover {
    background: rgba(245, 158, 11, 0.32);
}

/* 4 Executive KPI Cards */
.dd-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.dd-kpi-card {
    background: rgba(13, 20, 36, 0.92);
    border: 1px solid rgba(30, 41, 59, 0.9);
    border-radius: 16px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.dd-kpi-card:hover {
    border-color: #334155;
    transform: translateY(-1px);
}

.dd-kpi-card.active-kpi-blue {
    background: rgba(15, 23, 42, 0.96);
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.dd-kpi-card.active-kpi-emerald {
    background: rgba(6, 78, 59, 0.25);
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.dd-kpi-card.active-kpi-amber {
    background: rgba(120, 53, 15, 0.25);
    border-color: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.dd-kpi-card.active-kpi-rose {
    background: rgba(136, 19, 55, 0.25);
    border-color: #f43f5e;
    box-shadow: 0 0 0 2px rgba(244, 63, 94, 0.2);
}

.dd-kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.dd-kpi-label {
    font-size: 11px;
    font-family: monospace;
    font-weight: 700;
    text-transform: uppercase;
    color: #94a3b8;
}

.dd-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dd-dot-emerald {
    background: #34d399;
    box-shadow: 0 0 10px rgba(52, 211, 153, 0.8);
}

.dd-dot-amber {
    background: #fbbf24;
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.8);
}

.dd-dot-rose {
    background: #f43f5e;
    box-shadow: 0 0 10px rgba(244, 63, 94, 0.8);
}

.dd-kpi-value-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.dd-kpi-number {
    font-size: 28px;
    font-weight: 900;
    font-family: monospace;
    color: #ffffff;
}

.dd-kpi-tag {
    font-size: 12px;
    font-family: monospace;
    font-weight: 700;
}

.dd-kpi-sub {
    font-size: 12px;
    font-family: monospace;
    color: #94a3b8;
}

.dd-kpi-bar-bg {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: #1e293b;
    margin-top: 10px;
    overflow: hidden;
}

.dd-kpi-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #10b981, #22d3ee);
    transition: width 0.4s ease;
}

.dd-kpi-foot {
    display: block;
    margin-top: 10px;
    font-size: 11px;
    color: #94a3b8;
}

.dd-kpi-split-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.dd-kpi-latency-box {
    text-align: right;
}

.dd-kpi-latency-val {
    font-size: 18px;
    font-weight: 900;
    font-family: monospace;
    color: #22d3ee;
}

.dd-kpi-latency-lbl {
    display: block;
    font-size: 9px;
    font-family: monospace;
    text-transform: uppercase;
    color: #64748b;
}

/* Toolbar & Category Pills */
.dd-toolbar-panel {
    background: rgba(13, 20, 36, 0.92);
    border: 1px solid rgba(30, 41, 59, 0.9);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.dd-toolbar-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.dd-search-wrapper {
    position: relative;
    flex: 1;
    min-width: 260px;
    max-width: 460px;
}

.dd-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: #94a3b8;
}

.dd-search-input {
    width: 100%;
    padding: 10px 14px 10px 34px;
    border-radius: 12px;
    background: rgba(2, 6, 23, 0.9);
    border: 1px solid #1e293b;
    color: #ffffff;
    font-size: 12px;
    outline: none;
    transition: border-color 0.2s;
}

.dd-search-input:focus {
    border-color: #06b6d4;
}

.dd-toolbar-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.dd-sort-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dd-sort-label {
    font-size: 11px;
    font-family: monospace;
    color: #94a3b8;
}

.dd-sort-select {
    padding: 8px 12px;
    border-radius: 12px;
    background: #0f172a;
    border: 1px solid #1e293b;
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    outline: none;
}

.dd-viewmode-group {
    display: flex;
    align-items: center;
    padding: 4px;
    border-radius: 12px;
    background: #020617;
    border: 1px solid #1e293b;
    gap: 4px;
}

.dd-view-btn {
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s;
}

.dd-view-btn.active {
    background: #2563eb;
    color: #ffffff;
}

.dd-category-pills {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.dd-cat-pill {
    padding: 6px 14px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid #1e293b;
    color: #cbd5e1;
    transition: all 0.2s;
}

.dd-cat-pill:hover {
    background: #1e293b;
}

.dd-cat-pill.active {
    background: linear-gradient(90deg, #2563eb, #4f46e5);
    color: #ffffff;
    border-color: rgba(96, 165, 250, 0.35);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.dd-cat-count {
    font-size: 10px;
    font-family: monospace;
    padding: 1px 6px;
    border-radius: 999px;
    background: #1e293b;
    color: #94a3b8;
}

.dd-cat-pill.active .dd-cat-count {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

/* Services Grid & Cards */
.dd-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 18px;
}

.dd-company-card {
    background: rgba(13, 20, 36, 0.95);
    border: 1px solid rgba(30, 41, 59, 0.9);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    transition: all 0.25s ease;
}

.dd-company-card:hover {
    border-color: #334155;
    box-shadow: 0 10px 35px rgba(37, 99, 235, 0.14);
}

.dd-card-topbar {
    height: 6px;
    width: 100%;
}

.dd-topbar-emerald {
    background: linear-gradient(90deg, #10b981, #2dd4bf, #059669);
}

.dd-topbar-amber {
    background: linear-gradient(90deg, #f59e0b, #facc15, #f97316);
}

.dd-topbar-rose {
    background: linear-gradient(90deg, #e11d48, #ef4444, #db2777);
}

.dd-card-body {
    padding: 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.dd-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.dd-card-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.dd-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(51, 65, 85, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.dd-card-title {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dd-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 3px;
}

.dd-card-cat {
    font-size: 10px;
    font-family: monospace;
    padding: 2px 7px;
    border-radius: 4px;
    background: #0f172a;
    color: #94a3b8;
    border: 1px solid #1e293b;
}

.dd-card-slug {
    font-size: 10px;
    font-family: monospace;
    color: #64748b;
}

/* Status Badge */
.dd-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 10px;
    font-family: monospace;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
    border: 1px solid transparent;
}

.dd-badge-ok {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.4);
}

.dd-badge-warn {
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
    border-color: rgba(245, 158, 11, 0.4);
}

.dd-badge-down {
    background: rgba(244, 63, 94, 0.2);
    color: #fda4af;
    border-color: rgba(244, 63, 94, 0.5);
}

.dd-badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.dd-badge-ok .dd-badge-dot { background: #34d399; }
.dd-badge-warn .dd-badge-dot { background: #fbbf24; }
.dd-badge-down .dd-badge-dot { background: #f43f5e; }

/* Diagnostic Telemetry Box */
.dd-diag-box {
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 11px;
    line-height: 1.45;
    margin-bottom: 12px;
    border: 1px solid transparent;
}

.dd-diag-ok {
    background: rgba(6, 78, 59, 0.25);
    border-color: rgba(16, 185, 129, 0.25);
    color: #a7f3d0;
}

.dd-diag-warn {
    background: rgba(120, 53, 15, 0.35);
    border-color: rgba(245, 158, 11, 0.35);
    color: #fde68a;
}

.dd-diag-down {
    background: rgba(136, 19, 55, 0.4);
    border-color: rgba(244, 63, 94, 0.4);
    color: #fecdd3;
}

.dd-diag-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: monospace;
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.dd-http-chip {
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.35);
    color: #cbd5e1;
}

.dd-diag-text {
    margin: 0;
    color: #cbd5e1;
    font-size: 11px;
}

/* Downdetector Live Signal Box */
.dd-signal-box {
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 11px;
    margin-bottom: 12px;
    border: 1px solid rgba(99, 102, 241, 0.3);
    background: rgba(30, 27, 75, 0.28);
    color: #c7d2fe;
}

.dd-signal-box.dd-signal-warn {
    background: rgba(120, 53, 15, 0.38);
    border-color: rgba(245, 158, 11, 0.42);
    color: #fde68a;
}

.dd-signal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: monospace;
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.dd-signal-probs {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(99, 102, 241, 0.2);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.dd-prob-chip {
    font-size: 10px;
    font-family: monospace;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #fcd34d;
    font-weight: 700;
}

/* Sub-Services Matrix */
.dd-subs-box {
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(30, 41, 59, 0.9);
    border-radius: 12px;
    padding: 11px;
    margin-bottom: 12px;
}

.dd-subs-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 10px;
    font-family: monospace;
    font-weight: 700;
    text-transform: uppercase;
    color: #94a3b8;
}

.dd-sub-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px solid rgba(30, 41, 59, 0.7);
    font-size: 11px;
}

.dd-sub-row:last-child {
    border-bottom: none;
}

.dd-sub-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.dd-sub-name {
    color: #cbd5e1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dd-sub-status-pill {
    font-size: 10px;
    font-family: monospace;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    flex-shrink: 0;
}

.dd-sub-ok {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.dd-sub-warn {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.dd-sub-down {
    background: rgba(244, 63, 94, 0.2);
    color: #fda4af;
    border: 1px solid rgba(244, 63, 94, 0.4);
}

.dd-subs-toggle {
    width: 100%;
    text-align: center;
    font-size: 10px;
    font-family: monospace;
    font-weight: 700;
    margin-top: 8px;
    padding-top: 6px;
    border: none;
    border-top: 1px solid #1e293b;
    background: transparent;
    color: #22d3ee;
    cursor: pointer;
}

/* 3-Column Digital Readout */
.dd-readout-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(2, 6, 23, 0.65);
    border: 1px solid rgba(30, 41, 59, 0.85);
    text-align: center;
    font-family: monospace;
    margin-bottom: 12px;
}

.dd-readout-col-mid {
    border-left: 1px solid #1e293b;
    border-right: 1px solid #1e293b;
}

.dd-readout-lbl {
    display: block;
    font-size: 9px;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 2px;
}

.dd-readout-val {
    font-size: 13px;
    font-weight: 700;
}

/* Sparkline Box */
.dd-spark-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    font-family: monospace;
    color: #94a3b8;
    margin-bottom: 4px;
}

.dd-spark-svg-wrap {
    background: rgba(2, 6, 23, 0.72);
    border: 1px solid rgba(30, 41, 59, 0.85);
    border-radius: 8px;
    padding: 6px;
}

.dd-spark-stats {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    font-family: monospace;
    color: #94a3b8;
    margin-top: 5px;
}

/* Report Drawer */
.dd-report-drawer {
    margin-top: 12px;
    padding: 12px;
    border-radius: 12px;
    background: #0f172a;
    border: 1px solid rgba(245, 158, 11, 0.45);
}

.dd-report-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 700;
    color: #fcd34d;
    margin-bottom: 8px;
}

.dd-report-opt-btn {
    width: 100%;
    text-align: left;
    font-size: 11px;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid #334155;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    margin-bottom: 5px;
    transition: all 0.15s;
}

.dd-report-opt-btn:hover {
    background: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.5);
}

/* Card Footer */
.dd-card-footer {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(30, 41, 59, 0.85);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.dd-footer-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dd-action-btn {
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-family: monospace;
    font-weight: 600;
    background: #0f172a;
    border: 1px solid #334155;
    color: #22d3ee;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    transition: all 0.15s;
}

.dd-action-btn:hover {
    background: #1e293b;
}

.dd-action-link {
    color: #cbd5e1;
    border-color: #1e293b;
}

.dd-report-btn {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.38);
    color: #fda4af;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s;
}

.dd-report-btn:hover {
    background: rgba(244, 63, 94, 0.28);
}

/* Compact NOC Table */
.dd-noc-table-wrap {
    background: rgba(13, 20, 36, 0.95);
    border: 1px solid #1e293b;
    border-radius: 16px;
    overflow-x: auto;
}

.dd-noc-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 12px;
}

.dd-noc-table th {
    padding: 13px 16px;
    background: rgba(15, 23, 42, 0.92);
    border-bottom: 1px solid #1e293b;
    font-size: 11px;
    font-family: monospace;
    text-transform: uppercase;
    color: #94a3b8;
}

.dd-noc-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(30, 41, 59, 0.6);
    vertical-align: middle;
}

.dd-noc-table tr:hover td {
    background: rgba(15, 23, 42, 0.6);
}

/* Loading Box */
.dd-loading-box {
    text-align: center;
    padding: 70px 20px;
    background: rgba(13, 20, 36, 0.85);
    border: 1px solid #1e293b;
    border-radius: 16px;
}

.dd-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid #06b6d4;
    border-top-color: transparent;
    border-radius: 50%;
    margin: 0 auto 14px auto;
    animation: ddSpin 0.9s linear infinite;
}

@keyframes ddSpin {
    to { transform: rotate(360deg); }
}
