/* ============================================================
   SGS — Sistema de Gestión de Sommelier
   Eljuri Licores · Bootstrap 5 + Fénix UI Kit
   Color principal: Azul Fénix #0071bc (navy #002784 para marca/títulos)
   ============================================================ */

/* ── Variables ──────────────────────────────────────────────── */
/* Los tokens --fx-* (navy, blue, purple, cyan, teal, warning, danger, success…)
   ya llegan definidos por assets/fenix-ui/css/fenix-ui.min.css, cargado antes
   que este archivo. Aquí solo mapeamos los alias que consumen los módulos JS. */
:root {
  /* Alias SGS → Fénix (mantiene los nombres que ya consumen los módulos JS) */
  --wine:        var(--fx-blue);
  --wine-dark:   var(--fx-blue-hover);
  --wine-light:  var(--fx-blue-softer);
  --wine-medium: var(--fx-blue-dark);
  --navy:        var(--fx-navy);

  --bg:          #f3f6f9;
  --surface:     #ffffff;
  --surface-muted: #edf0f3;
  --border:      #d9dee5;
  --border-soft: #e7ebef;
  --text:        #495057;
  --text-muted:  #6c7680;
  --text-faint:  #91a1ad;
  --shadow-sm:   0 1px 3px rgba(50,58,70,.08), 0 1px 2px rgba(50,58,70,.04);
  --shadow-md:   0 2px 8px rgba(50,58,70,.10);
  --shadow-lg:   0 8px 24px rgba(50,58,70,.14);
  --shadow-modal:0 15px 40px rgba(0,0,0,.20);
  --radius-sm:   4px;
  --radius-md:   4px;
  --radius-lg:   8px;
  --radius-xl:   8px;
  --sidebar-w:   240px;
  --topbar-h:    56px;
  --bottom-nav-h:64px;
}

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

/* fenix-ui.css fija html{font-size:.85rem}; el resto de este archivo está
   calibrado en rem sobre una raíz de 16px, así que la restauramos. */
html { font-size: 100%; }

body {
  font-family: "Century Gothic", "Avenir Next", Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c3ccd4; border-radius: 99px; }

/* ── Compat shim (para clases JS que quedan de Bootstrap) ───── */
.d-none   { display: none !important; }
.hidden   { display: none !important; }

/* Ocultar modales en su contenedor — se muestran solo via SGSModal backdrop */
#modals-container .modal { display: none !important; }

/* ══════════════════════════════════════════════════════════════
   LAYOUT
   ══════════════════════════════════════════════════════════ */

#app-shell { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 40;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}
.sidebar-brand img { height: 28px; width: auto; flex-shrink: 0; }
.sidebar-brand-name {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -.01em;
  line-height: 1.2;
}
.sidebar-brand-sub {
  display: block;
  font-size: .625rem;
  color: var(--text-faint);
  letter-spacing: .04em;
  text-transform: uppercase;
  line-height: 1;
}

.sidebar-nav {
  flex: 1;
  list-style: none;
  padding: .5rem .5rem;
  margin: 0;
  overflow-y: auto;
}

.sidebar-section-label {
  font-size: .625rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: .75rem .75rem .25rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .55rem .75rem;
  border-radius: var(--radius-md);
  font-size: .8125rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: background .12s, color .12s;
  cursor: pointer;
  text-decoration: none;
}
.sidebar-link i { font-size: .875rem; width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-link:hover { background: var(--bg); color: var(--text); }
.sidebar-link.active {
  background: var(--wine-light);
  color: var(--wine);
  font-weight: 600;
}
.sidebar-link.active i { color: var(--wine); }

.sidebar-user {
  border-top: 1px solid var(--border-soft);
  padding: .625rem;
  flex-shrink: 0;
}
.sidebar-user-inner {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .5rem .625rem;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: background .12s;
}
.sidebar-user-inner:hover { background: var(--bg); }
.sidebar-user-inner:hover .sidebar-logout-btn { opacity: 1; }

.sidebar-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--wine-light);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-avatar i { color: var(--wine); font-size: 1.1rem; }
.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }

.sidebar-user-info { flex: 1; overflow: hidden; }
.sidebar-user-name { font-size: .8125rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: .6875rem; color: var(--text-faint); }

.sidebar-logout-btn {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: none;
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  cursor: pointer;
  opacity: 0;
  transition: opacity .12s, background .12s, color .12s;
  flex-shrink: 0;
}
.sidebar-logout-btn:hover { background: var(--wine-light); color: var(--wine); }

