:root {
  --bg: #f3f6fb;
  --focus-ring: 0 0 0 3px rgba(59,130,246,0.12);
  --focus-color: rgba(59,130,246,0.18);
  --surface: #ffffff;
  --surface-soft: #f8fbff;
  --surface-alt: #eef4ff;
  --text: #1f2a44;
  --muted: #6b778c;
  --primary: #2563eb;
  --primary-2: #4f46e5;
  --radius-button: 12px;
  --transition-fast: 160ms;
  --primary-soft: #e0e7ff;
  --accent-cyan: #06b6d4;
  --accent-pink: #ec4899;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --border: #e5eaf3;
  --shadow-sm: 0 6px 18px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 14px 36px rgba(15, 23, 42, 0.10);
  --shadow-card: 0 12px 30px rgba(15, 23, 42, 0.08);
  --radius-card: 20px;
  --radius-input: 14px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Skip link visible on keyboard focus */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: 2000;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
  width: auto;
  height: auto;
  padding: .45rem .7rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}

/* Accessible focus outlines for interactive controls */
button:focus-visible,
a:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.sidebar-link:focus-visible,
.sidebar-toggle:focus-visible,
.btn:focus-visible {
  outline: 3px solid var(--focus-color);
  outline-offset: 3px;
  border-radius: 8px;
}

body {
  font-family: "Inter", "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  line-height: 1.45;
  overflow-x: hidden;
  background: linear-gradient(180deg, #f4f7fb 0%, #edf3ff 100%);
  color: var(--text);
}

img {
  max-width: 100%;
}

.main-shell {
  padding-top: 1.4rem;
  padding-bottom: 2rem;
}

.content-wrap {
  background: transparent;
}

.topbar {
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.topbar-usertext {
  color: var(--text) !important;
}

.topbar-role {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.14), rgba(99, 102, 241, 0.18));
  color: #1d4ed8;
  border: 1px solid rgba(96, 165, 250, 0.22);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.card-header {
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(255, 255, 255, 0.98));
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.card-body {
  background: rgba(255, 255, 255, 0.98);
}

.table thead th {
  background: rgba(239, 246, 255, 0.95);
  color: #334155;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.table tbody tr {
  transition: background-color .18s ease;
}

.table tbody tr:hover {
  background: rgba(248, 250, 252, 0.8);
}

.form-control,
.form-select,
.input-group-text {
  border-radius: var(--radius-input);
  border-color: #d6dfec;
}

.btn {
  border-radius: var(--radius-button);
  transition: transform var(--transition-fast) ease, box-shadow var(--transition-fast) ease, background-color var(--transition-fast) ease;
}

.btn-primary {
  box-shadow: 0 12px 24px rgba(59, 130, 246, 0.18);
}

.alert {
  border-radius: 16px;
}

.app-layout {
  display: flex;
  min-height: 100vh;
}

.main-shell {
  min-width: 0;
  overflow-x: clip;
}

.sidebar {
  width: 260px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1040;
  overflow-y: auto;
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.22), rgba(56, 189, 248, 0) 26%),
    radial-gradient(circle at bottom right, rgba(244, 114, 182, 0.18), rgba(244, 114, 182, 0) 26%),
    linear-gradient(180deg, #0f172a 0%, #111c3d 44%, #172554 72%, #1e1b4b 100%);
  transition: width .2s ease;
  border-right: 1px solid rgba(148, 163, 184, 0.16);
  box-shadow: 18px 0 30px rgba(15, 23, 42, 0.12);
}

.sidebar-brand {
  padding: 1.15rem 1rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 23, 42, 0.18);
}

.sidebar-brand-link {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .4rem .25rem;
  border-radius: 12px;
}

.sidebar-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.85);
  padding: 2px;
}

.sidebar-nav {
  padding: .8rem;
}

.sidebar-link,
.sidebar-sublink,
.sidebar-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: .7rem .8rem;
  border-radius: 16px;
  color: #dbe7ff;
  text-decoration: none;
  border: 0;
  background: rgba(255, 255, 255, 0.04);
  margin-bottom: .25rem;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, border-color .18s ease;
}

.sidebar-link,
.sidebar-toggle {
  position: relative;
  overflow: hidden;
}

.sidebar-link:hover,
.sidebar-link.active,
.sidebar-toggle:hover,
.sidebar-toggle.active,
.sidebar-sublink:hover,
.sidebar-sublink.active {
  color: #fff;
  transform: translateX(2px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.24);
  border-color: rgba(255, 255, 255, 0.08);
}

.sidebar-link::before,
.sidebar-toggle::before,
.sidebar-sublink::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .2s ease;
  pointer-events: none;
}

.sidebar-icon {
  min-width: 28px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.28), rgba(129, 140, 248, 0.32));
  color: #eff6ff;
  text-align: center;
  margin-right: .5rem;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.18);
}

.sidebar-subicon {
  min-width: 24px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: .55rem;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.2), rgba(96, 165, 250, 0.28));
  color: #bfdbfe;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.16);
}

.sidebar-label {
  display: inline !important;
  white-space: nowrap;
  color: #fff !important;
  font-size: 1rem;
  opacity: 1 !important;
  visibility: visible !important;
}

.sidebar-toggle {
  justify-content: space-between;
}

.sidebar-link:hover::before,
.sidebar-link.active::before,
.sidebar-toggle:hover::before,
.sidebar-toggle.active::before,
.sidebar-sublink:hover::before,
.sidebar-sublink.active::before {
  opacity: 1;
}

.sidebar-link.active,
.sidebar-toggle.active,
.sidebar-sublink.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.22), rgba(99, 102, 241, 0.14));
  border: 1px solid rgba(147, 197, 253, 0.22);
}

.sidebar-link:hover .sidebar-icon,
.sidebar-link.active .sidebar-icon,
.sidebar-toggle:hover .sidebar-icon,
.sidebar-toggle.active .sidebar-icon {
  color: #fff7ed;
}

.menu-dashboard .sidebar-icon {
  background: linear-gradient(135deg, #22c55e, #14b8a6);
  color: #ecfdf5;
}

.menu-dashboard {
  background: rgba(255, 255, 255, 0.05);
  border: 0;
}

.menu-dashboard::before {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.5), rgba(129, 140, 248, 0.45));
}

.menu-products .sidebar-icon {
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #fff7ed;
}

.menu-products {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(249, 115, 22, 0.18));
  border: 1px solid rgba(251, 146, 60, 0.14);
}

.menu-products::before {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(249, 115, 22, 0.28));
}

.menu-clients .sidebar-icon {
  background: linear-gradient(135deg, #ec4899, #f43f5e);
  color: #fff1f2;
}

.menu-clients {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.16), rgba(244, 63, 94, 0.18));
  border: 1px solid rgba(244, 114, 182, 0.15);
}

.menu-clients::before {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.3), rgba(244, 63, 94, 0.28));
}

.menu-purchases .sidebar-icon {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: #f5f3ff;
}

.menu-purchases {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.16), rgba(99, 102, 241, 0.18));
  border: 1px solid rgba(129, 140, 248, 0.15);
}

.menu-purchases::before {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(99, 102, 241, 0.28));
}

.menu-sales .sidebar-icon {
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #fff7ed;
}

.menu-sales {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.16), rgba(249, 115, 22, 0.18));
  border: 1px solid rgba(248, 113, 113, 0.15);
}

.menu-sales::before {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.3), rgba(249, 115, 22, 0.28));
}

.menu-accounts .sidebar-icon {
  background: linear-gradient(135deg, #06b6d4, #0ea5e9);
  color: #ecfeff;
}

.menu-accounts {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.16), rgba(14, 165, 233, 0.18));
  border: 1px solid rgba(34, 211, 238, 0.15);
}

.menu-accounts::before {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.3), rgba(14, 165, 233, 0.28));
}

.menu-cash .sidebar-icon {
  background: linear-gradient(135deg, #22c55e, #84cc16);
  color: #f7fee7;
}

.menu-cash {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.16), rgba(132, 204, 22, 0.18));
  border: 1px solid rgba(134, 239, 172, 0.15);
}

.menu-cash::before {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.3), rgba(132, 204, 22, 0.28));
}

.menu-users .sidebar-icon {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #eff6ff;
}

.menu-users {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.16), rgba(99, 102, 241, 0.18));
  border: 1px solid rgba(96, 165, 250, 0.15);
}

.menu-users::before {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(99, 102, 241, 0.28));
}

.menu-settings .sidebar-icon {
  background: linear-gradient(135deg, #64748b, #334155);
  color: #f8fafc;
}

.menu-settings {
  background: linear-gradient(135deg, rgba(100, 116, 139, 0.18), rgba(51, 65, 85, 0.2));
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.menu-settings::before {
  background: linear-gradient(135deg, rgba(100, 116, 139, 0.3), rgba(51, 65, 85, 0.3));
}

.menu-reports .sidebar-icon {
  background: linear-gradient(135deg, #f43f5e, #8b5cf6);
  color: #fff1f2;
}

.menu-reports {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.16), rgba(139, 92, 246, 0.18));
  border: 1px solid rgba(244, 114, 182, 0.15);
}

.menu-reports::before {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.3), rgba(139, 92, 246, 0.28));
}

.menu-dashboard:hover .sidebar-icon,
.menu-dashboard.active .sidebar-icon,
.menu-products:hover .sidebar-icon,
.menu-products.active .sidebar-icon,
.menu-clients:hover .sidebar-icon,
.menu-clients.active .sidebar-icon,
.menu-purchases:hover .sidebar-icon,
.menu-purchases.active .sidebar-icon,
.menu-sales:hover .sidebar-icon,
.menu-sales.active .sidebar-icon,
.menu-accounts:hover .sidebar-icon,
.menu-accounts.active .sidebar-icon,
.menu-cash:hover .sidebar-icon,
.menu-cash.active .sidebar-icon,
.menu-users:hover .sidebar-icon,
.menu-users.active .sidebar-icon,
.menu-settings:hover .sidebar-icon,
.menu-settings.active .sidebar-icon,
.menu-reports:hover .sidebar-icon,
.menu-reports.active .sidebar-icon {
  filter: saturate(1.08) brightness(1.03);
}

.sidebar-submenu {
  margin: .2rem 0 .45rem;
  padding: .35rem 0 .15rem .55rem;
  border-left: 1px solid rgba(148, 163, 184, 0.18);
}

.sidebar-sublink {
  font-size: .92rem;
  padding: .52rem .75rem;
  color: #cbd5f5;
  background: rgba(15, 23, 42, 0.18);
  position: relative;
  overflow: hidden;
}

.sidebar-sublink span {
  color: inherit;
}

.sidebar-sublink:hover,
.sidebar-sublink.active {
  background: rgba(15, 23, 42, 0.18);
}

.sidebar-sublink:hover .sidebar-subicon,
.sidebar-sublink.active .sidebar-subicon {
  color: #fff7ed;
}

