:root {
    color-scheme: dark;
    /* Industrial Premium Palette */
    --primary-orange: #FF6B00;
    --primary-glow: rgba(255, 107, 0, 0.3);
    --bg-deep: #050608;
    --bg-surface: #0A0C12;
    --bg-card: rgba(16, 20, 26, 0.4);
    --border-glow: rgba(255, 107, 0, 0.15);
    --border-soft: rgba(255, 255, 255, 0.05);
    
    --text-main: #FFFFFF;
    --text-muted: #8A8F98;
    --text-dim: #5C626D;
    
    --sidebar-width: 260px;
    --topbar-height: 72px;
    --radius-lg: 12px;
    --radius-md: 8px;
    
    --glass-blur: blur(20px);
    
    --font-main: 'Outfit', sans-serif;
    --font-mono: 'Roboto Mono', monospace;
}

/* Custom Global Dark Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #050608;
}
::-webkit-scrollbar-thumb {
    background: #1c2742;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
::-webkit-scrollbar-thumb:hover {
    background: #FF6B00;
}

/* ANTI-FOUC (Evita piscar tela de login ao dar F5) */
html.is-logged-in #adminLoginSection { display: none !important; opacity: 0 !important; pointer-events: none !important; }
html.is-logged-in #adminLayout { display: flex !important; opacity: 1 !important; }

/* Estilização Global de Select e Option (Tema Dark) */
select {
    background-color: #0A0C12 !important;
    color: #FFFFFF !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 8px !important;
    font-family: 'Outfit', sans-serif !important;
    outline: none !important;
    cursor: pointer !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23FF6B00' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 16px center !important;
    background-size: 12px !important;
    padding-right: 40px !important;
}
select option {
    background-color: #0A0C12 !important;
    color: #FFFFFF !important;
    font-family: 'Outfit', sans-serif !important;
}
select:focus {
    border-color: #FF6B00 !important;
    box-shadow: 0 0 8px rgba(255, 107, 0, 0.3) !important;
}

html.not-logged-in #adminLayout { display: none !important; }
html.not-logged-in #adminLoginSection { display: flex !important; }

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

body {
    background: var(--bg-deep);
    color: var(--text-main);
    font-family: var(--font-main);
    min-height: 100vh;
    overflow-x: hidden;
    letter-spacing: -0.01em;
}

.hidden { display: none !important; }

/* Login Section Overhaul */
#adminLoginSection {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: var(--bg-deep) url('../assets/login-bg.jpg') center center/cover no-repeat;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    padding: 40px 24px;
}

#adminLoginSection::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(5, 6, 8, 0.25);
    backdrop-filter: blur(2px);
    z-index: 1;
}

.login-card-wrapper {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 520px;
    margin: auto;
}

/* O Brilho Laranja Emissivo atrás do Card */
.login-card-wrapper::after {
    content: "";
    position: absolute;
    top: -20px; left: -20px; right: -20px; bottom: -20px;
    background: radial-gradient(circle, rgba(255, 107, 0, 0.15) 0%, transparent 60%);
    z-index: -1;
    border-radius: 40px;
    pointer-events: none;
}

.login-card {
    background: rgba(10, 14, 20, 0.6);
    backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top: 1px solid rgba(255, 107, 0, 0.3);
    border-radius: 20px;
    padding: 50px 40px 40px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
}

.login-card .logo-box { margin-bottom: 25px; }
.login-card h2 { font-size: 2rem; font-weight: 800; letter-spacing: 0px; margin-bottom: 6px; color: #fff; }
.login-card p { color: var(--text-muted); font-size: 0.85rem; letter-spacing: 3px; font-weight: 500; text-transform: uppercase; margin-bottom: 25px; }

.login-badge-top {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    font-weight: 500;
}

.form-group { position: relative; margin-bottom: 20px; text-align: left; }
.form-group input { 
    width: 100%; height: 56px; 
    border-radius: 12px; 
    border: 1px solid rgba(255, 255, 255, 0.1); 
    background: rgba(0,0,0,0.4); 
    padding: 0 54px; 
    color: white; 
    font-size: 1rem; 
    transition: all 0.3s;
}
.form-group input::placeholder { color: var(--text-dim); }
.form-group input:focus { border-color: rgba(255, 107, 0, 0.5); outline: none; background: rgba(255, 107, 0, 0.05); }
.form-group .icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--primary-orange); }

