/* ============================================================
   OFA OS — BASE DESIGN SYSTEM
   Fuente de verdad única. Todas las consolas importan este archivo.
   Versión: 2026-06-27 (build v3 — sidebar compacta + responsive fix)
   ============================================================ */

/* ── GOOGLE FONTS ── */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&family=Space+Mono:wght@400;700&display=swap');

/* ══════════════════════════════════════════════
   TOKENS — LIGHT (default)
══════════════════════════════════════════════ */
:root, [data-theme="light"] {
  --bg:           #f1f5f9;
  --sidebar:      #ffffff;
  --card:         #ffffff;
  --topbar-bg:    #ffffff;
  --input-bg:     #f8fafc;

  --text:         #0f172a;
  --text-2:       #334155;
  --muted:        #64748b;
  --muted-2:      #94a3b8;

  --accent:       #334155;
  --accent-light: rgba(51,65,85,0.08);

  --border:       rgba(15,23,42,0.08);
  --shadow:       0 2px 12px rgba(15,23,42,0.06);
  --shadow-md:    0 8px 32px rgba(15,23,42,0.10);

  --success:      #10b981;
  --warning:      #f59e0b;
  --danger:       #ef4444;
  --info:         #0ea5e9;

  --hot:          #f97316;
  --hot-light:    rgba(249,115,22,0.10);

  --radius:       14px;
  --radius-sm:    10px;
  --radius-lg:    20px;
  --sidebar-w:    220px;
  --topbar-h:     56px;
  --transition:   0.2s cubic-bezier(0.4,0,0.2,1);
}

/* ══════════════════════════════════════════════
   TOKENS — DARK
══════════════════════════════════════════════ */
[data-theme="dark"] {
  --bg:           #0f172a;
  --sidebar:      #0a0f18;
  --card:         rgba(30,41,59,0.95);
  --topbar-bg:    #0f172a;
  --input-bg:     rgba(30,41,59,0.6);

  --text:         #f1f5f9;
  --text-2:       #cbd5e1;
  --muted:        #64748b;
  --muted-2:      #475569;

  --accent:       #94a3b8;
  --accent-light: rgba(148,163,184,0.08);

  --border:       rgba(148,163,184,0.10);
  --shadow:       0 2px 12px rgba(0,0,0,0.3);
  --shadow-md:    0 8px 32px rgba(0,0,0,0.4);
}

/* ══════════════════════════════════════════════
   RESET & BASE
══════════════════════════════════════════════ */
*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

html { height: 100%; }

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100%;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
  transition: background var(--transition), color var(--transition);
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* ══════════════════════════════════════════════
   LAYOUT PRINCIPAL
══════════════════════════════════════════════ */
#ofa-app {
  display: flex;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

/* ══════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════ */
.ofa-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  transition: background var(--transition), border-color var(--transition);
}

/* Logo compacto — al estilo LeadMatch: mismo alto que un nav-item */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 4px 14px;   /* reducido de 4px 8px 20px */
  margin-bottom: 4px;
}

.sidebar-logo-mark {
  width: 30px; height: 30px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-weight: 900;
  font-size: 13px;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-weight: 800;
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.3px;
}

/* Subtítulo del logo — muted, pequeño */
.sb-logo-sub {
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.2px;
}

/* Secciones — mantenemos .nav-section-label por compatibilidad legacy */
.nav-section-label,
.sb-section {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted-2);
  padding: 16px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 600;
  font-size: 13.5px;
  transition: all var(--transition);
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item svg {
  width: 16px; height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--accent-light);
  color: var(--text-2);
}

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 700;
}

.nav-spacer { flex: 1; }

.nav-item.nav-bottom {
  color: var(--muted);
  font-size: 13px;
}

/* ══════════════════════════════════════════════
   AREA DE CONTENIDO
══════════════════════════════════════════════ */
.ofa-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  background: var(--bg);
  transition: background var(--transition);
}

/* ══════════════════════════════════════════════
   TOPBAR
══════════════════════════════════════════════ */
.ofa-topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 90;
  transition: background var(--transition), border-color var(--transition);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.topbar-center {
  flex: 1;
  max-width: 360px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Status pill */
.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.15);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  color: var(--success);
  white-space: nowrap;
}

.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

/* Omni search */
.omni-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px 14px;
  transition: all var(--transition);
}

.omni-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.omni-search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  width: 100%;
  min-width: 0;
}

.omni-search input::placeholder { color: var(--muted); }

.omni-shortcut {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted-2);
  background: var(--accent-light);
  padding: 2px 6px;
  border-radius: 5px;
  white-space: nowrap;
}

/* Topbar icon buttons */
.topbar-btn {
  width: 34px; height: 34px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  transition: all var(--transition);
  position: relative;
}