#productsMenu .sidebar-subicon {
  background: linear-gradient(135deg, #f59e0b, #fb7185);
  color: #fff7ed;
}

#productsMenu .sidebar-sublink {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.14), rgba(251, 113, 133, 0.16));
}

#productsMenu .sidebar-sublink::before {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.24), rgba(251, 113, 133, 0.26));
}

#purchasesMenu .sidebar-subicon {
  background: linear-gradient(135deg, #8b5cf6, #3b82f6);
  color: #eef2ff;
}

#purchasesMenu .sidebar-sublink {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.14), rgba(59, 130, 246, 0.16));
}

#purchasesMenu .sidebar-sublink::before {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.24), rgba(59, 130, 246, 0.26));
}

#salesMenu .sidebar-subicon {
  background: linear-gradient(135deg, #ef4444, #f59e0b);
  color: #fff7ed;
}

#salesMenu .sidebar-sublink {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.14), rgba(245, 158, 11, 0.16));
}

#salesMenu .sidebar-sublink::before {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.24), rgba(245, 158, 11, 0.26));
}

#accountsMenu .sidebar-subicon {
  background: linear-gradient(135deg, #06b6d4, #14b8a6);
  color: #ecfeff;
}

#accountsMenu .sidebar-sublink {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.14), rgba(20, 184, 166, 0.16));
}

#accountsMenu .sidebar-sublink::before {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.24), rgba(20, 184, 166, 0.26));
}

#cashMenu .sidebar-subicon {
  background: linear-gradient(135deg, #22c55e, #10b981);
  color: #ecfdf5;
}

#cashMenu .sidebar-sublink {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.14), rgba(16, 185, 129, 0.16));
}

#cashMenu .sidebar-sublink::before {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.24), rgba(16, 185, 129, 0.26));
}

#usersMenu .sidebar-subicon {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #eff6ff;
}

#usersMenu .sidebar-sublink {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.14), rgba(139, 92, 246, 0.16));
}

#usersMenu .sidebar-sublink::before {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.24), rgba(139, 92, 246, 0.26));
}

#settingsMenu .sidebar-subicon {
  background: linear-gradient(135deg, #64748b, #0f172a);
  color: #f8fafc;
}

#settingsMenu .sidebar-sublink {
  background: linear-gradient(135deg, rgba(100, 116, 139, 0.16), rgba(15, 23, 42, 0.18));
}

#settingsMenu .sidebar-sublink::before {
  background: linear-gradient(135deg, rgba(100, 116, 139, 0.26), rgba(15, 23, 42, 0.28));
}

#reportsMenu .sidebar-subicon {
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  color: #fdf2f8;
}

#reportsMenu .sidebar-sublink {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.14), rgba(139, 92, 246, 0.16));
}

#reportsMenu .sidebar-sublink::before {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.24), rgba(139, 92, 246, 0.26));
}