.form-group .eye-icon {
    position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
    cursor: pointer;
    transition: 0.2s;
}
.form-group .eye-icon:hover svg { stroke: var(--primary-orange); }

.login-helpers {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    font-size: 0.8rem;
}

.remember-me {
    display: flex; align-items: center; gap: 8px; color: var(--text-main); cursor: pointer; user-select: none;
}
.remember-me input { display: none; }
.remember-me .checkmark {
    width: 18px; height: 18px; border: 1px solid rgba(255,255,255,0.3); border-radius: 4px;
    display: flex; align-items: center; justify-content: center; transition: 0.2s;
}
.remember-me input:checked ~ .checkmark { background: var(--primary-orange); border-color: var(--primary-orange); }
.remember-me input:checked ~ .checkmark::after { content: "✓"; color: #fff; font-size: 12px; font-weight: bold; }

.forgot-pass { color: var(--primary-orange); text-decoration: none; transition: 0.2s; border-bottom: 1px solid transparent; }
.forgot-pass:hover { border-color: var(--primary-orange); }

.login-btn { 
    width: 100%; height: 56px; 
    border: none; border-radius: 12px; 
    background: linear-gradient(135deg, #FF7B00 0%, #E65C00 100%); 
    color: white; font-size: 1rem; font-weight: 700; letter-spacing: 1px;
    cursor: pointer; transition: 0.3s; 
    box-shadow: 0 8px 25px rgba(255, 107, 0, 0.4);
    display: flex; justify-content: center; align-items: center; gap: 10px;
}
.login-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 35px rgba(255, 107, 0, 0.6); }

.login-footer-separator {
    margin: 30px auto;
    text-align: center;
    position: relative;
}
.login-footer-separator::before, .login-footer-separator::after {
    content: ""; position: absolute; top: 50%; width: 40%; height: 1px; background: rgba(255,255,255,0.1);
}
.login-footer-separator::before { left: 0; }
.login-footer-separator::after { right: 0; }

.login-footer-text {
    color: var(--text-muted); font-size: 0.8rem; line-height: 1.5; margin-bottom: 30px; text-align: center;
}

.login-badges-bottom {
    display: flex; justify-content: space-between; gap: 10px;
    background: rgba(0,0,0,0.3); padding: 15px; border-radius: 12px;
}
.badge-item { display: flex; align-items: center; gap: 10px; text-align: left; }
.badge-item strong { display: block; color: var(--text-main); font-size: 0.65rem; font-weight: 700; letter-spacing: 0.5px; }
.badge-item span { display: block; color: var(--text-dim); font-size: 0.6rem; }

.login-copyright {
    margin-top: 20px;
    color: var(--text-dim);
    font-size: 0.75rem;
    z-index: 2;
}
.login-copyright span { color: var(--primary-orange); }

/* Dashboard Layout */
.admin-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 280px;
    flex-shrink: 0;
    background: rgba(5, 6, 8, 0.6);
    backdrop-filter: blur(15px);
    border-right: 1px solid rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    overflow-y: auto;
    height: 100vh;
    position: sticky;
    top: 0;
}

.logo-area {
    padding: 30px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    position: sticky;
    top: 0;
    background: rgba(5, 6, 8, 0.85);
    backdrop-filter: blur(20px);
    z-index: 10;
}
.logo-area h1 { font-size: 1.4rem; font-weight: 900; letter-spacing: -1px; }
.logo-area h1 span { color: var(--primary-orange); }
.logo-area p { font-size: 0.6rem; letter-spacing: 4px; color: var(--text-dim); margin-top: -5px; font-weight: 700; }

.nav-section { padding: 25px 20px 10px 25px; }
.nav-section-title {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--primary-orange);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 15px;
    opacity: 0.9;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 8px;
    transition: 0.2s;
    position: relative;
    margin-bottom: 2px;
}

.nav-link svg { width: 18px; height: 18px; opacity: 0.6; transition: 0.2s; }

.nav-link:hover {
    background: rgba(255,255,255,0.03);
    color: #fff;
}
.nav-link:hover svg { opacity: 1; color: var(--primary-orange); }

