/*
 * ============================================================
 * AKRIBOS ERP — app.css
 * Tema: Dark Elegant (inspirado en Apple, azul + morado)
 * Versión: 1.0.0
 *
 * ÍNDICE
 * ──────────────────────────────────────────────────────────
 *  1.  Variables CSS (design tokens)
 *  2.  Reset y base
 *  3.  Tipografía
 *  4.  Layout: Auth (login / pantallas sin sidebar)
 *  5.  Layout: ERP (sidebar + main)
 *  6.  Componente: Sidebar
 *  7.  Componente: Topbar
 *  8.  Componente: Formularios e inputs
 *  9.  Componente: Botones
 * 10.  Componente: Mensajes flash y alertas
 * 11.  Componente: Cards genéricos
 * 12.  Componente: Tablas
 * 13.  Componente: Badges y etiquetas
 * 14.  Componente: Barra de progreso
 * 15.  Componente: Dashboard — métricas
 * 16.  Componente: Dashboard — accesos rápidos
 * 17.  Componente: Dashboard — widget lista
 * 18.  Componente: Page header
 * 19.  Utilidades
 * 20.  Animaciones
 * 21.  Responsive (tablet y móvil)
 * ============================================================
 */


/* ============================================================
   1. VARIABLES CSS — Design Tokens
   ============================================================ */
:root {

  /* ── Fondos en capas (de más oscuro a más claro) ── */
  --bg-base:       #09090f;   /* Fondo raíz de la aplicación         */
  --bg-surface:    #0f0f1a;   /* Sidebar, paneles laterales           */
  --bg-raised:     #141424;   /* Cards, inputs, elementos elevados    */
  --bg-hover:      #1a1a2e;   /* Estado hover de filas e ítems        */
  --bg-active:     #1e1e35;   /* Elemento activo / seleccionado       */
  --bg-overlay:    rgba(9,9,15,0.75); /* Fondos de modales            */

  /* ── Bordes ── */
  --border-subtle: rgba(255,255,255,0.055);  /* Divisores casi invisibles */
  --border-soft:   rgba(255,255,255,0.09);   /* Bordes de cards           */
  --border-medium: rgba(255,255,255,0.13);   /* Bordes de inputs focus    */
  --border-strong: rgba(255,255,255,0.20);   /* Bordes activos            */

  /* ── Azul principal — sofisticado, no eléctrico ── */
  --blue:          #4f7fff;
  --blue-dark:     #3a5fcf;
  --blue-deeper:   #2b46a8;
  --blue-muted:    rgba(79,127,255,0.11);
  --blue-glow:     rgba(79,127,255,0.18);
  --blue-text:     #8ab4ff;   /* Azul legible sobre fondo oscuro      */

  /* ── Morado / violeta — acento secundario ── */
  --violet:        #7b61ff;
  --violet-dark:   #5a45cc;
  --violet-deeper: #432fa8;
  --violet-muted:  rgba(123,97,255,0.11);
  --violet-glow:   rgba(123,97,255,0.18);
  --violet-text:   #a992ff;   /* Violeta legible sobre fondo oscuro   */

  /* ── Gradiente de marca (azul → violeta) ── */
  --gradient-brand:  linear-gradient(135deg, var(--blue), var(--violet));
  --gradient-subtle: linear-gradient(135deg,
      rgba(79,127,255,0.08),
      rgba(123,97,255,0.06));

  /* ── Texto ── */
  --text-primary:   #eeeef8;   /* Texto principal                     */
  --text-secondary: #8b8baa;   /* Texto secundario / descriptivo      */
  --text-tertiary:  #52526a;   /* Labels, placeholders, hint          */
  --text-disabled:  #383848;   /* Texto deshabilitado                 */
  --text-inverse:   #09090f;   /* Texto sobre fondos claros           */
  --text-link:      var(--blue-text);

  /* ── Estados — apagados, nunca neón ── */
  --green:          #34c97e;
  --green-dark:     #25a060;
  --green-muted:    rgba(52,201,126,0.09);
  --green-text:     #4eca8a;

  --amber:          #e8a842;
  --amber-dark:     #c08530;
  --amber-muted:    rgba(232,168,66,0.09);
  --amber-text:     #d4a040;

  --red:            #e05555;
  --red-dark:       #b83c3c;
  --red-muted:      rgba(224,85,85,0.09);
  --red-text:       #e07575;

  --teal:           #14b8a6;
  --teal-muted:     rgba(20,184,166,0.09);
  --teal-text:      #2ec4b4;

  --indigo:         #6366f1;
  --indigo-muted:   rgba(99,102,241,0.09);
  --indigo-text:    #8183f5;

  /* ── Tipografía ── */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont,
               'Segoe UI', Helvetica, Arial, sans-serif;

  --text-xs:   0.6875rem;   /*  11px */
  --text-sm:   0.75rem;     /*  12px */
  --text-base: 0.875rem;    /*  14px */
  --text-md:   0.9375rem;   /*  15px */
  --text-lg:   1.0625rem;   /*  17px */
  --text-xl:   1.1875rem;   /*  19px */
  --text-2xl:  1.375rem;    /*  22px */
  --text-3xl:  1.625rem;    /*  26px */
  --text-4xl:  2rem;        /*  32px */

  /* ── Radios de borde ── */
  --r-xs:   4px;
  --r-sm:   6px;
  --r-md:   10px;
  --r-lg:   14px;
  --r-xl:   18px;
  --r-2xl:  24px;
  --r-full: 9999px;

  /* ── Espaciado base ── */
  --sp-1:  0.25rem;   /*  4px */
  --sp-2:  0.5rem;    /*  8px */
  --sp-3:  0.75rem;   /* 12px */
  --sp-4:  1rem;      /* 16px */
  --sp-5:  1.25rem;   /* 20px */
  --sp-6:  1.5rem;    /* 24px */
  --sp-8:  2rem;      /* 32px */
  --sp-10: 2.5rem;    /* 40px */
  --sp-12: 3rem;      /* 48px */

  /* ── Sombras ── */
  --shadow-xs:    0 1px 2px rgba(0,0,0,0.35);
  --shadow-sm:    0 1px 0 rgba(255,255,255,0.04),
                  0 2px 8px rgba(0,0,0,0.35);
  --shadow-md:    0 1px 0 rgba(255,255,255,0.04),
                  0 4px 20px rgba(0,0,0,0.45);
  --shadow-lg:    0 1px 0 rgba(255,255,255,0.04),
                  0 8px 40px rgba(0,0,0,0.55);
  --shadow-float: 0 1px 0 rgba(255,255,255,0.05),
                  0 16px 56px rgba(0,0,0,0.65);

  /* ── Línea de luz (efecto glassmorphism sutil en cards) ── */
  --card-highlight: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255,255,255,0.055) 50%,
    transparent 100%
  );

  /* ── Transiciones ── */
  --t-fast: 120ms ease;
  --t-base: 200ms ease;
  --t-slow: 350ms ease;

  /* ── Dimensiones del layout ── */
  --sidebar-w:   240px;
  --topbar-h:    58px;
}