#productsMenu .sidebar-sublink,
#purchasesMenu .sidebar-sublink,
#salesMenu .sidebar-sublink,
#accountsMenu .sidebar-sublink,
#cashMenu .sidebar-sublink,
#usersMenu .sidebar-sublink,
#settingsMenu .sidebar-sublink,
#reportsMenu .sidebar-sublink {
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.content-wrap {
  margin-left: 260px;
  width: calc(100% - 260px);
  min-width: 0;
  padding: 2.5rem 2.5rem 2rem 2.5rem;
  transition: margin-left .2s ease, width .2s ease, padding .2s;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.pos-navbar {
  background: linear-gradient(135deg, #0f172a, #1e3a8a);
  box-shadow: var(--shadow-sm);
}

.pos-navbar .navbar-brand {
  font-weight: 700;
  letter-spacing: .3px;
}

.pos-navbar .nav-link {
  border-radius: 10px;
  padding: .45rem .75rem !important;
  margin-right: .2rem;
}

.pos-navbar .nav-link:hover,
.pos-navbar .nav-link.active {
  background: rgba(255, 255, 255, 0.16);
}

.page-title {
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.metric-card {
  border: 0;
  border-radius: 20px;
  color: #fff;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.metric-card .metric-label {
  opacity: .9;
  font-size: .9rem;
}

.metric-card .metric-value {
  font-size: 1.55rem;
  font-weight: 700;
}

.metric-sales { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.metric-income { background: linear-gradient(135deg, #0ea5e9, #06b6d4); }
.metric-products { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.metric-stock { background: linear-gradient(135deg, #f59e0b, #f97316); }

.table {
  --bs-table-bg: transparent;
}

.table tbody tr {
  border-top: 1px solid var(--border);
}

@media (max-width: 767.98px) {
  .responsive-stack thead {
    display: none;
  }

  .responsive-stack,
  .responsive-stack tbody,
  .responsive-stack tr,
  .responsive-stack td {
    display: block;
    width: 100%;
  }

  .responsive-stack tr {
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: .75rem;
    padding: .4rem .6rem;
    background: #fff;
  }

  .responsive-stack td {
    border: 0 !important;
    padding: .35rem .15rem;
    white-space: normal !important;
  }

  .responsive-stack td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .35px;
    color: var(--muted);
    margin-bottom: .15rem;
    font-weight: 600;
  }

  .inline-mobile-form {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: .4rem !important;
    align-items: stretch;
  }

  .inline-mobile-form .form-control,
  .inline-mobile-form .form-select,
  .inline-mobile-form .btn {
    width: 100%;
    max-width: 100% !important;
  }

  .inline-mobile-form .btn {
    min-height: 36px;
  }
}

/* ===== Desktop Stabilizer ===== */
@media (min-width: 992px) {
  .app-layout {
    position: relative;
    align-items: stretch;
  }

  .sidebar {
    transform: none !important;
    width: 260px;
    min-width: 260px;
    max-width: 260px;
    border-top-right-radius: 24px;
    border-bottom-right-radius: 24px;
  }

  .content-wrap {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin-left: 260px;
    width: calc(100% - 260px);
    padding: 0;
  }

  .main-shell.container-fluid {
    width: 100%;
    max-width: none;
    padding: 1.5rem 1.5rem 2rem;
  }

  .topbar {
    min-height: 64px;
    padding: .75rem 1.25rem;
    align-items: center;
    flex-wrap: nowrap;
    gap: .75rem;
  }

  .topbar .ms-auto {
    min-width: 0;
    width: auto;
    flex: 1;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: .65rem !important;
  }

  .topbar .navbar-text {
    display: inline-flex;
    align-items: center;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-layout.sidebar-collapsed .sidebar {
    width: 84px;
    min-width: 84px;
    max-width: 84px;
  }

  .app-layout.sidebar-collapsed .content-wrap {
    margin-left: 84px;
    width: calc(100% - 84px);
  }

  .app-layout.sidebar-collapsed .sidebar-link,
  .app-layout.sidebar-collapsed .sidebar-toggle,
  .app-layout.sidebar-collapsed .sidebar-sublink {
    justify-content: center;
    padding-left: .5rem;
    padding-right: .5rem;
  }

  .app-layout.sidebar-collapsed .sidebar-icon {
    margin-right: 0;
  }

  .app-layout.sidebar-collapsed .sidebar-label,
  .app-layout.sidebar-collapsed .sidebar-submenu,
  .app-layout.sidebar-collapsed .sidebar-toggle .bi-chevron-down,
  .app-layout.sidebar-collapsed .sidebar-credit {
    display: none !important;
  }

  .app-layout.sidebar-collapsed .sidebar-brand-link {
    justify-content: center;
  }
}
.tax-badge {
  display: inline-block;
  margin-top: .25rem;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 600;
  line-height: 1.25;
}

.tax-badge-included {
  background: var(--bs-success-bg-subtle, #d1e7dd);
  color: var(--bs-success-text-emphasis, #0f5132);
}

.tax-badge-exempt {
  background: var(--bs-warning-bg-subtle, #fff3cd);
  color: var(--bs-warning-text-emphasis, #664d03);
}

.form-control,
.form-select {
  border-radius: 12px;
  border-color: #d5ddec;
  min-height: 42px;
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.form-control:focus,
.form-select:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 .2rem rgba(59, 130, 246, .12);
}

.form-label {
  font-weight: 600;
  color: #334155;
  margin-bottom: .4rem;
}

.form-text {
  font-size: .78rem;
  color: var(--muted);
}

.form-control::placeholder {
  color: #94a3b8;
}

.form-control:hover,
.form-select:hover {
  border-color: #bfd0ea;
}

.form-control:disabled,
.form-control[readonly],
.form-select:disabled {
  background-color: #f1f5f9;
  color: #64748b;
}

.form-control.is-invalid,
.form-select.is-invalid {
  border-color: var(--bs-danger, #dc3545);
  box-shadow: 0 0 0 .2rem rgba(220, 53, 69, .1);
}

.form-control.is-valid,
.form-select.is-valid {
  border-color: var(--bs-success, #198754);
  box-shadow: 0 0 0 .2rem rgba(25, 135, 84, .1);
}

.input-group-text {
  border-radius: 12px;
  border-color: #d5ddec;
  background: var(--surface-soft);
  color: #475569;
  font-weight: 600;
}

.card .form-control,
.card .form-select,
.card .input-group-text {
  box-shadow: none;
}

.btn {
  border-radius: var(--radius-button);
  font-weight: 600;
  transition: transform var(--transition-fast) ease, box-shadow var(--transition-fast) ease, background-color var(--transition-fast) ease;
}

.btn-sm {
  border-radius: 10px;
}

.btn-primary {
  border: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 10px 22px rgba(37,99,235,0.18);
}

.btn-primary:hover,
.btn-primary:focus {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 18px 30px rgba(37,99,235,0.14);
}

.btn-outline-primary {
  border-color: #bfd3ff;
  color: #1d4ed8;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent;
}

.login-wrap {
  min-height: calc(100vh - 140px);
  display: flex;
  align-items: center;
  padding: 2rem 0;
  background:
    radial-gradient(circle at top left, rgba(96, 165, 250, 0.20), rgba(96, 165, 250, 0) 30%),
    radial-gradient(circle at bottom right, rgba(99, 102, 241, 0.18), rgba(99, 102, 241, 0) 32%),
    linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
}

.login-panel {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 26px;
  box-shadow: 0 28px 60px rgba(15, 23, 42, 0.12);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.92);
}

.login-side {
  background: linear-gradient(145deg, #1d4ed8 0%, #1e3a8a 46%, #111827 100%);
  color: #fff;
  padding: 2rem 1.6rem;
  position: relative;
}

.login-side::before {
  content: '';
  position: absolute;
  inset: auto -30px -30px auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0));
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .8rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-weight: 700;
  letter-spacing: .02em;
}

.auth-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
}

.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin-top: 1rem;
  padding: .45rem .7rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(110, 231, 183, 0.32);
  color: #d1fae5;
}

.auth-feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-top: 1.2rem;
}

.auth-feature-list span {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: .76rem;
  color: rgba(255, 255, 255, 0.9);
}

.auth-side-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  margin-top: 1.4rem;
}

.auth-side-card {
  padding: .8rem .75rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.auth-side-card strong {
  display: block;
  font-size: 1.05rem;
  font-weight: 800;
}

.auth-side-card small {
  color: rgba(255, 255, 255, 0.8);
}

.login-form {
  padding: 2rem 2rem 1.8rem;
  background: rgba(255, 255, 255, 0.94);
}

.auth-form-header {
  margin-bottom: .3rem;
}

.auth-form-kicker {
  display: inline-flex;
  align-items: center;
  padding: .35rem .7rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(96, 165, 250, 0.22);
  color: #1d4ed8;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.auth-submit-btn {
  min-height: 48px;
  font-size: 1rem;
}

.input-group-text {
  background: #f8fbff;
}

.chart-wrap {
  position: relative;
  height: 280px;
  border-radius: 18px;
  padding: .5rem;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.chart-wrap-sm {
  height: 220px;
}

.sale-builder .card-body {
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.product-quick-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 1055;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
  background: #ffffff;
  opacity: 1;
}

.purchase-quick-search-wrap {
  z-index: 12;
}

.cash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .65rem;
}

.cash-kpi-card {
  border: 1px solid #dbe6f7;
  background: #f8fbff;
  border-radius: 12px;
  padding: .65rem .75rem;
}

.cash-kpi-label {
  font-size: .78rem;
  color: var(--muted);
}

.cash-kpi-value {
  font-weight: 700;
  font-size: 1rem;
}

.cash-close-panel {
  border: 1px dashed #bfd3f8;
  background: #f7faff;
  border-radius: 12px;
  padding: .8rem;
}

.quick-product-image,
.product-thumb {
  width: 38px;
  height: 38px;
  object-fit: cover;
  border-radius: 9px;
  border: 1px solid #d8e1f0;
  background: #fff;
}

.invoice-sheet {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
}

.invoice-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px dashed #c9d5ec;
  padding-bottom: .75rem;
}

.invoice-meta {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
}

.invoice-table thead th {
  font-size: .78rem;
}

.cash-receipt-sheet {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
}

.invoice-page.ticket-mode {
  display: flex;
  justify-content: center;
}

.ticket-sheet {
  width: 82mm;
  max-width: 100%;
  background: #fff;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 10px;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.35;
}

.ticket-sheet.paper-58 {
  width: 60mm;
}

.ticket-sheet.paper-80 {
  width: 82mm;
}

.ticket-center {
  text-align: center;
}

.ticket-sep {
  border-top: 1px dashed #94a3b8;
  margin: 8px 0;
}

.ticket-item {
  margin-bottom: 6px;
}

.ticket-item-name {
  font-weight: 600;
}

.ticket-item-meta,
.ticket-total-row {
  display: flex;
  justify-content: space-between;
}

@media print {
  .sidebar,
  .topbar,
  .no-print,
  .alert,
  .btn {
    display: none !important;
  }

  .content-wrap,
  .main-shell {
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
  }

  .invoice-sheet {
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
  }

  .cash-receipt-sheet {
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
  }

  .invoice-page.ticket-mode {
    display: block;
  }

  .invoice-page.ticket-mode .ticket-sheet {
    width: 80mm;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    margin: 0 auto;
  }

  .invoice-page.ticket-mode.paper-58 .ticket-sheet,
  .invoice-page.ticket-mode .ticket-sheet.paper-58 {
    width: 58mm;
  }

  .invoice-page.ticket-mode.paper-80 .ticket-sheet,
  .invoice-page.ticket-mode .ticket-sheet.paper-80 {
    width: 80mm;
  }

  .invoice-page.ticket-mode .ticket-sheet * {
    font-size: 11px;
  }

  body {
    background: #fff !important;
  }
}

.fiscal-check-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .7rem .85rem;
  background: #fff;
}

.fiscal-kpi {
  border: 1px solid #dbe6f7;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff, #f8fbff);
  padding: .85rem;
}

.fiscal-kpi-label {
  color: var(--muted);
  font-size: .85rem;
}

.fiscal-kpi-value {
  font-weight: 700;
  font-size: 1.02rem;
}

@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    width: 260px;
  }

  .content-wrap {
    margin-left: 0;
    width: 100%;
  }

  .app-layout.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .app-layout.sidebar-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 1030;
  }

  .row {
    --bs-gutter-x: .9rem;
  }
}

@media (max-width: 767.98px) {
  .row {
    --bs-gutter-x: .75rem;
    --bs-gutter-y: .75rem;
  }

  .card-body {
    overflow-x: clip;
  }

  .page-title {
    font-size: 1.35rem;
    margin-bottom: .9rem;
    line-height: 1.2;
    word-break: break-word;
  }

  .section-subtitle {
    font-size: .88rem;
    margin-top: -4px;
    margin-bottom: .8rem;
  }

  .card {
    border-radius: 14px;
  }

  .card-header,
  .card-body {
    padding: .75rem;
  }

  .form-control,
  .form-select,
  .btn {
    min-height: 38px;
    font-size: .92rem;
  }

  .btn {
    white-space: nowrap;
  }

  .form-label {
    font-size: .88rem;
    margin-bottom: .3rem;
  }

  .table {
    font-size: .86rem;
  }

  .table-responsive {
    overflow-x: auto;
  }

  .table-responsive > .table {
    margin-bottom: 0;
  }

  .mobile-scroll-hint {
    font-size: .74rem;
    color: var(--muted);
  }

  .products-list-scroll {
    overflow-x: auto;
  }

  .products-table {
    min-width: 980px;
  }

  .products-table th:last-child,
  .products-table td:last-child {
    position: static;
    background: inherit;
    box-shadow: none;
  }

  .table thead th,
  .table tbody td {
    padding: .45rem .4rem;
    white-space: nowrap;
  }

  .table tbody td {
    vertical-align: middle;
  }

  .summary-box {
    padding: .7rem !important;
  }

  .invoice-sheet,
  .cash-receipt-sheet {
    padding: .85rem;
  }

  .invoice-head,
  .invoice-meta {
    flex-direction: column;
    align-items: flex-start !important;
    gap: .45rem;
  }

  .ticket-sheet {
    font-size: 11px;
  }

  .ticket-item-meta,
  .ticket-total-row {
    gap: .5rem;
  }

  .invoice-head .text-end {
    text-align: left !important;
  }

  .topbar {
    height: auto;
    min-height: 58px;
    align-items: flex-start;
    padding-top: .45rem;
    padding-bottom: .45rem;
  }

  .topbar .ms-auto {
    min-width: 0;
    flex: 1;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .topbar .navbar-text {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    max-width: 100%;
    font-size: .82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar .btn {
    min-height: 34px;
    padding: .3rem .6rem;
  }

  .topbar .navbar-text .badge-soft {
    flex-shrink: 0;
  }

  .product-quick-results {
    max-height: 180px;
  }

  .sidebar {
    width: min(260px, 86vw);
  }

  .modal-dialog {
    margin: .45rem;
  }

  .modal-content {
    border-radius: 12px;
  }

  .modal-body.row {
    --bs-gutter-x: .6rem;
  }

  .mobile-sale-submit {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1045;
    padding: .6rem .75rem calc(.65rem + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 20px rgba(15, 23, 42, 0.08);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
  }

  .mobile-sale-submit .btn {
    min-height: 44px;
  }

  .mobile-sale-submit-spacer {
    height: 92px;
  }
}

@media (max-width: 420px) {
  .row {
    --bs-gutter-x: .6rem;
    --bs-gutter-y: .6rem;
  }

  .page-title {
    font-size: 1.18rem;
  }

  .section-subtitle {
    font-size: .82rem;
  }

  .card-header {
    font-size: .9rem;
  }

  .table {
    font-size: .8rem;
  }

  .mobile-sale-submit .btn {
    min-height: 42px;
    font-size: .9rem;
  }
}

/* ===== Visual Kit v2 ===== */
:root {
  --radius-md: 16px;
  --radius-lg: 22px;
}

.card,
.invoice-sheet,
.cash-receipt-sheet,
.summary-box,
.cash-close-panel,
.fiscal-check-item,
.fiscal-kpi {
  border-radius: var(--radius-lg);
}

.card {
  transition: transform .18s ease, box-shadow .18s ease;
}

.card:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.09);
}

.btn,
.form-control,
.form-select,
.input-group-text,
.modal-content,
.alert,
.table-responsive {
  border-radius: var(--radius-md);
}

.btn {
  min-height: 40px;
}

.btn-sm {
  min-height: 34px;
}

.btn-danger,
.btn-outline-danger:hover,
.btn-outline-danger:focus {
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.2);
}

.btn-success,
.btn-outline-success:hover,
.btn-outline-success:focus {
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.2);
}

.tax-badge {
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: .01em;
}

.alert {
  border: 1px solid transparent;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.alert-success {
  border-color: rgba(16, 185, 129, 0.28);
}

.alert-danger {
  border-color: rgba(239, 68, 68, 0.26);
}

.modal-header,
.modal-footer {
  border-color: #e8eef9;
}

@media (max-width: 991.98px) {
  .card:hover {
    transform: none;
  }
}

/* ===== Visual Kit v2.1 - Caja rápida ===== */
.sale-builder .card-header,
.sale-summary .card-header {
  font-size: 1rem;
}

.sale-builder .card,
.sale-summary .card,
.product-form .card,
.product-editor .card,
.product-grid .card {
  border-radius: 22px;
  border: 1px solid rgba(203, 213, 225, 0.9);
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.06);
}

.sale-builder .form-control,
.sale-builder .form-select,
.sale-summary .form-control,
.sale-summary .form-select,
.product-form .form-control,
.product-form .form-select,
.product-editor .form-control,
.product-editor .form-select {
  min-height: 46px;
  font-size: .98rem;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  border-color: #d5ddec;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.sale-builder .form-control:focus,
.sale-builder .form-select:focus,
.sale-summary .form-control:focus,
.sale-summary .form-select:focus,
.product-form .form-control:focus,
.product-form .form-select:focus,
.product-editor .form-control:focus,
.product-editor .form-select:focus {
  border-color: rgba(96, 165, 250, 0.9);
  box-shadow: 0 0 0 0.2rem rgba(96, 165, 250, 0.14);
}

.sale-builder .table thead th,
.sale-summary .table thead th,
.product-form .table thead th,
.product-editor .table thead th {
  font-size: .78rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.sale-builder .table tbody td,
.sale-summary .table tbody td,
.product-form .table tbody td,
.product-editor .table tbody td {
  padding-top: .7rem;
  padding-bottom: .7rem;
  vertical-align: middle;
}

.sale-builder .table tbody tr:hover,
.sale-summary .table tbody tr:hover,
.product-form .table tbody tr:hover,
.product-editor .table tbody tr:hover {
  background: rgba(239, 246, 255, 0.46);
}

.sale-builder .unit-price,
.sale-builder .quantity {
  text-align: center;
  font-weight: 700;
}

.sale-builder .remove-row {
  min-width: 40px;
}

.sale-summary {
  top: 72px;
}

#checkoutButtonDesktop,
#checkoutButtonMobile {
  min-height: 52px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .01em;
}

.product-quick-results {
  border-radius: 14px;
  border: 1px solid #dbe6f7;
  padding: .3rem;
}

.quick-result-item {
  border-radius: 10px !important;
  margin-bottom: .2rem;
}

.quick-result-item:last-child {
  margin-bottom: 0;
}

@media (max-width: 767.98px) {
  .sale-builder .form-control,
  .sale-builder .form-select,
  .sale-summary .form-control,
  .sale-summary .form-select {
    min-height: 44px;
    font-size: .95rem;
  }

  #checkoutButtonMobile {
    min-height: 50px;
    font-size: 1rem;
  }
}

/* ===== Visual Kit v2.2 - Densidad compacta ===== */
body.ui-compact .main-shell {
  padding-top: .9rem !important;
}

body.ui-compact .page-title {
  font-size: 1.3rem;
  margin-bottom: .7rem;
}

body.ui-compact .section-subtitle {
  margin-bottom: .65rem;
}

body.ui-compact .card,
body.ui-compact .invoice-sheet,
body.ui-compact .cash-receipt-sheet,
body.ui-compact .summary-box {
  border-radius: 14px;
}

body.ui-compact .card-header,
body.ui-compact .card-body {
  padding: .68rem .78rem;
}

body.ui-compact .sidebar-link,
body.ui-compact .sidebar-toggle,
body.ui-compact .sidebar-sublink {
  min-height: 38px;
  padding-top: .45rem;
  padding-bottom: .45rem;
}

body.ui-compact .sidebar-icon {
  width: 24px;
  height: 24px;
  min-width: 24px;
  margin-right: .45rem;
}

body.ui-compact .form-control,
body.ui-compact .form-select,
body.ui-compact .btn {
  min-height: 36px;
  font-size: .9rem;
}

body.ui-compact .btn-sm {
  min-height: 32px;
}

body.ui-compact .table {
  font-size: .87rem;
}

body.ui-compact .table thead th,
body.ui-compact .table tbody td {
  padding: .42rem .45rem;
}

body.ui-compact .topbar .navbar-text {
  font-size: .84rem;
}

body.ui-compact .metric-card .metric-value {
  font-size: 1.35rem;
}

@media (max-width: 767.98px) {
  body.ui-compact .main-shell {
    padding-top: .6rem !important;
  }

  body.ui-compact .card-header,
  body.ui-compact .card-body {
    padding: .6rem .65rem;
  }
}

/* ===== Visual Kit v3 - Modern Refresh (Desktop + Mobile) ===== */
:root {
  --v3-bg: #eef3fb;
  --v3-surface: #ffffff;
  --v3-surface-2: #f7faff;
  --v3-text: #0f172a;
  --v3-muted: #64748b;
  --v3-primary: #4f46e5;
  --v3-primary-2: #0ea5e9;
  --v3-border: #dbe4f2;
  --v3-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --v3-shadow-soft: 0 6px 18px rgba(15, 23, 42, 0.06);
}

body {
  background:
    radial-gradient(circle at 8% 0%, rgba(99, 102, 241, 0.16), rgba(99, 102, 241, 0) 42%),
    radial-gradient(circle at 95% 0%, rgba(14, 165, 233, 0.15), rgba(14, 165, 233, 0) 35%),
    var(--v3-bg);
  color: var(--v3-text);
}

.topbar {
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--v3-border);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.sidebar {
  background: linear-gradient(180deg, #050505 0%, #0a0a0a 52%, #111111 100%);
  border-top-right-radius: 24px;
  border-bottom-right-radius: 24px;
  box-shadow: 0 20px 36px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.sidebar-nav {
  flex: 1 1 auto;
}

.sidebar-credit {
  margin: .4rem .8rem .9rem;
  padding: .85rem .9rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  color: #e5e7eb;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.sidebar-credit-title {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin-bottom: .35rem;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.66);
}

.sidebar-credit-name,
.sidebar-credit-phone {
  font-size: .8rem;
  line-height: 1.35;
}

.sidebar-credit-name {
  color: #ffffff;
  font-weight: 600;
}

.sidebar-credit-phone {
  margin-top: .2rem;
  color: rgba(255, 255, 255, 0.7);
}

.sidebar-link,
.sidebar-toggle,
.sidebar-sublink {
  border-radius: 14px;
  min-height: 42px;
  color: #e5e7eb;
  background: rgba(255, 255, 255, 0.025);
}

.sidebar-icon {
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-link:hover,
.sidebar-link.active,
.sidebar-toggle:hover,
.sidebar-toggle.active,
.sidebar-sublink:hover,
.sidebar-sublink.active {
  background: linear-gradient(135deg, rgba(31, 41, 55, 0.98), rgba(17, 24, 39, 0.96));
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.32);
  transform: translateX(2px);
}

.main-shell {
  max-width: none;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.sidebar-toggle .bi-chevron-down {
  transition: transform .2s ease;
}

.sidebar-toggle[aria-expanded="true"] .bi-chevron-down {
  transform: rotate(180deg);
}

.sidebar-submenu {
  margin: .15rem 0 .4rem;
}

.sidebar-submenu .sidebar-sublink {
  margin-left: 1.1rem;
  width: calc(100% - 1.1rem);
  background: rgba(255, 255, 255, 0.02);
}

.sidebar-subicon {
  width: 18px;
  min-width: 18px;
  text-align: center;
  opacity: .95;
}

@media (max-width: 991.98px) {
  .main-shell {
    padding-left: .9rem;
    padding-right: .9rem;
  }
}

.card,
.invoice-sheet,
.cash-receipt-sheet,
.summary-box,
.modal-content,
.table-responsive {
  background: var(--v3-surface);
  border: 1px solid var(--v3-border);
  border-radius: 18px;
  box-shadow: var(--v3-shadow-soft);
}

.card-header {
  background: linear-gradient(135deg, #f9fbff, #eef4ff);
  border-bottom: 1px solid var(--v3-border);
  border-top-left-radius: 18px !important;
  border-top-right-radius: 18px !important;
  font-size: .95rem;
  letter-spacing: .01em;
}

.page-title {
  letter-spacing: -0.02em;
  font-size: clamp(1.35rem, 2vw, 1.85rem);
}

.section-subtitle {
  color: var(--v3-muted);
}

.btn {
  border-radius: 13px;
  min-height: 40px;
  font-weight: 700;
}

.btn-primary {
  border: 0;
  background: linear-gradient(135deg, var(--v3-primary), var(--v3-primary-2));
  box-shadow: 0 10px 20px rgba(79, 70, 229, 0.24);
}

.btn-primary:hover,
.btn-primary:focus {
  background: linear-gradient(135deg, #4338ca, #0284c7);
}

.btn-success {
  box-shadow: 0 10px 20px rgba(16, 185, 129, 0.22);
}

.btn-danger {
  box-shadow: 0 10px 20px rgba(239, 68, 68, 0.2);
}

.form-control,
.form-select,
.input-group-text {
  border-color: var(--v3-border);
  background: var(--v3-surface);
  border-radius: 12px;
}

.form-control:focus,
.form-select:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 .2rem rgba(129, 140, 248, 0.14);
}

.table-responsive {
  overflow: hidden;
}

.table thead th {
  background: linear-gradient(180deg, #f8fbff, #edf3ff);
  color: #475569;
}

.table tbody tr {
  border-top-color: #e7edf7;
}

.table tbody tr:nth-child(odd) {
  background: rgba(248, 251, 255, 0.7);
}

.table tbody tr:hover {
  background: rgba(224, 231, 255, 0.5);
}

.badge-soft {
  background: #e0e7ff;
  color: #3730a3;
}

.empty-state {
  border: 1px dashed #d6e1f3;
  background: #f9fbff;
}

.metric-card {
  border-radius: 18px;
  box-shadow: var(--v3-shadow);
}

.metric-card .metric-value {
  font-size: 1.6rem;
}

@media (max-width: 991.98px) {
  .sidebar {
    width: min(290px, 88vw);
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }

  .topbar {
    padding-left: .65rem;
    padding-right: .65rem;
  }

  .topbar .btn {
    min-height: 36px;
  }

  .card,
  .invoice-sheet,
  .cash-receipt-sheet,
  .summary-box,
  .modal-content,
  .table-responsive {
    border-radius: 16px;
  }

  .card-header {
    border-top-left-radius: 16px !important;
    border-top-right-radius: 16px !important;
  }
}

@media (max-width: 767.98px) {
  .main-shell.container-fluid {
    padding-left: .62rem;
    padding-right: .62rem;
  }

  .page-title {
    font-size: 1.22rem;
    margin-bottom: .68rem;
  }

  .section-subtitle {
    font-size: .82rem;
    margin-bottom: .62rem;
  }

  .topbar {
    min-height: 56px;
    padding-top: .4rem;
    padding-bottom: .4rem;
  }

  .topbar .ms-auto {
    gap: .35rem !important;
  }

  .topbar .navbar-text {
    font-size: .78rem;
  }

  .topbar .btn {
    min-height: 34px;
    padding: .25rem .55rem;
    font-size: .84rem;
  }

  .card,
  .invoice-sheet,
  .cash-receipt-sheet,
  .summary-box,
  .modal-content,
  .table-responsive {
    border-radius: 14px;
  }

  .card-header,
  .card-body {
    padding: .7rem;
  }

  .form-control,
  .form-select,
  .btn {
    min-height: 40px;
    font-size: .93rem;
  }

  .table {
    font-size: .84rem;
  }

  .table thead th,
  .table tbody td {
    padding: .43rem .4rem;
  }

  .metric-card .metric-value {
    font-size: 1.35rem;
  }

  .mobile-sale-submit {
    border-top-color: #d9e4f7;
    box-shadow: 0 -10px 22px rgba(15, 23, 42, 0.1);
  }

  body.ui-compact .topbar .navbar-text {
    font-size: .74rem;
  }
}

@media (max-width: 420px) {
  .main-shell.container-fluid {
    padding-left: .45rem;
    padding-right: .45rem;
  }

  .page-title {
    font-size: 1.1rem;
  }

  .card-header {
    font-size: .85rem;
  }

  .topbar .navbar-text {
    max-width: 132px;
  }
}

/* ===== UX Patch v3.2 - Global desktop + mobile refinements ===== */
html {
  scroll-behavior: smooth;
}

:focus-visible {
  outline: 2px solid rgba(79, 70, 229, 0.55);
  outline-offset: 2px;
}

.card-body.table-responsive,
.table-responsive {
  overflow-x: auto;
}

.table td:last-child {
  white-space: nowrap;
}

.table td .btn,
.table td .btn-sm {
  margin-bottom: .2rem;
}

@media (max-width: 991.98px) {
  .topbar .navbar-text {
    max-width: 42vw;
  }

  .table td:last-child {
    min-width: 150px;
  }
}

@media (max-width: 767.98px) {
  .topbar {
    gap: .4rem;
  }

  .topbar .ms-auto {
    width: 100%;
    justify-content: space-between;
    gap: .4rem !important;
  }

  .topbar .navbar-text {
    max-width: 58vw;
  }

  .sidebar {
    width: min(300px, 92vw);
  }

  .modal-dialog {
    margin: .35rem;
    max-width: calc(100% - .7rem);
  }

  .modal-content {
    max-height: calc(100dvh - .7rem);
  }

  .modal-body {
    overflow-y: auto;
  }

  .table td:last-child {
    min-width: 168px;
  }

  .table td form.d-inline,
  .table td .d-inline {
    display: inline-flex !important;
    margin-right: .25rem;
    margin-bottom: .25rem;
  }

  .table td .btn,
  .table td .btn-sm {
    min-height: 34px;
    padding: .3rem .5rem;
    font-size: .78rem;
  }

  .products-table {
    min-width: 1020px;
  }
}

@media (max-width: 420px) {
  .topbar .navbar-text {
    max-width: 52vw;
  }

  .table td .btn,
  .table td .btn-sm {
    font-size: .75rem;
  }
}

/* ===== Verificación visual mobile/desktop ===== */
#networkStatusBadge {
  font-size: .74rem;
  line-height: 1.1;
  padding: .4rem .58rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.sale-summary .d-flex.gap-2.mb-3 > .btn {
  min-height: 42px;
}

#customerNameResults,
#creditOnlyCustomerNameResults {
  z-index: 75;
}

@media (max-width: 991.98px) {
  .sale-builder .card-header {
    flex-wrap: wrap;
    gap: .45rem;
  }

}

@media (max-width: 767.98px) {
  #networkStatusBadge {
    font-size: .68rem;
    padding: .32rem .5rem;
  }

  .sale-summary .d-flex.gap-2.mb-3 {
    flex-direction: column;
  }

  .sale-summary .d-flex.gap-2.mb-3 > .btn {
    width: 100%;
    min-height: 40px;
  }

}

/* ===== POS Touch Mode ===== */
.sale-page-touch .sale-search-input,
.sale-page-touch .sale-search-action,
.sale-page-touch .form-select,
.sale-page-touch .form-control {
  min-height: 56px;
  font-size: 1.05rem;
}

.sale-page-touch .sale-touch-actions .btn {
  min-height: 52px;
  padding-inline: 1rem;
  font-weight: 700;
  border-radius: 14px;
}

.sale-page-touch .sale-touch-hint {
  font-size: .85rem;
  color: #4b5563;
  text-align: center;
}

.sale-page-touch .sale-items-table td,
.sale-page-touch .sale-items-table th {
  vertical-align: middle;
}

.sale-page-touch .product-select,
.sale-page-touch .unit-price,
.sale-page-touch .quantity {
  min-height: 52px;
  font-size: 1.02rem;
}

.sale-page-touch .sale-items-table {
  min-width: 760px;
}

.sale-page-touch .sale-items-table th:nth-child(2),
.sale-page-touch .sale-items-table td:nth-child(2) {
  min-width: 118px;
  width: 118px;
}

.sale-page-touch .sale-items-table th:nth-child(3),
.sale-page-touch .sale-items-table td:nth-child(3) {
  min-width: 170px;
}

.sale-page-touch .sale-items-table th:nth-child(4),
.sale-page-touch .sale-items-table td:nth-child(4) {
  min-width: 120px;
  white-space: nowrap;
  font-size: 1.12rem;
}

.sale-page-touch .touch-qty {
  display: grid;
  grid-template-columns: 44px minmax(80px, 1fr) 44px;
  gap: .45rem;
  align-items: center;
}

.sale-page-touch .qty-step-btn {
  min-height: 44px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 1.1rem;
  padding: 0;
}

.sale-page-touch .remove-row {
  min-width: 46px;
  min-height: 46px;
  border-radius: 12px;
}

.sale-charge-touch .sale-charge-input {
  min-height: 62px;
  font-size: 1.3rem;
  font-weight: 700;
}

.sale-charge-quick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .5rem;
}

.sale-charge-quick-grid .btn {
  min-height: 48px;
  border-radius: 12px;
  font-weight: 700;
}

@media (pointer: coarse) {
  .sale-page-touch .sale-builder-card,
  .sale-page-touch .sale-summary-card {
    border-radius: 20px;
  }

  .sale-page-touch .sale-search-input,
  .sale-page-touch .sale-search-action,
  .sale-page-touch .form-select,
  .sale-page-touch .form-control,
  .sale-page-touch #checkoutButtonDesktop {
    min-height: 60px;
    font-size: 1.08rem;
  }

  .sale-page-touch #checkoutButtonDesktop {
    position: sticky;
    bottom: .75rem;
    z-index: 6;
    box-shadow: 0 16px 24px rgba(15, 23, 42, 0.2);
  }
}

@media (max-width: 991.98px) {
  .sale-page-touch .sale-summary {
    position: static !important;
    top: auto;
  }

  .sale-charge-quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ===== POS Bottom Bar (touch fixed) ===== */
.pos-bottom-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1050;
  background: #0f172a;
  border-top: 3px solid #10b981;
  padding: .65rem 1rem;
  gap: 1rem;
  align-items: center;
  box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.38);
  justify-content: space-between;
}

.pos-bottom-bar-totals {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.pos-bottom-stat {
  display: flex;
  flex-direction: column;
  gap: .1rem;
}

.pos-bottom-label {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .07em;
  color: #94a3b8;
  text-transform: uppercase;
}

.pos-bottom-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: #f1f5f9;
}

.pos-bottom-total .pos-bottom-value {
  font-size: 1.55rem;
  color: #34d399;
}

.pos-bottom-checkout {
  min-height: 62px;
  min-width: 160px;
  border-radius: 18px;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: .02em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  flex-shrink: 0;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.35);
}

.pos-bottom-checkout i {
  font-size: 1.3rem;
}

.pos-bottom-bar-visible {
  padding-bottom: 90px;
}

@media (pointer: coarse), (max-width: 991.98px) {
  .pos-bottom-bar {
    display: flex;
  }

  .sale-page-touch {
    padding-bottom: 90px;
  }

  .sale-page-touch #checkoutButtonDesktop {
    display: none;
  }
}

@media (max-width: 480px) {
  .pos-bottom-bar-totals {
    gap: .75rem;
  }

  .pos-bottom-stat:not(.pos-bottom-total) {
    display: none;
  }

  .pos-bottom-total .pos-bottom-value {
    font-size: 1.75rem;
  }

  .pos-bottom-checkout {
    min-width: 130px;
    min-height: 58px;
  }
}

/* ===== Sale View Refresh ===== */
.sale-page-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
}

