/* ==========================================================================
   VULKAN ERP — WORLD-CLASS ENTERPRISE DESIGN SYSTEM (v4.6)
   Typography: Google Roboto (UI / Display / Data) + Roboto Mono
   Responsive Continuum: 5" (320px) -> 1024x720 Compact -> Desktop -> 75" 4K UHD
   ========================================================================== */

:root {
    /* Bootstrap 5 Root Typography & Surface Overrides (100% Roboto Official) */
    --bs-font-sans-serif: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --bs-font-monospace: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    --bs-body-font-family: var(--bs-font-sans-serif);
    --bs-body-font-size: 0.875rem; /* Exact 14px Enterprise ERP Standard */
    --bs-body-font-weight: 400;
    --bs-body-line-height: 1.5;
    --bs-body-color: #1e293b;
    --bs-body-bg: #f8fafc;
    --bs-heading-color: #0f172a;
    --bs-border-color: #e2e8f0;
    --bs-border-radius: 0.5rem;
    --bs-border-radius-sm: 0.375rem;
    --bs-border-radius-lg: 0.75rem;
    --bs-primary: #2563eb;
    --bs-primary-rgb: 37, 99, 235;

    /* Vulkan Brand & Semantic Tokens */
    --vk-font-display: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --vk-font-sans: var(--bs-font-sans-serif);
    --vk-font-mono: var(--bs-font-monospace);

    --vk-primary: #2563eb;
    --vk-primary-hover: #1d4ed8;
    --vk-primary-soft: rgba(37, 99, 235, 0.09);
    --vk-accent: #0284c7;
    --vk-accent-hover: #0369a1;
    --vk-accent-soft: rgba(2, 132, 199, 0.10);

    /* Surfaces */
    --vk-bg-canvas: #f8fafc;
    --vk-bg-surface: #ffffff;
    --vk-bg-subtle: #f1f5f9;
    --vk-border: #e2e8f0;
    --vk-border-strong: #cbd5e1;

    /* Sidebar Slate Architecture (SAP Horizon / Linear / Stripe Enterprise) */
    --vk-sidebar-bg: #0f172a;
    --vk-sidebar-bg-end: #0b1120;
    --vk-sidebar-border: rgba(148, 163, 184, 0.12);
    --vk-sidebar-text: #cbd5e1;
    --vk-sidebar-muted: #64748b;
    --vk-sidebar-hover: rgba(255, 255, 255, 0.055);
    --vk-sidebar-width: 16rem; /* 256px exact */

    /* Text Hierarchy */
    --vk-text-main: #0f172a;
    --vk-text-body: #1e293b;
    --vk-text-secondary: #475569;
    --vk-text-muted: #64748b;

    /* Status */
    --vk-success: #059669;
    --vk-warning: #d97706;
    --vk-danger: #dc2626;
    --vk-info: #0284c7;

    /* Radii & Subtle Enterprise Shadows */
    --vk-radius-sm: 0.375rem;
    --vk-radius-md: 0.625rem;
    --vk-radius-lg: 0.75rem;
    --vk-shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.035);
    --vk-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
    --vk-shadow-md: 0 6px 18px -4px rgba(15, 23, 42, 0.08), 0 2px 6px -2px rgba(15, 23, 42, 0.04);
    --vk-shadow-lg: 0 18px 36px -10px rgba(15, 23, 42, 0.16);

    /* Backward compatibility aliases */
    --color-bg-main: var(--vk-bg-canvas);
    --color-bg-sidebar: var(--vk-sidebar-bg);
    --color-fg-sidebar: #ffffff;
    --color-hover-sidebar: var(--vk-sidebar-hover);
    --color-topbar: #ffffff;
    --color-accent: var(--vk-primary);
}

/* ==========================================================================
   1. PRECISION ERP TYPOGRAPHY (GOOGLE ROBOTO + TABULAR METRICS)
   ========================================================================== */
