: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: 10000;
  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,
.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;
}

/* Notification Badge */
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #dc2626;
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* Notification Panel */
.notif-panel {
  position: fixed;
  top: 0;
  right: -400px;
  width: 380px;
  max-width: 90vw;
  height: 100vh;
  background: var(--panel);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
}

.notif-panel.open {
  right: 0;
}

.notif-panel-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.notif-panel-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.notif-panel-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--muted);
}

.notif-panel-close:hover {
  color: var(--text);
}

.notif-panel-actions {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
}

.notif-panel-actions button {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--muted);
}

.notif-panel-actions button:hover {
  background: var(--panel-muted);
  color: var(--text);
}

.notif-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.notif-item {
  padding: 0.875rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: background 0.15s;
  border-left: 3px solid transparent;
}

.notif-item:hover {
  background: var(--bg-soft);
}

.notif-item.unread {
  background: var(--primary-soft);
  border-left-color: var(--primary);
}

.notif-item.severity-critical {
  border-left-color: #dc2626;
}

.notif-item.severity-warning {
  border-left-color: #d89b18;
}

.notif-item-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 0.25rem;
}

.notif-item-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.notif-item-time {
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
}

.notif-item-message {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

.notif-empty {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
}

.notif-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  z-index: 999;
  display: none;
}

.notif-overlay.active {
  display: block;
}

.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;
}

/* Centrar formulario cuando solo hay un panel */
.login-shell.login-single-panel {
  max-width: 480px;
  grid-template-columns: 1fr;
  justify-items: center;
}

.login-shell.login-single-panel .login-panel {
  min-height: auto;
  width: 100%;
}

.login-panel {
  min-height: 78vh;
  border-radius: 32px;
  padding: 2rem;
  box-shadow: var(--shadow);
}

/* Logo y nombre del negocio en login */
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.login-brand .brand-mark {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 1.8rem;
  font-weight: 800;
  flex-shrink: 0;
}

.login-brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.login-brand strong {
  display: block;
  font-size: 1.1rem;
  color: var(--text);
}

.login-brand span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.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);
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.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);
}

/* ============================================================
   METRICAS DE VENTAS EN TIEMPO REAL
   ============================================================ */

.sales-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

@media (max-width: 1200px) {
  .sales-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .sales-metrics-grid {
    grid-template-columns: 1fr;
  }
}

.metric-card {
  padding: 1.25rem;
  transition: all 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.metric-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.metric-header .metric-icon {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.05);
}

.metric-header .metric-icon.green {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}

.metric-header .metric-icon.blue {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.metric-header .metric-icon.purple {
  background: rgba(168, 85, 247, 0.1);
  color: #a855f7;
}

.metric-header .metric-icon.orange {
  background: rgba(249, 115, 22, 0.1);
  color: #f97316;
}

.metric-header .metric-icon i {
  width: 1.25rem;
  height: 1.25rem;
}

.metric-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
  line-height: 1;
}

.metric-details {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.875rem;
}

.metric-details span:first-child {
  color: var(--muted);
}

.trend-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  width: fit-content;
}

.trend-indicator i {
  width: 0.75rem;
  height: 0.75rem;
}

.trend-indicator.trend-up {
  color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
}

.trend-indicator.trend-down {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.trend-indicator.trend-stable {
  color: #6b7280;
  background: rgba(107, 114, 128, 0.1);
}

/* ============================================================
   BOTONES DE REPORTES ADICIONALES
   ============================================================ */

.report-action-btn {
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  border: 2px solid transparent !important;
  user-select: none !important;
}

.report-action-btn:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
  border-color: var(--primary) !important;
  background: rgba(0, 0, 0, 0.02) !important;
}

.report-action-btn:active {
  transform: translateY(0) !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

/* ============================================================
   DASHBOARD GRID
   ============================================================ */

.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;
}

.chart-shell-line {
  height: 260px !important;
  min-height: 260px !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);
  color: var(--primary-dark);
}

.pill.warning {
  background: rgba(216, 155, 24, 0.18);
  color: #946907;
}

.pill.danger {
  background: rgba(217, 83, 79, 0.18);
  color: #a42623;
  font-weight: 600;
}

.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,
.data-table .pill-normal {
  background: rgba(31, 122, 69, 0.15);
  color: var(--primary);
}

.data-table .pill-bajo,
.data-table .pill-warning,
.data-table .pill-critico {
  background: rgba(216, 155, 24, 0.18);
  color: #946907;
}

.data-table .pill-agotado,
.data-table .pill-danger {
  background: rgba(217, 83, 79, 0.18);
  color: #a42623;
  font-weight: 600;
}

.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;
}

/* Imagen del producto en la tabla */
.product-table-image {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
}

.product-table-image:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.product-table-image-placeholder {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-muted);
  border-radius: 8px;
  color: var(--muted);
}

.product-table-image-placeholder i {
  width: 24px;
  height: 24px;
}

/* Image Preview Popup (pequeño, flotante junto a imagen) */
.image-preview-popup {
  position: fixed;
  z-index: 10000;
  display: none;
  background: transparent;
  pointer-events: none;
}

.image-preview-popup.visible {
  display: block;
  animation: popupFadeIn 0.15s ease;
}

.image-preview-popup img {
  max-width: 400px;
  max-height: 400px;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  background: #fff;
  padding: 6px;
  display: block;
}

.image-preview-popup .image-preview-name {
  text-align: center;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 8px;
  background: rgba(0, 0, 0, 0.75);
  padding: 5px 12px;
  border-radius: 6px;
  white-space: nowrap;
}