/* ── Topbar ──────────────────────────────────────────────────── */
#topbar {
  display: flex;
  align-items: center;
  gap: .75rem;
  height: var(--topbar-h);
  padding: 0 1.25rem;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-brand {
  display: none;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
}
.topbar-brand-text { font-weight: 700; font-size: .875rem; color: var(--navy); }

.topbar-breadcrumb {
  display: none;
  align-items: center;
  gap: .375rem;
  font-size: .8125rem;
  flex: 1;
}
.topbar-breadcrumb a { color: var(--text-faint); }
.topbar-breadcrumb a:hover { color: var(--wine); }
.topbar-crumb-sep { font-size: .625rem; color: var(--text-faint); }
.topbar-crumb-active { color: var(--text); font-weight: 500; }

.topbar-title { display: none; flex: 1; text-align: center; font-size: .875rem; font-weight: 600; }
.topbar-date  { font-size: .75rem; color: var(--text-faint); flex-shrink: 0; display: none; }

.topbar-user-wrap { position: relative; flex-shrink: 0; margin-left: auto; }

.topbar-user-btn {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .375rem .625rem .375rem .375rem;
  border: 1px solid transparent;
  border-radius: 9999px;
  background: none;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.topbar-user-btn:hover { background: var(--bg); border-color: var(--border); }

.topbar-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--wine-light);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.topbar-avatar i { color: var(--wine); font-size: .875rem; }
.topbar-avatar img { width: 100%; height: 100%; object-fit: cover; }

.topbar-user-name { font-size: .8125rem; font-weight: 500; display: none; }
.topbar-chevron   { font-size: .625rem; color: var(--text-faint); display: none; }

.topbar-menu {
  position: absolute;
  right: 0; top: calc(100% + .5rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  z-index: 50;
  overflow: hidden;
  padding: .375rem 0;
}
.topbar-menu.hidden { display: none; }
.topbar-menu-header {
  padding: .625rem 1rem .5rem;
  font-size: .6875rem;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--border-soft);
}
.topbar-menu-item {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .625rem 1rem;
  font-size: .8125rem;
  color: var(--text);
  transition: background .1s;
  border: none;
  background: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  text-decoration: none;
}
.topbar-menu-item:hover { background: var(--bg); }
.topbar-menu-item i { font-size: .875rem; color: var(--text-faint); width: 16px; }
.topbar-menu-danger { color: var(--wine) !important; }
.topbar-menu-danger i { color: var(--wine) !important; }
.topbar-menu-divider { border-top: 1px solid var(--border-soft); margin: .25rem 0; }

/* ── Main content ────────────────────────────────────────────── */
#main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

#app {
  flex: 1;
  padding: 1.25rem 1.5rem;
  padding-bottom: 1.5rem;
  overflow-y: auto;
  min-height: 0;    /* hace que overflow-y funcione en flex child */
}

/* ── Bottom nav (mobile) ─────────────────────────────────────── */
#bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 40;
  padding-bottom: env(safe-area-inset-bottom);
}
#bottom-nav-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
}
.bottom-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: .625rem .5rem;
  flex: 1;
  text-decoration: none;
  color: var(--text-faint);
  transition: color .12s;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav-link i { font-size: 1.25rem; line-height: 1; }
.bottom-nav-link span { font-size: .625rem; font-weight: 500; }
.bottom-nav-link.active { color: var(--wine); }
.bottom-nav-link.active i { color: var(--wine); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 767px) {
  #sidebar { transform: translateX(-100%); }
  #main-content { margin-left: 0; height: 100dvh; }
  #app { padding: 1rem; padding-bottom: calc(var(--bottom-nav-h) + 1rem); }
  #bottom-nav { display: block; }
  .topbar-brand { display: flex; }
  .topbar-title  { display: block; }
  .kanban-board { height: calc(100dvh - var(--topbar-h) - var(--bottom-nav-h) - 5rem); }

  /* Tarjetas de KPI del Dashboard: en desktop son una grilla de 7 columnas fijas,
     que en celular las deja ilegibles y corta la última sin avisar. Se convierten
     en una fila deslizable horizontal, como un carrusel de tarjetas. */
  #kpi-cards-row {
    display: flex !important;
    grid-template-columns: none !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding-bottom: .25rem;
  }
  #kpi-cards-row > * {
    flex: 0 0 42%;
    scroll-snap-align: start;
  }
}