html {
    font-size: 16px; /* Integer base: 0.875rem = 14px, 0.8125rem = 13px, 0.75rem = 12px */
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-rendering: optimizeLegibility;
    max-width: 100%;
    overflow-x: hidden;
}

body {
    font-family: var(--vk-font-sans) !important;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: 0.004em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--vk-bg-canvas) !important;
    color: var(--vk-text-body);
    max-width: 100%;
    overflow-x: hidden;
}

/* Display & Section Headings: Crisp Medium/Bold Roboto */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--vk-font-display);
    color: var(--vk-text-main);
    font-weight: 600;
    letter-spacing: -0.015em;
    line-height: 1.28;
}

h1, .h1 { font-size: 1.5rem; }      /* 24px */
h2, .h2 { font-size: 1.3125rem; }   /* 21px */
h3, .h3 { font-size: 1.1875rem; }   /* 19px */
h4, .h4 { font-size: 1.0625rem; }   /* 17px */
h5, .h5 { font-size: 0.96875rem; }  /* 15.5px */
h6, .h6 { font-size: 0.875rem; }    /* 14px */

/* Tame excessive legacy .fw-bold on headings so they stay executive 600/700 instead of 800 */
h1.fw-bold, h2.fw-bold, h3.fw-bold, h4.fw-bold, h5.fw-bold, h6.fw-bold {
    font-weight: 600 !important;
}

/* Monospace & Tabular Numeric Discipline (IDs, Protocols, CPF/CNPJ, Tokens, Values) */
code, kbd, pre, samp, .font-monospace {
    font-family: var(--vk-font-mono) !important;
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

code {
    color: #0f172a;
    background-color: #f1f5f9;
    padding: 0.12rem 0.38rem;
    border-radius: 0.3rem;
    border: 1px solid #e2e8f0;
}

.kpi-value,
.stat-value,
.table td,
.badge {
    font-variant-numeric: tabular-nums;
}

a {
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

/* Clean browser autofill on light forms */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
    -webkit-text-fill-color: var(--vk-text-main) !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* ==========================================================================
   2. APP SHELL: ENTERPRISE SLATE SIDEBAR & CANVAS
   ========================================================================== */
#wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    overflow-x: clip;
}

#sidebar-wrapper {
    width: var(--vk-sidebar-width);
    min-width: var(--vk-sidebar-width);
    max-width: var(--vk-sidebar-width);
    background: linear-gradient(180deg, var(--vk-sidebar-bg) 0%, var(--vk-sidebar-bg-end) 100%);
    border-right: 1px solid var(--vk-sidebar-border) !important;
    display: flex;
    flex-direction: column;
    z-index: 1045;
    transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1), margin-left 0.24s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.sidebar-brand-box {
    min-height: 58px;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--vk-sidebar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
}

.sidebar-brand-link {
    display: flex;
    align-items: center;
    gap: 0.68rem;
    text-decoration: none;
    color: #ffffff;
}

.sidebar-brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-brand-title {
    font-family: var(--vk-font-display);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
    color: #f8fafc;
    line-height: 1.15;
}

.sidebar-brand-subtitle {
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    display: block;
    margin-top: 1px;
}

.sidebar-nav-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.65rem 0.65rem 1.25rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.22) transparent;
}

.sidebar-nav-scroll::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav-scroll::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.22);
    border-radius: 999px;
}

.sidebar-section-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b !important;
    padding: 0.85rem 0.65rem 0.35rem;
    margin: 0;
}

/* Primary Sidebar Items */
.list-group-item.sidebar-item {
    background-color: transparent;
    color: #cbd5e1;
    border: none;
    border-radius: 0.45rem !important;
    padding: 0.5rem 0.7rem;
    margin-bottom: 0.1rem;
    font-size: 0.8125rem; /* 13px crisp */
    font-weight: 500;
    letter-spacing: -0.005em;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: background-color 0.14s ease, color 0.14s ease;
    line-height: 1.35;
}

