/* ============================================================
   PayDesk — Components
   Importa tokens.css antes de este archivo
   ============================================================ */

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--dark);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
}


.sidebar-header {
  padding: 24px var(--space-xl) 18px;
  border-bottom: 1px solid var(--dark-border);
  flex-shrink: 0;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.logo-mark {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700;
  color: var(--text-on-accent);
  flex-shrink: 0;
  letter-spacing: -0.5px;
}

.logo-name {
  color: var(--text-on-dark);
  font-size: var(--font-lg);
  font-weight: 500;
  letter-spacing: -0.3px;
}

/* Company chip en sidebar */
.sidebar-company {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.company-avatar {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  background: var(--dark-2);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--font-xs); font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}

.company-name {
  color: var(--text-on-dark);
  font-size: var(--font-sm);
  font-weight: 500;
}

.company-sede {
  color: var(--dark-muted);
  font-size: 11px;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
  overflow-y: auto;
}


.nav-new-btn {
  width: 100%;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-on-accent);
  font-size: var(--font-md);
  font-weight: 500;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  transition: background var(--transition);
}

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

.nav-label {
  color: var(--dark-label);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 0 10px;
  margin: 14px 0 5px;
  display: block;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: #666;
  font-size: var(--font-md);
  cursor: pointer;
  margin-bottom: 1px;
  transition: background var(--transition), color var(--transition);
}

.nav-item i { font-size: 16px; flex-shrink: 0; }

.nav-item:hover { background: var(--dark-2); color: #ccc; }

.nav-item.active {
  background: #1A2D2F;
  color: var(--accent);
}

/* Sidebar footer */
.sidebar-footer {
  padding: var(--space-md);
  border-top: 1px solid var(--dark-border);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}

.sidebar-user:hover { background: var(--dark-2); }

.user-avatar-sm {
  width: 30px; height: 30px;
  border-radius: var(--radius-full);
  background: rgba(72, 202, 228, 0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}

.user-name-sm { color: #ccc; font-size: var(--font-sm); font-weight: 500; }
.user-role-sm { color: var(--dark-muted); font-size: 11px; }

/* ── Topbar ──────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-page);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left { display: flex; align-items: center; gap: var(--space-md); }
.topbar-right { display: flex; align-items: center; gap: var(--space-md); }

.topbar-title {
  font-size: var(--font-lg);
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-md);
  color: var(--text-secondary);
}

.topbar-breadcrumb span.current { color: var(--text-primary); font-weight: 500; }

/* Search box */
.search-box {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 7px 12px;
  min-width: 220px;
  transition: border-color var(--transition);
}

.search-box:focus-within { border-color: var(--accent); }

.search-box i { font-size: 15px; color: var(--text-muted); flex-shrink: 0; }

.search-box input {
  border: none;
  background: transparent;
  font-size: var(--font-md);
  color: var(--text-primary);
  outline: none;
  width: 100%;
}

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

/* Notif button */
.notif-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--card);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  position: relative;
  transition: border-color var(--transition);
}

.notif-btn:hover { border-color: var(--accent); }
.notif-btn i { font-size: 17px; color: var(--text-secondary); }

.notif-dot {
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: var(--radius-full);
  position: absolute;
  top: 7px; right: 7px;
  border: 1.5px solid var(--card);
}

/* Panel desplegable de la campanita — lo inyecta assets/js/utils.js dentro
   del .notif-btn (que ya es position:relative). Clases con prefijo propio
   para no chocar con las de la pagina de Notificaciones. */
.notif-panel {
  display: none;
  position: absolute;
  top: calc(100% + var(--space-sm));
  right: 0;
  width: 340px;
  max-width: calc(100vw - var(--space-page) * 2);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  cursor: default;
  text-align: left;
  z-index: 60; /* sobre el contenido de la topbar; los modales van en 200+ */
}

.notif-panel.open { display: block; }

.notif-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--divider);
  font-size: var(--font-md);
  font-weight: 500;
  color: var(--text-primary);
}

.notif-panel-list { max-height: 320px; overflow-y: auto; }

.notif-panel-row {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--divider);
  border-left: 2px solid transparent;
}

.notif-panel-row:last-child { border-bottom: none; }

.notif-panel-row.no-leida {
  background: var(--accent-light);
  border-left-color: var(--accent);
  cursor: pointer;
}

