/* ============================================================
   LAYOUT SIDEBAR — Premium lateral navigation
   Activado por body.layout-sidebar
   Todos los colores usan CSS variables del tema.
   ============================================================ */

/* ---- Override body + wrapper for full-screen sidebar layout ---- */
body.layout-sidebar {
  padding: 0 !important;
  overflow: hidden;
}
body.layout-sidebar .wrap {
  width: 100%;
  max-width: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
}
body.layout-sidebar .brandbar {
  padding: 12px 24px;
  flex-shrink: 0;
}
/* Hide the page footer in sidebar — copyright is injected inside the scrollable panel */
body.layout-sidebar .wrap > div:last-child:not(#appCard):not(.card) {
  display: none !important;
}
body.layout-sidebar #appCard {
  display: grid !important;
  grid-template-columns: var(--sidebar-width, 280px) 1fr;
  grid-template-rows: auto 1fr;
  padding: 0 !important;
  margin: 0;
  border-radius: 0;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

/* Hide top card and horizontal tabs in sidebar mode */
body.layout-sidebar #topCard {
  display: none !important;
}
body.layout-sidebar .tabs {
  display: none !important;
}

/* ---- Sidebar container ---- */
.sidebar-nav {
  grid-column: 1;
  grid-row: 1 / -1;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--card) 0%, color-mix(in srgb, var(--card) 92%, var(--blue)) 100%);
  border-right: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--line) 50%, transparent) transparent;
  transition: width 0.3s cubic-bezier(.4,0,.2,1);
  width: var(--sidebar-width, 280px);
  min-width: var(--sidebar-width, 280px);
  position: relative;
  z-index: 2;
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--line) 40%, transparent);
  border-radius: 3px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: var(--line);
}

/* ---- Sidebar header ---- */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 18px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 40%, transparent);
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  object-fit: contain;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.sidebar-brand-logo-fallback {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--blue), color-mix(in srgb, var(--blue) 70%, #8b5cf6));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--blue) 30%, transparent);
}

.sidebar-brand-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--heading);
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
  padding: 0;
  font-size: 0;
}

.sidebar-toggle:hover {
  background: var(--surface-2, var(--surface));
  color: var(--blue);
  border-color: var(--blue);
}

.sidebar-toggle-icon {
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  transition: transform 0.3s cubic-bezier(.4,0,.2,1);
  display: block;
}

/* Collapsed toggle icon rotation */
body.layout-sidebar.sidebar-collapsed .sidebar-toggle-icon {
  transform: rotate(180deg);
}

/* ---- Menu area ---- */
.sidebar-menu {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

/* ---- Category headers (clickable, collapsible) ---- */
.sidebar-category {
  margin-bottom: 0;
}

/* Thin separator line between categories */
.sidebar-category + .sidebar-category {
  border-top: 1px solid color-mix(in srgb, var(--line) 35%, transparent);
}

.sidebar-category-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px 18px 8px;
  border: none;
  background: transparent;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--muted) 80%, var(--blue));
  user-select: none;
  cursor: pointer;
  transition: color 0.15s;
}

.sidebar-category-label:hover {
  color: var(--blue);
}

.sidebar-category-label .cat-chevron {
  opacity: 0.4;
  transition: transform 0.2s ease, opacity 0.2s;
  flex-shrink: 0;
}

.sidebar-category-label:hover .cat-chevron {
  opacity: 0.8;
}

/* Collapsed category: hide items, rotate chevron */
.sidebar-category.cat-collapsed .sidebar-item,
.sidebar-category.cat-collapsed .sidebar-subitems {
  display: none !important;
}

.sidebar-category.cat-collapsed .sidebar-category-label .cat-chevron {
  transform: rotate(-90deg);
}

.sidebar-category.cat-collapsed .sidebar-category-label {
  padding-bottom: 12px;
}

/* ---- Nav items (Level 1 — tabs) ---- */
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 24px);
  margin: 1px 12px;
  padding: 9px 12px 9px 16px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.15s ease;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}