.list-group-item.sidebar-item i.nav-icon {
    font-size: 0.98rem;
    width: 1.15rem;
    text-align: center;
    color: #94a3b8;
    transition: color 0.14s ease;
    flex-shrink: 0;
}

.list-group-item.sidebar-item:hover {
    background-color: var(--vk-sidebar-hover);
    color: #f8fafc;
}

.list-group-item.sidebar-item:hover i.nav-icon {
    color: #e2e8f0;
}

/* Top-level Active Item: Refined SAP/Linear Pill + Left Accent Bar */
.list-group-item.sidebar-item.active {
    background: rgba(37, 99, 235, 0.18) !important;
    color: #ffffff !important;
    font-weight: 600;
    box-shadow: inset 3px 0 0 #3b82f6;
}

.list-group-item.sidebar-item.active i.nav-icon {
    color: #60a5fa !important;
}

/* Expanded Module Header */
.list-group-item.sidebar-item.group-active {
    background-color: rgba(255, 255, 255, 0.045);
    color: #f8fafc !important;
    font-weight: 600;
}

.list-group-item.sidebar-item.group-active i.nav-icon {
    color: #60a5fa !important;
}

.sidebar-chevron {
    font-size: 0.68rem;
    color: #64748b;
    transition: transform 0.2s ease;
    margin-left: auto;
}

.sidebar-item[aria-expanded="true"] .sidebar-chevron {
    transform: rotate(180deg);
    color: #94a3b8;
}

/* Submenu Items */
.sidebar-submenu {
    position: relative;
    margin-left: 1.05rem;
    padding-left: 0.55rem;
    border-left: 1px solid rgba(148, 163, 184, 0.15);
    margin-top: 0.12rem;
    margin-bottom: 0.3rem;
}

.sidebar-submenu .list-group-item.sidebar-subitem {
    background: transparent !important;
    color: #94a3b8;
    border: none;
    border-radius: 0.4rem !important;
    padding: 0.42rem 0.65rem !important;
    font-size: 0.795rem; /* ~12.7px */
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.08rem;
    transition: all 0.14s ease;
}

.sidebar-submenu .list-group-item.sidebar-subitem i {
    font-size: 0.85rem;
    opacity: 0.85;
}

.sidebar-submenu .list-group-item.sidebar-subitem:hover {
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.045) !important;
}

.sidebar-submenu .list-group-item.sidebar-subitem.active {
    color: #ffffff !important;
    background: rgba(59, 130, 246, 0.16) !important;
    font-weight: 500;
    box-shadow: none;
}

.sidebar-submenu .list-group-item.sidebar-subitem.active i {
    color: #60a5fa !important;
    opacity: 1;
}

.sidebar-footer {
    padding: 0.65rem 0.95rem;
    border-top: 1px solid var(--vk-sidebar-border);
    background: rgba(2, 6, 23, 0.3);
    font-size: 0.72rem;
    color: #64748b;
}

/* Mobile Drawer Backdrop */
#sidebarBackdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

/* Main Content Wrapper */
#page-content-wrapper {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    background-color: var(--vk-bg-canvas) !important;
}

.content-area {
    flex: 1 1 auto;
    width: 100%;
    max-width: 100%;
    padding: 1.25rem 1.5rem 2.25rem;
}

/* ==========================================================================
   3. TOPBAR NAVIGATION (CLEAN 56px HEADER)
   ========================================================================== */
.topbar-bg {
    background-color: rgba(255, 255, 255, 0.96) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--vk-border) !important;
    min-height: 56px;
    position: sticky;
    top: 0;
    z-index: 1025;
}

