/* ============================================================
   SISTEMA DE DISEÑO — "LIQUID GLASS ULTIMATE EDITION"
   Corrección de contrastes, scrollbars translúcidas y tablas de alta gama.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --azul: #004075; 
  --azul-700: #00335E; 
  --azul-050: rgba(0, 64, 117, 0.06);
  --azul-100: rgba(0, 64, 117, 0.12);
  --rojo: #FF0432; 
  --rojo-700: #D60029; 
  --blanco: #FFFFFF;

  --bg: #E8EEF5;
  --bg-gradient: radial-gradient(circle at 10% 10%, rgba(0, 64, 117, 0.04) 0%, rgba(255, 4, 50, 0.02) 50%, #E8EEF5 100%);
  
  --surface: rgba(255, 255, 255, 0.85);
  --surface-solid: #FFFFFF;
  
  --line: rgba(214, 222, 232, 0.7);
  --line-2: rgba(196, 207, 220, 0.9);
  --border-glass: 1px solid rgba(255, 255, 255, 0.8);
  
  --ink: #0E1B27; 
  --muted: #5C6B7B;
  
  --ok: #0E9E6E; --ok-bg: rgba(14, 158, 110, 0.1);
  --warn: #E08600; --warn-bg: rgba(224, 134, 0, 0.1);
  
  --radius: 14px;
  --radius-sm: 8px;
  
  --shadow: 0 4px 20px rgba(14, 27, 39, 0.05);
  --shadow-hover: 0 8px 30px rgba(14, 27, 39, 0.1);

  --font: 'Archivo', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --accent: var(--azul);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Scrollbars estilizadas y modernas */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.03); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: rgba(0,64,117,0.2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,64,117,0.4); }

button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--azul); color: #fff; }
:focus-visible { outline: 2px solid var(--rojo); outline-offset: 2px; }

/* ---------- Formularios ---------- */
label { display: block; font-weight: 600; font-size: 11px; letter-spacing: 0.04em; margin: 0 0 6px; color: var(--muted); text-transform: uppercase; font-family: var(--mono); }
.field { margin-bottom: 16px; }

input, select, textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  font: inherit;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  color: var(--ink);
  transition: all 0.2s ease;
}
input:hover, select:hover, textarea:hover { border-color: var(--azul); background: rgba(255, 255, 255, 0.95); }
input:focus, select:focus, textarea:focus {
  border-color: var(--azul);
  outline: none;
  background: #fff;
  box-shadow: 0 0 0 4px var(--azul-050), 0 4px 12px rgba(0,64,117,0.08);
}

