/* Shell principal: layout, sidebar, topbar y menu Nexo POS */
body {
  font-family: Inter, "SF Pro Display", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background:
    radial-gradient(circle at 18% 14%, color-mix(in srgb, var(--brand-color) 14%, transparent), transparent 26%),
    linear-gradient(145deg, #f8fbff 0%, #edf3fb 48%, #f9fbff 100%);
  color: var(--pos-text);
}

body.oscuro {
  --pos-bg: #07111f;
  --pos-surface: rgba(15, 23, 42, .72);
  --pos-surface-strong: rgba(15, 23, 42, .92);
  --pos-line: rgba(226, 232, 240, .16);
  --pos-text: #f8fafc;
  --pos-muted: #cbd5e1;
  --pos-shadow: 0 22px 60px rgba(0, 0, 0, .34);
  background:
    radial-gradient(circle at 20% 14%, color-mix(in srgb, var(--brand-color) 24%, transparent), transparent 30%),
    linear-gradient(145deg, #07111f 0%, #0f172a 48%, #08111f 100%);
  color: var(--pos-text);
}

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  background: transparent;
}

.contenido {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  position: relative;
  padding: 22px 28px 38px;
  background:
    radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--brand-color) 12%, transparent), transparent 28%),
    linear-gradient(135deg, rgba(255, 255, 255, .35), rgba(255, 255, 255, .10)) !important;
  color: var(--pos-text);
  min-height: 100vh;
}

body.oscuro .contenido {
  background:
    radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--brand-color) 24%, transparent), transparent 30%),
    linear-gradient(135deg, rgba(15, 23, 42, .72), rgba(2, 6, 23, .92)) !important;
}

/* Sidebar: navy plano, filas con icono y estado activo en pildora azul */
.sidebar {
  width: 278px;
  min-height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 20px 14px 16px !important;
  gap: 3px !important;
  background: #0b1220;
  border-right: 1px solid rgba(255, 255, 255, .06);
  box-shadow: none;
}

.sidebar h1 {
  font-size: 15px;
  margin: 0 0 8px;
  line-height: 1.2;
  color: #fff;
}

@media (min-width: 981px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  #sistema {
    height: 100vh;
    overflow: hidden;
  }

  .layout {
    height: 100vh !important;
    min-height: 100vh !important;
    display: grid !important;
    grid-template-columns: 278px minmax(0, 1fr) !important;
    overflow: hidden !important;
  }

  .sidebar {
    position: sticky !important;
    top: 0 !important;
    align-self: start !important;
    height: 100vh !important;
    min-height: 100vh !important;
    max-height: 100vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }

  .contenido {
    height: 100vh !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
  }
}

body.oscuro .sidebar {
  background: #070c16;
}

.brand-sidebar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px !important;
  padding: 4px 4px 16px !important;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  color: #fff;
}

.brand-sidebar span {
  line-height: 1.15;
  font-size: 16.5px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-sidebar .brand-logo-img,
.brand-sidebar .brand-logo-fallback {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 12px;
}

.brand-sidebar .brand-logo-img {
  object-fit: cover;
  background: #fff;
}

.brand-sidebar .brand-logo-fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--brand-color, #0d6efd), color-mix(in srgb, var(--brand-color, #0d6efd) 68%, #020617));
  color: #fff;
  font-weight: 900;
  font-size: 15px;
}

.sidebar button {
  min-height: 46px !important;
  display: flex;
  align-items: center;
  gap: 14px !important;
  width: 100%;
  margin: 0 !important;
  padding: 0 14px !important;
  border: 0 !important;
  border-radius: 12px !important;
  background: transparent !important;
  color: rgba(255, 255, 255, .72) !important;
  font-size: 14px;
  font-weight: 750;
  letter-spacing: 0;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  transition: background .15s ease, color .15s ease;
}

.sidebar button span,
.sidebar button .ui-icon {
  color: inherit !important;
  opacity: 1 !important;
  text-shadow: none !important;
}

.sidebar button .ui-icon {
  width: 20px !important;
  height: 20px !important;
  flex: 0 0 20px !important;
  stroke-width: 2 !important;
}

.sidebar button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px !important;
  font-weight: 750 !important;
  letter-spacing: 0 !important;
}

.sidebar button:hover {
  background: rgba(255, 255, 255, .07) !important;
  color: #fff !important;
}