/* ============================================================
   2. RESET Y BASE
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--text-primary);
  background-color: var(--bg-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100%;
}

img,
svg,
video {
  display: block;
  max-width: 100%;
}

a {
  color: var(--text-link);
  text-decoration: none;
  transition: color var(--t-fast);
}

a:hover {
  color: var(--blue);
}

button,
input,
select,
textarea {
  font-family: var(--font-sans);
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

ul,
ol {
  list-style: none;
}

hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: var(--sp-6) 0;
}


/* ============================================================
   3. TIPOGRAFÍA
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl);  }
h4 { font-size: var(--text-lg);  }
h5 { font-size: var(--text-md);  }
h6 { font-size: var(--text-base); }

p {
  color: var(--text-secondary);
  line-height: 1.65;
}

small {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

strong {
  font-weight: 600;
  color: var(--text-primary);
}

/* Texto con gradiente de marca */
.text-gradient {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}


/* ============================================================
   4. LAYOUT: AUTH (Login y pantallas sin sidebar)
   ============================================================ */
.auth-body {
  background: var(--bg-base);
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}

.auth-wrapper {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* ── Panel izquierdo de branding ── */
.auth-brand {
  flex: 1;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--sp-12) var(--sp-10);
  position: relative;
  overflow: hidden;
}

/* Gradiente ambiental */
.auth-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 50% at 20% 80%,
      rgba(79,127,255,0.08) 0%, transparent 100%),
    radial-gradient(ellipse 50% 40% at 80% 10%,
      rgba(123,97,255,0.07) 0%, transparent 100%);
}

/* Cuadrícula decorativa sutil */
.auth-brand::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 48px 48px;
}

.auth-brand-content {
  position: relative;
  z-index: 1;
}

.auth-brand-footer {
  position: relative;
  z-index: 1;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* Logo en el panel de branding */
.auth-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-10);
}

.auth-logo-mark {
  width: 44px;
  height: 44px;
  background: var(--gradient-brand);
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 20px rgba(79,127,255,0.25);
}

.auth-logo-name {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.05em;
  line-height: 1.1;
}

.auth-logo-sub {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Titular del branding */
.auth-headline {
  font-size: var(--text-4xl);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  line-height: 1.15;
  margin-bottom: var(--sp-4);
}

.auth-desc {
  font-size: var(--text-md);
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--sp-8);
  max-width: 400px;
}

/* Lista de características */
.auth-features {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.auth-feature {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--text-base);
  color: var(--text-secondary);
}

.auth-feature-icon {
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  background: var(--blue-muted);
  border: 1px solid rgba(79,127,255,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  color: var(--blue-text);
  flex-shrink: 0;
}

/* Stats decorativos */
.auth-stats {
  display: flex;
  gap: var(--sp-8);
  margin-top: var(--sp-8);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--border-subtle);
}

.auth-stat-num {
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: 1;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-stat-label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: var(--sp-1);
}

/* ── Panel derecho: formulario ── */
.auth-panel {
  width: 480px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-8) var(--sp-8);
  background: var(--bg-base);
}

.auth-card {
  width: 100%;
  max-width: 360px;
}

/* Cabecera del card de login */
.auth-card-eyebrow {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blue-text);
  margin-bottom: var(--sp-2);
}

.auth-card-title {
  font-size: var(--text-3xl);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: var(--sp-1);
}

.auth-card-subtitle {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-bottom: var(--sp-6);
}

/* Nota de seguridad al pie */
.auth-note {
  margin-top: var(--sp-5);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}


/* ============================================================
   5. LAYOUT: ERP (sidebar + main)
   ============================================================ */
.erp-body {
  display: flex;
  min-height: 100vh;
  background: var(--bg-base);
}

.erp-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.page-content {
  flex: 1;
  padding: var(--sp-8);
  max-width: 1400px;
  width: 100%;
}


/* ============================================================
   6. COMPONENTE: SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.06) transparent;
  transition: transform var(--t-base);
}

.sidebar::-webkit-scrollbar        { width: 4px; }
.sidebar::-webkit-scrollbar-thumb  { background: rgba(255,255,255,0.06); border-radius: 2px; }
.sidebar::-webkit-scrollbar-track  { background: transparent; }

/* Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.sidebar-logo-mark {
  width: 32px;
  height: 32px;
  background: var(--gradient-brand);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  font-size: 0.875rem;
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(79,127,255,0.22);
}

.sidebar-logo-name {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.05em;
  line-height: 1.1;
}

.sidebar-logo-sub {
  font-size: 0.625rem;
  color: var(--text-tertiary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Navegación */
.sidebar-nav {
  flex: 1;
  padding: var(--sp-3) var(--sp-2);
  display: flex;
  flex-direction: column;
  gap: 1px;
}

/* Etiqueta de sección */
.nav-section {
  padding: var(--sp-4) var(--sp-3) var(--sp-2);
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
}

/* Enlace de navegación */
.nav-link {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.4375rem var(--sp-3);
  color: var(--text-secondary);
  font-size: var(--text-base);
  font-weight: 400;
  border-radius: var(--r-sm);
  transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
  overflow: hidden;
}

.nav-link i {
  font-size: 0.9375rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  color: var(--text-tertiary);
  transition: color var(--t-fast);
}

.nav-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-link:hover i {
  color: var(--text-secondary);
}

.nav-link.active {
  background: var(--blue-muted);
  color: var(--blue-text);
  font-weight: 500;
}