.sidebar-item:hover {
  background: color-mix(in srgb, var(--blue) 7%, transparent);
  color: var(--heading);
}

.sidebar-item.active {
  background: color-mix(in srgb, var(--blue) 12%, transparent);
  color: var(--blue);
  font-weight: 600;
}

/* Active indicator — left accent bar */
.sidebar-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--blue);
}

.sidebar-item .sidebar-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: 0.55;
}

.sidebar-item:hover .sidebar-icon,
.sidebar-item.active .sidebar-icon {
  opacity: 1;
}

.sidebar-item .sidebar-icon svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-item .sidebar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.sidebar-item .sidebar-badge {
  background: var(--danger-text, #dc2626);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  padding: 0 5px;
  flex-shrink: 0;
}

.sidebar-item .sidebar-badge:empty,
.sidebar-item .sidebar-badge[data-count="0"] {
  display: none;
}

/* ---- Expand chevron for parents with sub-tabs ---- */
.sidebar-chevron {
  margin-left: auto;
  opacity: 0.3;
  transition: transform 0.2s ease, opacity 0.2s;
  flex-shrink: 0;
  display: flex;
}

.sidebar-item:hover .sidebar-chevron { opacity: 0.6; }
.sidebar-item.expanded .sidebar-chevron {
  transform: rotate(180deg);
  opacity: 0.6;
}

/* ---- Sub-tab items (Level 2 — nested under parent) ---- */
.sidebar-subitems {
  padding: 2px 0 6px;
  margin-left: 24px;
  border-left: 1.5px solid color-mix(in srgb, var(--line) 40%, transparent);
  position: relative;
}

.sidebar-subitem {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 12px);
  margin: 0 8px 0 0;
  padding: 6px 10px 6px 16px;
  border: none;
  background: transparent;
  color: color-mix(in srgb, var(--text) 75%, transparent);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 0 6px 6px 0;
  transition: all 0.15s ease;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}

/* Horizontal connector line from vertical bar to sub-item */
.sidebar-subitem::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 50%;
  width: 10px;
  height: 1.5px;
  background: color-mix(in srgb, var(--line) 40%, transparent);
}

.sidebar-subitem:hover {
  background: color-mix(in srgb, var(--blue) 7%, transparent);
  color: var(--text);
}

.sidebar-subitem.active {
  background: color-mix(in srgb, var(--blue) 10%, transparent);
  color: var(--blue);
  font-weight: 600;
}

.sidebar-subitem.active::before {
  background: var(--blue);
}

/* Remove the dot — the connector line replaces it */
.sidebar-sub-dot {
  display: none;
}

.sidebar-subitem.active .sidebar-sub-dot {
  opacity: 1;
  background: var(--blue);
}

/* ---- HIDE horizontal sub-tab bars in sidebar mode ---- */
body.layout-sidebar .sub-tab-bar,
body.layout-sidebar .presale-sub-tabs,
body.layout-sidebar .report-subtabs-nav {
  display: none !important;
}

/* Hide collapsed sub-items in collapsed sidebar */
body.layout-sidebar.sidebar-collapsed .sidebar-subitems,
body.layout-sidebar.sidebar-collapsed .sidebar-chevron {
  display: none !important;
}

/* ---- Sidebar footer (user info) ---- */
.sidebar-footer {
  border-top: 1px solid color-mix(in srgb, var(--line) 40%, transparent);
  padding: 14px 16px;
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  padding: 6px 4px;
  border-radius: 10px;
  transition: background 0.15s;
}
.sidebar-user:hover {
  background: color-mix(in srgb, var(--blue) 6%, transparent);
}

.sidebar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, color-mix(in srgb, var(--blue) 20%, transparent), color-mix(in srgb, var(--blue) 10%, transparent));
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
  border: 1.5px solid color-mix(in srgb, var(--blue) 25%, transparent);
}

.sidebar-user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--heading);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

.sidebar-user-role {
  font-size: 10.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}

