/* Monlodent - CRMON v3 UI Design System Tokens & Base CSS */
:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --ink: #1f2430;
  --ink-2: #5b6272;
  --ink-3: #8a90a0;
  --line: #e6e8ef;
  --line-2: #d4d8e2;
  --hover: #f1f3f8;
  --accent: #0284c7;
  --accent-ink: #ffffff;
  --accent-soft: #e0f2fe;
  --accent-hover: #0369a1;
  --danger: #d83a52;
  --danger-soft: #fee2e2;
  --ok: #00a36c;
  --ok-soft: #dcf7ea;
  --warn: #e2a400;
  --warn-soft: #fef3c7;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 24, 40, .06), 0 4px 16px rgba(20, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(20, 24, 40, .18);

  --ok-bg: #dcf7ea; --ok-ink: #006b47;
  --bad-bg: #fde3e7; --bad-ink: #a3172e;
  --warn-bg: #fff1d1; --warn-ink: #7a5600; --warn-line: #f1dd9c;
  --side-w: 240px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #14161c;
  --panel: #1c1f27;
  --ink: #e8eaf0;
  --ink-2: #a7adbb;
  --ink-3: #7d8394;
  --line: #2a2e39;
  --line-2: #383d4a;
  --hover: #232733;
  --accent: #38bdf8;
  --accent-ink: #0f172a;
  --accent-soft: #082f49;
  --accent-hover: #7dd3fc;
  --danger: #f43f5e;
  --danger-soft: #4c0519;
  --shadow: 0 1px 2px rgba(0,0,0,.3);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
  --ok-bg: #12382a; --ok-ink: #6ee7b7;
  --bad-bg: #401a22; --bad-ink: #fda4af;
  --warn-bg: #3a3014; --warn-ink: #fcd34d; --warn-line: #5c4a14;
  color-scheme: dark;
}

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

body {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Shell Layout */
.shell {
  display: flex;
  min-height: 100vh;
  transition: all 0.2s ease;
}

/* Menú Lateral con soporte para Colapsado Manual */
.side {
  width: var(--side-w);
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
  transition: width 0.2s ease, transform 0.2s ease;
  overflow: hidden;
  white-space: nowrap;
}

/* Estado del menú colapsado manualmente */
.shell.menu-collapsed .side {
  width: 64px;
}

.shell.menu-collapsed .brand .txt,
.shell.menu-collapsed .nav-cat,
.shell.menu-collapsed .nav-item span:not(.icon),
.shell.menu-collapsed .side-foot span.muted {
  display: none !important;
}

.shell.menu-collapsed .nav-item {
  justify-content: center;
  padding: 10px 0;
}

.shell.menu-collapsed .nav-item .icon {
  margin: 0;
  font-size: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  min-height: 56px;
}

.brand .logo-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  background: linear-gradient(135deg, var(--accent) 0%, #06b6d4 100%);
  color: #fff;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
}

.brand .txt {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.3px;
  display: flex;
  flex-direction: column;
}

.brand .txt small {
  font-size: 10px;
  color: var(--ink-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.side nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-cat {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-3);
  padding: 12px 10px 4px;
  letter-spacing: 0.6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: var(--hover);
  color: var(--ink);
}

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

.nav-item .icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.side-foot {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--ink-3);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Main Content Area */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: padding 0.2s ease;
}

.top {
  height: 56px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.top-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink-3);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.search-btn:hover {
  border-color: var(--line-2);
  color: var(--ink-2);
}

.search-btn kbd {
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  font-family: inherit;
  color: var(--ink-2);
}

.acciones-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Indicador de Presencia y Modo Offline (Similar a Los Pueblos & CRMON v3) */
.online-indicator-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--hover);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-2);
  user-select: none;
  transition: all 0.2s ease;
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.7);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.sync-count-badge {
  background: #f59e0b;
  color: #ffffff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}


.icono-btn {
  background: none;
  border: 1px solid var(--line);
  color: var(--ink-2);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  transition: all 0.15s ease;
}

.icono-btn:hover {
  background: var(--hover);
  color: var(--ink);
}

.user-menu-wrapper {
  position: relative;
  display: inline-block;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 20px;
  background: var(--hover);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
}

.user-badge:hover {
  background: var(--line);
}

.avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
}

[hidden] {
  display: none !important;
}

/* User Dropdown Menu (Inspirado en Los Pueblos & CRMON v3) */
.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 230px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 1000;
  display: none;
  flex-direction: column;
  animation: fadeIn 0.15s ease;
}