.nav-link.active {
    background: linear-gradient(90deg, rgba(255,107,0,0.1) 0%, transparent 100%);
    color: #fff;
    font-weight: 700;
}
.nav-link.active svg { opacity: 1; color: var(--primary-orange); }
.nav-link.active::after {
    content: "";
    position: absolute;
    right: 0; top: 20%; height: 60%;
    width: 3px;
    background: var(--primary-orange);
    box-shadow: 0 0 10px var(--primary-orange);
    border-radius: 3px 0 0 3px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 30px 25px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    bottom: 0;
    background: rgba(5, 6, 8, 0.95);
    backdrop-filter: blur(20px);
    z-index: 10;
    border-top: 1px solid rgba(255,255,255,0.03);
}

.btn-help {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px;
    background: rgba(255,107,0,0.05);
    border: 1px solid rgba(255,107,0,0.2);
    color: var(--primary-orange);
    border-radius: 10px;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    transition: 0.2s;
}
.btn-help:hover { background: rgba(255,107,0,0.1); box-shadow: 0 0 20px rgba(255,107,0,0.1); }

.version-info {
    text-align: center;
    font-size: 0.55rem;
    color: var(--text-dim);
    opacity: 0.5;
}

.main-content {
    margin-left: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: transparent;
    min-width: 0; /* Previne que o conteúdo expanda a flexbox pai */
    overflow-x: hidden; /* Garante que nada transborde horizontalmente */
}

.top-bar {
    height: var(--topbar-height);
    border-bottom: 1px solid var(--border-soft);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 32px;
    position: sticky; top: 0; z-index: 900;
    background: rgba(5, 6, 8, 0.6);
    backdrop-filter: blur(15px);
}

.top-bar-left { display: flex; align-items: center; gap: 24px; }
.top-bar-left h1 { font-size: 1.1rem; font-weight: 800; letter-spacing: 1px; }
.top-bar-left p { font-size: 0.7rem; color: var(--text-dim); text-transform: uppercase; font-weight: 600; }

.top-bar-center {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 2px 5px;
    backdrop-filter: blur(10px);
}

.telemetry-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 20px;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.telemetry-item:last-child {
    border-right: none;
}

.telemetry-item svg {
    opacity: 0.6;
    color: var(--primary-orange);
}

.telemetry-item .info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.telemetry-item .label {
    font-size: 0.65rem;
    color: var(--text-dim);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    line-height: 1;
    margin-bottom: 3px;
}