.topbar-btn:hover {
  background: var(--accent-light);
  color: var(--text);
}

.topbar-btn svg {
  width: 16px; height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.notif-badge {
  position: absolute;
  top: 3px; right: 3px;
  background: var(--danger);
  color: white;
  font-size: 9px;
  font-weight: 800;
  min-width: 14px; height: 14px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
  border: 2px solid var(--topbar-bg);
}

/* Avatar */
.topbar-avatar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
  transition: all var(--transition);
}

.topbar-avatar:hover { background: var(--accent-light); }

.avatar-circle {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════
   SCROLL AREA
══════════════════════════════════════════════ */
.ofa-scroll {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.ofa-scroll::-webkit-scrollbar { width: 5px; }
.ofa-scroll::-webkit-scrollbar-track { background: transparent; }
.ofa-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* ══════════════════════════════════════════════
   TAB SYSTEM
══════════════════════════════════════════════ */
.tab-bar {
  display: flex;
  gap: 2px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--topbar-bg);
  flex-shrink: 0;
  overflow-x: auto;
}

.tab-bar::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--muted);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab-btn svg {
  width: 14px; height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.tab-btn:hover { color: var(--text-2); }

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-content { display: none; padding: 24px; flex-direction: column; gap: 20px; }
.tab-content.active { display: flex; }

/* ══════════════════════════════════════════════
   CARDS
══════════════════════════════════════════════ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: background var(--transition), border-color var(--transition);
}

.card-pad { padding: 20px; }
.card-pad-sm { padding: 14px 16px; }

/* ══════════════════════════════════════════════
   KPI CARDS
══════════════════════════════════════════════ */
.kpi-grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }
.kpi-grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }

.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.kpi-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.kpi-val {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}

.kpi-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 500;
}

/* ══════════════════════════════════════════════
   BOTONES
══════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn svg {
  width: 14px; height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { opacity: 0.85; transform: translateY(-1px); }

.btn-hot { background: var(--hot); color: white; }
.btn-hot:hover { background: #ea580c; transform: translateY(-1px); }

.btn-ghost {
  background: var(--accent-light);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--accent); }

.btn-outline {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-outline:hover { color: var(--text); border-color: var(--accent); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 14px; }

/* ══════════════════════════════════════════════
   BADGES & PILLS
══════════════════════════════════════════════ */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
}

.badge-hot   { background: var(--hot-light); color: var(--hot); }
.badge-warm  { background: rgba(245,158,11,0.10); color: #d97706; }
.badge-cold  { background: rgba(100,116,139,0.08); color: var(--muted); }
.badge-ok    { background: rgba(16,185,129,0.10); color: var(--success); }
.badge-warn  { background: rgba(245,158,11,0.10); color: var(--warning); }
.badge-err   { background: rgba(239,68,68,0.10); color: var(--danger); }

/* ══════════════════════════════════════════════
   TABLAS
══════════════════════════════════════════════ */
.table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  box-shadow: var(--shadow);
}

.ofa-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.ofa-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--card);
  white-space: nowrap;
}

.ofa-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.ofa-table tbody tr:last-child td { border-bottom: none; }
.ofa-table tbody tr:hover td { background: var(--accent-light); }

/* ══════════════════════════════════════════════
   INPUTS
══════════════════════════════════════════════ */
.ofa-input {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.ofa-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.ofa-input::placeholder { color: var(--muted-2); }

.ofa-select {
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  outline: none;
  font-family: inherit;
}

.ofa-textarea {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  resize: none;
  width: 100%;
  font-family: inherit;
  line-height: 1.6;
}

.ofa-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* ══════════════════════════════════════════════
   ESTADOS
══════════════════════════════════════════════ */
.loading-state {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  padding: 32px 24px;
}

.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

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

.error-state {
  background: rgba(239,68,68,0.06);
  border: 1px solid rgba(239,68,68,0.15);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12.5px;
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: 8px;
}

.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--muted);
}

.empty-icon {
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-icon svg {
  width: 40px; height: 40px;
  stroke: var(--muted);
  fill: none;
  stroke-width: 1.5;
}

.empty-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.empty-sub {
  font-size: 13px;
  color: var(--muted);
}

/* ══════════════════════════════════════════════
   AVATARES
══════════════════════════════════════════════ */
.lead-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #475569, #334155);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════
   SPACE MONO — para metadatos/datos técnicos
══════════════════════════════════════════════ */
.mono {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
}

/* ══════════════════════════════════════════════
   DARK MODE TOGGLE HELPER
══════════════════════════════════════════════ */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  transition: all var(--transition);
}