.user-dropdown-menu.open {
  display: flex !important;
}


.user-dropdown-header {
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}

.user-role-tag {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.user-name-full {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all 0.15s ease;
}

.user-dropdown-item:hover {
  background: var(--hover);
  color: var(--ink);
}

.user-dropdown-item .item-icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
}

.user-dropdown-item.text-primary {
  color: var(--accent);
}

.user-dropdown-item.text-danger {
  color: var(--danger);
}

.user-dropdown-item.text-danger:hover {
  background: var(--danger-soft);
}

.user-dropdown-divider {
  height: 1px;
  background: var(--line);
  margin: 4px 0;
}


/* View Container - Fluid & Mobile / Tablet First */
.view {
  flex: 1;
  padding: 20px;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

/* Cards & Layout */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kpi .lbl {
  font-size: 12px;
  color: var(--ink-2);
  font-weight: 500;
}

.kpi .val {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.kpi .sub {
  font-size: 11px;
  color: var(--ink-3);
}

/* Tablas Responsivas */
.tbl-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.tbl {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
  min-width: 600px;
}

table.tbl th {
  background: var(--bg);
  padding: 10px 14px;
  color: var(--ink-3);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.tbl td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  vertical-align: middle;
}

table.tbl tbody tr:last-child td {
  border-bottom: none;
}

table.tbl tbody tr.click {
  cursor: pointer;
  transition: background 0.12s ease;
}

table.tbl tbody tr.click:hover {
  background: var(--hover);
}

/* Botones & Inputs */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--line-2);
  background: var(--panel);
  color: var(--ink);
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn:hover {
  background: var(--hover);
}

.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn.danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-2);
}

.btn.ghost:hover {
  background: var(--hover);
  color: var(--ink);
}

.btn.sm {
  padding: 4px 8px;
  font-size: 11.5px;
  border-radius: 6px;
}

.input, select.input, textarea.input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--panel);
  color: var(--ink);
  font-size: 13px;
  font-family: inherit;
  transition: all 0.15s ease;
}

.input:focus, select.input:focus, textarea.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Badges & Pills */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.pill.ok { background: var(--ok-bg); color: var(--ok-ink); }
.pill.bad { background: var(--bad-bg); color: var(--bad-ink); }
.pill.warn { background: var(--warn-bg); color: var(--warn-ink); }

/* Modales & Drawers */
.modal-overlay, .drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}

.modal-box {
  position: relative;
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
}

/* Botón 'X' universal de cierre en modales y drawers */
.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--hover);
  color: var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  z-index: 10;
  transition: all 0.15s ease;
  line-height: 1;
}

.modal-close-btn:hover {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger);
  transform: scale(1.05);
}