.nav-link.active i {
  color: var(--blue);
}

/* Perfil al pie del sidebar */
.sidebar-profile {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.sidebar-avatar {
  width: 30px;
  height: 30px;
  background: linear-gradient(145deg, var(--blue-dark), var(--violet-dark));
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
}

.sidebar-user-name {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.625rem;
  color: var(--text-tertiary);
}

.sidebar-logout {
  color: var(--text-tertiary);
  font-size: 0.9375rem;
  padding: var(--sp-1);
  border-radius: var(--r-xs);
  transition: color var(--t-fast), background var(--t-fast);
  flex-shrink: 0;
}

.sidebar-logout:hover {
  color: var(--red-text);
  background: var(--red-muted);
}


/* ============================================================
   7. COMPONENTE: TOPBAR
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  background: rgba(9,9,15,0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: 0 var(--sp-8);
  flex-shrink: 0;
}

.topbar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  color: var(--text-secondary);
  font-size: 1.125rem;
  transition: background var(--t-fast), color var(--t-fast);
}

.topbar-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.topbar-title {
  flex: 1;
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.topbar-date {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  white-space: nowrap;
}

.topbar-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
  transition: all var(--t-fast);
}

.topbar-icon-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-soft);
  color: var(--text-primary);
}


/* ============================================================
   8. COMPONENTE: FORMULARIOS E INPUTS
   ============================================================ */
.form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

/* Etiqueta */
.form-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  letter-spacing: 0.01em;
}

.form-label i {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* Input, select, textarea */
.form-control {
  width: 100%;
  padding: 0.6875rem var(--sp-4);
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
  appearance: none;
}

.form-control::placeholder {
  color: var(--text-tertiary);
}

.form-control:hover:not(:focus):not(:disabled) {
  border-color: var(--border-medium);
}

.form-control:focus {
  border-color: rgba(79,127,255,0.45);
  background: var(--bg-hover);
  box-shadow: 0 0 0 3px rgba(79,127,255,0.08);
}

.form-control:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.form-control.is-error {
  border-color: rgba(224,85,85,0.45);
  box-shadow: 0 0 0 3px rgba(224,85,85,0.07);
}

/* Campo con contraseña + botón toggle */
.input-password-wrap {
  position: relative;
}

.input-password-wrap .form-control {
  padding-right: 2.75rem;
}

.password-toggle {
  position: absolute;
  right: var(--sp-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 0.875rem;
  padding: var(--sp-1);
  transition: color var(--t-fast);
}

.password-toggle:hover {
  color: var(--text-secondary);
}

/* Select */
select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2352526a' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.25rem;
  cursor: pointer;
}

/* Textarea */
textarea.form-control {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

/* Mensaje de error bajo el input */
.form-error {
  font-size: var(--text-xs);
  color: var(--red-text);
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}


/* ============================================================
   9. COMPONENTE: BOTONES
   ============================================================ */

/* Base */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 0.5625rem var(--sp-5);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 500;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  transition: all var(--t-fast);
  letter-spacing: -0.01em;
  line-height: 1;
}

.btn:disabled,
.btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.btn i { font-size: 0.9375rem; }

/* Variantes */

/* Primario — gradiente de marca */
.btn-primary {
  background: var(--gradient-brand);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 20px rgba(79,127,255,0.18);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: 0 6px 28px rgba(79,127,255,0.28);
  transform: translateY(-1px);
  color: #fff;
}

.btn-primary:active:not(:disabled) {
  filter: brightness(0.96);
  transform: translateY(0);
  box-shadow: none;
}

/* Secundario — borde sutil */
.btn-secondary {
  background: var(--bg-raised);
  color: var(--text-secondary);
  border-color: var(--border-soft);
}

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

/* Ghost — transparente */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

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

/* Peligro */
.btn-danger {
  background: var(--red-muted);
  color: var(--red-text);
  border-color: rgba(224,85,85,0.2);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(224,85,85,0.16);
  border-color: rgba(224,85,85,0.3);
}

/* Tamaños */
.btn-sm {
  padding: 0.375rem var(--sp-3);
  font-size: var(--text-xs);
  border-radius: var(--r-sm);
}

.btn-lg {
  padding: 0.75rem var(--sp-6);
  font-size: var(--text-md);
  font-weight: 600;
  border-radius: var(--r-lg);
}

/* Ancho completo */
.btn-block {
  width: 100%;
}


/* ============================================================
   10. COMPONENTE: MENSAJES FLASH Y ALERTAS
   ============================================================ */
.flash {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0.6875rem var(--sp-4);
  border-radius: var(--r-md);
  font-size: var(--text-base);
  margin-bottom: var(--sp-4);
  border: 1px solid transparent;
}

.flash > i:first-child {
  font-size: 0.9375rem;
  flex-shrink: 0;
}

.flash-text {
  flex: 1;
}

.flash-close {
  color: inherit;
  opacity: 0.5;
  font-size: var(--text-xs);
  padding: 0 var(--sp-1);
  margin-left: auto;
  flex-shrink: 0;
  transition: opacity var(--t-fast);
}

.flash-close:hover {
  opacity: 1;
}

/* Variantes de flash */
.flash-success {
  background: var(--green-muted);
  color: var(--green-text);
  border-color: rgba(52,201,126,0.14);
}

.flash-error {
  background: var(--red-muted);
  color: var(--red-text);
  border-color: rgba(224,85,85,0.14);
}

.flash-warning {
  background: var(--amber-muted);
  color: var(--amber-text);
  border-color: rgba(232,168,66,0.14);
}

.flash-info {
  background: var(--blue-muted);
  color: var(--blue-text);
  border-color: rgba(79,127,255,0.14);
}


/* ============================================================
   11. COMPONENTE: CARDS
   ============================================================ */
.card {
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: relative;
}

/* Línea de luz en la parte superior (efecto Apple) */
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--card-highlight);
  pointer-events: none;
  z-index: 1;
}

.card:hover {
  border-color: var(--border-soft);
}

/* Variante elevada */
.card-elevated {
  box-shadow: var(--shadow-md);
}

/* Variante con acento de color */
.card-accent-blue {
  border-color: rgba(79,127,255,0.18);
  background: linear-gradient(145deg, var(--bg-raised), rgba(79,127,255,0.04));
}