@keyframes popupFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes zoomIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.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 (min-width: 768px) and (max-width: 1024px) {

  /* Mostrar botón hamburguesa en tablet con margen */
  .mobile-menu-btn {
    display: flex !important;
    top: 10px !important;
    left: 10px !important;
  }

  /* Sidebar en tablet - a la izquierda como en móvil */
  .sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    z-index: 1001;
    transition: left 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    border-radius: 0;
    margin: 0;
    padding: 1rem;
    display: flex;
    flex-direction: column;
  }

  .sidebar.active {
    left: 0;
  }

  /* Overlay para tablet */
  .sidebar-overlay {
    display: block;
  }

  /* Layout principal - una columna cuando sidebar está cerrado */
  .app-layout {
    grid-template-columns: 1fr;
  }

  /* Optimizar espacio en tablet */
  .sidebar-main {
    flex: 1;
    gap: 0.75rem;
    overflow-y: auto;
  }

  /* Brand más compacto */
  .brand {
    gap: 0.6rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
  }

  .brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 1.2rem;
  }

  .brand strong {
    font-size: 0.95rem;
    line-height: 1.2;
  }

  .brand span {
    font-size: 0.78rem;
  }

  /* Labels más compactos */
  .sidebar-group-label {
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
    font-size: 0.68rem;
  }

  /* Nav links más compactos */
  .nav-links {
    gap: 0.35rem;
  }

  .nav-link {
    padding: 0.75rem 0.85rem;
    border-radius: 12px;
    font-size: 0.9rem;
  }

  .nav-link .nav-label i {
    width: 1.1rem;
    height: 1.1rem;
  }

  /* Sidebar secondary más compacto */
  .sidebar-secondary {
    gap: 0.4rem;
    margin-top: 0.5rem;
  }

  .side-chip {
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    font-size: 0.85rem;
  }

  /* Footer más compacto */
  .sidebar-footer {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    gap: 0.5rem;
  }

  .sidebar-footer .profile-mini {
    gap: 0.5rem;
  }

  .sidebar-footer .avatar {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }

  .sidebar-footer .btn.ghost {
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
  }

  /* Contenido con padding para el botón hamburguesa */
  .content-shell {
    padding-top: 4rem;
    overflow-x: hidden;
  }

  /* Asegurar que las tarjetas no se desborden */
  .card,
  .list-card {
    overflow: hidden;
    max-width: 100%;
  }

  /* Toolbars - distribución en múltiples filas sin scroll */
  .products-toolbar,
  .categories-toolbar,
  .movements-toolbar,
  .users-toolbar,
  .suppliers-toolbar {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 0.5rem;
    overflow-x: visible;
  }

  .products-toolbar input,
  .products-toolbar select,
  .products-toolbar .btn,
  .categories-toolbar input,
  .categories-toolbar select,
  .categories-toolbar .btn,
  .movements-toolbar input,
  .movements-toolbar select,
  .movements-toolbar .btn,
  .users-toolbar input,
  .users-toolbar select,
  .users-toolbar .btn,
  .suppliers-toolbar input,
  .suppliers-toolbar select,
  .suppliers-toolbar .btn {
    flex: 1 1 calc(50% - 0.25rem);
    min-width: 0;
    width: auto;
  }

  /* Búsqueda ocupa todo el ancho */
  .products-toolbar input[type="search"],
  .users-toolbar input[type="search"],
  .suppliers-toolbar input[type="search"] {
    flex: 1 1 100%;
  }

  .categories-toolbar input[type="text"] {
    flex: 1 1 100%;
  }

  .movements-toolbar input[type="text"] {
    flex: 1 1 100%;
  }

  /* Botones principales ocupan todo el ancho */
  .products-toolbar .btn.primary,
  .categories-toolbar .btn.primary,
  .movements-toolbar .btn.primary,
  .users-toolbar .btn.primary,
  .suppliers-toolbar .btn.primary {
    flex: 1 1 100%;
  }

  /* Fechas en movimientos - 2 por fila */
  .movements-toolbar input[type="date"] {
    flex: 1 1 calc(50% - 0.25rem);
  }

  /* Tablas - scroll horizontal */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
  }

  .data-table {
    min-width: 700px;
    width: max-content;
  }

  .view.active {
    padding: 0.5rem;
  }

  /* Dashboard - 1 columna full width */
  #dashboardView {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow-x: hidden !important;
  }

  .dashboard-grid-new {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.5rem !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
  }

  .dashboard-left-column,
  .dashboard-center-column,
  .dashboard-right-column {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.5rem !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* FORZAR TODOS LOS CARDS A 100% EN MOVIL */
  .dashboard-left-column>*,
  .dashboard-center-column>*,
  .dashboard-right-column>* {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    margin: 0 !important;
    padding: 1.2rem !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
  }

  /* 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;
    overflow-x: hidden;
  }

  /* Asegurar que las tarjetas no se desborden */
  .card,
  .list-card {
    overflow: hidden;
    max-width: 100%;
  }

  .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%;
  }

  /* Settings grid - 1 columna en móvil */
  .settings-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .settings-card {
    padding: 1rem;
  }

  .settings-card h3 {
    font-size: 1.1rem;
  }

  .settings-card label {
    font-size: 0.85rem;
  }

  .settings-card input,
  .settings-card select {
    font-size: 0.9rem;
    padding: 0.7rem 0.85rem;
  }

  /* Tabla de reportes - scroll horizontal en móvil */
  .report-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
  }

  .report-table {
    min-width: 600px;
    width: max-content;
  }

  /* Toolbars - distribución en múltiples filas sin scroll */
  .products-toolbar,
  .categories-toolbar,
  .movements-toolbar,
  .users-toolbar,
  .suppliers-toolbar {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 0.5rem;
    overflow-x: visible;
  }

  .products-toolbar input,
  .products-toolbar select,
  .products-toolbar .btn,
  .categories-toolbar input,
  .categories-toolbar select,
  .categories-toolbar .btn,
  .movements-toolbar input,
  .movements-toolbar select,
  .movements-toolbar .btn,
  .users-toolbar input,
  .users-toolbar select,
  .users-toolbar .btn,
  .suppliers-toolbar input,
  .suppliers-toolbar select,
  .suppliers-toolbar .btn {
    flex: 1 1 calc(50% - 0.25rem);
    min-width: 0;
    width: auto;
  }

  /* Búsqueda ocupa todo el ancho */
  .products-toolbar input[type="search"],
  .users-toolbar input[type="search"],
  .suppliers-toolbar input[type="search"] {
    flex: 1 1 100%;
  }

  .categories-toolbar input[type="text"] {
    flex: 1 1 100%;
  }

  .movements-toolbar input[type="text"] {
    flex: 1 1 100%;
  }

  /* Botones principales ocupan todo el ancho */
  .products-toolbar .btn.primary,
  .categories-toolbar .btn.primary,
  .movements-toolbar .btn.primary,
  .users-toolbar .btn.primary,
  .suppliers-toolbar .btn.primary {
    flex: 1 1 100%;
  }

  /* Fechas en movimientos - 2 por fila */
  .movements-toolbar input[type="date"] {
    flex: 1 1 calc(50% - 0.25rem);
  }

  /* Tablas - scroll horizontal */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
  }

  .data-table {
    min-width: 700px;
    width: max-content;
  }

  /* 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: 90vw !important;
    max-width: 90vw !important;
    min-width: 85vw !important;
    max-height: 90vh;
    overflow-y: auto;
    margin: 0 auto;
  }

  /* Modal de confirmación (logout, delete, etc.) */
  .confirm-modal-card {
    width: 90vw !important;
    max-width: 90vw !important;
    min-width: 85vw !important;
  }

  .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 - cards full width */
  .dashboard-grid-new {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 0.5rem !important;
    width: 100% !important;
  }

  .dashboard-left-column,
  .dashboard-center-column,
  .dashboard-right-column {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 0.5rem !important;
    width: 100% !important;
  }

  .dashboard-grid-new .card,
  .dashboard-grid-new .chart-card,
  .dashboard-grid-new .compact-card {
    width: 100% !important;
    max-width: 100% !important;
    grid-column: 1 / -1 !important;
  }

  /* 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: 5px;
  left: 5px;
  margin-top: 5px;
  margin-left: 5px;
  z-index: 1002;
  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);
  cursor: pointer;
}

.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;
  pointer-events: none;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Sidebar en móvil */