/* ---------- Botones Líquidos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 10px 18px; font-weight: 600; font-size: 13px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--azul) 0%, var(--azul-700) 100%);
  color: #fff; border-color: rgba(255,255,255,0.15);
  box-shadow: 0 4px 14px rgba(0,64,117,0.25);
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,64,117,0.35); }
.btn-ghost {
  background: rgba(255, 255, 255, 0.7); backdrop-filter: blur(8px);
  border-color: var(--line-2); color: var(--ink);
}
.btn-ghost:hover { border-color: var(--azul); color: var(--azul); background: #fff; }
.btn-danger {
  background: linear-gradient(135deg, var(--rojo) 0%, var(--rojo-700) 100%);
  color: #fff; box-shadow: 0 4px 14px rgba(255,4,50,0.25);
}
.btn-danger:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: 64px;
  background: rgba(10, 34, 51, 0.9);
  backdrop-filter: blur(16px);
  color: #fff; display: flex; align-items: center; gap: 16px; padding: 0 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
}
.topbar .logo { display: flex; align-items: center; gap: 12px; font-weight: 700; color: #fff; }
.topbar .logo .mark {
  width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,0.1);
  color: #fff; display: grid; place-items: center; font-weight: 800; font-family: var(--mono);
  border: 1px solid rgba(255,255,255,0.2);
}
.topbar .logo .mark b { color: var(--rojo); text-shadow: 0 0 10px rgba(255,4,50,0.8); }
.topbar .logo > span:last-child { font-size: 16px; letter-spacing: -0.01em; color: #fff; }
.spacer { flex: 1; }
.user-chip {
  display: flex; align-items: center; gap: 10px; color: #C5D5E2; font-size: 13px; font-family: var(--mono);
  background: rgba(255,255,255,0.06); padding: 5px 14px 5px 8px; border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1);
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--rojo); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 12px;
  box-shadow: 0 0 10px rgba(255,4,50,0.5);
}
.logout, .theme-btn {
  color: #C5D5E2; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 15px;
  transition: all 0.2s ease;
}
.logout:hover { background: var(--rojo); color: #fff; border-color: var(--rojo); box-shadow: 0 0 15px rgba(255,4,50,0.4); }
.theme-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }
.hamb { display: none; background: transparent; border: 1px solid rgba(255,255,255,0.1); color: #fff; width: 40px; height: 40px; border-radius: 10px; font-size: 18px; }

/* ---------- Sidebar ---------- */
.layout { display: flex; align-items: flex-start; }
.sidebar {
  width: 248px; flex: 0 0 248px;
  background: rgba(10, 34, 51, 0.82);
  backdrop-filter: blur(20px);
  min-height: calc(100vh - 64px); padding: 16px 12px 32px;
  position: sticky; top: 64px; border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.nav-label {
  font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.18em;
  color: rgba(124, 147, 166, 0.7); margin: 20px 12px 8px; font-weight: 600;
}
.nav-label:first-child { margin-top: 8px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 14px; border-radius: var(--radius-sm); color: #C5D5E2; font-weight: 500; font-size: 13.5px;
  margin-bottom: 3px; transition: all 0.2s ease;
}
.nav-item .ic { width: 18px; height: 18px; flex: 0 0 18px; color: #7C93A6; transition: color 0.2s; }
.nav-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; transform: translateX(2px); }
.nav-item:hover .ic { color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(255, 4, 50, 0.15) 0%, rgba(255, 255, 255, 0.08) 100%);
  color: #fff; font-weight: 600; border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.nav-item.active .ic { color: var(--rojo); filter: drop-shadow(0 0 6px rgba(255,4,50,0.6)); }
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  background: var(--rojo); border-radius: 0 3px 3px 0; box-shadow: 0 0 10px var(--rojo);
}

.main { flex: 1; min-width: 0; padding: 28px 32px 72px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); }
.page-head .sub { color: var(--muted); font-size: 13.5px; margin-top: 4px; }

/* ---------- Avisos ---------- */
.flash { padding: 14px 18px; border-radius: var(--radius); font-size: 13.5px; font-weight: 500; margin-bottom: 20px; backdrop-filter: blur(10px); }
.flash-ok { background: rgba(14, 158, 110, 0.15); color: #0A6E4D; border: 1px solid rgba(14, 158, 110, 0.3); }
.flash-err { background: rgba(255, 4, 50, 0.1); color: #B4001F; border: 1px solid rgba(255, 4, 50, 0.3); }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 26px; }
.kpi {
  background: var(--surface); backdrop-filter: blur(16px);
  border: var(--border-glass); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.kpi::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3.5px; background: var(--accent); }
.kpi.alt::before { background: var(--rojo); box-shadow: 0 0 10px rgba(255,4,50,0.5); }
.kpi .k-label { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; font-family: var(--mono); }
.kpi .k-value { font-family: var(--mono); font-size: 32px; font-weight: 700; letter-spacing: -0.03em; margin-top: 8px; color: var(--ink); line-height: 1.1; }
.kpi .k-foot { font-size: 12px; color: var(--muted); margin-top: 6px; }
.kpi.alt .k-foot::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--rojo); margin-right: 6px; vertical-align: 1px; box-shadow: 0 0 8px rgba(255,4,50,0.8);
}

/* ---------- Tarjetas y Paneles Estilo Liquid Glass ---------- */
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
.card, .panel {
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: var(--border-glass);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}
.card .c-head, .panel h3 {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.4);
}
.card .c-head h3, .panel h3 { margin: 0; font-size: 13.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink); }
.card .c-body { padding: 20px; }
.panel { padding: 24px; }