.sidebar button.activo {
  background: var(--brand-color, #0d6efd) !important;
  color: #fff !important;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--brand-color, #0d6efd) 35%, transparent) !important;
}

.sidebar button.activo span,
.sidebar button.activo .ui-icon {
  color: #fff !important;
}

.submenu-sidebar {
  margin: 0 0 2px 34px !important;
  padding-left: 10px !important;
  border-left: 1px solid rgba(255, 255, 255, .1);
  gap: 2px !important;
}

.submenu-sidebar button {
  min-height: 40px !important;
  padding: 0 12px !important;
  gap: 12px !important;
  border-radius: 10px !important;
}

.submenu-sidebar button span {
  font-size: 13px !important;
}

.btn-configuracion-sidebar,
.btn-dueno-sidebar {
  margin-top: 6px !important;
}

.btn-dueno-sidebar {
  background: rgba(22, 163, 74, .16) !important;
  color: #4ade80 !important;
}

.btn-dueno-sidebar:hover {
  background: rgba(22, 163, 74, .26) !important;
  color: #86efac !important;
}

/* Pie de sidebar: version + estado de sync (opcional, solo si hay app de escritorio) */
.sidebar-footer {
  margin-top: auto !important;
  padding-top: 14px !important;
  display: grid;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.sidebar-footer-version {
  color: rgba(255, 255, 255, .38);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
  text-align: center;
}

.sidebar-powered-by {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.sidebar-powered-by span {
  color: rgba(255, 255, 255, .38);
  font-size: 10px;
  font-weight: 700;
}

.sidebar-powered-by img {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  display: block;
}

.sidebar-footer .sync-desktop-chip {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 12px;
  background: rgba(255, 255, 255, .05);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}

.sidebar-footer .sync-chip-inner {
  color: rgba(255, 255, 255, .8);
}

.sidebar-footer .sync-chip-inner small {
  color: rgba(255, 255, 255, .5) !important;
}

/* Topbar: barra clara con acciones e identidad de usuario */
.topbar-pos {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 22px;
  padding: 12px 18px;
  border: 1px solid var(--pos-line);
  border-radius: 18px;
  background: var(--pos-surface-strong, #ffffff);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .05);
}

body.oscuro .topbar-pos {
  background: rgba(15, 23, 42, .92);
}

.topbar-title-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.topbar-eyebrow {
  color: var(--brand-color);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.topbar-title-block strong {
  color: var(--pos-text);
  font-size: 21px;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: 0;
}

.topbar-title-block small {
  color: var(--pos-muted);
  font-size: 13px;
  font-weight: 750;
}

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

.topbar-icon-btn {
  width: 42px !important;
  height: 42px;
  min-width: 42px;
  margin: 0;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--pos-line);
  border-radius: 14px;
  background: var(--pos-bg, #f3f4f6) !important;
  color: var(--pos-text, #101828) !important;
  cursor: pointer;
  position: relative;
  font-weight: 900;
  transition: transform .15s ease, background .15s ease;
}

.topbar-icon-btn .ui-icon {
  width: 19px;
  height: 19px;
  color: inherit;
}

.topbar-icon-btn:hover {
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--brand-color, #0d6efd) 10%, var(--pos-bg, #f3f4f6)) !important;
}

body.oscuro .topbar-icon-btn {
  background: rgba(255, 255, 255, .06) !important;
  border-color: rgba(255, 255, 255, .12);
  color: var(--pos-text, #f8fafc) !important;
}

.notification-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--pos-surface-strong);
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.topbar-product-menu {
  position: relative;
  isolation: isolate;
}

.topbar-user-trigger {
  width: auto;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 4px 14px 4px 4px;
  border: 1px solid var(--pos-line);
  border-radius: 999px;
  background: var(--pos-bg, #f3f4f6) !important;
  color: var(--pos-text, #101828) !important;
  cursor: pointer;
  text-align: left;
}

.topbar-user-trigger:hover {
  background: color-mix(in srgb, var(--brand-color, #0d6efd) 10%, var(--pos-bg, #f3f4f6)) !important;
}

body.oscuro .topbar-user-trigger {
  background: rgba(255, 255, 255, .06) !important;
  border-color: rgba(255, 255, 255, .12);
}

.topbar-user-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-color, #0d6efd), color-mix(in srgb, var(--brand-color, #0d6efd) 68%, #020617));
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.topbar-user-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar-user-text strong,
.topbar-user-text small {
  display: block;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-user-text strong {
  color: var(--pos-text);
  font-size: 13px;
  font-weight: 900;
}

.topbar-user-text small {
  color: var(--pos-muted);
  font-size: 11.5px;
  font-weight: 700;
}

.nexo-menu-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 75;
  width: 260px;
  display: none;
  padding: 10px;
  border: 1px solid var(--pos-line);
  border-radius: 16px;
  background: var(--pos-surface-strong, #ffffff);
  color: #0f172a;
  box-shadow: 0 20px 46px rgba(15, 23, 42, .16);
}

.nexo-menu-panel.abierto {
  display: grid;
  gap: 8px;
  animation: posPanelIn .16s ease-out;
}

.nexo-menu-head {
  padding: 8px 10px 12px;
  border-bottom: 1px solid rgba(15, 23, 42, .08);
}

.nexo-menu-head strong,
.nexo-menu-head span {
  display: block;
}

.nexo-menu-head strong {
  color: #0f172a;
  font-size: 15px;
  font-weight: 900;
}

.nexo-menu-head span {
  margin-top: 2px;
  color: #64748b;
  font-size: 12px;
  font-weight: 750;
}

.nexo-menu-panel button {
  min-height: 46px !important;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0 10px;
  border: 1px solid rgba(15, 23, 42, .08) !important;
  border-radius: 12px;
  background: rgba(15, 23, 42, .03) !important;
  color: #0f172a !important;
  font-weight: 850;
  cursor: pointer;
  text-align: left;
}

.nexo-menu-panel button span {
  color: inherit !important;
  font-weight: 900 !important;
}

.nexo-menu-panel button:hover {
  background: rgba(15, 23, 42, .06) !important;
  border-color: rgba(13, 110, 253, .22) !important;
}

.nexo-menu-panel .ui-icon {
  width: 18px;
  height: 18px;
  color: var(--brand-color, #0d6efd) !important;
  opacity: 1 !important;
}

.nexo-menu-panel .nexo-menu-danger {
  color: #b42318 !important;
  background: rgba(254, 242, 242, .72) !important;
  border-color: rgba(239, 68, 68, .16) !important;
}

.nexo-menu-panel .nexo-menu-danger .ui-icon {
  color: #dc2626 !important;
}

body.oscuro .nexo-menu-panel {
  background: rgba(15, 23, 42, .96) !important;
  border-color: rgba(226, 232, 240, .16) !important;
  color: #f8fafc !important;
}

body.oscuro .nexo-menu-head strong {
  color: #f8fafc !important;
}

body.oscuro .nexo-menu-head span {
  color: #cbd5e1 !important;
}

body.oscuro .nexo-menu-panel button {
  background: rgba(255, 255, 255, .06) !important;
  border-color: rgba(226, 232, 240, .12) !important;
  color: #f8fafc !important;
}

body.oscuro .nexo-menu-panel .nexo-menu-danger {
  color: #fecaca !important;
  background: rgba(127, 29, 29, .36) !important;
  border-color: rgba(248, 113, 113, .18) !important;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    width: 100%;
    min-height: auto;
    flex-direction: row;
    overflow: auto;
    padding: 14px !important;
  }

  .brand-sidebar {
    min-width: 220px;
    margin: 0 !important;
    padding: 8px 14px 8px 6px !important;
    border-right: 1px solid rgba(255, 255, 255, .14);
    border-bottom: 0;
  }

  .sidebar button {
    min-width: max-content;
  }

  .submenu-sidebar {
    display: none !important;
  }

  .sidebar-footer {
    display: none;
  }

  .contenido {
    padding: 18px;
  }

  .topbar-pos {
    position: relative;
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    justify-content: space-between;
    flex-wrap: wrap;
  }
}

@media (max-width: 760px) {
  .topbar-product-menu {
    width: 100% !important;
    max-width: 100% !important;
  }

  .topbar-user-trigger {
    width: 100% !important;
    justify-content: flex-start !important;
  }

  .nexo-menu-panel {
    position: absolute !important;
    top: calc(100% + 10px) !important;
    right: 0 !important;
    left: 0 !important;
    width: 100% !important;
    min-width: 0 !important;
    padding: 12px !important;
    border-radius: 20px !important;
  }

  .nexo-menu-panel button {
    justify-content: flex-start !important;
    border-radius: 16px !important;
  }
}
