
/* ═══════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sb-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  overflow-y: auto;
  position: relative;
  z-index: 20;
  transition: width .25s cubic-bezier(.4,0,.2,1), transform .25s cubic-bezier(.4,0,.2,1) !important;
}

/* Overlay para cerrar sidebar en móvil */
#sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 19;
  backdrop-filter: blur(2px);
}

/* Fondo sutil con patrón de puntos */
.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
}

.sidebar-brand {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--sb-brand);
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.brand-logo {
  overflow: hidden;
  width: 46px;
  height: 46px;
  min-width: 46px;
  border-radius: 12px;
  background: linear-gradient(140deg, var(--primary-mid), var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: -.5px;
  box-shadow: 0 4px 16px var(--primary-glow), 0 2px 4px rgba(0,0,0,.3);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: high-quality;
  transform: translateZ(0);
  transition: box-shadow .22s ease !important;
}
/* Cuando hay logo personalizado cargado */
.brand-logo.has-logo {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

.brand-text { flex: 1; min-width: 0; }
.brand-name {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-sub { font-size: 11px; color: var(--g400); margin-top: 2px; }

.nav-section { padding: 10px 0 4px; }
.nav-label {
  font-size: 9px;
  font-weight: 700;
  color: rgba(255,255,255,.22);
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 10px 20px 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,.06);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--sb-txt);
  transition: background .16s ease, color .16s ease, transform .14s ease, box-shadow .16s ease;
  user-select: none;
  text-decoration: none;
  margin: 2px 8px;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}
/* Línea de acento izquierda al hover */
.nav-item::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
  opacity: 0;
  transform: scaleY(0);
  transition: opacity .16s ease, transform .16s ease;
}
.nav-item:hover::before {
  opacity: 1;
  transform: scaleY(1);
}
.nav-item:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
  transform: translateX(2px);
}
.nav-item.active {
  background: linear-gradient(110deg, var(--primary) 0%, var(--primary-mid) 100%);
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow), inset 0 1px 0 rgba(255,255,255,.15);
  transform: none;
}
.nav-item.active::before { display: none; }
/* Shimmer en activo */
.nav-item.active::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,.07) 50%, transparent 60%);
  pointer-events: none;
}
.nav-item.active i { opacity: 1; }
.nav-item i {
  font-size: 18px;
  opacity: .55;
  transition: opacity .16s ease, transform .16s ease;
  flex-shrink: 0;
}
.nav-item:hover i { opacity: .9; transform: scale(1.1); }
.nav-item.active i { opacity: 1; transform: none; }

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  background: var(--bad);
  color: #fff;
  padding: 2px 6px;
  border-radius: 10px;
  line-height: 1.4;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 18px;
  border-top: 1px solid var(--sb-brand);
}
.sidebar-footer-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,.05);
  border-radius: var(--r);
  border: 1px solid rgba(255,255,255,.06);
}
.sf-avatar { overflow: hidden; background-repeat: no-repeat;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.sf-name { font-size: 11.5px; font-weight: 600; color: #fff; line-height: 1.3; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sf-role { font-size: 10.5px; color: var(--g400); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sidebar-footer-inner {
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease !important;
}
.sidebar-footer-inner:hover {
  background: rgba(255,255,255,.09);
  border-color: rgba(255,255,255,.14);
  box-shadow: 0 0 0 1px rgba(255,255,255,.08);
}

/* ═══ Mi cuenta — pestañas ═══ */
.acc-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--g150);
  margin-bottom: 18px;
  overflow-x: auto;
}
.acc-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 12px;
  font-size: 12.5px; font-weight: 600;
  color: var(--g400);
  background: none; border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}
.acc-tab:hover { color: var(--g700); }
.acc-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.acc-panel { display: none; }
.acc-panel.active { display: block; }

/* ═══ Toggle / switch ═══ */
.acc-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--g100);
}
.acc-toggle-row:last-of-type { border-bottom: none; }
.acc-toggle-label { font-size: 13px; font-weight: 600; color: var(--g800); }
.acc-toggle-desc { font-size: 11.5px; color: var(--g400); margin-top: 2px; }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--g200); transition: .2s; border-radius: 999px;
}
.switch .slider::before {
  content: ""; position: absolute; width: 16px; height: 16px;
  left: 3px; bottom: 3px; background: #fff; transition: .2s; border-radius: 50%;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(18px); }

.acc-theme-btn.acc-active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}

/* ═══════════════════════════════════
   MAIN
   ═══════════════════════════════════ */
.main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  background: var(--g0);
  border-bottom: 1px solid var(--g150);
  display: flex;
  align-items: center;
  padding: 0 26px;
  gap: 14px;
  flex-shrink: 0;
  box-shadow: var(--sh-xs);
  position: relative;
}
/* Línea de acento inferior con el color del tema */
.topbar::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2.5px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-mid) 60%, transparent 100%);
  opacity: .55;
  pointer-events: none;
}