@media (max-width: 767px) {
  .mobile-menu-btn {
    display: flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    height: 100dvh;
    /* Dynamic viewport height para móviles */
    max-height: 100vh;
    z-index: 1001;
    transition: left 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    border-radius: 0;
    margin: 0;
    padding: 1rem;
    display: flex;
    flex-direction: column;
  }

  .sidebar.active {
    left: 0;
  }

  /* Optimizar espacio en móvil */
  .sidebar-main {
    flex: 1;
    gap: 0.75rem;
    overflow-y: auto;
  }

  /* Brand más compacto */
  .brand {
    gap: 0.6rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
  }

  .brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 1.2rem;
  }

  .brand strong {
    font-size: 0.95rem;
    line-height: 1.2;
  }

  .brand span {
    font-size: 0.78rem;
  }

  /* Labels más compactos */
  .sidebar-group-label {
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
    font-size: 0.68rem;
  }

  /* Nav links más compactos */
  .nav-links {
    gap: 0.35rem;
  }

  .nav-link {
    padding: 0.75rem 0.85rem;
    border-radius: 12px;
    font-size: 0.9rem;
  }

  .nav-link .nav-label i {
    width: 1.1rem;
    height: 1.1rem;
  }

  /* Sidebar secondary más compacto */
  .sidebar-secondary {
    gap: 0.4rem;
    margin-top: 0.5rem;
  }

  .side-chip {
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    font-size: 0.85rem;
  }

  /* Footer más compacto */
  .sidebar-footer {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    gap: 0.5rem;
  }

  .sidebar-footer .profile-mini {
    gap: 0.5rem;
  }

  .sidebar-footer .avatar {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }

  .sidebar-footer .btn.ghost {
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
  }

  .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;
  }
}

/* ==================== VENTAS ==================== */

.sales-toolbar {
  display: flex !important;
  flex-direction: row !important;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.sales-toolbar input,
.sales-toolbar select,
.sales-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;
}

.sales-toolbar input[type="search"] {
  flex: 1 1 200px;
  min-width: 180px;
}

.sales-toolbar input[type="date"] {
  min-width: 130px;
}

.sales-toolbar .btn.primary {
  background: linear-gradient(135deg, var(--primary), #2f9a5b) !important;
  color: #fff !important;
  box-shadow: 0 10px 22px rgba(31, 122, 69, 0.18);
  font-weight: 700;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
}

.sales-toolbar .btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(31, 122, 69, 0.25);
}

.sales-toolbar .btn.primary i,
.sales-toolbar .btn.primary span {
  display: inline-flex !important;
  align-items: center !important;
}

/* ==================== POS - PUNTO DE VENTA ==================== */

.pos-container {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 1rem;
  height: calc(100vh - 140px);
  min-height: 600px;
}

/* Panel de productos (izquierda) */
.pos-products-panel {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
}

.pos-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel-muted);
}

.pos-search-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg);
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 0.75rem;
}

.pos-search-box i {
  width: 20px;
  height: 20px;
  color: var(--muted);
  flex-shrink: 0;
}

.pos-search-box input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.95rem;
  outline: none;
}

.pos-search-box select {
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  min-width: 70px;
}

.pos-page-size-box {
  margin-bottom: 0.75rem;
}

.pos-page-size-box select {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  cursor: pointer;
}

.pos-search-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.pos-search-row .pos-search-box {
  flex: 1;
  margin-bottom: 0;
}

.pos-search-row select {
  padding: 0.6rem 0.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  width: 70px;
}

.pos-search-row .pos-search-box {
  padding: 0.6rem 1rem;
}

.pos-category-filters {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.pos-cat-btn {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.pos-cat-btn:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.pos-cat-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Grid de productos */
.pos-products-grid {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  align-content: start;
}

.pos-product-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
}

.pos-product-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(31, 122, 69, 0.15);
  transform: translateY(-2px);
}

.pos-product-card:active {
  transform: scale(0.98);
}

.pos-product-image {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--panel-muted);
}

.pos-product-image-placeholder {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-muted);
  border-radius: 8px;
  color: var(--muted);
}

.pos-product-image-placeholder i {
  width: 32px;
  height: 32px;
}

.pos-product-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pos-product-price {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}

.pos-product-stock {
  font-size: 0.75rem;
  color: var(--muted);
}

/* Panel de ticket (derecha) */
.pos-ticket-panel {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.pos-ticket-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel-muted);
}

.pos-ticket-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.pos-ticket-title i {
  width: 20px;
  height: 20px;
  color: var(--primary);
}

/* Selector de cliente */
.pos-customer-select {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.pos-customer-select select {
  flex: 1;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 0.9rem;
  outline: none;
}

.pos-customer-new-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pos-customer-new-btn:hover {
  background: var(--primary-soft);
}

.pos-customer-new-btn i {
  width: 18px;
  height: 18px;
}

.pos-customer-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.pos-customer-badge i {
  width: 16px;
  height: 16px;
}

/* Items del ticket */
.pos-ticket-items {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1rem;
}

/* POS Alert Modal */
.pos-alert-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.pos-alert-card {
  background: #fff;
  border-radius: 16px;
  padding: 2rem;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
  text-align: center;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.pos-alert-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #e8f5e9;
  color: #2e7d32;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.pos-alert-icon i {
  width: 40px;
  height: 40px;
}

.pos-alert-card h3 {
  margin: 0 0 1.5rem;
  font-size: 1.3rem;
  color: #1a1a1a;
}

.pos-alert-details {
  background: #f5f5f5;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.pos-alert-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  font-size: 0.95rem;
  color: #666;
}

.pos-alert-row strong {
  color: #1a1a1a;
}

.pos-alert-total {
  border-top: 2px solid #ddd;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  font-size: 1.1rem;
}

.pos-alert-total strong {
  color: #2e7d32;
  font-size: 1.3rem;
}

.pos-alert-actions {
  display: flex;
  gap: 0.75rem;
}

.pos-alert-btn {
  flex: 1;
  padding: 0.9rem 1rem;
  border-radius: 10px;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.pos-alert-btn i {
  width: 18px;
  height: 18px;
}

.pos-alert-btn-secondary {
  background: #f0f0f0;
  color: #666;
}

.pos-alert-btn-secondary:hover {
  background: #e0e0e0;
}

.pos-alert-btn-primary {
  background: #2e7d32;
  color: #fff;
}

.pos-alert-btn-primary:hover {
  background: #1b5e20;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(46, 125, 50, 0.3);
}

.pos-ticket-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--muted);
  padding: 2rem;
  text-align: center;
}

