/* ============================================================
   VentasPro v2 — Sistema de diseño
   Basado en arquitectura tipo dashboard corporativo (VetSys)
   Soporta temas de marca seleccionables — ver js/theme.js
   ============================================================ */
/* 1. Importamos la fuente Inter desde Google Fonts (incluyendo pesos comunes para SaaS: 300, 400, 500, 600, 700) */
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=DM+Mono:wght@400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; }

:root {
  /* 2. Cambiamos la variable de fuente Sans por Inter */
  --font-sans:      'Inter', sans-serif;
  --font-mono:      'Inter', monospace;

  /* ── Marca (sobrescrita en runtime por js/theme.js) ── */
  --brand:          #00C4CC;
  --brand-dark:     #009AA0;
  --brand-light:    #E0F9FA;
  --brand-mid:      #B3EFF1;

  /* ── Superficies ── */
  --bg:             #F5F6F4;
  --bg-card:        #FFFFFF;
  --bg-sidebar:     #11161A;
  --bg-sidebar-hover:  rgba(255,255,255,.07);
  --bg-sidebar-active: rgba(0,196,204,.18);

  /* ── Texto ── */
  --text-primary:   #161A14;
  --text-secondary: #5B6258;
  --text-tertiary:  #9CA398;
  --text-sidebar:        #B8C2BC;
  --text-sidebar-active: #FFFFFF;

  /* ── Bordes ── */
  --border:         #E5E7E0;
  --border-focus:   var(--brand);

  /* ── Estado ── */
  --success:        #3B6D11;
  --success-bg:     #EAF3DE;
  --warning:         #854F0B;
  --warning-bg:      #FAEEDA;
  --danger:          #A32D2D;
  --danger-bg:       #FCEBEB;
  --info:            var(--brand-dark);
  --info-bg:         var(--brand-light);

  /* ── Layout ── */
  --sidebar-w:      222px;
  --topbar-h:       56px;
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      14px;
  --radius-xl:      20px;
  --shadow-sm:      0 1px 3px rgba(20,24,18,.06), 0 1px 2px rgba(20,24,18,.04);
  --shadow-md:      0 4px 14px rgba(20,24,18,.08), 0 2px 4px rgba(20,24,18,.04);
  --shadow-lg:      0 12px 32px rgba(20,24,18,.14), 0 4px 8px rgba(20,24,18,.06);
  --transition:     all .16s ease;

  /* ── Compat — alias de nombres anteriores, no eliminar ── */
  --cyan:           var(--brand);
  --cyan-dark:      var(--brand-dark);
  --cyan-light:     var(--brand-light);
  --green:          var(--success);
  --green-dark:     var(--success);
  --green-light:    var(--success-bg);
  --grad-brand:     linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  --grad-brand-h:   linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 100%);
  --color-bg:       var(--bg);
  --color-surface:  var(--bg-card);
  --color-border:   var(--border);
  --color-border-2: var(--border);
  --color-text:     var(--text-primary);
  --color-muted:    var(--text-secondary);
  --color-subtle:   var(--text-tertiary);
  --color-success:  var(--success);
  --color-danger:   var(--danger);
  --color-warning:  var(--warning);
  --color-info:     var(--info);
  --radius:         var(--radius-md);
}

/* ══════════════════════════════════════════════════════════
   Modo oscuro — se activa poniendo data-modo="oscuro" en <html>
   (ver js/theme.js). Solo pisa los tokens base — todo lo demás
   en la hoja de estilos ya usa var(--color-*) y hereda solo.
   ══════════════════════════════════════════════════════════ */
html[data-modo="oscuro"] {
  --bg:             #15181C;
  --bg-card:        #1E2126;
  --bg-sidebar:     #0B0E11;
  --bg-sidebar-hover:  rgba(255,255,255,.06);
  --bg-sidebar-active: rgba(0,196,204,.22);

  --text-primary:   #EDEFEC;
  --text-secondary: #9BA39A;
  --text-tertiary:  #6B7269;
  --text-sidebar:        #9BA39A;
  --text-sidebar-active: #FFFFFF;

  --border:         #2B2F33;

  --success:        #6FCB57;
  --success-bg:     #16261A;
  --warning:        #E3A63D;
  --warning-bg:     #2E2410;
  --danger:         #E26969;
  --danger-bg:      #2E1717;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.35), 0 1px 2px rgba(0,0,0,.25);
  --shadow-md: 0 4px 14px rgba(0,0,0,.4), 0 2px 4px rgba(0,0,0,.25);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.5), 0 4px 8px rgba(0,0,0,.3);
}

