/* ============================================================
   EFFIZA STOCK SYSTEM — Estilos principales
   Paleta: #1C4B69 (azul), #65BF65 (verde), #ADDDAD (menta)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

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

:root {
  --blue:       #1C4B69;
  --blue-dark:  #163a52;
  --blue-light: #2a6490;
  --green:      #65BF65;
  --green-dark: #4da34d;
  --mint:       #ADDDAD;
  --mint-light: #EFF8EF;
  --white:      #ffffff;
  --gray-50:    #f8f9fa;
  --gray-100:   #f0f2f5;
  --gray-200:   #e2e8f0;
  --gray-400:   #94a3b8;
  --gray-600:   #475569;
  --gray-800:   #1e293b;
  --danger:     #dc3545;
  --warning:    #f59e0b;
  --sidebar-w:  248px;
  --radius:     8px;
  --shadow:     0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --shadow-md:  0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

body {
  font-family: 'Montserrat', sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}

a { text-decoration: none; color: inherit; }

/* ============================================================
   LAYOUT
   ============================================================ */

.layout {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
  width: var(--sidebar-w);
  background: var(--blue);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: var(--green);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: white;
  flex-shrink: 0;
}

.sidebar-logo .logo-text {
  font-size: 18px; font-weight: 700; letter-spacing: 0.5px;
}

.sidebar-logo .logo-sub {
  font-size: 9px; font-weight: 400; opacity: 0.7; letter-spacing: 1px; text-transform: uppercase;
}

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

.nav-section {
  margin-bottom: 4px;
}

.nav-section-label {
  padding: 8px 20px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  opacity: 0.5;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.8);
  transition: all .15s;
  border-left: 3px solid transparent;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: white;
}

.nav-item.active {
  background: rgba(255,255,255,0.12);
  color: white;
  border-left-color: var(--green);
}

.nav-item i {
  font-size: 15px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-user {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user .user-avatar {
  width: 34px; height: 34px;
  background: var(--green);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: white;
  flex-shrink: 0;
}

.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-role { font-size: 10px; opacity: 0.6; }

.sidebar-user .logout-btn {
  color: rgba(255,255,255,0.5);
  font-size: 16px;
  padding: 4px;
  transition: color .15s;
}
.sidebar-user .logout-btn:hover { color: var(--danger); }

/* ============================================================
   MAIN CONTENT
   ============================================================ */

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

/* Stack pegajoso: banner de superadmin (si lo hay) + topbar, siempre visibles. */
.topbar-stack {
  position: sticky; top: 0; z-index: 50;
}

.superadmin-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 28px;
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
}
.superadmin-bar .sa-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .7px;
  white-space: nowrap;
}
.superadmin-bar .sa-label i { font-size: 16px; }
.superadmin-bar .sa-mid { flex: 1; min-width: 0; }
.superadmin-bar .sa-empresa {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, .25);
  padding: 2px 13px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 14px;
}
.superadmin-bar .sa-empresa.sa-none { background: rgba(0, 0, 0, .18); }
.superadmin-bar .sa-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  color: #1e293b;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.superadmin-bar .sa-btn:hover { background: #eef2ff; color: #4f46e5; }

