@import url("tokens.css");

/**
 * Legatium Portal — shared product UI (dashboard, pages, sidebar fixed)
 */
:root {
  --lg-sidebar-w: 260px;
  --portal-content-max: 1100px;
  --portal-gutter: clamp(1.1rem, 2.2vw, 2rem);
}

/* Sidebar brand: logo + name centered in the rail */
.lg-sidebar-brand {
  position: relative;
  margin-bottom: 2rem;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 2.25rem; /* room for mobile close on the right */
}
.lg-sidebar-brand-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.lg-sidebar-brand-center:hover .lg-brand-text {
  color: #000;
}
.lg-sidebar-brand .lg-brand-text {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.2rem;
  color: #111;
  letter-spacing: 1px;
  white-space: nowrap;
}

/* Nav items: black icons + labels (Legatium light UI) */
.lg-sidebar .lg-nav-item {
  color: #1a1a1a !important;
}
.lg-sidebar .lg-nav-item svg {
  color: #1a1a1a;
  stroke: currentColor;
  flex-shrink: 0;
  opacity: 0.9;
}
.lg-sidebar .lg-nav-item span {
  color: inherit;
}
.lg-sidebar .lg-nav-item:hover {
  color: #000 !important;
  background: rgba(0, 0, 0, 0.04);
}
.lg-sidebar .lg-nav-item.active {
  color: #111 !important;
}
.lg-sidebar .lg-nav-item.active svg {
  color: #8b6914;
}
.lg-sidebar-brand .lg-mobile-close-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

/* ========== SHELL: sidebar + main (centrado en el hueco derecho) ==========
   style.css ponía max-width+margin:auto en .lg-main-content como hijo flex,
   lo que descentra el bloque respecto a la sidebar. Aquí se corrige. */
.lg-dashboard-layout {
  display: flex !important;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  align-items: stretch;
  background: var(--clr-bg, #faf7f2);
  box-sizing: border-box;
}

/* Fixed sidebar — no collapse on desktop */
.lg-dashboard-layout > .lg-sidebar,
.lg-sidebar {
  width: var(--lg-sidebar-w) !important;
  min-width: var(--lg-sidebar-w) !important;
  max-width: var(--lg-sidebar-w);
  flex: 0 0 var(--lg-sidebar-w) !important;
  flex-shrink: 0 !important;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  align-self: flex-start;
  z-index: 40;
  box-sizing: border-box;
  /* Gold rail separating menu from content */
  border-right: 1.5px solid rgba(197, 160, 89, 0.42) !important;
  box-shadow: 1px 0 0 rgba(232, 209, 148, 0.25);
}

/* Main: ocupa TODO el resto a la derecha de la sidebar (sin max-width propio) */
.lg-dashboard-layout > .lg-main-content,
.lg-main-content {
  flex: 1 1 0% !important;
  min-width: 0 !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 28px var(--portal-gutter) 56px !important;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center; /* centra la columna de contenido en el hueco derecho */
  gap: 0;
}

/* Columna de contenido centrada en el hueco derecho (sin la sidebar) */
.lg-dashboard-layout > .lg-main-content > *,
.lg-main-content > .lg-page-header,
.lg-main-content > .lg-help-callout,
.lg-main-content > .bento,
.lg-main-content > .lg-surface,
.lg-main-content > .content-area,
.lg-main-content > .dashboard-inner-wide,
.lg-main-content > .dashboard-inner,
.lg-main-content > .banner-readonly,
.lg-main-content > form,
.lg-main-content > .lg-filter-bar,
.lg-main-content > .lg-alert,
.lg-main-content > .lg-empty,
.lg-main-content > .lg-inv-summary,
.lg-main-content > .lg-inv-list,
.lg-main-content > .lg-inv-filters,
.lg-main-content > .lg-inv-smart-tip,
.lg-main-content > .lg-inv-form-card,
.lg-main-content > .empty-state,
.lg-main-content > .bento-card,
.lg-main-content > .dash-block,
.lg-main-content > .dash-inv-score,
.lg-main-content > section,
.lg-main-content > .lg-card,
.lg-main-content > .lg-legado-tabs,
.lg-main-content > nav.lg-legado-tabs,
.lg-main-content > .lg-legado-concept {
  width: 100%;
  max-width: var(--portal-content-max);
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

/* Elementos que deben ser full-bleed dentro del main (modales, scripts) */
.lg-main-content > script,
.lg-main-content > style,
.lg-main-content > .lg-modal-overlay,
.lg-main-content > .lg-confirm-modal,
.lg-main-content > .lg-preview-modal,
.lg-main-content > [id^="modal"],
.lg-main-content > .loading-overlay {
  max-width: none !important;
  width: auto;
}

/* Headers y help alineados al mismo ancho que el cuerpo */
.lg-page-header,
.lg-help-callout {
  max-width: var(--portal-content-max) !important;
  width: 100%;
}

/* Bento grids fill the content column */
.lg-main-content .bento {
  width: 100%;
  max-width: var(--portal-content-max);
}

/* Files page shell */
.lg-main-content .content-area,
.lg-main-content .lg-surface {
  width: 100%;
  max-width: var(--portal-content-max);
}

/* Chat Lía: ocupar altura disponible sin descentrar */
.lg-main-content.chat-main,
.lg-dashboard-layout > .lg-main-content[style*="height"] {
  align-items: stretch;
  max-width: none !important;
}
.lg-main-content.chat-main > *,
.lg-dashboard-layout > .lg-main-content[style*="height"] > * {
  max-width: none;
}

@media (max-width: 768px) {
  .lg-dashboard-layout > .lg-sidebar,
  .lg-sidebar {
    position: fixed !important;
    height: 100dvh !important;
    max-width: 280px;
    width: 280px !important;
  }
  .lg-dashboard-layout > .lg-main-content,
  .lg-main-content {
    padding: calc(80px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right))
      calc(32px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left)) !important;
    align-items: stretch;
  }
  .lg-dashboard-layout > .lg-main-content > *,
  .lg-main-content > .bento,
  .lg-main-content > .lg-page-header,
  .lg-main-content > .lg-help-callout,
  .lg-main-content > .lg-surface,
  .lg-main-content > .content-area {
    max-width: none;
  }
}
.lg-sidebar.mini {
  width: var(--lg-sidebar-w) !important;
  align-items: stretch !important;
}
.lg-sidebar.mini .lg-brand-text,
.lg-sidebar.mini .lg-nav-item span,
.lg-sidebar.mini .hide-mini {
  display: flex !important;
}
.lg-sidebar.mini .lg-nav-item {
  justify-content: flex-start !important;
  width: auto !important;
  padding: 0.75rem 1rem !important;
  margin: 0 0 0.25rem !important;
}
.lg-sidebar-toggle-btn,
#lgDesktopToggle,
#lgDesktopToggleMini {
  /* display removed — visible on mobile via media query */
}

/* Active nav: full gold border around the whole item (not a left rail) */
.lg-sidebar .lg-nav-item {
  position: relative;
  border-radius: 12px;
  border: 1.5px solid transparent;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, color 0.15s;
}
.lg-nav-item.active,
.lg-sidebar .lg-nav-item.active {
  background: rgba(197, 160, 89, 0.12) !important;
  color: var(--clr-primary) !important;
  font-weight: 650;
  border: 1.5px solid rgba(197, 160, 89, 0.55) !important;
  box-shadow: 0 2px 10px rgba(197, 160, 89, 0.12) !important;
}
/* Kill legacy absolute / inset rails */
.lg-nav-item.active::before,
.lg-sidebar .lg-nav-item.active::before {
  content: none !important;
  display: none !important;
}

/* Divider under main nav (below Mi perfil) */
.lg-nav-divider {
  height: 0;
  margin: 12px 10px 6px;
  border: 0;
  border-top: 1.5px solid rgba(197, 160, 89, 0.35);
}