.card-accent-violet {
  border-color: rgba(123,97,255,0.18);
  background: linear-gradient(145deg, var(--bg-raised), rgba(123,97,255,0.04));
}

/* Cabecera del card */
.card-header {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.card-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.card-title i {
  font-size: 0.9375rem;
}

.card-link {
  font-size: var(--text-xs);
  color: var(--blue-text);
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  transition: color var(--t-fast);
}

.card-link:hover {
  color: var(--blue);
}

/* Cuerpo del card */
.card-body {
  padding: var(--sp-5);
}

/* Pie del card */
.card-footer {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
}


/* ============================================================
   12. COMPONENTE: TABLAS
   ============================================================ */
.table-wrap {
  overflow-x: auto;
}

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

thead th {
  padding: 0.5625rem var(--sp-5);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(255,255,255,0.015);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

tbody td {
  padding: 0.75rem var(--sp-5);
  font-size: var(--text-base);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

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

tbody tr {
  transition: background var(--t-fast);
}

tbody tr:hover td {
  background: var(--bg-hover);
}

/* Celda nombre + subtítulo */
.td-name {
  font-weight: 500;
  color: var(--text-primary);
}

.td-sub {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* Celda de monto */
.td-amount {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* Celda de acciones */
.td-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}


/* ============================================================
   13. COMPONENTE: BADGES Y ETIQUETAS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.625rem;
  border-radius: var(--r-full);
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  border: 1px solid transparent;
}

/* Punto de estado antes del texto */
.badge::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* Variantes */
.badge-green {
  background: var(--green-muted);
  color: var(--green-text);
  border-color: rgba(52,201,126,0.14);
}

.badge-amber {
  background: var(--amber-muted);
  color: var(--amber-text);
  border-color: rgba(232,168,66,0.14);
}

.badge-red {
  background: var(--red-muted);
  color: var(--red-text);
  border-color: rgba(224,85,85,0.14);
}

.badge-blue {
  background: var(--blue-muted);
  color: var(--blue-text);
  border-color: rgba(79,127,255,0.14);
}

.badge-violet {
  background: var(--violet-muted);
  color: var(--violet-text);
  border-color: rgba(123,97,255,0.14);
}

.badge-teal {
  background: var(--teal-muted);
  color: var(--teal-text);
  border-color: rgba(20,184,166,0.14);
}

.badge-gray {
  background: rgba(255,255,255,0.04);
  color: var(--text-tertiary);
  border-color: var(--border-subtle);
}

/* Rol (sin punto) */
.badge-role {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.375rem var(--sp-3);
  background: var(--violet-muted);
  border: 1px solid rgba(123,97,255,0.18);
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--violet-text);
}


/* ============================================================
   14. COMPONENTE: BARRA DE PROGRESO
   ============================================================ */
.progress-wrap {
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--r-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--gradient-brand);
  transition: width var(--t-slow);
}

/* Tamaños */
.progress-wrap.sm { height: 3px; }
.progress-wrap.lg { height: 6px; }

/* Etiqueta de porcentaje */
.progress-labeled {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.progress-labeled .progress-wrap {
  flex: 1;
}

.progress-pct {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  min-width: 28px;
  text-align: right;
}


/* ============================================================
   15. COMPONENTE: DASHBOARD — MÉTRICAS
   ============================================================ */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}

.metric-card {
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--sp-5) var(--sp-5);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  box-shadow: var(--shadow-sm);
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
  position: relative;
  overflow: hidden;
}

/* Línea de luz */
.metric-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: var(--card-highlight);
}

.metric-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-soft);
  transform: translateY(-1px);
}

/* Variante directiva (acento azul) */
.metric-card.directivo {
  background: linear-gradient(145deg, var(--bg-raised), rgba(79,127,255,0.04));
  border-color: rgba(79,127,255,0.14);
}

/* Variante de alerta (facturas pendientes) */
.metric-card.alerta {
  border-color: rgba(232,168,66,0.16);
}

/* Ícono de métrica */
.metric-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  flex-shrink: 0;
}

.metric-icon.blue   { background: rgba(79,127,255,0.10);  color: #6a9aff; }
.metric-icon.green  { background: rgba(52,201,126,0.09);  color: #4eca8a; }
.metric-icon.amber  { background: rgba(232,168,66,0.09);  color: #d4a040; }
.metric-icon.violet { background: rgba(123,97,255,0.10);  color: #9b80ff; }
.metric-icon.indigo { background: rgba(99,102,241,0.10);  color: #8183f5; }
.metric-icon.teal   { background: rgba(20,184,166,0.09);  color: #2ec4b4; }
.metric-icon.red    { background: rgba(224,85,85,0.09);   color: #e07575; }

/* Cuerpo de la métrica */
.metric-body {
  flex: 1;
  min-width: 0;
}

.metric-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-label {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-top: 2px;
}

.metric-sub {
  font-size: var(--text-xs);
  color: var(--amber-text);
  font-weight: 500;
  margin-top: 2px;
}

/* Flecha de navegación */
.metric-arrow {
  color: var(--text-tertiary);
  font-size: 1rem;
  flex-shrink: 0;
  transition: color var(--t-fast), transform var(--t-fast);
}

.metric-card:hover .metric-arrow {
  color: var(--blue);
  transform: translateX(2px);
}


/* ============================================================
   16. COMPONENTE: DASHBOARD — ACCESOS RÁPIDOS
   ============================================================ */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-6);
}

.quick-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.5rem var(--sp-4);
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--t-fast);
  box-shadow: var(--shadow-xs);
}

.quick-btn i {
  font-size: 0.875rem;
  color: var(--blue);
}

.quick-btn:hover {
  background: var(--blue-muted);
  border-color: rgba(79,127,255,0.22);
  color: var(--blue-text);
  transform: translateY(-1px);
}


/* ============================================================
   17. COMPONENTE: DASHBOARD — WIDGET LISTA
   ============================================================ */
.widget-list {
  padding: var(--sp-2) 0;
}

.widget-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0.6875rem var(--sp-5);
  transition: background var(--t-fast);
}

.widget-item:hover {
  background: var(--bg-hover);
}

.widget-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9375rem;
  flex-shrink: 0;
}

.widget-body {
  flex: 1;
  min-width: 0;
}

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

.widget-desc {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: 2px;
}


/* ============================================================
   18. COMPONENTE: PAGE HEADER
   ============================================================ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--sp-6);
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.page-header-left {}

.page-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.page-subtitle {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-top: var(--sp-1);
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}

/* Título de sección dentro de una página */
.section-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--sp-4);
  letter-spacing: -0.01em;
}


