/* =========================================================
   Portal Manager — AdminLTE 4 Style
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* ── Sidebar (TailAdmin dark) ── */
  --sidebar-bg:      #1C2434;
  --sidebar-bg-dark: #111827;
  --sidebar-border:  #2A3547;
  --sidebar-text:    #C8D6E8;
  --sidebar-muted:   #6B84A3;
  --sidebar-active:  #4F8EF7;
  --sidebar-hover:   rgba(255,255,255,.06);
  --sidebar-width:   252px;

  /* ── Content (Light Bootstrap) ── */
  --body-bg:    #F1F5F9;
  --card-bg:    #ffffff;
  --card-2:     #F8FAFC;
  --border:     #E2EAF4;
  --border-2:   #CBD5E1;

  /* ── Brand colors (modernized) ── */
  --primary:    #4F8EF7;
  --primary-hi: #3a7de8;
  --primary-lo: rgba(79,142,247,.13);
  --success:    #10B981;
  --success-lo: rgba(16,185,129,.13);
  --warning:    #F59E0B;
  --warning-lo: rgba(245,158,11,.13);
  --danger:     #EF4444;
  --danger-lo:  rgba(239,68,68,.13);
  --info:       #06B6D4;
  --info-lo:    rgba(6,182,212,.13);
  --secondary:  #64748B;

  /* ── Text ── */
  --text:       #1E293B;
  --text-muted: #64748B;
  --text-light: #94A3B8;
  --text-white: #ffffff;

  /* ── Shadows (Light Bootstrap feel) ── */
  --shadow-sm:  0 2px 8px rgba(30,41,59,.08);
  --shadow:     0 4px 16px rgba(30,41,59,.12);
  --shadow-lg:  0 10px 36px rgba(30,41,59,.16);
  --shadow-xl:  0 24px 64px rgba(30,41,59,.22);

  --radius:    10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --transition: .2s ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--body-bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #aab8c8; }

.hidden { display: none !important; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

input, select, textarea {
  font-family: 'Inter', inherit;
  font-size: 13.5px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,111,212,.15);
}
label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin: 12px 0 4px;
  font-weight: 600;
}

/* =========================================================
   LOGIN — Split Layout COPAVILA
   ========================================================= */
.login-view {
  position: fixed; inset: 0; z-index: 99;
  display: flex;
  background: #fff;
}

/* Panel izquierdo — formulario */
.login-panel-left {
  flex: 0 0 44%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 64px;
  background: #fff;
}

/* Panel derecho — fotografía */
.login-panel-right {
  flex: 1;
  background-image: url('login-bg.jpg');
  background-size: cover;
  background-position: center top;
  overflow: hidden;
  position: relative;
}
.login-panel-right::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.55);
}

/* Tarjeta del formulario */
.login-card {
  width: 100%; max-width: 380px;
  background: none; box-shadow: none;
  border-radius: 0; padding: 0;
  animation: loginIn .45s cubic-bezier(.34,1.3,.64,1) both;
}
@keyframes loginIn {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.login-logo {
  width: 52px; height: 52px; border-radius: 13px;
  background: linear-gradient(135deg, var(--primary), var(--info));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  margin: 0 0 28px;
  box-shadow: 0 6px 20px rgba(59,111,212,.32);
}
.login-greeting {
  font-size: 15px; font-weight: 500;
  color: #8c9db0; letter-spacing: .01em;
  line-height: 1.2; margin-bottom: 32px;
}
.login-greeting br + .wm-copa,
.login-greeting br + * {
  display: inline;
}
.wm-copa {
  font-size: 38px; font-weight: 900;
  color: #1e3a8a; letter-spacing: -.01em;
}
.wm-avila {
  font-size: 38px; font-weight: 400;
  color: #4F8EF7; font-style: italic;
  margin-left: 8px; letter-spacing: -.01em;
}
.login-card label {
  color: #9ca3af;
  font-size: 11.5px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
  margin: 22px 0 6px;
}
.login-card input {
  border: none;
  border-bottom: 2px solid #e5e7eb;
  border-radius: 0;
  padding: 8px 0;
  background: transparent;
  font-size: 15px; font-weight: 500;
  color: #111827;
  box-shadow: none;
  transition: border-color .2s ease;
}
.login-card input:focus {
  border-bottom-color: var(--primary);
  box-shadow: none;
  outline: none;
}
.login-card input::placeholder { color: #d1d5db; font-weight: 400; }

.login-card button[type=submit] {
  width: 100%; margin-top: 36px; padding: 14px;
  background: var(--primary);
  border: none; border-radius: 50px;
  color: #fff; font-weight: 700; font-size: 15px;
  letter-spacing: .03em;
  transition: all .2s ease;
  box-shadow: 0 6px 20px rgba(59,111,212,.3);
}
.login-card button[type=submit]:hover {
  background: var(--primary-hi);
  box-shadow: 0 10px 28px rgba(59,111,212,.4);
  transform: translateY(-2px);
}
.login-card button[type=submit]:active { transform: translateY(0); }

.error { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 16px; text-align: center; }

/* =========================================================
   LAYOUT
   ========================================================= */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width); flex: none;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  box-shadow: 3px 0 12px rgba(0,0,0,.2);
  z-index: 10;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px; height: 58px;
  border-bottom: 1px solid var(--sidebar-border);
  background: var(--sidebar-bg-dark);
  font-weight: 800; font-size: 16px;
  color: var(--text-white);
  letter-spacing: -.01em;
  flex-shrink: 0;
}
.brand-logo {
  width: 36px; height: 36px; border-radius: 8px; flex: none;
  background: linear-gradient(135deg, var(--primary), var(--info));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
}