/* ---------- Herramientas / Filtros ---------- */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 20px; background: var(--surface); backdrop-filter: blur(12px); padding: 16px; border-radius: var(--radius); border: var(--border-glass); box-shadow: var(--shadow); }
.seg { display: inline-flex; background: rgba(0,0,0,0.04); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px; }
.seg a { padding: 7px 14px; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--muted); font-family: var(--mono); transition: all 0.2s; }
.seg a.active { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(0,64,117,0.3); }
.f-field { display: flex; flex-direction: column; gap: 5px; }
.f-field label { margin: 0; }
.f-field input, .f-field select { padding: 9px 12px; font-size: 13px; min-width: 150px; }
.export-group { display: flex; gap: 8px; margin-left: auto; }
.export-group .icon-btn svg { width: 15px; height: 15px; vertical-align: -2px; margin-right: 4px; }

/* ---------- Tablas Modernas y Estilizadas ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255, 255, 255, 0.6); backdrop-filter: blur(12px); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; font-family: var(--mono); padding: 14px 18px; border-bottom: 1px solid var(--line-2); white-space: nowrap; background: rgba(247, 249, 252, 0.8); }
td { padding: 14px 18px; border-bottom: 1px solid var(--line); white-space: nowrap; color: var(--ink); }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background 0.15s ease; }
tbody tr:hover { background: rgba(0, 64, 117, 0.04); }
.empty { color: var(--muted); text-align: center; padding: 36px; font-style: italic; }
td .num, .mono { font-family: var(--mono); }

/* ---------- Botones de Acción de Tabla con Iconos Profesionales ---------- */
.row-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  border: 1px solid var(--line-2); background: rgba(255,255,255,0.9);
  border-radius: var(--radius-sm); padding: 7px 12px; font-size: 12px; font-weight: 600;
  color: var(--muted); display: inline-flex; align-items: center; gap: 6px; transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.icon-btn:hover { border-color: var(--azul); color: var(--azul); background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,0.06); }
.icon-btn.del:hover { border-color: var(--rojo); color: var(--rojo); background: rgba(255,4,50,0.05); }
.icon-btn.fin { border-color: #9FD9C4; color: var(--ok); background: rgba(14,158,110,0.05); }

/* ---------- Badges / Indicadores Líquidos ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 6px; font-size: 11.5px; font-weight: 600; font-family: var(--mono); letter-spacing: 0.02em; border: 1px solid transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.9; box-shadow: 0 0 6px currentColor; }
.b-ok { background: var(--ok-bg); color: #0A7A55; border-color: rgba(14,158,110,0.25); }
.b-warn { background: var(--warn-bg); color: #9A5B00; border-color: rgba(224,134,0,0.25); }
.b-red { background: rgba(255,4,50,0.1); color: #C20029; border-color: rgba(255,4,50,0.25); }
.b-gray { background: rgba(0,0,0,0.05); color: #5A6675; border-color: rgba(0,0,0,0.08); }
.b-blue { background: var(--azul-050); color: var(--azul); border-color: var(--azul-100); }

.rank-pos { width: 28px; height: 28px; border-radius: 8px; display: inline-grid; place-items: center; font-weight: 700; font-size: 12px; font-family: var(--mono); background: var(--azul-050); color: var(--azul); }
.rank-pos.top { background: var(--azul); color: #fff; box-shadow: 0 2px 8px rgba(0,64,117,0.4); }

/* ---------- Formularios y Paneles ---------- */
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-form .full { grid-column: 1 / -1; }
.field-hint { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); line-height: 1.45; }
.field-hint a { color: var(--azul); font-weight: 600; }
.field-hint a:hover { text-decoration: underline; }
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.matrix input { width: auto; }
.swatch { display: inline-flex; align-items: center; gap: 10px; }
.swatch input[type=color] { width: 46px; height: 38px; padding: 2px; border-radius: var(--radius-sm); cursor: pointer; }

