:root {
  --bg: #ecebe8;
  --bg-soft: #f6f5f2;
  --panel: #ffffff;
  --panel-muted: #f3f4f1;
  --panel-strong: #fcfcfa;
  --border: #e4e5df;
  --text: #171717;
  --muted: #7d8179;
  --primary: #1f7a45;
  --primary-dark: #176238;
  --primary-soft: #e8f4ec;
  --accent: #d7a48e;
  --danger: #d9534f;
  --warning: #d89b18;
  --shadow: 0 18px 40px rgba(30, 35, 25, 0.08);
  --radius: 24px;
  --font-main: "Segoe UI", "Trebuchet MS", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-main);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(31, 122, 69, 0.08), transparent 30%),
    radial-gradient(circle at bottom right, rgba(215, 164, 142, 0.14), transparent 30%),
    var(--bg);
}

.toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 2000;
  display: grid;
  gap: 0.75rem;
  width: min(360px, calc(100vw - 2rem));
}

.toast {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: start;
  padding: 0.9rem 0.95rem;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 22px 40px rgba(25, 33, 23, 0.14);
  animation: toastIn 0.22s ease;
}

.toast-icon,
.toast-close {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}

.toast-icon {
  background: var(--panel-muted);
  color: var(--primary);
}

.toast-error .toast-icon {
  background: rgba(217, 83, 79, 0.12);
  color: #a42623;
}

.toast-success .toast-icon {
  background: var(--primary-soft);
  color: var(--primary);
}

.toast-body strong {
  display: block;
  margin-bottom: 0.15rem;
}