.pos-ticket-empty i {
  width: 48px;
  height: 48px;
  opacity: 0.3;
}

.pos-ticket-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.pos-ticket-item:last-child {
  border-bottom: none;
}

.pos-item-info {
  flex: 1;
  min-width: 0;
}

.pos-item-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pos-item-price {
  font-size: 0.8rem;
  color: var(--muted);
}

.pos-item-qty-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pos-item-qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pos-item-qty-btn:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.pos-item-qty-btn.remove:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.pos-item-qty-btn i {
  width: 16px;
  height: 16px;
}

.pos-item-qty {
  font-weight: 700;
  font-size: 0.95rem;
  min-width: 24px;
  text-align: center;
}

.pos-item-total {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  min-width: 70px;
  text-align: right;
}

/* Footer del ticket */
.pos-ticket-footer {
  border-top: 1px solid var(--border);
  padding: 1rem;
  background: var(--panel-muted);
}

.pos-ticket-summary {
  margin-bottom: 1rem;
}

.pos-summary-row {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.pos-summary-total {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  padding-top: 0.75rem;
  margin-top: 0.5rem;
  border-top: 2px solid var(--border);
}

.pos-pay-btn {
  width: 100%;
  padding: 1rem;
  border-radius: 12px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.15s ease;
  margin-bottom: 0.5rem;
}

.pos-pay-btn:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(31, 122, 69, 0.3);
}

.pos-pay-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pos-pay-btn span:last-child {
  font-size: 1.2rem;
}

.pos-clear-btn {
  width: 100%;
  padding: 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.15s ease;
}

.pos-clear-btn:hover {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger);
}

.pos-clear-btn i {
  width: 18px;
  height: 18px;
}

/* ==================== Modal de venta ==================== */
.sale-modal-card {
  max-width: 1100px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
}

.sale-form-grid {
  display: grid;
  gap: 1.5rem;
}

.sale-section {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
}

.sale-section h4 {
  margin: 0 0 0.75rem 0;
  font-size: 0.95rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sale-items-container {
  display: grid;
  gap: 0.5rem;
}

.sale-items-list {
  display: grid;
  gap: 0.5rem;
}

.sale-item-row {
  display: grid;
  grid-template-columns: 2fr 80px 80px 100px 40px;
  gap: 0.5rem;
  align-items: center;
  background: var(--panel);
  padding: 0.5rem;
  border-radius: 8px;
}

.sale-product-select,
.sale-qty-input,
.sale-discount-input {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
}

.sale-item-total {
  text-align: right;
  font-weight: 600;
  font-size: 0.9rem;
}

.sale-totals {
  display: grid;
  gap: 0.5rem;
  background: var(--panel);
  padding: 1rem;
  border-radius: 8px;
}

.sale-total-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.sale-total-row:last-child {
  border-bottom: none;
}

.sale-total-final {
  font-size: 1.2rem;
  color: var(--primary);
  padding-top: 0.75rem;
  border-top: 2px solid var(--primary);
}

/* Detalle de venta */
.sale-detail-card {
  max-width: 700px;
  width: 90%;
}

.sale-detail-info {
  display: grid;
  gap: 1rem;
}

.sale-detail-header {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  background: var(--bg-soft);
  padding: 1rem;
  border-radius: 8px;
}

.sale-detail-totals {
  background: var(--bg-soft);
  padding: 1rem;
  border-radius: 8px;
  margin-top: 1rem;
}

/* Responsive ventas */
@media (max-width: 767px) {
  .sales-toolbar {
    flex-wrap: wrap !important;
  }

  .sales-toolbar input,
  .sales-toolbar select,
  .sales-toolbar .btn {
    flex: 1 1 calc(50% - 0.25rem);
    min-width: 0;
  }

  .sales-toolbar input[type="search"] {
    flex: 1 1 100%;
  }

  .sales-toolbar .btn.primary {
    flex: 1 1 100%;
  }

  .sale-item-row {
    grid-template-columns: 1fr;
  }

  .sale-modal-card {
    width: 95%;
    max-height: 95vh;
  }

  .sale-detail-header {
    grid-template-columns: 1fr;
  }
}

/* ==================== REPORTES DE VENTAS ==================== */

.sales-report-card {
  background: linear-gradient(180deg, #ffffff, #f8faf9);
}

.metric-box {
  background: var(--bg-soft);
  padding: 1rem;
  border-radius: 12px;
  text-align: center;
  border: 1px solid var(--border);
}

.metric-box .muted {
  font-size: 0.85rem;
  display: block;
  margin-bottom: 0.25rem;
}

/* Responsive para reportes de ventas */
@media (max-width: 767px) {
  .sales-report-summary {
    grid-template-columns: 1fr !important;
  }

  .sales-report-filters {
    flex-direction: column !important;
  }

  .sales-report-filters select,
  .sales-report-filters input {
    width: 100% !important;
    min-width: 100% !important;
  }
}

/* ==================== CLIENTES TOOLBAR ==================== */

.customers-toolbar {
  display: flex !important;
  flex-direction: row !important;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}

.customers-toolbar input {
  flex: 1;
  min-width: 200px;
}

.customers-toolbar .btn {
  white-space: nowrap;
}

/* Responsive para toolbar de clientes */
@media (max-width: 767px) {
  .customers-toolbar {
    flex-wrap: wrap !important;
  }

  .customers-toolbar input {
    flex: 1 1 100%;
  }

  .customers-toolbar .btn {
    flex: 1 1 100%;
  }
}

/* Banner de Error en Formularios */
.form-error-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  margin: 0 1.5rem 1rem 1.5rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 12px;
  color: #991b1b;
  font-size: 0.9rem;
  font-weight: 500;
}

.form-error-banner i {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.form-error-banner span {
  flex: 1;
}

.form-error-banner .icon-btn {
  color: #991b1b;
  background: transparent;
  padding: 0.25rem;
}

.form-error-banner .icon-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* POS Responsive - Móvil */
@media (max-width: 767px) {
  .pos-container {
    grid-template-columns: 1fr;
    height: auto;
    min-height: auto;
  }

  .pos-products-panel {
    max-height: 50vh;
  }

  .pos-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
  }

  .pos-product-image,
  .pos-product-image-placeholder {
    width: 60px;
    height: 60px;
  }

  .pos-ticket-panel {
    max-height: 50vh;
  }
}

/* ============================================================
   ESTILOS DE COMPRAS - ÓRDENES DE COMPRA
   ============================================================ */

/* Toolbar de compras */
.purchases-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.purchases-toolbar input[type="search"],
.purchases-toolbar input[type="date"],
.purchases-toolbar select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  flex: 1;
  min-width: 150px;
}