.telemetry-item .value {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

.status-badge { color: #00FF7F; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 4px; }
.status-dot { width: 6px; height: 6px; background: #00FF7F; border-radius: 50%; box-shadow: 0 0 10px #00FF7F; }

.top-bar-right { display: flex; align-items: center; gap: 20px; }

.v-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
}

.action-group {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    display: flex;
    align-items: center;
    padding: 2px;
}

.action-icon {
    color: var(--text-muted);
    cursor: pointer;
    transition: 0.2s;
    position: relative;
    padding: 8px 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-icon:first-child {
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.action-icon:hover { color: #fff; background: rgba(255, 255, 255, 0.03); }

.notif-badge {
    position: absolute;
    top: 4px;
    right: 8px;
    min-width: 14px;
    height: 14px;
    padding: 0 4px;
    background: var(--primary-orange);
    border-radius: 50%;
    border: 2px solid #050608;
    font-size: 0.6rem;
    color: #fff;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(255, 107, 0, 0.4);
    z-index: 10;
}

.profile-box { display: flex; align-items: center; gap: 15px; cursor: pointer; padding: 5px 10px; border-radius: 8px; transition: 0.2s; position: relative; }
.profile-box:hover { background: rgba(255, 255, 255, 0.03); }

/* Profile Dropdown Menu styling */
.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: rgba(10, 12, 18, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    min-width: 180px;
    padding: 6px 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.profile-box:hover .profile-dropdown,
.profile-box.active .profile-dropdown {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.dropdown-item svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    transition: transform 0.2s ease;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: #fff !important;
}

.dropdown-item:hover svg {
    transform: translateX(3px);
}

.dropdown-item[style*="color: #ff4444"]:hover,
.dropdown-item[style*="color: rgb(255, 68, 68)"]:hover {
    background: rgba(255, 68, 68, 0.08);
    color: #ff4444 !important;
}

.profile-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
    object-fit: cover;
}

.profile-info { text-align: left; }
.profile-info .name-row { display: flex; align-items: center; gap: 8px; }
.profile-info .name { font-size: 0.9rem; font-weight: 700; color: #fff; }
.profile-info .role { font-size: 0.7rem; color: var(--text-dim); display: block; margin-top: -2px; }
.profile-info svg { opacity: 0.5; transition: transform 0.25s ease; }

.profile-box:hover .profile-info svg,
.profile-box.active .profile-info svg {
    transform: rotate(180deg);
}

/* Dashboard Grid System */
.dashboard-container { padding: 24px 32px; width: 100%; max-width: 1800px; margin: 0 auto; }

.kpi-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-left: 3px solid var(--primary-orange);
    border-radius: 12px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 120px;
}
.kpi-card:hover { 
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 107, 0, 0.3);
    transform: translateY(-2px);
}
.kpi-card .label { 
    font-size: 0.65rem; 
    color: var(--text-dim); 
    font-weight: 800; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
}
.kpi-card .value-row { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    margin-top: 8px; 
    z-index: 2;
}
.kpi-card .value { font-size: 1.8rem; font-weight: 800; color: #fff; }
.kpi-card .trend { 
    font-size: 0.75rem; 
    font-weight: 700; 
    color: #00FF7F; 
}
.kpi-card .subtitle { 
    font-size: 0.65rem; 
    color: var(--text-dim); 
    margin-top: auto;
    opacity: 0.5;
}
.kpi-card svg.kpi-icon {
    position: absolute;
    right: 15px;
    bottom: 15px;
    width: 48px;
    height: 48px;
    opacity: 0.15;
    color: #fff;
    pointer-events: none;
}

.grid-row-2 {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.widget-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.widget-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.widget-title { font-size: 0.85rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: #fff; }

.chart-container { position: relative; flex: 1; min-height: 200px; }

/* Telemetry Legend */
.chart-legend-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.legend-item { display: flex; flex-direction: column; border-right: 1px solid rgba(255, 255, 255, 0.05); }
.legend-item:last-child { border-right: none; }
.legend-item .dot-label { display: flex; align-items: center; gap: 8px; font-size: 0.6rem; text-transform: uppercase; font-weight: 800; opacity: 0.6; }
.legend-item .val { font-size: 1.2rem; font-weight: 700; margin-top: 5px; }

/* Alerts List */
.alert-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
    transition: 0.2s;
}
.alert-item.critical { background: rgba(255, 69, 0, 0.05); border-color: rgba(255, 69, 0, 0.1); }
.alert-item svg { width: 24px; height: 24px; }
.alert-item .alert-body { flex: 1; }
.alert-item h4 { font-size: 0.75rem; font-weight: 700; color: #fff; }
.alert-item p { font-size: 0.65rem; color: var(--text-dim); margin-top: 2px; }
.alert-item .time { font-size: 0.6rem; opacity: 0.4; }

.grid-row-3 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 24px;
}

.map-container {
    position: relative;
    background: #050608 url('https://w0.peakpx.com/wallpaper/406/504/HD-wallpaper-dark-world-map-black-background-world-map-continents-black-atlas.jpg') center/cover;
    border-radius: 10px;
    height: 100%;
    min-height: 300px;
    
}

.map-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at center, transparent 0%, rgba(5,6,8,0.7) 100%);
    z-index: 1;
}

.map-pin {
    position: absolute;
    width: 10px; height: 10px;
    border-radius: 50%;
    z-index: 5;
    box-shadow: 0 0 15px currentColor;
}

.map-pin::after {
    content: "";
    position: absolute;
    top: -5px; left: -5px; right: -5px; bottom: -5px;
    border-radius: 50%;
    border: 2px solid currentColor;
    opacity: 0.5;
    animation: pinPulse 2s infinite;
}

@keyframes pinPulse {
    0% { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(2.5); opacity: 0; }
}

.map-legend {
    position: absolute;
    bottom: 24px; left: 24px;
    background: rgba(10,12,18,0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 15px 20px; border-radius: 12px;
    display: flex; flex-direction: column; gap: 12px;
    z-index: 10;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.map-controls {
    position: absolute;
    bottom: 24px; right: 24px;
    display: flex; flex-direction: column; gap: 8px;
    z-index: 10;
}

.map-ctrl-btn {
    width: 36px; height: 36px;
    background: rgba(10,12,18,0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 1.2rem;
    transition: 0.2s;
}
.map-ctrl-btn:hover { background: rgba(255,255,255,0.05); border-color: var(--primary-orange); }

.timeline-container { position: relative; padding-left: 10px; margin-top: 10px; }
.timeline-container::before {
    content: ""; position: absolute; left: 55px; top: 0; width: 1px; height: 100%;
    background: repeating-linear-gradient(to bottom, transparent, transparent 3px, rgba(255,255,255,0.1) 3px, rgba(255,255,255,0.1) 6px);
}

.activity-item { display: flex; align-items: flex-start; gap: 15px; margin-bottom: 20px; position: relative; }
.activity-time { font-size: 0.65rem; color: var(--text-dim); width: 45px; flex-shrink: 0; padding-top: 5px; font-weight: 700; }
.activity-icon {
    width: 26px; height: 26px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.1);
    display: flex; align-items: center; justify-content: center; background: #0A0C12;
    z-index: 2; flex-shrink: 0;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}
.activity-content { flex: 1; }
.activity-content h5 { font-size: 0.75rem; font-weight: 700; color: #fff; }
.activity-content p { font-size: 0.6rem; color: var(--text-dim); margin-top: 2px; }

.widget-footer-link {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin-top: auto; padding-top: 15px; border-top: 1px solid rgba(255,255,255,0.05);
    text-decoration: none; color: var(--text-dim); font-size: 0.65rem; font-weight: 700; transition: 0.2s;
}
.widget-footer-link:hover { color: var(--primary-orange); }

.grid-row-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 24px;
}

.agenda-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.agenda-item:last-child { border-bottom: none; }
.agenda-date {
    text-align: center;
    min-width: 35px;
    font-size: 0.65rem;
    color: var(--text-dim);
    font-weight: 800;
    line-height: 1.1;
}
.agenda-date b { font-size: 1.1rem; color: #fff; display: block; }

.qa-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 10px;
}
.qa-item {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: 0.2s;
}
.qa-item:hover { background: rgba(255,107,0,0.05); border-color: rgba(255,107,0,0.2); }
.qa-item svg { width: 24px; height: 24px; color: var(--primary-orange); }
.qa-item span { font-size: 0.6rem; font-weight: 700; text-align: center; color: var(--text-muted); text-transform: uppercase; }

.security-bar {
    margin: 40px 0 20px 0;
    background: rgba(10,12,18,0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.05);
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    clip-path: polygon(15px 0%, calc(100% - 15px) 0%, 100% 15px, 100% calc(100% - 15px), calc(100% - 15px) 100%, 15px 100%, 0% calc(100% - 15px), 0% 15px);
}

.security-item {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 0 20px;
    border-right: 1px solid rgba(255,255,255,0.05);
}
.security-item:last-child { border-right: none; }
.security-item svg { width: 28px; height: 28px; color: var(--primary-orange); opacity: 0.7; }
.security-info h4 { font-size: 0.7rem; font-weight: 800; color: #fff; text-transform: uppercase; letter-spacing: 0.5px; }
.security-info p { font-size: 0.6rem; color: var(--text-dim); margin-top: 2px; }

.copyright-area {
    text-align: center;
    padding: 10px 0 30px 0;
    font-size: 0.65rem;
    color: var(--text-dim);
}
.copyright-area span { color: var(--primary-orange); font-weight: 700; }

/* ==========================================
   MÓDULO DE CERTIFICADOS & TABELAS INDUSTRIAIS
   ========================================== */

/* Botão de Tabulação de Paineis (Ex: Live Telemetry) */
.btn-tab {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
    border: 1px solid transparent;
    padding: 8px 16px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.btn-tab.active {
    background: rgba(255, 107, 0, 0.15);
    color: var(--primary-orange);
    border: 1px solid rgba(255, 107, 0, 0.3);
    box-shadow: 0 0 15px rgba(255, 107, 0, 0.1);
}

/* Botão de Ação / Comando Principal */
.btn-command {
    background: linear-gradient(135deg, #FF7B00 0%, #E65C00 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 22px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(255, 107, 0, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-command:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 0, 0.5);
    filter: brightness(1.1);
    color: #fff !important;
}
.btn-command:active {
    transform: translateY(0);
}

/* Botões de Ícones em Tabelas */
.btn-icon {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}
.btn-icon svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
}
.btn-icon:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}
.btn-icon.delete {
    color: var(--text-muted);
}
.btn-icon.delete:hover {
    background: rgba(255, 68, 68, 0.08);
    border-color: rgba(255, 68, 68, 0.3);
    color: #ff4444 !important;
    box-shadow: 0 0 10px rgba(255, 68, 68, 0.1);
}

/* Grid & Tabela Industrial Responsiva */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.industrial-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    color: var(--text-main);
    font-family: var(--font-main);
}
.industrial-table th {
    background: rgba(255, 255, 255, 0.01);
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.industrial-table td {
    padding: 18px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 0.85rem;
    vertical-align: middle;
}
.industrial-table tr {
    transition: background 0.2s ease;
}
.industrial-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.015);
}
.industrial-table tbody tr:last-child td {
    border-bottom: none;
}

/* Estilização das Barras de Rolagem Customizadas (Scrollbars) */
.table-responsive::-webkit-scrollbar,
body::-webkit-scrollbar,
aside::-webkit-scrollbar,
div::-webkit-scrollbar,
select::-webkit-scrollbar,
input::-webkit-scrollbar,
textarea::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.table-responsive::-webkit-scrollbar-track,
body::-webkit-scrollbar-track,
aside::-webkit-scrollbar-track,
div::-webkit-scrollbar-track,
select::-webkit-scrollbar-track,
input::-webkit-scrollbar-track,
textarea::-webkit-scrollbar-track {
    background: rgba(5, 6, 8, 0.5);
    border-radius: 3px;
}
.table-responsive::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb,
aside::-webkit-scrollbar-thumb,
div::-webkit-scrollbar-thumb,
select::-webkit-scrollbar-thumb,
input::-webkit-scrollbar-thumb,
textarea::-webkit-scrollbar-thumb {
    background: rgba(255, 107, 0, 0.35);
    border-radius: 3px;
    transition: background 0.3s ease;
}
.table-responsive::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover,
aside::-webkit-scrollbar-thumb:hover,
div::-webkit-scrollbar-thumb:hover,
select::-webkit-scrollbar-thumb:hover,
input::-webkit-scrollbar-thumb:hover,
textarea::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 107, 0, 0.7);
    box-shadow: 0 0 10px rgba(255, 107, 0, 0.5);
}

/* ==========================================
   MODAL UNIVERSAL E SIDEBAR RESPONSIVO
   ========================================== */

/* Esconde o botão de fechar sidebar no desktop */
.sidebar-close-btn {
    display: none;
}

/* Esconde o botão hamburger no desktop */
#sidebarMobileToggle {
    display: none !important;
}

/* Estilo para o Modal Universal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(5, 6, 8, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 2000000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

#modalBody {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 10px;
}

.modal-content {
    background: rgba(10, 12, 16, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
    width: 100%;
    max-width: 900px;
    border-radius: 16px;
    padding: 35px 40px;
    transform: translateY(20px);
    transition: transform 0.3s ease, opacity 0.3s ease;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

/* Input group em Modais */
.modal-content .input-group {
    margin-bottom: 20px;
}
.modal-content .input-group label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 8px;
}
.modal-content .input-group input, 
.modal-content .input-group select, 
.modal-content .input-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s ease;
}
.modal-content .input-group input:focus, 
.modal-content .input-group select:focus, 
.modal-content .input-group textarea:focus {
    border-color: var(--primary-orange);
    background: rgba(255,107,0,0.02);
}
.modal-content .input-group select option {
    background: #0A0C12;
    color: #fff;
}