/* ---- Breadcrumb + user controls bar ---- */
.sidebar-breadcrumb {
  display: none;
  grid-column: 2;
  grid-row: 1;
  padding: 10px 20px;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 40%, transparent);
  background: color-mix(in srgb, var(--surface) 60%, var(--card));
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  backdrop-filter: blur(8px);
}

body.layout-sidebar .sidebar-breadcrumb {
  display: flex;
}

.breadcrumb-left {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  min-width: 0;
}

.breadcrumb-category { color: var(--muted); font-weight: 500; }
.breadcrumb-sep { color: color-mix(in srgb, var(--line) 70%, transparent); font-size: 14px; }
.breadcrumb-current { color: var(--heading); font-weight: 600; }

.breadcrumb-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  white-space: nowrap;
}

.breadcrumb-lic {
  font-size: 11px;
  color: var(--muted);
  opacity: 0.8;
}

.breadcrumb-bell {
  position: relative;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.breadcrumb-bell:hover { color: var(--blue); }

.breadcrumb-bell-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  background: var(--danger-text, #dc2626);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 50%;
  min-width: 14px;
  height: 14px;
  line-height: 14px;
  text-align: center;
  padding: 0 2px;
  display: none;
}

.breadcrumb-email {
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s;
  text-decoration: underline;
  text-decoration-color: transparent;
}
.breadcrumb-email:hover { color: var(--text); text-decoration-color: currentColor; }

.breadcrumb-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: all 0.15s;
}
.breadcrumb-logout:hover {
  background: color-mix(in srgb, var(--danger-text, #dc2626) 12%, transparent);
  color: var(--danger-text, #dc2626);
}

/* ---- Panel in sidebar mode ---- */
body.layout-sidebar .panel {
  grid-column: 2;
  grid-row: 2;
  border-radius: 0;
  border: none;
  margin-top: 0;
  min-height: auto;
  overflow-y: auto;
}

/* ---- Hamburger button ---- */
.sidebar-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: all 0.15s;
}

.sidebar-hamburger:hover {
  background: var(--surface-2, var(--surface));
  color: var(--blue);
}

.sidebar-hamburger svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---- Backdrop ---- */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 8999;
  opacity: 0;
  transition: opacity 0.25s ease;
  backdrop-filter: blur(2px);
}

.sidebar-backdrop.visible {
  display: block;
  opacity: 1;
}

/* ============================================================
   COLLAPSED STATE (64px icon-only)
   ============================================================ */
body.layout-sidebar.sidebar-collapsed {
  --sidebar-width: 64px;
}

body.layout-sidebar.sidebar-collapsed .sidebar-label,
body.layout-sidebar.sidebar-collapsed .sidebar-category-label,
body.layout-sidebar.sidebar-collapsed .sidebar-user-name,
body.layout-sidebar.sidebar-collapsed .sidebar-user-role,
body.layout-sidebar.sidebar-collapsed .sidebar-brand-text,
body.layout-sidebar.sidebar-collapsed .sidebar-brand-sub {
  display: none;
}

body.layout-sidebar.sidebar-collapsed .sidebar-item {
  display: flex !important; /* Override cat-collapsed display:none */
  justify-content: center;
  padding: 10px 0;
  margin: 1px 4px;
  border-radius: 8px;
  box-shadow: none;
}

/* In collapsed mode, hide category labels but show all items as icons */
body.layout-sidebar.sidebar-collapsed .sidebar-category.cat-collapsed .sidebar-item {
  display: flex !important;
}

body.layout-sidebar.sidebar-collapsed .sidebar-item.active {
  box-shadow: none;
  background: color-mix(in srgb, var(--blue) 16%, transparent);
}

body.layout-sidebar.sidebar-collapsed .sidebar-header {
  justify-content: center;
  padding: 14px 8px;
}

body.layout-sidebar.sidebar-collapsed .sidebar-brand {
  display: none;
}

body.layout-sidebar.sidebar-collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

body.layout-sidebar.sidebar-collapsed .sidebar-footer {
  padding: 10px 6px;
}

body.layout-sidebar.sidebar-collapsed .sidebar-user {
  justify-content: center;
}

body.layout-sidebar.sidebar-collapsed .sidebar-item .sidebar-badge {
  position: absolute;
  top: 2px;
  right: 4px;
  min-width: 14px;
  height: 14px;
  line-height: 14px;
  font-size: 9px;
  padding: 0 3px;
}

/* Tooltip on hover when collapsed */
body.layout-sidebar.sidebar-collapsed .sidebar-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 9100;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
}
body.layout-sidebar.sidebar-collapsed .sidebar-item:hover::after {
  opacity: 1;
}