.sale-page-kicker {
  display: inline-flex;
  align-items: center;
  padding: .38rem .7rem;
  margin-bottom: .8rem;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.1);
  color: #4338ca;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.sale-page-status {
  min-width: 220px;
}

.sale-status-card {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  padding: 1rem 1.1rem;
  border: 1px solid #dbe4f2;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,.94), rgba(244,248,255,.98));
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.sale-status-label {
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .08em;
  color: #64748b;
  text-transform: uppercase;
}

.sale-builder-card,
.sale-summary-card {
  overflow: hidden;
}

.sale-card-header {
  min-height: 68px;
  background: linear-gradient(135deg, rgba(248, 250, 255, 0.98), rgba(234, 243, 255, 0.98));
}

.sale-header-hint {
  font-size: .82rem;
  color: #64748b;
  font-weight: 600;
}

.sale-search-shell {
  padding: 1rem;
  border: 1px solid #dde7f6;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(246,250,255,.98));
}

.sale-field-label {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #64748b;
}

.sale-search-input {
  min-height: 52px;
  border-radius: 16px;
  padding-left: 1rem;
  font-size: 1rem;
}

.sale-search-caption {
  margin-top: .45rem;
  font-size: .82rem;
  color: #64748b;
}

.sale-search-action {
  min-height: 52px;
  border-radius: 16px;
}

.sale-search-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
}