/* Sidebar footer: language + logout (Activity/Help live in Profile) */
.lg-sidebar-footer {
  border-top: none;
  padding-top: 0.35rem;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.lg-sidebar-lang {
  display: flex;
  justify-content: center;
  width: 100%;
  margin: 0.15rem 0 0;
}
.lg-sidebar-lang .lg-lang-container {
  width: 100%;
  max-width: 100%;
}
.lg-sidebar .lg-sidebar-lang .lg-lang-btn {
  width: 100%;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 14px 16px !important;
  border-radius: 14px !important;
  border: 1.5px solid rgba(197, 160, 89, 0.45) !important;
  background: linear-gradient(180deg, #fffefb 0%, rgba(197, 160, 89, 0.12) 100%) !important;
  color: var(--clr-primary) !important;
  font-weight: 700 !important;
  font-size: 0.95rem !important;
  box-shadow: 0 2px 10px rgba(197, 160, 89, 0.1);
}
.lg-sidebar .lg-sidebar-lang .lg-lang-btn:hover {
  background: rgba(197, 160, 89, 0.2) !important;
  border-color: rgba(197, 160, 89, 0.65) !important;
}
/* Language dropdown position is owned by .lg-lang-in-sidebar (no flash) */

/* Logout — larger CTA */
.lg-sidebar .lg-nav-logout,
a.lg-nav-item.lg-nav-logout {
  margin-top: 2px !important;
  justify-content: center !important;
  gap: 10px;
  min-height: 50px;
  padding: 14px 16px !important;
  border-radius: 14px !important;
  border: 1.5px solid #fca5a5 !important;
  background: linear-gradient(180deg, #fef2f2 0%, #fee2e2 100%) !important;
  color: #b91c1c !important;
  font-weight: 700 !important;
  font-size: 0.95rem !important;
  box-shadow: 0 3px 12px rgba(220, 38, 38, 0.1);
}
.lg-sidebar .lg-nav-logout:hover,
a.lg-nav-item.lg-nav-logout:hover {
  background: #fecaca !important;
  border-color: #f87171 !important;
  color: #991b1b !important;
  transform: none;
}

/* Profile page — Legatium panels */
.profile-wrap {
  width: 100%;
  max-width: var(--portal-content-max, 1100px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.profile-quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 4px;
}
.profile-quick-links .lg-btn {
  flex: 0 1 auto;
}
.profile-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  position: sticky;
  top: 12px;
  z-index: 20;
  padding: 8px;
  background: rgba(250, 247, 242, 0.94);
  backdrop-filter: blur(10px);
  border: 1.5px solid rgba(197, 160, 89, 0.28);
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(30, 27, 46, 0.05);
}
.profile-toc a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--clr-text-muted, #78716c);
  background: transparent;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.profile-toc a:hover {
  border-color: rgba(197, 160, 89, 0.4);
  background: rgba(197, 160, 89, 0.1);
  color: var(--clr-primary);
}
.profile-toc a.is-active {
  background: #fff;
  color: var(--clr-primary);
  border-color: rgba(197, 160, 89, 0.35);
  box-shadow: 0 2px 8px rgba(26, 21, 32, 0.05);
}
.profile-section {
  scroll-margin-top: 88px;
}
.profile-panel {
  background: var(--clr-surface, #fff);
  border: 1.5px solid rgba(197, 160, 89, 0.22);
  border-radius: 18px;
  box-shadow: 0 4px 18px rgba(30, 27, 46, 0.04);
  overflow: hidden;
}
.profile-panel + .profile-panel {
  margin-top: 0;
}
.profile-panel > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--clr-primary);
  background: linear-gradient(180deg, #fffefb 0%, #faf6ee 100%);
  border-bottom: 1px solid transparent;
  user-select: none;
}
.profile-panel > summary::-webkit-details-marker { display: none; }
.profile-panel > summary::after {
  content: '▾';
  margin-left: auto;
  font-size: 0.9rem;
  color: var(--clr-accent, #c5a059);
  transition: transform 0.2s;
}
.profile-panel[open] > summary {
  border-bottom-color: rgba(197, 160, 89, 0.2);
}
.profile-panel[open] > summary::after {
  transform: rotate(180deg);
}
.profile-panel-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(197, 160, 89, 0.12);
  flex-shrink: 0;
  font-size: 1.1rem;
}
.profile-panel-body {
  padding: 18px 20px 22px;
}
.profile-panel .card-desc {
  margin: 0 0 16px;
}
.profile-hero {
  border: 1.5px solid rgba(197, 160, 89, 0.28);
  border-radius: 20px;
  overflow: hidden;
  background: var(--clr-surface, #fff);
  box-shadow: 0 8px 28px rgba(197, 160, 89, 0.08);
}
.profile-meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-top: 10px;
}
.profile-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(197, 160, 89, 0.1);
  border: 1px solid rgba(197, 160, 89, 0.22);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--clr-primary);
}
.profile-form-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.profile-form-stack form {
  margin: 0;
  padding-bottom: 18px;
  border-bottom: 1px dashed rgba(197, 160, 89, 0.25);
}
.profile-form-stack form:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.profile-form-stack h4 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--clr-primary);
}
.profile-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}
@media (max-width: 900px) {
  .profile-grid-2 { grid-template-columns: 1fr; }
  .profile-toc { top: 72px; }
}

.lg-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: var(--clr-accent-light);
  color: var(--clr-accent-hover);
  border: 1px solid rgba(197, 160, 89, 0.3);
  vertical-align: middle;
}
.lg-chip--ia { background: linear-gradient(135deg, rgba(197,160,89,0.2), rgba(184,134,11,0.15)); color: var(--clr-accent-deep); }
.lg-chip--ok { background: var(--clr-success-bg); color: #059669; border-color: rgba(16,185,129,0.3); }
.lg-chip--warn { background: var(--clr-warning-bg); color: #b45309; border-color: #fcd34d; }
.lg-chip--danger { background: var(--clr-error-bg); color: var(--clr-error); border-color: rgba(239,68,68,0.3); }
.lg-chip--plan { text-transform: uppercase; }

.lg-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 20px;
  margin-bottom: 1.5rem;
}
.lg-page-header h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2.2vw, 1.65rem);
  font-weight: 700;
  color: var(--clr-primary);
  font-family: var(--font-heading);
}
.lg-page-header p {
  margin: 4px 0 0;
  color: var(--clr-text-muted);
  font-size: 0.92rem;
  max-width: 52ch;
}
.lg-page-header-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Quieter cards */
.bento-card:hover,
.lg-bento-card:hover,
.stat-glass-card:hover {
  transform: translateY(-2px) !important;
  scale: none !important;
}

/* Legacy-ready dashboard */
.legacy-hero {
  background: linear-gradient(160deg, #fffefb 0%, #faf3e0 45%, #f0dfb8 100%);
  border: 1px solid rgba(197, 160, 89, 0.28);
  border-radius: var(--radius-xl);
  padding: 28px 28px 24px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.legacy-hero-top {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.legacy-hero-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--clr-surface);
  border: 2px solid rgba(197, 160, 89, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.legacy-hero-avatar img { width: 100%; height: 100%; object-fit: cover; }
.legacy-hero-text { flex: 1; min-width: 160px; }
.legacy-hero-text p { margin: 0; font-size: 0.88rem; color: var(--clr-text-muted); }
.legacy-hero-text h1 { margin: 2px 0 0; font-size: 1.4rem; font-weight: 700; color: var(--clr-primary); }
.legacy-status-badge {
  margin-left: auto;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}
.legacy-status-badge.is-ready {
  background: rgba(16, 185, 129, 0.14);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.35);
}
.legacy-status-badge.is-pending {
  background: rgba(197, 160, 89, 0.16);
  color: var(--clr-accent-hover);
  border: 1px solid rgba(197, 160, 89, 0.4);
}
.protocol-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.protocol-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(197, 160, 89, 0.18);
}
.protocol-step.done {
  border-color: rgba(16, 185, 129, 0.4);
}
.protocol-step .ps-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(197, 160, 89, 0.12);
  color: var(--clr-accent);
  flex-shrink: 0;
}
.protocol-step.done .ps-icon {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
}
.protocol-step .ps-body { min-width: 0; flex: 1; }
.protocol-step .ps-title { font-weight: 600; font-size: 0.88rem; color: var(--clr-primary); }
.protocol-step .ps-cta {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--clr-accent);
  text-decoration: none;
}
.legacy-hero-cta { display: flex; flex-wrap: wrap; gap: 10px; }

.dash-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.dash-metric {
  background: var(--clr-surface);
  border: 1px solid rgba(197, 160, 89, 0.12);
  border-radius: var(--radius-xl);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.dash-metric:hover {
  border-color: rgba(197, 160, 89, 0.35);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.dash-metric .dm-value {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--clr-primary);
  line-height: 1.1;
}
.dash-metric .dm-label {
  font-size: 0.82rem;
  color: var(--clr-text-muted);
  font-weight: 500;
}

.dash-quick {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.dash-quick a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 12px;
  background: var(--clr-surface);
  border: 1px solid rgba(197, 160, 89, 0.12);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--clr-primary);
  font-size: 0.82rem;
  font-weight: 600;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  text-align: center;
}
.dash-quick a:hover {
  border-color: rgba(197, 160, 89, 0.4);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
  color: var(--clr-primary);
}
.dash-quick .dq-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(197, 160, 89, 0.12);
  color: var(--clr-accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dash-section {
  background: var(--clr-surface);
  border: 1px solid rgba(197, 160, 89, 0.12);
  border-radius: var(--radius-xl);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.dash-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.dash-section-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: var(--font-heading);
  color: var(--clr-primary);
}
.dash-section-head a {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--clr-accent);
  text-decoration: none;
}

.activity-timeline { list-style: none; padding: 0; margin: 0; }
.activity-timeline li {
  position: relative;
  padding: 0 0 16px 28px;
  border-left: 2px solid rgba(197, 160, 89, 0.25);
}
.activity-timeline li:last-child { padding-bottom: 0; }
.activity-timeline li::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--clr-accent);
  box-shadow: 0 0 0 3px rgba(197, 160, 89, 0.2);
}
.activity-timeline .at-time { font-size: 0.75rem; color: var(--clr-text-muted); }
.activity-timeline .at-desc { font-size: 0.92rem; color: var(--clr-primary); margin-top: 2px; line-height: 1.4; }