html { font-size: 14px; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout principal ───────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform .25s ease;
}
.sidebar > div.overflow-y-auto { scrollbar-width: none; }
.sidebar > div.overflow-y-auto::-webkit-scrollbar { display: none; }

.sidebar-logo {
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-logo img { width: 30px; height: 30px; object-fit: contain; flex-shrink: 0; }
.sidebar-logo-name { font-size: 15px; font-weight: 600; color: #fff; letter-spacing: -.01em; }
.sidebar-logo-sub  { font-size: 11px; color: var(--text-sidebar); opacity: .6; }

.sidebar-nav { flex: 1; padding: 8px 0; }

.nav-section-label {
  font-size: 10px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-sidebar); opacity: .4;
  padding: 14px 16px 4px;
}

.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 16px; font-size: 13.5px;
  color: var(--text-sidebar);
  cursor: pointer; position: relative;
  text-decoration: none; user-select: none;
  transition: var(--transition);
}
.nav-item:hover { background: var(--bg-sidebar-hover); color: #fff; text-decoration: none; }
.nav-item.active {
  background: var(--bg-sidebar-active);
  color: var(--text-sidebar-active);
  font-weight: 500;
}
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 4px; bottom: 4px;
  width: 3px; background: var(--brand); border-radius: 0 3px 3px 0;
}
.nav-item svg, .nav-item i { flex-shrink: 0; opacity: .85; }
.nav-item.active svg, .nav-item.active i { opacity: 1; }

.sidebar-footer { padding: 12px 16px 16px; border-top: 1px solid rgba(255,255,255,.06); }
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: var(--radius-md);
  cursor: pointer; transition: var(--transition);
}
.sidebar-user:hover { background: var(--bg-sidebar-hover); }
.sidebar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #fff; flex-shrink: 0;
}
.sidebar-user-name { font-size: 13px; color: #fff; font-weight: 500; }
.sidebar-user-role { font-size: 11px; color: var(--text-sidebar); opacity: .6; }

.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 99;
}
.sidebar-overlay.show { display: block; }

@media (max-width: 1023px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
}

/* ── Área de contenido ──────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1; display: flex; flex-direction: column; min-width: 0;
}

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 22px; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
  gap: 12px;
}
.topbar-left  { display: flex; align-items: center; gap: 12px; }
.topbar-title { font-size: 15px; font-weight: 600; color: var(--text-primary); letter-spacing: -.01em; }
.topbar-breadcrumb { font-size: 12px; color: var(--text-tertiary); }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.hamburger { display: none; }
@media (max-width: 1023px) { .hamburger { display: flex; } }

.btn-icon {
  width: 34px; height: 34px; border-radius: var(--radius-md);
  border: none; background: transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-secondary);
  transition: var(--transition);
}
.btn-icon:hover { background: var(--bg); color: var(--text-primary); }

.badge-notif { position: relative; }
.badge-notif::after {
  content: ''; position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px; background: var(--danger);
  border-radius: 50%; border: 2px solid var(--bg-card);
}

/* ── Página ─────────────────────────────────────────────── */
.page { padding: 22px; flex: 1; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.page-title { font-size: 19px; font-weight: 600; color: var(--text-primary); letter-spacing: -.01em; }
.page-subtitle { font-size: 12.5px; color: var(--text-tertiary); margin-top: 2px; }

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
}
.card-title {
  font-size: 13.5px; font-weight: 600; color: var(--text-primary);
  margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between;
}
.card-title-link { font-size: 12px; font-weight: 500; color: var(--brand-dark); cursor: pointer; }

.vp-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); }

/* ── Métricas ───────────────────────────────────────────── */
.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.metric-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 15px 17px;
  transition: var(--transition);
}
.metric-card:hover { box-shadow: var(--shadow-sm); }
.metric-label { font-size: 11.5px; color: var(--text-tertiary); margin-bottom: 7px; display: flex; align-items: center; gap: 6px; }
.metric-value { font-size: 23px; font-weight: 600; color: var(--text-primary); letter-spacing: -.02em; line-height: 1; margin-bottom: 5px; }
.metric-trend { font-size: 11.5px; display: flex; align-items: center; gap: 3px; }
.metric-trend.up      { color: var(--success); }
.metric-trend.down    { color: var(--danger); }
.metric-trend.neutral { color: var(--text-tertiary); }