.toast-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.toast-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.toast-close i,
.toast-icon i {
  width: 1rem;
  height: 1rem;
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.muted {
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: #1f7a45;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 0.85rem 1.15rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  font-weight: 700;
}

.btn,
.nav-label,
.side-chip,
.title-with-icon,
.item-icon,
.movement-meta strong,
.movement-meta small {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn i,
.nav-label i,
.side-chip i,
.title-with-icon i,
.item-icon i,
.search-icon i,
.icon-soft i,
.icon-btn i,
.movement-meta i,
.brand-mark i {
  width: 1rem;
  height: 1rem;
  stroke-width: 2.2;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary), #2f9a5b);
  color: #fff;
  box-shadow: 0 10px 22px rgba(31, 122, 69, 0.18);
}

.btn.primary.subtle {
  box-shadow: none;
}

.btn.secondary {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.btn.danger-btn {
  background: linear-gradient(135deg, #c94743, #e0615d);
  color: #fff;
  box-shadow: 0 10px 22px rgba(201, 71, 67, 0.2);
}

.btn.wide {
  width: 100%;
}

.icon-soft {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 50%;
  cursor: pointer;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.login-shell {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.5rem;
  align-items: stretch;
}

.login-panel {
  min-height: 78vh;
  border-radius: 32px;
  padding: 2rem;
  box-shadow: var(--shadow);
}

.hero-panel {
  background: linear-gradient(160deg, #1b6b3d, #21552f);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-panel h1 {
  font-size: clamp(2.6rem, 5vw, 4.6rem);
  margin: 0.5rem 0 1rem;
  line-height: 0.98;
}

.hero-panel p {
  max-width: 34rem;
  color: rgba(255, 255, 255, 0.78);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  opacity: 0.75;
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 2rem 0 0;
  display: grid;
  gap: 0.9rem;
}

.feature-list li::before {
  content: "• ";
  color: #facc15;
}

.form-panel {
  display: grid;
  place-items: center;
}

.card,
.glass {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.glass {
  padding: 2rem;
  width: min(460px, 100%);
}

.auth-form,
.stack-form {
  display: grid;
  gap: 1rem;
}

label span {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.92rem;
  color: var(--muted);
}

input,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.92rem 1rem;
  background: var(--bg-soft);
}

textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.92rem 1rem;
  background: var(--bg-soft);
  font-family: inherit;
  font-size: inherit;
  resize: vertical;
  min-height: 80px;
}

.textarea-reason {
  min-height: 100px;
  resize: vertical;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 3rem;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.7rem;
  transform: translateY(-50%);
  width: 2rem;
  height: 2rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.password-toggle i {
  width: 1rem;
  height: 1rem;
}

.demo-box,
.alert {
  margin-top: 1rem;
  border-radius: 16px;
  padding: 0.9rem 1rem;
}

.demo-box {
  background: var(--primary-soft);
}

.alert.error {
  background: rgba(217, 83, 79, 0.12);
  color: #991b1b;
}

.app-frame {
  min-height: 100vh;
  padding: 14px;
}

.app-layout {
  display: grid;
  grid-template-columns: 278px 1fr;
  min-height: calc(100vh - 28px);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 30px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.sidebar {
  background: linear-gradient(180deg, #f4f4f1, #efefeb);
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--border);
}

.sidebar-main {
  display: grid;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.35rem;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 1.35rem;
  font-weight: 800;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
}

.sidebar-group-label {
  margin-top: 0.7rem;
  font-size: 0.72rem;
  color: #8c9088;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.nav-links {
  display: grid;
  gap: 0.5rem;
}

.nav-link {
  text-align: left;
  border: 0;
  background: transparent;
  color: #4d514c;
  padding: 0.92rem 1rem;
  border-radius: 16px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.nav-label {
  color: inherit;
}

.nav-link .nav-label i {
  color: #7a7f77;
}

.nav-link.active .nav-label i,
.nav-link:hover .nav-label i {
  color: var(--primary);
}

.nav-link.active,
.nav-link:hover {
  background: #fff;
  color: #111;
  box-shadow: 0 10px 24px rgba(33, 40, 29, 0.07);
}

.sidebar-secondary {
  display: grid;
  gap: 0.55rem;
}

.side-chip {
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 14px;
  padding: 0.78rem 0.9rem;
  text-align: left;
  color: #666b64;
  cursor: pointer;
  justify-content: flex-start;
}

.download-card {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 22px;
  background:
    radial-gradient(circle at top left, rgba(77, 171, 104, 0.24), transparent 34%),
    linear-gradient(160deg, #0f2619, #102717 55%, #1e6235);
  color: #fff;
}

.download-overline {
  margin: 0 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.68);
}

.download-card h3,
.download-card p {
  margin: 0 0 0.7rem;
}

.sidebar-footer {
  display: grid;
  gap: 1rem;
}

.sidebar-footer form {
  width: 100%;
}

.profile-mini,
.user-chip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.profile-mini {
  padding: 0.9rem 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
}

.profile-mini>div:last-child {
  min-width: 0;
}

.profile-mini strong,
.profile-mini .muted {
  display: block;
  margin: 0;
}

.profile-mini .muted {
  overflow-wrap: anywhere;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 800;
}

.avatar.warm {
  background: #f5ddd3;
  color: #8f4e35;
}

.sidebar-footer .btn.ghost {
  justify-content: center;
  background: #1f7a45;
  color: #fff;
  border: 1px solid #1f7a45;
}

.sidebar-footer .btn.ghost:hover {
  background: #176238;
}

.content-shell {
  padding: 1.25rem;
  overflow: auto;
  background: rgba(249, 249, 247, 0.72);
}

.topbar,
.page-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.topbar {
  margin-bottom: 0.95rem;
  justify-content: flex-end;
}

.page-heading {
  margin-bottom: 1rem;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  flex: 1;
  min-width: 260px;
}

.search-icon {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
}

.topbar-search input {
  border: 0;
  background: transparent;
  padding: 0;
}

.topbar-search input:focus {
  outline: none;
}

.search-icon,
.search-shortcut {
  color: var(--muted);
  white-space: nowrap;
}

.search-shortcut {
  padding: 0.3rem 0.55rem;
  border-radius: 10px;
  background: var(--panel-muted);
  font-size: 0.78rem;
}

.topbar-actions,
.hero-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.user-chip {
  padding: 0.45rem 0.6rem;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--border);
}

.user-chip span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
}

.page-heading h1 {
  margin: 0;
  font-size: 2.2rem;
}

.title-with-icon {
  color: var(--text);
}

.title-with-icon i {
  color: var(--primary);
}

.section-intro {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.soft-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(245, 246, 242, 0.95));
}

.section-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--primary);
}

.section-intro h3 {
  margin: 0 0 0.3rem;
  font-size: 1.25rem;
}

.mini-metrics {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.mini-metrics div {
  min-width: 110px;
  padding: 0.85rem 1rem;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--border);
}

.mini-metrics strong,
.report-tile strong {
  display: block;
  font-size: 1.4rem;
  margin-bottom: 0.2rem;
}

.mini-metrics span {
  color: var(--muted);
  font-size: 0.82rem;
}

.view {
  display: none;
  animation: fadeUp 0.3s ease;
}

.view.active {
  display: block;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.stat-card {
  padding: 1.2rem;
  background: var(--panel-strong);
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.stat-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-muted);
  color: var(--primary);
}

.stat-card.highlight .stat-icon {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.stat-card strong {
  display: block;
  font-size: 2rem;
  margin: 0.5rem 0 0.2rem;
}

.stat-card.highlight {
  background: linear-gradient(160deg, var(--primary), #239154);
  color: #fff;
}

.stat-card.highlight .muted {
  color: rgba(255, 255, 255, 0.78);
}

.dashboard-grid,
.split-grid {
  display: grid;
  gap: 1rem;
}

/* Nuevo diseño del dashboard */
.dashboard-grid-new {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  min-height: 500px;
}

.dashboard-left-column,
.dashboard-center-column,
.dashboard-right-column {
  display: grid;
  gap: 1rem;
  grid-template-rows: auto auto;
}

.dashboard-left-column .chart-card:first-child,
.dashboard-center-column .chart-card:first-child,
.dashboard-right-column .chart-card:first-child {
  min-height: 320px;
}

.dashboard-left-column .chart-card:last-child,
.dashboard-center-column .chart-card:last-child,
.dashboard-right-column .chart-card:last-child {
  min-height: 280px;
}

.chart-shell-doughnut {
  height: 280px !important;
  min-height: 280px !important;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.chart-shell-bar {
  height: 240px !important;
  min-height: 240px !important;
  position: relative;
}

/* Asegurar que los canvas sean visibles */
.chart-shell canvas {
  display: block !important;
  max-width: 100%;
  max-height: 100%;
}

/* Stats grid actualizado */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.stat-card {
  padding: 1.3rem 1.4rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--panel);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.stat-card .muted {
  font-size: 0.82rem;
  color: var(--muted);
}

.stat-icon {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-muted);
  color: var(--primary);
}

.stat-card.highlight .stat-icon {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.stat-card strong {
  display: block;
  font-size: 2.1rem;
  margin: 0.5rem 0 0.2rem;
  line-height: 1.2;
}

.stat-card.highlight {
  background: linear-gradient(135deg, var(--primary), #239154);
  color: #fff;
  border: none;
}

.stat-card.highlight .muted {
  color: rgba(255, 255, 255, 0.85);
}

/* Iconos de stats con colores específicos */
.stat-card .stat-icon.green {
  background: rgba(31, 122, 69, 0.12);
  color: var(--primary);
}

.stat-card .stat-icon.blue {
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
}

.stat-card .stat-icon.orange {
  background: rgba(249, 115, 22, 0.12);
  color: #f97316;
}

.stat-card .stat-icon.purple {
  background: rgba(139, 92, 246, 0.12);
  color: #8b5cf6;
}

.dashboard-grid {
  grid-template-columns: 1.25fr 1fr 1fr;
}

.panel-wide {
  grid-row: span 2;
}

.activity-card,
.chart-card,
.reminder-card,
.compact-card {
  min-height: 100%;
}

.card {
  padding: 1.2rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 1rem;
}

.panel-head h3 {
  margin: 0;
}

.tiny-tag {
  font-size: 0.75rem;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 0.32rem 0.55rem;
  border-radius: 999px;
  font-weight: 700;
}

.reminder-copy {
  display: grid;
  gap: 0.8rem;
}

.chart-shell {
  position: relative;
  height: 320px;
  min-height: 320px;
}

.chart-shell canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.stack-list {
  display: grid;
  gap: 0.75rem;
}

.list-item,
.category-item,
.movement-item,
.product-card {
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1rem;
  background: var(--panel-strong);
}

.activity-item,
.alert-item,
.report-tile {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
}

/* Alertas rapidas con fondo beige */
#lowStockListDashboard .alert-item {
  background: linear-gradient(180deg, #faf8f3, #f5f2eb);
  border: 1px solid #e8e4d9;
}

#lowStockListDashboard .alert-item .item-icon {
  background: rgba(216, 155, 24, 0.18);
  color: #b8860b;
}

#lowStockListDashboard .alert-item strong {
  font-size: 0.95rem;
}

#lowStockListDashboard .alert-item .muted {
  font-size: 0.82rem;
  color: #888;
}

.item-icon {
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  border-radius: 12px;
  justify-content: center;
  background: var(--primary-soft);
  color: var(--primary);
}

.item-icon.is-warning {
  background: rgba(216, 155, 24, 0.15);
  color: #946907;
}

.item-icon.is-success {
  background: rgba(31, 122, 69, 0.12);
  color: var(--primary);
}

.item-icon.is-danger {
  background: rgba(217, 83, 79, 0.12);
  color: #a42623;
}

.elevated-card {
  box-shadow: 0 12px 24px rgba(32, 38, 29, 0.05);
}

.compact-head {
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.toolbar {
  margin-bottom: 1rem;
}

.actions-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.product-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 18px;
  background: #e8e8e4;
}

.product-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 0.95rem 0;
}

.product-stats div {
  padding: 0.8rem;
  border-radius: 16px;
  background: var(--panel-muted);
}

.product-stats span,
.movement-meta small {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.product-stats strong,
.movement-meta strong {
  display: block;
  margin-top: 0.2rem;
}

.product-meta,
.pill-row,
.actions-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.pill {
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  background: var(--primary-soft);
}

.pill.warn {
  background: rgba(216, 155, 24, 0.14);
  color: #946907;
}

.pill.danger {
  background: rgba(217, 83, 79, 0.12);
  color: #a42623;
}

.split-grid {
  grid-template-columns: 380px 1fr;
}

.single-grid {
  display: grid;
  grid-template-columns: 1fr;
}

.form-card,
.list-card,
.report-card {
  background: rgba(255, 255, 255, 0.94);
}

.category-meta {
  margin-bottom: 0.9rem;
}

.color-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.75);
}

.movement-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
}