.notif-panel-row.no-leida:hover { border-left-color: var(--accent-hover); }

.notif-panel-titulo { font-size: var(--font-md); font-weight: 500; color: var(--text-primary); }
.notif-panel-desc { font-size: var(--font-sm); color: var(--text-secondary); line-height: 1.4; margin-top: 2px; }
.notif-panel-fecha { font-size: var(--font-xs); color: var(--text-muted); margin-top: 4px; }

.notif-panel-vacio {
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
  font-size: var(--font-md);
  color: var(--text-secondary);
}

.notif-panel-pie {
  padding: var(--space-sm) var(--space-lg);
  border-top: 1px solid var(--divider);
  text-align: center;
}

.notif-panel-pie a {
  font-size: var(--font-sm);
  font-weight: 500;
  color: var(--accent-text);
  text-decoration: none;
}

/* User chip */
.user-chip {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 5px 12px 5px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: border-color var(--transition);
}

.user-chip:hover { border-color: var(--accent); }

.user-chip-avatar {
  width: 26px; height: 26px;
  border-radius: var(--radius-full);
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600;
  color: var(--text-on-accent);
}

.user-chip-name { font-size: var(--font-md); color: #333; font-weight: 500; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.card-sm  { border-radius: var(--radius-md); }
.card-xl  { border-radius: var(--radius-xl); }

.card-hover {
  transition: border-color var(--transition), transform var(--transition);
  cursor: pointer;
}

.card-hover:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px var(--space-lg) 10px;
}

.card-title {
  font-size: var(--font-base);
  font-weight: 500;
  color: var(--text-primary);
}

.card-action {
  font-size: var(--font-sm);
  color: var(--accent);
  cursor: pointer;
  transition: opacity var(--transition);
}

.card-action:hover { opacity: 0.75; }

.card-body { padding: var(--space-lg); }
.card-body-sm { padding: var(--space-md); }

/* ── Metric card ─────────────────────────────────────────────────────────── */
.metric-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px var(--space-xl);
}

.metric-label {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.metric-value {
  font-size: 26px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1;
  margin-bottom: 6px;
}

.metric-delta { font-size: var(--font-sm); color: var(--success); }
.metric-delta.neg { color: var(--danger); }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--font-xs);
  font-weight: 500;
  white-space: nowrap;
}

.badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-warning { background: var(--warning-bg); color: var(--warning-text); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger-text);  }
.badge-info    { background: var(--info-bg);     color: var(--info-text);    }
.badge-accent  { background: var(--accent-light); color: var(--accent-text); }
.badge-neutral { background: var(--surface);     color: var(--text-secondary); }

/* ── Avatares de iniciales ───────────────────────────────────────────────── */
.avatar {
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
}

.avatar-sm  { width: 28px; height: 28px; font-size: 10px; }
.avatar-md  { width: 34px; height: 34px; font-size: 12px; }
.avatar-lg  { width: 40px; height: 40px; font-size: 14px; }
.avatar-round { border-radius: var(--radius-full); }

.avatar-accent  { background: var(--accent-light); color: var(--accent-text); }
.avatar-success { background: var(--success-bg);   color: var(--success-text); }
.avatar-danger  { background: var(--danger-bg);    color: var(--danger-text);  }
.avatar-warning { background: var(--warning-bg);   color: var(--warning-text); }
.avatar-info    { background: var(--info-bg);       color: var(--info-text);    }
.avatar-neutral { background: var(--surface);       color: var(--text-secondary); }

/* ── List items ──────────────────────────────────────────────────────────── */
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px var(--space-lg);
  border-bottom: 1px solid var(--divider);
  transition: background var(--transition);
}

.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--surface); }