.purchases-toolbar input[type="search"] {
  min-width: 250px;
  flex: 2;
}

/* Botones no crecen */
.purchases-toolbar .btn {
  flex: 0 0 auto;
}

/* Modal de compra */
.purchase-modal-card,
.receive-modal-card {
  max-width: 900px;
  width: 90%;
}

.purchase-form-grid {
  display: grid;
  gap: 1.5rem;
}

.purchase-section h4 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  color: var(--text);
  font-size: 1rem;
}

.purchase-section h4 i {
  color: var(--primary);
}

.purchase-items-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.purchase-totals {
  background: var(--bg-soft);
  padding: 1rem;
  border-radius: 0.5rem;
}

.purchase-total-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.purchase-total-row:last-child {
  border-bottom: none;
}

.purchase-total-final {
  font-size: 1.25rem;
  color: var(--primary);
  padding-top: 0.75rem;
  margin-top: 0.5rem;
  border-top: 2px solid var(--primary);
}

/* Detalle de compra */
.purchase-detail-card {
  max-width: 800px;
  width: 90%;
}

.purchase-detail-header {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.detail-row .label {
  font-weight: 600;
  color: var(--muted);
}

/* Modal de recepción */
.receive-modal-card {
  max-width: 600px;
  width: 90%;
}

.receive-items-list {
  max-height: 400px;
  overflow-y: auto;
  padding: 1rem 0;
}

.receive-item-row {
  padding: 0.75rem;
  background: var(--bg-soft);
  border-radius: 0.5rem;
}

.receive-item-row input[type="number"] {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
}

/* Items de compra - mismo estilo que sale-item-row */
.purchase-item-row {
  display: grid;
  grid-template-columns: 2fr 80px 100px 100px auto;
  gap: 0.5rem;
  align-items: center;
  background: var(--panel);
  padding: 0.5rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.purchase-item-row .btn.action-btn.danger {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #dc2626;
}

.purchase-item-row .btn.action-btn.danger:hover {
  background: #fecaca;
  border-color: #f87171;
}

.purchase-item-row .btn.action-btn.danger i {
  width: 18px !important;
  height: 18px !important;
  display: block;
}

.purchase-item-row input[type="text"],
.purchase-item-row input[type="number"],
.purchase-item-row select {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
}

/* Responsive para compras */
@media (max-width: 768px) {
  .purchases-toolbar {
    flex-direction: column;
  }

  .purchases-toolbar input[type="search"],
  .purchases-toolbar input[type="date"],
  .purchases-toolbar select {
    width: 100%;
  }

  .purchase-modal-card,
  .receive-modal-card,
  .purchase-detail-card {
    width: 95%;
  }
}

/* ============================================================
   ESTILOS DE DEVOLUCIONES - NOTAS DE CRÉDITO Y DÉBITO
   ============================================================ */

/* Toolbar de devoluciones */
.returns-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.returns-toolbar input[type="search"],
.returns-toolbar input[type="date"],
.returns-toolbar select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  flex: 1;
  min-width: 150px;
}

.returns-toolbar input[type="search"] {
  min-width: 250px;
  flex: 2;
}

.returns-toolbar .btn {
  flex: 0 0 auto;
}

/* Modal de devolución */
.return-modal-card,
.return-detail-card {
  max-width: 800px;
  width: 90%;
}

.return-form-grid {
  display: grid;
  gap: 1.5rem;
}

.return-section h4 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  color: var(--text);
  font-size: 1rem;
}

.return-section h4 i {
  color: var(--primary);
}

.return-items-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.return-item-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem;
  background: var(--panel);
  border-radius: 8px;
}

.return-item-row input[type="number"],
.return-item-row select {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
}

.return-totals {
  background: var(--bg-soft);
  padding: 1rem;
  border-radius: 0.5rem;
}

.return-total-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.return-total-row:last-child {
  border-bottom: none;
}

.return-total-final {
  font-size: 1.25rem;
  color: var(--primary);
  padding-top: 0.75rem;
  margin-top: 0.5rem;
  border-top: 2px solid var(--primary);
}

/* Detalle de devolución */
.return-detail-header {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

/* ============================================================
   ESTILOS DE LOTES - ALERTAS Y TRAZABILIDAD
   ============================================================ */

/* Tabs de lotes */
.batch-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.5rem;
}

.batch-tab-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--bg-soft);
  border: none;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.batch-tab-btn:hover {
  background: var(--border);
}

.batch-tab-btn.active {
  background: var(--primary);
  color: white;
}

.batch-tab-btn i {
  width: 16px;
  height: 16px;
}

.batch-tab-content {
  display: none;
}

.batch-tab-content.active {
  display: block;
}

/* Filtros de lotes */
.batch-filters {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.batch-filters select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  font-size: 0.875rem;
}

/* Resumen de lotes */
.batch-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.batch-summary-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--bg-soft);
  border-radius: 0.75rem;
}

.batch-summary-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.batch-summary-card h3 {
  font-size: 1.75rem;
  margin-bottom: 0.25rem;
}

/* Modal de trazabilidad */
.batch-traceability-card {
  max-width: 900px;
  width: 90%;
}

.batch-detail-header {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.batch-quantities {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}

.batch-qty-card {
  padding: 1rem;
  border-radius: 0.5rem;
  text-align: center;
}

.batch-qty-card>div:first-child {
  font-size: 1.5rem;
  font-weight: bold;
}

.batch-qty-card .muted {
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* Responsive para devoluciones */
@media (max-width: 768px) {
  .returns-toolbar {
    flex-direction: column;
  }

  .returns-toolbar input[type="search"],
  .returns-toolbar input[type="date"],
  .returns-toolbar select {
    width: 100%;
  }

  .return-modal-card,
  .return-detail-card {
    width: 95%;
  }

  .batch-tabs {
    flex-wrap: wrap;
  }

  .batch-tab-btn {
    flex: 1;
    min-width: 120px;
  }

  .batch-filters {
    flex-direction: column;
  }

  .batch-summary-grid {
    grid-template-columns: 1fr;
  }

  .batch-quantities {
    grid-template-columns: repeat(2, 1fr);
  }
}

}

/* ============================================================
   PRECIOS - Gestion de precios y descuentos
   ============================================================ */

/* Tabs de navegacion interna */
.pricing-tabs {
  display: flex;
  gap: 4px;
  padding: 0 0 0 0;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
}

.pricing-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}

.pricing-tab:hover {
  color: var(--text);
  background: var(--bg-soft);
}

.pricing-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: transparent;
}