.superadmin-bar.sa-active {
  background: linear-gradient(90deg, #4f46e5, #7c3aed);
}
.superadmin-bar.sa-warning {
  background: linear-gradient(90deg, #d97706, #dc2626);
  animation: saPulse 1.8s ease-in-out infinite;
}
@keyframes saPulse {
  0%, 100% { filter: brightness(1); }
  50%      { filter: brightness(1.15); }
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
}

.topbar-title { font-size: 17px; font-weight: 600; color: var(--blue); }
.topbar-sub { font-size: 12px; color: var(--gray-400); margin-top: 1px; }

.content {
  padding: 24px 28px;
  flex: 1;
}

/* ============================================================
   FLASH MESSAGES
   ============================================================ */

.flash-container {
  margin-bottom: 16px;
}

.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  border: 1px solid transparent;
}

.alert-success { background: #d1fae5; border-color: #6ee7b7; color: #065f46; }
.alert-danger   { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.alert-warning  { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.alert-info     { background: #dbeafe; border-color: #93c5fd; color: #1e40af; }

.alert-close {
  margin-left: auto; cursor: pointer; opacity: 0.6; font-size: 16px;
  background: none; border: none; color: inherit;
}
.alert-close:hover { opacity: 1; }

/* ============================================================
   CARDS
   ============================================================ */

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--blue);
  display: flex; align-items: center; gap: 8px;
}

.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--gray-200); background: var(--gray-50); }

/* ============================================================
   STAT CARDS (Dashboard)
   ============================================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.blue  { background: rgba(28,75,105,.1); color: var(--blue); }
.stat-icon.green { background: rgba(101,191,101,.15); color: var(--green-dark); }
.stat-icon.warn  { background: rgba(245,158,11,.1); color: var(--warning); }
.stat-icon.red   { background: rgba(220,53,69,.1); color: var(--danger); }

.stat-value { font-size: 24px; font-weight: 700; color: var(--gray-800); line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--gray-400); font-weight: 500; margin-top: 2px; }

/* ============================================================
   TABLES
   ============================================================ */

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: var(--gray-50);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--gray-600);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}

tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--gray-200);
  vertical-align: middle;
}

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

tfoot td {
  padding: 11px 14px;
  vertical-align: middle;
}

.text-right { text-align: right; }
.text-center { text-align: center; }

/* ============================================================
   BADGES
   ============================================================ */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-blue    { background: rgba(28,75,105,.1); color: var(--blue); }
.badge-green   { background: rgba(101,191,101,.15); color: var(--green-dark); }
.badge-warn    { background: rgba(245,158,11,.12); color: #b45309; }
.badge-danger  { background: rgba(220,53,69,.1); color: #b91c1c; }
.badge-gray    { background: var(--gray-100); color: var(--gray-600); }
.badge-purple  { background: rgba(139,92,246,.12); color: #7c3aed; }
.badge-lg      { font-size: 13px; padding: 5px 14px; }

/* Marca del criterio de IVA de un importe. Acompaña importes y etiquetas de
   formulario; tiene que leerse aun dentro de un <th>, que viene en mayúsculas
   y con letter-spacing propio.
     .sin-iva → Comercial y Operaciones trabajan siempre sin IVA.
     .con-iva → Presupuesto de gastos: el monto cargado ya incluye el impuesto.
   Van en colores distintos a propósito: son criterios opuestos y no se tienen
   que confundir de un vistazo. */
.sin-iva,
.con-iva {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.5;
  letter-spacing: .4px;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 4px;
  vertical-align: middle;
  white-space: nowrap;
}

.sin-iva { background: rgba(28,75,105,.12);  color: var(--blue); }
.con-iva { background: rgba(245,158,11,.14); color: #b45309; }

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
  font-family: 'Montserrat', sans-serif;
  white-space: nowrap;
  text-align: center;
}

.btn-primary   { background: var(--blue); color: white; }
.btn-primary:hover  { background: var(--blue-dark); }
.btn-success   { background: var(--green); color: white; }
.btn-success:hover  { background: var(--green-dark); }
.btn-danger    { background: var(--danger); color: white; }
.btn-danger:hover   { background: #b91c1c; }
.btn-outline   { background: white; color: var(--blue); border: 1.5px solid var(--blue); }
.btn-outline:hover  { background: var(--blue); color: white; }
.btn-ghost     { background: transparent; color: var(--gray-600); border: 1.5px solid var(--gray-200); }
.btn-ghost:hover    { background: var(--gray-100); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }
.btn-icon { padding: 7px; }

/* ============================================================
   FORMS
   ============================================================ */

.form-group { margin-bottom: 18px; }

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: 'Montserrat', sans-serif;
  color: var(--gray-800);
  background: white;
  transition: border-color .15s, box-shadow .15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(28,75,105,.1);
}

.form-control::placeholder { color: var(--gray-400); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.form-hint { font-size: 11px; color: var(--gray-400); margin-top: 4px; }

/* Stock info box */
.stock-info-box {
  background: var(--mint-light);
  border: 1px solid var(--mint);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-top: 8px;
  font-size: 12px;
  display: none;
}
.stock-info-box.show { display: block; }
.stock-info-box .info-row { display: flex; justify-content: space-between; padding: 2px 0; }
.stock-info-box .info-label { color: var(--gray-600); }
.stock-info-box .info-value { font-weight: 600; color: var(--blue); }
.stock-info-box .low-stock { color: var(--danger); }

/* ============================================================
   SEARCH BAR
   ============================================================ */

.search-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  flex: 1; min-width: 200px;
}

.search-input-wrap i {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--gray-400); font-size: 14px;
}

.search-input-wrap input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: 'Montserrat', sans-serif;
}

.search-input-wrap input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(28,75,105,.1);
}