.sale-tag {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .42rem .7rem;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.6);
  color: #334155;
  font-size: .8rem;
  font-weight: 600;
}

.sale-items-shell {
  padding: .25rem 0 0;
}

.sale-section-title {
  font-size: 1rem;
  font-weight: 700;
}

.sale-section-copy {
  color: #64748b;
  font-size: .87rem;
}

.sale-table-badge {
  display: inline-flex;
  align-items: center;
  padding: .4rem .7rem;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.1);
  color: #047857;
  font-size: .8rem;
  font-weight: 700;
}

.sale-table-wrap {
  border-radius: 18px;
  border: 1px solid #e0e8f6;
  background: #fff;
}

.sale-items-table thead th {
  font-size: .74rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.sale-items-table tbody td {
  padding-top: .8rem;
  padding-bottom: .8rem;
}

.sale-builder-footnote {
  margin-top: 1rem;
}

.sale-summary-card .card-body {
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(245,249,255,.96));
}

.sale-summary-block {
  padding: 1rem;
  border: 1px solid #dde7f6;
  border-radius: 18px;
  background: rgba(255,255,255,.88);
}

.sale-fiscal-block {
  background: linear-gradient(180deg, rgba(248,250,255,.98), rgba(239,245,255,.98));
}

.sale-block-title,
.sale-total-label {
  margin-bottom: .8rem;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .08em;
  color: #64748b;
  text-transform: uppercase;
}

.sale-total-box {
  border-style: solid;
  border-color: #cfdcf4;
  background: linear-gradient(160deg, #f8fbff, #eef4ff);
}

.sale-grand-total {
  font-size: 1.35rem;
  color: #0f172a;
}

#checkoutButtonDesktop,
#checkoutButtonMobile {
  min-height: 54px;
  border-radius: 18px;
}

.product-thumb,
.quick-product-image {
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fbff, #eef4ff);
  border: 1px solid #dde6f4;
}

.product-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
}

.quick-product-image {
  width: 42px;
  height: 42px;
  object-fit: cover;
}

.quick-result-item {
  border: 1px solid transparent;
}

.quick-result-item:hover {
  border-color: #cddaf4;
  background: #f8fbff;
}

@media (max-width: 991.98px) {
  .sale-page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .sale-page-status {
    min-width: 0;
  }
}