.topbar-left { display: flex; align-items: center; gap: 10px; flex: 1; }
.topbar-breadcrumb {
  font-size: 11px;
  color: var(--g400);
  display: flex;
  align-items: center;
  gap: 6px;
}
.topbar-breadcrumb span:last-child { color: var(--g700); font-weight: 600; }
.topbar-sep { color: var(--g300); }
.topbar-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--g800);
}

.topbar-right { display: flex; align-items: center; gap: 10px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  border: 1px solid transparent;
}
.chip-blue  { background: var(--primary-light); color: var(--primary-dark); }
.chip-green { background: var(--accent-light);  color: var(--accent-dark); }
.chip-red   { background: var(--bad-bg);  color: var(--bad-txt); }
.chip-amber { background: var(--warn-bg); color: var(--warn-txt); }
.chip-gray  { background: var(--g100); color: var(--g500); }
.chip i { font-size: 13px; }

.topbar-icon-btn {
  width: 34px; height: 34px;
  border: 1px solid var(--g150);
  border-radius: var(--r);
  background: var(--g0);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--g500);
  font-size: 17px;
  transition: all var(--t);
  position: relative;
}
.topbar-icon-btn:hover { background: var(--g50); color: var(--g700); border-color: var(--g200); }
.notif-dot {
  position: absolute; top: 5px; right: 5px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--bad); border: 1.5px solid #fff;
}

/* ═══════════════════════════════════
   PANEL DE NOTIFICACIONES
   ═══════════════════════════════════ */
.notif-panel {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 340px; max-width: 90vw; max-height: 420px;
  background: var(--g0); border-radius: var(--r-xl);
  box-shadow: var(--sh-lg); border: 1px solid var(--g100);
  z-index: 1100; overflow: hidden;
  display: flex; flex-direction: column;
  opacity: 0; transform: translateY(-6px) scale(.97);
  pointer-events: none; transition: opacity .15s, transform .15s;
}
.notif-panel.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: all; }
.notif-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--g100);
  font-size: 13px; font-weight: 700; color: var(--g800);
}
.notif-mark-all {
  background: none; border: none; cursor: pointer;
  font-size: 11.5px; font-weight: 600; color: var(--primary);
  padding: 0;
}
.notif-mark-all:hover { text-decoration: underline; }
.notif-panel-list { overflow-y: auto; max-height: 360px; }
.notif-empty { padding: 28px 14px; text-align: center; color: var(--g400); font-size: 13px; }
.notif-item {
  display: flex; gap: 10px; padding: 11px 14px;
  border-bottom: 1px solid var(--g100); cursor: pointer;
  transition: background .12s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--g50); }
.notif-item.unread { background: rgba(27,79,216,.04); }
.notif-icon {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.notif-icon.warn { background: var(--warn-bg); color: var(--warn-txt); }
.notif-icon.info { background: rgba(27,79,216,.12); color: var(--primary); }
.notif-icon.ok   { background: var(--ok-bg); color: var(--ok-txt); }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 12.5px; font-weight: 600; color: var(--g700); line-height: 1.35; }
.notif-time { font-size: 10.5px; color: var(--g400); margin-top: 2px; }
.notif-unread-mark { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); flex-shrink: 0; margin-top: 4px; }

/* ═══════════════════════════════════
   CONTENT AREA
   ═══════════════════════════════════ */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 22px 26px;
  scroll-behavior: smooth;
}

/* ═══════════════════════════════════
   PAGES
   ═══════════════════════════════════ */
.page { display: none; animation: fadeIn .18s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }


/* ═══════════════════════════════════════════════
   VISIBILIDAD DE PÁGINAS — tarjetas estilo dashboard
   ═══════════════════════════════════════════════ */