.topbar-btn-icon {
    width: 34px;
    height: 34px;
    border-radius: 0.45rem;
    border: 1px solid var(--vk-border);
    background: #ffffff;
    color: var(--vk-text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.topbar-btn-icon:hover {
    background: var(--vk-bg-subtle);
    color: var(--vk-text-main);
    border-color: var(--vk-border-strong);
}

.topbar-btn-icon.active-mode {
    background: var(--vk-primary-soft);
    color: var(--vk-primary);
    border-color: rgba(37, 99, 235, 0.35);
}

.user-avatar-pill {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    color: #ffffff;
    font-family: var(--vk-font-display);
    font-weight: 600;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.02em;
}

/* ==========================================================================
   4. CARDS, TABS, TABLES, FORMS, SELECT2 & BADGES (ALL ERP MODULES)
   ========================================================================== */
.card {
    background-color: var(--vk-bg-surface);
    border: 1px solid var(--vk-border) !important;
    border-radius: var(--vk-radius-lg);
    box-shadow: var(--vk-shadow-xs);
}

.card.rounded-4 {
    border-radius: var(--vk-radius-lg) !important;
}

.card-header {
    background-color: #ffffff;
    border-bottom: 1px solid var(--vk-border);
    padding: 0.875rem 1.25rem;
}

.hover-card {
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.hover-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--vk-shadow-md) !important;
    border-color: var(--vk-border-strong) !important;
}

.icon-circle {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.uppercase-text {
    text-transform: uppercase;
    letter-spacing: 0.055em;
    font-size: 0.6875rem; /* 11px */
    font-weight: 600;
    color: var(--vk-text-muted);
}

.text-accent {
    color: var(--vk-primary) !important;
}

/* Enterprise Navigation Tabs (SAP / Omie / Linear clean underline) */
.nav-tabs {
    border-bottom: 1px solid var(--vk-border);
    gap: 0.15rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0;
}

.nav-tabs::-webkit-scrollbar {
    display: none;
}

.nav-tabs .nav-item {
    flex-shrink: 0;
}

.nav-tabs .nav-link,
.nav-tabs .nav-link.fw-bold {
    border: none !important;
    border-bottom: 2px solid transparent !important;
    border-radius: 0.4rem 0.4rem 0 0;
    color: var(--vk-text-secondary);
    font-weight: 500 !important;
    font-size: 0.84375rem; /* 13.5px */
    padding: 0.65rem 0.95rem !important;
    background: transparent;
    transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.nav-tabs .nav-link i.fs-5 {
    font-size: 0.95rem !important;
}

.nav-tabs .nav-link:hover {
    color: var(--vk-text-main);
    background-color: rgba(15, 23, 42, 0.025);
}

.nav-tabs .nav-link.active,
.nav-tabs .nav-link.active.fw-bold {
    color: var(--vk-primary) !important;
    background-color: transparent !important;
    border-bottom: 2px solid var(--vk-primary) !important;
    font-weight: 600 !important;
}

/* High-Density Crisp ERP Tables & DataTables */
.table {
    --bs-table-color: var(--vk-text-body);
    --bs-table-border-color: #eef2f6;
    margin-bottom: 0;
    vertical-align: middle;
}

.table > thead > tr > th {
    background-color: #f8fafc;
    color: #475569;
    font-size: 0.6875rem; /* 11px uppercase label */
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.68rem 0.875rem;
    border-bottom: 1px solid var(--vk-border);
    white-space: nowrap;
}

.table > tbody > tr > td {
    padding: 0.68rem 0.875rem;
    font-size: 0.84375rem; /* 13.5px */
    color: #1e293b;
    border-bottom-color: #f1f5f9;
}

.table-hover > tbody > tr:hover > * {
    background-color: #f8fafc;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    border: 1px solid var(--vk-border-strong);
    border-radius: 0.45rem;
    padding: 0.32rem 0.6rem;
    font-size: 0.8125rem;
    background-color: #ffffff;
    color: var(--vk-text-main);
}

.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    font-size: 0.8125rem;
    color: var(--vk-text-muted);
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    padding-top: 0.75rem !important;
}

/* Forms, Labels & Select2 Unified Styling */
.form-label,
.form-label.fw-bold {
    font-size: 0.8125rem; /* 13px */
    font-weight: 500 !important;
    color: #334155;
    margin-bottom: 0.32rem;
    letter-spacing: -0.005em;
}

.form-control,
.form-select {
    border: 1px solid var(--vk-border-strong);
    border-radius: 0.45rem;
    font-size: 0.875rem; /* 14px */
    line-height: 1.45;
    padding: 0.46rem 0.75rem;
    color: var(--vk-text-main);
    background-color: #ffffff;
    box-shadow: 0 1px 1px rgba(15, 23, 42, 0.02);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--vk-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.input-group-text {
    font-size: 0.8125rem;
    background-color: #f8fafc;
    border-color: var(--vk-border-strong);
    color: #475569;
}

/* Select2 Bootstrap 5 Alignment */
.select2-container--bootstrap-5 .select2-selection {
    min-height: 37px !important;
    border: 1px solid var(--vk-border-strong) !important;
    border-radius: 0.45rem !important;
    font-size: 0.875rem !important;
    font-family: var(--vk-font-sans) !important;
    box-shadow: 0 1px 1px rgba(15, 23, 42, 0.02);
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: var(--vk-primary) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12) !important;
}

.select2-container--bootstrap-5 .select2-dropdown {
    border-color: var(--vk-border-strong) !important;
    border-radius: 0.5rem !important;
    box-shadow: var(--vk-shadow-md) !important;
    font-size: 0.84375rem !important;
}

/* Buttons */
.btn {
    border-radius: 0.45rem;
    font-size: 0.84375rem; /* 13.5px */
    font-weight: 500;
    padding: 0.45rem 0.9rem;
    letter-spacing: -0.005em;
    transition: all 0.15s ease;
}

.btn.fw-bold {
    font-weight: 600 !important;
}

.btn-sm {
    font-size: 0.78125rem; /* 12.5px */
    padding: 0.3rem 0.68rem;
    border-radius: 0.375rem;
}

.btn-primary {
    background-color: var(--vk-primary) !important;
    border-color: var(--vk-primary) !important;
    color: #ffffff !important;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background-color: var(--vk-primary-hover) !important;
    border-color: var(--vk-primary-hover) !important;
}

.btn-outline-secondary {
    border-color: var(--vk-border-strong);
    color: #475569;
    background-color: #ffffff;
}

.btn-outline-secondary:hover {
    background-color: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
}

/* Badges */
.badge {
    font-weight: 500;
    font-size: 0.72rem;
    letter-spacing: 0.01em;
    border-radius: 0.35rem;
}

/* Modals */
.modal-content {
    border: 1px solid var(--vk-border);
    border-radius: 0.75rem;
    box-shadow: var(--vk-shadow-lg);
}

.modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--vk-border);
}