/* ============================================================
   LIGHT MODE — Premium sidebar refinements
   Polished look inspired by Linear/Notion/Stripe dashboards.
   Only overrides within body.light-mode — dark theme untouched.
   ============================================================ */

/* -- Sidebar container: cool slate gradient + depth -- */
body.light-mode .sidebar-nav {
  background: linear-gradient(180deg, #f0f4f8 0%, #e2e8f0 40%, #dce4ef 100%) !important;
  border-right: 1px solid rgba(0, 0, 0, 0.10) !important;
  box-shadow: 3px 0 16px rgba(0, 0, 0, 0.06), 1px 0 4px rgba(0, 0, 0, 0.03) !important;
}

/* -- Scrollbar: visible but subtle -- */
body.light-mode .sidebar-nav {
  scrollbar-color: rgba(0, 0, 0, 0.12) transparent;
}
body.light-mode .sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.10);
}
body.light-mode .sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.18);
}

/* -- Sidebar header: distinct premium zone -- */
body.light-mode .sidebar-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

body.light-mode .sidebar-brand-logo {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

body.light-mode .sidebar-brand-text {
  color: #0f172a;
}

body.light-mode .sidebar-brand-sub {
  color: #64748b;
}

body.light-mode .sidebar-toggle {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.10);
  color: #475569;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
body.light-mode .sidebar-toggle:hover {
  background: #f1f5f9;
  border-color: var(--blue);
  color: var(--blue);
}

/* -- Category labels: more visible with accent -- */
body.light-mode .sidebar-category + .sidebar-category {
  border-top-color: rgba(0, 0, 0, 0.06);
}

body.light-mode .sidebar-category-label {
  color: #64748b;
  font-weight: 800;
  padding-left: 20px;
  position: relative;
}

body.light-mode .sidebar-category-label::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-1px);
  width: 3px;
  height: 12px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--blue) 30%, transparent);
}

body.light-mode .sidebar-category-label:hover {
  color: var(--blue);
}

body.light-mode .sidebar-category-label:hover::before {
  background: var(--blue);
}

/* -- Nav items: better contrast + polished hover/active -- */
body.light-mode .sidebar-item {
  color: #334155;
}

body.light-mode .sidebar-item .sidebar-icon {
  opacity: 0.50;
  color: #475569;
}

body.light-mode .sidebar-item:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #0f172a;
}

body.light-mode .sidebar-item:hover .sidebar-icon {
  opacity: 0.85;
  color: #334155;
}