.banner-readonly {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: var(--radius-xl);
  padding: 20px 24px;
  margin-bottom: 16px;
}
.banner-readonly h2 { margin: 0 0 6px; font-size: 1.1rem; color: #991b1b; }
.banner-readonly p { margin: 0; color: #7f1d1d; font-size: 0.92rem; }

.dashboard-inner-wide {
  width: 100%;
  max-width: var(--portal-content-max, 1100px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0; /* padding lo aporta .lg-main-content */
  box-sizing: border-box;
}

/* Legacy aliases: if any page still uses premium-wrapper, treat as main column */
.lg-dashboard-layout > .dashboard-premium-wrapper,
.lg-dashboard-layout > .dashboard-wrap {
  flex: 1 1 0% !important;
  min-width: 0 !important;
  max-width: none !important;
  margin: 0 !important;
  width: auto !important;
}
.dashboard-premium-grid {
  /* Never a multi-column shell — was leaving content in col 1 only */
  display: flex !important;
  flex-direction: column !important;
  width: 100%;
  max-width: var(--portal-content-max, 1100px);
  margin: 0 auto;
  gap: 16px;
  box-sizing: border-box;
}

@media (max-width: 900px) {
  .protocol-steps { grid-template-columns: 1fr; }
  .dash-metrics { grid-template-columns: 1fr; }
  .dash-quick { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .dash-quick { grid-template-columns: 1fr 1fr; }
  .legacy-hero { padding: 18px; }
}

/* Share link modal bits */
.share-ttl-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}
.share-ttl-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid rgba(197, 160, 89, 0.25);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--clr-surface);
}
.share-ttl-options input { accent-color: var(--clr-accent); }

/* ========== Design system v2: buttons, help, forms ========== */
:root {
  --lg-text-readable: #44403c; /* warmer, higher contrast than gray-500 */
  --lg-border-strong: rgba(197, 160, 89, 0.28);
  --lg-btn-min-h: 44px;
}

/* Readable body defaults inside portal main */
.lg-main-content {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--clr-text);
}
.lg-main-content p,
.lg-page-header p,
.lg-help-callout p,
.lg-field-hint {
  color: var(--lg-text-readable);
}

/* Page header refined */
.lg-page-header {
  padding-bottom: 4px;
  border-bottom: 1px solid var(--lg-border-strong);
  margin-bottom: 1.25rem !important;
  padding-bottom: 1rem;
}
.lg-page-header h1 {
  letter-spacing: -0.02em;
}
.lg-page-header .lg-page-lead {
  margin: 8px 0 0;
  font-size: 0.95rem;
  line-height: 1.55;
  max-width: 62ch;
  color: var(--lg-text-readable);
}

/* Page title + ? help on same row */
.lg-page-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.lg-page-header-text { min-width: 0; flex: 1; }
.lg-page-header .lg-page-lead {
  max-width: 48ch;
  font-size: 0.9rem !important;
  line-height: 1.45 !important;
  margin-top: 6px !important;
}

/* Collapsible help — "? Ayuda" chip (default closed) */
.lg-help-details {
  position: relative;
  display: inline-block;
  margin: 0;
}
.lg-help-toggle {
  list-style: none;
  cursor: pointer;
  min-height: 32px;
  height: auto;
  width: auto;
  padding: 5px 12px 5px 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-weight: 700;
  font-size: 0.82rem;
  font-family: var(--font-heading, Outfit, sans-serif);
  color: var(--clr-accent-deep, #8b6914);
  background: rgba(197, 160, 89, 0.14);
  border: 1.5px solid rgba(197, 160, 89, 0.35);
  box-shadow: var(--shadow-sm);
  user-select: none;
  transition: background 0.2s, transform 0.15s, border-color 0.2s;
  white-space: nowrap;
}
.lg-help-toggle .lg-help-q {
  display: inline-flex;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  background: rgba(197, 160, 89, 0.25);
  font-weight: 800;
  font-size: 0.85rem;
}
.lg-help-toggle .lg-help-word {
  letter-spacing: 0.01em;
}
/* Compact phone dial: only +34, no flags overflow */
.prefix-dial,
input.prefix-dial {
  max-width: 88px !important;
  min-width: 72px;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  padding-left: 8px !important;
  padding-right: 8px !important;
}
.loc-list .loc-option.prefix-only {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.loc-list .loc-option .loc-flag { display: none !important; }
.lg-help-toggle::-webkit-details-marker { display: none; }
.lg-help-toggle::marker { content: ''; }
.lg-help-details[open] .lg-help-toggle,
.lg-help-toggle:hover {
  background: rgba(197, 160, 89, 0.28);
  border-color: rgba(197, 160, 89, 0.55);
  transform: scale(1.05);
}
.lg-help-panel {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 60;
  width: min(360px, 86vw);
  padding: 14px 16px;
  background: #fffefb;
  border: 1.5px solid var(--lg-border-strong, rgba(197,160,89,0.28));
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(30, 27, 46, 0.12);
  color: var(--lg-text-readable, #44403c);
}
/* When help is not inside header (standalone), flow in document */
.lg-main-content > .lg-help-details {
  align-self: flex-start;
  margin: 0 0 1rem;
  max-width: var(--portal-content-max, 1100px);
  width: 100%;
}
.lg-main-content > .lg-help-details .lg-help-panel {
  position: static;
  width: 100%;
  max-width: 520px;
  margin-top: 8px;
}
.lg-help-panel-title {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--clr-primary);
  margin: 0 0 6px;
}
.lg-help-panel p {
  margin: 0 0 8px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--lg-text-readable, #44403c);
}
.lg-help-panel ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--lg-text-readable, #44403c);
}
.lg-help-panel li { margin-bottom: 4px; }

/* Close "?" help when clicking outside (native details) */
.lg-help-details[open] .lg-help-panel { pointer-events: auto; }

/* Legacy class kept for any leftover markup */
.lg-help-callout {
  display: none; /* replaced by .lg-help-details */
}
.lg-help-callout .lg-help-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(197,160,89,0.18);
  color: var(--clr-accent-deep, #8b6914);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lg-help-callout strong {
  display: block;
  font-size: 0.92rem;
  color: var(--clr-primary);
  margin-bottom: 4px;
}
.lg-help-callout p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
}
.lg-help-callout ul {
  margin: 8px 0 0;
  padding-left: 1.15rem;
  font-size: 0.88rem;
  color: var(--lg-text-readable);
  line-height: 1.5;
}
.lg-help-callout li { margin-bottom: 4px; }

/* Surface card with clear boundary */
.lg-surface {
  background: var(--clr-surface);
  border: 1.5px solid var(--lg-border-strong);
  border-radius: var(--radius-xl);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  max-width: 900px;
}

/* Buttons — 3 clear roles */
.lg-btn,
.btn {
  min-height: var(--lg-btn-min-h);
  padding: 0.7rem 1.35rem;
  font-weight: 600;
  font-size: 0.92rem;
  border-radius: 12px;
  border: 1.5px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none !important;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  line-height: 1.2;
  box-sizing: border-box;
}
.lg-btn:hover,
.btn:hover {
  transform: translateY(-1px);
}
.lg-btn:active,
.btn:active {
  transform: translateY(0);
}
.lg-btn:focus-visible,
.btn:focus-visible,
.lg-input:focus-visible {
  outline: 3px solid rgba(197, 160, 89, 0.4);
  outline-offset: 2px;
}

/* Botones: sistema unificado al final del archivo */