/* ---------- Logotipo y Pestañas ---------- */
.topbar .logo .logo-img { height: 36px; width: auto; max-width: 160px; border-radius: 6px; background: rgba(255,255,255,0.9); padding: 3px 8px; object-fit: contain; }
.login-logo { max-width: 190px; max-height: 70px; width: auto; object-fit: contain; display: block; margin: 0 auto 12px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-2); margin-bottom: 22px; flex-wrap: wrap; }
.tabs a { padding: 10px 18px; font-size: 12.5px; font-weight: 600; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color 0.2s; }
.tabs a:hover { color: var(--azul); }
.tabs a.active { color: var(--azul); border-bottom-color: var(--rojo); font-weight: 700; }

.section-title { font-family: var(--mono); font-size: 11.5px; font-weight: 700; color: var(--azul); text-transform: uppercase; letter-spacing: 0.1em; margin: 12px 0 14px; padding-left: 10px; border-left: 3px solid var(--rojo); }

/* ============================================================
   MODO OSCURO REFINADO (LIQUID GLASS DARK THEME CORREGIDO)
   ============================================================ */
[data-theme="dark"] {
  --bg: #060F18;
  --bg-gradient: radial-gradient(circle at 20% 20%, rgba(0, 64, 117, 0.2) 0%, rgba(255, 4, 50, 0.06) 50%, #060F18 100%);
  
  --surface: rgba(14, 28, 42, 0.85);
  --surface-solid: #0E1C2A;
  
  --line: rgba(30, 52, 72, 0.7);
  --line-2: rgba(44, 73, 99, 0.9);
  --border-glass: 1px solid rgba(255, 255, 255, 0.08);
  
  --ink: #EAF2F8 !important; 
  --muted: #94AABD !important;
  
  --azul-050: rgba(0, 64, 117, 0.3);
  --azul-100: rgba(0, 64, 117, 0.5);
  
  --chrome: rgba(5, 14, 22, 0.95);
  --chrome-2: rgba(14, 30, 44, 0.95);
  --chrome-line: rgba(28, 51, 71, 0.9);
  --chrome-ink: #C5D5E2;
  --chrome-muted: #7C93A6;

  --ok-bg: rgba(14, 49, 41, 0.5);
  --warn-bg: rgba(48, 35, 13, 0.5);
  
  --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 12px 40px 0 rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] body, [data-theme="dark"] p, [data-theme="dark"] span, [data-theme="dark"] div {
  color: var(--ink);
}

[data-theme="dark"] .card,
[data-theme="dark"] .panel,
[data-theme="dark"] .kpi,
[data-theme="dark"] .table-wrap,
[data-theme="dark"] .seg,
[data-theme="dark"] .toolbar,
[data-theme="dark"] .client-group {
  background: var(--surface) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: var(--border-glass) !important;
}

[data-theme="dark"] .card .c-head,
[data-theme="dark"] .panel h3,
[data-theme="dark"] .client-group .c-head {
  background: rgba(10, 22, 34, 0.75) !important;
  border-bottom: 1px solid var(--line) !important;
}

[data-theme="dark"] .card .c-head h3,
[data-theme="dark"] .panel h3,
[data-theme="dark"] .perm-head h4,
[data-theme="dark"] .page-head h2,
[data-theme="dark"] .client-group .c-head h3 { color: var(--ink) !important; }

[data-theme="dark"] th { background: rgba(10, 22, 34, 0.9) !important; color: var(--muted) !important; border-bottom: 1px solid var(--line-2) !important; }
[data-theme="dark"] td { border-bottom: 1px solid var(--line) !important; color: var(--ink) !important; }
[data-theme="dark"] tbody tr:hover { background: rgba(0, 64, 117, 0.25) !important; }
[data-theme="dark"] tfoot td { background: rgba(10, 22, 34, 0.9) !important; }

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: rgba(10, 22, 34, 0.8);
  color: var(--ink);
  border-color: var(--line-2);
}
[data-theme="dark"] input:hover,
[data-theme="dark"] select:hover,
[data-theme="dark"] textarea:hover { border-color: #456A8A; background: rgba(10, 22, 34, 0.95); }
[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
  background: rgba(10, 22, 34, 1);
  box-shadow: 0 0 0 4px rgba(0,64,117,0.4), 0 4px 16px rgba(0,0,0,0.6);
}
[data-theme="dark"] label { color: #B9CBDA !important; }
[data-theme="dark"] .btn-ghost,
[data-theme="dark"] .icon-btn {
  background: rgba(18, 40, 58, 0.85);
  color: #C3D4E2 !important;
  border-color: var(--line-2);
}
[data-theme="dark"] .btn-ghost:hover,
[data-theme="dark"] .icon-btn:hover {
  background: rgba(25, 52, 73, 1);
  color: #fff !important;
  border-color: var(--azul);
}

[data-theme="dark"] .b-ok { background: rgba(14,49,41,0.6); color: #5FD8AE !important; border-color: rgba(29,83,68,0.5); }
[data-theme="dark"] .b-warn { background: rgba(48,35,13,0.6); color: #E8B45F !important; border-color: rgba(90,67,26,0.5); }
[data-theme="dark"] .b-red { background: rgba(58,18,28,0.6); color: #FF7D96 !important; border-color: rgba(94,31,46,0.5); }
[data-theme="dark"] .b-gray { background: rgba(20,35,50,0.6); color: #9FB4C6 !important; border-color: rgba(42,66,86,0.5); }
[data-theme="dark"] .b-blue { background: rgba(14,37,58,0.6); color: #7FB6E8 !important; border-color: rgba(31,71,103,0.5); }

[data-theme="dark"] .flash-ok { background: rgba(14,49,41,0.7); color: #7FE3BF; border-color: rgba(29,83,68,0.6); }
[data-theme="dark"] .flash-err { background: rgba(58,18,28,0.7); color: #FF9BAF; border-color: rgba(94,31,46,0.6); }

[data-theme="dark"] .empty, [data-theme="dark"] .field-hint, [data-theme="dark"] .sub { color: var(--muted) !important; }
[data-theme="dark"] .rank-pos { background: rgba(14,37,58,0.7); color: #7FB6E8; }
[data-theme="dark"] .logo-box { background: rgba(10,22,34,0.6); border-color: var(--line-2); }
[data-theme="dark"] .tabs a.active { color: #7FB6E8; }
[data-theme="dark"] .total-card { background: rgba(14,37,58,0.7); border-color: rgba(31,71,103,0.7); }
[data-theme="dark"] .total-row, [data-theme="dark"] .total-amount { color: #8FC4F0; }
[data-theme="dark"] .client-group .c-head h3 { color: #8FC4F0 !important; }
[data-theme="dark"] .cg-btn { background: rgba(14,30,44,0.7); color: #8FC4F0; border-color: var(--line-2); }
[data-theme="dark"] .vid-link { color: #7FB6E8; }
[data-theme="dark"] .section-title { color: #8FC4F0; }
[data-theme="dark"] .topbar .logo .mark { background: rgba(255,255,255,0.15); }

/* ---------- Responsive ---------- */
.scrim { display: none; }
@media (max-width: 1024px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 880px) {
  .hamb { display: block; }
  .sidebar {
    position: fixed; left: 0; top: 64px; bottom: 0; z-index: 40;
    transform: translateX(-110%); transition: transform 0.25s ease;
    box-shadow: 10px 0 30px rgba(0,0,0,0.3); overflow: auto;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .scrim {
    display: block; position: fixed; inset: 64px 0 0 0;
    background: rgba(8, 20, 30, 0.6); backdrop-filter: blur(4px); z-index: 35;
  }
  .main { padding: 18px; }
  .user-chip .uname { display: none; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: 1fr; }
  .grid-form { grid-template-columns: 1fr; }
  .export-group { margin-left: 0; width: 100%; }
  .page-head h2 { font-size: 20px; }
}
/* Toggle Switch Estilizado y Adaptable a Modo Oscuro */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background-color: rgba(0,0,0,0.15); transition: .3s; border-radius: 24px; border: 1px solid var(--line-2); }
.toggle-slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: #fff; transition: .3s; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }

input:checked + .toggle-slider { background-color: #0e9e6e; border-color: #0e9e6e; }
input:checked + .toggle-slider:before { transform: translateX(20px); }

[data-theme="dark"] .toggle-slider { background-color: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.15); }
[data-theme="dark"] input:checked + .toggle-slider { background-color: #0e9e6e; border-color: #0e9e6e; }