.movement-meta strong,
.movement-meta small {
  gap: 0.35rem;
}

.movement-meta small i,
.movement-meta strong i {
  width: 0.9rem;
  height: 0.9rem;
}

.report-tile {
  background: linear-gradient(180deg, #ffffff, #f6f7f2);
}

.reports-grid {
  grid-template-columns: repeat(2, 1fr);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.settings-card {
  background: rgba(255, 255, 255, 0.94);
}

.settings-summary-card {
  background: linear-gradient(180deg, #ffffff, #f5f7f1);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-soft);
}

.toggle-row span {
  margin: 0;
}

.toggle-row input {
  width: 20px;
  height: 20px;
}

.report-summary {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

/* Nuevo diseño de reportes */
.reports-intro {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(247, 248, 245, 0.9));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.reports-top-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.report-summary-card,
.report-alerts-card,
.report-explorer-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
}

.report-metrics {
  display: grid;
  gap: 0.75rem;
}

.metric-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: linear-gradient(180deg, #fafafa, #f5f6f2);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.metric-icon {
  width: 2.5rem;
  height: 2.5rem;
  min-width: 2.5rem;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.metric-icon.green {
  background: rgba(31, 122, 69, 0.12);
  color: var(--primary);
}

.metric-icon.blue {
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
}

.metric-icon.orange {
  background: rgba(249, 115, 22, 0.12);
  color: #f97316;
}

.metric-content strong {
  display: block;
  font-size: 1.5rem;
  line-height: 1.2;
}

.metric-content .muted {
  font-size: 0.85rem;
}

.report-alerts-card .panel-head {
  align-items: center;
}

.report-explorer-card {
  padding: 1.25rem;
}

.report-filters {
  display: grid;
  grid-template-columns: 1.5fr auto auto auto auto;
  gap: 0.75rem;
  margin-bottom: 1rem;
  align-items: center;
}

.report-filters select,
.report-filters input {
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  font-size: 0.9rem;
}

.report-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
}

.report-tab {
  padding: 0.55rem 1rem;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.report-tab:hover {
  background: var(--panel-muted);
  color: var(--text);
}

.report-tab.active {
  background: var(--primary);
  color: #fff;
}

.report-table-container {
  margin-bottom: 1rem;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  display: none;
}

.report-table.active {
  display: table;
}

.report-table thead th {
  padding: 0.85rem 1rem;
  text-align: left;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
}

.report-table tbody td {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.report-table tbody tr:hover {
  background: var(--panel-muted);
}

.report-table tbody tr:last-child td {
  border-bottom: none;
}

.report-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.report-page-info {
  font-size: 0.85rem;
  color: var(--muted);
}

.btn.soft {
  background: var(--panel-muted);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.55rem 0.85rem;
  font-size: 0.85rem;
}

.btn.soft:hover {
  background: var(--border);
}

/* Estado pills en reportes */
.report-table .status-pill {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.report-table .status-pill.ok {
  background: rgba(31, 122, 69, 0.12);
  color: var(--primary);
}

.report-table .status-pill.bajo {
  background: rgba(249, 115, 22, 0.12);
  color: #f97316;
}

.report-table .status-pill.agotado {
  background: rgba(217, 83, 79, 0.12);
  color: #a42623;
}

/* Status pills globales */
.status-pill {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-pill.ok {
  background: rgba(31, 122, 69, 0.12);
  color: var(--primary);
}

.status-pill.bajo {
  background: rgba(249, 115, 22, 0.12);
  color: #f97316;
}

.status-pill.agotado {
  background: rgba(217, 83, 79, 0.12);
  color: #a42623;
}

/* Alertas en reportes */
.report-alerts-card .alert-item {
  background: linear-gradient(180deg, #fffef8, #faf8f0);
  border: 1px solid #f0e9d9;
}

.report-alerts-card .alert-item .item-icon {
  background: rgba(249, 115, 22, 0.15);
  color: #f97316;
}

.report-alerts-card .alert-item strong {
  font-size: 0.95rem;
  display: block;
}

.report-alerts-card .alert-item .muted {
  font-size: 0.82rem;
  color: #888;
}

.modal {
  border: none;
  padding: 0;
  background: transparent;
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.modal[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-card {
  width: min(760px, calc(100% - 2rem));
  margin: 0;
  padding: 0;
  background: var(--panel-strong);
  border-radius: 26px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
  position: relative;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-card .panel-head {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-card .panel-head h3 {
  margin: 0;
  font-size: 1.25rem;
}

.modal-card-content {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal-card .form-grid {
  padding: 1.25rem;
}

.modal-card .btn {
  margin: 1.25rem;
  flex-shrink: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.span-2 {
  grid-column: span 2;
}

.icon-btn {
  border: none;
  background: var(--panel-muted);
  width: 38px;
  height: 38px;
  border-radius: 12px;
  cursor: pointer;
}

.qr-card,
.category-modal-card,
.movement-modal-card,
.confirm-modal-card {
  width: min(560px, calc(100% - 2rem));
}

.scanner-card {
  width: min(560px, calc(100% - 2rem));
}

.scanner-card .modal-card-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#qrReader {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.confirm-actions {
  justify-content: flex-end;
  margin-top: 1rem;
}

.qr-image {
  width: min(320px, 100%);
  display: block;
  margin: 0 auto 1rem;
}

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

  .panel-wide {
    grid-column: span 2;
    grid-row: auto;
  }

  .reports-top-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1080px) {

  .split-grid,
  .reports-grid,
  .settings-grid,
  .login-shell,
  .app-layout,
  .stats-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .reports-top-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .panel-wide {
    grid-column: auto;
  }

  .report-filters {
    grid-template-columns: 1fr 1fr;
  }

  /* Toolbars en una fila con scroll si es necesario */
  .products-toolbar,
  .categories-toolbar,
  .movements-toolbar,
  .users-toolbar,
  .suppliers-toolbar {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
  }

  .categories-toolbar input[type="text"] {
    flex: 1 1 150px;
    min-width: 150px;
  }

  .movements-toolbar input[type="text"] {
    flex: 1 1 150px;
    min-width: 150px;
  }

  .users-toolbar input[type="search"] {
    flex: 1 1 150px;
    min-width: 150px;
  }

  .suppliers-toolbar input[type="search"] {
    flex: 1 1 150px;
    min-width: 150px;
  }
}

@media (max-width: 720px) {
  .app-frame {
    padding: 0;
  }

  .app-layout {
    min-height: 100vh;
    border-radius: 0;
  }

  .content-shell {
    padding: 1rem;
  }

  .report-filters {
    grid-template-columns: 1fr;
  }

  .report-tabs {
    flex-wrap: wrap;
  }

  .report-pagination {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }
}

.topbar,
.page-heading,
.section-intro {
  flex-direction: column;
  align-items: stretch;
}

.hero-actions>* {
  flex: auto;
  width: 100%;
}

.form-grid {
  grid-template-columns: 1fr;
}

.product-stats {
  grid-template-columns: 1fr;
}

.movement-meta {
  flex-direction: column;
  align-items: flex-start;
}

.chart-shell {
  height: 260px;
  min-height: 260px;
}

.span-2 {
  grid-column: auto;
}

.movements-toolbar {
  grid-template-columns: 1fr;
}

.movements-toolbar input,
.movements-toolbar select,
.movements-toolbar .btn {
  width: 100%;
}

.movements-toolbar input[type="text"] {
  min-width: auto;
}

.categories-toolbar {
  display: flex !important;
  flex-direction: row !important;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.categories-toolbar input,
.categories-toolbar select,
.categories-toolbar .btn {
  width: auto !important;
  min-width: fit-content;
}

.categories-toolbar input[type="text"] {
  flex: 1 1 200px;
  min-width: 200px;
}

.users-toolbar {
  display: flex !important;
  flex-direction: row !important;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.users-toolbar input,
.users-toolbar select {
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  font-size: 0.88rem;
  white-space: nowrap;
  width: auto !important;
}

.users-toolbar input[type="search"] {
  flex: 1 1 200px;
  min-width: 180px;
}

.users-toolbar select {
  cursor: pointer;
  min-width: 140px;
}

.users-toolbar .btn {
  cursor: pointer;
  transition: all 0.15s ease;
}

.users-toolbar .btn:hover {
  background: var(--panel-muted);
}

.users-toolbar .btn.primary {
  background: linear-gradient(135deg, var(--primary), #2f9a5b) !important;
  color: #fff !important;
  border: none !important;
  box-shadow: 0 10px 22px rgba(31, 122, 69, 0.18);
}

.users-toolbar .btn.primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), #1f7a45) !important;
  transform: translateY(-1px);
}

.suppliers-toolbar {
  display: flex !important;
  flex-direction: row !important;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.suppliers-toolbar input,
.suppliers-toolbar select {
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  font-size: 0.88rem;
  white-space: nowrap;
  width: auto !important;
}

.suppliers-toolbar input[type="search"] {
  flex: 1 1 200px;
  min-width: 180px;
}

.suppliers-toolbar select {
  cursor: pointer;
  min-width: 140px;
}

.suppliers-toolbar .btn {
  cursor: pointer;
  transition: all 0.15s ease;
}

.suppliers-toolbar .btn:hover {
  background: var(--panel-muted);
}

.suppliers-toolbar .btn.primary {
  background: linear-gradient(135deg, var(--primary), #2f9a5b) !important;
  color: #fff !important;
  border: none !important;
  box-shadow: 0 10px 22px rgba(31, 122, 69, 0.18);
}

.suppliers-toolbar .btn.primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), #1f7a45) !important;
  transform: translateY(-1px);
}

.categories-toolbar input[type="text"] {
  min-width: auto;
}

.products-toolbar {
  display: flex !important;
  flex-direction: row !important;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.products-toolbar input,
.products-toolbar select,
.products-toolbar .btn {
  width: auto !important;
  min-width: fit-content;
}

.products-toolbar input[type="search"] {
  flex: 1 1 200px;
  min-width: 200px;
}

/* Table styles for movements */
.table-container {
  overflow-x: auto;
}

.movements-toolbar {
  display: flex !important;
  flex-direction: row !important;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.movements-toolbar input,
.movements-toolbar select,
.movements-toolbar .btn {
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  font-size: 0.88rem;
  white-space: nowrap;
  width: auto !important;
}

.movements-toolbar input[type="text"] {
  flex: 1 1 200px;
  min-width: 180px;
}

.movements-toolbar input[type="date"] {
  min-width: 130px;
}

.movements-toolbar select {
  cursor: pointer;
}

.movements-toolbar .btn {
  cursor: pointer;
  transition: all 0.15s ease;
}

.movements-toolbar .btn:hover {
  background: var(--panel-muted);
}

.movements-toolbar .btn.primary {
  background: linear-gradient(135deg, var(--primary), #2f9a5b) !important;
  color: #fff !important;
  border: none !important;
  box-shadow: 0 10px 22px rgba(31, 122, 69, 0.18);
}

.movements-toolbar .btn.primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), #1f7a45) !important;
  transform: translateY(-1px);
}

.categories-toolbar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}

.categories-toolbar input,
.categories-toolbar select,
.categories-toolbar .btn {
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  font-size: 0.88rem;
  white-space: nowrap;
}

.categories-toolbar input[type="text"] {
  min-width: 180px;
}

.categories-toolbar select {
  cursor: pointer;
  min-width: 150px;
}

.categories-toolbar .btn {
  cursor: pointer;
  transition: all 0.15s ease;
}

.categories-toolbar .btn:hover {
  background: var(--panel-muted);
}

.categories-toolbar .btn.primary {
  background: linear-gradient(135deg, var(--primary), #2f9a5b) !important;
  color: #fff !important;
  border: none !important;
  box-shadow: 0 10px 22px rgba(31, 122, 69, 0.18);
}

.categories-toolbar .btn.primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), #1f7a45) !important;
  transform: translateY(-1px);
}

.products-toolbar {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0.75rem;
}

.products-toolbar input,
.products-toolbar select,
.products-toolbar .btn {
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  font-size: 0.88rem;
  white-space: nowrap;
}

.products-toolbar input[type="search"] {
  min-width: 180px;
}

.products-toolbar select {
  cursor: pointer;
  min-width: 140px;
}

.products-toolbar .btn {
  cursor: pointer;
  transition: all 0.15s ease;
}

.products-toolbar .btn:hover {
  background: var(--panel-muted);
}

.products-toolbar .btn.primary {
  background: linear-gradient(135deg, var(--primary), #2f9a5b);
  color: #fff;
  border: none;
  box-shadow: 0 10px 22px rgba(31, 122, 69, 0.18);
}

.products-toolbar .btn.primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), #239154);
}

.data-table .pill-ok {
  background: rgba(31, 122, 69, 0.12);
  color: var(--primary);
}

.data-table .pill-bajo {
  background: rgba(216, 155, 24, 0.15);
  color: #946907;
}

.data-table .pill-agotado,
.data-table .pill-danger {
  background: rgba(217, 83, 79, 0.12);
  color: #a42623;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.data-table thead {
  background: var(--panel-muted);
}

.data-table th,
.data-table td {
  padding: 0.85rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
}

.data-table tbody tr {
  transition: background 0.15s ease;
}

.data-table tbody tr:hover {
  background: var(--panel-muted);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table td small {
  color: var(--muted);
  font-size: 0.82rem;
}

.data-table .pill {
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  text-transform: lowercase;
}

.data-table .pill-entrada {
  background: rgba(31, 122, 69, 0.12);
  color: var(--primary);
}

.data-table .pill-salida {
  background: rgba(217, 83, 79, 0.12);
  color: #a42623;
}

/* Tabla de usuarios */
#usersTable th:nth-child(1),
#usersTable td:nth-child(1) {
  width: 35%;
}

#usersTable th:nth-child(2),
#usersTable td:nth-child(2) {
  width: 20%;
}

#usersTable th:nth-child(3),
#usersTable td:nth-child(3) {
  width: 15%;
}

#usersTable th:nth-child(4),
#usersTable td:nth-child(4) {
  width: 15%;
}

#usersTable th:nth-child(5),
#usersTable td:nth-child(5) {
  width: 15%;
}

#usersTable .actions-row {
  display: flex;
  gap: 0.5rem;
}

#usersTable .btn.action-btn.soft {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

#usersTable .btn.action-btn.soft:hover {
  background: var(--panel-muted);
  transform: translateY(-1px);
}

#usersTable .btn.action-btn.soft i {
  width: 0.95rem;
  height: 0.95rem;
}

/* Tabla de proveedores */
#suppliersTable th:nth-child(1),
#suppliersTable td:nth-child(1) {
  width: 25%;
}

#suppliersTable th:nth-child(2),
#suppliersTable td:nth-child(2) {
  width: 25%;
}

#suppliersTable th:nth-child(3),
#suppliersTable td:nth-child(3) {
  width: 15%;
}

#suppliersTable th:nth-child(4),
#suppliersTable td:nth-child(4) {
  width: 15%;
}