@media (max-width: 767.98px) {
  .sale-search-shell,
  .sale-summary-block {
    padding: .8rem;
    border-radius: 16px;
  }

  .sale-search-tags {
    gap: .4rem;
  }

  .sale-tag {
    font-size: .74rem;
  }

  .sale-table-badge,
  .sale-header-hint {
    display: none;
  }

  .sale-grand-total {
    font-size: 1.2rem;
  }
}

/* ===== Component polish layer ===== */
.page-title {
  line-height: 1.05;
}

.section-subtitle {
  max-width: 68ch;
  margin-bottom: 1rem;
  line-height: 1.55;
}

.card {
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-height: 58px;
  padding: .9rem 1.05rem;
}

.card-body {
  padding: 1.05rem;
}

.metric-card .card-body {
  padding: 1.05rem 1.1rem;
}

.form-label {
  margin-bottom: .42rem;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #64748b;
}

.form-control,
.form-select,
.input-group-text {
  min-height: 44px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease, transform .18s ease;
}

.form-control:hover,
.form-select:hover {
  border-color: #c7d4ec;
  background: #fbfdff;
}

.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-dark {
  border-width: 1px;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06);
}

.btn-outline-primary:hover,
.btn-outline-secondary:hover,
.btn-outline-dark:hover {
  transform: translateY(-1px);
}

.btn-logout {
  border: 1px solid #fca5a5;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(220, 38, 38, 0.22);
}

.btn-logout:hover,
.btn-logout:focus {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  border-color: #f87171;
  color: #ffffff;
  transform: translateY(-1px);
}

.badge,
.badge-soft {
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: .01em;
}

.empty-state {
  padding: 1rem 1.1rem;
  border-radius: 14px;
  color: #64748b;
  text-align: center;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .95rem;
}

.overview-card {
  padding: 1rem 1.05rem;
  border: 1px solid #dbe4f2;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 249, 255, 0.98));
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.06);
}

.overview-kicker {
  margin-bottom: .45rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #64748b;
}

.overview-value {
  margin-bottom: .25rem;
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  font-weight: 800;
  color: #0f172a;
}

.overview-note {
  color: #64748b;
  line-height: 1.45;
}

.surface-banner {
  background: linear-gradient(180deg, rgba(248, 251, 255, 0.92), rgba(241, 246, 255, 0.98));
}

.banner-note {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: .75rem .9rem;
  border: 1px dashed #cad8ee;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  color: #475569;
}

.table-icon-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid #dbe4f2;
  background: linear-gradient(180deg, #f8fbff, #eef4ff);
  color: #64748b;
}

.status-pill {
  padding: .5rem .72rem;
}

.cell-muted {
  color: #475569;
  font-weight: 500;
}

.action-cluster {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

.inline-mobile-form {
  align-items: center;
}

.settings-panel {
  padding: 1rem;
  border: 1px solid #dbe4f2;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 249, 255, 0.98));
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.tax-toggle-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.2rem;
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.08);
}

.tax-toggle-panel.is-enabled {
  background: linear-gradient(135deg, rgba(236, 253, 245, 0.98), rgba(224, 242, 254, 0.98));
}

.tax-toggle-panel.is-disabled {
  background: linear-gradient(135deg, rgba(255, 247, 237, 0.98), rgba(254, 242, 242, 0.98));
}

.tax-toggle-kicker {
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: .2rem;
}

.tax-toggle-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
}

.tax-toggle-copy {
  margin-top: .2rem;
  color: #475569;
  max-width: 620px;
}

.tax-toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  padding: .8rem 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.85);
  cursor: pointer;
  flex-shrink: 0;
}

.tax-toggle-switch .form-check-input {
  margin: 0;
  width: 3rem;
  height: 1.55rem;
}

.tax-toggle-switch-label {
  font-weight: 800;
  color: #1e293b;
}

.dashboard-period-card {
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(191, 219, 254, 0.55);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.06);
}

.dashboard-period-card-body {
  position: relative;
  padding: .8rem .9rem;
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.12), rgba(56, 189, 248, 0) 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 249, 255, 0.96));
}

.dashboard-period-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .9rem;
  margin-bottom: .9rem;
}

.dashboard-quick-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
}

.dashboard-quick-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: .55rem .88rem;
  border: 1px solid rgba(191, 219, 254, 0.85);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: #334155;
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .01em;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.05);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background-color .18s ease, color .18s ease;
}

.dashboard-quick-filter:hover {
  transform: translateY(-1px);
  border-color: rgba(96, 165, 250, 0.9);
  box-shadow: 0 18px 32px rgba(59, 130, 246, 0.12);
}

.dashboard-quick-filter.is-active {
  border-color: rgba(59, 130, 246, 0.9);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(79, 70, 229, 0.14));
  color: #1d4ed8;
}

.dashboard-period-chip {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 36px;
  padding: .52rem .82rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.05);
  color: #475569;
  font-size: .82rem;
  font-weight: 700;
}

.dashboard-period-form .form-label {
  margin-bottom: .3rem;
  font-size: .7rem;
}

.dashboard-period-form .form-control,
.dashboard-period-form .btn {
  min-height: 38px;
  font-size: .9rem;
}

.dashboard-period-note {
  min-height: 38px;
  padding: .55rem .75rem;
  font-size: .84rem;
}

.dashboard-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 30px;
  border: 1px solid rgba(79, 70, 229, 0.12);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(239, 246, 255, 0.96));
  box-shadow: 0 28px 58px rgba(15, 23, 42, 0.09);
}

.dashboard-hero::before,
.dashboard-hero::after {
  content: '';
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
  z-index: -1;
}

.dashboard-hero::before {
  top: -18%;
  right: -10%;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.22), rgba(99, 102, 241, 0) 70%);
}

.dashboard-hero::after {
  bottom: -26%;
  left: -10%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.16), rgba(6, 182, 212, 0) 70%);
}

.dashboard-hero-body {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(260px, 1fr);
  gap: 1rem;
  align-items: stretch;
}

.dashboard-hero-kicker {
  display: inline-flex;
  align-items: center;
  padding: .35rem .65rem;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.1);
  color: #4338ca;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.dashboard-hero-title {
  margin: .8rem 0 .45rem;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 900;
  letter-spacing: -.03em;
  color: #0f172a;
}

.dashboard-hero-copy {
  max-width: 60ch;
  margin-bottom: .95rem;
  color: #475569;
  line-height: 1.55;
}

.dashboard-delta-row {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
}

.dashboard-delta-pill {
  display: inline-flex;
  align-items: center;
  padding: .48rem .78rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .01em;
}

.dashboard-delta-pill.is-positive {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
}

.dashboard-delta-pill.is-negative {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}

.dashboard-hero-side {
  display: grid;
  gap: .75rem;
}

.dashboard-side-card {
  padding: .9rem 1rem;
  border: 1px solid #dbe4f2;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.dashboard-side-card:hover {
  transform: translateY(-2px);
  border-color: rgba(165, 180, 252, 0.7);
  box-shadow: 0 18px 32px rgba(15, 23, 42, 0.08);
}

.dashboard-side-label {
  margin-bottom: .35rem;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #64748b;
}

.dashboard-side-value {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
}

.dashboard-hero-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
}

.dashboard-hero-chip {
  padding: .9rem 1rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.06);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.dashboard-hero-chip:hover {
  transform: translateY(-2px);
  border-color: rgba(191, 219, 254, 0.9);
  box-shadow: 0 22px 36px rgba(15, 23, 42, 0.08);
}

.dashboard-hero-chip-label {
  display: block;
  margin-bottom: .35rem;
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #64748b;
}

.dashboard-hero-chip strong {
  display: block;
  color: #0f172a;
  font-size: 1rem;
  line-height: 1.25;
}

.dashboard-hero-chip.is-positive {
  border-color: rgba(16, 185, 129, 0.38);
  background: linear-gradient(180deg, rgba(236, 253, 245, 0.92), rgba(220, 252, 231, 0.86));
}

.dashboard-hero-chip.is-positive .dashboard-hero-chip-label,
.dashboard-hero-chip.is-positive strong {
  color: #065f46;
}

.dashboard-hero-chip.is-negative {
  border-color: rgba(239, 68, 68, 0.34);
  background: linear-gradient(180deg, rgba(254, 242, 242, 0.95), rgba(254, 226, 226, 0.9));
}

.dashboard-hero-chip.is-negative .dashboard-hero-chip-label,
.dashboard-hero-chip.is-negative strong {
  color: #991b1b;
}

.dashboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: .9rem;
}

.dashboard-kpi-card {
  position: relative;
  overflow: hidden;
  padding: 1rem;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.94));
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.06);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.dashboard-kpi-card:hover {
  transform: translateY(-4px);
  border-color: rgba(191, 219, 254, 0.92);
  box-shadow: 0 26px 42px rgba(15, 23, 42, 0.1);
}

.dashboard-kpi-card::after {
  content: '';
  position: absolute;
  inset: auto -12% -38% auto;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0));
}

.dashboard-kpi-card::before {
  content: '';
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.9), rgba(99, 102, 241, 0.55), rgba(255, 255, 255, 0));
  opacity: .92;
}

.dashboard-kpi-card.theme-indigo {
  background: linear-gradient(180deg, rgba(238, 242, 255, 0.98), rgba(255, 255, 255, 0.95));
}

.dashboard-kpi-card.theme-cyan {
  background: linear-gradient(180deg, rgba(236, 254, 255, 0.98), rgba(255, 255, 255, 0.95));
}

.dashboard-kpi-card.theme-amber {
  background: linear-gradient(180deg, rgba(255, 251, 235, 0.98), rgba(255, 255, 255, 0.95));
}

.dashboard-kpi-card.theme-emerald {
  background: linear-gradient(180deg, rgba(236, 253, 245, 0.98), rgba(255, 255, 255, 0.95));
}

.dashboard-kpi-card.theme-rose {
  background: linear-gradient(180deg, rgba(255, 241, 242, 0.98), rgba(255, 255, 255, 0.95));
}

.dashboard-kpi-card.theme-slate {
  background: linear-gradient(180deg, rgba(241, 245, 249, 0.98), rgba(255, 255, 255, 0.95));
}

.dashboard-kpi-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: .85rem;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
  font-size: 1.1rem;
}

.dashboard-kpi-label {
  margin-bottom: .35rem;
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #64748b;
}

.dashboard-kpi-value {
  margin-bottom: .25rem;
  font-size: clamp(1.15rem, 2vw, 1.65rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -.03em;
  color: #0f172a;
}

.dashboard-kpi-meta {
  font-size: .84rem;
  color: #475569;
}

.dashboard-panel-footer {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
  margin-top: .25rem;
}

.dashboard-footer-chip {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  padding: .75rem .8rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.92);
}

.dashboard-footer-chip span {
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #64748b;
}

.dashboard-footer-chip strong {
  color: #0f172a;
  font-size: .96rem;
  font-weight: 800;
}

.dashboard-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 24px;
  box-shadow: 0 22px 42px rgba(15, 23, 42, 0.08);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.dashboard-panel:hover,