/* Nav group: Mi legado */
.lg-nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lg-nav-group-toggle {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  position: relative;
}
.lg-nav-group-toggle .lg-nav-chevron {
  margin-left: auto;
  opacity: 0.55;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.lg-nav-group.is-open .lg-nav-group-toggle .lg-nav-chevron {
  transform: rotate(180deg);
}
.lg-nav-sub {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 0 6px 12px;
  margin-left: 10px;
  border-left: 2px solid rgba(197, 160, 89, 0.25);
}
.lg-nav-subitem {
  font-size: 0.9rem !important;
  min-height: 40px !important;
  padding-left: 12px !important;
}
.lg-sidebar.mini .lg-nav-sub {
  display: none !important;
}

/* Domain search modal shell (shared Legatium branding) */
.lg-domain-modal {
  max-width: 520px;
  width: 100%;
  padding: 26px 22px 18px;
  text-align: left;
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(197, 160, 89, 0.28);
  box-shadow: 0 24px 60px rgba(30, 27, 46, 0.18);
  position: relative;
  box-sizing: border-box;
}
.lg-domain-modal-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.lg-domain-modal-logo-img {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: contain;
  background: #fff;
  border: 1.5px solid rgba(197, 160, 89, 0.35);
  padding: 4px;
  box-sizing: border-box;
  box-shadow: 0 4px 12px rgba(197, 160, 89, 0.15);
}
.lg-domain-modal-brand-name {
  font-family: var(--font-heading, Outfit, sans-serif);
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  color: #8b6914;
}
.lg-domain-search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1.5px solid rgba(197, 160, 89, 0.35);
  background: #fffefb;
  margin-bottom: 12px;
  box-shadow: 0 4px 16px rgba(197, 160, 89, 0.08);
}
.lg-domain-search-row .lg-domain-search-input,
.lg-domain-search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 1rem;
  min-width: 0;
  color: var(--clr-primary, #1e1b2e);
  font-family: inherit;
}
.lg-inv-upload-box {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1.5px dashed rgba(139, 92, 246, 0.45);
  background: linear-gradient(145deg, rgba(139, 92, 246, 0.06), rgba(167, 139, 250, 0.1));
}
.lg-inv-upload-box .lg-label {
  color: #5b21b6 !important;
}
.lg-file-pick {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.lg-file-pick input[type="file"] {
  position: absolute;
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}
.lg-file-pick-name {
  font-size: 0.85rem;
  color: #6b7280;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Danger — definido abajo en el sistema unificado de botones */

/* Global confirm modal */
.lg-confirm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10050;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.lg-confirm-overlay.active {
  display: flex;
}
.lg-confirm-box {
  background: #fff;
  width: 100%;
  max-width: 420px;
  border-radius: 16px;
  padding: 28px 24px 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
  text-align: center;
  animation: slideUp 0.28s ease-out;
}
.lg-confirm-icon {
  font-size: 2rem;
  margin-bottom: 8px;
  line-height: 1;
}
.lg-confirm-box h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  color: var(--clr-primary);
  font-family: var(--font-heading, Outfit, sans-serif);
}
.lg-confirm-box p {
  margin: 0 0 20px;
  font-size: 0.92rem;
  color: var(--clr-text-muted, #6b7280);
  line-height: 1.5;
}
.lg-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.lg-confirm-actions .lg-btn {
  min-width: 120px;
}

/* .lg-btn-sm definido abajo en el sistema unificado */

/* Form labels + hints */
.lg-label {
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  color: var(--clr-primary) !important;
  margin-bottom: 0.4rem !important;
}
.lg-field-hint {
  display: block;
  font-size: 0.8rem;
  line-height: 1.4;
  margin-top: 0.35rem;
  color: var(--lg-text-readable);
}
.lg-input,
.input {
  min-height: 44px;
  border: 1.5px solid rgba(30, 27, 46, 0.12) !important;
  font-size: 0.95rem !important;
}
.lg-input:focus,
.input:focus {
  border-color: var(--clr-accent) !important;
  box-shadow: 0 0 0 3px rgba(197, 160, 89, 0.18) !important;
}

/* Empty state improved */
.lg-empty {
  text-align: center;
  padding: 48px 28px;
  background: var(--clr-surface);
  border: 2px dashed var(--lg-border-strong);
  border-radius: var(--radius-xl);
  max-width: 520px;
}
.lg-empty h3 {
  margin: 12px 0 8px;
  font-family: var(--font-heading);
  color: var(--clr-primary);
}
.lg-empty p {
  margin: 0 0 16px;
  color: var(--lg-text-readable);
  font-size: 0.92rem;
  line-height: 1.5;
}
.lg-empty ol {
  text-align: left;
  max-width: 340px;
  margin: 0 auto 20px;
  padding-left: 1.2rem;
  color: var(--lg-text-readable);
  font-size: 0.9rem;
  line-height: 1.55;
}

/* Inventory / subscription cards */
.lg-inv-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 1.25rem;
  max-width: 960px;
}
.lg-inv-stat {
  background: var(--clr-surface);
  border: 1.5px solid var(--lg-border-strong);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  text-align: center;
}
.lg-inv-stat .v {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--clr-primary);
}
.lg-inv-stat .l {
  font-size: 0.78rem;
  color: var(--lg-text-readable);
  font-weight: 600;
  margin-top: 2px;
}
.lg-inv-list-grouped {
  display: flex;
  flex-direction: column;
  gap: 28px;
  width: 100%;
  max-width: var(--portal-content-max, 1100px);
  margin: 0 auto;
}
.lg-inv-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.lg-inv-group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 2px 2px;
  border-bottom: 1px solid rgba(197, 160, 89, 0.22);
  padding-bottom: 10px;
}
.lg-inv-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.lg-inv-group-title h2 {
  margin: 0;
  font-family: var(--font-heading, Outfit, sans-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--clr-primary, #1c1917);
}
.lg-inv-group-icon {
  font-size: 1.35rem;
  line-height: 1;
}
.lg-inv-group-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6rem;
  height: 1.6rem;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #8b6914;
  background: rgba(197, 160, 89, 0.15);
  border: 1px solid rgba(197, 160, 89, 0.3);
}
.lg-inv-group-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.lg-inv-list {
  display: grid;
  gap: 12px;
  max-width: 900px;
}
.lg-inv-card {
  background: var(--clr-surface);
  border: 1.5px solid var(--lg-border-strong);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.lg-inv-card:hover {
  border-color: rgba(197, 160, 89, 0.45);
  box-shadow: var(--shadow-sm);
}
.lg-inv-card.is-urgent {
  border-color: #fca5a5;
  background: #fffbfb;
}
.lg-inv-card.is-soon {
  border-color: #fcd34d;
  background: #fffdf5;
}
.lg-chip-cat {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(197,160,89,0.14);
  color: var(--clr-accent-deep, #8b6914);
  border: 1px solid rgba(197,160,89,0.3);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.lg-chip-action {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  border: 1px solid transparent;
}
.lg-chip-action.continuar { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.lg-chip-action.cancelar { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.lg-chip-action.transferir { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.lg-chip-action.revisar { background: #fffbeb; color: #b45309; border-color: #fde68a; }

.lg-form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
@media (max-width: 700px) {
  .lg-form-grid-2 { grid-template-columns: 1fr; }
}

.lg-section-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--clr-primary);
  margin: 20px 0 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(197,160,89,0.15);
}
.lg-section-title:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

/* Inventory filters — compact chips + category dropdown */
.lg-inv-filters {
  margin-bottom: 1.1rem;
  max-width: 900px;
  width: 100%;
}
.lg-inv-filters-primary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.lg-chip-filter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--clr-primary);
  background: #fff;
  border: 1.5px solid rgba(30, 27, 46, 0.12);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.lg-chip-filter::-webkit-details-marker { display: none; }
.lg-chip-filter.is-on,
.lg-chip-filter:hover {
  border-color: rgba(197, 160, 89, 0.55);
  background: rgba(197, 160, 89, 0.12);
  color: var(--clr-accent-deep, #8b6914);
}
.lg-inv-cat-details { position: relative; }
.lg-inv-cat-details > summary.lg-chip-filter { list-style: none; }
.lg-inv-cat-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 40;
  min-width: 200px;
  background: #fff;
  border: 1.5px solid rgba(197, 160, 89, 0.28);
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(30, 27, 46, 0.12);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lg-inv-cat-menu a {
  padding: 9px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--clr-primary);
  font-size: 0.88rem;
  font-weight: 500;
}
.lg-inv-cat-menu a:hover,
.lg-inv-cat-menu a.is-on {
  background: rgba(197, 160, 89, 0.12);
  color: var(--clr-accent-deep, #8b6914);
  font-weight: 600;
}

/* Inventory card v2 — structured meta, not one long line */
.lg-inv-card-v2 {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px 16px;
  align-items: start;
}
.lg-inv-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--clr-surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid rgba(197, 160, 89, 0.2);
}
.lg-inv-card-title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--clr-primary);
  font-family: var(--font-heading);
  line-height: 1.25;
}
.lg-inv-card-title-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.lg-inv-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.lg-inv-meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px 14px;
  margin: 0;
}
.lg-inv-meta > div {
  background: rgba(197, 160, 89, 0.06);
  border-radius: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(197, 160, 89, 0.12);
}
.lg-inv-meta dt {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--clr-text-muted);
}
.lg-inv-meta dd {
  margin: 2px 0 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--clr-primary);
}
.lg-inv-meta dd .muted {
  font-weight: 500;
  color: var(--clr-text-muted);
  font-size: 0.8rem;
}
.lg-inv-notes {
  margin: 10px 0 0;
  font-size: 0.88rem;
  color: var(--lg-text-readable);
  line-height: 1.45;
  padding: 10px 12px;
  background: var(--clr-surface-alt, #f8f5f0);
  border-radius: 10px;
  border-left: 3px solid rgba(197, 160, 89, 0.45);
}
.lg-inv-contact {
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: var(--lg-text-readable);
}
.lg-inv-doc { margin: 10px 0 0; }
.lg-inv-doc-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.lg-inv-doc-list .lg-btn {
  max-width: 100%;
  text-align: left;
  white-space: normal;
  line-height: 1.3;
}
.lg-inv-doc-role-tag {
  font-weight: 700;
  color: var(--clr-accent, #c5a059);
  margin-right: 4px;
}
.lg-inv-card-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}
.lg-chip--muted {
  background: rgba(120, 113, 108, 0.12);
  color: #57534e;
  border: 1px solid rgba(120, 113, 108, 0.2);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

/* Ficha del legado — bloques colapsables */
.lg-inv-form-card .lg-inv-block {
  border: 1px solid rgba(197, 160, 89, 0.22);
  border-radius: 12px;
  background: var(--clr-surface-alt, #faf8f5);
  margin: 0 0 12px;
  overflow: hidden;
}
.lg-inv-block-sum {
  cursor: pointer;
  list-style: none;
  font-family: var(--font-heading, Outfit, sans-serif);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--clr-primary, #1c1917);
  padding: 12px 14px;
  user-select: none;
}
.lg-inv-block-sum::-webkit-details-marker { display: none; }
.lg-inv-block-sum::before {
  content: '▸';
  display: inline-block;
  margin-right: 8px;
  color: var(--clr-accent, #c5a059);
  transition: transform 0.15s ease;
}
.lg-inv-block[open] > .lg-inv-block-sum::before {
  transform: rotate(90deg);
}
.lg-inv-block-body {
  padding: 0 14px 14px;
}
.lg-inv-doc-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.lg-inv-doc-row {
  display: grid;
  grid-template-columns: minmax(110px, 140px) 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid rgba(28, 25, 23, 0.08);
  border-radius: 10px;
}
.lg-inv-doc-rol {
  font-size: 0.85rem !important;
  padding: 6px 8px !important;
}
.lg-inv-doc-name {
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--lg-text-readable, #44403c);
}
.lg-inv-doc-remove {
  min-width: 36px;
  font-size: 1.1rem;
  line-height: 1;
  padding: 4px 10px !important;
}
.lg-inv-upload-box {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed rgba(197, 160, 89, 0.35);
}
.lg-inv-address {
  margin: 10px 0 0;
  font-size: 0.88rem;
  color: var(--lg-text-readable, #44403c);
  line-height: 1.4;
}
.lg-inv-address a {
  font-weight: 700;
  color: var(--clr-accent, #b8860b);
  text-decoration: none;
}
.lg-inv-address a:hover { text-decoration: underline; }
.lg-inv-rel-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.lg-inv-rel-chip {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(28, 25, 23, 0.05);
  border: 1px solid rgba(28, 25, 23, 0.08);
  color: var(--lg-text-readable, #44403c);
}
.lg-inv-rel-chip.is-in {
  background: rgba(197, 160, 89, 0.12);
  border-color: rgba(197, 160, 89, 0.3);
}
.lg-inv-check strong {
  font-size: 0.9rem;
  color: var(--clr-primary);
}
.file-inv-badge {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(197, 160, 89, 0.15);
  color: #92640a;
  text-decoration: none;
  vertical-align: middle;
}
.file-inv-badge--none {
  background: rgba(120, 113, 108, 0.12);
  color: #78716c;
  font-weight: 600;
}
.lg-inv-brand-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.lg-inv-brand-row .lg-input { flex: 1; min-width: 0; }
.lg-inv-brand-row .lg-btn-upload { flex-shrink: 0; white-space: nowrap; }

/* Protocol callout (need crypto key before authorized persons) */
.lg-protocol-callout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
  margin: 0 0 18px;
  padding: 16px 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(197, 160, 89, 0.12), rgba(251, 191, 36, 0.08));
  border: 1.5px solid rgba(197, 160, 89, 0.4);
  box-sizing: border-box;
  width: 100%;
  max-width: var(--portal-content-max, 1100px);
}
.lg-protocol-callout-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  background: #fff;
  border: 1px solid rgba(197, 160, 89, 0.35);
  box-shadow: 0 2px 8px rgba(26, 21, 32, 0.06);
}
.lg-protocol-callout-text {
  flex: 1 1 200px;
  min-width: 0;
}
.lg-protocol-callout-text strong {
  display: block;
  font-size: 1.02rem;
  color: var(--clr-primary, #1e1b2e);
  margin: 0 0 4px;
  font-family: var(--font-heading, Outfit, system-ui, sans-serif);
}
.lg-protocol-callout-text p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--clr-text-muted, #57534e);
}
.lg-protocol-callout-cta {
  flex-shrink: 0;
  align-self: center;
  white-space: nowrap;
  margin: 0 !important;
}
@media (max-width: 640px) {
  .lg-protocol-callout {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
  }
  .lg-protocol-callout-cta {
    width: 100%;
    text-align: center;
  }
}
.lg-inv-brand-preview {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(28, 25, 23, 0.1);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.lg-inv-brand-preview img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}
.lg-inv-brand-img {
  width: 36px !important;
  height: 36px !important;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}
.lg-inv-card-icon {
  overflow: hidden;
}
.lg-inv-map-wrap {
  margin-top: 10px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(28, 25, 23, 0.1);
  max-width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 200px;
}
.lg-inv-map {
  width: 100%;
  height: 100%;
  min-height: 160px;
  border: 0;
  display: block;
}
.lg-iban-toggle {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.9rem;
  margin-left: 4px;
  padding: 0 4px;
  opacity: 0.7;
  flex-shrink: 0;
}
.lg-iban-toggle:hover { opacity: 1; }
.lg-iban-mask {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85em;
  letter-spacing: 0.04em;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.lg-iban-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
}
.lg-inv-meta-wide {
  grid-column: 1 / -1;
}
.lg-inv-meta-wide dd {
  font-variant-numeric: tabular-nums;
}
/* Legado: Fichas | Contraseñas */
/* Concept strip above tabs — always light, large readable type */
.lg-legado-concept {
  width: 100%;
  max-width: var(--portal-content-max, 1100px);
  margin: 0 auto 10px;
  padding: 0;
  background: linear-gradient(145deg, #fffefb 0%, #faf6ee 100%);
  border: 1.5px solid rgba(197, 160, 89, 0.28);
  border-radius: 12px;
  box-sizing: border-box;
}
.lg-legado-concept-compact > summary.lg-legado-concept-title {
  list-style: none;
  cursor: pointer;
  margin: 0;
  padding: 10px 14px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--clr-primary, #1e1b2e);
  font-family: var(--font-heading, Outfit, sans-serif);
  user-select: none;
}
.lg-legado-concept-compact > summary::-webkit-details-marker { display: none; }
.lg-legado-concept-compact > summary::after {
  content: ' ▾';
  color: #8b6914;
  font-weight: 800;
}
.lg-legado-concept-compact[open] > summary::after { content: ' ▴'; }
.lg-legado-concept-body { padding: 0 14px 12px; }
.lg-legado-concept-title {
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--clr-primary, #1e1b2e);
  font-family: var(--font-heading, Outfit, sans-serif);
}
.lg-legado-concept-steps {
  margin: 0;
  padding: 0 0 0 1.1rem;
  font-size: 0.84rem;
  color: #44403c;
  line-height: 1.4;
}
.lg-legado-concept-steps li { margin-bottom: 3px; }
.lg-legado-concept-foot {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: #78716c;
  line-height: 1.35;
}
.lg-legado-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
  max-width: var(--portal-content-max, 1100px);
  margin: 0 auto 1.1rem;
  padding: 6px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(197, 160, 89, 0.22);
  border-radius: 16px;
  box-sizing: border-box;
  position: sticky;
  top: 16px;
  z-index: 100;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}
.lg-legado-tab {
  text-align: center;
  padding: 12px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--clr-text-muted, #78716c);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none !important;
  min-height: 72px; /* Force uniform height */
}
.lg-legado-tab-label { font-weight: 800; }
.lg-legado-tab-count {
  display: inline-flex;
  min-width: 1.4em;
  padding: 0 6px;
  margin-left: 4px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  background: rgba(197, 160, 89, 0.2);
  color: #8b6914;
  vertical-align: middle;
}
.lg-legado-tab.is-on .lg-legado-tab-count {
  background: rgba(26, 18, 8, 0.12);
  color: #1a1208;
}
.lg-legado-tab-hint {
  font-size: 0.68rem;
  font-weight: 600;
  opacity: 0.75;
  line-height: 1.2;
}
.lg-inv-related {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(197, 160, 89, 0.35);
}
.lg-inv-related-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #8b6914;
  margin-bottom: 6px;
}
.lg-inv-related-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
a.lg-inv-rel-chip-link,
span.lg-inv-rel-chip-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: #fff;
  border: 1.5px solid rgba(30, 27, 46, 0.18);
  color: #1e1b2e !important;
  text-decoration: none !important;
  line-height: 1.2;
}
a.lg-inv-rel-chip-link:hover {
  border-color: rgba(197, 160, 89, 0.65);
  background: rgba(197, 160, 89, 0.08);
}
.lg-inv-rel-chip-link.is-static { cursor: default; opacity: 0.9; }
.lg-inv-link-callout {
  padding: 12px 14px;
  border-radius: 12px;
  background: #faf7f2;
  border: 1.5px solid rgba(197, 160, 89, 0.3);
}
.lg-inv-link-callout strong { display: block; color: var(--clr-primary); margin-bottom: 4px; font-size: 0.9rem; }
.lg-inv-link-callout p { margin: 0 0 10px; font-size: 0.84rem; color: #57534e; line-height: 1.45; }
.lg-legado-tab {
  /* continue existing props */
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.lg-legado-tab:hover {
  background: rgba(255, 255, 255, 0.7);
  color: var(--clr-primary);
}
.lg-legado-tab.is-on {
  background: #fff;
  color: var(--clr-primary);
  box-shadow: 0 2px 8px rgba(26, 21, 32, 0.06);
  border: 1px solid rgba(197, 160, 89, 0.25);
}
.lg-inv-map-fallback {
  padding: 14px 16px;
  background: rgba(197, 160, 89, 0.06);
  border-radius: 12px;
  border: 1px dashed rgba(197, 160, 89, 0.3);
}

.lg-inv-smart-tip {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
  max-width: var(--portal-content-max, 1100px);
  margin: 0 auto 1.1rem;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(197, 160, 89, 0.35);
  background: linear-gradient(135deg, rgba(197, 160, 89, 0.1), rgba(255, 255, 255, 0.6));
  box-sizing: border-box;
}
.lg-inv-form-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.lg-inv-type-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8b6914;
  background: rgba(197, 160, 89, 0.14);
  border: 1px solid rgba(197, 160, 89, 0.35);
  padding: 4px 10px;
  border-radius: 999px;
}
.lg-inv-paid-note {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(22, 163, 74, 0.08);
  border: 1px solid rgba(22, 163, 74, 0.22);
  color: #166534;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
}
.lg-inv-amount-box {
  margin: 14px 0 0;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(197, 160, 89, 0.22);
  background: rgba(250, 247, 242, 0.85);
}
.lg-inv-amount-title {
  margin: 0 0 4px;
  font-family: var(--font-heading, Outfit, sans-serif);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--clr-primary, #1c1917);
}
.lg-inv-wizard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.lg-inv-wizard-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 18px 14px;
  border-radius: 16px;
  border: 1.5px solid rgba(197, 160, 89, 0.22);
  background: #fff;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  min-height: 140px;
}
.lg-inv-wizard-card:hover {
  border-color: rgba(197, 160, 89, 0.55);
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(197, 160, 89, 0.12);
}
.lg-inv-wizard-icon {
  font-size: 1.75rem;
  line-height: 1;
  margin-bottom: 4px;
}
.lg-inv-wizard-card strong {
  font-size: 0.95rem;
  color: var(--clr-primary, #1c1917);
}
.lg-inv-wizard-card span:last-child {
  font-size: 0.8rem;
  color: var(--lg-text-readable, #57534e);
  line-height: 1.35;
}
@media (max-width: 900px) {
  .lg-inv-wizard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .lg-inv-wizard-grid { grid-template-columns: 1fr; }
}
/* Inventario: mismo eje que el resto del portal */
.lg-main-content > .lg-inv-summary,
.lg-main-content > .lg-inv-list,
.lg-main-content > .lg-inv-filters {
  margin-left: auto;
  margin-right: auto;
}
.lg-inv-smart-tip-icon { font-size: 1.4rem; line-height: 1; }
.lg-inv-smart-tip-body strong {
  display: block;
  color: var(--clr-primary);
  margin-bottom: 4px;
}
.lg-inv-smart-tip-body p {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: var(--lg-text-readable, #44403c);
  line-height: 1.45;
}
.lg-inv-smart-tip-list {
  margin: 0 0 10px;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  color: var(--lg-text-readable, #57534e);
}
@media (max-width: 900px) {
  .lg-inv-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 700px) {
  .lg-inv-card-v2 {
    grid-template-columns: auto 1fr;
  }
  .lg-inv-card-actions {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .lg-inv-card-actions .lg-btn { flex: 1; }
  .lg-inv-doc-row {
    grid-template-columns: 1fr auto;
  }
  .lg-inv-doc-rol { grid-column: 1 / -1; }
  .lg-inv-summary {
    grid-template-columns: 1fr 1fr;
  }
}

/* —— Overflow / text safety (2026) —— */
.legatium-text-safe,
.lg-main-content h1,
.lg-main-content h2,
.lg-main-content p,
.auth-name,
.auth-meta,
.auth-preview-body,
.lg-page-header h1,
.lg-page-header p {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.lg-btn, .auth-folder-chip, .lg-chip {
  max-width: 100%;
}
.lg-btn {
  white-space: normal;
  text-align: center;
  line-height: 1.25;
}
@media (max-width: 520px) {
  .lg-page-header {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .lg-page-header .lg-btn {
    width: 100%;
  }
}

/* —— Phase C: mobile-first portal polish —— */
@media (max-width: 768px) {
  .lg-page-header {
    flex-direction: column;
    align-items: stretch !important;
    gap: 12px;
  }
  .lg-page-header .lg-btn,
  .lg-page-header a.lg-btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }
  .lg-legado-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .lg-legado-tabs::-webkit-scrollbar { display: none; }
  .lg-legado-tab {
    flex: 0 0 auto;
    white-space: nowrap;
    min-height: 40px;
    padding: 8px 14px !important;
    font-size: 0.85rem !important;
  }
  .lg-form-grid-2,
  .lg-inv-form .lg-form-grid-2 {
    grid-template-columns: 1fr !important;
  }
  .lg-inv-wizard-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }
  .lg-surface,
  .lg-inv-block {
    border-radius: 14px;
  }
  .lg-btn,
  .lg-btn-sm {
    min-height: 40px;
  }
  .lg-btn-sm {
    min-height: 36px;
  }
  table.lg-table,
  .lg-table-wrap {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .lg-topbar {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  .lg-context-pill {
    max-width: min(38vw, 140px) !important;
  }
}

/* Focus visibility */
.lg-btn:focus-visible,
.lg-input:focus-visible,
.lg-label + .lg-input:focus-visible {
  outline: 3px solid rgba(197,160,89,0.45);
  outline-offset: 2px;
}

/* —— Responsive polish: never hide primary content —— */
html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }

/* Large desktops: comfortable content width */
@media (min-width: 1400px) {
  .lg-main-content > .lg-surface,
  .lg-main-content > .lg-page-header,
  .lg-main-content > .content-area {
    max-width: min(1200px, 100%);
  }
}

/* Tablets */
@media (max-width: 1024px) {
  .lg-form-grid-2 { grid-template-columns: 1fr 1fr; gap: 12px; }
  .lg-inv-wizard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

/* Phones & small tablets: stack, scroll, show everything */
@media (max-width: 768px) {
  .lg-dashboard-layout { min-height: 100dvh; }
  .lg-main-content {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }
  .lg-page-header-text, .lg-page-lead { max-width: 100%; }
  .lg-form-grid-2,
  .lg-inv-form .lg-form-grid-2,
  .lg-form-grid-3 {
    grid-template-columns: 1fr !important;
  }
  .lg-inv-wizard-grid { grid-template-columns: 1fr 1fr !important; }
  .lg-table, table.lg-table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* Do not hide labels, hints, actions */
  .lg-field-hint, .lg-label, .lg-inv-block-sum, .lg-legado-tabs { display: revert; }
  .lg-btn, a.lg-btn { white-space: normal; text-align: center; }
  input, select, textarea, .lg-input { max-width: 100%; font-size: 16px !important; }
  img, video, svg { max-width: 100%; height: auto; }
  .lg-modal-box, .lg-pm-modal, .lia-attach-box {
    width: 100% !important;
    max-width: 100% !important;
    max-height: min(92dvh, 100%);
    overflow: auto;
  }
}

@media (max-width: 480px) {
  .lg-inv-wizard-grid { grid-template-columns: 1fr !important; }
  .lg-page-header h1 { font-size: 1.35rem !important; line-height: 1.25; }
  .lg-legado-tab { font-size: 0.82rem !important; }
}

/* Botones definitivos en el sistema unificado al final del archivo */
/* Forms: bare submit buttons still look like a green CTA (never ghost white) */
.lg-main-content form button[type="submit"]:not(.lg-btn):not(.btn-bento):not(.icon-btn):not(.lia-chip):not(.send-btn),
.lg-modal-box form button[type="submit"]:not(.lg-btn):not(.btn-bento),
.lg-main-content form input[type="submit"]:not(.lg-btn) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.7rem 1.15rem;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  background: linear-gradient(135deg, #34d399, #10b981 50%, #059669) !important;
  color: #ffffff !important;
  border: 1.5px solid #047857 !important;
  box-shadow: 0 4px 14px rgba(16,185,129,0.22);
}

/* btn-bento system (files.php etc.) always colored */
.btn-bento.primary,
button.btn-bento.primary {
  background: linear-gradient(135deg, #e2c37d, #c5a059 48%, #b8860b) !important;
  color: #1a1208 !important;
  border: 1.5px solid rgba(184,134,11,0.35) !important;
  font-weight: 700 !important;
}
.btn-bento.outline,
button.btn-bento.outline {
  background: #fff !important;
  color: #1e1b2e !important;
  border: 1.5px solid rgba(30,27,46,0.28) !important;
  font-weight: 700 !important;
}

/* Date / search / generic control buttons in toolbars */
.lg-toolbar button.lg-btn,
.lg-filter-bar button.lg-btn,
.lg-search-row button.lg-btn {
  font-weight: 700 !important;
}

/* Offcanvas Panel */
.lg-offcanvas-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(3px);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.lg-offcanvas-overlay.open {
    opacity: 1;
    visibility: visible;
}
.lg-offcanvas {
    position: fixed;
    top: 16px;
    right: -420px;
    width: 400px;
    height: calc(100vh - 32px);
    background: #fff;
    box-shadow: -4px 0 24px rgba(0,0,0,0.12);
    transition: right 0.3s ease;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    border-radius: 20px 0 0 20px;
}
.lg-offcanvas.active {
    right: 0;
}
.lg-offcanvas-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--lg-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}
.lg-offcanvas-close {
  background: #fef2f2 !important;
  color: #dc2626 !important;
  border: 1px solid #fecaca !important;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 1.25rem;
  font-weight: 700;
  transition: all 0.2s ease;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}
.lg-offcanvas-close:hover {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  transform: scale(1.05);
}
.lg-offcanvas-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* ==========================================================================
   UX ENHANCEMENTS: TOASTS & MICRO-ANIMATIONS
   ========================================================================== */

/* TOAST NOTIFICATIONS */
.lg-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.lg-toast {
    background: #fff;
    border-radius: 8px;
    padding: 12px 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    border-left: 4px solid var(--clr-primary);
    color: var(--lg-text-strong);
    font-size: 0.95rem;
    font-weight: 500;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: auto;
}
.lg-toast.show {
    transform: translateX(0);
    opacity: 1;
}
.lg-toast.lg-toast-error {
    border-left-color: #ef4444;
}
.lg-toast.lg-toast-success {
    border-left-color: #10b981;
}

/* MICRO-ANIMATIONS PARA TARJETAS */
.lg-inv-card, .cred-card, .bento-card, .dash-concept-card, .dash-circle-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease !important;
}
.lg-inv-card:hover:not(.no-hover), 
.cred-card:hover:not(.no-hover), 
.bento-card:hover:not(.no-hover), 
.dash-concept-card:hover:not(.no-hover), 
.dash-circle-card:hover:not(.no-hover) {
    transform: translateY(-3px) !important;
    box-shadow: 0 12px 30px rgba(197, 160, 89, 0.15) !important;
    border-color: rgba(197, 160, 89, 0.4) !important;
}

/* Toggle Switch Styles */
.lg-toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    flex-shrink: 0;
}
.lg-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}
.lg-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #e5e7eb;
    transition: .3s;
    border-radius: 34px;
}
.lg-toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
input:checked + .lg-toggle-slider {
    background-color: #10b981;
}
input:focus + .lg-toggle-slider {
    box-shadow: 0 0 1px #10b981;
}
input:checked + .lg-toggle-slider:before {
    transform: translateX(22px);
}

/* Permissions Modern UI */
.auth-box-scope {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}
.auth-box-scope:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}
.auth-scope-all {
    display: flex;
    align-items: center;
    padding: 16px;
    background: #fafaf9;
    border-bottom: 1px solid #e5e7eb;
}
.auth-scope-all:last-child {
    border-bottom: none;
}
.auth-scope-all > span {
    display: flex;
    flex-direction: column;
    margin-left: 16px;
}
.auth-scope-all > span > strong {
    font-size: 1.05rem;
    color: #1c1917;
}
.auth-scope-all > span > em {
    font-size: 0.85rem;
    color: #78716c;
    font-style: normal;
    margin-top: 4px;
}
.folder-scope-panel {
    padding: 16px;
    background: #ffffff;
}

/* Premium Form UI & Bento Cards - UI Redesign V2 */
.lg-form-card {
    background: #ffffff;
    border: 1px solid var(--lg-border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}
.lg-form-card-title {
    margin: 0 0 20px;
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--clr-primary);
    border-bottom: 1px solid rgba(197, 160, 89, 0.15);
    padding-bottom: 12px;
}
.lg-form-grid-bento {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

/* Enhancing lg-inv-card-v2 */
.lg-inv-card-v2 {
    background: #ffffff;
    border: 1px solid var(--lg-border);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
    transition: all 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    overflow: hidden;
}
.lg-inv-card-v2:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(197, 160, 89, 0.12);
    border-color: rgba(197, 160, 89, 0.4);
}
.lg-inv-card-v2-top {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.lg-inv-card-v2-main {
    flex: 1;
    min-width: 0;
}
.lg-inv-card-v2-footer {
    display: flex;
    gap: 8px;
    border-top: 1px solid rgba(197, 160, 89, 0.1);
    padding-top: 16px;
    margin-top: auto;
}

/* Unifying Lists in Credentials & Payments */
.cred-card, .pm-card-row {
    background: #ffffff;
    border: 1px solid var(--lg-border);
    border-radius: 16px;
    padding: 16px 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 16px;
}
.cred-card:hover, .pm-card-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(197, 160, 89, 0.1);
    border-color: rgba(197, 160, 89, 0.35);
}

/* ==========================================================================
   BOTONES — SISTEMA COMPLETO (portal.css)
   ========================================================================== */

/* Base .lg-btn — with a visible default so bare buttons never look broken */
.lg-btn,
a.lg-btn,
button.lg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0.7rem 1.25rem;
  border-radius: 12px;
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  background: var(--clr-surface, #fff);
  color: var(--clr-primary, #1e1b2e);
  border-color: rgba(30, 27, 46, 0.2);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.lg-btn:hover,
a.lg-btn:hover,
button.lg-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.lg-btn:active,
a.lg-btn:active,
button.lg-btn:active {
  transform: translateY(0);
  box-shadow: none;
}
.lg-btn:focus-visible,
a.lg-btn:focus-visible,
button.lg-btn:focus-visible {
  outline: 2px solid var(--clr-accent, #c5a059);
  outline-offset: 2px;
}
.lg-btn:disabled,
a.lg-btn:disabled,
button.lg-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  transform: none !important;
  box-shadow: none !important;
}

/* Loading state — espera animada */
.lg-btn.is-loading,
a.lg-btn.is-loading,
button.lg-btn.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.lg-btn.is-loading::after,
a.lg-btn.is-loading::after,
button.lg-btn.is-loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: lg-spin 0.6s linear infinite;
}
@keyframes lg-spin {
  to { transform: rotate(360deg); }
}

/* Primary — gold gradient (Legatium brand) */
.lg-btn-primary,
a.lg-btn-primary,
button.lg-btn-primary,
.lg-btn-accent,
a.lg-btn-accent,
button.lg-btn-accent {
  background: linear-gradient(135deg, #e8d194 0%, #c5a059 42%, #d4af37 68%, #b8860b 100%) !important;
  color: #1a1208 !important;
  border: 1.5px solid rgba(139, 105, 20, 0.35) !important;
  box-shadow: 0 4px 14px rgba(197, 160, 89, 0.28) !important;
}
.lg-btn-primary:hover,
.lg-btn-accent:hover {
  filter: brightness(1.06);
  box-shadow: 0 8px 24px rgba(197, 160, 89, 0.35) !important;
  color: #1a1208 !important;
}

/* Blue — acción secundaria distincta */
.lg-btn-blue,
a.lg-btn-blue,
button.lg-btn-blue {
  background: linear-gradient(135deg, #60a5fa, #3b82f6) !important;
  color: #fff !important;
  border: 1.5px solid #2563eb !important;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.25) !important;
}
.lg-btn-blue:hover {
  background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
  filter: brightness(1.05);
}

/* Search / lookup (alias of primary gold) */
.lg-btn-search,
a.lg-btn-search,
button.lg-btn-search,
.btn-search {
  background: linear-gradient(135deg, #e2c37d 0%, #c5a059 50%, #b8860b 100%) !important;
  color: #1a1208 !important;
  border: 1.5px solid rgba(139, 105, 20, 0.4) !important;
  box-shadow: 0 4px 14px rgba(197, 160, 89, 0.28) !important;
  font-weight: 700 !important;
}
.lg-btn-search:hover {
  background: linear-gradient(135deg, #d4b06a, #c5a059) !important;
  color: #1a1208 !important;
  box-shadow: 0 8px 22px rgba(197, 160, 89, 0.35) !important;
  filter: brightness(1.05);
}

/* Upload / attach — violeta (distinto del verde y azul) */
.lg-btn-upload,
a.lg-btn-upload,
button.lg-btn-upload,
.btn-upload {
  background: linear-gradient(135deg, #a78bfa, #8b5cf6 50%, #7c3aed) !important;
  color: #fff !important;
  border: 1.5px solid #6d28d9 !important;
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.28) !important;
  font-weight: 700 !important;
}
.lg-btn-upload:hover {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed) !important;
  filter: brightness(1.05);
}

/* Success — verde esmeralda */
.lg-btn-success,
a.lg-btn-success,
button.lg-btn-success {
  background: linear-gradient(135deg, #34d399, #10b981 50%, #059669) !important;
  color: #fff !important;
  border: 1.5px solid #047857 !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.28) !important;
}
.lg-btn-success:hover {
  filter: brightness(1.03);
  background: linear-gradient(135deg, #34d399, #10b981 50%, #059669) !important;
}

/* Danger — rojo sólido */
.lg-btn-danger,
a.lg-btn-danger,
button.lg-btn-danger {
  background: #dc2626 !important;
  color: #fff !important;
  border: 1.5px solid #b91c1c !important;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.22) !important;
}
.lg-btn-danger:hover {
  background: #b91c1c !important;
}

/* Danger outline — rojo suave para acciones destructivas secundarias */
.lg-btn-danger-outline,
a.lg-btn-danger-outline,
button.lg-btn-danger-outline {
  background: #fff !important;
  color: #b91c1c !important;
  border: 1.5px solid #fca5a5 !important;
}
.lg-btn-danger-outline:hover {
  background: #fef2f2 !important;
  color: #991b1b !important;
}

/* Outline — neutro con borde dorado sutil */
.lg-btn-outline,
a.lg-btn-outline,
button.lg-btn-outline {
  background: #fff !important;
  color: #1e1b2e !important;
  border: 1.5px solid rgba(30, 27, 46, 0.28) !important;
  font-weight: 700 !important;
}
.lg-btn-outline:hover {
  border-color: var(--clr-accent, #c5a059) !important;
  background: rgba(197, 160, 89, 0.06) !important;
}

/* Ghost — mínimo, sin borde ni fondo (para toolbars) */
.lg-btn-ghost,
a.lg-btn-ghost,
button.lg-btn-ghost {
  background: transparent !important;
  color: var(--clr-text-muted, #6b7280) !important;
  border-color: transparent !important;
  box-shadow: none !important;
  min-height: 36px;
  padding: 0.4rem 0.8rem;
}
.lg-btn-ghost:hover {
  background: rgba(0, 0, 0, 0.04) !important;
  color: var(--clr-primary, #1e1b2e) !important;
  transform: none !important;
}

/* Warning — naranja/ámbar para avisos */
.lg-btn-warning,
a.lg-btn-warning,
button.lg-btn-warning {
  background: linear-gradient(135deg, #fbbf24, #f59e0b 50%, #d97706) !important;
  color: #1a1208 !important;
  border: 1.5px solid #b45309 !important;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25) !important;
}
.lg-btn-warning:hover {
  filter: brightness(1.05);
}

/* Premium — dorado oscuro sobre fondo oscuro */
.lg-btn-premium,
a.lg-btn-premium,
button.lg-btn-premium {
  background: linear-gradient(135deg, var(--clr-accent, #c5a059) 0%, #a67c00 100%);
  color: #fff;
  border: none;
  box-shadow: 0 4px 14px rgba(197, 160, 89, 0.3);
  font-weight: 700;
}
.lg-btn-premium:hover {
  background: linear-gradient(135deg, #a67c00 0%, #8b6914 100%);
  box-shadow: 0 8px 24px rgba(197, 160, 89, 0.4);
  color: #fff;
}

/* Edit — azul claro */
.lg-btn-edit,
a.lg-btn-edit,
button.lg-btn-edit {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
  border-color: #bfdbfe !important;
}
.lg-btn-edit:hover {
  background: #dbeafe !important;
}

/* Sizes */
.lg-btn-sm,
a.lg-btn-sm,
button.lg-btn-sm {
  min-height: 36px;
  padding: 0.4rem 0.9rem;
  font-size: 0.82rem;
  border-radius: 10px;
}
.lg-btn-lg,
a.lg-btn-lg,
button.lg-btn-lg {
  min-height: 52px;
  padding: 0.85rem 1.75rem;
  font-size: 1.05rem;
  border-radius: 14px;
}
.lg-btn-full,
a.lg-btn-full,
button.lg-btn-full {
  width: 100%;
}

/* Button group — toolbar horizontal */
.lg-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* ==========================================================================
   BOTTOM NAVIGATION BAR (Mobile)
   ========================================================================== */
.lg-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 95;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1.5px solid rgba(197, 160, 89, 0.25);
  padding: 6px 8px env(safe-area-inset-bottom, 6px);
  justify-content: space-around;
  align-items: stretch;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
}
@media (max-width: 768px) {
  .lg-bottom-nav {
    display: flex;
  }
}
.lg-bottom-nav .bn-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 10px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--clr-text-muted, #6b7280);
  font-size: 0.65rem;
  font-weight: 600;
  min-width: 0;
  flex: 1;
  max-width: 96px;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.lg-bottom-nav .bn-item svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.lg-bottom-nav .bn-item span {
  line-height: 1.1;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.lg-bottom-nav .bn-item:hover {
  color: var(--clr-primary, #1e1b2e);
  background: rgba(197, 160, 89, 0.08);
}
.lg-bottom-nav .bn-item:active {
  transform: scale(0.95);
}
.lg-bottom-nav .bn-item.active {
  color: var(--clr-accent-deep, #8b6914);
  font-weight: 700;
}
.lg-bottom-nav .bn-item.active svg {
  opacity: 1;
  stroke: var(--clr-accent, #c5a059);
}
.lg-bottom-nav .bn-item.active::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--clr-accent, #c5a059);
}

/* Mobile sidebar behaves as a modal panel: the background stays still while
   the menu is open and the panel gets a clear depth cue. */
@media (max-width: 1024px) {
  body.lg-sidebar-open {
    overflow: hidden;
    overscroll-behavior: none;
  }
  .lg-sidebar.active {
    box-shadow: 18px 0 42px rgba(30, 27, 46, 0.2);
  }
}

.lg-bottom-nav .bn-item:focus-visible,
.lg-mobile-toggle:focus-visible,
.lg-mobile-close-btn:focus-visible {
  outline: 3px solid var(--clr-accent, #c5a059);
  outline-offset: 3px;
}

/* ==========================================================================
   CARD SYSTEM — Consistencia en todas las cards del portal
   ========================================================================== */
.lg-card,
.bento-card,
.lg-bento-card,
.dash-block,
.lg-surface,
.lg-inv-card,
.lg-inv-card-v2,
.cred-card,
.pm-card-row,
.lg-form-card {
  background: var(--clr-surface, #fff);
  border: 1.5px solid rgba(197, 160, 89, 0.18);
  border-radius: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.lg-card:hover:not(.no-hover):not(.no-hover),
.bento-card:hover:not(.no-hover),
.lg-bento-card:hover:not(.no-hover),
.dash-block:hover:not(.no-hover),
.lg-surface:hover:not(.no-hover),
.lg-inv-card:hover:not(.no-hover),
.lg-inv-card-v2:hover:not(.no-hover),
.cred-card:hover:not(.no-hover):not(.no-hover),
.pm-card-row:hover:not(.no-hover),
.lg-form-card:hover:not(.no-hover) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(197, 160, 89, 0.12);
  border-color: rgba(197, 160, 89, 0.35);
}

/* ==========================================================================
   EMPTY STATE — Mejorado
   ========================================================================== */
.empty-state,
.lg-empty {
  text-align: center;
  padding: 48px 24px;
  background: var(--clr-surface, #fff);
  border-radius: 18px;
  border: 2px dashed rgba(197, 160, 89, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.empty-state .empty-icon,
.lg-empty .empty-icon {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: rgba(197, 160, 89, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--clr-accent, #c5a059);
  border: 1px solid rgba(197, 160, 89, 0.2);
  margin-bottom: 8px;
}
.empty-state h3,
.lg-empty h3 {
  font-family: var(--font-heading, 'Outfit', sans-serif);
  font-size: 1.15rem;
  color: var(--clr-primary, #1e1b2e);
  margin: 0;
}
.empty-state p,
.lg-empty p {
  font-size: 0.92rem;
  color: var(--clr-text-muted, #6b7280);
  margin: 0;
  max-width: 340px;
  line-height: 1.5;
}

/* ==========================================================================
   STATUS BADGES — Consistencia
   ========================================================================== */
.lg-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.3;
  border: 1px solid transparent;
  white-space: nowrap;
}
.lg-badge--gold {
  background: rgba(197, 160, 89, 0.14);
  color: #8b6914;
  border-color: rgba(197, 160, 89, 0.3);
}
.lg-badge--green {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}
.lg-badge--red {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}
.lg-badge--amber {
  background: #fffbeb;
  color: #b45309;
  border-color: #fcd34d;
}
.lg-badge--blue {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}
.lg-badge--gray {
  background: #f5f5f4;
  color: #57534e;
  border-color: #e7e5e4;
}

/* ==========================================================================
   SKELETON LOADERS
   ========================================================================== */
@keyframes lg-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.lg-skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 37%, #f0f0f0 63%);
  background-size: 200% 100%;
  animation: lg-shimmer 1.4s ease infinite;
  border-radius: 8px;
}
.lg-skeleton--text {
  height: 16px;
  margin-bottom: 8px;
  width: 80%;
}
.lg-skeleton--title {
  height: 24px;
  margin-bottom: 12px;
  width: 60%;
}
.lg-skeleton--avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}
.lg-skeleton--card {
  height: 120px;
  border-radius: 16px;
}

/* ==========================================================================
   SCROLLBAR — Personalizado (WebKit)
   ========================================================================== */
.lg-main-content::-webkit-scrollbar,
.lg-sidebar::-webkit-scrollbar,
.modal-content::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.lg-main-content::-webkit-scrollbar-track,
.lg-sidebar::-webkit-scrollbar-track,
.modal-content::-webkit-scrollbar-track {
  background: transparent;
}
.lg-main-content::-webkit-scrollbar-thumb,
.lg-sidebar::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb {
  background: rgba(197, 160, 89, 0.25);
  border-radius: 3px;
}
.lg-main-content::-webkit-scrollbar-thumb:hover,
.lg-sidebar::-webkit-scrollbar-thumb:hover,
.modal-content::-webkit-scrollbar-thumb:hover {
  background: rgba(197, 160, 89, 0.4);
}

/* ==========================================================================
   TEXT SELECTION — Brand
   ========================================================================== */
::selection {
  background: rgba(197, 160, 89, 0.25);
  color: var(--clr-primary, #1e1b2e);
}

/* ==========================================================================
   FOCUS RINGS — Accesibilidad
   ========================================================================== */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--clr-accent, #c5a059);
  outline-offset: 2px;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline-offset: 0;
}

/* ==========================================================================
   TOOLTIP MEJORADO
   ========================================================================== */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(30, 27, 46, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  z-index: 1000;
  line-height: 1.3;
}
[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   MICRO-INTERACCIONES — hover en filas de tabla
   ========================================================================== */
.modern-table tbody tr {
  transition: background 0.15s ease;
}
.modern-table tbody tr:hover td {
  background: rgba(197, 160, 89, 0.04);
}

/* ==========================================================================
   ALERTAS MEJORADAS
   ========================================================================== */
.lg-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 16px;
}
.lg-alert.lg-alert-success {
  background: #ecfdf5;
  color: #065f46;
  border: 1.5px solid #a7f3d0;
}
.lg-alert.lg-alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1.5px solid #fecaca;
}
.lg-alert.lg-alert-warning {
  background: #fffbeb;
  color: #92400e;
  border: 1.5px solid #fcd34d;
}
.lg-alert.lg-alert-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1.5px solid #bfdbfe;
}

/* ==========================================================================
   MODAL BOTONES DE CIERRE — Consistentes
   ========================================================================== */
.lg-btn-close-modal {
  background: #fef2f2 !important;
  color: #dc2626 !important;
  border: 1px solid #fecaca !important;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 1.25rem;
  font-weight: 700;
  transition: all 0.2s ease;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}
.lg-btn-close-modal:hover {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  transform: scale(1.05);
}

/* ==========================================================================
   BANNER READ-ONLY (modo herencia)
   ========================================================================== */
.banner-readonly {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 1.5px solid rgba(197, 160, 89, 0.35);
  border-radius: 16px;
  padding: 16px 20px;
  color: #92400e;
}
.banner-readonly h2 {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: #78350f;
  margin: 0 0 6px;
}
.banner-readonly p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
}

/* ==========================================================================
   RESPONSIVE — Ajustes finos
   ========================================================================== */
@media (max-width: 480px) {
  .lg-btn,
  a.lg-btn,
  button.lg-btn {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    min-height: 40px;
  }
  .lg-btn-sm,
  a.lg-btn-sm,
  button.lg-btn-sm {
    min-height: 32px;
    padding: 0.3rem 0.7rem;
    font-size: 0.78rem;
  }
  .lg-btn-lg,
  a.lg-btn-lg,
  button.lg-btn-lg {
    min-height: 46px;
    padding: 0.7rem 1.25rem;
    font-size: 0.95rem;
  }
  .lg-btn-group {
    gap: 6px;
  }
}