/* Layout responsivo para telas menores (mobile/tablet) */
@media (max-width: 991px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 10000;
    }
    
    .sidebar.sidebar-open {
        left: 0;
    }
    
    .sidebar-close-btn {
        display: block;
        position: absolute;
        top: 15px;
        right: 20px;
        background: transparent;
        border: none;
        color: #fff;
        font-size: 2rem;
        cursor: pointer;
        outline: none;
        transition: color 0.2s;
    }
    .sidebar-close-btn:hover {
        color: var(--primary-orange);
    }
    
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 9998;
    }
    
    .sidebar-backdrop.active {
        opacity: 1;
        pointer-events: auto;
    }
    
    #sidebarMobileToggle {
        display: block !important;
        cursor: pointer;
    }
}

/* Botão de contorno (Cancel) */
.btn-outline {
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    background: rgba(255, 255, 255, 0.02) !important;
    color: var(--text-muted) !important;
    padding: 10px 24px !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    text-transform: uppercase !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
}

/* Glass Card Standard styling */
.glass-card {
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    border-radius: 15px !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3) !important;
}


/* ==========================================================================
   POWER BLOCK: OVERRIDE RESPONSIVO GLOBAL DE GRIDS INLINE DO JAVASCRIPT
   ========================================================================== */

/* Ajustes Gerais de Containers, Modais e Topbar */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    border-radius: 8px;
}