.list-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* ── Chat tipo WhatsApp (panel contador) ── */
.chat-layout {
  display: flex;
  height: 100%;
  overflow: hidden;
}
.chat-lista-panel {
  width: 320px;
  min-width: 320px;
  background: var(--card);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.chat-lista-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px var(--space-lg);
  border-bottom: 1px solid var(--divider);
  cursor: pointer;
  transition: background var(--transition);
}
.chat-lista-item:hover { background: var(--surface); }
.chat-lista-item.activo { background: var(--accent-light); }
.chat-lista-item-info { flex: 1; min-width: 0; }
.chat-lista-item-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.chat-lista-item-nombre { font-weight: 500; font-size: var(--font-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-lista-item-hora { font-size: var(--font-xs); color: var(--text-muted); flex-shrink: 0; }
.chat-lista-item-preview { font-size: var(--font-xs); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.chat-lista-badge { background: var(--danger); color: #fff; font-size: 10px; border-radius: 999px; padding: 1px 6px; flex-shrink: 0; }
.chat-conversacion-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.chat-lista-item.activo {
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
  padding-left: calc(var(--space-lg) - 3px);
}
.chat-mensajes-area {
  background-color: var(--surface);
  background-image:
    radial-gradient(circle at 12px 12px, rgba(72,202,228,0.08) 1.5px, transparent 1.5px),
    radial-gradient(circle at 32px 32px, rgba(72,202,228,0.08) 1.5px, transparent 1.5px);
  background-size: 44px 44px;
}
.chat-fecha-separador {
  align-self: center;
  background: var(--card);
  color: var(--text-secondary);
  font-size: var(--font-xs);
  padding: 4px 14px;
  border-radius: var(--radius-full);
  margin: var(--space-sm) 0;
  box-shadow: var(--shadow-sm);
}
.chat-sistema-msg {
  align-self: center;
  background: var(--border);
  color: var(--text-secondary);
  font-size: var(--font-xs);
  font-style: italic;
  text-align: center;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  margin: var(--space-xs) 0;
  max-width: 85%;
}
.chat-bubble-row {
  display: flex;
  flex-direction: column;
  max-width: 68%;
  margin-bottom: 2px;
}
.chat-bubble-row.mio  { align-self: flex-end;   align-items: flex-end; }
.chat-bubble-row.otro { align-self: flex-start; align-items: flex-start; }
.chat-bubble {
  padding: 8px 12px;
  font-size: var(--font-sm);
  line-height: 1.4;
  box-shadow: var(--shadow-sm);
  word-break: break-word;
}
.chat-bubble.mio {
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-xs) var(--radius-lg);
}
.chat-bubble.otro {
  background: var(--card);
  color: var(--text-primary);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) var(--radius-xs);
}
.chat-hora {
  font-size: var(--font-xs);
  color: var(--text-muted);
  margin-top: 2px;
  padding: 0 2px;
}



.list-item-name {
  font-size: var(--font-md);
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item-sub {
  font-size: var(--font-xs);
  color: var(--text-secondary);
}

.list-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
  margin-left: var(--space-md);
}

.list-item-amount {
  font-size: var(--font-md);
  font-weight: 500;
  color: var(--text-primary);
}

/* ── Botones ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: var(--font-md);
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: var(--text-on-accent);
}

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

.btn-dark {
  background: var(--dark);
  color: var(--text-on-dark);
}

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

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

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover { background: var(--surface); color: var(--text-primary); }

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
}

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

.btn-sm { padding: 6px 12px; font-size: var(--font-sm); border-radius: var(--radius-sm); }
.btn-lg { padding: 12px 20px; font-size: var(--font-base); }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ── Inputs ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: var(--space-lg); }

.form-label {
  display: block;
  font-size: var(--font-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  padding: 0 14px;
  font-size: var(--font-md);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}

.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--text-muted); }
.form-input:disabled { background: var(--surface); color: var(--text-muted); }

.form-select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  padding: 0 14px;
  font-size: var(--font-md);
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color var(--transition);
}

.form-select:focus { border-color: var(--accent); }

.form-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  padding: 10px 14px;
  font-size: var(--font-md);
  color: var(--text-primary);
  outline: none;
  resize: vertical;
  min-height: 90px;
  transition: border-color var(--transition);
}

.form-textarea:focus { border-color: var(--accent); }

/* ── Tablas ───────────────────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--card);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead tr {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

th {
  padding: 10px var(--space-lg);
  text-align: left;
  font-size: var(--font-xs);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

td {
  padding: 12px var(--space-lg);
  font-size: var(--font-md);
  color: var(--text-primary);
  border-bottom: 1px solid var(--divider);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface); }

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-xl);
}

.tab-item {
  padding: 10px 16px;
  font-size: var(--font-md);
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition), border-color var(--transition);
}

.tab-item:hover { color: var(--text-primary); }
.tab-item.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }

/* ── Modales ─────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: var(--space-page);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(10px);
  transition: transform var(--transition);
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
}

.modal-title {
  font-size: var(--font-xl);
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: border-color var(--transition);
}

.modal-close:hover { border-color: var(--danger); color: var(--danger); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px var(--space-page);
  color: var(--text-secondary);
  text-align: center;
}

.empty-state i { font-size: 40px; color: var(--text-muted); margin-bottom: var(--space-lg); }
.empty-state h3 { font-size: var(--font-lg); font-weight: 500; color: var(--text-primary); margin-bottom: var(--space-sm); }
.empty-state p { font-size: var(--font-md); color: var(--text-secondary); margin-bottom: var(--space-xl); }

/* ── Estado sin conexión ─────────────────────────────────────────────────── */
.offline-banner {
  position: fixed;
  bottom: var(--space-xl);
  left: 50%;
  transform: translateX(-50%);
  background: var(--dark);
  color: var(--text-on-dark);
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: var(--font-sm);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.offline-banner.visible { opacity: 1; pointer-events: all; }
.offline-banner i { color: var(--danger); }

/* ── Quick action cards ──────────────────────────────────────────────────── */
.quick-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition);
}

.quick-card:hover { border-color: var(--accent); transform: translateY(-1px); }

.quick-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--accent-light);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 10px;
}