/* ============================================================
   PAGINATION
   ============================================================ */

.pagination {
  display: flex; gap: 4px; align-items: center;
  justify-content: center; padding: 16px 0 8px;
}

.page-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: 6px;
  font-size: 13px; font-weight: 500;
  color: var(--gray-600);
  border: 1.5px solid var(--gray-200);
  transition: all .15s;
}

.page-link:hover { background: var(--gray-100); color: var(--blue); border-color: var(--blue); }
.page-link.active { background: var(--blue); color: white; border-color: var(--blue); }
.page-link.disabled { opacity: 0.4; pointer-events: none; }

/* ============================================================
   LOW STOCK ALERT ROW
   ============================================================ */

tr.low-stock-row { background: #fff5f5 !important; }
tr.low-stock-row:hover { background: #fee2e2 !important; }

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-400);
}
.empty-state i { font-size: 48px; display: block; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-light) 100%);
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  width: 100%; max-width: 400px;
  overflow: hidden;
}

.login-header {
  background: var(--blue);
  padding: 32px 32px 28px;
  text-align: center;
  color: white;
}

.login-logo {
  width: 56px; height: 56px;
  background: var(--green);
  border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: white;
  margin-bottom: 12px;
}

.login-header h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.login-header p  { font-size: 12px; opacity: 0.7; font-style: italic; letter-spacing: 0.5px; }

.login-body { padding: 32px; }
.login-body .form-group { margin-bottom: 20px; }

.login-btn {
  width: 100%;
  padding: 11px;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  font-family: 'Montserrat', sans-serif;
  cursor: pointer;
  transition: background .15s;
  margin-top: 4px;
}
.login-btn:hover { background: var(--blue-dark); }

/* ============================================================
   MISC UTILITIES
   ============================================================ */

.text-blue   { color: var(--blue); }
.text-green  { color: var(--green-dark); }
.text-danger { color: var(--danger); }
.text-muted  { color: var(--gray-400); }
.text-bold   { font-weight: 600; }
.text-sm     { font-size: 12px; }
.text-xs     { font-size: 11px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

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

.separator { border: none; border-top: 1px solid var(--gray-200); margin: 16px 0; }

/* Delete confirm modal */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: white; border-radius: 12px;
  padding: 28px; max-width: 400px; width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-box h3 { font-size: 17px; margin-bottom: 10px; color: var(--gray-800); }
.modal-box p  { font-size: 13px; color: var(--gray-600); margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }

/* Highlight on select */
.autocomplete-item {
  padding: 8px 12px; cursor: pointer; font-size: 13px;
  border-bottom: 1px solid var(--gray-200);
}
.autocomplete-item:hover { background: var(--mint-light); }

/* Print styles */
@media print {
  .sidebar, .topbar, .btn, .search-bar { display: none !important; }
  .main { margin-left: 0; }
  .content { padding: 0; }
}

/* ============================================================
   EFFIZA GESTIÓN — Estilos adicionales al sistema unificado
   ============================================================ */

/* Logo image en sidebar */
.logo-img { max-height: 36px; max-width: 100px; object-fit: contain; border-radius: 4px; }

/* Nav módulos con submenú */
.nav-module-header { display: flex; align-items: center; justify-content: space-between; }
.nav-chevron { font-size: 10px; opacity: 0.6; margin-left: auto; }
.module-badge { font-size: 9px; padding: 2px 6px; border-radius: 10px; margin-left: auto; font-weight: 600; }
.module-badge.coming { background: rgba(255,255,255,0.15); color: rgba(255,255,255,0.7); }
.nav-submenu { background: rgba(0,0,0,0.15); padding: 4px 0; }
.nav-sub { padding: 7px 20px 7px 36px !important; font-size: 12px !important; }
.nav-sub-label {
  padding: 8px 20px 3px 36px;
  font-size: 9px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; opacity: 0.45;
}

/* Stat card link */
.stat-card-link { text-decoration: none; transition: transform .15s, box-shadow .15s; }
.stat-card-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* ============================================================
   HOME LAYOUT — News + Widgets
   ============================================================ */
.home-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
}

