/* ═══════════════════════════════════════════════════════════════
   SIC — Unified Stylesheet v2.0
   Path: sic/shared/assets/css/style.css
   Merged: design-tokens + sidebar layout + mobile responsive
   Breakpoints: 768px (mobile off-canvas), 1024px (tablet icons), 1025px+ (desktop)
   ═══════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════
   SIC DESIGN SYSTEM v1.0 — Tokens CSS
   Carga: <link rel="stylesheet" href="/includes/design-tokens.css?v=1">
   Principios: 8px grid · 60-30-10 color · 2 familias tipográficas
   ═══════════════════════════════════════════════════════════════ */

/* ═══ PUENTE: Variables desde personalización (BD) → CSS ═══ */
/* Conecta --bg-sidebar (PHP/BD) con --sidebar-bg (CSS sidebar) */
:root {
  --sidebar-bg: var(--bg-sidebar, var(--color-sidebar, #1a1a2e));
  --sidebar-text: var(--text-sidebar, var(--color-text, rgba(255,255,255,0.88)));
  --sidebar-border: var(--border-color, var(--color-border, rgba(255,255,255,0.06)));
  --sidebar-text-muted: var(--text-sidebar-muted, var(--color-text-muted, rgba(255,255,255,0.5)));
  --sidebar-collapsed-width: var(--sidebar-collapsed, 72px);
  --font-base: 16px;  /* base tipográfica para calc(--font-scale) */
}

/* ═══ TEMA OSCURO — unificado con el bloque CSS de abajo ═══ */

/* ═══ ALTO CONTRASTE ═══ */
[data-theme="highcontrast"] {
  --color-surface:       #000000;
  --color-surface-alt:   #111111;
  --color-container:        #000000;
  --color-container-hover:  #1a1a1a;
  --color-sidebar:          #000000;
  --color-topbar:           #000000;
  --color-text:           #ffffff;
  --color-text-secondary: #cccccc;
  --color-text-muted:     #aaaaaa;
  --color-border:        #444444;
  --color-border-light:  #333333;
  --color-border-focus:  #ffff00;
  --color-primary:       #ffff00;
  --color-primary-hover: #ffff33;
  --color-primary-light: rgba(255,255,0,0.15);
  --color-primary-text:  #000000;
  --focus-ring-color:    #ffff00;
  --shadow-sm:   0 0 0 1px #444;
  --shadow-md:   0 0 0 2px #444;
  --shadow-lg:   0 0 0 3px #444;
}

/* ═══════════════════════════════════════════════════════
   CULTURARED — Sidebar Unificado v3.0
   Bottom Nav (mobile) + Sidebar colapsable (desktop)
   Glass-morphism + Seguridad anti-XSS (solo CSS)
   ═══════════════════════════════════════════════════════ */

/* ═══ CSS CUSTOM PROPERTIES ═══ */

/* ═══ TEMA OSCURO ═══ */
[data-theme="dark"] {
  --bg: #0f1117;
  --bg-main: #1e2130;
  --card: #1e2130;
  --text: #e8eaed;
  --text-primary: #e8eaed;
  --text-secondary: #9aa0b0;
  --border: #2d3348;
  --color-text: #e8eaed;
  --color-surface: #0f1117;
  --color-container: #1e2130;
  --color-sidebar: #0d0f17;
  --color-topbar: #1a1d27;
  --shadow: 0 1px 3px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.5);
  --primary: #7c6fcd;
  --primary-hover: #9d93e0;
  --primary-light: rgba(124,111,205,.15);
}

/* ═══ TEMA CLARO (profesional) ═══ */
[data-theme="light"] {
  --bg: #f4f6f9;
  --bg-main: #ffffff;
  --card: #ffffff;
  --text: #1a1a2e;
  --text-primary: #1a1a2e;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --color-text: #1a1a2e;
  --color-surface: #f4f6f9;
  --color-container: #ffffff;
  --shadow: 0 1px 3px rgba(0,0,0,.06);
  --shadow-lg: 0 4px 16px rgba(0,0,0,.08);
  --primary: #6c5ce7;
  --primary-hover: #5a4fcf;
  --primary-light: rgba(108,92,231,.1);
}

/* ═══ ALTO CONTRASTE ═══ */
[data-theme="highcontrast"] {
  --sidebar-bg: #000;
  --bg: #000;
  --card: #111;
  --text: #fff;
  --text-secondary: #ccc;
  --border: #444;
  --accent: #ff0;
  --accent-hover: #ff3;
  --accent-light: rgba(255,255,0,.15);
}

/* ═══ ACENTOS ═══ */
[data-accent="blue"]   { --accent: #2980b9; --accent-hover: #3498db; --accent-light: rgba(41,128,185,.15); --accent-glow: 0 0 20px rgba(41,128,185,.3); }
[data-accent="green"]  { --accent: #27ae60; --accent-hover: #2ecc71; --accent-light: rgba(39,174,96,.15); --accent-glow: 0 0 20px rgba(39,174,96,.3); }
[data-accent="orange"] { --accent: #e67e22; --accent-hover: #f39c12; --accent-light: rgba(230,126,34,.15); --accent-glow: 0 0 20px rgba(230,126,34,.3); }
[data-accent="red"]    { --accent: #c0392b; --accent-hover: #e74c3c; --accent-light: rgba(192,57,43,.15); --accent-glow: 0 0 20px rgba(192,57,43,.3); }
[data-accent="black"]  { --accent: #d4a853; --accent-hover: #e0b960; --accent-light: rgba(212,168,83,.15); --accent-glow: 0 0 20px rgba(212,168,83,.3); --sidebar-bg: linear-gradient(180deg, #0a0a0a 0%, #1a1a1a 100%); }

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

html { font-size: calc(var(--font-base, 16px) * var(--font-scale, 1)); }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  transition: background .3s ease, color .3s ease;
  overflow-x: hidden;
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR — Desktop (≥768px)
   ═══════════════════════════════════════════════════════════ */
@media(min-width: 768px) {

.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  background-attachment: fixed;
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: width .35s cubic-bezier(.4,0,.2,1), transform .35s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
  box-shadow: 2px 0 24px rgba(0,0,0,.08);
  border-right: 1px solid var(--border);
}

/* Sidebar colapsado */
.sidebar.collapsed { width: var(--sidebar-collapsed-width); }

/* ── Brand ── */
.sidebar-brand {
  padding: 22px 20px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
  overflow: hidden;
  transition: padding .3s;
  position: relative;
}
/* Línea decorativa debajo del brand */
.sidebar-brand::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 20px;
  right: 20px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 60%);
  border-radius: 1px;
  opacity: .6;
}
.sidebar.collapsed .sidebar-brand { padding: 16px 0; justify-content: center; }
.sidebar.collapsed .sidebar-brand::after { display: none; }
.sidebar-brand h2, .sidebar-brand__logo {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  margin: 0;
  overflow: hidden;
  transition: opacity .2s;
  letter-spacing: -.01em;
}
.sidebar-brand__icon {
  color: var(--accent);
  font-size: 1.15rem;
  filter: drop-shadow(0 0 8px rgba(108,92,231,.4));
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 10px;
  background: rgba(108,92,231,.15);
  flex-shrink: 0;
}
.sidebar-brand__text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity .2s, width .2s;
}
.sidebar.collapsed .sidebar-brand__text,
.sidebar.collapsed .sidebar-brand h2 span,
.sidebar.collapsed .sidebar-brand h2 small { opacity: 0; width: 0; overflow: hidden; }
.sidebar-brand h2 i { 
  color: var(--accent);
  font-size: 1.15rem;
  filter: drop-shadow(0 0 8px rgba(108,92,231,.4));
}
.sidebar-brand small, .sidebar-brand__sub {
  display: block;
  font-size: .58rem;
  font-weight: 500;
  color: var(--sidebar-text-muted);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-top: 2px;
  transition: opacity .2s;
}
.sidebar.collapsed .sidebar-brand small,
.sidebar.collapsed .sidebar-brand__sub { display: none; }

/* ── Toggle ── */
.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--sidebar-border);
  background: transparent;
  color: var(--sidebar-text-muted);
  cursor: pointer;
  font-size: .75rem;
  transition: all .2s;
  flex-shrink: 0;
  margin-left: auto;
  backdrop-filter: blur(4px);
}
.sidebar-toggle:hover { background: var(--sidebar-hover); color: var(--accent); }
.sidebar.collapsed .sidebar-toggle {
  margin-left: 0;
  transform: rotate(180deg);
  /* Toggle visible para poder re-expandir */
  position: fixed;
  bottom: 16px;
  left: calc(var(--sidebar-collapsed-width) / 2 - 15px);
  z-index: 1010;
  background: var(--sidebar-bg);
  border-color: var(--sidebar-border);
}
.sidebar:not(.collapsed) .sidebar-toggle {
  position: static;
}

/* ── User area ── */
.sidebar-user {
  padding: 14px 20px;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  transition: background .15s, padding .3s;
  user-select: none;
  white-space: nowrap;
  overflow: visible;
}
.sidebar.collapsed .sidebar-user { padding: 10px 0; justify-content: center; }
.sidebar-user:hover { background: var(--sidebar-hover); }
.sidebar-user .avatar, .sidebar-user__avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--accent);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .9rem;
  color: var(--text);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(108,92,231,.3);
}
.sidebar-user .user-info, .sidebar-user__info { flex: 1; min-width: 0; transition: opacity .2s; }
.sidebar.collapsed .sidebar-user .user-info,
.sidebar.collapsed .sidebar-user__info,
.sidebar.collapsed .sidebar-user .chevron,
.sidebar.collapsed .sidebar-user__arrow { opacity: 0; width: 0; padding: 0; margin: 0; overflow: hidden; }
.sidebar-user .user-name, .sidebar-user__name {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user .user-role, .sidebar-user__role { margin-top: 2px; }
.sidebar-user .chevron, .sidebar-user__arrow {
  font-size: .65rem;
  opacity: .5;
  transition: transform .25s;
  flex-shrink: 0;
}
.sidebar-user .chevron.open, .sidebar-user__arrow.open { transform: rotate(180deg); }

/* ── Role badges ── */
.role-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.role-admin   { background: linear-gradient(135deg, #ffd54f, #ffca28); color: #5d4037; }
.role-sidic   { background: linear-gradient(135deg, #81c784, #66bb6a); color: #1b5e20; }
.role-gestion { background: linear-gradient(135deg, #64b5f6, #42a5f5); color: #0d47a1; }
.role-base    { background: linear-gradient(135deg, #bdbdbd, #9e9e9e); color: #424242; }

/* ── User Dropdown ── */
.user-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 10px 16px 14px;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  animation: dropdownSlide .2s ease-out;
}
@keyframes dropdownSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.sidebar.collapsed .user-dropdown {
  position: fixed;
  left: var(--sidebar-collapsed-width);
  top: auto;
  width: 240px;
  border-radius: var(--radius);
  border: 1px solid var(--glass-border);
  margin-left: 6px;
  animation: dropdownSlide .2s ease-out;
}
.user-dropdown.open { display: block; }

.dropdown-item, .user-dropdown__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: .82rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.dropdown-item:hover, .user-dropdown__item:hover { background: var(--sidebar-hover); color: var(--accent); }
.dropdown-item i, .user-dropdown__item i { width: 20px; text-align: center; font-size: .85rem; color: var(--accent); }
.dropdown-divider { height: 1px; background: var(--sidebar-border); margin: 6px 0; }

.personalizacion-section { padding: 6px 0; }
.personalizacion-section + .personalizacion-section { 
  border-top: 1px solid var(--sidebar-border); 
  padding-top: 10px; 
  margin-top: 2px; 
}
.personalizacion-label {
  font-size: .64rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--sidebar-text-muted);
  margin-bottom: 6px;
}
.font-controls { display: flex; align-items: center; gap: 6px; }
.font-controls button {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--sidebar-border);
  background: transparent;
  color: var(--sidebar-text);
  font-size: .9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  line-height: 1;
}
.font-controls button:hover { background: var(--sidebar-hover); border-color: var(--accent); }
.font-controls .font-value {
  font-size: .78rem;
  color: var(--sidebar-text);
  min-width: 40px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.font-controls .btn-reset { width: auto; padding: 0 10px; font-size: .65rem; margin-left: auto; }

.theme-controls { display: flex; gap: 4px; }
.theme-btn {
  flex: 1;
  padding: 5px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--sidebar-border);
  background: transparent;
  color: var(--sidebar-text-muted);
  font-size: .65rem;
  cursor: pointer;
  transition: all .15s;
  text-align: center;
  line-height: 1.3;
}
.theme-btn:hover { border-color: var(--accent); color: var(--sidebar-text); }
.theme-btn.active { 
  background: var(--accent-light); 
  border-color: var(--accent); 
  color: #fff; 
  box-shadow: 0 0 12px rgba(108,92,231,.2);
}

.accent-controls { display: flex; gap: 6px; flex-wrap: wrap; }
.accent-dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all .2s;
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
.accent-dot:hover { transform: scale(1.2); }
.accent-dot.active { 
  border-color: #fff; 
  box-shadow: 0 0 0 2px var(--accent), 0 0 16px rgba(108,92,231,.4);
}

/* ── Navigation ── */
.sidebar-nav {
  flex: 1;
  padding: 4px 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }

.sidebar-nav .nav-section, .sidebar-section {
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--sidebar-text-muted);
  padding: 20px 20px 8px;
  white-space: nowrap;
  transition: opacity .2s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-nav .nav-section::before, .sidebar-section::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  opacity: .5;
  box-shadow: 0 0 6px var(--accent);
}
.sidebar.collapsed .nav-section,
.sidebar.collapsed .sidebar-section { opacity: 0; height: 0; padding: 0; overflow: hidden; }

.sidebar-nav a, .sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  margin: 2px 10px;
  color: var(--sidebar-text-muted);
  text-decoration: none;
  font-size: .82rem;
  font-weight: 500;
  transition: all .2s cubic-bezier(.4,0,.2,1);
  border-radius: 8px;
  white-space: nowrap;
  position: relative;
}
.sidebar.collapsed .sidebar-nav a,
.sidebar.collapsed .sidebar-link { justify-content: center; padding: 11px 0; margin: 2px 8px; }
.sidebar-nav a:hover, .sidebar-link:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
  transform: translateX(2px);
}
.sidebar-nav a.active, .sidebar-link.active {
  background: rgba(108,92,231,.12);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent), 0 0 20px rgba(108,92,231,.08);
}
.sidebar-nav a.active::after, .sidebar-link.active::after {
  content: '';
  position: absolute;
  left: -3px; top: 50%; transform: translateY(-50%);
  width: 6px; height: 60%;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
  opacity: .9;
  box-shadow: 0 0 10px var(--accent);
}
.sidebar.collapsed .sidebar-nav a.active,
.sidebar.collapsed .sidebar-link.active { box-shadow: inset 0 -2px 0 var(--accent); }
.sidebar.collapsed .sidebar-nav a.active::after,
.sidebar.collapsed .sidebar-link.active::after { display: none; }
.sidebar-nav a i, .sidebar-link__icon {
  width: 22px;
  text-align: center;
  font-size: .9rem;
  color: rgba(255,255,255,.4);
  flex-shrink: 0;
  transition: all .2s;
}

/* ── Sidebar link label ── */
.sidebar-link__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar.collapsed .sidebar-link__label { opacity: 0; width: 0; }

/* ── Sidebar footer ── */
.sidebar-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--sidebar-border);
  position: relative;
}
.sidebar-footer__text {
  text-align: center;
  font-size: .6rem;
  color: var(--sidebar-text-muted);
  padding: 8px 10px;
  letter-spacing: .04em;
}
.sidebar.collapsed .sidebar-footer { padding: 0; }
.sidebar.collapsed .sidebar-footer__text { display: none; }