/* ── Botones ────────────────────────────────────────────── */
.btn, .btn-primary, .btn-brand, .btn-secondary, .btn-ghost, .btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius-md);
  font-size: 13.5px; font-weight: 500; font-family: var(--font-sans);
  cursor: pointer; border: none; transition: var(--transition);
  white-space: nowrap; text-decoration: none;
}
.btn-primary, .btn-brand {
  background: var(--brand); color: #fff;
  width: auto; box-shadow: none;
}
.btn-primary:hover, .btn-brand:hover { background: var(--brand-dark); color: #fff; text-decoration: none; }
.btn-secondary {
  background: var(--bg); color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Tamaños altos de versión anterior (compat) */
.btn-brand, .btn-primary.h46 {
  height: 46px; padding: 0 22px; font-size: 14px; font-weight: 600;
}
.btn-secondary.h46 { height: 46px; padding: 0 18px; }

/* ── Badges / chips ─────────────────────────────────────── */
.badge, .vp-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 500;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-info    { background: var(--info-bg);    color: var(--info); }
.badge-neutral { background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }
.badge-green  { background: var(--success-bg); color: var(--success); }
.badge-cyan   { background: var(--info-bg);     color: var(--info); }
.badge-red    { background: var(--danger-bg);   color: var(--danger); }
.badge-amber  { background: var(--warning-bg);  color: var(--warning); }
.badge-gray   { background: var(--bg); color: var(--text-secondary); }

/* ── Tablas ─────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto; border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--bg-card);
}
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  padding: 10px 16px; text-align: left;
  font-size: 11px; font-weight: 600; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--border); background: var(--bg);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg); }
tbody td { padding: 11px 16px; color: var(--text-primary); vertical-align: middle; }
.td-secondary { color: var(--text-secondary); font-size: 12.5px; }

/* ── Formularios ────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label, .vp-label {
  display: block; font-size: 12.5px; font-weight: 500;
  color: var(--text-secondary); margin-bottom: 5px;
}
.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control, .vp-input {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  font-size: 13.5px;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  transition: var(--transition);
  outline: none;
  appearance: none;
}
.form-control:focus, .vp-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}
.form-control::placeholder, .vp-input::placeholder { color: var(--text-tertiary); }
select.form-control, select.vp-input { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: 11.5px; color: var(--text-tertiary); margin-top: 4px; }
.form-error, .vp-error {
  font-size: 11px; color: var(--danger); margin-top: 4px; display: none;
}
.form-error.show, .vp-error.show { display: block; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

select.vp-input {
  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='%239CA398' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 34px;
}

/* ── Modal ──────────────────────────────────────────────── */
.modal-overlay, .modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(17,22,17,.45);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
  padding: 16px;
}
.modal-overlay.open, .modal-overlay.show,
.modal-backdrop.open, .modal-backdrop.show {
  opacity: 1; pointer-events: all; display: flex;
}
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 480px; max-height: 90vh;
  overflow-y: auto;
  transform: translateY(10px) scale(.98);
  transition: transform .2s ease;
}
.modal-overlay.open .modal, .modal-overlay.show .modal,
.modal-backdrop.open .modal, .modal-backdrop.show .modal { transform: translateY(0) scale(1); }
.modal-lg { max-width: 680px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.modal-body { padding: 18px 20px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px 18px; border-top: 1px solid var(--border);
}

/* ── Buscador ───────────────────────────────────────────── */
.search-wrap { position: relative; display: inline-flex; align-items: center; }
.search-wrap svg, .search-wrap i {
  position: absolute; left: 11px; color: var(--text-tertiary); pointer-events: none;
}
.search-input {
  padding: 8px 12px 8px 34px;
  font-size: 13.5px; font-family: var(--font-sans);
  border: 1.5px solid var(--border); border-radius: var(--radius-md);
  background: var(--bg-card); color: var(--text-primary);
  outline: none; width: 230px; transition: var(--transition);
}
.search-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}

/* Varias páginas arman el buscador con .vp-input en vez de .search-input
   dentro de .search-wrap — sin esto, la lupa queda pisando el placeholder.
   Un selector más específico que .vp-input solo, sin !important, para que
   gane siempre por especificidad y no por orden de declaración. */