@media (min-width: 768px) {
  .topbar-breadcrumb { display: flex; }
  .topbar-date       { display: block; }
  /* El sidebar ya muestra avatar/nombre/perfil/logout en desktop;
     el bloque de usuario del topbar queda solo como trigger móvil. */
  .topbar-user-wrap  { display: none; }
}

/* ══════════════════════════════════════════════════════════════
   MODAL SYSTEM (sin Bootstrap)
   ══════════════════════════════════════════════════════════ */
.sgs-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: fadeIn .15s ease;
}
@media (min-width: 768px) {
  .sgs-backdrop { align-items: center; padding: 1rem; }
}

.sgs-dialog {
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-modal);
  animation: slideUp .2s cubic-bezier(.4,0,.2,1);
}
@media (min-width: 768px) {
  .sgs-dialog {
    border-radius: var(--radius-xl);
    max-width: 520px;
    animation: scaleIn .15s cubic-bezier(.4,0,.2,1);
  }
  .sgs-dialog.lg { max-width: 760px; }
  .sgs-dialog.xl { max-width: 1100px; }
}

.sgs-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.5rem;
  background: var(--navy);
  border-bottom: none;
  flex-shrink: 0;
}
.sgs-modal-title { font-size: 1rem; font-weight: 600; color: #fff; }
.sgs-modal-header .sgs-close-btn { color: rgba(255,255,255,.75); }
.sgs-modal-header .sgs-close-btn:hover { background: rgba(255,255,255,.15); color: #fff; }
.sgs-modal-body  { padding: 1.25rem 1.5rem; overflow-y: auto; flex: 1; }
.sgs-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .5rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-soft);
  flex-shrink: 0;
}

.sgs-close-btn {
  width: 32px; height: 32px;
  border: none; background: none;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-faint);
  font-size: 1.1rem;
  transition: background .1s, color .1s;
}
.sgs-close-btn:hover { background: var(--bg); color: var(--text); }

@keyframes fadeIn   { from { opacity:0 } to { opacity:1 } }
@keyframes slideUp  { from { transform:translateY(40px); opacity:0 } to { transform:translateY(0); opacity:1 } }
@keyframes scaleIn  { from { transform:scale(.96); opacity:0 } to { transform:scale(1); opacity:1 } }