.theme-toggle:hover { background: var(--accent-light); color: var(--text); }
.theme-toggle.active,
.nav-item.theme-toggle.active { background: transparent !important; color: var(--muted) !important; box-shadow: none !important; font-weight: 600 !important; }

.theme-toggle svg {
  width: 15px; height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* ══════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════ */

/* ── Tablet: sidebar mini (solo iconos) ── */
@media (max-width: 1100px) {
  .ofa-sidebar {
    width: 64px;
  }
  /* FIX v3: clase real en DOM es .sb-section (antes era .nav-section-label) */
  .ofa-sidebar .sidebar-logo-text,
  .ofa-sidebar .sb-logo-sub,
  .ofa-sidebar .nav-item span,
  .ofa-sidebar .sb-section,
  .ofa-sidebar .nav-section-label,
  .ofa-sidebar .sb-footer-sep { display: none; }
  .ofa-sidebar .nav-item { justify-content: center; padding: 10px; }
  .ofa-sidebar .sidebar-logo { justify-content: center; padding-left: 0; padding-right: 0; }
  .kpi-grid-4 { grid-template-columns: repeat(2,1fr); }
}

/* ── Mobile: sidebar oculto como drawer ── */
@media (max-width: 768px) {
  body { overflow-x: hidden; }

  .ofa-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 240px !important;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 300;
    box-shadow: 4px 0 24px rgba(0,0,0,.18);
  }
  .ofa-sidebar.open {
    transform: translateX(0);
  }
  /* FIX v3: restaurar .sb-section y .sb-logo-sub al abrir en móvil */
  .ofa-sidebar.open .sidebar-logo-text,
  .ofa-sidebar.open .sb-logo-sub,
  .ofa-sidebar.open .nav-item span,
  .ofa-sidebar.open .sb-section,
  .ofa-sidebar.open .nav-section-label { display: block; }
  .ofa-sidebar.open .sb-footer-sep { display: block; height: 1px; }
  .ofa-sidebar.open .nav-item { justify-content: flex-start; padding: 10px 12px; }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.45);
    z-index: 299;
    backdrop-filter: blur(2px);
  }
  .sidebar-overlay.show { display: block; }

  .ofa-content {
    margin-left: 0 !important;
    width: 100%;
  }

  .ofa-topbar {
    padding-left: 8px;
  }
  .hamburger-btn {
    display: flex !important;
  }

  .kpi-grid-4,
  .kpi-grid-3 { grid-template-columns: 1fr 1fr; }

  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .ofa-table { min-width: 600px; }

  .cards-grid,
  .grid-2,
  .grid-3 { grid-template-columns: 1fr !important; }

  .agent-panel,
  .panel-360 {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* Botón hamburguesa */
.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  margin-right: 8px;
  color: var(--text);
  flex-shrink: 0;
}
.hamburger-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ═══════════════════════════════════════════════════════
   AÑADIDOS C1 — WhatsApp · Modal · Toast · Segmented control
═══════════════════════════════════════════════════════ */

:root { --wa: #25d366; --wa-dark: #128c7e; --wa-light: rgba(37,211,102,0.10); }
[data-theme="dark"] { --wa: #25d366; --wa-dark: #128c7e; }

.ofa-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.4);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
}
.ofa-modal {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  max-width: 560px; width: 92%;
  max-height: 85vh; overflow: auto;
  padding: 28px;
}
.ofa-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.ofa-modal-title { font-size: 16px; font-weight: 800; color: var(--text); }
.ofa-modal-close {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--input-bg); border: 1px solid var(--border);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 16px; line-height: 1;
}
.ofa-modal-close:hover { background: var(--accent-light); color: var(--text); }

.ofa-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--card);
  padding: 10px 20px; border-radius: 100px;
  font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-md); z-index: 300;
  animation: ofa-toast-in .25s cubic-bezier(.25,1,.5,1);
  white-space: nowrap;
}
@keyframes ofa-toast-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
}

.segmented {
  display: inline-flex;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 100px; padding: 3px;
}
.segmented button {
  border: none; background: transparent;
  padding: 6px 16px; border-radius: 100px;
  font-size: 12.5px; font-weight: 700;
  color: var(--muted); cursor: pointer;
  transition: all var(--transition);
}
.segmented button.active {
  background: var(--accent); color: #fff;
}
.segmented button:hover:not(.active) {
  color: var(--text-2);
}

img.sidebar-logo-mark {
  background: transparent !important;
  border-radius: 0 !important;
  object-fit: contain;
}

