@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Azure Fluent Design Palette */
  --brand: #1e8a8a;
  --brand-dark: #0c1e21;
  --bg: #FAFAFA;
  --text: #323130;
  --muted: #605E5C;
  --white: #FFFFFF;
  --card-bg: #FFFFFF;
  --danger: #D13438;
  --success: #107C10;
  --warning: #D83B01;
  --info: #1e8a8a;
  --secondary: #E1DFDD;
  --border: #EDEBE9;
  
  --sidebar-bg: #0c1e21;
  --sidebar-text: #C8C6C4;
  --sidebar-hover: #1e8a8a;
  --radius: 6px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

[data-theme="dark"] {
  --bg: #0F172A;
  --text: #F8FAFC;
  --muted: #94A3B8;
  --white: #1E293B;
  --card-bg: #1E293B;
  --secondary: #334155;
  --border: #334155;
  --sidebar-bg: #0c1e21;
  --sidebar-text: #94A3B8;
  --sidebar-hover: #18292c;
}

* { box-sizing: border-box; }
body {
  font-family: 'Segoe UI', 'Inter', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  margin: 0; padding: 0;
  color: var(--text);
  background-color: var(--bg);
  line-height: 1.5;
  font-size: 0.9rem;
}

/* =========================================================
   LOGIN & PUBLIC
   ========================================================= */
body:not(.body-admin) {
  background: linear-gradient(135deg, #f6f8fb 0%, #e5ebf4 100%);
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
}
.login-container { display: flex; justify-content: center; align-items: center; width: 100%; padding: 20px; }
.login-card {
  background: rgba(255, 255, 255, 0.95); padding: 48px 40px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.5); box-shadow: 0 10px 40px -10px rgba(0,0,0,0.1);
  backdrop-filter: blur(10px);
  text-align: center; width: 100%; max-width: 420px;
}
.login-card h2 { margin-top: 0; margin-bottom: 32px; color: var(--text); font-size: 1.6rem; font-weight: 700; }

/* =========================================================
   LAYOUT ADMIN
   ========================================================= */
.body-admin {
  background: var(--bg);
  padding-left: 260px;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 260px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex; flex-direction: column;
  z-index: 1000;
  box-shadow: 2px 0 8px rgba(0,0,0,0.05);
}
.sidebar-header {
  padding: 20px 24px;
  font-size: 1.2rem; font-weight: 600; color: #fff;
  display: flex; align-items: center; gap: 10px;
}
.sidebar-nav {
  flex: 1; overflow-y: auto; padding: 12px 0;
}
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 24px;
  color: var(--sidebar-text); text-decoration: none; font-weight: 500; font-size: 0.9rem;
  transition: all 0.2s; border-left: 3px solid transparent;
}
.sidebar-nav a:hover {
  background: var(--sidebar-hover); color: #fff;
}
.sidebar-nav a.active {
  background: #252423; color: #fff;
  border-left: 3px solid var(--brand);
}
.sidebar-nav a i { width: 20px; text-align: center; font-size: 1.1rem; }
.sidebar-footer {
  padding: 16px 24px; background: #11100F;
}
.user-info .user-name { display: block; font-weight: 600; font-size: 0.9rem; color: #fff; }
.user-info .user-role { display: block; font-size: 0.8rem; color: var(--sidebar-text); }
.submenu { display: none; background: #11100F; }
.submenu a { padding-left: 56px; font-size: 0.85rem; }

/* Main Content & Headers */
.main-content {
  display: flex; flex-direction: column; min-height: 100vh;
}
.app-header {
  position: sticky; top: 0; background: #fff;
  padding: 12px 24px; display: flex; align-items: center;
  border-bottom: 1px solid var(--border); z-index: 900;
}
.app-header h1, .app-header .header-title { margin: 0; font-size: 1.25rem; font-weight: 600; color: var(--text); }

.container {
  max-width: 1400px; margin: 0 auto; padding: 24px; width: 100%;
}

/* =========================================================
   COMPONENTS (CARDS)
   ========================================================= */
.card, .form-card, .table-wrap {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 1.6px 3.6px rgba(0,0,0,0.02), 0 0.3px 0.9px rgba(0,0,0,0.02);
  padding: 24px;
  margin-bottom: 24px;
}
.card h2, .card h3, .form-card h2 {
  margin-top: 0; margin-bottom: 20px; font-size: 1.1rem; color: var(--text); font-weight: 600;
  border-bottom: 1px solid var(--border); padding-bottom: 12px;
}
.card p { color: var(--muted); font-size: 0.9rem; margin-top: 0; }

/* KPI Grid */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-bottom: 24px; }
.kpi-card {
  background: #fff; padding: 20px; border-radius: var(--radius);
  border: 1px solid var(--border); border-top: 4px solid var(--brand);
  box-shadow: 0 1.6px 3.6px rgba(0,0,0,0.02);
  display: flex; justify-content: space-between; align-items: center;
}
.kpi-title { font-size: 0.85rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.kpi-value { font-size: 2rem; font-weight: 600; color: var(--text); margin-top: 4px; }

.kpi-widget {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.kpi-widget:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -8px rgba(0,0,0,0.1);
}

/* Formularios */
.form-group { margin-bottom: 20px; text-align: left; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text); margin-bottom: 8px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; padding: 8px 12px; border: 1px solid var(--secondary);
  border-radius: var(--radius); font-size: 0.9rem; font-family: inherit; color: var(--text);
  background: #fff; transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand);
}
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; }