/* ══════════════════════════════════════════════════════════════
   COMPONENTS
   ══════════════════════════════════════════════════════════ */

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .375rem;
  padding: .5rem 1rem;
  font-size: .8125rem; font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .1s;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary  { background: var(--wine); color: #fff; border-color: var(--wine); }
.btn-primary:hover:not(:disabled) { background: var(--wine-dark); border-color: var(--wine-dark); }

.btn-secondary { background: var(--bg); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: #eeebe7; }

.btn-danger   { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

.btn-warning  { background: #d97706; color: #fff; border-color: #d97706; }
.btn-warning:hover:not(:disabled) { background: #b45309; }

.btn-success  { background: #16a34a; color: #fff; border-color: #16a34a; }
.btn-success:hover:not(:disabled) { background: #15803d; }

.btn-outline-primary { background: transparent; color: var(--wine); border-color: var(--wine); }
.btn-outline-primary:hover:not(:disabled) { background: var(--wine-light); }

.btn-outline-secondary { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-outline-secondary:hover:not(:disabled) { background: var(--bg); color: var(--text); }

.btn-outline-danger { background: transparent; color: #dc2626; border-color: #fca5a5; }
.btn-outline-danger:hover:not(:disabled) { background: #fef2f2; }

.btn-outline-success { background: transparent; color: #16a34a; border-color: #86efac; }
.btn-outline-success:hover:not(:disabled) { background: #f0fdf4; }

.btn-outline-warning { background: transparent; color: #d97706; border-color: #fcd34d; }
.btn-outline-warning:hover:not(:disabled) { background: #fffbeb; }

.btn-sm { padding: .35rem .75rem; font-size: .75rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: .9375rem; }
.w-full, .w-100 { width: 100%; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: .2rem .55rem;
  font-size: .6875rem; font-weight: 600;
  border-radius: 9999px;
  line-height: 1.4;
}
.badge-wine    { background: var(--wine-light); color: var(--wine); }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-info    { background: #e0f2fe; color: #0369a1; }
.badge-neutral { background: var(--surface-muted); color: var(--text-muted); }

/* Legacy Bootstrap badge compat */
.badge.bg-primary   { background: var(--wine-light) !important; color: var(--wine) !important; }
.badge.bg-success   { background: #dcfce7 !important; color: #15803d !important; }
.badge.bg-danger    { background: #fee2e2 !important; color: #b91c1c !important; }
.badge.bg-warning   { background: #fef3c7 !important; color: #b45309 !important; }
.badge.bg-secondary { background: var(--surface-muted) !important; color: var(--text-muted) !important; }
.badge.bg-info      { background: #e0f2fe !important; color: #0369a1 !important; }
.badge.bg-dark      { background: var(--surface-muted) !important; color: var(--text) !important; }
.badge.bg-light     { background: var(--bg) !important; color: var(--text) !important; border: 1px solid var(--border); }
.badge.rounded-pill { border-radius: 9999px !important; }
.bg-purple          { background: var(--fx-purple-soft) !important; color: var(--fx-purple) !important; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card.border-0 { border: none; box-shadow: var(--shadow-sm); }
.card.shadow-sm { box-shadow: var(--shadow-sm); }
.card-body   { padding: 1.25rem; }
.card-header {
  padding: .875rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
  font-size: .875rem;
  font-weight: 600;
}
.card-header.bg-white { background: var(--surface); }

/* ── Form controls ───────────────────────────────────────────── */
.form-control, .form-select {
  width: 100%;
  padding: .575rem .875rem;
  font-size: .8125rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  line-height: 1.5;
  appearance: none;
  -webkit-appearance: none;
}
.form-control::placeholder { color: var(--text-faint); }
.form-control:focus, .form-select:focus {
  border-color: var(--wine);
  box-shadow: 0 0 0 3px rgba(0,113,188,.15);
}
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239c9187' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  padding-right: 2.25rem;
  cursor: pointer;
}
.form-label { font-size: .8125rem; font-weight: 600; color: var(--text); display: block; margin-bottom: .375rem; }
.form-control-sm, .form-select-sm { padding: .35rem .75rem; font-size: .75rem; }
.input-group { display: flex; }
.input-group .form-control { border-radius: var(--radius-md) 0 0 var(--radius-md); flex: 1; }
.input-group .btn { border-radius: 0 var(--radius-md) var(--radius-md) 0; border-left: none; }
.input-group-sm .form-control { padding: .35rem .75rem; font-size: .75rem; }
.input-group-text {
  display: flex; align-items: center;
  padding: .575rem .75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  color: var(--text-faint);
  font-size: .8125rem;
}
.input-group .input-group-text + .form-control { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.input-group.input-group-sm .input-group-text { padding: .35rem .625rem; font-size: .75rem; }
.form-check { display: flex; align-items: center; gap: .5rem; }
.form-check-input {
  width: 1rem; height: 1rem;
  border: 1.5px solid var(--border);
  border-radius: .25rem;
  accent-color: var(--wine);
  cursor: pointer;
  flex-shrink: 0;
}
.form-check-label { font-size: .8125rem; color: var(--text); cursor: pointer; }

/* ── Tables ──────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: .8125rem; }
table.table th {
  font-size: .6875rem; font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
  background: var(--surface);
}
table.table td {
  padding: .875rem 1rem;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
  vertical-align: middle;
}
table.table tbody tr:last-child td { border-bottom: none; }
table.table.table-hover tbody tr:hover { background: var(--bg); }
table.table .align-middle td { vertical-align: middle; }

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
  padding: .875rem 1rem;
  border-radius: var(--radius-md);
  font-size: .8125rem;
  display: flex; align-items: flex-start; gap: .5rem;
}
.alert-danger  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── Loading / Empty ─────────────────────────────────────────── */
.sgs-loader {
  display: flex; align-items: center; justify-content: center;
  min-height: 180px; gap: .625rem; color: var(--text-faint);
  flex-direction: column;
}
.sgs-spinner {
  width: 28px; height: 28px;
  border: 2.5px solid var(--border);
  border-top-color: var(--wine);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.sgs-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 180px; gap: .5rem;
  color: var(--text-faint); text-align: center; padding: 2rem;
}
.sgs-empty i { font-size: 2.5rem; opacity: .35; }
.sgs-empty p  { font-size: .875rem; margin: 0; }

/* Bootstrap compat spinner */
.spinner-border {
  display: inline-block;
  width: 1.5rem; height: 1.5rem;
  border: 2px solid var(--border);
  border-top-color: var(--wine);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spinner-border-sm { width: .9rem; height: .9rem; border-width: 1.5px; }
.visually-hidden   { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── Toast ───────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + .75rem);
  right: 1rem;
  z-index: 200;
  display: flex; flex-direction: column; gap: .5rem;
  max-width: 360px; width: calc(100% - 2rem);
}
@media (min-width: 768px) {
  #toast-container { bottom: 1.25rem; }
}
.sgs-toast {
  display: flex; align-items: center; gap: .75rem;
  padding: .875rem 1rem;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  animation: slideUp .2s ease;
  font-size: .8125rem; font-weight: 500;
}
.sgs-toast-success { border-left: 3px solid #16a34a; }
.sgs-toast-danger  { border-left: 3px solid #dc2626; }
.sgs-toast-warning { border-left: 3px solid #d97706; }
.sgs-toast-info    { border-left: 3px solid #0ea5e9; }
.sgs-toast-icon    { font-size: 1rem; flex-shrink: 0; }
.sgs-toast-msg     { flex: 1; color: var(--text); }
.sgs-toast-close   { border: none; background: none; cursor: pointer; color: var(--text-faint); font-size: 1rem; padding: 0; line-height: 1; }

/* ── Pagination ──────────────────────────────────────────────── */
.sgs-pagination { display: flex; gap: .25rem; align-items: center; }
.sgs-page-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .75rem; font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
  cursor: pointer;
  transition: background .1s, color .1s, border-color .1s;
  text-decoration: none;
}
.sgs-page-btn:hover  { background: var(--bg); color: var(--wine); border-color: var(--wine); }
.sgs-page-btn.active { background: var(--wine); color: #fff; border-color: var(--wine); }
.sgs-page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ══════════════════════════════════════════════════════════════
   MODULE-SPECIFIC
   ══════════════════════════════════════════════════════════ */

/* Avatar */
.avatar-thumb {
  width: 36px; height: 36px;
  object-fit: cover; border-radius: 50%;
  flex-shrink: 0;
}
.avatar-thumb-lg {
  width: 80px; height: 80px;
  object-fit: cover; border-radius: 50%;
}

/* KPI */
.kpi-bar-track {
  height: 6px;
  background: var(--border-soft);
  border-radius: 99px;
  overflow: hidden;
}
.kpi-bar-fill  { height: 100%; border-radius: 99px; transition: width .3s ease; }
.kpi-pct-text  { font-size: 1.75rem; font-weight: 700; color: var(--wine); line-height: 1; }
.kpi-card      { transition: box-shadow .2s; }
.kpi-card:hover{ box-shadow: var(--shadow-md); }

/* Semáforo dot */
.semaforo-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

/* Kanban */
.kanban-board {
  display: flex;
  gap: .75rem;
  overflow-x: auto;
  /* Llena toda la altura: viewport − topbar − padding de #app − header del módulo */
  height: calc(100vh - var(--topbar-h) - 6.5rem);
  padding-bottom: .5rem;
  align-items: stretch;
}
.kanban-col   {
  min-width: 270px;
  max-width: 310px;
  flex: 1 0 270px;
  display: flex;
  flex-direction: column;
}
.kanban-col-header {
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  padding: .625rem 1rem;
  font-size: .8125rem; font-weight: 600;
}
.kanban-cards { min-height: 80px; flex: 1; overflow-y: auto; }
.kanban-card { transition: box-shadow .15s, transform .1s; }
.kanban-card.dragging { opacity: .4; transform: rotate(1.5deg); }
.kanban-col.drag-over .kanban-cards { background: var(--wine-light); border-radius: var(--radius-sm); }

/* Cursor "para agarrar" solo en dispositivos con mouse real: en táctiles
   el drag-and-drop HTML5 no responde al dedo, así que no se promete. */
@media (hover: hover) and (pointer: fine) {
  .kanban-card { cursor: grab; }
  .kanban-card:active { cursor: grabbing; }
}

/* QR */
.qr-wrapper canvas, .qr-wrapper img { max-width: 200px; }

/* ── Utility compat ─────────────────────────────────────────────
   Bootstrap 5 real ya provee text-*/fw-*/flex/spacing/grid, así que
   ese shim quedó retirado. Solo se mantienen dos que no son de
   Bootstrap o que llevan color de marca en vez del azul por defecto. */
.text-primary     { color: var(--wine) !important; }
.cursor-pointer   { cursor: pointer; }

/* Login page */
#login-page {
  min-height: 100vh;
  background: linear-gradient(145deg, var(--fx-blue-softer) 0%, var(--bg) 60%, var(--fx-purple-soft) 100%);
}