/* ═══════════════════════════════════════════════════════
   VOICE MODULE — ARREGLADO 2026-06-26
═══════════════════════════════════════════════════════ */
.voice-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border: none; border-radius: 50%;
  background: transparent; color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s, transform .1s;
  flex-shrink: 0; position: relative;
}
.voice-btn:hover { background: var(--accent-light); color: var(--text); }
.voice-btn:active { transform: scale(.93); }
.voice-btn svg, .voice-btn .feather {
  width: 18px; height: 18px;
  stroke: currentColor; fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.voice-btn.mic-btn.listening { color: var(--danger); }
.voice-btn.mic-btn.listening::after {
  content: ""; position: absolute;
  width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid var(--danger);
  animation: mic-pulse 1.2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes mic-pulse {
  0% { transform: scale(1); opacity: 1; }
  70%, 100% { transform: scale(1.4); opacity: 0; }
}
.hidden { display: none !important; }
/* === FIN VOICE MODULE === */

/* ═══════════════════════════════════════════════════════
   RESPONSIVE PRO — 2026-06-27 v3
═══════════════════════════════════════════════════════ */

/* ── ESCRITORIO GRANDE (1440px+) ── */
@media (min-width: 1440px) {
  .ofa-scroll > div { max-width: 1600px; }
  .kpi-grid-4 { gap: 16px; }
}

/* ── LAPTOP (1100-1439px) ── */
@media (min-width: 1101px) and (max-width: 1439px) {
  .kpi-grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ── TABLET HORIZONTAL (901-1100px) ── */
@media (min-width: 901px) and (max-width: 1100px) {
  .kpi-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid-3 { grid-template-columns: repeat(3, 1fr); }
  .cards-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ── TABLET VERTICAL (769-900px) ── */
@media (min-width: 769px) and (max-width: 900px) {
  .kpi-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid-3 { grid-template-columns: 1fr 1fr; }
  .cards-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .kpi-val { font-size: 26px; }
}

/* ── MÓVIL GRANDE (481-768px) ── */
@media (min-width: 481px) and (max-width: 768px) {
  .kpi-grid-4, .kpi-grid-3 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-card { padding: 14px; }
  .kpi-val { font-size: 24px; }
  .tab-btn { padding: 14px 14px; }
  .btn { padding: 11px 18px; min-height: 44px; }
  .topbar-avatar span:last-child { display: none; }
}

/* ── MÓVIL PEQUEÑO (≤480px) ── */
@media (max-width: 480px) {
  .ofa-topbar { padding: 0 12px; gap: 8px; }
  .kpi-grid-4, .kpi-grid-3 { grid-template-columns: 1fr; gap: 10px; }
  .kpi-card { padding: 16px 18px; }
  .kpi-val { font-size: 28px; }
  .cards-grid { grid-template-columns: 1fr !important; }
  .tab-bar { padding: 0 12px; }
  .tab-btn { padding: 14px 12px; font-size: 12px; }
  .ofa-scroll > div { padding-left: 14px !important; padding-right: 14px !important; }
  .btn, .tab-btn, .hamburger-btn, .topbar-avatar { min-height: 44px; }
  .topbar-avatar span:last-child { display: none; }
  .topbar-left > div:last-child span { display: none; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .ofa-table { min-width: 520px; }
  .ofa-modal { width: 94%; padding: 20px; border-radius: 16px; }
}

/* ── TÁCTIL ── */
@media (hover: none) {
  .nav-item:hover { background: transparent; }
  .card:hover { transform: none; }
  .nav-item:active { background: var(--accent-light); }
  .btn:active { opacity: 0.7; }
}

/* ── ALTURA PEQUEÑA (landscape) ── */
@media (max-height: 480px) and (orientation: landscape) {
  .ofa-topbar { height: 48px; }
  .kpi-card { padding: 10px 14px; }
}

/* ═══════════════════════════════════════════════════════
   SAFARI / WEBKIT — 2026-06-26
═══════════════════════════════════════════════════════ */

@supports (height: 100dvh) {
  #ofa-app { height: 100dvh; }
  .ofa-sidebar { height: 100dvh; }
}

.ofa-scroll, .table-wrap, .tab-bar {
  -webkit-overflow-scrolling: touch;
}

.ofa-modal-backdrop, .sidebar-overlay {
  -webkit-backdrop-filter: blur(4px);
}

@media (max-width: 768px) {
  .ofa-input, .ofa-select, .ofa-textarea, .omni-search input {
    font-size: 16px;
  }
}
.ofa-input, .ofa-select, .ofa-textarea {
  -webkit-appearance: none;
  appearance: none;
  border-radius: var(--radius-sm);
}

button, a, .nav-item, .tab-btn {
  -webkit-tap-highlight-color: transparent;
}

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

@supports (padding: max(0px)) {
  .ofa-sidebar { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  @media (max-width: 768px) {
    .ofa-topbar { padding-left: max(8px, env(safe-area-inset-left)); }
  }
}