/* Botones */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 6px 16px; border: 1px solid transparent; border-radius: var(--radius);
  font-weight: 600; font-size: 0.85rem; cursor: pointer; text-decoration: none;
  transition: all 0.15s ease-in-out; min-height: 32px;
}
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.secondary { background: #fff; color: var(--text); border-color: var(--secondary); }
.btn.secondary:hover { background: #F3F2F1; }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.danger:hover { background: #A4262C; border-color: #A4262C; }
.btn.success { background: var(--success); color: #fff; border-color: var(--success); }
.btn.success:hover { background: #0B5A0B; border-color: #0B5A0B; }
.btn.warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn.warning:hover { background: #A82E00; border-color: #A82E00; }
.btn.info { background: var(--info); color: #fff; border-color: var(--info); }
.btn.info:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.sm { padding: 4px 12px; font-size: 0.8rem; min-height: 28px; }
.btn:disabled, button:disabled { background: #F3F2F1 !important; color: #A19F9D !important; border-color: #EDEBE9 !important; cursor: not-allowed; }

.link { color: var(--brand); text-decoration: none; font-weight: 500; } 
.link:hover { text-decoration: underline; color: var(--brand-dark); }

/* =========================================================
   TABLES (High Density Azure Style)
   ========================================================= */
.table-wrap { padding: 0; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: none; margin-bottom: 24px; }
.table { width: 100%; border-collapse: collapse; text-align: left; }
.table th, .table td { padding: 12px 16px; font-size: 0.85rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table thead th { 
  background: #F3F2F1; font-weight: 600; color: var(--text); 
  border-bottom: 2px solid var(--secondary); position: sticky; top: 0; z-index: 10;
}
.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover { background: #F3F2F1; }
.table tbody tr:last-child td { border-bottom: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions a {
  text-decoration: none; color: var(--brand); font-weight: 500; font-size: 0.85rem;
  padding: 4px 8px; border-radius: var(--radius); transition: background 0.15s;
}
.actions a:hover { background: #E1DFDD; }

/* Status Badges */
.status-badge {
  padding: 4px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent;
}
.status-badge.active, .status-badge.running { background: #DFF6DD; color: #107C10; border-color: #107C10; }
.status-badge.stopped, .status-badge.error { background: #FDE7E9; color: #D13438; border-color: #D13438; }
.status-badge.pending, .status-badge.warning { background: #FFF4CE; color: #975A16; border-color: #D83B01; }
.status-badge.closed { background: #E1DFDD; color: #605E5C; border-color: #8A8886; }

/* =========================================================
   ALERTS
   ========================================================= */
.alert {
  padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px;
  display: flex; align-items: center; gap: 12px; font-size: 0.9rem; font-weight: 500;
  border-left: 4px solid transparent;
}
.alert.ok, .alert.success { background: #DFF6DD; color: #107C10; border-left-color: #107C10; }
.alert.error, .alert.danger { background: #FDE7E9; color: #D13438; border-left-color: #D13438; }
.alert.info { background: #E1F0FE; color: #1e8a8a; border-left-color: #1e8a8a; }

/* =========================================================
   PROGRESS BAR & BADGES
   ========================================================= */
.progress { background: #EDEBE9; border-radius: 10px; overflow: hidden; height: 8px; margin-top: 8px; }
.progress-bar { height: 100%; transition: width 0.4s ease; }
.progress-bar.ok { background: var(--success); }
.progress-bar.warn { background: var(--warning); }
.progress-bar.err { background: var(--danger); }

.badge {
  padding: 2px 8px; border-radius: 12px; color: white; font-size: 0.7rem; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
}
.badge.ok { background: var(--success); }
.badge.warn { background: var(--warning); }
.progress-bar.err { background: var(--danger); }

.badge {
  padding: 2px 8px; border-radius: 12px; color: white; font-size: 0.7rem; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
}
.badge.ok { background: var(--success); }
.badge.warn { background: var(--warning); }
.badge.err { background: var(--danger); }
.badge.info { background: var(--info); }

/* =========================================================
   SIDEBAR REFACTOR (Phase 4)
   ========================================================= */
.sidebar-header-extended {
  flex-direction: column; align-items: stretch; padding-bottom: 0;
}
.brand {
  display: flex; align-items: center; justify-content: space-between;
}
.user-profile {
  margin-top: 20px; padding: 12px; background: rgba(255,255,255,0.05); 
  border-radius: 8px; display: flex; flex-direction: column; gap: 4px;
}
.user-name {
  font-weight: 600; font-size: 0.9rem; color: #fff;
}
.user-company {
  font-size: 0.75rem; color: var(--muted);
}
.user-actions {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-top: 12px;
}
.btn-user-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  border-radius: 6px;
  font-size: 0.88rem;
  color: #fff;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}
.btn-user-action:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
  transform: translateY(-1px);
}
.btn-profile { background: rgba(255,255,255,0.1); }
.btn-logout {
  background: rgba(209, 52, 56, 0.25);
  color: #FF8B90;
  border-color: rgba(209, 52, 56, 0.4);
}
.btn-logout:hover {
  background: rgba(209, 52, 56, 0.5);
  color: #FFF;
}
.user-notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #e74c3c;
  color: white;
  border-radius: 50%;
  padding: 1px 4px;
  font-size: 0.6rem;
  font-weight: bold;
  border: 1px solid var(--sidebar-bg);
}

.nav-section-title {
  font-size: 0.75rem; text-transform: uppercase; color: var(--muted); 
  margin: 18px 24px 6px; letter-spacing: 0.05em; font-weight: 600;
}

.menu-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; color: var(--sidebar-text); font-weight: 500; cursor: pointer;
  text-decoration: none; transition: background 0.2s;
}
.menu-toggle-inner {
  display: flex; align-items: center; gap: 12px;
}
.menu-toggle:hover { background: var(--sidebar-hover); color: #fff; }
.menu-toggle .arrow { transition: transform 0.3s ease; font-size: 0.7rem; }
.menu-toggle.open .arrow { transform: rotate(90deg); }

.submenu {
  display: none; flex-direction: column; background: rgba(0,0,0,0.2);
}
.submenu.open { display: flex; }
.submenu a {
  padding: 10px 24px 10px 48px; color: var(--sidebar-text);
  font-size: 0.9rem; text-decoration: none; transition: background 0.2s;
}
.submenu a:hover, .submenu a.active { color: #fff; background: rgba(255,255,255,0.05); border-left: 3px solid var(--brand); }

.sidebar.collapsed { width: 80px; }
.sidebar.collapsed .sidebar-header .brand { display: none; }
.sidebar.collapsed .label, .sidebar.collapsed .arrow { display: none; }
.sidebar.collapsed .submenu { display: none !important; }
.sidebar.collapsed .menu-toggle { justify-content: center; }

.app-header-mobile { display: none; }
.btn-mobile-menu { color: var(--text); background: transparent; border: none; font-size: 1.2rem; cursor: pointer; }

@media (max-width: 992px) {
    .app-header-mobile { display: flex !important; }
}

@media (max-width: 768px) {
    .body-admin { padding-left: 0; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
}

/* =========================================================
   EXTRACTED COMPONENTS (Phase 3)
   ========================================================= */

/* Detail Pages */
.detail-card { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 24px; margin-bottom: 24px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
.detail-row { display: grid; grid-template-columns: 200px 1fr; padding: 12px 0; border-bottom: 1px solid var(--border); }
.detail-row:last-child { border-bottom: none; }
.detail-label { font-weight: 600; color: var(--muted); }
.detail-value { font-weight: 500; color: var(--text); }

/* Summary Cards (VM Create) */
.summary-card { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 20px; }
.summary-title { font-weight: 600; margin-bottom: 15px; color: var(--brand); }
.summary-list { list-style: none; padding: 0; margin: 0; }
.summary-list li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
.summary-list li:last-child { border-bottom: none; }
.highlight { font-weight: 600; color: var(--text); }

/* Chat / Tickets */
.chat-header { font-size: 1.1rem; font-weight: 600; margin-bottom: 20px; color: var(--text); padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.chat-wrap { display: flex; flex-direction: column; gap: 24px; margin-bottom: 30px; }
.msg { padding: 16px 20px; border-radius: 8px; max-width: 85%; font-size: 0.95rem; line-height: 1.5; position: relative; }
.msg.initial { background: var(--brand); color: #fff; max-width: 100%; border-bottom-left-radius: 0; }
.msg.user { background: #E1F0FE; color: var(--text); align-self: flex-start; border-bottom-left-radius: 0; border: 1px solid rgba(0,120,212,0.2); }
.msg.admin { background: #F3F2F1; color: var(--text); align-self: flex-end; border-bottom-right-radius: 0; border: 1px solid var(--border); }
.msg-meta { font-size: 0.75rem; opacity: 0.7; margin-bottom: 6px; display: block; font-weight: 600; }
.msg-content { white-space: pre-wrap; }
.msg.initial .msg-meta { opacity: 0.9; }
.attach-thumb { display: inline-flex; align-items: center; gap: 8px; background: rgba(0,0,0,0.05); padding: 8px 12px; border-radius: 4px; margin-top: 10px; font-size: 0.85rem; text-decoration: none; color: inherit; }
.attach-thumb:hover { background: rgba(0,0,0,0.1); }
.msg.initial .attach-thumb { background: rgba(255,255,255,0.2); }
.msg.initial .attach-thumb:hover { background: rgba(255,255,255,0.3); }
.reply-card { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 20px; }

/* Progress Bars */
.progress-label { display: flex; justify-content: space-between; font-size: 0.85rem; margin-top: 12px; margin-bottom: 4px; color: var(--muted); }
/* ===== RANGOS Y BARRAS DE RECURSOS ===== */
.bar-container { 
    background: #e2e8f0; 
    border-radius: 8px; 
    height: 8px; 
    width: 100%; 
    margin-bottom: 8px; 
    overflow: hidden; 
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}
.bar { 
    height: 100%; 
    border-radius: 8px;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1); 
}
.bar.cpu, .bar.cpu span { 
    background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%) !important; 
} 
.bar.ram, .bar.ram span { 
    background: linear-gradient(90deg, #10b981 0%, #059669 100%) !important; 
} 
.bar.disk, .bar.disk span { 
    background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%) !important; 
}
.bar.pbs, .bar.pbs span { 
    background: linear-gradient(90deg, #8b5cf6 0%, #7c3aed 100%) !important; 
}
.bar.info, .bar.info span { 
    background: linear-gradient(90deg, #06b6d4 0%, #0891b2 100%) !important; 
}

/* ===== UNIVERSAL RANGE SLIDERS (Crear VM & Ampliar Recursos) ===== */
input[type="range"], .do-range { 
    -webkit-appearance: none; 
    appearance: none; 
    width: 100%; 
    height: 8px; 
    border-radius: 8px; 
    background: #e2e8f0; 
    cursor: pointer; 
    outline: none;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
    margin: 8px 0;
}

/* Webkit Thumbs (Chrome, Safari, Edge) */
input[type="range"]::-webkit-slider-thumb,
.do-range::-webkit-slider-thumb { 
    -webkit-appearance: none; 
    width: 22px; 
    height: 22px; 
    border-radius: 50%; 
    background: #ffffff; 
    border: 3px solid #1e8a8a; 
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15); 
    transition: all 0.2s ease; 
}
input[type="range"]::-webkit-slider-thumb:hover,
.do-range::-webkit-slider-thumb:hover { 
    transform: scale(1.15); 
    box-shadow: 0 4px 10px rgba(0, 120, 212, 0.35); 
}

/* Firefox Thumbs */
input[type="range"]::-moz-range-thumb,
.do-range::-moz-range-thumb { 
    width: 22px; 
    height: 22px; 
    border-radius: 50%; 
    background: #ffffff; 
    border: 3px solid #1e8a8a; 
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15); 
    transition: all 0.2s ease; 
}

/* Specific Resource Colors (CPU = Blue, RAM = Green, Disk = Amber) */
#cpuSlider::-webkit-slider-thumb, #slider_cpu::-webkit-slider-thumb { border-color: #1e8a8a; }
#ramSlider::-webkit-slider-thumb, #slider_ram::-webkit-slider-thumb { border-color: #10b981; }
#diskSlider::-webkit-slider-thumb, #slider_disk::-webkit-slider-thumb { border-color: #f59e0b; }
#slider_backup::-webkit-slider-thumb { border-color: #1e8a8a; }
#slider_vpn_ssl::-webkit-slider-thumb { border-color: #10b981; }
#pbsSlider::-webkit-slider-thumb { border-color: #8b5cf6; }
#vpnSlider::-webkit-slider-thumb, #ipsecSlider::-webkit-slider-thumb { border-color: #06b6d4; }

#ramSlider::-webkit-slider-thumb:hover, #slider_ram::-webkit-slider-thumb:hover { box-shadow: 0 4px 10px rgba(16, 185, 129, 0.4); }
#diskSlider::-webkit-slider-thumb:hover, #slider_disk::-webkit-slider-thumb:hover { box-shadow: 0 4px 10px rgba(245, 158, 11, 0.4); }
#pbsSlider::-webkit-slider-thumb:hover { box-shadow: 0 4px 10px rgba(139, 92, 246, 0.4); }
#vpnSlider::-webkit-slider-thumb:hover, #ipsecSlider::-webkit-slider-thumb:hover { box-shadow: 0 4px 10px rgba(6, 182, 212, 0.4); }

.input-mini { width: 100px; padding: 6px; border: 1px solid var(--border); border-radius: 4px; }
.flex-row { display: flex; align-items: center; gap: 12px; }

.dashboard-banner { background: linear-gradient(135deg, var(--brand), #005a9e); color: white; padding: 24px; border-radius: 8px; margin-bottom: 24px; }
.dashboard-banner h1 { margin: 0; font-size: 1.5rem; font-weight: 600; color: white; }
.dashboard-banner p { margin: 8px 0 0 0; opacity: 0.9; }

/* Section Titles */
.section-title { font-size: 1.4rem; font-weight: 600; color: var(--brand); display: flex; align-items: center; gap: 8px; margin-top: 0; margin-bottom: 24px; }

/* =========================================================
   COMMAND PALETTE & SEARCH SPOTLIGHT (Ctrl + K)
   ========================================================= */
.cmd-palette-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 100px;
  opacity: 0; pointer-events: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.cmd-palette-overlay.open {
  opacity: 1; pointer-events: auto;
}
.cmd-palette-modal {
  background: var(--card-bg);
  border: 1px solid var(--border);
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  border-radius: 12px;
  width: 100%; max-width: 640px;
  overflow: hidden;
  transform: scale(0.96);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.cmd-palette-overlay.open .cmd-palette-modal {
  transform: scale(1);
}
.cmd-palette-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.cmd-palette-header i { font-size: 1.2rem; color: var(--brand); }
.cmd-palette-input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 1.05rem; font-family: inherit; color: var(--text);
}
.cmd-palette-kbd {
  background: var(--bg); border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; color: var(--muted);
}
.cmd-palette-results {
  max-height: 380px; overflow-y: auto; padding: 8px 0;
}
.cmd-group-title {
  padding: 8px 16px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--muted);
}
.cmd-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; color: var(--text); text-decoration: none;
  font-size: 0.9rem; transition: background 0.15s;
}
.cmd-item:hover, .cmd-item.selected {
  background: rgba(0, 120, 212, 0.1); color: var(--brand);
}
.cmd-item-left { display: flex; align-items: center; gap: 12px; }
.cmd-item-badge {
  font-size: 0.75rem; padding: 2px 8px; border-radius: 12px;
  background: var(--bg); color: var(--muted); border: 1px solid var(--border);
}

/* =========================================================
   DARK MODE COMPREHENSIVE OVERRIDES
   ========================================================= */
[data-theme="dark"] {
  background-color: var(--bg);
  color: var(--text);
}
[data-theme="dark"] body,
[data-theme="dark"] .body-admin {
  background-color: var(--bg);
  color: var(--text);
}
[data-theme="dark"] .form-card,
[data-theme="dark"] .card,
[data-theme="dark"] .table-wrap,
[data-theme="dark"] .table-card,
[data-theme="dark"] .step-card,
[data-theme="dark"] .kpi-widget,
[data-theme="dark"] .summary-card {
  background-color: var(--card-bg) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important;
}

/* Tables in Dark Mode */
[data-theme="dark"] table,
[data-theme="dark"] .table {
  background-color: var(--card-bg) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
[data-theme="dark"] table thead,
[data-theme="dark"] .table thead,
[data-theme="dark"] table thead th,
[data-theme="dark"] .table thead th {
  background-color: #0F172A !important;
  color: #94A3B8 !important;
  border-bottom-color: var(--border) !important;
}
[data-theme="dark"] table tbody tr,
[data-theme="dark"] .table tbody tr {
  background-color: var(--card-bg) !important;
  color: var(--text) !important;
}
[data-theme="dark"] table tbody tr:hover,
[data-theme="dark"] .table tbody tr:hover {
  background-color: #334155 !important;
}
[data-theme="dark"] table td,
[data-theme="dark"] .table td,
[data-theme="dark"] table th,
[data-theme="dark"] .table th {
  border-bottom-color: var(--border) !important;
  color: var(--text) !important;
}
[data-theme="dark"] table tbody tr:nth-child(even) {
  background-color: #162032 !important;
}

/* Form Controls in Dark Mode */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] select,
[data-theme="dark"] textarea,
[data-theme="dark"] .input-mini {
  background-color: #0F172A !important;
  color: #F8FAFC !important;
  border-color: #334155 !important;
}
[data-theme="dark"] select option {
  background-color: #0F172A;
  color: #F8FAFC;
}
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: #64748B;
}

/* Buttons & Links in Dark Mode */
[data-theme="dark"] .btn.secondary {
  background-color: #334155 !important;
  color: #F8FAFC !important;
  border-color: #475569 !important;
}
[data-theme="dark"] .btn.secondary:hover {
  background-color: #475569 !important;
}
[data-theme="dark"] .actions a:hover {
  background-color: #334155 !important;
}

/* Force inline dark colors to become bright text in Dark Mode */
[data-theme="dark"] [style*="color:#1e293b"],
[data-theme="dark"] [style*="color: #1e293b"],
[data-theme="dark"] [style*="color:#1E293B"],
[data-theme="dark"] [style*="color: #1E293B"],
[data-theme="dark"] [style*="color:#323130"],
[data-theme="dark"] [style*="color: #323130"],
[data-theme="dark"] [style*="color:#333"],
[data-theme="dark"] [style*="color: #333"],
[data-theme="dark"] [style*="color:#000"],
[data-theme="dark"] [style*="color: #000"],
[data-theme="dark"] [style*="color:black"],
[data-theme="dark"] [style*="color: black"],
[data-theme="dark"] [style*="color:var(--text)"],
[data-theme="dark"] [style*="color: var(--text)"],
[data-theme="dark"] td span,
[data-theme="dark"] td strong,
[data-theme="dark"] th span,
[data-theme="dark"] th strong {
  color: #F8FAFC !important;
}

/* Herramientas (Network Tools) in Dark Mode */
[data-theme="dark"] .tool-panel {
  background-color: var(--card-bg) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}
[data-theme="dark"] .tools-btn {
  background-color: #1E293B !important;
  color: #F8FAFC !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .tools-btn:hover {
  background-color: #334155 !important;
}
[data-theme="dark"] .tools-btn.active {
  background-color: var(--brand) !important;
  color: #FFFFFF !important;
}
[data-theme="dark"] .text-muted,
[data-theme="dark"] p.text-muted {
  color: #94A3B8 !important;
}

/* Sliders (.do-range & input[type="range"]) in Dark Mode */
[data-theme="dark"] .do-range,
[data-theme="dark"] input[type="range"] {
  background: #334155 !important;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4) !important;
}
[data-theme="dark"] .do-range::-webkit-slider-thumb,
[data-theme="dark"] input[type="range"]::-webkit-slider-thumb {
  background: #0F172A !important;
}
[data-theme="dark"] .do-range::-moz-range-thumb,
[data-theme="dark"] input[type="range"]::-moz-range-thumb {
  background: #0F172A !important;
}

[data-theme="dark"] #cpuSlider::-webkit-slider-thumb,
[data-theme="dark"] #slider_cpu::-webkit-slider-thumb {
  border-color: #38BDF8 !important;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.6) !important;
}
[data-theme="dark"] #ramSlider::-webkit-slider-thumb,
[data-theme="dark"] #slider_ram::-webkit-slider-thumb {
  border-color: #34D399 !important;
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.6) !important;
}
[data-theme="dark"] #diskSlider::-webkit-slider-thumb,
[data-theme="dark"] #slider_disk::-webkit-slider-thumb {
  border-color: #FBBF24 !important;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.6) !important;
}
[data-theme="dark"] #slider_backup::-webkit-slider-thumb {
  border-color: #38BDF8 !important;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.6) !important;
}
[data-theme="dark"] #slider_vpn_ssl::-webkit-slider-thumb {
  border-color: #34D399 !important;
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.6) !important;
}

/* Dark Mode Inline Color Overrides for Upgrade Module & Labels */
[data-theme="dark"] [style*="color:#334155"],
[data-theme="dark"] [style*="color: #334155"],
[data-theme="dark"] [style*="color:#64748b"],
[data-theme="dark"] [style*="color: #64748b"],
[data-theme="dark"] [style*="color:#1e293b"],
[data-theme="dark"] [style*="color: #1e293b"],
[data-theme="dark"] [style*="color:#475569"],
[data-theme="dark"] [style*="color: #475569"],
[data-theme="dark"] [style*="color:#333455"] {
  color: #F8FAFC !important;
}
[data-theme="dark"] [style*="background:#ecfdf5"],
[data-theme="dark"] [style*="background: #ecfdf5"] {
  background: rgba(16, 185, 129, 0.2) !important;
  color: #34D399 !important;
  border-color: rgba(52, 211, 153, 0.4) !important;
}
[data-theme="dark"] hr[style*="border-top"] {
  border-top-color: #334155 !important;
}

/* Modern Card Containers & Special Boxes in Dark Mode */
[data-theme="dark"] .create-user-card,
[data-theme="dark"] .ipsec-card,
[data-theme="dark"] .role-card,
[data-theme="dark"] .wizard-card,
[data-theme="dark"] .backup-card,
[data-theme="dark"] .detail-card,
[data-theme="dark"] .reply-card,
[data-theme="dark"] .kpi-card,
[data-theme="dark"] .form-card,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .service-card,
[data-theme="dark"] .network-card,
[data-theme="dark"] .billing-card {
  background-color: #1E293B !important;
  border-color: #334155 !important;
  color: #F8FAFC !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important;
}

/* Premium Tables in Dark Mode */
[data-theme="dark"] .premium-table tbody tr {
  background-color: #1E293B !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
  border-color: #334155 !important;
}

[data-theme="dark"] .premium-table tbody td {
  color: #F8FAFC !important;
  border-color: #334155 !important;
}

[data-theme="dark"] .premium-table thead th {
  color: #94A3B8 !important;
}

[data-theme="dark"] .form-header-title,
[data-theme="dark"] .form-header-title i,
[data-theme="dark"] .crypto-title,
[data-theme="dark"] .field-group label {
  color: #F8FAFC !important;
}

[data-theme="dark"] .form-header-sub,
[data-theme="dark"] .form-section-label,
[data-theme="dark"] .field-hint {
  color: #94A3B8 !important;
}

[data-theme="dark"] .role-info-box,
[data-theme="dark"] .crypto-box {
  background-color: #0F172A !important;
  border-color: #334155 !important;
  color: #94A3B8 !important;
}

[data-theme="dark"] .role-info-box div,
[data-theme="dark"] .role-info-box strong,
[data-theme="dark"] .role-info-box ul li {
  color: #CBD5E1 !important;
}

/* Action Buttons & Fast Triggers in Dark Mode */
[data-theme="dark"] .btn-pwd-action {
  background-color: #334155 !important;
  border-color: #475569 !important;
  color: #F8FAFC !important;
}

[data-theme="dark"] .btn-pwd-action:hover {
  background-color: #475569 !important;
  color: #FFFFFF !important;
}

[data-theme="dark"] .actions a {
  color: #38BDF8 !important;
}

[data-theme="dark"] .actions a:hover {
  background-color: #334155 !important;
  color: #7DD3FC !important;
}

/* Toast Notifications in Dark Mode */
[data-theme="dark"] .toast-notification {
  background-color: #1E293B !important;
  color: #F8FAFC !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5) !important;
}

/* Dashboard KPI Icon Containers in Dark Mode */
[data-theme="dark"] .kpi-widget div[style*="background: #E1F0FE"],
[data-theme="dark"] .kpi-widget div[style*="background:#E1F0FE"],
[data-theme="dark"] .kpi-widget div[style*="background: #DFF6DD"],
[data-theme="dark"] .kpi-widget div[style*="background:#DFF6DD"],
[data-theme="dark"] .kpi-widget div[style*="background: #FFF4CE"],
[data-theme="dark"] .kpi-widget div[style*="background:#FFF4CE"],
[data-theme="dark"] .kpi-widget div[style*="background: #FDE7E9"],
[data-theme="dark"] .kpi-widget div[style*="background:#FDE7E9"],
[data-theme="dark"] .kpi-widget div[style*="background: #EAE6FF"],
[data-theme="dark"] .kpi-widget div[style*="background:#EAE6FF"],
[data-theme="dark"] .kpi-widget div[style*="background: #FFF4E6"],
[data-theme="dark"] .kpi-widget div[style*="background:#FFF4E6"],
[data-theme="dark"] .kpi-widget div[style*="background: #F3E8FF"],
[data-theme="dark"] .kpi-widget div[style*="background:#F3E8FF"],
[data-theme="dark"] .kpi-widget div[style*="background: #FFEBE6"],
[data-theme="dark"] .kpi-widget div[style*="background:#FFEBE6"],
[data-theme="dark"] .kpi-widget div[style*="background: #FEE2E2"],
[data-theme="dark"] .kpi-widget div[style*="background:#FEE2E2"],
[data-theme="dark"] .kpi-widget div[style*="background: #E0F2FE"],
[data-theme="dark"] .kpi-widget div[style*="background:#E0F2FE"],
[data-theme="dark"] .kpi-widget div[style*="background: #DCFCE7"],
[data-theme="dark"] .kpi-widget div[style*="background:#DCFCE7"] {
  background: rgba(255, 255, 255, 0.08) !important;
}

/* Modern Alerts in Dark Mode */
[data-theme="dark"] .alert.ok {
  background-color: rgba(16, 185, 129, 0.15) !important;
  border-left-color: #10B981 !important;
  color: #34D399 !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2) !important;
}

[data-theme="dark"] .alert.error,
[data-theme="dark"] .alert.err,
[data-theme="dark"] .alert.danger {
  background-color: rgba(239, 68, 68, 0.15) !important;
  border-left-color: #EF4444 !important;
  color: #FCA5A5 !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2) !important;
}

/* Badges & Status Indicators in Dark Mode */
[data-theme="dark"] .badge.ok,
[data-theme="dark"] .badge.active,
[data-theme="dark"] .badge.activo,
[data-theme="dark"] .status-badge.active,
[data-theme="dark"] .status-badge.activo,
[data-theme="dark"] .status-badge.up,
[data-theme="dark"] .status-badge.ok {
  background-color: rgba(16, 185, 129, 0.2) !important;
  color: #34D399 !important;
  border: 1px solid rgba(52, 211, 153, 0.4) !important;
}

[data-theme="dark"] .badge.err,
[data-theme="dark"] .badge.inactivo,
[data-theme="dark"] .badge.danger,
[data-theme="dark"] .badge.muted,
[data-theme="dark"] .status-badge.muted,
[data-theme="dark"] .status-badge.inactivo,
[data-theme="dark"] .status-badge.down,
[data-theme="dark"] .status-badge.err {
  background-color: rgba(239, 68, 68, 0.2) !important;
  color: #FCA5A5 !important;
  border: 1px solid rgba(239, 68, 68, 0.4) !important;
}