.search-wrap .vp-input { padding-left: 34px; }

/* ── Avatar / iniciales ─────────────────────────────────── */
.pet-avatar, .vp-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-light); color: var(--brand-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; flex-shrink: 0;
}

/* ── Toast ──────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 22px; right: 22px; z-index: 999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; background: var(--bg-sidebar); color: #fff;
  border-radius: var(--radius-lg); font-size: 13.5px;
  box-shadow: var(--shadow-lg); animation: slideUp .25s ease;
  max-width: 320px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--brand); }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ── Spinner ────────────────────────────────────────────── */
.spinner {
  width: 18px; height: 18px; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .65s linear infinite;
  display: inline-block;
}
.spinner.dark { border-color: var(--border); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }

.page-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 280px; gap: 12px; color: var(--text-tertiary); font-size: 13px;
}

/* ── Empty state ────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 44px 22px; text-align: center;
}
.empty-state svg, .empty-state i {
  color: var(--text-tertiary); opacity: .4; margin-bottom: 10px;
}
.empty-state-title { font-size: 14px; font-weight: 600; color: var(--text-secondary); margin-bottom: 5px; }
.empty-state-sub   { font-size: 12.5px; color: var(--text-tertiary); margin-bottom: 14px; }

/* ── Alertas inline ─────────────────────────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 14px; border-radius: var(--radius-md); font-size: 13px;
}
.alert svg, .alert i { margin-top: 1px; flex-shrink: 0; }
.alert-danger  { background: var(--danger-bg);  color: var(--danger); }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-warning { background: var(--warning-bg); color: var(--warning); }
.alert-info    { background: var(--info-bg);    color: var(--info); }

/* ── Tabs ───────────────────────────────────────────────── */
.page-tabs {
  display: flex; gap: 4px; padding: 3px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-md); width: fit-content; margin-bottom: 18px;
}
.page-tab {
  padding: 6px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  cursor: pointer; border: none; background: transparent;
  transition: var(--transition); font-family: var(--font-sans);
}
.page-tab.active { background: var(--bg-card); color: var(--text-primary); box-shadow: var(--shadow-sm); }

/* ── Tema — selector de color de marca ──────────────────── */
.theme-swatch {
  width: 28px; height: 28px; border-radius: 50%;
  cursor: pointer; border: 2px solid transparent;
  transition: transform .15s, border-color .15s;
  flex-shrink: 0; padding: 0;
}
.theme-swatch:hover { transform: scale(1.1); }
.theme-swatch.active { border-color: var(--text-primary); box-shadow: 0 0 0 2px var(--bg-card); }

/* ── Interruptor de modo oscuro ── */
#modo-oscuro-slider::before {
  content: '';
  position: absolute;
  height: 15px; width: 15px;
  left: 2px; top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform .15s;
}
#modo-oscuro-check:checked + #modo-oscuro-slider { background: var(--brand); }
#modo-oscuro-check:checked + #modo-oscuro-slider::before { transform: translateX(15px); }