nav { flex: 1; padding: 10px 0; overflow-y: auto; }
nav::before {
  content: 'NAVIGATION';
  display: block;
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  color: var(--sidebar-muted); padding: 14px 18px 6px; opacity: .7;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px;
  color: var(--sidebar-text);
  font-size: 13.5px; font-weight: 500;
  cursor: pointer; margin: 1px 0;
  transition: all var(--transition);
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; border-left-color: rgba(79,142,247,.35); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(79,142,247,.18) 0%, rgba(79,142,247,.04) 100%);
  color: var(--sidebar-active); border-left-color: var(--sidebar-active); font-weight: 600;
}
.nav-item svg { flex: none; opacity: .75; }
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  padding: 14px 18px; border-top: 1px solid var(--sidebar-border);
  display: flex; align-items: center; gap: 10px;
  background: var(--sidebar-bg-dark); flex-shrink: 0;
}
.user-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--primary), var(--info));
  color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.user-meta { min-width: 0; }
.user-name { font-weight: 600; font-size: 13px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--sidebar-muted); text-transform: capitalize; }
.logout {
  background: transparent; border: 1px solid var(--sidebar-border);
  color: var(--sidebar-muted); border-radius: var(--radius-sm);
  padding: 7px; display: flex; align-items: center; flex: none;
  transition: all var(--transition);
}
.logout:hover { border-color: var(--danger); color: var(--danger); background: rgba(220,53,69,.1); }

/* ── Content ── */
.content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; height: 60px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 var(--border), 0 2px 8px rgba(30,41,59,.04);
  flex: none; z-index: 5;
}
.topbar h2 {
  font-size: 17px; font-weight: 700; color: var(--text); letter-spacing: -.015em;
  display: flex; align-items: center; gap: 8px;
}
.page { flex: 1; overflow-y: auto; padding: 26px 28px; }

/* =========================================================
   BOTONES
   ========================================================= */
.btn {
  background: var(--primary); border: none; color: #fff; font-weight: 600;
  border-radius: var(--radius-sm); padding: 8px 16px; font-size: 13px;
  display: inline-flex; align-items: center; gap: 7px;
  transition: all var(--transition); letter-spacing: .01em;
}
.btn:hover { background: var(--primary-hi); box-shadow: 0 4px 12px rgba(59,111,212,.3); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.secondary { background: var(--secondary); }
.btn.secondary:hover { background: #5a6268; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #c82333; box-shadow: 0 4px 12px rgba(220,53,69,.3); }
.btn.small { padding: 5px 11px; font-size: 12px; }
.btn.ghost { background: transparent; border: 1px solid var(--border-2); color: var(--text-muted); }
.btn.ghost:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-lo); }