/* ============================================================
   19. UTILIDADES
   ============================================================ */

/* Texto */
.text-primary   { color: var(--text-primary)   !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-tertiary  { color: var(--text-tertiary)  !important; }
.text-blue      { color: var(--blue-text)      !important; }
.text-violet    { color: var(--violet-text)    !important; }
.text-green     { color: var(--green-text)     !important; }
.text-amber     { color: var(--amber-text)     !important; }
.text-red       { color: var(--red-text)       !important; }

/* Tamaños de texto */
.text-xs   { font-size: var(--text-xs)   !important; }
.text-sm   { font-size: var(--text-sm)   !important; }
.text-base { font-size: var(--text-base) !important; }
.text-md   { font-size: var(--text-md)   !important; }
.text-lg   { font-size: var(--text-lg)   !important; }

/* Pesos */
.font-normal  { font-weight: 400 !important; }
.font-medium  { font-weight: 500 !important; }
.font-semibold{ font-weight: 600 !important; }
.font-bold    { font-weight: 700 !important; }

/* Display */
.d-flex  { display: flex; }
.d-block { display: block; }
.d-none  { display: none; }

/* Flex helpers */
.align-center   { align-items: center; }
.justify-between{ justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-1         { flex: 1; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }

/* Espaciado */
.mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mt-8 { margin-top: var(--sp-8); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }
.mb-8 { margin-bottom: var(--sp-8); }

/* Truncar texto en una línea */
.truncate {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Tabla de números (montos alineados) */
.tabular { font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

/* Divisor */
.divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: var(--sp-6) 0;
}


/* ============================================================
   20. ANIMACIONES
   ============================================================ */

/* Giro para spinners de carga */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.spin {
  animation: spin 0.75s linear infinite;
  display: inline-block;
}

/* Entrada suave de elementos */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-up {
  animation: fade-up 0.22s ease;
}

/* Aplicar a la página al cargar */
.page-content > * {
  animation: fade-up 0.18s ease both;
}

/* Pulso suave (loading skeleton) */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.skeleton {
  background: var(--bg-hover);
  border-radius: var(--r-sm);
  animation: pulse 1.6s ease-in-out infinite;
}


/* ============================================================
   21. RESPONSIVE — Tablet y móvil
   ============================================================ */

/* Tablet grande (< 1280px): reducir sidebar */
@media (max-width: 1280px) {
  :root {
    --sidebar-w: 220px;
  }
}

/* Tablet (< 1024px): ocultar panel de branding en login */
@media (max-width: 1024px) {
  .auth-brand {
    display: none;
  }

  .auth-panel {
    width: 100%;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Móvil (< 768px): sidebar colapsable */
@media (max-width: 768px) {

  /* Sidebar oculto por defecto */
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }

  /* Clase JS para abrirlo */
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-float);
  }

  /* Main ocupa todo el ancho */
  .erp-main {
    margin-left: 0;
  }

  /* Mostrar botón de toggle */
  .topbar-toggle {
    display: flex;
  }

  .topbar {
    padding: 0 var(--sp-4);
  }

  .page-content {
    padding: var(--sp-5);
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-3);
  }

  .quick-actions {
    flex-direction: column;
  }

  .quick-btn {
    width: 100%;
  }
}

/* Móvil pequeño (< 480px) */
@media (max-width: 480px) {
  .auth-panel {
    padding: var(--sp-5);
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
    gap: var(--sp-3);
  }

  .topbar {
    padding: 0 var(--sp-3);
  }

  .topbar-date {
    display: none;
  }
}

/* ============================================================
   SPRINT 2 — ESTILOS ADICIONALES
   Agregar al final de public/css/app.css en Hostinger
   ============================================================ */

/* ── Botón back ──────────────────────────────────────────── */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  color: var(--text-secondary);
  font-size: .8125rem;
  text-decoration: none;
  margin-bottom: .375rem;
  transition: color .15s;
}
.btn-back:hover { color: var(--accent); }