.modal-header.bg-dark {
    background-color: #0f172a !important;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   5. TELECOM MODULE & DIAGNOSTICS COMPONENTS
   ========================================================================== */
.pulse-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
    position: relative;
}

.pulse-dot.online {
    background-color: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.65);
    animation: vkPulseGreen 2.2s infinite;
}

.pulse-dot.offline {
    background-color: #ef4444;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6);
    animation: vkPulseRed 2.2s infinite;
}

@keyframes vkPulseGreen {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
    70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes vkPulseRed {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
    70% { box-shadow: 0 0 0 7px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.telemetry-tile {
    background: #f8fafc;
    border: 1px solid var(--vk-border);
    border-radius: 0.625rem;
    padding: 0.75rem 0.95rem;
    height: 100%;
}

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

.telemetry-tile .tile-value {
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--vk-text-main);
    margin-top: 0.18rem;
    word-break: break-word;
}

.telecom-import-bar {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #cbd5e1;
    border-left: 3px solid var(--vk-primary);
    border-radius: 0.625rem;
    padding: 0.9rem 1rem;
}

/* ==========================================================================
   6. MULTI-RESPONSIVE CONTINUUM: 5" (320px) -> 1024x720 -> 75" 4K (3840x2160)
   ========================================================================== */

/* Global Anti-Overflow & Touch Tab Scroll Guards */
code {
    word-break: break-word;
}

.nav-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.nav-tabs .nav-link {
    white-space: nowrap;
}

/* --- A. Mobile & Tablet Off-Canvas Drawer (< 992px) --- */
@media (max-width: 991.98px) {
    #sidebar-wrapper {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: min(84vw, 16.5rem);
        min-width: min(84vw, 16.5rem);
        max-width: min(84vw, 16.5rem);
        height: 100vh;
        height: 100dvh;
        transform: translateX(-105%);
        box-shadow: var(--vk-shadow-lg);
    }

    #wrapper.toggled #sidebar-wrapper {
        transform: translateX(0);
    }

    #wrapper.toggled #sidebarBackdrop {
        opacity: 1;
        visibility: visible;
    }

    .content-area {
        padding: 1rem 0.9rem 2rem !important;
    }

    .content-area > .d-flex.justify-content-between,
    .card-header.d-flex.justify-content-between {
        flex-wrap: wrap;
        gap: 0.65rem;
    }

    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        text-align: left !important;
        margin-bottom: 0.6rem;
    }

    .dataTables_wrapper .dataTables_filter input {
        width: 100% !important;
        margin-left: 0 !important;
        margin-top: 0.25rem;
    }

    .modal-dialog {
        margin: 0.65rem;
    }
}