/* =========================================================
   STAT CARDS  (Flatlogic gradient icons + Light Bootstrap shadows)
   ========================================================= */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; margin-bottom: 28px; }
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px 20px;
  box-shadow: var(--shadow-sm); transition: all .22s ease;
  position: relative; overflow: hidden;
}
/* Accent bottom-border (Flatlogic signature) */
.stat-card::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 3px; border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.stat-card:nth-child(4n+1)::after { background: linear-gradient(90deg, #4F8EF7, #818CF8); }
.stat-card:nth-child(4n+2)::after { background: linear-gradient(90deg, #10B981, #34D399); }
.stat-card:nth-child(4n+3)::after { background: linear-gradient(90deg, #F59E0B, #FBBF24); }
.stat-card:nth-child(4n+4)::after { background: linear-gradient(90deg, #EF4444, #F87171); }
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); }

/* Icon box — gradient bg, white icon (Flatlogic style) */
.stat-card .icon {
  width: 52px; height: 52px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px; flex-shrink: 0;
}
.stat-card .icon.blue {
  background: linear-gradient(135deg, #4F8EF7 0%, #818CF8 100%);
  color: #fff;
  box-shadow: 0 6px 18px rgba(79,142,247,.38);
}
.stat-card .icon.green {
  background: linear-gradient(135deg, #10B981 0%, #34D399 100%);
  color: #fff;
  box-shadow: 0 6px 18px rgba(16,185,129,.38);
}
.stat-card .icon.orange {
  background: linear-gradient(135deg, #F59E0B 0%, #FBBF24 100%);
  color: #fff;
  box-shadow: 0 6px 18px rgba(245,158,11,.38);
}
.stat-card .icon.red {
  background: linear-gradient(135deg, #EF4444 0%, #F87171 100%);
  color: #fff;
  box-shadow: 0 6px 18px rgba(239,68,68,.38);
}
.stat-value { font-size: 32px; font-weight: 800; color: var(--text); line-height: 1; letter-spacing: -.02em; }
.stat-label { color: var(--text-muted); font-size: 12.5px; margin-top: 5px; font-weight: 500; letter-spacing: .01em; }

/* =========================================================
   PANELS
   ========================================================= */
.section-title { font-size: 13px; margin: 8px 0 14px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.panel {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm);
}
.panel-head {
  padding: 15px 20px; border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 13px; color: var(--text);
  display: flex; justify-content: space-between; align-items: center;
  background: var(--card-2); letter-spacing: .01em;
}
.panel-body { padding: 4px 0; }

/* ── Tablas ── */
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 11px 16px; text-align: left; font-size: 13px; border-bottom: 1px solid var(--border); }
.tbl th {
  color: var(--text-muted); font-weight: 700; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .06em;
  background: var(--card-2); position: sticky; top: 0; z-index: 1;
  border-bottom: 2px solid var(--border-2);
}
.tbl tbody tr { cursor: default; transition: background var(--transition); }
.tbl tbody tr.clickable:hover { background: #f0f5fb; cursor: pointer; }
.tbl code {
  background: #f0f5fb; padding: 2px 7px; border-radius: 4px;
  font-size: 11.5px; font-family: 'JetBrains Mono', monospace;
  color: var(--primary); border: 1px solid var(--border);
}
.empty-row { text-align: center; color: var(--text-light); padding: 32px !important; font-style: italic; }

/* ── Badges (Light Bootstrap — pill shape) ── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: 50px;
  font-size: 11px; font-weight: 700; letter-spacing: .03em;
}
.badge.online  { background: rgba(16,185,129,.13);  color: #059669;  border: 1px solid rgba(16,185,129,.28); }
.badge.offline { background: rgba(100,116,139,.1);  color: #64748B;  border: 1px solid rgba(100,116,139,.25); }
.badge.on      { background: rgba(16,185,129,.13);  color: #059669;  border: 1px solid rgba(16,185,129,.28); }
.badge.off     { background: rgba(100,116,139,.1);  color: #64748B;  border: 1px solid rgba(100,116,139,.25); }
.badge.rol-superadmin { background: rgba(245,158,11,.13); color: #D97706; border: 1px solid rgba(245,158,11,.28); }
.badge.rol-admin      { background: rgba(79,142,247,.13);  color: #3a7de8; border: 1px solid rgba(79,142,247,.28); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.online .dot { animation: dotPulse 2s ease-in-out infinite; }
@keyframes dotPulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

/* ── Toggle ── */
.switch { position: relative; width: 42px; height: 22px; flex: none; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background: #ced4da; border-radius: 22px; transition: all var(--transition); }
.slider:before {
  content: ''; position: absolute;
  height: 16px; width: 16px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: all var(--transition);
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.switch input:checked + .slider { background: var(--success); }
.switch input:checked + .slider:before { transform: translateX(20px); }

/* ── Modal ── */
.modal-overlay, .drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: fadeBg .2s ease; backdrop-filter: blur(3px);
}
@keyframes fadeBg { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg);
  width: min(1400px, 98vw); max-height: 94vh;
  overflow: hidden; display: flex; flex-direction: column;
  box-shadow: var(--shadow-xl);
  animation: modalIn .22s cubic-bezier(.34,1.4,.64,1) both;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.96) translateY(-8px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}
.modal-head {
  padding: 18px 24px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; flex-shrink: 0;
  background: var(--card-2);
}
.modal-head h3 { font-size: 16px; font-weight: 700; color: var(--text); }
.modal-body { padding: 0; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 14px 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px; flex-shrink: 0;
  background: var(--card-2);
}
.x-btn { background: transparent; border: none; color: var(--text-muted); font-size: 22px; line-height: 1; transition: color var(--transition); }
.x-btn:hover { color: var(--danger); }

.modal-cols { display: grid; grid-template-columns: 420px 1fr; min-height: 0; height: 100%; }
.modal-col { padding: 20px 24px; overflow-y: auto; overflow-x: hidden; }
.modal-col + .modal-col { border-left: 1px solid var(--border); background: var(--card-2); }
.modal-col-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-muted); margin-bottom: 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.modal-col input, .modal-col select { max-width: 100%; box-sizing: border-box; }
.modal-col .cfg-group { margin-bottom: 12px; padding: 4px 12px 8px; }
.modal-col .cfg-group-title { padding: 8px 0 4px; }
.modal-col .cfg-row { padding: 7px 0; }
.modal-col .cfg-valor { width: 180px; }

#modulosContainer { max-height: 420px; overflow-y: auto; overflow-x: hidden; margin-top: 8px; }
.modulos-lista { width: 100%; box-sizing: border-box; }
.modulos-categoria { margin-bottom: 18px; }
.modulos-categoria-titulo {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted); margin-bottom: 8px;
  padding-bottom: 4px; border-bottom: 1px solid var(--border);
}
.mod-checkbox-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 4px; cursor: pointer; user-select: none; box-sizing: border-box;
  border-radius: var(--radius-sm); transition: background var(--transition);
}
.mod-checkbox-row:hover { background: #f0f5fb; }
.mod-checkbox-row input[type="checkbox"] { margin: 0; flex-shrink: 0; cursor: pointer; width: 15px; height: 15px; accent-color: var(--primary); }
.mod-checkbox-label { flex: 1; min-width: 0; font-size: 13px; color: var(--text); line-height: 1.35; word-wrap: break-word; }

.mod-checkbox-row-global {
  display: flex; align-items: center; gap: 12px; padding: 10px 4px; cursor: pointer;
  user-select: none; border-bottom: 1px solid var(--border); transition: background var(--transition);
}
.mod-checkbox-row-global:last-child { border-bottom: none; }
.mod-checkbox-row-global:hover { background: #f0f5fb; padding-left: 10px; border-radius: var(--radius-sm); }
.mod-checkbox-row-global input[type="checkbox"] { margin: 0; flex-shrink: 0; cursor: pointer; accent-color: var(--primary); }
.mod-checkbox-info { flex: 1; min-width: 0; }
.mod-checkbox-nombre { font-size: 13px; font-weight: 500; color: var(--text); }
.mod-checkbox-id { font-size: 11px; color: var(--text-muted); margin-top: 2px; font-family: 'JetBrains Mono', monospace; }

/* ── Drawer ── */
.drawer-overlay { z-index: 40; justify-content: flex-end; align-items: stretch; padding: 0; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 800px; max-width: 96vw;
  background: #fff; border-left: 1px solid var(--border); z-index: 45;
  overflow-y: auto; box-shadow: -8px 0 40px rgba(0,0,0,.15);
  animation: drawerIn .25s cubic-bezier(.4,0,.2,1) both;
}
@keyframes drawerIn {
  from { transform: translateX(30px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
.drawer-head {
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: flex-start;
  background: var(--card-2);
}
.drawer-body { padding: 22px; }
.drawer h3 { font-size: 17px; font-weight: 700; color: var(--text); }
.drawer .sub { color: var(--text-muted); font-size: 13px; margin-top: 3px; }

.field-row { display: flex; gap: 10px; align-items: center; }
.token-box { display: flex; gap: 8px; align-items: center; }
.token-box code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mod-row {
  display: grid; grid-template-columns: 44px 1fr 140px auto; gap: 12px; align-items: center;
  padding: 11px 0; border-bottom: 1px solid var(--border); transition: background var(--transition);
}
.mod-row:last-child { border-bottom: none; }
.mod-row:hover { background: #f8fbff; }
.mod-row .mod-name { font-size: 13px; font-weight: 500; color: var(--text); }
.mod-row .mod-name small { display: block; color: var(--text-muted); font-weight: 400; font-size: 11px; font-family: 'JetBrains Mono', monospace; }
.mod-row input[type=text] { padding: 7px 9px; }

.subsec { margin-top: 24px; }
.subsec h4 { font-size: 14px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; color: var(--text); border-bottom: 1px solid var(--border); padding-bottom: 8px; }

.horario-form { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; align-items: end; margin-top: 10px; }
.horario-form label { margin: 0 0 4px; }

.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--primary-lo); border: 1px solid rgba(59,111,212,.2); border-radius: 4px; padding: 4px 12px; font-size: 12px; color: var(--primary); font-weight: 500; }

.audit-item { padding: 11px 16px; border-bottom: 1px solid var(--border); font-size: 13px; transition: background var(--transition); }
.audit-item:last-child { border-bottom: none; }
.audit-item:hover { background: #f8fbff; }
.audit-item .meta { color: var(--text-muted); font-size: 11px; margin-top: 2px; font-family: 'JetBrains Mono', monospace; }
.audit-item .accion { color: var(--primary); font-weight: 600; }

.filter-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.filter-bar select { max-width: 280px; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 100;
  background: var(--text); color: #fff;
  padding: 12px 18px; border-radius: var(--radius); font-size: 13px; font-weight: 500;
  opacity: 0; transform: translateY(10px) scale(.97);
  transition: all var(--transition); pointer-events: none;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast.ok  { background: var(--success); }
.toast.err { background: var(--danger); }

.help-text { color: var(--text-muted); font-size: 12px; margin-top: 4px; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* =========================================================
   TABS / DISPOSITIVOS
   ========================================================= */
.tabs { display: flex; gap: 0; margin-bottom: 16px; border-bottom: 2px solid var(--border); }
.tab {
  background: transparent; border: none; cursor: pointer;
  color: var(--text-muted); font-weight: 600; font-size: 13px;
  padding: 10px 18px; border-bottom: 2px solid transparent; margin-bottom: -2px;
  display: inline-flex; align-items: center; gap: 8px; transition: all var(--transition);
}
.tab:hover { color: var(--text); background: var(--card-2); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-count {
  background: var(--border); color: var(--text-muted);
  border-radius: 20px; font-size: 11px; font-weight: 700;
  padding: 1px 8px; min-width: 18px; text-align: center; transition: all var(--transition);
}
.tab.active .tab-count { background: var(--primary); color: #fff; }
.acciones { display: flex; gap: 6px; flex-wrap: wrap; }
.gpu-cell { max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-muted); font-size: 12px; }
.mod-row.dev-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border);
}
.mod-row.dev-row:last-child { border-bottom: none; }

/* ── Config groups ── */
.cfg-group {
  background: var(--card-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 14px 12px; margin-bottom: 14px;
}
.cfg-group-title { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; padding: 10px 0 6px; }
.cfg-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); }
.cfg-row:first-of-type { border-top: none; }
.cfg-info { flex: 1; min-width: 0; }
.cfg-label { font-size: 13px; font-weight: 500; color: var(--text); }
.cfg-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; line-height: 1.35; }
.cfg-valor { flex: none; width: 200px; margin: 0; }
select.cfg-valor { cursor: pointer; background-color: #fff; text-overflow: ellipsis; }
select.cfg-valor:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 900px) {
  .modal-cols { grid-template-columns: 1fr; }
  .modal-col + .modal-col { border-left: none; border-top: 1px solid var(--border); }
}
@media (max-width: 620px) {
  .cfg-row { flex-wrap: wrap; }
  .cfg-valor { width: 100%; }
}

/* ── Portal badges (pill) ── */
.badge.portal-new { background: rgba(6,182,212,.13); color: #0891B2; border: 1px solid rgba(6,182,212,.28); }
.badge.portal-old { background: rgba(111,66,193,.12); color: #7C3AED; border: 1px solid rgba(111,66,193,.28); }

/* ── Module explorer ── */
.portal-tabs { display: flex; gap: 8px; margin-bottom: 16px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.portal-tab-btn {
  padding: 7px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: #fff; color: var(--text-muted); cursor: pointer;
  font-weight: 600; font-size: 13px; transition: all var(--transition);
}
.portal-tab-btn:hover { color: var(--text); background: var(--card-2); }
.portal-tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.mod-search-bar { display: flex; gap: 12px; margin-bottom: 16px; align-items: center; }
.mod-search-input {
  flex: 1; padding: 9px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-2); background: #fff; color: var(--text); font-size: 13.5px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.mod-search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,111,212,.12); }

.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-top: 10px; }
.mod-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 6px;
  box-shadow: var(--shadow-sm); transition: all var(--transition);
  border-left: 3px solid var(--primary);
}
.mod-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.mod-card-cat { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--primary); }
.mod-card-title { font-size: 13px; font-weight: 600; color: var(--text); }
.mod-card-php {
  font-size: 11px; font-family: 'JetBrains Mono', monospace; color: var(--text-muted);
  background: var(--card-2); padding: 4px 8px; border-radius: 4px;
  word-break: break-all; border: 1px solid var(--border);
}