body.light-mode .sidebar-item.active {
  background: color-mix(in srgb, var(--blue) 14%, #eaf0ff) !important;
  color: var(--blue) !important;
  font-weight: 700 !important;
  box-shadow: 0 1px 4px color-mix(in srgb, var(--blue) 12%, transparent) !important;
}

body.light-mode .sidebar-item.active .sidebar-icon {
  opacity: 1;
  color: var(--blue);
}

/* Active accent bar: stronger in light mode */
body.light-mode .sidebar-item.active::before {
  width: 3.5px;
  background: var(--blue);
  box-shadow: 1px 0 6px color-mix(in srgb, var(--blue) 30%, transparent);
}

/* -- Sub-items: visible tree connectors -- */
body.light-mode .sidebar-subitems {
  border-left-color: rgba(0, 0, 0, 0.10);
}

body.light-mode .sidebar-subitem {
  color: #475569;
}

body.light-mode .sidebar-subitem::before {
  background: rgba(0, 0, 0, 0.10);
}

body.light-mode .sidebar-subitem:hover {
  background: rgba(0, 0, 0, 0.035);
  color: #1e293b;
}

body.light-mode .sidebar-subitem.active {
  background: color-mix(in srgb, var(--blue) 8%, #f0f4ff);
  color: var(--blue);
  font-weight: 600;
}

body.light-mode .sidebar-subitem.active::before {
  background: var(--blue);
}

/* -- Sidebar footer: subtle separation -- */
body.light-mode .sidebar-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.07);
  background: linear-gradient(0deg, #f1f5f9 0%, transparent 100%);
}

body.light-mode .sidebar-avatar {
  background: linear-gradient(135deg, color-mix(in srgb, var(--blue) 15%, #f0f4ff), color-mix(in srgb, var(--blue) 8%, #f8fafc));
  border-color: color-mix(in srgb, var(--blue) 20%, transparent);
  color: var(--blue);
}

body.light-mode .sidebar-user-name {
  color: #0f172a;
}

body.light-mode .sidebar-user-role {
  color: #64748b;
}

body.light-mode .sidebar-user:hover {
  background: rgba(0, 0, 0, 0.03);
}

/* -- Breadcrumb bar in light mode -- */
body.light-mode .sidebar-breadcrumb {
  background: rgba(255, 255, 255, 0.85);
  border-bottom-color: rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(12px);
}

body.light-mode .breadcrumb-category {
  color: #64748b;
}

body.light-mode .breadcrumb-current {
  color: #0f172a;
}

/* -- Collapsed tooltip in light mode -- */
body.light-mode.layout-sidebar.sidebar-collapsed .sidebar-item::after {
  background: #ffffff;
  color: #1e293b;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10), 0 1px 4px rgba(0, 0, 0, 0.06);
}

/* -- Hamburger button in light mode (mobile) -- */
body.light-mode .sidebar-hamburger {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.10);
  color: #475569;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
body.light-mode .sidebar-hamburger:hover {
  background: #f1f5f9;
  color: var(--blue);
}

/* -- Backdrop lighter in light mode -- */
body.light-mode .sidebar-backdrop {
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(4px);
}

/* ============================================================
   RESPONSIVE — TABLET + MOBILE drawer mode (<=1024px)
   F1 hotfix v3.7.6 (2026-04-30): unifica el comportamiento drawer
   off-canvas para todo viewport <=1024px (incluye tablet portrait
   Xiaomi Pad 9" 800×1280 que antes quedaba con mini-sidebar 64px
   sin afordancia para expandirse → menú inoperable).
   El mini-sidebar 64px ahora es opt-in del user solo en >1024px
   vía toggleSidebarCollapse().
   ============================================================ */
@media (max-width: 1024px) {
  body.layout-sidebar #appCard {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  body.layout-sidebar .sidebar-nav {
    position: fixed;
    left: -310px;
    top: 0;
    bottom: 0;
    z-index: 9000;
    width: 300px;
    min-width: 300px;
    transition: left 0.3s cubic-bezier(.4,0,.2,1);
    box-shadow: none;
  }

  body.layout-sidebar.sidebar-open .sidebar-nav {
    left: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
  }

  body.layout-sidebar .sidebar-hamburger {
    display: flex;
  }

  body.layout-sidebar .sidebar-breadcrumb {
    grid-column: 1;
    grid-row: 1;
    padding-left: 14px;
  }

  body.layout-sidebar .breadcrumb-lic { display: none; }
  body.layout-sidebar .breadcrumb-email { display: none; }

  body.layout-sidebar .panel {
    grid-column: 1;
    grid-row: 2;
  }
}

/* ============================================================
   RESPONSIVE — MOBILE small (<=640px) — ajustes finos
   ============================================================ */
@media (max-width: 640px) {
  body.layout-sidebar .sidebar-nav {
    width: 280px;
    min-width: 280px;
    left: -290px;
  }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .sidebar-nav, .sidebar-breadcrumb, .sidebar-hamburger, .sidebar-backdrop { display: none !important; }
  body.layout-sidebar #appCard { grid-template-columns: 1fr; }
  body.layout-sidebar .panel { grid-column: 1; }
}