.pricing-tab i {
  width: 16px;
  height: 16px;
}

/* Contenido de tabs */
.pricing-tab-content {
  display: none;
}

.pricing-tab-content.active {
  display: block;
}

/* Bulk update form */
#bulkUpdateForm {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 0;
}

#bulkUpdateForm label span:first-child {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 4px;
  color: var(--text);
}

#bulkUpdateForm input,
#bulkUpdateForm select,
#bulkUpdateForm textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  background: var(--panel);
}

#bulkUpdateForm input:focus,
#bulkUpdateForm select:focus,
#bulkUpdateForm textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.bulk-preview {
  background: var(--primary-soft);
  border: 1px solid var(--primary);
  border-radius: 10px;
  padding: 12px 16px;
  margin-top: 8px;
}

.bulk-preview p {
  margin: 0;
  color: var(--primary-dark);
  font-size: 0.9rem;
}

#bulkCount {
  font-size: 1.2rem;
  font-weight: 700;
}

/* Badge de tipo de cambio */
.badge.soft {
  background: var(--bg-soft);
  color: var(--text);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  text-transform: capitalize;
}

.badge.success {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.badge.muted {
  background: var(--bg-soft);
  color: var(--muted);
}

/* Checkbox label */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

/* Row actions */
.row-actions {
  display: flex;
  gap: 4px;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
}

.btn-icon:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.btn-icon.danger:hover {
  background: #fde8e8;
  color: var(--danger);
}

.btn-icon i {
  width: 16px;
  height: 16px;
}

/* Responsive pricing tabs */
@media (max-width: 768px) {
  .pricing-tabs {
    flex-wrap: wrap;
    gap: 2px;
  }

  .pricing-tab {
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  .pricing-tab span {
    display: none;
  }

  .pricing-tab i {
    width: 18px;
    height: 18px;
  }
}

/* Two column layout */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 600px) {
  .two-col {
    grid-template-columns: 1fr;
  }
}

/* Small muted text helper */
small.muted {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
}

/* Toolbar alignment */
.users-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.users-toolbar input[type="search"],
.users-toolbar select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
  background: var(--panel);
}

.users-toolbar input[type="search"] {
  min-width: 200px;
}

/* Text center helper */
.text-center {
  text-align: center;
  padding: 12px;
}

/* Ensure tables scroll on mobile */
.table-container {
  overflow-x: auto;
}

/* ==================== TABS COMPONENT ==================== */
.tab-container {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  background: var(--bg-soft);
  padding: 0;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-main);
}

.tab-btn:hover {
  color: var(--primary);
  background: rgba(31, 122, 69, 0.05);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--panel);
  font-weight: 600;
}

.tab-btn i {
  width: 18px;
  height: 18px;
}

.tab-content {
  display: none;
  padding: 1.5rem;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .tab-btn {
    padding: 0.875rem 1rem;
    font-size: 0.85rem;
  }

  .tab-btn span {
    display: none;
  }

  .tab-btn i {
    width: 20px;
    height: 20px;
  }

  .tab-content {
    padding: 1rem;
  }
}

/* ==================== CURRENCY CONVERTER ==================== */
.converter-modern {
  max-width: 900px;
  margin: 0 auto;
}

.converter-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: var(--radius) var(--radius) 0 0;
  color: white;
}

.converter-icon-wrapper {
  width: 70px;
  height: 70px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.converter-icon-wrapper i {
  width: 36px;
  height: 36px;
}

.converter-title-group h3 {
  margin: 0 0 0.25rem 0;
  font-size: 1.75rem;
  font-weight: 700;
  color: white;
}

.converter-subtitle {
  margin: 0;
  font-size: 0.95rem;
  opacity: 0.9;
  color: rgba(255, 255, 255, 0.9);
}

.converter-body {
  padding: 2.5rem;
  background: var(--panel);
  border-radius: 0 0 var(--radius) var(--radius);
}

.converter-cards {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.5rem;
  align-items: end;
  margin-bottom: 2rem;
}

.converter-card {
  background: var(--bg-soft);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  transition: all 0.3s ease;
}

.converter-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 20px rgba(31, 122, 69, 0.1);
}

.converter-card.from-card {
  border-top: 4px solid #3b82f6;
}

.converter-card.to-card {
  border-top: 4px solid #10b981;
}

.converter-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.converter-label i {
  width: 18px;
  height: 18px;
}

.converter-amount-input,
.converter-result-input {
  width: 100%;
  padding: 1rem 1.25rem;
  font-size: 2rem;
  font-weight: 700;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  margin-bottom: 1rem;
  transition: all 0.2s ease;
}

.converter-amount-input {
  text-align: left;
}

.converter-amount-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(31, 122, 69, 0.1);
}

.converter-result-input {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  color: var(--primary);
  cursor: default;
}

.converter-select {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.converter-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(31, 122, 69, 0.1);
}

.converter-swap-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 2rem;
}

.converter-swap-btn {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border: 3px solid white;
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(31, 122, 69, 0.3);
}

.converter-swap-btn:hover {
  transform: rotate(180deg) scale(1.1);
  box-shadow: 0 6px 20px rgba(31, 122, 69, 0.4);
}

.converter-swap-btn i {
  width: 28px;
  height: 28px;
}

.converter-convert-btn {
  width: 100%;
  padding: 1.25rem;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 12px;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border: none;
  box-shadow: 0 4px 15px rgba(31, 122, 69, 0.3);
  transition: all 0.3s ease;
}

.converter-convert-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(31, 122, 69, 0.4);
}

.converter-convert-btn i {
  width: 22px;
  height: 22px;
}

.converter-info {
  display: flex;
  gap: 1rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-radius: 12px;
  border-left: 4px solid #f59e0b;
}

.converter-info-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background: #f59e0b;
  color: white;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.converter-info-icon i {
  width: 22px;
  height: 22px;
}

.converter-info-content {
  flex: 1;
}

.converter-info-content strong {
  display: block;
  margin-bottom: 0.5rem;
  color: #92400e;
  font-size: 1rem;
}