#suppliersTable th:nth-child(5),
#suppliersTable td:nth-child(5) {
  width: 10%;
}

#suppliersTable th:nth-child(6),
#suppliersTable td:nth-child(6) {
  width: 10%;
}

#suppliersTable .actions-row {
  display: flex;
  gap: 0.5rem;
}

#suppliersTable .btn.action-btn.soft {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

#suppliersTable .btn.action-btn.soft:hover {
  background: var(--panel-muted);
  transform: translateY(-1px);
}

#suppliersTable .btn.action-btn.soft i {
  width: 0.95rem;
  height: 0.95rem;
}

/* ==================== KARDEX ==================== */

.kardex-modal-card {
  max-width: 1200px;
  width: 95%;
}

.kardex-modal-card .modal-card-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.kardex-header {
  padding: 1rem;
  background: linear-gradient(180deg, rgba(31, 122, 69, 0.08), rgba(31, 122, 69, 0.02));
  border: 1px solid var(--border);
  border-radius: 16px;
  flex-shrink: 0;
}

.kardex-filters {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.kardex-table-container {
  overflow-y: auto;
  max-height: 400px;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.kardex-product-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.kardex-product-info .product-main {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.kardex-product-info .product-stats {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.kardex-product-info .stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-width: 100px;
}

.kardex-product-info .stat-box .muted {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kardex-filters {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.kardex-filters input[type="date"] {
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  font-size: 0.9rem;
}

.kardex-table-container {
  max-height: 500px;
  overflow-y: auto;
}

.kardex-table thead th {
  position: sticky;
  top: 0;
  background: var(--panel-muted);
  z-index: 1;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.85rem 0.75rem;
}

.kardex-table tbody td {
  padding: 0.75rem;
  vertical-align: middle;
}

.kardex-table tbody tr.warning {
  background: rgba(249, 115, 22, 0.08);
}

.kardex-table tbody tr.danger {
  background: rgba(217, 83, 79, 0.08);
}

.kardex-table tbody tr:hover {
  background: var(--panel-muted);
}

.kardex-table .status-pill {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
}

.kardex-table .status-pill.ok {
  background: rgba(31, 122, 69, 0.12);
  color: var(--primary);
}

.kardex-table .status-pill.bajo {
  background: rgba(249, 115, 22, 0.12);
  color: #f97316;
}

.kardex-table .status-pill.muted {
  background: var(--panel-muted);
  color: var(--muted);
}

/* ==================== ANÁLISIS ABC ==================== */

.abc-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1rem;
  padding: 1rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(247, 248, 245, 0.9));
  border: 1px solid var(--border);
  border-radius: 16px;
}

.abc-summary-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.abc-summary-card.class-a {
  border-left: 4px solid #ef4444;
}

.abc-summary-card.class-b {
  border-left: 4px solid #f59e0b;
}

.abc-summary-card.class-c {
  border-left: 4px solid #22c55e;
}

.abc-class-badge {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.3rem;
  color: #fff;
}

.class-a .abc-class-badge {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.class-b .abc-class-badge {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.class-c .abc-class-badge {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

.abc-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  flex: 1;
}

.abc-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.abc-stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.abc-stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}

.class-a .abc-stat-value {
  color: #ef4444;
}

.class-b .abc-stat-value {
  color: #f59e0b;
}

.class-c .abc-stat-value {
  color: #22c55e;
}

@media (max-width: 768px) {
  .abc-summary {
    grid-template-columns: 1fr;
  }

  .abc-summary-card {
    flex-direction: column;
    text-align: center;
  }
}

/* ==================== BODEGAS ==================== */

.warehouses-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

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

.warehouse-stock-list {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.warehouse-stock-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--panel-muted);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.warehouse-stock-item .warehouse-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.warehouse-stock-item .warehouse-stock {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.warehouse-stock-item .stock-value {
  font-weight: 700;
  font-size: 1.1rem;
}

.warehouse-stock-item .stock-low {
  color: #f97316;
}

.warehouse-stock-item .stock-ok {
  color: var(--primary);
}

/* ==================== VALORIZACION ==================== */

/* ==================== CODIGO QR ==================== */

.qr-card {
  max-width: 500px;
}

.qr-card .modal-card-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.qr-product-info {
  padding: 1rem;
  background: linear-gradient(180deg, rgba(31, 122, 69, 0.08), rgba(31, 122, 69, 0.02));
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: center;
  flex-shrink: 0;
}

.qr-product-info strong {
  display: block;
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.qr-product-info .muted {
  font-size: 0.9rem;
}

.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 12px;
  flex-shrink: 0;
}

.qr-image {
  width: 280px;
  height: 280px;
  object-fit: contain;
  image-rendering: pixelated;
}

.qr-hint {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.qr-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.qr-actions .btn {
  flex: 1;
  max-width: 200px;
}

@media print {
  .qr-actions {
    display: none;
  }

  .qr-card {
    box-shadow: none;
  }
}

/* ==================== VALORIZACION ==================== */

.valorizacion-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, rgba(31, 122, 69, 0.08), rgba(31, 122, 69, 0.02));
  border: 1px solid var(--border);
  border-radius: 16px;
  margin: 1rem 0;
}

.valorizacion-total {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.valorizacion-method-selector {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.valorizacion-method-selector select {
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .valorizacion-summary {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .valorizacion-method-selector {
    flex-direction: column;
    width: 100%;
  }

  .valorizacion-method-selector select,
  .valorizacion-method-selector button {
    width: 100%;
  }
}

/* Alertas de vencimiento */
.products-table .expiring-soon {
  background: rgba(249, 115, 22, 0.08);
}

.products-table .expired {
  background: rgba(217, 83, 79, 0.08);
}

.action-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.action-btn:hover {
  background: var(--panel-muted);
  border-color: var(--primary);
}

.action-btn i {
  width: 0.9rem;
  height: 0.9rem;
  stroke-width: 2;
}


/* ============================================
   RESPONSIVE DESIGN - COMPLETE
   ============================================
   Breakpoints:
   - Desktop: > 1200px (default)
   - Laptop: 1024px - 1199px
   - Tablet: 768px - 1023px
   - Mobile: < 767px
   ============================================ */

/* ==================== LAPTOP (1024px - 1199px) ==================== */
@media (max-width: 1199px) {

  /* Dashboard - 2 columnas */
  .dashboard-grid-new {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-center-column {
    grid-column: span 2;
  }

  /* Stats grid - 2x4 */
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
  }

  .stat-card strong {
    font-size: 1.75rem;
  }

  /* Settings grid - 2 columnas */
  .settings-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Warehouses grid - 1 columna */
  .warehouses-grid {
    grid-template-columns: 1fr;
  }
}

/* ==================== TABLET (768px - 1023px) ==================== */
@media (max-width: 1024px) {

  /* Layout principal */
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    width: 100%;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: auto;
    max-height: 50vh;
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
    padding: 0;
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  }

  .sidebar-main {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
  }

  .brand {
    flex-direction: row;
    align-items: center;
  }

  .nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
  }

  .nav-link {
    flex: 1;
    min-width: 140px;
  }

  .sidebar-secondary {
    display: flex;
    gap: 0.5rem;
    width: 100%;
  }

  .sidebar-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
  }

  /* Dashboard - 1 columna */
  .dashboard-grid-new {
    grid-template-columns: 1fr;
  }

  .dashboard-left-column,
  .dashboard-center-column,
  .dashboard-right-column {
    grid-column: auto;
  }

  /* Stats grid - 2x2 */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Reportes */
  .report-filters {
    grid-template-columns: 1fr 1fr;
  }

  .report-tabs {
    flex-wrap: wrap;
  }

  .report-tab {
    flex: 1;
    min-width: 100px;
  }

  /* Tablas */
  .table-container {
    overflow-x: auto;
  }

  .data-table {
    min-width: 800px;
  }

  /* Formularios */
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  /* Toolbar de productos */
  .products-toolbar,
  .users-toolbar,
  .suppliers-toolbar {
    grid-template-columns: 1fr 1fr;
  }
}

/* ==================== MOBILE (< 768px) ==================== */
@media (max-width: 767px) {

  /* Layout principal */
  .app-frame {
    padding: 0;
  }

  .app-layout {
    min-height: 100vh;
    border-radius: 0;
  }

  .sidebar {
    padding: 0.75rem;
  }

  .brand {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
  }

  .brand-mark {
    margin: 0 auto;
  }

  .sidebar-group-label {
    width: 100%;
    margin-top: 0.75rem;
  }

  .nav-links {
    flex-direction: column;
    width: 100%;
  }

  .nav-link {
    width: 100%;
    min-width: auto;
  }

  .sidebar-secondary {
    flex-direction: column;
    width: 100%;
  }

  .side-chip {
    width: 100%;
    justify-content: center;
  }

  .sidebar-footer {
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    border-top: 1px solid var(--border);
  }

  .profile-mini {
    flex-direction: column;
    text-align: center;
  }

  /* Contenido */
  .content-shell {
    padding: 0.75rem;
  }

  .page-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .page-heading h1 {
    font-size: 1.5rem;
  }

  /* Stats grid - 2 columnas pequeñas */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .stat-card {
    padding: 0.75rem;
  }

  .stat-card strong {
    font-size: 1.25rem;
  }

  .stat-icon {
    width: 1.75rem;
    height: 1.75rem;
  }

  /* Dashboard */
  .dashboard-grid-new {
    gap: 0.75rem;
  }

  .chart-shell {
    height: 240px !important;
    min-height: 240px !important;
  }

  .chart-shell-doughnut {
    height: 220px !important;
    min-height: 220px !important;
  }

  /* Reportes */
  .report-filters {
    grid-template-columns: 1fr;
  }

  .report-tabs {
    flex-direction: column;
    gap: 0.25rem;
  }

  .report-tab {
    width: 100%;
    min-width: auto;
  }

  .report-summary {
    grid-template-columns: 1fr;
  }

  .abc-summary {
    grid-template-columns: 1fr;
  }

  .valorizacion-summary {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }

  .valorizacion-method-selector {
    flex-direction: column;
    width: 100%;
  }

  .valorizacion-method-selector select,
  .valorizacion-method-selector button {
    width: 100%;
  }

  /* Toolbars - todos en una fila con wrap */
  .products-toolbar,
  .categories-toolbar,
  .movements-toolbar,
  .users-toolbar,
  .suppliers-toolbar {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .products-toolbar input[type="search"] {
    flex: 1 1 150px;
    min-width: 150px;
  }

  .categories-toolbar input[type="text"] {
    flex: 1 1 150px;
    min-width: 150px;
  }

  .movements-toolbar input[type="text"] {
    flex: 1 1 150px;
    min-width: 150px;
  }

  .users-toolbar input[type="search"] {
    flex: 1 1 150px;
    min-width: 150px;
  }

  .suppliers-toolbar input[type="search"] {
    flex: 1 1 150px;
    min-width: 150px;
  }

  /* Tablas - scroll horizontal */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .data-table {
    min-width: 700px;
  }

  /* Tarjetas de sección */
  .section-intro {
    flex-direction: column;
    align-items: stretch;
  }

  .section-intro .hero-actions {
    width: 100%;
  }

  .hero-actions {
    flex-direction: column;
    width: 100%;
  }

  .hero-actions .btn {
    width: 100%;
  }

  /* Formularios */
  .form-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: 1;
  }

  .toggle-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .toggle-row input {
    width: 100%;
  }

  /* Modales */
  .modal-card {
    width: 95%;
    max-width: none;
    max-height: 95vh;
    overflow-y: auto;
  }

  .modal-card .panel-head {
    flex-direction: column;
    gap: 0.75rem;
  }

  .modal-card .panel-head h3 {
    font-size: 1.1rem;
  }

  /* Botones de acción en tablas */
  .actions-row {
    flex-direction: column;
    gap: 0.25rem;
  }

  .actions-row .btn {
    width: 100%;
    justify-content: center;
  }

  /* QR */
  .qr-image {
    width: 220px;
    height: 220px;
  }

  .qr-actions {
    flex-direction: column;
  }

  .qr-actions .btn {
    width: 100%;
    max-width: none;
  }

  /* Etiquetas de impresión */
  .buttons-container {
    bottom: 10px;
    flex-direction: column;
  }

  .print-btn,
  .close-btn,
  .download-btn {
    width: 100%;
    justify-content: center;
  }

  /* Toast notifications */
  .toast-container {
    width: calc(100% - 2rem);
    right: 1rem;
  }

  .toast {
    grid-template-columns: 1fr;
  }

  .toast-icon {
    display: none;
  }

  /* Mini metrics */
  .mini-metrics {
    flex-direction: column;
  }

  .mini-metrics div {
    width: 100%;
  }

  /* Activity items */
  .activity-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .activity-item .item-icon {
    margin-bottom: 0.5rem;
  }

  /* Alert items */
  .alert-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .alert-item .item-icon {
    margin-bottom: 0.5rem;
  }
}

/* ==================== MOBILE PEQUEÑO (< 480px) ==================== */
@media (max-width: 479px) {

  /* Stats grid - 1 columna */
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-card.highlight {
    grid-column: 1;
  }

  /* Dashboard charts más pequeños */
  .chart-shell {
    height: 200px !important;
    min-height: 200px !important;
  }

  .chart-shell-doughnut {
    height: 180px !important;
    min-height: 180px !important;
  }

  /* Tablas */
  .data-table {
    min-width: 600px;
    font-size: 0.85rem;
  }

  /* QR más pequeño */
  .qr-image {
    width: 180px;
    height: 180px;
  }

  /* Fuentes más pequeñas */
  .page-heading h1 {
    font-size: 1.25rem;
  }

  .section-intro h3 {
    font-size: 1rem;
  }
}

/* ==================== PRINT STYLES ==================== */
@media print {

  .sidebar,
  .topbar,
  .btn,
  .actions-row,
  .toast-container,
  .modal,
  .no-print {
    display: none !important;
  }

  .app-layout {
    display: block;
  }

  .content-shell {
    padding: 0;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* ==================== UTILIDADES RESPONSIVE ==================== */

/* Botón hamburguesa para móvil */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1001;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  border: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(31, 122, 69, 0.3);
}

.mobile-menu-btn i {
  width: 24px;
  height: 24px;
}

/* Overlay para el sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
}

/* Sidebar en móvil */
@media (max-width: 767px) {
  .mobile-menu-btn {
    display: flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    z-index: 1000;
    transition: left 0.3s ease;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
  }

  .sidebar.active {
    left: 0;
  }

  .sidebar-overlay {
    display: block;
  }

  .content-shell {
    padding-top: 4rem;
  }

  /* Ajustar botón hamburguesa cuando sidebar está abierto */
  .mobile-menu-btn {
    background: var(--primary);
    transition: background 0.3s ease;
  }

  .sidebar.active~.mobile-menu-btn {
    background: var(--primary-dark);
  }
}

/* Mostrar solo en móvil */
@media (max-width: 767px) {
  .hide-mobile {
    display: none !important;
  }
}

/* Ocultar en tablet */
@media (min-width: 768px) and (max-width: 1023px) {
  .hide-tablet {
    display: none !important;
  }
}

/* Ocultar en desktop */
@media (min-width: 1024px) {
  .hide-desktop {
    display: none !important;
  }
}

/* Mostrar solo en móvil */
@media (max-width: 767px) {
  .show-mobile {
    display: block !important;
  }
}

/* Mostrar solo en tablet */
@media (min-width: 768px) and (max-width: 1023px) {
  .show-tablet {
    display: block !important;
  }
}

/* Mostrar solo en desktop */
@media (min-width: 1024px) {
  .show-desktop {
    display: block !important;
  }
}

/* ==================== PERFIL DE USUARIO ==================== */

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.profile-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
}

.profile-card:nth-child(3) {
  grid-column: span 2;
}

.profile-avatar-section {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: linear-gradient(135deg, rgba(31, 122, 69, 0.08), rgba(31, 122, 69, 0.02));
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 1rem;
}

.avatar-large {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #2f9a5b);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
}

.avatar-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.avatar-info strong {
  font-size: 1.1rem;
  color: var(--text);
}

.avatar-info .muted {
  font-size: 0.9rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-row label {
  margin: 0;
}

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

  .profile-card:nth-child(3) {
    grid-column: auto;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .profile-avatar-section {
    flex-direction: column;
    text-align: center;
  }
}