/* ── Estilos de Alertas Locales Tipo SweetAlert2 (100% Offline) ── */
.swal-icon-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid;
  animation: scaleIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.swal-success {
  border-color: #10b981;
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

.swal-error {
  border-color: #f43f5e;
  color: #f43f5e;
  background: rgba(244, 63, 94, 0.1);
}

.swal-warning {
  border-color: #f59e0b;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
}

.swal-info {
  border-color: #38bdf8;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
}

.swal-question {
  border-color: #818cf8;
  color: #818cf8;
  background: rgba(129, 140, 248, 0.1);
}

@keyframes scaleIn {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}


.drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 480px;
  max-width: 100%;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  z-index: 101;
  display: flex;
  flex-direction: column;
  animation: slideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Toasts */
.toasts {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: calc(100vw - 40px);
}

.toast {
  pointer-events: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 10px 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  min-width: 240px;
  animation: toastIn 0.2s ease;
}

@keyframes toastIn {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Command Palette (Ctrl+K) */
.cmd-palette {
  width: 560px;
  max-width: 90vw;
  background: var(--panel);
  border-radius: 12px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.cmd-input-wrap {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}

.cmd-input {
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  width: 100%;
  outline: none;
}

.cmd-list {
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
}

.cmd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink);
}

.cmd-item:hover, .cmd-item.selected {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Chatroom Estilo WhatsApp */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 600px;
  max-height: 80vh;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.chat-header {
  padding: 14px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background-color: var(--bg);
}

.chat-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  position: relative;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.chat-bubble.out {
  align-self: flex-end;
  background: #dcf8c6;
  color: #111;
  border-bottom-right-radius: 2px;
}

:root[data-theme="dark"] .chat-bubble.out {
  background: #005c4b;
  color: #e9edef;
}

.chat-bubble.in {
  align-self: flex-start;
  background: var(--panel);
  color: var(--ink);
  border-bottom-left-radius: 2px;
  border: 1px solid var(--line);
}

.chat-meta {
  font-size: 10.5px;
  color: var(--ink-3);
  margin-top: 4px;
  text-align: right;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.chat-input-bar {
  padding: 12px 16px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Media Queries Responsivos (Mobile & Tablet First) */
.sidebar-backdrop {
  display: none;
}

@media (max-width: 900px) {
  .side {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    height: 100vh;
    height: 100dvh;
    z-index: 1000;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
  }

  .shell.mobile-open .side {
    transform: translateX(0);
  }

  .shell.mobile-open .sidebar-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .shell.menu-collapsed .side {
    width: var(--side-w);
    transform: translateX(-100%);
  }

  .top {
    padding: 0 12px;
  }

  .user-badge span:not(.avatar) {
    display: none;
  }

  .search-btn span {
    display: none;
  }

  .view {
    padding: 14px;
  }
}

@media (max-width: 600px) {
  .kpis {
    grid-template-columns: 1fr;
  }

  .modal-box {
    width: 95%;
    padding: 16px;
  }

  .drawer-panel {
    width: 100%;
  }

  .top-left h2 {
    font-size: 14px;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   SELECTOR DESPLEGABLE CON BÚSQUEDA INSTANTÁNEA (COMBOBOX BUSCABLE)
   Filtrado en tiempo real manteniendo la lista abierta
═══════════════════════════════════════════════════════════════════ */
.visually-hidden-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.searchable-select-wrap {
  position: relative;
  width: 100%;
}

.searchable-select-box {
  display: flex;
  align-items: center;
  position: relative;
  width: 100%;
}

.searchable-select-input {
  width: 100%;
  padding-left: 36px;
  padding-right: 58px;
  cursor: text;
  text-overflow: ellipsis;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.searchable-select-input:focus,
.searchable-select-wrap.open .searchable-select-input {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.searchable-select-icon-left {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--ink-3);
  pointer-events: none;
  z-index: 2;
}

.searchable-select-actions {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  z-index: 2;
}

.searchable-select-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  color: var(--ink-3);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.searchable-select-btn:hover {
  background: var(--hover);
  color: var(--ink);
}

.searchable-clear-btn {
  font-size: 13px;
  font-weight: 700;
  display: none;
}

.searchable-select-wrap.has-value .searchable-clear-btn {
  display: flex;
}

.searchable-arrow-btn {
  transition: transform 0.2s ease;
}

.searchable-select-wrap.open .searchable-arrow-btn {
  transform: rotate(180deg);
  color: var(--accent);
}

/* Lista desplegable flotante */
.searchable-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.18), 0 8px 10px -6px rgba(0, 0, 0, 0.12);
  max-height: 280px;
  overflow-y: auto;
  z-index: 1050;
  display: none;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.searchable-select-wrap.open .searchable-dropdown {
  display: block;
  animation: sDropFade 0.15s ease;
}

@keyframes sDropFade {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.searchable-dropdown-header {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg);
  border-bottom: 1px solid var(--line-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.searchable-dropdown-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
}

.searchable-option {
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  transition: background 0.1s ease;
  font-size: 13px;
  border-bottom: 1px solid var(--line-2);
}

.searchable-option:last-child {
  border-bottom: none;
}

.searchable-option:hover,
.searchable-option.active {
  background: var(--hover);
}

.searchable-option.selected {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.searchable-option-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.searchable-option-title {
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.searchable-option.selected .searchable-option-title {
  color: var(--accent);
  font-weight: 600;
}

.searchable-option-sub {
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.searchable-option-mark {
  background: #fef08a;
  color: #854d0e;
  border-radius: 2px;
  padding: 0 2px;
  font-weight: 700;
}

.searchable-option-check {
  font-size: 14px;
  color: var(--accent);
  display: none;
}

.searchable-option.selected .searchable-option-check {
  display: inline-block;
}

.searchable-no-results {
  padding: 18px 14px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
}

.searchable-no-results-icon {
  font-size: 20px;
  margin-bottom: 4px;
  display: block;
}

/* ─── v2.11: suscripción, panel superadmin y NOC ─────────────────────────── */
:root { --serie-1: #0284c7; --serie-2: #8b5cf6; --serie-3: #00a36c; --estado-gris: #9aa1b1; }
:root[data-theme="dark"] { --serie-1: #38bdf8; --serie-2: #a78bfa; --serie-3: #34d399; --estado-gris: #6b7280; }

.banner-suscripcion {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 12px 20px 0; padding: 10px 14px; border-radius: var(--radius); font-size: 13px; line-height: 1.45;
}
.banner-suscripcion.critico { background: var(--bad-bg); color: var(--bad-ink); border: 1px solid var(--danger); }
.banner-suscripcion.aviso { background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--warn-line); }
.banner-suscripcion .btn { flex-shrink: 0; }

/* Semáforo de estado (mismo lenguaje visual que el punto "en línea" de la barra superior) */
.semaforo { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; vertical-align: middle; }
.semaforo.verde { background: #10b981; box-shadow: 0 0 8px rgba(16, 185, 129, .7); }
.semaforo.ambar { background: #f59e0b; box-shadow: 0 0 8px rgba(245, 158, 11, .6); }
.semaforo.rojo { background: #ef4444; box-shadow: 0 0 8px rgba(239, 68, 68, .6); animation: semaforoPulso 1.6s ease-in-out infinite; }
.semaforo.gris { background: var(--estado-gris); }
@keyframes semaforoPulso { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .semaforo.rojo { animation: none; } }

.sa-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.sa-tabs a { padding: 8px 12px; font-size: 13px; font-weight: 600; color: var(--ink-2); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.sa-tabs a:hover { color: var(--ink); }
.sa-tabs a.activo { color: var(--accent); border-bottom-color: var(--accent); }
.sa-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.sa-head h2 { font-size: 18px; font-weight: 700; }
.sa-head p { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.sa-filtros { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.sa-filtros .input { width: auto; min-width: 140px; }
.sa-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; margin-bottom: 14px; }
.kpi .val.pos { color: var(--ok-ink); }
.kpi .delta { font-size: 11px; font-weight: 600; }
.kpi .delta.pos { color: var(--ok-ink); }
.kpi .delta.neg { color: var(--bad-ink); }
.sa-card-titulo { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.sa-card-titulo h3 { font-size: 14px; font-weight: 700; }
.sa-leyenda { display: flex; gap: 12px; font-size: 11.5px; color: var(--ink-2); flex-wrap: wrap; }
.sa-leyenda i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.sa-chart { width: 100%; height: auto; display: block; overflow: visible; }
.sa-chart text { fill: var(--ink-3); font-size: 10px; font-family: inherit; }
.sa-chart .rejilla { stroke: var(--line); stroke-width: 1; }
.sa-chart .barra:hover, .sa-chart .punto:hover { opacity: .8; }
.sa-barras-h { display: flex; flex-direction: column; gap: 8px; }
.sa-barras-h .fila { display: grid; grid-template-columns: 130px 1fr 52px; gap: 8px; align-items: center; font-size: 12px; }
.sa-barras-h .pista { height: 10px; background: var(--hover); border-radius: 5px; overflow: hidden; }
.sa-barras-h .relleno { height: 100%; border-radius: 5px; background: var(--serie-1); }
.sa-barras-h .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.noc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 18px; }
.noc-servicio { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.noc-servicio .semaforo { margin-top: 4px; }
.noc-servicio strong { display: block; font-size: 13px; }
.noc-servicio small { display: block; font-size: 11.5px; color: var(--ink-2); margin-top: 2px; line-height: 1.4; }
.noc-global { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 700; background: var(--hover); border: 1px solid var(--line); }
.sa-vacio { padding: 28px; text-align: center; color: var(--ink-3); font-size: 13px; }
.sa-acciones { display: flex; gap: 4px; flex-wrap: wrap; }
.sa-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.sa-form-grid label { font-size: 12px; font-weight: 600; display: block; margin-bottom: 4px; color: var(--ink-2); }
.sus-planes { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 12px 0 18px; }
.sus-plan { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--panel); display: flex; flex-direction: column; gap: 6px; }
.sus-plan.recomendado { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.sus-plan .precio { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sus-plan .equiv { font-size: 11.5px; color: var(--ink-3); }
@media (max-width: 640px) {
  .banner-suscripcion { margin: 10px 12px 0; }
  .sa-barras-h .fila { grid-template-columns: 90px 1fr 44px; }
  .sa-grid-2 { grid-template-columns: 1fr; }
}

/* Estilos de Impresión */
@media print {
  body * {
    visibility: hidden !important;
  }
  .ticket-print-area, .ticket-print-area * {
    visibility: visible !important;
  }
  .ticket-print-area {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 78mm !important;
    margin: 0 !important;
    padding: 4mm !important;
    border: none !important;
    box-shadow: none !important;
  }
}