.quick-icon i { font-size: 22px; color: var(--accent); }
.quick-card span { font-size: var(--font-sm); color: var(--text-secondary); font-weight: 500; }

/* ── Divider con texto ───────────────────────────────────────────────────── */
.divider-text {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-xl) 0;
}

.divider-text hr { flex: 1; border: none; border-top: 1px solid var(--border); }
.divider-text span { font-size: var(--font-sm); color: var(--text-muted); white-space: nowrap; }

/* ── Tooltip ─────────────────────────────────────────────────────────────── */
[data-tooltip] { position: relative; }

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--dark);
  color: var(--text-on-dark);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
  z-index: 400;
}

[data-tooltip]:hover::after { opacity: 1; }

/* ── POS — Filtros de categoría ──────────────────────────────────────────── */
.cat-filters {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.cat-btn {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--card);
  font-size: var(--font-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-family);
  transition: all var(--transition);
}

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

.cat-btn.active {
  background: var(--dark);
  color: var(--text-on-dark);
  border-color: var(--dark);
}

.subcat-btn {
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--card);
  font-size: var(--font-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-family);
  transition: all var(--transition);
}

.subcat-btn.active {
  border-color: var(--accent);
  color: var(--accent-text);
  background: var(--accent-light);
}

/* ── POS — Grid de productos ─────────────────────────────────────────────── */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.prod-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 12px;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition);
}

.prod-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.prod-card.out-of-stock { opacity: 0.45; pointer-events: none; }

.prod-img {
  width: 100%;
  height: 64px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.prod-img i { font-size: 28px; color: var(--text-muted); }
.prod-img img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.prod-img img + i, .prod-thumb img + i { display: none; }

/* Miniatura en la tabla del catalogo */
.prod-thumb {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: var(--surface);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.prod-thumb img { width: 100%; height: 100%; object-fit: contain; }
.prod-thumb i { font-size: 18px; color: var(--text-muted); }

/* Imagen del producto en el formulario del catalogo */
.prod-img-preview {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.prod-img-preview img { width: 100%; height: 100%; object-fit: contain; }
.prod-img-preview i { font-size: 28px; color: var(--text-muted); }

/* Cuadricula de "Buscar imagen" */
.img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: var(--space-md);
  min-height: 120px;
}
.img-opcion {
  aspect-ratio: 1;
  padding: 6px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.img-opcion:hover, .img-opcion:focus-visible { border-color: var(--accent); }
.img-opcion img { max-width: 100%; max-height: 100%; object-fit: contain; }
.img-grid .empty-state { grid-column: 1 / -1; }
.prod-name { font-size: var(--font-sm); font-weight: 500; color: var(--text-primary); margin-bottom: 4px; line-height: 1.3; }
.prod-price { font-size: var(--font-base); font-weight: 500; color: var(--text-primary); }
.prod-stock { font-size: var(--font-xs); color: var(--text-muted); }
.prod-stock.low { color: var(--danger); }

/* ── POS — Carrito header ────────────────────────────────────────────────── */
.cart-header {
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.cart-title { font-size: 15px; font-weight: 500; color: var(--text-primary); }
.cart-sub { font-size: var(--font-sm); color: var(--text-secondary); margin-top: 2px; }

/* ── POS — Carrito items ─────────────────────────────────────────────────── */
.cart-items {
  flex: 0 1 auto;
  overflow-y: auto;
  padding: var(--space-md) var(--space-xl);
  /* Que siempre quepa al menos un renglon completo (92px) aunque el pie
     crezca: la lista es lo que el cajero necesita ver para saber que cobra. */
  min-height: 132px;
}


.cart-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--divider);
}

.cart-item:last-child { border-bottom: none; }

.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: var(--font-md); font-weight: 500; color: var(--text-primary); }
.cart-item-price { font-size: var(--font-xs); color: var(--text-secondary); margin-top: 2px; }

.cart-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.cart-item-total { font-size: var(--font-md); font-weight: 500; color: var(--text-primary); }

/* ── POS — Controles de cantidad ─────────────────────────────────────────── */
.qty-controls { display: flex; align-items: center; gap: var(--space-sm); }

.qty-btn {
  width: 24px; height: 24px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  transition: border-color var(--transition);
}

.qty-btn:hover { border-color: var(--accent); color: var(--accent); }
.qty-val { font-size: var(--font-md); font-weight: 500; min-width: 18px; text-align: center; }

.del-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 14px; padding: 0;
  transition: color var(--transition);
}