/* ── Alias de compatibilidad — nombres usados en páginas existentes ── */
.sidebar-bottom    { padding: 12px 16px 16px; border-top: 1px solid rgba(255,255,255,.06); }
.user-chip         { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-md); cursor: pointer; transition: var(--transition); }
.user-chip:hover   { background: var(--bg-sidebar-hover); }
.user-avatar       { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: #fff; flex-shrink: 0; }
.user-name         { font-size: 13px; color: #fff; font-weight: 500; }
.user-role         { font-size: 11px; color: var(--text-sidebar); opacity: .6; }
.nav-label         { font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-sidebar); opacity: .4; padding: 14px 16px 4px; }
.nav-section       { padding: 10px 10px 4px; }
.sidebar-logo span { font-size: 15px; font-weight: 600; color: #fff; letter-spacing: -.01em; }
.nav-badge         { margin-left: auto; font-size: 10px; font-weight: 600; background: var(--brand); color: #fff; padding: 1px 6px; border-radius: 10px; min-width: 18px; text-align: center; }

.panel             { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.panel-header      { padding: 13px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.panel-title       { font-size: 13px; font-weight: 600; color: var(--text-primary); flex: 1; }
.panel-action      { font-size: 11.5px; color: var(--brand-dark); font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; }
.panel-action:hover{ text-decoration: underline; }
.panel-body        { padding: 0; }

.metric-sub        { font-size: 11px; color: var(--text-tertiary); display: flex; align-items: center; gap: 3px; }
.metric-up         { color: var(--success); }
.metric-down       { color: var(--danger); }
.accent-bar        { position: absolute; top: 0; left: 0; right: 0; height: 2px; }

.btn-caja {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 14px;
  background: var(--brand); color: #fff;
  border: none; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: var(--transition); text-decoration: none;
}
.btn-caja:hover { background: var(--brand-dark); color: #fff; text-decoration: none; }

.status-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 500; padding: 3px 10px; border-radius: 20px; cursor: default; }
.status-pill .dot { width: 6px; height: 6px; border-radius: 50%; }
.pill-open  { background: var(--success-bg); color: var(--success); }
.pill-open .dot  { background: var(--success); animation: pulse 2s infinite; }
.pill-closed { background: var(--bg); color: var(--text-secondary); }
.pill-closed .dot { background: var(--text-tertiary); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

.topbar-sub { font-size: 12px; color: var(--text-tertiary); }

.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 80px; padding: 0 16px 12px; }
.bar-col   { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar-fill  { width: 100%; border-radius: 4px 4px 0 0; background: var(--border); transition: background .2s; cursor: pointer; min-height: 4px; }
.bar-fill:hover { background: var(--text-tertiary); }
.bar-fill.today { background: var(--brand); }
.bar-label { font-size: 9px; color: var(--text-tertiary); font-weight: 500; }
.bar-label.today-l { color: var(--brand-dark); font-weight: 600; }

.venta-row  { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); transition: background .1s; }
.venta-row:last-child { border-bottom: none; }
.venta-row:hover { background: var(--bg); }
.venta-num    { font-size: 11px; color: var(--text-tertiary); font-family: var(--font-mono); min-width: 52px; }
.venta-client { font-size: 13px; color: var(--text-primary); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.venta-monto  { font-size: 13px; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; white-space: nowrap; }

.stock-row  { display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--border); }
.stock-row:last-child { border-bottom: none; }
.stock-name  { font-size: 12px; color: var(--text-primary); flex: 1; }
.stock-track { width: 52px; height: 4px; background: var(--border); border-radius: 2px; flex-shrink: 0; }
.stock-fill  { height: 4px; border-radius: 2px; }
.stock-qty   { font-size: 11px; font-family: var(--font-mono); min-width: 28px; text-align: right; }

.top-row   { display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--border); }
.top-row:last-child { border-bottom: none; }
.top-rank  { font-size: 11px; font-family: var(--font-mono); color: var(--text-tertiary); min-width: 18px; text-align: center; }
.top-name  { font-size: 12px; color: var(--text-primary); flex: 1; }
.top-qty   { font-size: 11px; color: var(--text-secondary); }
.top-monto { font-size: 12px; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }

/* ── Utilities ──────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 12.5px; }
.text-muted { color: var(--text-tertiary); }
.text-right { text-align: right; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.w-full { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .form-grid { grid-template-columns: 1fr; } }

.pagination {
  display: flex; align-items: center; padding: 10px 16px;
  border-top: 1px solid var(--border); gap: 8px;
}
.page-btn {
  height: 30px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-card);
  font-size: 12px; font-weight: 500; color: var(--text-secondary);
  cursor: pointer; transition: var(--transition);
}
.page-btn:hover:not(:disabled) { border-color: var(--brand); color: var(--brand-dark); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }
.page-btn.active { background: var(--text-primary); color: #fff; border-color: var(--text-primary); }

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar       { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--brand); }

/* ── Skeleton loader ────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, #f0f0ec 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Fondo grilla sutil (compat onboarding/login) ──────── */
.bg-grid {
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(0,0,0,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,.035) 1px, transparent 1px);
  background-size: 28px 28px;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ── Impresión de ticket — solo se ve el comprobante al imprimir ── */
#ticket-print-hidden { display: none; }
@media print {
  body * { visibility: hidden; }
  #ticket-print-hidden, #ticket-print-hidden * { visibility: visible; }
  #ticket-print-hidden {
    display: block !important;
    position: absolute;
    left: 0; top: 0;
    width: 100%;
  }
  #pagare-print-hidden, #pagare-print-hidden * { visibility: visible; }
  #pagare-print-hidden {
    display: block !important;
    position: absolute;
    left: 0; top: 0;
    width: 100%;
  }
}