.dashboard-insight-card:hover {
  transform: translateY(-3px);
  border-color: rgba(191, 219, 254, 0.9);
  box-shadow: 0 28px 48px rgba(15, 23, 42, 0.1);
}

.dashboard-panel-primary {
  background:
    radial-gradient(circle at bottom left, rgba(244, 114, 182, 0.16), rgba(244, 114, 182, 0) 24%),
    radial-gradient(circle at top right, rgba(96, 165, 250, 0.26), rgba(96, 165, 250, 0) 36%),
    linear-gradient(180deg, rgba(248, 250, 255, 0.98), rgba(255, 255, 255, 0.96));
}

.dashboard-panel-soft {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96));
}

.dashboard-panel-ops {
  background:
    radial-gradient(circle at top left, rgba(251, 191, 36, 0.16), rgba(251, 191, 36, 0) 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 250, 251, 0.96));
}

.dashboard-panel-body,
.dashboard-insight-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.2rem;
}

.dashboard-panel-header,
.dashboard-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.dashboard-panel-kicker {
  display: inline-flex;
  align-items: center;
  padding: .35rem .65rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  color: #334155;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.dashboard-panel-title {
  margin: .65rem 0 .3rem;
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: -.03em;
  color: #0f172a;
}

.dashboard-panel-copy {
  margin: 0;
  max-width: 58ch;
  color: #475569;
  line-height: 1.55;
}

.dashboard-panel-badge {
  align-self: flex-start;
  padding: .45rem .72rem;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.08);
  color: #4338ca;
  font-size: .76rem;
  font-weight: 800;
}

.dashboard-panel-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
  min-width: min(100%, 420px);
}

.dashboard-panel-stat {
  padding: .9rem;
  border: 1px solid rgba(219, 228, 242, 0.95);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
}

.dashboard-panel-stat-label {
  display: block;
  margin-bottom: .42rem;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #64748b;
}

.dashboard-panel-stat strong {
  display: block;
  color: #0f172a;
  font-size: 1.08rem;
  line-height: 1.2;
}

.dashboard-panel-stat small {
  color: #64748b;
}

.dashboard-chart-stage {
  min-height: 330px;
  padding: .7rem;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(241, 245, 249, 0.6));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.dashboard-panel-footer {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
}

.dashboard-footer-chip {
  padding: .88rem .95rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(226, 232, 240, 0.95);
}

.dashboard-footer-chip span {
  display: block;
  margin-bottom: .3rem;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #64748b;
}

.dashboard-footer-chip strong {
  color: #0f172a;
  font-size: 1rem;
}

.dashboard-insight-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 24px;
  background:
    radial-gradient(circle at bottom right, rgba(244, 114, 182, 0.14), rgba(244, 114, 182, 0) 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96));
  box-shadow: 0 22px 42px rgba(15, 23, 42, 0.08);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.dashboard-ring-list {
  display: grid;
  gap: .85rem;
}

.dashboard-ring-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .9rem;
  align-items: center;
  padding: .9rem;
  border-radius: 20px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: rgba(255, 255, 255, 0.82);
}

.dashboard-ring-visual {
  --dashboard-ring-color: #4f46e5;
  --dashboard-progress: 0;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: conic-gradient(var(--dashboard-ring-color) calc(var(--dashboard-progress) * 1%), rgba(226, 232, 240, 0.92) 0);
}

.dashboard-ring-visual::after {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: #ffffff;
}

.dashboard-ring-visual span {
  position: relative;
  z-index: 1;
  font-size: .92rem;
  font-weight: 900;
  color: #0f172a;
}

.dashboard-ring-visual.theme-emerald {
  --dashboard-ring-color: #10b981;
}

.dashboard-ring-visual.theme-cyan {
  --dashboard-ring-color: #06b6d4;
}

.dashboard-ring-visual.theme-indigo {
  --dashboard-ring-color: #4f46e5;
}

.dashboard-ring-label {
  margin-bottom: .2rem;
  font-size: .92rem;
  font-weight: 800;
  color: #0f172a;
}

.dashboard-ring-copy {
  color: #64748b;
  line-height: 1.45;
}

.dashboard-comparison-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
}

.dashboard-comparison-card {
  padding: .95rem;
  border-radius: 18px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: rgba(255, 255, 255, 0.82);
  transition: transform .18s ease, box-shadow .18s ease;
}

.dashboard-comparison-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(15, 23, 42, 0.08);
}

.dashboard-comparison-card span {
  display: block;
  margin-bottom: .35rem;
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #64748b;
}

.dashboard-comparison-card strong {
  display: block;
  margin-bottom: .18rem;
  font-size: 1.08rem;
  color: #0f172a;
}

[data-dashboard-reveal] {
  opacity: 0;
  transform: translateY(18px) scale(.985);
  transition: opacity .45s ease, transform .45s ease;
}

[data-dashboard-reveal].is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@media (prefers-reduced-motion: reduce) {
  [data-dashboard-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .dashboard-kpi-card,
  .dashboard-panel,
  .dashboard-insight-card,
  .dashboard-side-card,
  .dashboard-hero-chip,
  .dashboard-quick-filter,
  .dashboard-comparison-card {
    transition: none;
  }
}

.dashboard-comparison-card small {
  color: #64748b;
}

.dashboard-comparison-card.is-positive {
  background: linear-gradient(180deg, rgba(236, 253, 245, 0.94), rgba(255, 255, 255, 0.9));
}

.dashboard-comparison-card.is-negative {
  background: linear-gradient(180deg, rgba(254, 242, 242, 0.94), rgba(255, 255, 255, 0.9));
}

.dashboard-payment-chart,
.dashboard-top-chart {
  min-height: 240px;
}

.dashboard-payment-list,
.dashboard-ranking-list,
.dashboard-ops-list {
  display: grid;
  gap: .75rem;
}

.dashboard-payment-item,
.dashboard-ranking-item {
  display: grid;
  gap: .45rem;
}

.dashboard-payment-head,
.dashboard-ranking-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  color: #334155;
  font-size: .92rem;
}

.dashboard-payment-head strong,
.dashboard-ranking-head strong {
  color: #0f172a;
}

.dashboard-progress-track {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.96);
}

.dashboard-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4f46e5, #06b6d4);
}

.dashboard-progress-track.is-rose span {
  background: linear-gradient(90deg, #fb7185, #f97316);
}

.dashboard-ops-summary {
  display: grid;
  gap: .9rem;
}

.dashboard-ops-card {
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid rgba(226, 232, 240, 0.95);
}

.dashboard-ops-card.state-open {
  background: linear-gradient(180deg, rgba(236, 253, 245, 0.98), rgba(255, 255, 255, 0.94));
}

.dashboard-ops-card.state-closed {
  background: linear-gradient(180deg, rgba(255, 247, 237, 0.98), rgba(255, 255, 255, 0.94));
}

.dashboard-ops-label {
  display: block;
  margin-bottom: .35rem;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #64748b;
}

.dashboard-ops-card strong {
  display: block;
  margin-bottom: .2rem;
  font-size: 1rem;
  color: #0f172a;
}

.dashboard-ops-card small {
  color: #64748b;
}

.dashboard-ops-action {
  width: fit-content;
}

.dashboard-ops-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .75rem;
  align-items: flex-start;
}

.dashboard-ops-bullet {
  width: 12px;
  height: 12px;
  margin-top: .35rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

.dashboard-ops-content strong {
  display: block;
  margin-bottom: .2rem;
  color: #0f172a;
}

.dashboard-ops-content span {
  color: #64748b;
  line-height: 1.45;
}

.report-hero {
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
}

.report-hero-sales {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(238, 248, 255, 0.96));
}

.report-hero-cash {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(240, 253, 244, 0.96));
}

.report-hero-inventory {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 251, 235, 0.97));
}

.report-hero-users {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(239, 246, 255, 0.97));
}

.report-hero-permissions {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(243, 232, 255, 0.97));
}

.report-hero-settings {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(236, 253, 245, 0.97));
}

.report-hero-company {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(240, 249, 255, 0.97));
}

.report-hero-backups {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(239, 246, 255, 0.96));
}

.report-hero-alerts {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(254, 242, 242, 0.97));
}

.report-hero-tax {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(243, 244, 246, 0.97));
}

.report-hero-payables {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 247, 237, 0.97));
}

.report-hero-audits {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(238, 242, 255, 0.97));
}

.report-hero-suppliers {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(240, 253, 250, 0.97));
}

.report-hero-tax-settings {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(243, 244, 246, 0.97));
}

.report-hero-cancel-sales {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(254, 242, 242, 0.97));
}

.report-hero-sale-detail {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(239, 246, 255, 0.97));
}

.report-hero-returns {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(240, 253, 250, 0.97));
}

.report-hero-charge {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(236, 253, 245, 0.97));
}

.report-hero-tax-type {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(243, 244, 246, 0.97));
}

.report-hero-purchases {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 247, 237, 0.97));
}

.report-hero-cash-ops {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(238, 242, 255, 0.97));
}

.report-hero-cash-open {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(236, 253, 245, 0.97));
}

.report-hero-cash-close {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(254, 242, 242, 0.97));
}

.report-hero-body {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(240px, .95fr);
  gap: 1rem;
  align-items: stretch;
}

.report-hero-kicker {
  display: inline-flex;
  align-items: center;
  padding: .35rem .65rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  color: #334155;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.report-hero-title {
  margin: .8rem 0 .45rem;
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  font-weight: 900;
  letter-spacing: -.03em;
  color: #0f172a;
}

.report-hero-copy {
  max-width: 62ch;
  margin-bottom: .95rem;
  color: #475569;
  line-height: 1.55;
}

.report-hero-strip {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
}

.report-hero-pill {
  display: inline-flex;
  align-items: center;
  padding: .5rem .8rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.24);
  color: #334155;
  font-size: .8rem;
  font-weight: 800;
}

.report-hero-side {
  display: grid;
  gap: .75rem;
}

.report-hero-stat {
  padding: .95rem 1rem;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.8);
}

.report-hero-stat-label {
  margin-bottom: .35rem;
  color: #64748b;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.report-hero-stat-value {
  color: #0f172a;
  font-size: 1.05rem;
  font-weight: 800;
}

.report-toolbar {
  border-radius: 20px;
}

.report-toolbar-body {
  padding: .95rem 1rem;
}

.report-toolbar-note {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: .7rem .9rem;
  border: 1px dashed #cad8ee;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  color: #475569;
  font-size: .9rem;
}

.report-card {
  border-radius: 20px;
  overflow: hidden;
}