/* --- B. 5-Inch Smartphones & Compact Handsets (320px - 575.98px) --- */
@media (max-width: 575.98px) {
    html {
        font-size: 16px; /* Integer 16px prevents iOS/Android input zoom */
    }

    .topbar-bg {
        min-height: 50px;
        padding-left: 0.65rem !important;
        padding-right: 0.65rem !important;
    }

    .content-area {
        padding: 0.75rem 0.6rem 1.65rem !important;
    }

    /* Prevent iOS Safari & Chrome Mobile focus zoom on touch inputs */
    .form-control,
    .form-select,
    textarea.form-control,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    input[type="tel"] {
        font-size: 16px !important;
    }

    .card-header {
        padding: 0.7rem 0.85rem !important;
    }

    .card-body {
        padding: 0.85rem !important;
    }

    h1, .h1 { font-size: 1.25rem; }
    h2, .h2 { font-size: 1.15rem; }
    h3, .h3 { font-size: 1.0625rem; }
    h4, .h4 { font-size: 0.98rem; }

    /* KPI values inside 2-column (.col-6) grids never clip R$ figures on 320px */
    .kpi-value,
    .pms-kpi-value,
    .col-6 .fs-3,
    .col-6 .h3 {
        font-size: clamp(1.05rem, 4.3vw, 1.35rem) !important;
        line-height: 1.18 !important;
        word-break: break-word;
    }

    .col-6 .icon-circle {
        width: 2rem;
        height: 2rem;
        font-size: 0.9rem;
        flex-shrink: 0;
    }

    .dropdown-menu {
        max-width: calc(100vw - 1rem);
    }

    /* Screen-Pop PBX Toast fits 320px 5" screens cleanly */
    .toast-container {
        left: 0.5rem !important;
        right: 0.5rem !important;
        padding: 0.5rem !important;
    }

    .toast-container .toast {
        width: 100% !important;
        max-width: 100% !important;
    }

    .global-search-pill {
        border-radius: 0.65rem !important;
        flex-wrap: wrap;
    }

    .global-search-pill .btn-search-submit {
        width: 100%;
        border-radius: 0 0 0.6rem 0.6rem !important;
        padding-top: 0.55rem;
        padding-bottom: 0.55rem;
    }

    .table > :not(caption) > * > * {
        padding: 0.5rem 0.55rem;
        font-size: 0.79rem;
    }
}

/* Extra-narrow 5" legacy viewport guard (320px - 374px) */
@media (max-width: 374.98px) {
    .content-area {
        padding: 0.6rem 0.45rem 1.4rem !important;
    }

    .card-body,
    .pms-kpi-card {
        padding: 0.7rem 0.72rem !important;
    }

    .topbar-bg .badge {
        font-size: 0.62rem;
        padding: 0.22em 0.45em;
    }
}