.del-btn:hover { color: var(--danger); }

/* ── POS — Cart footer ───────────────────────────────────────────────────── */
.cart-footer {
  padding: var(--space-lg) var(--space-xl);
  border-top: 1px solid var(--border);
  /* El pie fue creciendo (descuento, totales, CFDI, efectivo recibido, cambio,
     pago mixto) hasta medir mas que el panel entero: con flex-shrink:0 no cedia
     ni un pixel y aplastaba la lista de articulos a 24px de alto. El producto
     SI entraba al carrito, pero el renglon quedaba recortado y parecia que el
     boton no hacia nada. Ahora el pie cede espacio y se desplaza por dentro. */
  flex-shrink: 1;
  min-height: 0;
  max-height: 70vh;
  overflow-y: auto;
}

.discount-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-md);
  cursor: pointer;
  transition: background var(--transition);
}

.discount-row:hover { background: var(--accent-light); }
.discount-row span { font-size: var(--font-sm); color: var(--text-secondary); }
.discount-val { font-size: var(--font-sm); color: var(--accent-text); font-weight: 500; }

/* ── POS — Totales ───────────────────────────────────────────────────────── */
.totals { margin-bottom: var(--space-md); }

.total-row {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-md);
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.total-row.main {
  color: var(--text-primary);
  font-size: var(--font-lg);
  font-weight: 500;
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border);
}

/* ── POS — Métodos de pago ───────────────────────────────────────────────── */
.pay-methods {
  display: flex;
  gap: 6px;
  margin-bottom: var(--space-md);
}

.pay-btn {
  flex: 1;
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  font-size: var(--font-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-family);
  transition: all var(--transition);
  text-align: center;
}

.pay-btn.active {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent-text);
  font-weight: 500;
}

/* ── POS — CFDI checkbox ─────────────────────────────────────────────────── */
.cfdi-check {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.cfdi-check input { accent-color: var(--accent); }
.cfdi-check label { font-size: var(--font-sm); color: var(--text-secondary); cursor: pointer; }

/* ── POS — Botón cobrar ──────────────────────────────────────────────────── */
.cobrar-btn {
  width: 100%;
  margin-top: var(--space-md);
  height: 46px;
  background: var(--dark);
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-on-dark);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-family);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  transition: background var(--transition);
}

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

/* ── POS — Client chip en topbar ─────────────────────────────────────────── */
.client-chip {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  background: var(--card);
  transition: border-color var(--transition);
  font-size: var(--font-md);
  color: var(--text-secondary);
}

.client-chip:hover { border-color: var(--accent); }
.client-chip .avatar { width: 22px; height: 22px; font-size: 9px; border-radius: var(--radius-full); }
/* FIX: .totals se estaba renderizando con una altura anormal (~1095px) por
   causa aun no identificada. Se fuerza altura de contenido. */
.totals {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  display: block !important;
}
.total-row {
  height: auto !important;
  max-height: 30px !important;
  line-height: normal !important;
  overflow: visible !important;
  white-space: nowrap !important;
}
.total-row.main {
  max-height: 40px !important;
}