/* Section title */
.section-title {
  font-size: 14px; font-weight: 600; color: var(--gray-600);
  margin-bottom: 16px; display: flex; align-items: center; gap: 8px;
  text-transform: uppercase; letter-spacing: 0.5px;
}

/* News */
.news-card {
  background: white; border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden;
  border-left: 4px solid var(--gray-200);
}
.news-pinned { border-left-color: var(--blue); }
.news-card-header {
  padding: 14px 18px 8px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.news-title { font-size: 15px; font-weight: 600; color: var(--gray-800); }
.news-content { padding: 0 18px 12px; font-size: 13px; color: var(--gray-600); line-height: 1.6; white-space: pre-wrap; }
.news-meta { padding: 8px 18px 12px; font-size: 11px; color: var(--gray-400); border-top: 1px solid var(--gray-100); }
.news-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-xs { padding: 3px 8px !important; font-size: 11px !important; }

/* Widgets */
.widget-card {
  background: white; border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden;
}
.widget-header {
  padding: 12px 14px; background: var(--blue);
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; color: white;
}
.widget-source { margin-left: auto; font-size: 10px; opacity: 0.7; }
.widget-link { margin-left: auto; color: rgba(255,255,255,0.7); font-size: 13px; }
.widget-link:hover { color: white; }
.widget-body { padding: 14px; }
.widget-loading { text-align: center; color: var(--gray-400); font-size: 13px; padding: 8px 0; }
.widget-big-value { font-size: 28px; font-weight: 700; color: var(--gray-800); line-height: 1; }
.widget-sub { font-size: 12px; color: var(--gray-400); margin-top: 4px; }
.widget-note { font-size: 11px; color: var(--gray-400); margin-top: 8px; }
.widget-stat-row { display: flex; justify-content: space-between; align-items: center; }
.widget-stat-label { font-size: 12px; color: var(--gray-600); }
.widget-stat-value { font-size: 18px; font-weight: 700; color: var(--gray-800); }

/* Weather widget */
.weather-row { display: flex; justify-content: space-between; }
.weather-day { text-align: center; flex: 1; padding: 4px 2px; }
.weather-day-name { font-size: 11px; font-weight: 600; color: var(--gray-600); margin-bottom: 4px; }
.weather-icon { font-size: 22px; color: var(--blue); display: block; margin: 4px 0; }
.weather-temp { font-size: 12px; }
.temp-max { font-weight: 700; color: var(--gray-800); }
.temp-min { color: var(--gray-400); margin-left: 3px; }
.weather-rain { font-size: 10px; color: var(--blue-light); margin-top: 3px; }

/* Docs in widget */
.doc-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 0;
  font-size: 12px; color: var(--blue); font-weight: 500;
  border-bottom: 1px solid var(--gray-100); text-decoration: none;
}
.doc-item:last-child { border-bottom: none; }
.doc-item:hover { color: var(--blue-dark); }
.doc-item i { font-size: 16px; flex-shrink: 0; }

/* Spin animation */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { display: inline-block; animation: spin 1s linear infinite; }

/* ============================================================
   CONFIG — modules grid, chips
   ============================================================ */
.modules-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.module-toggle input[type="checkbox"] { display: none; }
.module-toggle-box {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 12px; border-radius: var(--radius);
  border: 2px solid var(--gray-200); cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--gray-600);
  transition: all .15s;
}
.module-toggle-box i { font-size: 22px; }
.module-toggle input:checked + .module-toggle-box {
  border-color: var(--blue); background: rgba(28,75,105,0.06); color: var(--blue);
}
.module-toggle:hover .module-toggle-box { border-color: var(--blue-light); }