/* --- C. Desktop Sticky Shell (>= 992px) --- */
@media (min-width: 992px) {
    #sidebar-wrapper {
        position: sticky;
        top: 0;
        height: 100vh;
        height: 100dvh;
        margin-left: 0;
        transform: none;
    }

    #wrapper.toggled #sidebar-wrapper {
        margin-left: calc(var(--vk-sidebar-width) * -1);
    }
}

/* --- D. Compact Landscape Monitors & Terminals: 1024x720 / 1024x768 / 1280x720 --- */
@media (min-width: 992px) and (max-width: 1279.98px) {
    :root {
        --vk-sidebar-width: 13.5rem; /* 216px -> unlocks +40px horizontal canvas at 1024px */
    }

    .sidebar-brand-box {
        padding: 0.65rem 0.75rem;
        min-height: 50px;
    }

    .sidebar-brand-title {
        font-size: 0.82rem;
    }

    .list-group-item.sidebar-item {
        padding: 0.44rem 0.65rem !important;
        font-size: 0.8125rem;
    }

    .sidebar-submenu {
        margin-left: 0.75rem;
        padding-left: 0.45rem;
    }

    .sidebar-submenu .list-group-item.sidebar-subitem {
        padding: 0.36rem 0.55rem !important;
        font-size: 0.765rem;
    }

    .content-area {
        padding: 0.9rem 1rem 1.5rem;
    }

    .table > :not(caption) > * > * {
        padding: 0.52rem 0.62rem;
        font-size: 0.8rem;
    }

    .kpi-value,
    .pms-kpi-value {
        font-size: clamp(1.15rem, 1.55vw, 1.45rem);
    }
}

/* Short-Height Landscape Optimization (1024x720, 1280x720, 1366x768 Notebooks/POS) */
@media (min-width: 768px) and (max-height: 780px) {
    .topbar-bg {
        min-height: 46px;
        padding-top: 0.2rem !important;
        padding-bottom: 0.2rem !important;
    }

    .sidebar-brand-box {
        min-height: 46px;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .sidebar-section-label {
        padding-top: 0.6rem;
        padding-bottom: 0.2rem;
    }

    .content-area {
        padding-top: 0.75rem !important;
        padding-bottom: 1.15rem !important;
    }

    .content-area > .mb-4 {
        margin-bottom: 0.85rem !important;
    }

    .card-header {
        padding-top: 0.6rem;
        padding-bottom: 0.6rem;
    }

    .pms-kpi-card {
        padding: 0.78rem 0.95rem;
    }

    .table > :not(caption) > * > * {
        padding-top: 0.44rem;
        padding-bottom: 0.44rem;
    }

    /* Prevent tall modals or sticky summary cards from clipping below 720px height */
    .modal-body {
        max-height: calc(100dvh - 8.5rem);
        overflow-y: auto;
    }

    .sticky-top {
        max-height: calc(100dvh - 4rem);
        overflow-y: auto;
    }
}

/* --- E. Fluid Scaling for Full HD+, QHD (2560px) & 75" 4K UHD (3840x2160) --- */
@media (min-width: 1920px) {
    html {
        /* Continuous rem scaling: 1920px=16px | 2560px=18px | 3200px=20px | 3840px(4K)=22px */
        font-size: clamp(16px, calc(10px + 0.3125vw), 22px);
    }
}

@media (min-width: 2200px) {
    :root {
        --vk-sidebar-width: 16.75rem;
    }

    .content-area {
        padding: 1.5rem 2.25rem 2.5rem;
    }

    .modal-lg {
        --bs-modal-width: 56rem;
    }

    .modal-xl {
        --bs-modal-width: 76rem;
    }
}

@media (min-width: 3200px) {
    :root {
        --vk-sidebar-width: 17.75rem;
    }

    .content-area {
        padding: 1.85rem 2.85rem 3rem;
    }

    .icon-circle {
        width: 3.1rem;
        height: 3.1rem;
    }
}

/* --- F. Explicit 75" Smart TV / NOC Wallboard Mode Toggle --- */
body.tv-wallboard-mode {
    background-color: #070d19 !important;
    color: #f1f5f9 !important;
    -webkit-font-smoothing: antialiased;
}

html:has(body.tv-wallboard-mode) {
    font-size: clamp(16px, calc(11px + 0.32vw), 23px);
}

body.tv-wallboard-mode #page-content-wrapper {
    background-color: #070d19 !important;
}