.converter-info-content p {
  margin: 0;
  color: #a16207;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Responsive */
@media (max-width: 768px) {
  .converter-cards {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .converter-swap-wrapper {
    padding: 0;
  }

  .converter-swap-btn {
    width: 50px;
    height: 50px;
  }

  .converter-amount-input,
  .converter-result-input {
    font-size: 1.5rem;
    padding: 0.875rem 1rem;
  }

  .converter-header {
    flex-direction: column;
    text-align: center;
    padding: 1.5rem;
  }

  .converter-body {
    padding: 1.5rem;
  }
}

/* Converter Result Details */
.converter-details {
  margin-top: 2rem;
  padding: 2rem;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 16px;
  border: 2px solid var(--border);
}

.converter-step {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  background: var(--panel);
  border-radius: 12px;
  border-left: 4px solid var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

.converter-step:hover {
  box-shadow: 0 4px 12px rgba(31, 122, 69, 0.1);
  transform: translateX(4px);
}

.converter-step:last-of-type {
  margin-bottom: 0;
}

.step-number {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.converter-step strong {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text);
  font-size: 1rem;
}

.converter-step .muted {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.converter-result-box {
  margin-top: 1.5rem;
  padding: 2rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 12px;
  text-align: center;
  color: white;
  box-shadow: 0 8px 24px rgba(31, 122, 69, 0.3);
  position: relative;
  overflow: hidden;
}

.converter-result-box::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% {
    transform: translate(-50%, -50%);
  }

  50% {
    transform: translate(50%, 50%);
  }

  100% {
    transform: translate(-50%, -50%);
  }
}

.result-amount {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  position: relative;
  z-index: 1;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.result-info {
  font-size: 1rem;
  opacity: 0.95;
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.15);
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  display: inline-block;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.converter-error {
  margin-top: 2rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  border-radius: 12px;
  border-left: 4px solid #ef4444;
  color: #991b1b;
  display: flex;
  gap: 1rem;
  align-items: center;
}

.converter-error i {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.converter-error p {
  margin: 0;
  font-weight: 600;
}

/* Responsive for converter result */
@media (max-width: 768px) {
  .converter-details {
    padding: 1.5rem;
  }

  .converter-step {
    flex-direction: column;
    gap: 0.75rem;
  }

  .result-amount {
    font-size: 2rem;
  }
}

/* ==================== SEND ORDER MODAL ==================== */
.send-order-modal .modal-card-content {
  text-align: center;
  padding: 2rem 1.5rem;
}

.send-order-icon-wrapper {
  width: 90px;
  height: 90px;
  margin: 0 auto 1.5rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(31, 122, 69, 0.3);
}

.send-order-icon-wrapper i {
  width: 48px;
  height: 48px;
  color: white;
}

.send-order-message {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.75rem 0;
  line-height: 1.5;
}

.send-order-hint {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.send-order-modal .confirm-actions {
  padding: 1.5rem;
  gap: 0.75rem;
}

.send-order-modal .confirm-actions .btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  font-weight: 600;
}

.send-order-modal .confirm-actions .btn i {
  width: 18px;
  height: 18px;
}

/* Responsive */
@media (max-width: 480px) {
  .send-order-modal .confirm-actions {
    flex-direction: column;
  }

  .send-order-icon-wrapper {
    width: 70px;
    height: 70px;
  }

  .send-order-icon-wrapper i {
    width: 36px;
    height: 36px;
  }
}

/* ==================== PERMISSIONS MODAL ==================== */
/* Note: Old permissions-* styles are deprecated. Use perm-* classes instead. */
.permissions-modal-card {
  max-width: 900px;
  width: 95%;
}

.permissions-modal-card .modal-card-content {
  padding: 0;
}

.permissions-search {
  position: relative;
  margin-bottom: 1.5rem;
}

.permissions-search>i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}

.permissions-search input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
  background: var(--bg-soft);
}

.permissions-search input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(31, 122, 69, 0.1);
}

.permissions-role-selector {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.permissions-role-selector label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  flex: 1;
}

.permissions-role-selector label>i {
  width: 18px;
  height: 18px;
  color: var(--primary);
  flex-shrink: 0;
}

.permissions-role-selector select {
  flex: 1;
  padding: 0.65rem 0.85rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  background: var(--panel);
  cursor: pointer;
}

.permissions-role-selector select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(31, 122, 69, 0.1);
}

.permissions-role-selector .btn-small {
  padding: 0.6rem 0.85rem;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.permissions-role-selector .btn-small i {
  width: 16px;
  height: 16px;
}

.permissions-table-wrapper {
  max-height: 500px;
  overflow-y: auto;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
}

.permissions-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
}

.permissions-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--primary);
  color: white;
}

.permissions-table thead th {
  padding: 1rem;
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--primary-dark);
}

.permissions-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: all 0.2s ease;
}

.permissions-table tbody tr:hover {
  background: var(--bg-soft);
}

.permissions-table tbody tr:last-child {
  border-bottom: none;
}

.permissions-table tbody td {
  padding: 0.875rem 1rem;
  vertical-align: middle;
}

.permissions-table tbody td:first-child {
  text-align: center;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.875rem;
}

.permissions-table tbody td:nth-child(2) {
  font-weight: 600;
  color: var(--text);
}

/* Toggle switches */
.permission-toggle {
  display: flex;
  justify-content: center;
  align-items: center;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
  left: 0;
  top: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: all 0.3s ease;
  border-radius: 26px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: all 0.3s ease;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked+.toggle-slider {
  background: linear-gradient(135deg, #1f7a45 0%, #176238 100%);
}

.toggle-switch input:checked+.toggle-slider:before {
  transform: translateX(22px);
}

.toggle-switch input:disabled {
  cursor: not-allowed;
}

.toggle-switch input:disabled+.toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

.toggle-switch:hover input:not(:disabled)+.toggle-slider {
  box-shadow: 0 0 0 4px rgba(31, 122, 69, 0.15);
}

.toggle-switch:hover input:checked:not(:disabled)+.toggle-slider {
  box-shadow: 0 0 0 4px rgba(31, 122, 69, 0.25);
}

/* Notice for admin */
.permissions-notice {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-left: 4px solid #f59e0b;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #92400e;
  font-size: 0.9rem;
}

.permissions-notice i {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: #f59e0b;
}

/* Save button */
.permissions-modal-card .confirm-actions {
  padding: 1.5rem;
  gap: 0.75rem;
}

.permissions-modal-card .confirm-actions .btn.danger {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #dc2626;
}

.permissions-modal-card .confirm-actions .btn.danger:hover {
  background: #fecaca;
  border-color: #f87171;
}

.permissions-modal-card .confirm-actions .btn.danger i {
  color: #dc2626;
}

/* Responsive */
@media (max-width: 768px) {
  .permissions-modal-card {
    width: 100%;
    max-width: none;
    margin: 0;
  }

  .permissions-table thead th {
    padding: 0.75rem 0.5rem;
    font-size: 0.75rem;
  }

  .permissions-table tbody td {
    padding: 0.75rem 0.5rem;
  }

  .toggle-switch {
    width: 42px;
    height: 21px;
  }

  .toggle-slider:before {
    height: 15px;
    width: 15px;
  }

  .toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(21px);
  }
}

/* ============================================
   PERMISSION MODAL STYLES (perm-* classes)
   ============================================ */

.perm-modal-card {
  max-width: 950px;
  width: 95%;
  background: linear-gradient(180deg, var(--panel-strong, #ffffff) 0%, #f8faf9 100%);
  border-radius: 24px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.perm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.75rem 2rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #ffffff 0%, #f8faf9 100%);
}

.perm-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.perm-icon-badge {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary) 0%, #146b3a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 12px rgba(31, 122, 69, 0.3);
}

.perm-icon-badge i {
  width: 24px;
  height: 24px;
}

.perm-title-group h3 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.perm-role-name {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}

.perm-close-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  background: white;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.perm-close-btn i {
  width: 20px;
  height: 20px;
  color: var(--muted);
}

.perm-close-btn:hover {
  background: var(--bg-soft);
  border-color: var(--muted);
  transform: scale(1.05);
}

.perm-body {
  padding: 1.75rem 2rem;
  overflow-y: auto;
  max-height: calc(90vh - 200px);
}

.perm-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.perm-select-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.perm-select-wrapper>i {
  width: 20px;
  height: 20px;
  color: var(--primary);
  flex-shrink: 0;
}

.perm-select-wrapper>span {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
}

.perm-select-wrapper select {
  flex: 1;
  padding: 0.7rem 1rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 0.875rem;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.perm-select-wrapper select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(31, 122, 69, 0.1);
}

.perm-search-wrapper {
  position: relative;
  margin-bottom: 1.25rem;
}

.perm-search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}

.perm-search-wrapper input {
  width: 100%;
  padding: 0.7rem 1rem 0.7rem 2.75rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 0.875rem;
  background: white;
  transition: all 0.2s ease;
}

.perm-search-wrapper input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(31, 122, 69, 0.1);
}