.table thead th {
  padding: .78rem .82rem;
  border-bottom: 0;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.table tbody td {
  padding: .8rem .82rem;
  vertical-align: middle;
}

.table tbody tr {
  transition: background-color .18s ease, box-shadow .18s ease;
}

.table td .btn,
.table td .btn-sm {
  border-radius: 10px;
}

@media (max-width: 767.98px) {
  .overview-grid {
    grid-template-columns: 1fr;
    gap: .75rem;
  }

  .dashboard-kpi-grid,
  .dashboard-panel-stats,
  .dashboard-panel-footer,
  .dashboard-comparison-grid,
  .dashboard-hero-strip {
    grid-template-columns: 1fr;
  }

  .dashboard-panel-header,
  .dashboard-card-heading,
  .dashboard-ring-item {
    grid-template-columns: 1fr;
    display: grid;
  }

  .dashboard-kpi-card,
  .dashboard-panel,
  .dashboard-insight-card {
    border-radius: 20px;
  }

  .dashboard-chart-stage {
    min-height: 280px;
  }

  .overview-card {
    padding: .85rem .9rem;
    border-radius: 16px;
  }

  .banner-note {
    min-height: 0;
    padding: .65rem .75rem;
    font-size: .85rem;
  }

  .settings-panel {
    padding: .85rem;
    border-radius: 16px;
  }

  .dashboard-period-card-body {
    padding: .75rem .8rem;
  }

  .dashboard-period-note {
    min-height: 0;
    font-size: .8rem;
  }

  .dashboard-hero-body {
    grid-template-columns: 1fr;
  }

  .dashboard-hero-title {
    font-size: 1.7rem;
  }

  .dashboard-side-card {
    border-radius: 16px;
  }

  .report-hero-body {
    grid-template-columns: 1fr;
  }

  .report-hero-title {
    font-size: 1.65rem;
  }

  .report-toolbar-note {
    min-height: 0;
  }

  .inline-mobile-form {
    flex-wrap: wrap;
  }

  .section-subtitle {
    margin-bottom: .8rem;
  }

  .card-header {
    min-height: 52px;
    padding: .75rem .8rem;
  }

  .card-body {
    padding: .8rem;
  }

  .table thead th,
  .table tbody td {
    padding: .55rem .5rem;
  }
}

/* ===== Mobile Fit Patch ===== */
@media (max-width: 767.98px) {
  html,
  body,
  .app-layout,
  .content-wrap,
  .main-shell {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .content-wrap {
    padding: 0;
  }

  .topbar {
    padding-left: .5rem;
    padding-right: .5rem;
  }

  .topbar .ms-auto {
    min-width: 0;
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: .45rem !important;
  }

  .topbar .navbar-text {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    font-size: .76rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar .navbar-text .badge-soft {
    margin-right: .35rem !important;
  }

  .topbar .btn-logout {
    min-width: 72px;
    padding-left: .75rem;
    padding-right: .75rem;
  }

  .sidebar {
    width: min(272px, 84vw);
    max-width: 84vw;
    overflow-x: hidden;
  }

  .sidebar-nav {
    padding: .65rem;
  }

  .sidebar-link,
  .sidebar-toggle,
  .sidebar-sublink {
    min-height: 40px;
    padding: .6rem .7rem;
    font-size: .97rem;
  }

  .sidebar-submenu .sidebar-sublink {
    margin-left: .7rem;
    width: calc(100% - .7rem);
  }

  .sidebar-credit {
    margin: .35rem .65rem .8rem;
    padding: .8rem;
  }

  .dashboard-hero-body,
  .report-hero-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-delta-row,
  .report-hero-strip {
    gap: .45rem;
  }

  .dashboard-delta-pill,
  .report-hero-pill {
    max-width: 100%;
    font-size: .76rem;
  }
}

@media (max-width: 420px) {
  .topbar .navbar-text {
    font-size: .72rem;
  }

  .topbar .navbar-text .badge-soft + * {
    display: none;
  }

  .sidebar {
    width: min(250px, 82vw);
    max-width: 82vw;
  }

  .page-title {
    line-height: 1.15;
  }
}

/* ===== Global Mobile Lockdown ===== */
@media (max-width: 767.98px) {
  body {
    overflow-x: hidden !important;
  }

  .app-layout {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  .content-wrap {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 0 !important;
    overflow-x: hidden !important;
  }

  .main-shell,
  .main-shell.container-fluid {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding-left: .55rem !important;
    padding-right: .55rem !important;
    overflow-x: hidden !important;
  }

  .topbar {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 0 .35rem 0 !important;
    padding: .45rem .5rem !important;
    gap: .45rem !important;
  }

  .topbar .ms-auto {
    width: 100% !important;
    min-width: 0 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    justify-content: initial !important;
    gap: .45rem !important;
  }

  .topbar .navbar-text {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    font-size: .74rem !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .topbar .btn,
  .topbar .btn-logout {
    min-height: 34px !important;
    padding: .35rem .7rem !important;
    font-size: .84rem !important;
  }

  .sidebar {
    width: 78vw !important;
    max-width: 278px !important;
    min-width: 0 !important;
    border-radius: 0 !important;
    overflow-x: hidden !important;
  }

  .sidebar-nav {
    padding: .6rem !important;
  }

  .sidebar-link,
  .sidebar-toggle,
  .sidebar-sublink {
    min-height: 39px !important;
    padding: .58rem .68rem !important;
    font-size: .95rem !important;
  }

  .sidebar-icon {
    min-width: 24px !important;
    width: 24px !important;
    height: 24px !important;
    margin-right: .45rem !important;
  }

  .sidebar-submenu {
    padding-left: .2rem !important;
  }

  .sidebar-submenu .sidebar-sublink {
    margin-left: .45rem !important;
    width: calc(100% - .45rem) !important;
  }

  .sidebar-credit {
    margin: .35rem .6rem .75rem !important;
    padding: .75rem !important;
    overflow: hidden !important;
  }

  .sidebar-credit-name,
  .sidebar-credit-phone {
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }

  .row {
    --bs-gutter-x: .7rem !important;
    --bs-gutter-y: .7rem !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
  }

  .row > * {
    max-width: 100% !important;
  }

  .card,
  .dashboard-hero,
  .report-hero,
  .surface-banner,
  .summary-box,
  .invoice-sheet,
  .cash-receipt-sheet {
    width: 100% !important;
    max-width: 100% !important;
  }

  .dashboard-hero-body,
  .report-hero-body,
  .overview-grid,
  .cash-kpi-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .dashboard-delta-row,
  .report-hero-strip {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: .42rem !important;
  }

  .dashboard-delta-pill,
  .report-hero-pill {
    justify-content: center !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

@media (max-width: 420px) {
  .main-shell,
  .main-shell.container-fluid {
    padding-left: .42rem !important;
    padding-right: .42rem !important;
  }

  .topbar .navbar-text {
    font-size: .7rem !important;
  }

  .sidebar {
    width: 74vw !important;
    max-width: 248px !important;
  }
}

/* ===== Device Adaptive Refinement ===== */
.topbar-usertext {
  min-width: 0;
}

.topbar-role,
.topbar-username {
  vertical-align: middle;
}

@media (max-width: 1199.98px) {
  .report-hero-body,
  .dashboard-hero-body {
    grid-template-columns: minmax(0, 1.3fr) minmax(220px, .9fr);
  }

  .dashboard-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-panel-header {
    flex-direction: column;
  }

  .dashboard-panel-stats {
    min-width: 0;
    width: 100%;
  }

  .overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 991.98px) {
  .main-shell,
  .main-shell.container-fluid {
    padding-left: .75rem !important;
    padding-right: .75rem !important;
  }

  .sidebar {
    width: min(320px, 82vw) !important;
    max-width: 82vw !important;
  }

  .report-hero-body,
  .dashboard-hero-body,
  .overview-grid,
  .cash-kpi-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .dashboard-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-hero-strip,
  .dashboard-comparison-grid,
  .dashboard-panel-footer {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar-usertext {
    max-width: min(48vw, 320px);
  }

  .topbar-username {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 767.98px) {
  .overview-grid {
    grid-template-columns: 1fr !important;
  }

  .topbar-usertext {
    display: flex !important;
    align-items: center;
    gap: .35rem;
    max-width: 100% !important;
  }

  .topbar-role {
    flex: 0 0 auto;
  }

  .topbar-username {
    flex: 1 1 auto;
    min-width: 0;
  }

  .dashboard-hero-title,
  .report-hero-title {
    font-size: clamp(1.45rem, 8vw, 1.8rem) !important;
    line-height: 1.08;
  }

  .dashboard-hero-copy,
  .report-hero-copy,
  .overview-note,
  .banner-note,
  .report-toolbar-note {
    font-size: .88rem !important;
    line-height: 1.45;
    max-width: 100% !important;
  }

  .metric-card .metric-value,
  .overview-value,
  .dashboard-side-value,
  .report-hero-stat-value {
    word-break: break-word;
  }
}

@media (max-width: 575.98px) {
  .topbar {
    border-radius: 0 !important;
  }

  .topbar .ms-auto {
    grid-template-columns: minmax(0, 1fr) auto !important;
  }

  .topbar-usertext {
    font-size: .74rem !important;
  }

  .topbar-username {
    max-width: 100%;
  }

  .sidebar {
    width: min(265px, 78vw) !important;
    max-width: 78vw !important;
  }

  .sidebar-credit-title,
  .sidebar-credit-name,
  .sidebar-credit-phone {
    font-size: .76rem !important;
  }
}

@media (max-width: 420px) {
  .topbar-username {
    display: none;
  }

  .topbar-usertext {
    justify-content: flex-start;
  }

  .topbar-role {
    margin-right: 0 !important;
  }

  .dashboard-delta-pill,
  .report-hero-pill {
    font-size: .73rem !important;
    padding: .45rem .65rem !important;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .sidebar {
    width: min(250px, 74vw) !important;
  }

  .sidebar-brand {
    padding: .8rem .9rem !important;
  }

  .sidebar-link,
  .sidebar-toggle,
  .sidebar-sublink {
    min-height: 36px !important;
    padding-top: .45rem !important;
    padding-bottom: .45rem !important;
  }

  .sidebar-credit {
    padding: .65rem !important;
  }
}

@media (max-width: 991.98px) {
  .content-wrap {
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }

  .main-shell,
  .main-shell.container-fluid {
    padding-bottom: calc(.75rem + env(safe-area-inset-bottom, 0px)) !important;
  }

  .sidebar {
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .sidebar-credit {
    margin-bottom: calc(.8rem + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 767.98px) {
  .topbar {
    padding-top: calc(.45rem + env(safe-area-inset-top, 0px)) !important;
    padding-right: calc(.5rem + env(safe-area-inset-right, 0px)) !important;
    padding-left: calc(.5rem + env(safe-area-inset-left, 0px)) !important;
  }

  .main-shell,
  .main-shell.container-fluid {
    padding-left: calc(.55rem + env(safe-area-inset-left, 0px)) !important;
    padding-right: calc(.55rem + env(safe-area-inset-right, 0px)) !important;
  }
}