body.tv-wallboard-mode .topbar-bg {
    background-color: rgba(15, 23, 42, 0.96) !important;
    border-bottom-color: rgba(148, 163, 184, 0.16) !important;
    color: #f8fafc !important;
}

body.tv-wallboard-mode .topbar-bg .text-dark,
body.tv-wallboard-mode .topbar-btn-icon {
    color: #f8fafc !important;
}

body.tv-wallboard-mode .topbar-btn-icon {
    background-color: #1e293b !important;
    border-color: rgba(148, 163, 184, 0.25) !important;
}

body.tv-wallboard-mode .card,
body.tv-wallboard-mode .pms-kpi-card,
body.tv-wallboard-mode .pms-subnav,
body.tv-wallboard-mode .modal-content,
body.tv-wallboard-mode .bg-white {
    background-color: #0f172a !important;
    border-color: rgba(148, 163, 184, 0.18) !important;
    color: #f1f5f9 !important;
}

body.tv-wallboard-mode .bg-light,
body.tv-wallboard-mode .table-light {
    background-color: #1e293b !important;
    border-color: rgba(148, 163, 184, 0.2) !important;
    color: #e2e8f0 !important;
}

body.tv-wallboard-mode .card-header {
    background-color: rgba(15, 23, 42, 0.95) !important;
    border-bottom-color: rgba(148, 163, 184, 0.16) !important;
}

body.tv-wallboard-mode h1,
body.tv-wallboard-mode h2,
body.tv-wallboard-mode h3,
body.tv-wallboard-mode h4,
body.tv-wallboard-mode h5,
body.tv-wallboard-mode h6,
body.tv-wallboard-mode .text-dark,
body.tv-wallboard-mode .pms-kpi-value,
body.tv-wallboard-mode .kpi-value {
    color: #f8fafc !important;
}

body.tv-wallboard-mode .text-muted,
body.tv-wallboard-mode .pms-kpi-label,
body.tv-wallboard-mode .pms-subnav-link {
    color: #94a3b8 !important;
}

body.tv-wallboard-mode .pms-subnav-link.active {
    background-color: #2563eb !important;
    color: #ffffff !important;
}

body.tv-wallboard-mode .form-control,
body.tv-wallboard-mode .form-select,
body.tv-wallboard-mode .input-group-text {
    background-color: #1e293b !important;
    border-color: rgba(148, 163, 184, 0.24) !important;
    color: #f8fafc !important;
}

body.tv-wallboard-mode .table {
    --bs-table-color: #e2e8f0;
    --bs-table-bg: transparent;
    --bs-table-border-color: rgba(148, 163, 184, 0.16);
}

body.tv-wallboard-mode .table > thead > tr > th {
    background-color: #1e293b !important;
    color: #cbd5e1 !important;
}

body.tv-wallboard-mode .table > tbody > tr > td {
    color: #e2e8f0 !important;
}

body.tv-wallboard-mode .gantt-uh-col {
    background-color: #0f172a !important;
    border-right-color: rgba(148, 163, 184, 0.28) !important;
}

body.tv-wallboard-mode .gantt-cell-free {
    background-color: rgba(30, 41, 59, 0.65) !important;
    color: #94a3b8 !important;
}

body.tv-wallboard-mode .telemetry-tile {
    background-color: #1e293b !important;
    border-color: rgba(148, 163, 184, 0.2) !important;
}

body.tv-wallboard-mode .telemetry-tile .tile-value {
    color: #ffffff !important;
}