/* ── Badges adicionales ──────────────────────────────────── */
.badge-teal   { background: rgba(20,184,166,.15); color: #2dd4bf; }
.badge-indigo { background: rgba(99,102,241,.15); color: #a5b4fc; }

/* ── Links en tabla ─────────────────────────────────────── */
.td-link { color: var(--text-primary); text-decoration: none; font-weight: 500; }
.td-link:hover { color: var(--accent); }
.link { color: var(--accent); text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ── Paginación ─────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}
.pagination-info { color: var(--text-secondary); font-size: .8125rem; }
.btn-sm { padding: .375rem .75rem; font-size: .8125rem; }

/* ── Detail list ────────────────────────────────────────── */
.detail-list { display: flex; flex-direction: column; gap: .875rem; }
.detail-row  { display: flex; flex-direction: column; gap: .2rem; }
.detail-row dt {
  font-size: .75rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 500;
}
.detail-row dd { color: var(--text-primary); font-size: .9375rem; margin: 0; }

/* ── Form hints y errors ─────────────────────────────────── */
.form-hint  { font-size: .75rem; color: var(--text-tertiary); margin-top: .25rem; }
.form-error { font-size: .75rem; color: #f87171; margin-top: .25rem; }
.is-invalid { border-color: #ef4444 !important; }
.required   { color: #f87171; }

/* ── Botones adicionales ─────────────────────────────────── */
.btn-secondary {
  background: var(--surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-3, var(--surface-2)); filter: brightness(1.1); }

.btn-success {
  background: rgba(34,197,94,.15);
  color: #4ade80;
  border: 1px solid rgba(34,197,94,.3);
}
.btn-success:hover { background: rgba(34,197,94,.25); }

.btn-danger {
  background: rgba(239,68,68,.15);
  color: #f87171;
  border: 1px solid rgba(239,68,68,.3);
}
.btn-danger:hover { background: rgba(239,68,68,.25); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text-primary); }

/* ── Card body ───────────────────────────────────────────── */
.card-body { padding: 1.25rem; }

/* ── Btn icon ────────────────────────────────────────────── */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem; height: 2rem;
  border-radius: .5rem;
  border: none;
  background: var(--surface-2);
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s;
  font-size: .9rem;
}
.btn-icon:hover { background: var(--surface-3, #2a2a3a); color: var(--accent); }
.btn-icon.sm { width: 1.625rem; height: 1.625rem; font-size: .8rem; }
.btn-icon.green:hover { color: #4ade80; }

/* ── Metric card active ──────────────────────────────────── */
.metric-card.active { border-color: var(--accent); }

/* ── Tabular numbers ─────────────────────────────────────── */
.tabular { font-variant-numeric: tabular-nums; font-size: .875rem; }

/* ── Kanban board ────────────────────────────────────────── */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  align-items: start;
  overflow-x: auto;
}
.kanban-col {
  background: var(--surface-1, #13131a);
  border: 1px solid var(--border);
  border-radius: .75rem;
  display: flex;
  flex-direction: column;
  min-height: 200px;
}
.kanban-col-header {
  padding: .875rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kanban-col-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 600;
  font-size: .875rem;
  color: var(--text-primary);
}
.kanban-count {
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: .7rem;
  font-weight: 700;
  padding: .1rem .4rem;
  border-radius: 9999px;
}
.kanban-col-value { font-size: .75rem; color: var(--accent); font-weight: 600; }
.kanban-dot { width: .5rem; height: .5rem; border-radius: 50%; flex-shrink: 0; }
.kanban-dot.blue   { background: var(--accent); }
.kanban-dot.amber  { background: #f59e0b; }
.kanban-dot.violet { background: #a78bfa; }
.kanban-dot.green  { background: #4ade80; }
.kanban-cards { padding: .75rem; display: flex; flex-direction: column; gap: .625rem; }
.kanban-empty {
  text-align: center; padding: 2rem 1rem;
  color: var(--text-tertiary); font-size: .8125rem;
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
}
.kanban-empty i { font-size: 1.5rem; }
.kanban-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: .625rem;
  padding: .875rem;
  display: flex; flex-direction: column; gap: .375rem;
  transition: border-color .15s, box-shadow .15s;
}
.kanban-card:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.kanban-card-title {
  font-weight: 600; font-size: .875rem;
  color: var(--text-primary); text-decoration: none; line-height: 1.3;
}
.kanban-card-title:hover { color: var(--accent); }
.kanban-card-empresa { font-size: .75rem; color: var(--text-secondary); display: flex; align-items: center; gap: .3rem; }
.kanban-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: .125rem; }
.kanban-card-valor  { font-weight: 700; font-size: .875rem; color: var(--accent); }
.kanban-card-prob   { font-size: .75rem; color: var(--text-tertiary); }
.kanban-card-fecha  { font-size: .7rem; color: var(--text-tertiary); display: flex; align-items: center; gap: .3rem; }
.kanban-card-actions {
  display: flex; align-items: center; gap: .375rem;
  padding-top: .375rem; border-top: 1px solid var(--border); margin-top: .25rem;
}
.kanban-select {
  background: var(--surface-1, #13131a);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: .7rem; padding: .2rem .4rem;
  border-radius: .375rem; flex: 1; cursor: pointer;
}

@media (max-width: 900px) { .kanban-board { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .kanban-board { grid-template-columns: 1fr; } }

/* ============================================================
   SPRINT 2 — ESTILOS ADICIONALES
   Agregar al final de public/css/app.css en Hostinger
   ============================================================ */

/* ── Botón back ──────────────────────────────────────────── */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  color: var(--text-secondary);
  font-size: .8125rem;
  text-decoration: none;
  margin-bottom: .375rem;
  transition: color .15s;
}
.btn-back:hover { color: var(--accent); }

/* ── Badges adicionales ──────────────────────────────────── */
.badge-teal   { background: rgba(20,184,166,.15); color: #2dd4bf; }
.badge-indigo { background: rgba(99,102,241,.15); color: #a5b4fc; }

/* ── Links en tabla ─────────────────────────────────────── */
.td-link { color: var(--text-primary); text-decoration: none; font-weight: 500; }
.td-link:hover { color: var(--accent); }
.link { color: var(--accent); text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ── Paginación ─────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}
.pagination-info { color: var(--text-secondary); font-size: .8125rem; }
.btn-sm { padding: .375rem .75rem; font-size: .8125rem; }

/* ── Detail list ────────────────────────────────────────── */
.detail-list { display: flex; flex-direction: column; gap: .875rem; }
.detail-row  { display: flex; flex-direction: column; gap: .2rem; }
.detail-row dt {
  font-size: .75rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 500;
}
.detail-row dd { color: var(--text-primary); font-size: .9375rem; margin: 0; }

/* ── Form hints y errors ─────────────────────────────────── */
.form-hint  { font-size: .75rem; color: var(--text-tertiary); margin-top: .25rem; }
.form-error { font-size: .75rem; color: #f87171; margin-top: .25rem; }
.is-invalid { border-color: #ef4444 !important; }
.required   { color: #f87171; }

/* ── Botones adicionales ─────────────────────────────────── */
.btn-secondary {
  background: var(--surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-3, var(--surface-2)); filter: brightness(1.1); }

.btn-success {
  background: rgba(34,197,94,.15);
  color: #4ade80;
  border: 1px solid rgba(34,197,94,.3);
}
.btn-success:hover { background: rgba(34,197,94,.25); }

.btn-danger {
  background: rgba(239,68,68,.15);
  color: #f87171;
  border: 1px solid rgba(239,68,68,.3);
}
.btn-danger:hover { background: rgba(239,68,68,.25); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text-primary); }

/* ── Card body ───────────────────────────────────────────── */
.card-body { padding: 1.25rem; }

/* ── Btn icon ────────────────────────────────────────────── */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem; height: 2rem;
  border-radius: .5rem;
  border: none;
  background: var(--surface-2);
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s;
  font-size: .9rem;
}
.btn-icon:hover { background: var(--surface-3, #2a2a3a); color: var(--accent); }
.btn-icon.sm { width: 1.625rem; height: 1.625rem; font-size: .8rem; }
.btn-icon.green:hover { color: #4ade80; }

/* ── Metric card active ──────────────────────────────────── */
.metric-card.active { border-color: var(--accent); }

/* ── Tabular numbers ─────────────────────────────────────── */
.tabular { font-variant-numeric: tabular-nums; font-size: .875rem; }

/* ── Kanban board ────────────────────────────────────────── */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  align-items: start;
  overflow-x: auto;
}
.kanban-col {
  background: var(--surface-1, #13131a);
  border: 1px solid var(--border);
  border-radius: .75rem;
  display: flex;
  flex-direction: column;
  min-height: 200px;
}
.kanban-col-header {
  padding: .875rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kanban-col-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 600;
  font-size: .875rem;
  color: var(--text-primary);
}
.kanban-count {
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: .7rem;
  font-weight: 700;
  padding: .1rem .4rem;
  border-radius: 9999px;
}
.kanban-col-value { font-size: .75rem; color: var(--accent); font-weight: 600; }
.kanban-dot { width: .5rem; height: .5rem; border-radius: 50%; flex-shrink: 0; }
.kanban-dot.blue   { background: var(--accent); }
.kanban-dot.amber  { background: #f59e0b; }
.kanban-dot.violet { background: #a78bfa; }
.kanban-dot.green  { background: #4ade80; }
.kanban-cards { padding: .75rem; display: flex; flex-direction: column; gap: .625rem; }
.kanban-empty {
  text-align: center; padding: 2rem 1rem;
  color: var(--text-tertiary); font-size: .8125rem;
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
}
.kanban-empty i { font-size: 1.5rem; }
.kanban-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: .625rem;
  padding: .875rem;
  display: flex; flex-direction: column; gap: .375rem;
  transition: border-color .15s, box-shadow .15s;
}
.kanban-card:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.kanban-card-title {
  font-weight: 600; font-size: .875rem;
  color: var(--text-primary); text-decoration: none; line-height: 1.3;
}
.kanban-card-title:hover { color: var(--accent); }
.kanban-card-empresa { font-size: .75rem; color: var(--text-secondary); display: flex; align-items: center; gap: .3rem; }
.kanban-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: .125rem; }
.kanban-card-valor  { font-weight: 700; font-size: .875rem; color: var(--accent); }
.kanban-card-prob   { font-size: .75rem; color: var(--text-tertiary); }
.kanban-card-fecha  { font-size: .7rem; color: var(--text-tertiary); display: flex; align-items: center; gap: .3rem; }
.kanban-card-actions {
  display: flex; align-items: center; gap: .375rem;
  padding-top: .375rem; border-top: 1px solid var(--border); margin-top: .25rem;
}
.kanban-select {
  background: var(--surface-1, #13131a);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: .7rem; padding: .2rem .4rem;
  border-radius: .375rem; flex: 1; cursor: pointer;
}

@media (max-width: 900px) { .kanban-board { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .kanban-board { grid-template-columns: 1fr; } }


/* ============================================================
   SPRINT 4 — FASES
   ============================================================ */

.fase-row {
  display: flex;
  align-items: flex-start;
  gap: .875rem;
  padding: .875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.fase-row:last-child { border-bottom: none; }
.fase-row:hover { background: var(--surface-2); }
.fase-row.alerta { border-left: 3px solid #ef4444; }

.fase-orden {
  width: 1.75rem; height: 1.75rem;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
  margin-top: .125rem;
}

.fase-body { flex: 1; min-width: 0; }

.fase-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .25rem;
}

.fase-nombre {
  font-weight: 600;
  font-size: .9375rem;
  color: var(--text-primary);
}

.fase-meta {
  display: flex;
  gap: .875rem;
  flex-wrap: wrap;
  font-size: .75rem;
  color: var(--text-tertiary);
}
.fase-meta span {
  display: flex;
  align-items: center;
  gap: .25rem;
}

.fase-acciones {
  display: flex;
  align-items: center;
  gap: .375rem;
  flex-shrink: 0;
}

/* ── Progress bar variants ───────────────────────────────── */
.progress-bar.danger { background: #ef4444; }

/* ── Metric card teal icon ───────────────────────────────── */
.metric-icon.teal    { background: rgba(20,184,166,.15); color: #2dd4bf; }
.metric-icon.gray    { background: var(--surface-2); color: var(--text-secondary); }
.metric-icon.red     { background: rgba(239,68,68,.15); color: #f87171; }

/* ── Card link (header action) ───────────────────────────── */
.card-link {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .8125rem;
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}
.card-link:hover { text-decoration: underline; }

/* ============================================================
   SPRINT 2 — ESTILOS ADICIONALES
   Agregar al final de public/css/app.css en Hostinger
   ============================================================ */

/* ── Botón back ──────────────────────────────────────────── */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  color: var(--text-secondary);
  font-size: .8125rem;
  text-decoration: none;
  margin-bottom: .375rem;
  transition: color .15s;
}
.btn-back:hover { color: var(--accent); }

/* ── Badges adicionales ──────────────────────────────────── */
.badge-teal   { background: rgba(20,184,166,.15); color: #2dd4bf; }
.badge-indigo { background: rgba(99,102,241,.15); color: #a5b4fc; }

/* ── Links en tabla ─────────────────────────────────────── */
.td-link { color: var(--text-primary); text-decoration: none; font-weight: 500; }
.td-link:hover { color: var(--accent); }
.link { color: var(--accent); text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ── Paginación ─────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}
.pagination-info { color: var(--text-secondary); font-size: .8125rem; }
.btn-sm { padding: .375rem .75rem; font-size: .8125rem; }

/* ── Detail list ────────────────────────────────────────── */
.detail-list { display: flex; flex-direction: column; gap: .875rem; }
.detail-row  { display: flex; flex-direction: column; gap: .2rem; }
.detail-row dt {
  font-size: .75rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 500;
}
.detail-row dd { color: var(--text-primary); font-size: .9375rem; margin: 0; }

/* ── Form hints y errors ─────────────────────────────────── */
.form-hint  { font-size: .75rem; color: var(--text-tertiary); margin-top: .25rem; }
.form-error { font-size: .75rem; color: #f87171; margin-top: .25rem; }
.is-invalid { border-color: #ef4444 !important; }
.required   { color: #f87171; }

/* ── Botones adicionales ─────────────────────────────────── */
.btn-secondary {
  background: var(--surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-3, var(--surface-2)); filter: brightness(1.1); }

.btn-success {
  background: rgba(34,197,94,.15);
  color: #4ade80;
  border: 1px solid rgba(34,197,94,.3);
}
.btn-success:hover { background: rgba(34,197,94,.25); }

.btn-danger {
  background: rgba(239,68,68,.15);
  color: #f87171;
  border: 1px solid rgba(239,68,68,.3);
}
.btn-danger:hover { background: rgba(239,68,68,.25); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text-primary); }

/* ── Card body ───────────────────────────────────────────── */
.card-body { padding: 1.25rem; }

/* ── Btn icon ────────────────────────────────────────────── */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem; height: 2rem;
  border-radius: .5rem;
  border: none;
  background: var(--surface-2);
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s;
  font-size: .9rem;
}
.btn-icon:hover { background: var(--surface-3, #2a2a3a); color: var(--accent); }
.btn-icon.sm { width: 1.625rem; height: 1.625rem; font-size: .8rem; }
.btn-icon.green:hover { color: #4ade80; }

/* ── Metric card active ──────────────────────────────────── */
.metric-card.active { border-color: var(--accent); }

/* ── Tabular numbers ─────────────────────────────────────── */
.tabular { font-variant-numeric: tabular-nums; font-size: .875rem; }

/* ── Kanban board ────────────────────────────────────────── */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  align-items: start;
  overflow-x: auto;
}
.kanban-col {
  background: var(--surface-1, #13131a);
  border: 1px solid var(--border);
  border-radius: .75rem;
  display: flex;
  flex-direction: column;
  min-height: 200px;
}
.kanban-col-header {
  padding: .875rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kanban-col-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 600;
  font-size: .875rem;
  color: var(--text-primary);
}
.kanban-count {
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: .7rem;
  font-weight: 700;
  padding: .1rem .4rem;
  border-radius: 9999px;
}
.kanban-col-value { font-size: .75rem; color: var(--accent); font-weight: 600; }
.kanban-dot { width: .5rem; height: .5rem; border-radius: 50%; flex-shrink: 0; }
.kanban-dot.blue   { background: var(--accent); }
.kanban-dot.amber  { background: #f59e0b; }
.kanban-dot.violet { background: #a78bfa; }
.kanban-dot.green  { background: #4ade80; }
.kanban-cards { padding: .75rem; display: flex; flex-direction: column; gap: .625rem; }
.kanban-empty {
  text-align: center; padding: 2rem 1rem;
  color: var(--text-tertiary); font-size: .8125rem;
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
}
.kanban-empty i { font-size: 1.5rem; }
.kanban-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: .625rem;
  padding: .875rem;
  display: flex; flex-direction: column; gap: .375rem;
  transition: border-color .15s, box-shadow .15s;
}
.kanban-card:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.kanban-card-title {
  font-weight: 600; font-size: .875rem;
  color: var(--text-primary); text-decoration: none; line-height: 1.3;
}
.kanban-card-title:hover { color: var(--accent); }
.kanban-card-empresa { font-size: .75rem; color: var(--text-secondary); display: flex; align-items: center; gap: .3rem; }
.kanban-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: .125rem; }
.kanban-card-valor  { font-weight: 700; font-size: .875rem; color: var(--accent); }
.kanban-card-prob   { font-size: .75rem; color: var(--text-tertiary); }
.kanban-card-fecha  { font-size: .7rem; color: var(--text-tertiary); display: flex; align-items: center; gap: .3rem; }
.kanban-card-actions {
  display: flex; align-items: center; gap: .375rem;
  padding-top: .375rem; border-top: 1px solid var(--border); margin-top: .25rem;
}
.kanban-select {
  background: var(--surface-1, #13131a);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: .7rem; padding: .2rem .4rem;
  border-radius: .375rem; flex: 1; cursor: pointer;
}

@media (max-width: 900px) { .kanban-board { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .kanban-board { grid-template-columns: 1fr; } }


/* ============================================================
   SPRINT 4 — FASES
   ============================================================ */

.fase-row {
  display: flex;
  align-items: flex-start;
  gap: .875rem;
  padding: .875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.fase-row:last-child { border-bottom: none; }
.fase-row:hover { background: var(--surface-2); }
.fase-row.alerta { border-left: 3px solid #ef4444; }

.fase-orden {
  width: 1.75rem; height: 1.75rem;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
  margin-top: .125rem;
}

.fase-body { flex: 1; min-width: 0; }

.fase-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .25rem;
}

.fase-nombre {
  font-weight: 600;
  font-size: .9375rem;
  color: var(--text-primary);
}

.fase-meta {
  display: flex;
  gap: .875rem;
  flex-wrap: wrap;
  font-size: .75rem;
  color: var(--text-tertiary);
}
.fase-meta span {
  display: flex;
  align-items: center;
  gap: .25rem;
}

.fase-acciones {
  display: flex;
  align-items: center;
  gap: .375rem;
  flex-shrink: 0;
}

/* ── Progress bar variants ───────────────────────────────── */
.progress-bar.danger { background: #ef4444; }

/* ── Metric card teal icon ───────────────────────────────── */
.metric-icon.teal    { background: rgba(20,184,166,.15); color: #2dd4bf; }
.metric-icon.gray    { background: var(--surface-2); color: var(--text-secondary); }
.metric-icon.red     { background: rgba(239,68,68,.15); color: #f87171; }

/* ── Card link (header action) ───────────────────────────── */
.card-link {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .8125rem;
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}
.card-link:hover { text-decoration: underline; }


/* ============================================================
   SPRINT 5 — FACTURACIÓN
   ============================================================ */
.fila-alerta td { background: rgba(239,68,68,.04); }
.fila-alerta:hover td { background: rgba(239,68,68,.08) !important; }

/* ── Dashboard KPI cards ─────────────────────────────── */
.kpi-card {
  display: flex;
  align-items: flex-start;
  gap: .875rem;
  padding: 1.125rem 1.25rem;
}
.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: .625rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.kpi-body {
  flex: 1;
  min-width: 0;
}
.kpi-label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-tertiary);
  margin-bottom: .25rem;
}
.kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}
.kpi-sub {
  font-size: .75rem;
  color: var(--text-secondary);
  margin-top: .25rem;
}