/* Table container */
.perm-table-container {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: white;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.perm-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.25rem;
  background: linear-gradient(135deg, #f8faf9 0%, #f0f4f2 100%);
  border-bottom: 1px solid var(--border);
}

.perm-table-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.perm-table-badge {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  background: var(--primary);
  color: white;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.perm-table-count {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

.perm-table-header-right {
  display: flex;
  align-items: center;
}

.perm-legend {
  display: flex;
  gap: 1.25rem;
}

.perm-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

.perm-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.perm-legend-dot--active {
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(31, 122, 69, 0.2);
}

.perm-legend-dot--inactive {
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
}

.perm-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

.perm-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(135deg, var(--primary) 0%, #1a7a44 100%);
  color: white;
}

.perm-table thead th {
  padding: 1.25rem 1.25rem;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--primary-dark);
}

.perm-col-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.perm-col-header i {
  width: 16px;
  height: 16px;
  opacity: 0.9;
}

.perm-col-header span {
  font-size: 0.75rem;
}

.perm-table tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: all 0.15s ease;
}

.perm-table tbody tr:hover {
  background: linear-gradient(90deg, #f8faf9 0%, #f0f7f4 100%);
}

.perm-table tbody tr:last-child {
  border-bottom: none;
}

.perm-table tbody td {
  padding: 0.875rem 1.25rem;
  vertical-align: middle;
  text-align: center;
}

.perm-table tbody td:first-child {
  text-align: center;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.8rem;
  background: #f8faf9;
  width: 50px;
}

.perm-table tbody td:nth-child(2) {
  font-weight: 600;
  color: var(--text);
  text-align: left;
  padding-left: 1.5rem;
}

.perm-table tbody td:nth-child(2)::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  background: var(--primary);
  border-radius: 50%;
  margin-right: 0.75rem;
  vertical-align: middle;
}

/* Centrar toggles en sus celdas */
.perm-table tbody td:nth-child(3),
.perm-table tbody td:nth-child(4),
.perm-table tbody td:nth-child(5),
.perm-table tbody td:nth-child(6) {
  padding: 0.75rem 0.5rem;
}

.perm-empty-msg {
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.perm-empty-msg i {
  width: 48px;
  height: 48px;
  color: #cbd5e1;
}

.perm-empty-msg span {
  font-weight: 500;
}

.perm-notice {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%);
  border-left: 4px solid #f59e0b;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #92400e;
  font-size: 0.875rem;
  font-weight: 500;
}

.perm-notice i {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: #f59e0b;
}

.perm-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--border);
  background: linear-gradient(135deg, #ffffff 0%, #f8faf9 100%);
}

.perm-footer-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Permission toggle styles */
.perm-table .permission-toggle {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #e2e8f0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 24px;
}

.toggle-slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  background-color: white;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.toggle-switch input:checked+.toggle-slider {
  background: linear-gradient(135deg, var(--primary) 0%, #1a7a44 100%);
  box-shadow: 0 2px 8px rgba(31, 122, 69, 0.3);
}

.toggle-switch input:checked+.toggle-slider::before {
  transform: translate(20px, -50%);
}

.toggle-switch input:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.toggle-switch input:disabled+.toggle-slider {
  cursor: not-allowed;
}

/* Responsive for perm modal */
@media (max-width: 768px) {
  .perm-modal-card {
    width: 100%;
    max-width: none;
    margin: 0;
    border-radius: 0;
  }

  .perm-header {
    padding: 1.5rem 1.5rem 1rem;
  }

  .perm-body {
    padding: 1.5rem;
  }

  .perm-footer {
    padding: 1.5rem;
    flex-direction: column;
    gap: 1rem;
  }

  .perm-footer-right {
    width: 100%;
    justify-content: flex-end;
  }

  .perm-controls-row {
    flex-direction: column;
    align-items: stretch;
  }

  .perm-select-wrapper {
    flex-direction: column;
    align-items: stretch;
  }

  .perm-table thead th {
    padding: 0.75rem 0.5rem;
    font-size: 0.7rem;
  }

  .perm-table tbody td {
    padding: 0.75rem 0.5rem;
  }

  .perm-col-header span {
    font-size: 0.65rem;
  }

  .perm-table-header {
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
  }
}

/* ============================================
   PHYSICAL COUNT MODULE STYLES
   ============================================ */

.count-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.count-card {
  background: var(--card-bg, #fff);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
}

.count-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.count-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.count-card .meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-draft {
  background: #fef3c7;
  color: #92400e;
}

.status-in_progress {
  background: #dbeafe;
  color: #1e40af;
}

.status-completed {
  background: #dcfce7;
  color: #166534;
}

.status-cancelled {
  background: #fee2e2;
  color: #991b1b;
}

.diff-positive {
  color: #166534;
  font-weight: 600;
}

.diff-negative {
  color: #dc2626;
  font-weight: 600;
}

.diff-zero {
  color: #16a34a;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--card-bg, #fff);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  text-align: center;
}

.stat-card .value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.stat-card .label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.actions-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.search-bar input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
  background: var(--bg-soft);
  transition: all 0.2s ease;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(31, 122, 69, 0.1);
}

.table-container {
  overflow-x: auto;
}

.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
}