/* ═══ DESKTOP TOPBAR ═══ */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topbar-height);
  background: var(--bg-topbar);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 900;
  transition: left var(--transition-speed) cubic-bezier(.4,0,.2,1);
}
.sidebar.collapsed ~ .topbar { left: var(--sidebar-collapsed); }
.sidebar.collapsed ~ .sic-ticker { left: var(--sidebar-collapsed); }
.sidebar.collapsed ~ .sic-panel { left: var(--sidebar-collapsed); }
.sidebar.flyout ~ .sic-ticker,
.sidebar.flyout ~ .sic-panel { left: 0; }
.topbar__left { display: flex; align-items: center; gap: 12px; }
.topbar__title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.topbar__title i { color: var(--accent); font-size: 1rem; }
.topbar__toggle {
  display: none; /* hidden by default; shown on tablet */
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border: none; background: transparent;
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background .15s;
  flex-shrink: 0;
}
.topbar__toggle:hover { background: var(--border-color); }
.topbar__right { display: flex; align-items: center; gap: 12px; }

/* ═══ TOPBAR ACCESIBILIDAD (Tema, Fuente, Acento) ═══ */
.topbar-access {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border-right: 1px solid var(--border-color);
  border-left: 1px solid var(--border-color);
  height: 36px;
}
.topbar-access__btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  font-weight: 600;
  font-family: var(--font-family, 'Inter', sans-serif);
  transition: all .15s;
  line-height: 1;
  padding: 0;
}
.topbar-access__btn:hover {
  background: var(--primary-light, rgba(108,92,231,0.08));
  border-color: var(--accent, #6c5ce7);
  color: var(--accent, #6c5ce7);
}
.topbar-access__theme {
  font-size: 1rem;
}
.topbar-access__fonts {
  display: flex;
  align-items: center;
  gap: 2px;
}
.topbar-access__val {
  font-size: .65rem;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 34px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.topbar-access__reset {
  font-size: 1rem;
  width: 26px;
  height: 26px;
}
.topbar-access__accents {
  display: flex;
  align-items: center;
  gap: 3px;
}
.topbar-access__dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all .2s;
  padding: 0;
  display: inline-block;
}
.topbar-access__dot:hover {
  transform: scale(1.25);
}
.topbar-access__dot.active {
  border-color: var(--text-primary, #1a1a2e);
  box-shadow: 0 0 0 2px var(--accent, #6c5ce7);
}
[data-theme="dark"] .topbar-access__dot.active {
  border-color: #fff;
}
/* En móviles ocultar controles de accesibilidad en topbar */
@media (max-width: 1024px) {
  .topbar-access { display: none; }
}
@media (max-width: 1200px) {
  .topbar-access__accents { display: none; }
}

.topbar__user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background .15s;
  user-select: none;
}
.topbar__user-badge:hover { background: rgba(0,0,0,.04); }
.topbar__user-badge i { font-size: 1.1rem; color: var(--accent); }

/* ═══ MAIN CONTENT ═══ */
.main-content {
  margin-left: 0;
  margin-top: 0;
  padding: 24px 28px;
  min-height: calc(100vh - var(--topbar-height));
  transition: margin-left var(--transition-speed) cubic-bezier(.4,0,.2,1);
  background: var(--bg-main);
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}
.main-content.sidebar-collapsed { margin-left: var(--sidebar-collapsed); }

} /* END @media(min-width: 768px) */

/* ═══════════════════════════════════════════════════════════════
   TABLET (768-1024px) — Sidebar collapsed icon-dock
   ═══════════════════════════════════════════════════════════════ */
@media (min-width: 768px) and (max-width: 1024px) {

  /* ── Sidebar: collapsed by default, always visible ── */
  .sidebar {
    width: var(--sidebar-collapsed);
    /* flyout expand will overlay, not push */
  }
  .sidebar:not(.flyout) .sidebar-brand__text,
  .sidebar:not(.flyout) .sidebar-section,
  .sidebar:not(.flyout) .sidebar-link__label,
  .sidebar:not(.flyout) .sidebar-user__info,
  .sidebar:not(.flyout) .sidebar-user__arrow,
  .sidebar:not(.flyout) .sidebar-footer__text,
  .sidebar:not(.flyout) .sidebar-toggle { display: none; }
  .sidebar:not(.flyout) .sidebar-brand { padding: 16px 0; justify-content: center; }
  .sidebar:not(.flyout) .sidebar-nav a,
  .sidebar:not(.flyout) .sidebar-link { justify-content: center; padding: 11px 0; margin: 2px 8px; }
  .sidebar:not(.flyout) .sidebar-user { padding: 10px 0; justify-content: center; }
  .sidebar:not(.flyout) .sidebar-brand::after { display: none; }

  /* ── Fly-out: expanded overlay ── */
  .sidebar.flyout {
    width: var(--sidebar-width);
    z-index: 1100;
    box-shadow: 4px 0 40px rgba(0,0,0,.35);
  }
  .sidebar.flyout .sidebar-brand__text,
  .sidebar.flyout .sidebar-section,
  .sidebar.flyout .sidebar-link__label,
  .sidebar.flyout .sidebar-user__info,
  .sidebar.flyout .sidebar-user__arrow,
  .sidebar.flyout .sidebar-footer__text,
  .sidebar.flyout .sidebar-toggle { display: flex; }
  .sidebar.flyout .sidebar-brand { padding: 22px 20px 16px; justify-content: flex-start; }
  .sidebar.flyout .sidebar-nav a,
  .sidebar.flyout .sidebar-link { justify-content: flex-start; padding: 10px 16px; margin: 2px 12px; }
  .sidebar.flyout .sidebar-user { padding: 14px 20px; justify-content: flex-start; }
  .sidebar.flyout .sidebar-brand::after { display: block; }


  /* ── Topbar: flush with sidebar width ── */
  .topbar {
    left: var(--sidebar-collapsed);
  }
  .topbar__toggle { display: flex; }
  .sidebar.flyout ~ .topbar { left: var(--sidebar-width); }

  /* ── Main content: full width ── */
  .main-content {
    margin-left: 0;
  }
  .main-content.sidebar-collapsed { margin-left: var(--sidebar-collapsed); }
  .sidebar.flyout ~ .main-content { margin-left: var(--sidebar-collapsed); }

  /* ── Hide mobile elements ── */
  .sic-topbar#mobile-header { display: none !important; }
  .sic-bottom-nav { display: none !important; }
  .sic-fab { display: none !important; }
  .sic-mobile-only { display: none !important; }
}

/* ═══ Hide desktop topbar on mobile ═══ */
@media (max-width: 767px) {
  .topbar { display: none; }
}

/* ═══════════════════════════════════════════════════════════════
   SIC TOPBAR — Menú de usuario
   ═══════════════════════════════════════════════════════════════ */

.sic-topbar-spacer { flex: 1; }

.sic-user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  transition: background .15s;
  position: relative;
  user-select: none;
}
.sic-user-menu:hover {
  background: var(--bg, #f5f6fa);
}
.sic-user-name {
  font-size: .82rem;
  font-weight: 500;
  color: var(--text, #2d3436);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sic-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent, #6c5ce7);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: .85rem;
  flex-shrink: 0;
}
.sic-chevron {
  font-size: .6rem;
  color: var(--text-muted, #636e72);
  transition: transform .2s;
}
.sic-user-menu:hover .sic-chevron {
  transform: rotate(180deg);
}

/* ─── Dropdown ─────────────────────────────────────────────── */

.sic-user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background: var(--card, #fff);
  border: 1px solid var(--border, #e0e0e0);
  border-radius: var(--radius, 12px);
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
  z-index: 1000;
  overflow: hidden;
}
.sic-user-dropdown.open {
  display: block;
}

.sic-dropdown-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg, #f5f6fa);
}
.sic-avatar-lg {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent, #6c5ce7);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.sic-dropdown-name {
  font-weight: 600;
  font-size: .9rem;
  color: var(--text, #2d3436);
}
.sic-dropdown-role {
  font-size: .75rem;
  color: var(--text-muted, #636e72);
  text-transform: capitalize;
}

.sic-dropdown-divider {
  height: 1px;
  background: var(--border, #e0e0e0);
}

.sic-dropdown-section {
  padding: 12px 16px;
}
.sic-dropdown-label {
  font-size: .7rem;
  font-weight: 600;
  color: var(--text-muted, #636e72);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 8px;
}

/* Controles de fuente */
.sic-font-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.sic-font-controls button {
  width: 32px;
  height: 28px;
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 4px;
  background: var(--card, #fff);
  cursor: pointer;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text, #2d3436);
  transition: all .15s;
}
.sic-font-controls button:hover {
  background: var(--accent, #6c5ce7);
  color: #fff;
  border-color: var(--accent);
}
.sic-btn-reset {
  margin-left: auto;
  font-size: .7rem !important;
  padding: 0 8px !important;
  width: auto !important;
}

/* Controles de tema */
.sic-theme-controls {
  display: flex;
  gap: 8px;
}
.sic-theme-btn {
  padding: 6px 12px;
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 6px;
  background: var(--card, #fff);
  cursor: pointer;
  font-size: .85rem;
  transition: all .15s;
}
.sic-theme-btn:hover {
  border-color: var(--accent, #6c5ce7);
}
.sic-theme-btn.active {
  background: var(--accent, #6c5ce7);
  color: #fff;
  border-color: var(--accent);
}

/* Items del dropdown */
.sic-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text, #2d3436);
  text-decoration: none;
  font-size: .82rem;
  transition: background .15s;
}
.sic-dropdown-item:hover {
  background: var(--bg, #f5f6fa);
}
.sic-dropdown-item i {
  width: 18px;
  text-align: center;
  color: var(--text-muted, #636e72);
  font-size: .85rem;
}
.sic-dropdown-item.sic-logout {
  color: #e74c3c;
}
.sic-dropdown-item.sic-logout i {
  color: #e74c3c;
}

/* ─── Botón login (cuando no hay sesión) ─── */
.sic-btn-login {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--accent, #6c5ce7);
  color: #fff;
  border-radius: var(--radius-sm, 6px);
  text-decoration: none;
  font-size: .82rem;
  font-weight: 500;
  transition: opacity .15s;
}
.sic-btn-login:hover { opacity: .85; }

/* ─── Hamburger (oculto en desktop, visible en mobile) ─── */
.sic-hamburger {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile (drawer + overlay)
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
  /* ─── Sidebar → off-canvas drawer ─── */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    max-width: 85vw;
    height: 100vh;
    height: 100dvh;
    z-index: 1100;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0, 0, 0, 0.3);
  }


  /* ─── Body scroll lock ─── */
  body.drawer-open {
    overflow: hidden;
    touch-action: none;
  }

  /* ─── Hamburger button ─── */
  .sic-hamburger {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text, #2d3436);
    font-size: 1.3rem;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }
  .sic-hamburger:hover,
  .sic-hamburger:active {
    background: rgba(0, 0, 0, 0.06);
  }

  /* ─── Main content: full width, no sidebar margin ─── */
  .main-content {
    margin-left: 0 !important;
    margin-top: 0 !important;
    width: 100%;
    padding: 16px 12px;
  }
}/* ═══════════════════════════════════════════════════════
   SIC MOBILE PRO — Experiencia móvil profesional
   CulturaRED | v1.0 | 2026-06-02
   
   Mejoras:
   - Bottom tab bar glass-morphism
   - Safe area (notch/island) support
   - Skeleton loading con shimmer
   - Cards adaptativas (reemplazan tablas)
   - Touch targets ≥44px (Apple HIG)
   - Pull-to-refresh nativo
   - Animaciones 60fps (transform/opacity)
   - Floating action button (FAB)
   ═══════════════════════════════════════════════════════ */

/* ═══ CUSTOM PROPERTIES ═══ */

/* ═══════════════════════════════════════════════════════
   MOBILE ONLY (≤767px)
   ═══════════════════════════════════════════════════════ */
@media(max-width: 767px) {

/* ── Body ── */
body {
  padding-bottom: calc(var(--mobile-tab-height) + env(safe-area-inset-bottom, 0px) + 8px);
  padding-top: var(--mobile-header-height);
}

/* ── Mobile Header ── */
.sic-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--mobile-header-height);
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 0.5px solid rgba(0,0,0,.08);
  z-index: 950;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 10px;
}
.sic-topbar .sic-hamburger {
  width: var(--touch-min); height: var(--touch-min);
  border: none; background: transparent;
  font-size: 1.3rem; color: var(--text);
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--mobile-radius);
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.sic-topbar .sic-hamburger:active { background: rgba(0,0,0,.06); }
.sic-topbar .sic-module-title {
  flex: 1;
  font-weight: 600;
  font-size: .95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sic-topbar .sic-topbar-actions {
  display: flex; gap: 4px; align-items: center;
}
.sic-topbar .sic-topbar-actions button,
.sic-topbar .sic-topbar-actions a {
  width: var(--touch-min); height: var(--touch-min);
  border-radius: var(--mobile-radius);
  border: none; background: transparent;
  color: var(--text-secondary);
  font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.sic-topbar .sic-topbar-actions button:active,
.sic-topbar .sic-topbar-actions a:active {
  background: rgba(0,0,0,.06);
}

/* ── Bottom Tab Bar (glass-morphism) ── */
.sic-bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--mobile-tab-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-top: 0.5px solid rgba(0,0,0,.08);
  z-index: 950;
  display: flex !important;
  align-items: center;
  justify-content: space-around;
  box-shadow: var(--mobile-shadow);
}
.sic-bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: .62rem;
  font-weight: 500;
  position: relative;
  transition: color .2s;
  -webkit-tap-highlight-color: transparent;
}
.sic-bottom-nav a:active {
  transform: scale(.92);
  transition: transform .1s;
}
.sic-bottom-nav a i {
  font-size: 1.3rem;
  transition: transform .2s, color .2s;
}
.sic-bottom-nav a.active {
  color: var(--accent);
  font-weight: 600;
}
.sic-bottom-nav a.active i {
  transform: translateY(-2px);
}
.sic-bottom-nav a.active::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--accent);
  border-radius: 0 0 3px 3px;
}
/* Badge en bottom nav */
.sic-bottom-nav a .nav-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 20px);
  background: #e74c3c;
  color: #fff;
  font-size: .55rem;
  font-weight: 700;
  padding: 0 5px;
  border-radius: 8px;
  min-width: 16px;
  text-align: center;
  line-height: 1.5;
  box-shadow: 0 1px 4px rgba(231,76,60,.4);
}



/* ── Floating Action Button ── */
.sic-fab {
  position: fixed;
  bottom: calc(var(--mobile-tab-height) + env(safe-area-inset-bottom, 0px) + 20px);
  right: 20px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  box-shadow: 0 4px 16px rgba(108,92,231,.4);
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 900;
  transition: transform .2s, box-shadow .2s;
  -webkit-tap-highlight-color: transparent;
}
.sic-fab:active {
  transform: scale(.9);
  box-shadow: 0 2px 8px rgba(108,92,231,.3);
}

/* ── Skeleton Loading ── */
.sic-skeleton {
  background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%);
  background-size: 200% 100%;
  animation: sic-shimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
  pointer-events: none;
  user-select: none;
}
@keyframes sic-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.sic-skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  width: 80%;
}
.sic-skeleton-text:last-child { width: 60%; }
.sic-skeleton-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sic-skeleton-card {
  padding: 16px;
  background: var(--card);
  border-radius: var(--mobile-radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  display: flex;
  gap: 14px;
}

/* ── Mobile Cards (reemplaza tablas) ── */
.sic-mobile-card {
  background: var(--card);
  border-radius: var(--mobile-radius);
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}
.sic-mobile-card:active {
  transform: scale(.98);
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.sic-mobile-card .card-avatar {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.sic-mobile-card .card-body { flex: 1; min-width: 0; }
.sic-mobile-card .card-title {
  font-weight: 600;
  font-size: .9rem;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sic-mobile-card .card-subtitle {
  font-size: .78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sic-mobile-card .card-meta {
  display: flex; gap: 8px; margin-top: 4px;
  font-size: .72rem; color: var(--text-secondary);
}
.sic-mobile-card .card-actions {
  display: flex; gap: 4px; flex-shrink: 0;
}
.sic-mobile-card .card-actions button {
  width: var(--touch-min); height: var(--touch-min);
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--card);
  font-size: .9rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.sic-mobile-card .card-actions button:active { background: rgba(0,0,0,.05); }

/* Ocultar tablas en mobile, mostrar cards */
.sic-desktop-only { display: none !important; }

/* ── Formularios mobile ── */
.sic-form-group { margin-bottom: 16px; }
.sic-form-group label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.sic-form-group input,
.sic-form-group select,
.sic-form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--mobile-radius);
  font-size: .9rem;
  font-family: inherit;
  background: var(--card);
  -webkit-appearance: none;
}
.sic-form-group input:focus,
.sic-form-group select:focus,
.sic-form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108,92,231,.12);
}

/* ── Pull-to-refresh indicator ── */
.sic-pull-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 0;
  overflow: hidden;
  transition: height .2s;
  color: var(--text-secondary);
  font-size: .8rem;
}
.sic-pull-indicator.pulling { height: 48px; }

/* ── Toast notifications ── */
.sic-toast {
  position: fixed;
  top: calc(var(--mobile-header-height) + env(safe-area-inset-top, 0px) + 8px);
  left: 16px; right: 16px;
  padding: 12px 16px;
  border-radius: var(--mobile-radius);
  color: #fff;
  font-size: .85rem;
  font-weight: 500;
  z-index: 2000;
  transform: translateY(-120%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
}
.sic-toast.show { transform: translateY(0); }
.sic-toast.success { background: #2e7d32; }
.sic-toast.error   { background: #c62828; }
.sic-toast.info    { background: #1565c0; }

/* ── Swipe hint ── */
.sic-swipe-hint {
  position: absolute;
  left: 4px; top: 50%;
  transform: translateY(-50%);
  width: 4px; height: 32px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0;
  transition: opacity .3s;
}
.sic-mobile-card:hover .sic-swipe-hint,
.sic-mobile-card:active .sic-swipe-hint { opacity: .3; }

} /* end @media(max-width:767px) */

/* ═══════════════════════════════════════════════════════
   DESKTOP ONLY (≥1025px) — ocultar elementos mobile
   ═══════════════════════════════════════════════════════ */
@media(min-width: 1025px) {
  .sic-bottom-nav { display: none !important; }
  .sic-fab { display: none !important; }
  .sic-mobile-only { display: none !important; }
  .topbar__toggle { display: none !important; } /* desktop uses sidebar toggle */
}

/* ═══════════════════════════════════════════════════════
   BREADCRUMB — Navegación contextual
   ═══════════════════════════════════════════════════════ */
.sic-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted, #636e72);
  margin-left: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sic-breadcrumb-link {
  color: var(--primary, #6c5ce7);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s;
}
.sic-breadcrumb-link:hover {
  color: var(--primary-dark, #5a4bd1);
  text-decoration: underline;
}
.sic-breadcrumb-link i {
  font-size: 0.75rem;
}
.sic-breadcrumb-sep {
  color: var(--border, #dfe6e9);
  font-size: 0.75rem;
  margin: 0 2px;
}
.sic-breadcrumb-current {
  color: var(--text, #2d3436);
  font-weight: 500;
}

/* Mobile: hide breadcrumb (too narrow) */
@media(max-width: 767px) {
  .sic-breadcrumb { display: none; }
}


/* ═══════════════════════════════════════════════════════
   TOAST / LOG SYSTEM — toast-log-system.js
   ═══════════════════════════════════════════════════════ */

/* Toast container */
.sic-toast-container {
  position: fixed;
  top: 70px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 400px;
}

/* Individual toast */
.sic-toast-container .sic-toast {
  pointer-events: auto;
  padding: 12px 16px;
  border-radius: 8px;
  color: #fff;
  font-size: 0.85rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  opacity: 1;
  transform: none;
  position: relative;
  top: auto; left: auto; right: auto;
  text-align: left;
  transition: opacity 0.35s, transform 0.35s;
  cursor: pointer;
}

.sic-toast--info { background: #1565c0; }
.sic-toast--success { background: #2e7d32; }
.sic-toast--error { background: #c62828; }
.sic-toast--warning { background: #e65100; }

.sic-toast__meta {
  display: flex;
  gap: 8px;
  font-size: 0.72rem;
  opacity: 0.85;
  margin-bottom: 4px;
}
.sic-toast__mod { font-weight: 600; }
.sic-toast__code { font-family: monospace; }
.sic-toast__time { margin-left: auto; }
.sic-toast__body { font-weight: 500; }

/* Ticker bar (fixed bottom) */
.sic-ticker {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-width);
  right: 0;
  height: 32px;
  background: var(--sidebar-bg, #1a1a2e);
  border-top: 1px solid var(--border-color, #2d2d44);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 8px;
  z-index: 1000;
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--text-secondary, #94a3b8);
}
.sic-ticker:hover { background: var(--sidebar-hover, #16213e); }
.sic-ticker__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}
.sic-ticker__text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sic-ticker__count {
  flex-shrink: 0;
  font-weight: 600;
  color: var(--accent, #6c5ce7);
}

/* History panel (slide-up) */
.sic-panel {
  position: fixed;
  bottom: 32px;
  left: var(--sidebar-width);
  right: 0;
  max-height: 0;
  background: var(--sidebar-bg, #1a1a2e);
  border-top: 2px solid var(--accent, #6c5ce7);
  z-index: 999;
  overflow: hidden;
  transition: max-height 0.3s ease;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
}
.sic-panel--open { max-height: 300px; overflow-y: auto; }
.sic-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color, #2d2d44);
  color: var(--text-primary, #e2e8f0);
  font-size: 0.85rem;
}
.sic-panel__close {
  background: none;
  border: none;
  color: var(--text-secondary, #94a3b8);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.sic-panel__close:hover { color: #fff; }
.sic-panel__rows {
  padding: 4px 0;
  max-height: 240px;
  overflow-y: auto;
}
.sic-panel__row {
  padding: 6px 16px;
  font-size: 0.8rem;
  color: var(--text-primary, #e2e8f0);
  border-bottom: 1px solid var(--border-color, #2d2d44);
}
.sic-panel__row--info { border-left: 3px solid #1565c0; }
.sic-panel__row--success { border-left: 3px solid #2e7d32; }
.sic-panel__row--error { border-left: 3px solid #c62828; }
.sic-panel__row--warning { border-left: 3px solid #e65100; }

/* Mobile adjustments */
@media(max-width: 767px) {
  .sic-toast-container { top: auto; bottom: 60px; right: 8px; left: 8px; max-width: none; }
  .sic-panel { bottom: 32px; }
}

/* ── Popup Toast (centrado, con icono) ── */
.sic-popup-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 99998;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
.sic-popup-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}
.sic-popup-toast {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  max-width: 360px;
  width: calc(100% - 48px);
  padding: 28px 24px 24px;
  border-radius: 16px;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  z-index: 99999;
  box-shadow: 0 16px 48px rgba(0,0,0,0.35);
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s cubic-bezier(.34,1.56,.64,1);
  pointer-events: none;
  line-height: 1.5;
  cursor: pointer;
  user-select: none;
}
.sic-popup-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}
.sic-popup-toast.error   { background: #c62828; }
.sic-popup-toast.success { background: #2e7d32; }
.sic-popup-toast.info    { background: #1565c0; }
.sic-popup-toast.warning { background: #e65100; }
.sic-popup-toast__icon {
  font-size: 2.4rem;
  margin-bottom: 12px;
}
.sic-popup-toast__text {
  font-size: 0.93rem;
  line-height: 1.45;
}

@media(max-width: 480px) {
  .sic-popup-toast {
    max-width: 300px;
    padding: 24px 20px 20px;
  }
  .sic-popup-toast__icon {
    font-size: 2rem;
    margin-bottom: 10px;
  }
}

/* Mobile user: show only on mobile, hide on desktop */
@media(min-width: 768px) {
  .mobile-only { display: none !important; }
}
@media(max-width: 767px) {
  .sidebar-user.mobile-only { display: flex; }
  .user-dropdown.mobile-only { display: none; }
  .user-dropdown.mobile-only.open { display: block; }
}

/* ═══════════════════════════════════════════════════════════
   SISTEMA DE 6 TEMAS PROFESIONALES — TS-22
   ═══════════════════════════════════════════════════════════ */

[data-theme="sunset"] {
  --bg: #fff7ed;
  --bg-main: #ffffff;
  --card: #ffffff;
  --text: #431407;
  --text-primary: #431407;
  --text-secondary: #9a3412;
  --border: #fed7aa;
  --color-text: #431407;
  --color-surface: #fff7ed;
  --color-container: #ffffff;
  --color-sidebar: #7c2d12;
  --shadow: 0 1px 3px rgba(234,88,12,.08);
  --shadow-lg: 0 4px 16px rgba(234,88,12,.12);
  --primary: #ea580c;
  --primary-hover: #c2410c;
  --primary-light: rgba(234,88,12,.1);
}

[data-theme="forest"] {
  --bg: #f0fdf4;
  --bg-main: #ffffff;
  --card: #ffffff;
  --text: #14532d;
  --text-primary: #14532d;
  --text-secondary: #166534;
  --border: #bbf7d0;
  --color-text: #14532d;
  --color-surface: #f0fdf4;
  --color-container: #ffffff;
  --color-sidebar: #14532d;
  --shadow: 0 1px 3px rgba(22,163,74,.08);
  --shadow-lg: 0 4px 16px rgba(22,163,74,.12);
  --primary: #16a34a;
  --primary-hover: #15803d;
  --primary-light: rgba(22,163,74,.1);
}

[data-theme="ocean"] {
  --bg: #eff6ff;
  --bg-main: #ffffff;
  --card: #ffffff;
  --text: #1e3a5f;
  --text-primary: #1e3a5f;
  --text-secondary: #1d4ed8;
  --border: #bfdbfe;
  --color-text: #1e3a5f;
  --color-surface: #eff6ff;
  --color-container: #ffffff;
  --color-sidebar: #1e3a5f;
  --shadow: 0 1px 3px rgba(37,99,235,.08);
  --shadow-lg: 0 4px 16px rgba(37,99,235,.12);
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: rgba(37,99,235,.1);
}

[data-theme="midnight"] {
  --bg: #0a0e1a;
  --bg-main: #0f1629;
  --card: #0f1629;
  --text: #c8d3f0;
  --text-primary: #c8d3f0;
  --text-secondary: #637bb6;
  --border: #1e2d4a;
  --color-text: #c8d3f0;
  --color-surface: #0a0e1a;
  --color-container: #0f1629;
  --color-sidebar: #060810;
  --shadow: 0 1px 3px rgba(0,0,0,.6);
  --shadow-lg: 0 8px 32px rgba(74,158,255,.15);
  --primary: #4a9eff;
  --primary-hover: #6bb3ff;
  --primary-light: rgba(74,158,255,.15);
}

/* ── Herencia global de variables por tema ── */
[data-theme] body,
[data-theme] .app-wrapper {
  background: var(--bg);
  color: var(--text-primary);
}
[data-theme] .app-content,
[data-theme] .main-content,
[data-theme] .page-content {
  background: var(--bg);
  color: var(--text-primary);
}
[data-theme] .app-sidebar {
  background: var(--sidebar-bg,
    var(--color-sidebar,
    var(--bg-main, #1a1a2e)));
}
[data-theme] .card,
[data-theme] .stat-card,
[data-theme] .kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  color: var(--text-primary);
}
[data-theme] table,
[data-theme] thead,
[data-theme] tbody,
[data-theme] tr,
[data-theme] td,
[data-theme] th {
  color: var(--text-primary);
  border-color: var(--border);
}
[data-theme] tbody tr:hover {
  background: var(--primary-light);
}
[data-theme] input,
[data-theme] select,
[data-theme] textarea {
  background: var(--bg-main);
  border: 1px solid var(--border);
  color: var(--text-primary);
}
[data-theme] input::placeholder,
[data-theme] textarea::placeholder {
  color: var(--text-secondary);
}
[data-theme] .btn-primary {
  background: var(--primary);
  color: #ffffff;
  border: none;
}
[data-theme] .btn-primary:hover {
  background: var(--primary-hover);
}

/* ── Cards de eventos sin imagen ── */
.event-card-image {
  height: 120px;
  background: linear-gradient(135deg,
    var(--primary) 0%,
    var(--primary-hover) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.5);
  font-size: 2rem;
}
.event-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Lista de temas en personalizar ── */
.theme-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
  background: var(--card);
  transition: box-shadow .15s;
}
.theme-list-item:hover {
  box-shadow: var(--shadow);
}
.theme-list-swatch {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  flex-shrink: 0;
}
.theme-list-info { flex: 1; }
.theme-list-name {
  font-weight: 600;
  font-size: .9rem;
  color: var(--text-primary);
}
.theme-list-slug {
  display: inline-block;
  font-size: .7rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--primary-light);
  color: var(--primary);
  font-family: monospace;
}
.theme-list-actions {
  display: flex;
  gap: 4px;
}

/* ════════════════════════════════════
   LAYOUT SISTEMA — SIC
   Sin inline, todo controlado aquí
   ════════════════════════════════════ */

/* ── Base: variables de layout ── */
:root {
  --sidebar-w:      260px;
  --sidebar-w-sm:   200px;
  --sidebar-w-icon:  64px;
  --topbar-h:        60px;
}

/* ── Desktop (> 1024px): Grid clásico ── */
@media (min-width: 1025px) {
  .app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--topbar-height) 1fr;
    grid-template-areas:
      "sidebar topbar"
      "sidebar content";
    min-height: 100vh;
  }
  .app-sidebar {
    grid-area: sidebar;
    position: sticky;
    top: 0;
    height: 100vh;
    width: var(--sidebar-width);
    overflow-y: auto;
    z-index: 100;
    background: var(--sidebar-bg, #1a1a2e);
    color: var(--sidebar-text, #e2e8f0);
    display: flex;
    flex-direction: column;
    transition: width .3s ease;
  }
  .app-sidebar.collapsed {
    width: var(--sidebar-collapsed);
  }
  .app-topbar {
    grid-area: topbar;
    position: sticky;
    top: 0;
    z-index: 90;
    height: var(--topbar-height);
    background: var(--topbar-bg, #ffffff);
    border-bottom: 1px solid var(--topbar-border, #e2e8f0);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
  }
  .app-content,
  .app-main {
    grid-area: content;
    padding: 30px 40px;
    background: var(--bg, #f4f6f9);
    min-height: calc(100vh - var(--topbar-height));
    overflow-y: auto;
    max-width: 1400px;
    margin: 0 auto;
  }
  /* Colapso desktop */
  .app-layout.sidebar-collapsed {
    grid-template-columns: var(--sidebar-collapsed) 1fr;
  }
  /* Ocultar elementos mobile en desktop */
  .hamburger-btn,
  .sidebar-overlay,
  .bottom-nav { display: none !important; }
}

/* ── Tablet (768px – 1024px): sidebar compacto + flyout ── */
@media (min-width: 768px) and (max-width: 1024px) {
  .app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-collapsed, 64px) 1fr;
    grid-template-rows: var(--topbar-height) 1fr;
    grid-template-areas:
      "sidebar topbar"
      "sidebar content";
    min-height: 100vh;
  }
  .app-sidebar {
    grid-area: sidebar;
    position: sticky;
    top: 0;
    height: 100vh;
    width: var(--sidebar-collapsed, 64px);
    overflow-y: auto;
    z-index: 100;
    background: var(--sidebar-bg, #1a1a2e);
    color: var(--sidebar-text, #e2e8f0);
    display: flex;
    flex-direction: column;
    transition: width .3s ease;
  }
  /* Collapsed sidebar: icon-only by default on tablet */
  .app-sidebar:not(.flyout) .sidebar-brand-text,
  .app-sidebar:not(.flyout) .nav-item-label,
  .app-sidebar:not(.flyout) .nav-item-badge,
  .app-sidebar:not(.flyout) .nav-group-label,
  .app-sidebar:not(.flyout) .sidebar-user-info,
  .app-sidebar:not(.flyout) .sidebar-version,
  .app-sidebar:not(.flyout) .sidebar-brand-sub { display: none; }
  .app-sidebar:not(.flyout) .nav-item { justify-content: center; padding: 12px; margin: 2px 6px; }
  .app-sidebar:not(.flyout) .sidebar-brand { justify-content: center; }
  /* Flyout: full overlay */
  .app-sidebar.flyout {
    width: var(--sidebar-width, 260px);
    z-index: 1100;
    box-shadow: 4px 0 40px rgba(0,0,0,.35);
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
  }
  .app-topbar {
    grid-area: topbar;
    position: sticky;
    top: 0;
    z-index: 90;
    height: var(--topbar-height);
    background: var(--topbar-bg, #ffffff);
    border-bottom: 1px solid var(--topbar-border, #e2e8f0);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
  }
  .app-content,
  .app-main {
    grid-area: content;
    padding: 20px;
    background: var(--bg, #f4f6f9);
    overflow-y: auto;
  }
  /* Ocultar mobile en tablet */
  .hamburger-btn,
  .sidebar-overlay,
  .bottom-nav { display: none !important; }
  /* Texto sidebar compacto */
  .nav-item-label { font-size: .8rem; }
  .sidebar-brand-sub { display: none; }
}

/* ── Mobile (< 768px): Drawer + Bottom Nav ── */
@media (max-width: 767px) {
  /* Layout simple: columna única */
  .app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-bottom: 60px;
  }

  /* Raíz: prevenir cualquier overflow */
  html { overflow-x: hidden; scrollbar-width: none; }
  body { overflow-x: hidden; }
  .app-layout { overflow-x: hidden; }

  /* Topbar fijo arriba */
  .app-topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    z-index: 300;
    background: var(--topbar-bg, #ffffff);
    border-bottom: 1px solid var(--topbar-border, #e2e8f0);
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
  }

  /* Contenido con margen topbar */
  .app-content,
  .app-main {
    margin-top: var(--topbar-h);
    padding: 12px 16px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
    background: var(--bg, #f4f6f9);
    flex: 1;
    width: 100%;
    word-break: break-word;
  }

  /* Sidebar: DRAWER oculto por defecto */
  .app-sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 280px;
    height: 100vh;
    z-index: 400;
    background: var(--sidebar-bg, #1a1a2e);
    color: var(--sidebar-text, #e2e8f0);
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    overflow-y: auto;
    box-shadow: none;
  }

  /* Sidebar abierto */
  .app-sidebar.open,
  .app-sidebar.drawer-open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0,0,0,.4);
  }

  /* Overlay para cerrar */
  .sidebar-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.5);
    z-index: 399;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
  }
  .sidebar-overlay.active {
    opacity: 1;
    pointer-events: all;
    animation: fadeIn .2s ease;
  }
  @keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

  /* Botón hamburger */
  .hamburger-btn {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
    cursor: pointer;
    border: none;
    background: transparent;
    border-radius: 8px;
    flex-shrink: 0;
    transition: background .2s;
  }
  .hamburger-btn:hover {
    background: var(--primary-light, rgba(108,92,231,.1));
  }
  .hamburger-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--topbar-text, #1a1a2e);
    border-radius: 2px;
    transition: all .3s;
  }

  /* Bottom Navigation */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 60px;
    background: var(--topbar-bg, #ffffff);
    border-top: 1px solid var(--topbar-border, #e2e8f0);
    z-index: 200;
    box-shadow: 0 -2px 8px rgba(0,0,0,.08);
    padding: 0 env(safe-area-inset-right, 0px);
  }
  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: .65rem;
    color: var(--text-secondary, #64748b);
    text-decoration: none;
    padding: 6px 4px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: color .2s;
    min-height: 44px;
  }
  .bottom-nav-item.active,
  .bottom-nav-item:hover {
    color: var(--primary, #6c5ce7);
  }
  .bottom-nav-item i,
  .bottom-nav-item .nav-icon {
    font-size: 1.2rem;
  }

  /* Ocultar elementos desktop */
  .desktop-only,
  .sidebar-collapse-btn { display: none !important; }

  /* Ocultar ticker/log bar en mobile — compite con bottom-nav */
  .sic-ticker,
  #sic-ticker-bar { display: none !important; }

  /* Bottom-nav sin borde superior en mobile (la sombra basta) */
  .bottom-nav { border-top: none !important; }

  /* Tablas → scroll horizontal */
  .table-wrapper,
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius, 10px);
  }

  /* KPI 2 columnas */
  .kpi-grid, .stats-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  /* Formularios columna única */
  .form-row {
    flex-direction: column !important;
  }
  .form-group {
    width: 100% !important;
  }
  input, select, textarea {
    font-size: 16px !important;
  }

  /* Búsqueda topbar oculta en mobile
     (se muestra como barra separada en página) */
  .topbar-search { display: none; }

  /* ── Mejoras confort mobile ── */

  /* Evitar overflow horizontal */
  .app-content,
  .app-main { overflow-x: hidden; }

  /* KPI cards: 1 columna apilados */
  .kpi-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }
  .kpi-card {
    flex-direction: row !important;
    align-items: center !important;
    text-align: left !important;
    padding: 12px 16px !important;
    gap: 10px !important;
    border-radius: 10px !important;
  }
  .kpi-card__icon {
    width: 32px !important;
    height: 32px !important;
    font-size: .85rem !important;
    border-radius: 8px !important;
    flex-shrink: 0;
  }
  .kpi-card__body {
    align-items: flex-start !important;
    gap: 0 !important;
  }
  .kpi-card__value {
    font-size: 1.15rem !important;
    line-height: 1.2;
  }
  .kpi-card__label {
    font-size: .72rem !important;
    line-height: 1.2;
  }
  .kpi-card__sub {
    font-size: .65rem !important;
  }

  /* Bottom nav más táctil y compacto */
  .bottom-nav-item {
    min-height: 48px;
    gap: 2px;
    padding: 8px 2px;
  }
  .bottom-nav-item i,
  .bottom-nav-item .nav-icon {
    font-size: 1.1rem;
  }
  .bottom-nav-item span {
    font-size: .58rem;
  }

  /* Welcome text más compacto */
  .dashboard-welcome h2 { font-size: 1.1rem; }
  .dashboard-subtitle { font-size: .75rem; }
}

/* ── Utilidades responsive ── */
.mobile-only  { display: none; }
.tablet-only  { display: none; }
.desktop-only { display: block; }

@media (max-width: 767px) {
  .mobile-only  { display: block; }
  .desktop-only { display: none; }
}
@media (min-width: 768px) and (max-width: 1024px) {
  .tablet-only  { display: block; }
}

/* ════════════════════════════════════════
   SIDEBAR PROFESIONAL — SIC v2.6.0
   Controlado desde admin-personalizacion.php
   ════════════════════════════════════════ */

/* ── Estructura base (solo desktop/tablet) ── */
@media (min-width: 768px) {
.app-sidebar {
  width: var(--sidebar-width, 260px);
  background: var(--sidebar-bg, #1a1a2e);
  color: var(--sidebar-text, #e2e8f0);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  top: 0; left: 0;
  z-index: 200;
  transition: width .3s ease, transform .3s ease;
  overflow: hidden;
  box-shadow: 2px 0 12px rgba(0,0,0,.15);
}

/* ── Logo / Brand ── */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
  text-decoration: none;
  min-height: var(--topbar-height, 60px);
}
.sidebar-brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--sidebar-accent, #6c5ce7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(108,92,231,.4);
}
.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-brand-name {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: .3px;
  white-space: nowrap;
}
.sidebar-brand-sub {
  font-size: .68rem;
  color: rgba(255,255,255,.5);
  white-space: nowrap;
  margin-top: 1px;
}

/* ── Navegación ── */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.15);
  border-radius: 4px;
}
/* ── Grupos de navegación ── */
.nav-group {
  margin-bottom: 4px;
}
.nav-group-label {
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
  padding: 16px 20px 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-group-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,.06);
}

/* ── Items de navegación ── */
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: var(--nav-padding, 10px) 16px;
  margin: 2px 10px;
  border-radius: var(--nav-radius, 8px);
  color: var(--sidebar-text, #e2e8f0);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  transition: all .2s ease;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  opacity: .75;
}
.nav-item:hover {
  background: rgba(255,255,255,.08);
  color: #ffffff;
  opacity: 1;
  transform: translateX(2px);
}
.nav-item.active {
  background: linear-gradient(135deg,
    var(--sidebar-accent, #6c5ce7) 0%,
    color-mix(in srgb,
      var(--sidebar-accent, #6c5ce7) 80%,
      #ffffff) 100%);
  color: var(--sidebar-accent-t, #ffffff);
  opacity: 1;
  box-shadow: 0 2px 8px rgba(108,92,231,.35);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: #ffffff;
  border-radius: 0 3px 3px 0;
}
.nav-item-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}
.nav-item-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-item-badge {
  background: var(--sidebar-accent, #6c5ce7);
  color: white;
  font-size: .65rem;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
  flex-shrink: 0;
}
.nav-item.active .nav-item-badge {
  background: rgba(255,255,255,.25);
}

/* ── Footer del sidebar ── */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .2s;
}
.sidebar-user:hover {
  background: rgba(255,255,255,.06);
}
.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--avatar-bg, #6c5ce7);
  color: var(--avatar-text, #ffffff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .85rem;
  flex-shrink: 0;
  position: relative;
}
.sidebar-avatar::after {
  content: '';
  position: absolute;
  bottom: 0; right: 0;
  width: 10px;
  height: 10px;
  background: var(--status-color, #10b981);
  border: 2px solid var(--sidebar-bg, #1a1a2e);
  border-radius: 50%;
}
.sidebar-user-info {
  flex: 1;
  overflow: hidden;
}
.sidebar-user-name {
  font-size: .82rem;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: .7rem;
  color: rgba(255,255,255,.4);
}
.sidebar-version {
  font-size: .65rem;
  color: rgba(255,255,255,.25);
  text-align: center;
  margin-top: 8px;
  letter-spacing: .5px;
}

/* ── Colapso sidebar ── */
.app-sidebar.collapsed {
  width: 64px;
}
.app-sidebar.collapsed .sidebar-brand-text,
.app-sidebar.collapsed .nav-item-label,
.app-sidebar.collapsed .nav-item-badge,
.app-sidebar.collapsed .nav-group-label,
.app-sidebar.collapsed .sidebar-user-info,
.app-sidebar.collapsed .sidebar-version {
  opacity: 0;
  width: 0;
  overflow: hidden;
}
.app-sidebar.collapsed .sidebar-brand-icon {
  margin: 0 auto;
}
.app-sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 12px;
  margin: 2px 6px;
}
.app-sidebar.collapsed .nav-item::before {
  display: none;
}
.app-sidebar.collapsed + .app-main {
  margin-left: 64px;
}
/* ── Tooltip en sidebar colapsado ── */
.app-sidebar.collapsed .nav-item {
  position: relative;
}
.app-sidebar.collapsed .nav-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,.85);
  color: #ffffff;
  font-size: .78rem;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  z-index: 1000;
}
.app-sidebar.collapsed .nav-item:hover::after {
  opacity: 1;
}

/* ── Botón colapsar ── */
.sidebar-collapse-btn {
  position: absolute;
  top: 20px;
  right: -12px;
  width: 24px;
  height: 24px;
  background: var(--sidebar-accent, #6c5ce7);
  border: 2px solid var(--sidebar-bg, #1a1a2e);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: .7rem;
  color: white;
  z-index: 10;
  transition: transform .3s;
}
.app-sidebar.collapsed .sidebar-collapse-btn {
  transform: rotate(180deg);
  right: -12px;
}
} /* end @media (min-width: 768px) sidebar profesional */

/* ════════════════════════════════════════
   TOPBAR PROFESIONAL — SIC v2.6.0
   ════════════════════════════════════════ */

.app-topbar {
  height: var(--topbar-height, 60px);
  background: var(--topbar-bg, #ffffff);
  border-bottom: 1px solid var(--topbar-border, #e2e8f0);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

/* ── Breadcrumb ── */
.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .85rem;
  flex: 1;
}
.topbar-breadcrumb a {
  color: var(--text-secondary, #64748b);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color .2s;
}
.topbar-breadcrumb a:hover {
  color: var(--primary, #6c5ce7);
}
.topbar-breadcrumb-sep {
  color: var(--border, #e2e8f0);
  font-size: 1rem;
  user-select: none;
}
.topbar-breadcrumb-current {
  color: var(--topbar-text, #1a1a2e);
  font-weight: 600;
}

/* ── Búsqueda ── */
.topbar-search {
  position: relative;
  max-width: 320px;
  width: 100%;
}
.topbar-search-input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1.5px solid var(--topbar-border, #e2e8f0);
  border-radius: 20px;
  background: var(--bg, #f4f6f9);
  color: var(--topbar-text, #1a1a2e);
  font-size: .85rem;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.topbar-search-input:focus {
  border-color: var(--primary, #6c5ce7);
  box-shadow: 0 0 0 3px rgba(108,92,231,.12);
  background: var(--card, #ffffff);
}
.topbar-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary, #64748b);
  font-size: .9rem;
  pointer-events: none;
}

/* ── Dropdown de búsqueda ── */
.topbar-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-width: 380px;
  margin-top: 6px;
  background: var(--card, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,.12);
  z-index: 999;
  overflow: hidden;
  animation: searchFadeIn .15s ease-out;
}
@keyframes searchFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.search-dropdown-body {
  max-height: 320px;
  overflow-y: auto;
}
.search-dropdown-footer {
  padding: 6px 14px;
  font-size: .75rem;
  color: var(--text-secondary, #64748b);
  border-top: 1px solid var(--border, #e2e8f0);
  background: var(--bg-tooltip, #f8f9fa);
  text-align: right;
}
.search-loading {
  padding: 20px;
  text-align: center;
  color: var(--text-secondary, #64748b);
  font-size: .85rem;
}
.search-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-secondary, #64748b);
  font-size: .85rem;
}
.search-group {
  padding: 4px 0;
}
.search-group-title {
  padding: 6px 14px 2px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-secondary, #64748b);
}
.search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  text-decoration: none;
  color: var(--text-primary, #1a1a2e);
  transition: background .12s;
  gap: 8px;
}
.search-item:hover {
  background: var(--hover, #f1f5f9);
}
.search-item-label {
  font-size: .85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-item-detail {
  font-size: .75rem;
  color: var(--text-secondary, #64748b);
  flex-shrink: 0;
}
[data-theme="dark"] .topbar-search-dropdown,
[data-theme="midnight"] .topbar-search-dropdown {
  background: var(--card, #1e1e2e);
  border-color: var(--border, #313244);
  box-shadow: 0 8px 30px rgba(0,0,0,.4);
}
[data-theme="dark"] .search-item:hover,
[data-theme="midnight"] .search-item:hover {
  background: var(--hover, #2a2a3d);
}
[data-theme="dark"] .search-dropdown-footer,
[data-theme="midnight"] .search-dropdown-footer {
  background: var(--bg-tooltip, #181825);
  border-color: var(--border, #313244);
}

/* ── Acciones topbar ── */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.topbar-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary, #64748b);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .2s;
  position: relative;
  font-size: 1rem;
}
.topbar-btn:hover {
  background: var(--bg, #f4f6f9);
  color: var(--topbar-text, #1a1a2e);
}

/* ── Badge notificaciones ── */
.notif-badge {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 16px;
  height: 16px;
  background: var(--notif-color, #ef4444);
  color: white;
  font-size: .6rem;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  border: 2px solid var(--topbar-bg, #ffffff);
}
.notif-badge.pulse {
  animation: notif-pulse 2s infinite;
}
@keyframes notif-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.4); }
  50%       { box-shadow: 0 0 0 4px rgba(239,68,68,0); }
}
/* ── Avatar topbar ── */
.topbar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg,
    var(--avatar-bg, #6c5ce7),
    color-mix(in srgb,
      var(--avatar-bg, #6c5ce7) 70%,
      #ffffff));
  color: var(--avatar-text, #ffffff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .82rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color .2s, box-shadow .2s;
  position: relative;
}
.topbar-avatar:hover {
  border-color: var(--primary, #6c5ce7);
  box-shadow: 0 0 0 3px rgba(108,92,231,.15);
}
.topbar-avatar-status {
  position: absolute;
  bottom: 0; right: 0;
  width: 10px;
  height: 10px;
  background: var(--status-color, #10b981);
  border: 2px solid var(--topbar-bg, #ffffff);
  border-radius: 50%;
}

/* ── Dropdown usuario ── */
.topbar-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: var(--card, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  box-shadow: var(--shadow-lg,
    0 8px 24px rgba(0,0,0,.12));
  overflow: hidden;
  z-index: 1000;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: all .2s ease;
}
.topbar-dropdown.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}
.topbar-dropdown-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  background: var(--bg, #f4f6f9);
}
.topbar-dropdown-name {
  font-weight: 600;
  font-size: .9rem;
  color: var(--text-primary, #1a1a2e);
}
.topbar-dropdown-email {
  font-size: .75rem;
  color: var(--text-secondary, #64748b);
  margin-top: 2px;
}
.topbar-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text-primary, #1a1a2e);
  text-decoration: none;
  font-size: .85rem;
  transition: background .15s;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.topbar-dropdown-item:hover {
  background: var(--bg, #f4f6f9);
  color: var(--primary, #6c5ce7);
}
.topbar-dropdown-item.danger:hover {
  background: #fef2f2;
  color: #ef4444;
}
.topbar-dropdown-divider {
  height: 1px;
  background: var(--border, #e2e8f0);
  margin: 4px 0;
}

/* ── Dark mode topbar ── */
[data-theme="dark"] .app-topbar,
[data-theme="midnight"] .app-topbar {
  background: var(--bg-main, #1e2130);
  border-color: var(--border, #2d3348);
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
[data-theme="dark"] .topbar-search-input,
[data-theme="midnight"] .topbar-search-input {
  background: var(--bg, #0f1117);
}
[data-theme="dark"] .topbar-dropdown,
[data-theme="midnight"] .topbar-dropdown {
  background: var(--card, #1e2130);
  border-color: var(--border, #2d3348);
}

/* ─── AUTH removido — ahora vive en modulo_sic/views/login.php (inline) ─── */

/* ═══════════════════════════════════════════════════════════════
   SISTEMA A → B — Neutralización de conflictos
   Cuando app-layout (Sistema B) está presente, neutralizar
   reglas de Sistema A que puedan interferir.
   ═══════════════════════════════════════════════════════════════ */

/* Body flex no debe interferir con el grid de app-layout */
.app-layout {
  width: 100%;
}

/* Neutralizar .topbar de Sistema A dentro de app-layout */
.app-layout .topbar {
  display: none;
}

/* Neutralizar .sidebar de Sistema A dentro de app-layout */
.app-layout .sidebar {
  display: none;
}

/* Neutralizar .main-content de Sistema A dentro de app-layout */
.app-layout main.main-content:not(#main-content) {
  display: none;
}