.industrial-table {
    min-width: 800px; /* Força scroll horizontal em telas menores */
}

@media (max-width: 1200px) {
    /* Topbar Indicators Wrap */
    #topbar-kpis {
        display: none !important; /* Em telas menores, esconde os KPIs extras do topbar ou condensa */
    }
}

@media (max-width: 991px) {
    /* Força os modais a caber na tela */
    div[style*="max-width: 1000px"], 
    div[style*="max-width: 900px"], 
    div[style*="max-width: 800px"], 
    div[style*="max-width: 700px"], 
    div[style*="max-width: 600px"] {
        max-width: 95% !important;
        margin: 10px auto !important;
    }
    
    /* Quebra os grids de 4 colunas para 2 colunas */
    div[style*="grid-template-columns: repeat(4, 1fr)"],
    div[style*="grid-template-columns: repeat(3, 1fr)"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* Layouts do Header Actions */
    #headerActions {
        margin-left: auto !important;
        margin-right: 15px !important;
    }
    
    #headerActions .admin-avatar {
        display: none !important;
    }
}

@media (max-width: 768px) {
    /* Transforma todas as estruturas de grade JS inline em 1 coluna */
    div[style*="grid-template-columns: repeat(4, 1fr)"],
    div[style*="grid-template-columns: repeat(3, 1fr)"],
    div[style*="grid-template-columns: repeat(2, 1fr)"],
    div[style*="grid-template-columns: 1fr 1fr"],
    div[style*="grid-template-columns: 1fr 400px"],
    div[style*="grid-template-columns: 350px 1fr"],
    div[style*="grid-template-columns: 380px 1fr"],
    div[style*="grid-template-columns: 2fr 1fr"],
    div[style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    /* Ajustes nas grades de métricas no painel de chamados e dashboard */
    .metrics-grid, .stats-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Força Flexbox Inline do Javascript a quebrar a linha */
    div[style*="display:flex; gap:10px;"]:not(.sidebar *),
    div[style*="display:flex; align-items:center; gap:15px;"],
    div[style*="display:flex; gap:15px;"] {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    
    /* Botões 100% no mobile */
    .btn-command {
        width: 100% !important;
        margin-bottom: 5px;
        justify-content: center;
    }
    
    /* Inputs text e selects */
    .input-group input, .input-group select, .input-group textarea {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Topbar Section Titulo */
    #sectionSub {
        display: none !important;
    }
    #sectionTitle {
        font-size: 1.1rem !important;
    }
}


/* ==========================================================================
   VANILLA RESPONSIVE ARCHITECTURE (MOBILE-READY)
   ========================================================================== */

/* Classes de Layout Grid Flexíveis */
.grid-layout-sidebar {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 20px;
}

.grid-layout-cards-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.grid-layout-cards-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.grid-layout-cards-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.grid-layout-2-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.grid-layout-form {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

/* Tabela Responsiva - Permite rolagem horizontal sem quebrar layout */
.table-responsive-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}
.table-responsive-wrapper table {
    width: 100%;
    min-width: 800px; /* Força scroll em telas menores */
    border-collapse: collapse;
}

/* MEDIA QUERIES PARA RESPONSIVIDADE */

/* Desktops Médios (Até 1440px) */
@media (max-width: 1440px) {
    .kpi-row {
        grid-template-columns: repeat(3, 1fr); /* 6 colunas para 3 colunas (2 linhas) */
    }
}

/* Notebooks (Até 1200px) */
@media (max-width: 1200px) {
    .grid-row-2, .grid-row-3, .grid-row-4 {
        grid-template-columns: repeat(2, 1fr); /* Quebra as grids principais ao meio */
    }
}

/* Tablets (Até 1024px) */
@media (max-width: 1024px) {
    .grid-layout-cards-4, .grid-layout-cards-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    .kpi-row {
        grid-template-columns: repeat(2, 1fr); /* Diminui os KPIs para 2 colunas */
    }
    .grid-row-4, .grid-row-3, .grid-row-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Celulares Grandes / Tablets (Até 768px) */
@media (max-width: 768px) {

    
    .grid-layout-sidebar {
        grid-template-columns: 1fr;
    }

    .grid-layout-cards-4, 
    .grid-layout-cards-3, 
    .grid-layout-cards-2,
    .grid-layout-2-cols,
    .kpi-row,
    .grid-row-4, 
    .grid-row-3, 
    .grid-row-2 {
        grid-template-columns: 1fr;
    }

    .dashboard-container {
        padding: 15px;
    }

    .top-bar {
        padding: 0 15px;
        flex-direction: column;
        height: auto;
        padding-top: 10px;
        padding-bottom: 10px;
        gap: 10px;
    }

    .top-bar-center {
        display: none; /* Esconde a telemetria complexa no mobile */
    }
}

/* Celulares Pequenos (Até 480px) */
@media (max-width: 480px) {
    .login-card {
        padding: 30px 20px;
    }
    
    .form-group input {
        font-size: 0.9rem;
    }
}

/* Overlay Mobile Sidebar Fix */
@media (max-width: 991px) {
    #sidebarMobileToggle { display: block !important; cursor: pointer; }
    
    .sidebar {
        position: fixed;
        left: -320px;
        top: 0;
        height: 100vh !important;
        width: 280px !important;
        z-index: 100000 !important;
        transition: left 0.3s ease;
        background: rgba(5, 6, 8, 0.98) !important;
        border-right: 1px solid rgba(255, 107, 0, 0.3) !important;
        box-shadow: 10px 0 30px rgba(0,0,0,0.8);
        padding-top: 20px;
    }
    
    .sidebar.sidebar-open {
        left: 0 !important;
    }
    
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.8);
        z-index: 99999;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        backdrop-filter: blur(5px);
    }
    
    .sidebar-backdrop.active {
        opacity: 1;
        pointer-events: auto;
    }
    
    .sidebar-close-btn {
        position: absolute;
        top: 15px;
        right: 15px;
        background: rgba(255, 107, 0, 0.1);
        border: 1px solid rgba(255, 107, 0, 0.3);
        border-radius: 8px;
        color: var(--primary-orange);
        font-size: 24px;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 100001;
        transition: 0.2s;
    }
    
    .sidebar-close-btn:hover {
        background: var(--primary-orange);
        color: #fff;
    }
}

@media (min-width: 992px) {
    #sidebarMobileToggle { display: none !important; }
}

/* Chart Grids */
.grid-layout-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

@media (max-width: 1024px) {
    .grid-layout-charts {
        grid-template-columns: 1fr; /* Force 1 column on tablets and smaller */
    }
}

/* Global Input Group Styles (Fix for Security Module and others outside modals) */
.input-group {
    margin-bottom: 20px;
}
.input-group label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 8px;
    text-align: left;
}
.input-group input, 
.input-group select, 
.input-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s ease;
}
.input-group input:focus, 
.input-group select:focus, 
.input-group textarea:focus {
    border-color: var(--primary-orange);
    background: rgba(255,107,0,0.02);
}
.input-group select option {
    background: #0A0C12;
    color: #fff;
}