.modules-list { display: flex; flex-wrap: wrap; gap: 4px; }
.module-chip {
  font-size: 10px; font-weight: 600; padding: 2px 8px;
  border-radius: 10px; background: var(--gray-200); color: var(--gray-600);
}
.module-chip.all { background: rgba(28,75,105,0.12); color: var(--blue); }

/* ============================================================
   COMING SOON
   ============================================================ */
.coming-soon-box {
  text-align: center; padding: 80px 24px;
  max-width: 480px; margin: 0 auto;
}
.coming-soon-icon { font-size: 64px; color: var(--blue); margin-bottom: 24px; display: block; }
.coming-soon-box h2 { font-size: 28px; font-weight: 700; color: var(--gray-800); margin-bottom: 12px; }
.coming-soon-box p { color: var(--gray-600); font-size: 15px; margin-bottom: 8px; }
.coming-soon-sub { font-size: 13px !important; color: var(--gray-400) !important; }

/* Responsive home layout */
@media (max-width: 900px) {
  .home-layout { grid-template-columns: 1fr; }
  .modules-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   MODULE TABS (Punto 1)
   ============================================================ */

.module-tabs {
  background: var(--white);
  border-bottom: 2px solid var(--gray-200);
  padding: 0 28px;
  display: flex;
  gap: 0;
  position: sticky;
  top: 57px;
  z-index: 40;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.module-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 13px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all .15s;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.module-tab:hover {
  color: var(--blue);
  background: var(--gray-50);
}

.module-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  background: transparent;
}

.module-tab i {
  font-size: 15px;
}

.module-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-200);
  color: var(--gray-600);
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 5px;
}

.module-tab.active .module-tab-count {
  background: rgba(28,75,105,0.15);
  color: var(--blue);
}

/* Sub-tabs (segunda fila dentro de cada sección) */
.module-subtabs {
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 28px;
  display: flex;
  gap: 0;
}

.module-subtab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-600);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all .15s;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.module-subtab:hover {
  color: var(--blue);
  background: var(--gray-100);
}

.module-subtab.active {
  color: var(--blue);
  border-bottom-color: var(--green);
  font-weight: 600;
}

.module-subtab i {
  font-size: 13px;
}

/* ============================================================
   RBAC — Permission Matrix (Punto 2)
   ============================================================ */

.permission-matrix {
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}

.perm-module-row {
  border-bottom: 1px solid var(--gray-200);
}

.perm-module-row:last-child { border-bottom: none; }

.perm-module-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--gray-50);
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
}

.perm-module-header i { font-size: 16px; }

.perm-module-access {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-600);
}

.perm-actions-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px 14px 40px;
}

.perm-action-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1.5px solid var(--gray-200);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}

.perm-action-toggle:has(input:checked) {
  border-color: var(--green);
  background: rgba(101,191,101,0.08);
  color: var(--green-dark);
}

.perm-action-toggle input { display: none; }

.perm-action-toggle i { font-size: 13px; }

/* Custom toggle switch */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.toggle-switch input { display: none; }

.toggle-track {
  width: 36px;
  height: 20px;
  background: var(--gray-200);
  border-radius: 10px;
  position: relative;
  transition: background .2s;
}

.toggle-track::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  top: 2px; left: 2px;
  transition: left .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-track {
  background: var(--green);
}

.toggle-switch input:checked + .toggle-track::after {
  left: 18px;
}

/* ============================================================
   MAESTROS (Punto 3)
   ============================================================ */

.maestro-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: box-shadow .15s;
}

.maestro-card:hover { box-shadow: var(--shadow-md); }

.maestro-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: white;
  flex-shrink: 0;
}

.maestro-avatar.blue  { background: var(--blue); }
.maestro-avatar.green { background: var(--green-dark); }
.maestro-avatar.mint  { background: #5a9a6c; }

.nav-maestros-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px 8px 32px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.75);
  transition: all .15s;
  border-left: 3px solid transparent;
}

.nav-maestros-item:hover {
  background: rgba(255,255,255,0.08);
  color: white;
}

.nav-maestros-item.active {
  background: rgba(255,255,255,0.12);
  color: white;
  border-left-color: var(--mint);
}