.pv-header-desc {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--primary-light); border: 1px solid var(--primary-mid);
  border-radius: var(--r-lg); padding: 12px 14px;
  font-size: 12.5px; color: var(--g600); line-height: 1.5;
  margin-bottom: 18px;
}
.pv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.pv-card {
  background: var(--g0); border: 1px solid var(--g150);
  border-radius: var(--r-lg); padding: 14px 16px;
  box-shadow: var(--sh-xs); transition: opacity var(--t), box-shadow var(--t);
}
.pv-card:hover { box-shadow: var(--sh-sm); }
.pv-card--off { opacity: .55; }
.pv-card-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
.pv-card-icon {
  width: 40px; height: 40px; border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.pv-card-info { flex: 1; min-width: 0; }
.pv-card-title { font-size: 13px; font-weight: 600; color: var(--g800); }
.pv-card-sub   { font-size: 11px; margin-top: 2px; line-height: 1.35; }
.pv-card-toggle { flex-shrink: 0; }
.pv-roles-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding-top: 10px; border-top: 1px solid var(--g100);
}
.pv-roles-label {
  font-size: 11px; color: var(--g400); font-weight: 500;
  white-space: nowrap; margin-right: 2px;
}
.pv-role-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 500; cursor: pointer;
  border: 1px solid var(--g200); background: var(--g50); color: var(--g500);
  transition: background var(--t), color var(--t), border-color var(--t);
  line-height: 1.4;
}
.pv-role-chip .ti { font-size: 12px; }
.pv-role-chip:hover { border-color: var(--primary-mid); color: var(--primary); background: var(--primary-light); }
.pv-role-chip.selected {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.pv-role-chip--locked {
  cursor: not-allowed;
  opacity: 0.75;
}
/* Admin locked+selected: color ámbar/dorado para distinguirlo de los chips normales */
.pv-role-chip--locked.selected {
  background: #92400e; color: #fef3c7; border-color: #78350f;
}
.pv-role-chip--locked:hover,
.pv-role-chip--locked.selected:hover {
  background: #92400e; color: #fef3c7; border-color: #78350f;
  opacity: 1;
}
/* Botón de limpiar restricción por tarjeta */
.pv-clear-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 500; cursor: pointer;
  border: 1px dashed var(--g300); background: transparent; color: var(--g400);
  transition: background var(--t), color var(--t), border-color var(--t);
  line-height: 1.4; margin-left: 6px;
}
.pv-clear-btn:hover {
  border-color: var(--bad); color: var(--bad); background: #fef2f2;
}

/* Sub-toggle "¿Quién puede editar?" — solo en la tarjeta de Horario */
.pv-edicion-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding-top: 10px; margin-top: 4px; border-top: 1px dashed var(--g150);
}
.pv-edicion-hint {
  display: flex; align-items: flex-start; gap: 6px;
  font-size: 10.5px; color: var(--g400); line-height: 1.4;
  margin: 6px 0 0;
}
.pv-edicion-hint .ti { font-size: 12px; margin-top: 1px; flex-shrink: 0; }

/* ═══════════════════════════════════════════════
   "VER COMO" — badge flotante draggable
   ═══════════════════════════════════════════════ */
#admin-ver-como-badge {
  position: fixed; z-index: 9900;
  display: none;
  bottom: 28px; right: 28px;
  background: var(--g900); color: #fff;
  border-radius: 999px;
  padding: 10px 16px 10px 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,.35);
  display: none; align-items: center; gap: 10px;
  font-size: 12.5px; font-weight: 600;
  cursor: grab; user-select: none;
  border: 2px solid rgba(255,255,255,.15);
  max-width: 260px;
  transition: box-shadow .15s;
}
#admin-ver-como-badge:active { cursor: grabbing; box-shadow: 0 8px 28px rgba(0,0,0,.45); }
#admin-ver-como-badge .vcb-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #34D399; box-shadow: 0 0 6px #34D399;
  flex-shrink: 0;
}
#admin-ver-como-badge .vcb-label {
  flex: 1; min-width: 0; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
#admin-ver-como-badge .vcb-exit {
  flex-shrink: 0; background: rgba(255,255,255,.15);
  border: none; color: #fff; border-radius: 999px;
  padding: 3px 10px; font-size: 11.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: background .12s;
}
#admin-ver-como-badge .vcb-exit:hover { background: rgba(255,255,255,.28); }

/* ═══════════════════════════════════════════════
   "VER COMO" — tarjetas de rol en la pestaña
   ═══════════════════════════════════════════════ */
.vc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.vc-role-card {
  background: var(--g0); border: 1px solid var(--g150);
  border-radius: var(--r-lg); padding: 16px 14px;
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; text-align: center;
  box-shadow: var(--sh-xs); transition: box-shadow var(--t), border-color var(--t);
  cursor: pointer;
}
.vc-role-card:hover { box-shadow: var(--sh-sm); border-color: var(--primary-mid); }
.vc-role-icon {
  width: 48px; height: 48px; border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; background: var(--primary-light); color: var(--primary);
}
.vc-role-label { font-size: 13px; font-weight: 600; color: var(--g800); }
.vc-role-desc  { font-size: 11px; color: var(--g400); line-height: 1.4; margin-bottom: 4px; }
.vc-btn {
  margin-top: 2px; padding: 5px 14px;
  border-radius: 999px; border: 1px solid var(--primary);
  background: transparent; color: var(--primary);
  font-size: 11.5px; font-weight: 600; cursor: pointer;
  transition: background var(--t), color var(--t);
}
.vc-btn:hover { background: var(--primary); color: #fff; }
