:root {
  --sidebar-width: 264px;
  --sidebar-collapsed-width: 84px;
  --accessibility-component-min-font: 0.88rem;
  --accessibility-control-min-font: 0.94rem;
  --bg: #f6f8ff;
  --surface: #ffffff;
  --surface-2: #eef6fb;
  --text: #071126;
  --muted: #637188;
  --border: #d8e1ee;
  --sidebar-bg: #041421;
  --sidebar-text: #f7f5ff;
  --sidebar-muted: #a9c1d7;
  --sidebar-active: #123044;
  --primary: #6d28d9;
  --primary-hover: #5b21b6;
  --primary-rgb: 109, 40, 217;
  --primary-text: #ffffff;
  --accent: #06b6d4;
  --accent-rgb: 6, 182, 212;
  --accent-soft: rgba(6, 182, 212, 0.12);
  --success: #16a34a;
  --success-rgb: 22, 163, 74;
  --warning: #f59e0b;
  --warning-rgb: 245, 158, 11;
  --danger: #ef4444;
  --danger-rgb: 239, 68, 68;
  --info: #2563eb;
  --info-rgb: 37, 99, 235;
  --shadow: 0 16px 40px rgba(7, 17, 38, 0.1);
}

[data-theme='dark'] {
  --bg: #050b16;
  --surface: #0b1424;
  --surface-2: #122033;
  --text: #f7fbff;
  --muted: #9fb0c3;
  --border: #26364d;
  --sidebar-bg: #030d18;
  --sidebar-text: #f7f5ff;
  --sidebar-muted: #9bb8ce;
  --sidebar-active: #102b3c;
  --primary: #8b5cf6;
  --primary-hover: #a78bfa;
  --primary-rgb: 139, 92, 246;
  --primary-text: #ffffff;
  --accent: #22d3ee;
  --accent-rgb: 34, 211, 238;
  --accent-soft: rgba(34, 211, 238, 0.12);
  --success: #22c55e;
  --success-rgb: 34, 197, 94;
  --warning: #fbbf24;
  --warning-rgb: 251, 191, 36;
  --danger: #fb7185;
  --danger-rgb: 251, 113, 133;
  --info: #60a5fa;
  --info-rgb: 96, 165, 250;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.36);
}

html,
body,
.app-shell,
.main-content,
.topbar,
.card,
.form-control,
.form-select,
.table,
.modal-content {
  transition: background-color 220ms ease, color 180ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

@media (prefers-reduced-motion: reduce) {
  html,
  body,
  .app-shell,
  .main-content,
  .topbar,
  .card,
  .form-control,
  .form-select,
  .table,
  .modal-content,
  .theme-toggle-thumb,
  .theme-toggle-icon {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

html[data-text-scale='large'] {
  --accessibility-component-min-font: 0.98rem;
  --accessibility-control-min-font: 1.02rem;
  font-size: 17.5px;
}

html[data-text-scale='extra'] {
  --accessibility-component-min-font: 1.04rem;
  --accessibility-control-min-font: 1.08rem;
  font-size: 19px;
}

@media (max-width: 1500px) {
  html[data-text-scale='large'] {
    font-size: 16.8px;
  }

  html[data-text-scale='extra'] {
    font-size: 18px;
  }
}

@media (max-width: 1200px) {
  html[data-text-scale='large'] {
    font-size: 16.25px;
  }

  html[data-text-scale='extra'] {
    font-size: 17px;
  }
}

@media (max-width: 900px) {
  html[data-text-scale='large'],
  html[data-text-scale='extra'] {
    font-size: 16px;
  }
}

html[data-accessibility-bold='true'] body,
html[data-accessibility-bold='true'] button,
html[data-accessibility-bold='true'] input,
html[data-accessibility-bold='true'] select,
html[data-accessibility-bold='true'] textarea,
html[data-accessibility-bold='true'] a,
html[data-accessibility-bold='true'] span,
html[data-accessibility-bold='true'] small,
html[data-accessibility-bold='true'] th,
html[data-accessibility-bold='true'] td,
html[data-accessibility-bold='true'] .badge,
html[data-accessibility-bold='true'] .form-control,
html[data-accessibility-bold='true'] .form-select,
html[data-accessibility-bold='true'] .dropdown-item,
html[data-accessibility-bold='true'] .action-button,
html[data-accessibility-bold='true'] .user-menu-link,
html[data-accessibility-bold='true'] .user-theme-choice,
html[data-accessibility-bold='true'] .settings-tab-button,
html[data-accessibility-bold='true'] .accessibility-choice {
  font-weight: 700 !important;
}

html[data-accessibility-bold='true'] h1,
html[data-accessibility-bold='true'] h2,
html[data-accessibility-bold='true'] h3,
html[data-accessibility-bold='true'] h4,
html[data-accessibility-bold='true'] h5,
html[data-accessibility-bold='true'] h6,
html[data-accessibility-bold='true'] strong,
html[data-accessibility-bold='true'] label,
html[data-accessibility-bold='true'] .btn,
html[data-accessibility-bold='true'] .sidebar-link,
html[data-accessibility-bold='true'] .nav-link {
  font-weight: 900 !important;
}

html[data-accessibility-enabled='true'] :where(
  .badge,
  .status-badge,
  .btn,
  .action-button,
  .form-control,
  .form-select,
  .nav-link,
  .user-menu-button,
  .user-menu-link,
  .user-theme-choice,
  .settings-tab-button,
  .accessibility-choice,
  .sales-column-filter summary,
  .sales-column-search span,
  .table th,
  .table td,
  .sales-table th,
  .sales-table td,
  .compact-table th,
  .compact-table td,
  .summary-card,
  .stat-card,
  .metric-card,
  .timeline-item,
  .payment-badge
) {
  font-size: max(1em, var(--accessibility-component-min-font));
  line-height: 1.35;
}

html[data-accessibility-enabled='true'] :where(
  button,
  input,
  select,
  textarea,
  .btn,
  .form-control,
  .form-select,
  .action-button,
  .user-menu-button,
  .accessibility-choice
) {
  font-size: max(1em, var(--accessibility-control-min-font));
}

html[data-accessibility-enabled='true'] :where(
  .text-muted,
  .user-menu-identity small,
  .user-accessibility-summary,
  .card small,
  .badge,
  .table small,
  .sales-table small
) {
  font-size: max(1em, var(--accessibility-component-min-font));
}

[data-theme='light'][data-contrast='high'] {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef2ff;
  --text: #000000;
  --muted: #172554;
  --border: #1d4ed8;
  --primary: #4c1d95;
  --primary-hover: #2e1065;
  --primary-rgb: 76, 29, 149;
  --accent: #0369a1;
  --accent-rgb: 3, 105, 161;
  --accent-soft: rgba(3, 105, 161, 0.18);
  --success: #047857;
  --success-rgb: 4, 120, 87;
  --warning: #b45309;
  --warning-rgb: 180, 83, 9;
  --danger: #b91c1c;
  --danger-rgb: 185, 28, 28;
  --info: #1d4ed8;
  --info-rgb: 29, 78, 216;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
}

[data-theme='dark'][data-contrast='high'] {
  --bg: #000000;
  --surface: #020617;
  --surface-2: #07111f;
  --text: #ffffff;
  --muted: #dbeafe;
  --border: #60a5fa;
  --primary: #fbbf24;
  --primary-hover: #fde68a;
  --primary-rgb: 251, 191, 36;
  --primary-text: #020617;
  --accent: #38bdf8;
  --accent-rgb: 56, 189, 248;
  --accent-soft: rgba(56, 189, 248, 0.18);
  --success: #4ade80;
  --success-rgb: 74, 222, 128;
  --warning: #facc15;
  --warning-rgb: 250, 204, 21;
  --danger: #f87171;
  --danger-rgb: 248, 113, 113;
  --info: #93c5fd;
  --info-rgb: 147, 197, 253;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
}

[data-theme='light'][data-contrast='soft'] {
  --bg: #f8fbff;
  --surface: #ffffff;
  --surface-2: #f1f7fb;
  --text: #102033;
  --muted: #6a7b8d;
  --border: #d9e6f2;
  --primary: #7c3aed;
  --primary-hover: #6d28d9;
  --primary-rgb: 124, 58, 237;
  --accent: #0ea5e9;
  --accent-rgb: 14, 165, 233;
  --accent-soft: rgba(14, 165, 233, 0.1);
}

[data-theme='dark'][data-contrast='soft'] {
  --bg: #07111f;
  --surface: #102033;
  --surface-2: #172a40;
  --text: #f1f7ff;
  --muted: #b5c5d6;
  --border: #33485f;
  --primary: #a78bfa;
  --primary-hover: #c4b5fd;
  --primary-rgb: 167, 139, 250;
  --accent: #67e8f9;
  --accent-rgb: 103, 232, 249;
  --accent-soft: rgba(103, 232, 249, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 1rem;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(var(--accent-rgb), 0.12), transparent 32rem),
    radial-gradient(circle at bottom left, rgba(var(--warning-rgb), 0.08), transparent 28rem),
    var(--bg);
}

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  min-height: 100vh;
  flex: 0 0 var(--sidebar-width);
  background: linear-gradient(180deg, #031525 0%, var(--sidebar-bg) 56%, #160b2f 100%);
  color: var(--sidebar-text);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  contain: inline-size layout paint;
}

.app-shell.sidebar-animating .sidebar {
  transition: none;
}

.app-shell.sidebar-animating .sidebar-toggle span {
  transition: transform 160ms ease;
}

.app-shell.sidebar-animating .brand-block,
.app-shell.sidebar-animating .nav-label {
  transition: opacity 140ms ease, transform 140ms ease;
}

.app-shell.sidebar-animating.sidebar-collapsed .brand-block,
.app-shell.sidebar-animating.sidebar-collapsed .nav-label {
  opacity: 0;
  transform: translateX(-0.35rem);
}

.app-shell.sidebar-collapsed .sidebar,
html[data-sidebar-state='collapsed'] .app-shell .sidebar,
body.sidebar-navigation-lock .app-shell .sidebar {
  width: var(--sidebar-collapsed-width) !important;
  min-width: var(--sidebar-collapsed-width) !important;
  max-width: var(--sidebar-collapsed-width) !important;
  flex: 0 0 var(--sidebar-collapsed-width) !important;
  overflow: hidden !important;
}

.sidebar-sticky {
  position: sticky;
  top: 0;
  padding: 1.5rem;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.brand-logo {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  object-fit: contain;
  border-radius: 0.5rem;
  background: transparent;
}

.brand-copy {
  min-width: 0;
}

.brand-block h4 {
  margin-bottom: 0.25rem;
  white-space: nowrap;
  color: var(--sidebar-text);
  font-weight: 900;
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.login-brand > div {
  min-width: 0;
}

.login-brand-logo {
  width: 76px;
  height: 76px;
  flex: 0 0 76px;
  object-fit: contain;
  border-radius: 0.5rem;
  background: transparent;
  box-shadow: none;
}

.login-brand h2 {
  margin: 0;
}

.login-brand-logo-horizontal {
  width: min(100%, 430px);
  height: auto;
  max-height: 150px;
  object-fit: contain;
}

.login-brand h2 {
  font-weight: 900;
}

.login-tab-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
}

.login-tab-nav .nav-item {
  min-width: 0;
}

.login-tab-nav .settings-tab-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  border-color: var(--border);
  background: transparent;
  color: var(--muted);
  text-align: center;
  box-shadow: none;
}

.login-tab-nav .settings-tab-button:hover,
.login-tab-nav .settings-tab-button:focus-visible {
  border-color: var(--primary);
  background: var(--accent-soft);
  color: var(--text);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.14);
}

.login-tab-nav .settings-tab-button.is-active,
.login-tab-nav .settings-tab-button.active {
  border-color: var(--border);
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--sidebar-text);
  font-size: 1.35rem;
  line-height: 1;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
}

.app-shell.sidebar-collapsed .sidebar-header,
html[data-sidebar-state='collapsed'] .app-shell:not(.sidebar-animating) .sidebar-header {
  justify-content: center;
}

.app-shell.sidebar-collapsed .brand-block,
html[data-sidebar-state='collapsed'] .app-shell:not(.sidebar-animating) .brand-block {
  display: none;
}

.text-muted,
.brand-block .text-muted {
  color: var(--muted) !important;
}

.sidebar .text-muted {
  color: var(--sidebar-muted) !important;
}

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 100%;
  color: var(--sidebar-text);
  padding: 0.85rem 0.95rem;
  border-radius: 0.5rem;
  min-height: 44px;
  white-space: nowrap;
  overflow: hidden;
  transition: background-color 120ms ease, color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.sidebar .nav,
.sidebar .nav-item {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text);
  box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar .nav-link:hover {
  transform: translateX(2px);
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font-size: 0;
  font-weight: 700;
  line-height: 1;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.sidebar .nav-link:hover .nav-icon,
.sidebar .nav-link.active .nav-icon {
  border-color: rgba(255, 255, 255, 0.64);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.nav-icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.nav-outline-icon {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-shell.sidebar-collapsed .sidebar-sticky,
html[data-sidebar-state='collapsed'] .app-shell .sidebar-sticky {
  padding: 1rem 0.8rem;
  width: var(--sidebar-collapsed-width);
  min-width: var(--sidebar-collapsed-width);
  max-width: var(--sidebar-collapsed-width);
  overflow: hidden;
}

body.sidebar-navigation-lock .sidebar-sticky,
body.sidebar-navigation-lock .sidebar .nav,
body.sidebar-navigation-lock .sidebar .nav-item,
body.sidebar-navigation-lock .sidebar .nav-link,
.app-shell.sidebar-collapsed .sidebar .nav,
.app-shell.sidebar-collapsed .sidebar .nav-item,
.app-shell.sidebar-collapsed .sidebar .nav-link,
html[data-sidebar-state='collapsed'] .app-shell .sidebar .nav,
html[data-sidebar-state='collapsed'] .app-shell .sidebar .nav-item,
html[data-sidebar-state='collapsed'] .app-shell .sidebar .nav-link {
  min-width: 0 !important;
  max-width: calc(var(--sidebar-collapsed-width) - 1.6rem) !important;
  overflow: hidden !important;
}

.app-shell.sidebar-collapsed .sidebar .nav-link,
html[data-sidebar-state='collapsed'] .app-shell .sidebar .nav-link {
  justify-content: center;
  gap: 0;
  padding: 0.8rem;
  width: calc(var(--sidebar-collapsed-width) - 1.6rem) !important;
  transform: none;
}

.app-shell.sidebar-collapsed .nav-label,
html[data-sidebar-state='collapsed'] .app-shell .nav-label {
  display: none;
}

.app-shell.sidebar-collapsed .nav-icon,
html[data-sidebar-state='collapsed'] .app-shell .nav-icon {
  margin: 0;
}

.app-shell.sidebar-collapsed .sidebar-toggle span,
html[data-sidebar-state='collapsed'] .app-shell .sidebar-toggle span {
  transform: rotate(180deg);
}

.main-content {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  transition: max-width 160ms ease;
}

.content-frame {
  width: min(100%, 1480px);
  margin: 0 auto;
  padding: clamp(1rem, 2vw, 2rem);
}

.topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  min-height: 44px;
}

.topbar-user-area {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  min-width: 0;
}

.topbar-username {
  max-width: min(260px, 40vw);
  color: var(--text);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu {
  position: relative;
  min-width: 0;
}

.user-menu summary {
  list-style: none;
}

.user-menu summary::-webkit-details-marker {
  display: none;
}

.user-menu-button {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 0.65rem;
  min-width: 190px;
  max-width: min(290px, 46vw);
  min-height: 46px;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.user-menu-button:hover,
.user-menu[open] .user-menu-button {
  border-color: var(--accent);
  background: var(--surface-2);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.user-menu-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 0.45rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: var(--primary-text);
  font-size: 0.95rem;
  font-weight: 900;
}

.user-menu-avatar-large {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
  font-size: 1.05rem;
}

.user-menu-identity {
  display: grid;
  min-width: 0;
  text-align: left;
}

.user-menu-identity strong,
.user-menu-identity small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-identity strong {
  font-size: 0.92rem;
  line-height: 1.25;
}

.user-menu-identity small {
  color: var(--muted);
  font-size: 0.76rem;
}

.user-menu-chevron {
  color: var(--muted);
  font-size: 1rem;
  transition: transform 140ms ease;
}

.user-menu[open] .user-menu-chevron {
  transform: rotate(180deg);
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 0.65rem);
  right: 0;
  z-index: 30;
  width: min(290px, calc(100vw - 2rem));
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.user-menu-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.user-menu-header > div {
  display: grid;
  min-width: 0;
}

.user-menu-header strong,
.user-menu-header small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-header small,
.user-menu-label {
  color: var(--muted);
}

.user-menu-section {
  display: grid;
  gap: 0.55rem;
  padding: 0.85rem 1rem 1rem;
}

.user-menu-label {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.user-theme-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.theme-toggle {
  width: 64px;
  height: 36px;
  margin: 0 12px 0 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  transition: border-color 200ms ease, background-color 220ms ease, box-shadow 200ms ease, transform 150ms ease;
}

.login-theme-toggle {
  position: fixed;
  z-index: 20;
  top: 1rem;
  right: 1rem;
}

.login-theme-toggle .theme-toggle {
  margin: 0;
  box-shadow: var(--shadow);
}

.theme-toggle:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.theme-toggle:active {
  transform: scale(0.96);
}

.theme-toggle:focus-visible {
  outline: 3px solid rgba(var(--accent-rgb), 0.34);
  outline-offset: 2px;
}

.theme-toggle-track {
  position: relative;
  width: 54px;
  height: 28px;
  display: block;
}

.theme-toggle-thumb {
  position: absolute;
  z-index: 1;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 3px 9px rgba(7, 17, 38, 0.22);
  transform: translateX(0);
  transition: transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1), background-color 220ms ease;
}

.theme-toggle-icon {
  position: absolute;
  z-index: 2;
  top: 6px;
  width: 16px;
  height: 16px;
  pointer-events: none;
  transition: opacity 180ms ease, transform 240ms ease, color 180ms ease;
}

.theme-toggle-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle-sun {
  left: 6px;
  color: #d97706;
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.theme-toggle-moon {
  right: 6px;
  color: var(--muted);
  opacity: 0.55;
  transform: rotate(-22deg) scale(0.86);
}

[data-theme='dark'] .theme-toggle-thumb {
  transform: translateX(26px);
  background: #17233a;
}

[data-theme='dark'] .theme-toggle-sun {
  opacity: 0.45;
  transform: rotate(55deg) scale(0.82);
  color: var(--muted);
}

[data-theme='dark'] .theme-toggle-moon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
  color: #c4b5fd;
}

@media (max-width: 640px) {
  .theme-toggle {
    width: 58px;
    margin-right: 8px;
  }

  .theme-toggle-track {
    width: 50px;
  }

  [data-theme='dark'] .theme-toggle-thumb {
    transform: translateX(22px);
  }
}

body.has-destructive-confirmation {
  overflow: hidden;
}

.destructive-confirmation-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 3vw, 2rem);
}

.destructive-confirmation-modal.is-open {
  display: flex;
}

.destructive-confirmation-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(5px);
  cursor: default;
}

.destructive-confirmation-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 580px);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid rgba(var(--danger-rgb), 0.48);
  border-radius: 20px;
  background:
    linear-gradient(145deg, rgba(var(--danger-rgb), 0.08), transparent 48%),
    var(--surface);
  color: var(--text);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.48);
}

.destructive-confirmation-heading {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.destructive-confirmation-heading h2 {
  margin: 0;
  font-size: clamp(1.5rem, 1.25rem + 1vw, 2rem);
}

.destructive-confirmation-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border: 1px solid rgba(var(--danger-rgb), 0.5);
  border-radius: 15px;
  background: rgba(var(--danger-rgb), 0.14);
  color: var(--danger);
  font-size: 1.5rem;
  font-weight: 900;
}

.destructive-confirmation-eyebrow {
  display: block;
  margin-bottom: 0.15rem;
  color: var(--danger);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.destructive-confirmation-description {
  margin-bottom: 1rem;
  color: var(--muted);
  line-height: 1.6;
}

.destructive-confirmation-target {
  margin-bottom: 1rem;
  padding: 0.8rem 1rem;
  border: 1px solid rgba(var(--danger-rgb), 0.35);
  border-radius: 12px;
  background: rgba(var(--danger-rgb), 0.09);
  color: var(--text);
  font-weight: 800;
  overflow-wrap: anywhere;
  user-select: all;
}

.destructive-confirmation-input {
  border-color: rgba(var(--danger-rgb), 0.35);
}

.destructive-confirmation-input:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 0.2rem rgba(var(--danger-rgb), 0.15);
}

.destructive-confirmation-error {
  margin: 0.65rem 0 0;
  color: var(--danger);
  font-size: 0.9rem;
}

.destructive-confirmation-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.destructive-confirmation-actions .btn {
  min-height: 50px;
  white-space: normal;
}

@media (max-width: 520px) {
  .destructive-confirmation-actions {
    grid-template-columns: 1fr;
  }
}

.user-accessibility-summary {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.user-accessibility-summary strong {
  color: var(--text);
}

.user-theme-choice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 40px;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
}

.user-theme-choice:hover,
.user-theme-choice.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-text);
}

.user-menu-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
}

.user-menu-link:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

.user-menu-logout {
  width: 100%;
  border: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border);
  background: transparent;
  color: var(--danger);
  font-weight: 800;
  text-decoration: none;
  text-align: left;
}

.user-menu-logout:hover {
  background: rgba(var(--danger-rgb), 0.1);
  color: var(--danger);
}

.notification-menu {
  position: relative;
  flex: 0 0 auto;
}

.notification-menu summary {
  list-style: none;
}

.notification-menu summary::-webkit-details-marker {
  display: none;
}

.notification-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.notification-button:hover {
  border-color: var(--primary);
}

.notification-bell {
  font-size: 1.1rem;
  line-height: 1;
}

.notification-count {
  position: absolute;
  top: -7px;
  right: -7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #e11d48;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
}

.notification-dropdown {
  position: absolute;
  top: calc(100% + 0.65rem);
  right: 0;
  z-index: 20;
  width: min(360px, calc(100vw - 2rem));
  max-height: min(420px, 70vh);
  overflow-y: auto;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.notification-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.25rem 0.25rem 0.65rem;
  border-bottom: 1px solid var(--border);
}

.notification-header span {
  color: var(--muted);
  font-size: 0.84rem;
  white-space: nowrap;
}

.notification-list {
  display: grid;
  gap: 0.5rem;
  padding-top: 0.65rem;
}

.notification-item {
  width: 100%;
  display: grid;
  gap: 0.25rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--text);
  text-decoration: none;
  text-align: left;
  background: var(--surface-2);
}

.notification-dismiss-form {
  margin: 0;
}

.notification-item-button {
  border: 1px solid var(--border);
  font: inherit;
}

.notification-item:hover {
  border-color: var(--primary);
  color: var(--text);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.notification-item span {
  font-weight: 800;
}

.notification-item small,
.notification-empty {
  color: var(--muted);
}

.notification-empty {
  margin: 0;
  padding: 0.8rem 0.25rem 0.25rem;
}

.card-dark {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--text);
  box-shadow: var(--shadow);
}

.import-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(280px, 520px);
  gap: 1rem;
  align-items: center;
  padding: 1rem;
}

.import-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  min-width: 0;
}

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

.dashboard-grid .card {
  min-width: 0;
}

.dashboard-kpi {
  display: grid;
  gap: 0.3rem;
  padding: 1rem;
  border-top: 3px solid rgba(var(--accent-rgb), 0.5);
}

.dashboard-kpi span,
.dashboard-kpi small {
  color: var(--muted);
}

.dashboard-kpi strong {
  color: var(--text);
  font-size: 1.45rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.dashboard-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.dashboard-panel {
  display: grid;
  gap: 0.85rem;
  min-width: 0;
  padding: 1rem;
}

.dashboard-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.dashboard-panel-header h5 {
  margin: 0;
}

.dashboard-list {
  display: grid;
  gap: 0.65rem;
}

.dashboard-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: linear-gradient(135deg, var(--surface-2), rgba(var(--accent-rgb), 0.05));
}

.dashboard-list-item div {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.dashboard-list-item strong,
.dashboard-list-item small {
  overflow-wrap: anywhere;
}

.dashboard-list-item small {
  color: var(--muted);
}

.dashboard-list-item > span {
  color: var(--text);
  font-weight: 800;
  white-space: nowrap;
}

.filter-panel {
  padding: 1.25rem;
  overflow-x: auto;
}

.quick-filter-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(128px, 0.5fr) minmax(170px, 0.7fr) max-content;
  gap: 0.75rem;
  align-items: end;
  min-width: 860px;
}

.product-filter-grid {
  grid-template-columns:
    minmax(240px, 1fr)
    minmax(136px, 0.42fr)
    minmax(190px, 0.62fr)
    max-content;
  min-width: 980px;
}

.category-filter-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 180px 190px auto;
  gap: 1rem;
  align-items: end;
}

.report-filter-form {
  display: grid;
  grid-template-columns: 180px 180px 180px auto;
  gap: 1rem;
  align-items: end;
}

.search-field {
  min-width: 0;
}

.quick-filter-grid > div {
  min-width: 0;
}

.filter-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.75rem;
  align-items: end;
  justify-content: flex-end;
}

.filter-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  white-space: nowrap;
}

.product-filter-grid .filter-actions {
  flex-wrap: nowrap;
  min-width: max-content;
}

.advanced-filters {
  display: none;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.advanced-filters.is-open {
  display: grid;
}

.filter-count {
  color: var(--primary);
  font-size: 1.25rem;
  line-height: 0;
}

.form-label {
  color: var(--text);
  font-weight: 600;
}

.form-control,
.form-select {
  min-height: 44px;
  background-color: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.form-control:disabled,
.form-select:disabled {
  background-color: var(--surface-2);
  border-color: var(--border);
  color: var(--muted);
  opacity: 1;
}

.form-control:focus,
.form-select:focus {
  background-color: var(--surface);
  border-color: var(--primary);
  color: var(--text);
  box-shadow: 0 0 0 0.2rem rgba(var(--primary-rgb), 0.2);
}

.btn {
  min-height: 42px;
  border-radius: 0.5rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-color: var(--primary);
  color: var(--primary-text);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover), var(--accent));
  border-color: var(--accent);
  color: var(--primary-text);
}

.btn-outline-light {
  border-color: var(--border);
  color: var(--text);
}

.btn-outline-light:hover {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

.status-badge,
.badge-accent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  max-width: 100%;
  min-height: 28px;
  padding: 0.32rem 0.62rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.15;
  white-space: nowrap;
}

.status-badge {
  background: rgba(var(--info-rgb), 0.12);
  border-color: rgba(var(--info-rgb), 0.24);
  color: var(--info);
}

.status-paid,
.status-active,
.status-open {
  background: rgba(var(--success-rgb), 0.14);
  border-color: rgba(var(--success-rgb), 0.3);
  color: var(--success);
}

.status-warning,
.status-pending,
.status-due_today,
.status-near_due {
  background: rgba(var(--warning-rgb), 0.16);
  border-color: rgba(var(--warning-rgb), 0.34);
  color: var(--warning);
}

.status-danger,
.status-inactive,
.status-closed,
.status-overdue {
  background: rgba(var(--danger-rgb), 0.14);
  border-color: rgba(var(--danger-rgb), 0.32);
  color: var(--danger);
}

.btn-outline-secondary {
  border-color: var(--border);
  color: var(--muted);
}

.btn-outline-secondary:hover {
  background: var(--surface-2);
  color: var(--text);
}

.table-responsive {
  border-radius: 0.5rem;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}

.table-dark,
.table-dark > :not(caption) > * > * {
  --bs-table-bg: var(--surface);
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--border);
  --bs-table-striped-bg: var(--surface-2);
  --bs-table-hover-bg: var(--surface-2);
  color: var(--text);
}

.app-table th,
.app-table td {
  padding: 1rem;
  white-space: nowrap;
  vertical-align: middle;
}

.app-table th:first-child,
.app-table td:first-child {
  min-width: 220px;
}

.app-table {
  min-width: 1180px;
  table-layout: auto;
}

.product-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

.product-table th,
.product-table td {
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
}

.product-table th:first-child,
.product-table td:first-child {
  min-width: 460px;
}

.product-table th:nth-child(2),
.product-table td:nth-child(2) {
  min-width: 240px;
}

.product-table th:nth-child(3),
.product-table td:nth-child(3) {
  min-width: 180px;
}

.product-table th:nth-child(4),
.product-table td:nth-child(4) {
  min-width: 140px;
}

.product-table th:nth-child(5),
.product-table td:nth-child(5) {
  min-width: 120px;
}

.product-image,
.product-table img {
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.catalog-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  color: var(--muted);
}

.catalog-pagination-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.catalog-pagination-actions strong {
  color: var(--text);
  white-space: nowrap;
}

.category-table {
  min-width: 560px;
}

.company-table {
  min-width: 980px;
}

.company-table th,
.company-table td {
  white-space: normal;
}

.company-table th:not(:first-child),
.company-table td:not(:first-child) {
  min-width: 96px;
}

.company-table .product-name-button span,
.company-table .product-name-button small {
  overflow-wrap: anywhere;
}

.master-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.master-toolbar .settings-theme-choice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 0.55rem 0.85rem;
  text-decoration: none;
}

.master-eyebrow {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.master-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 0.85rem;
}

.master-overview-grid > a {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.master-overview-grid > a:hover {
  border-color: rgba(var(--primary-rgb), 0.5);
  background: var(--surface-2);
}

.master-overview-grid span,
.master-overview-grid small {
  color: var(--muted);
}

.master-overview-grid strong {
  font-size: 1.65rem;
}

.master-compact-list,
.master-user-list {
  display: grid;
  gap: 0.6rem;
}

.master-compact-list > a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--text);
  text-decoration: none;
}

.master-compact-list > a > span:first-child {
  display: grid;
  min-width: 0;
}

.master-compact-list small {
  color: var(--muted);
}

.master-user-search {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.65rem;
}

.master-user-search > div {
  flex: 1 1 320px;
  min-width: 0;
}

.master-user-item {
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface-2);
}

.master-user-item summary {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem;
  cursor: pointer;
}

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

.master-user-name {
  display: grid;
  min-width: 0;
}

.master-user-name strong,
.master-user-name small {
  overflow-wrap: anywhere;
}

.master-user-name small {
  color: var(--muted);
}

.master-user-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  gap: 0.65rem;
  padding: 0.85rem;
  border-top: 1px solid var(--border);
}

.master-user-details > div {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.master-user-details span {
  color: var(--muted);
  font-size: 0.82rem;
}

.master-user-details strong {
  overflow-wrap: anywhere;
}

.master-user-item > .btn {
  margin: 0 0.85rem 0.85rem;
}

.company-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 1rem;
}

.company-card {
  display: grid;
  gap: 1rem;
  min-width: 0;
  padding: 1.25rem;
}

.company-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
}

.company-card-header > div {
  min-width: 0;
}

.company-card-header h5 {
  overflow-wrap: anywhere;
}

.company-card-header p {
  overflow-wrap: anywhere;
}

.company-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.company-stat-grid > div {
  display: grid;
  gap: 0.25rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface-2);
}

.company-stat-grid span {
  color: var(--muted);
  font-size: 0.9rem;
}

.company-stat-grid strong {
  color: var(--text);
  font-size: 1.1rem;
  overflow-wrap: anywhere;
}

.company-edit-form,
.company-inline-edit {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
}

.company-inline-edit {
  grid-template-columns: minmax(180px, 1fr) auto auto;
  align-items: center;
}

.company-db-path {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.company-details-stats {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
}

.company-details-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  min-width: 0;
}

.company-main-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(120px, auto);
  gap: 0.75rem;
  align-items: end;
  min-width: 0;
}

.company-details-form > div,
.company-main-form > div,
.company-subscription-form > div {
  min-width: 0;
}

.company-active-toggle {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-end;
}

.company-key-toggle {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-start;
  align-self: end;
}

.company-key-note {
  align-self: end;
  font-size: 0.85rem;
  line-height: 1.35;
}

.activation-key-field {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.activation-key-display {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.03em;
}

.activation-key-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.copy-key-button {
  min-width: 74px;
}

.copy-key-button.is-copied {
  border-color: rgba(22, 163, 74, 0.48);
  background: rgba(22, 163, 74, 0.16);
}

.master-subscription-panel {
  overflow: hidden;
}

.master-subscription-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.master-subscription-box {
  display: grid;
  gap: 0.85rem;
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface-2);
}

.master-subscription-box strong,
.master-subscription-box p {
  overflow-wrap: anywhere;
}

.master-key-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  gap: 0.85rem;
  align-items: end;
  min-width: 0;
}

.master-key-form > div {
  min-width: 0;
}

.master-key-form > .btn {
  min-height: 42px;
}

.master-key-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-self: end;
}

.master-key-list {
  min-width: 0;
}

.company-subscription-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: 0.75rem;
  min-width: 0;
}

.company-details-form .btn[type='submit'] {
  width: 100%;
}

.subscription-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.2;
  white-space: normal;
}

.subscription-ok {
  border-color: rgba(var(--success-rgb), 0.35);
  background: rgba(var(--success-rgb), 0.12);
}

.subscription-warning {
  border-color: rgba(var(--warning-rgb), 0.4);
  background: rgba(var(--warning-rgb), 0.14);
}

.subscription-danger {
  border-color: rgba(var(--danger-rgb), 0.42);
  background: rgba(var(--danger-rgb), 0.12);
}

.master-log-panel {
  padding: 1rem;
}

.master-log-list {
  display: grid;
  gap: 0.65rem;
}

.master-log-item {
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface-2);
  overflow: hidden;
}

.master-log-item summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.5rem 0.75rem;
  align-items: center;
  padding: 0.85rem;
  cursor: pointer;
}

.master-log-item summary strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.master-log-item summary small {
  grid-column: 2;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.master-log-details {
  display: grid;
  gap: 0.85rem;
  padding: 0 0.85rem 0.85rem;
  border-top: 1px solid var(--border);
}

.master-log-trace {
  max-height: 260px;
  overflow: auto;
  margin: 0;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  color: var(--text);
  white-space: pre-wrap;
}

.activation-page {
  display: grid;
  place-items: center;
  min-height: min(70vh, 680px);
}

.activation-card {
  width: min(100%, 720px);
  display: grid;
  gap: 1.25rem;
  padding: clamp(1rem, 3vw, 2rem);
}

.activation-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
}

.activation-status-grid > div {
  display: grid;
  gap: 0.25rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface-2);
}

.activation-status-grid span {
  color: var(--muted);
  font-size: 0.9rem;
}

.activation-status-grid strong {
  color: var(--text);
  overflow-wrap: anywhere;
}

.activation-form {
  display: grid;
  gap: 0.75rem;
}

.activation-key-input {
  min-height: 52px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.subscription-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.75rem;
}

.subscription-overview > div {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface-2);
}

.subscription-overview span,
.subscription-price-grid span {
  color: var(--muted);
  font-size: 0.9rem;
}

.subscription-overview strong,
.subscription-price-grid strong {
  color: var(--text);
  overflow-wrap: anywhere;
}

.subscription-page-head,
.subscription-hero-panel,
.subscription-empty-panel,
.subscription-license-panel {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
}

.subscription-page-head {
  margin-bottom: 1rem;
}

.subscription-page-head h2,
.subscription-hero-panel h3,
.subscription-empty-panel h3,
.subscription-license-panel h3 {
  margin: 0;
  overflow-wrap: anywhere;
}

.subscription-hero-panel,
.subscription-empty-panel,
.subscription-license-panel {
  padding: clamp(1rem, 2vw, 1.5rem);
}

.subscription-hero-content {
  display: grid;
  gap: 0.8rem;
  min-width: 0;
}

.subscription-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
}

.subscription-meta-row strong {
  color: var(--text);
}

.subscription-benefit-section {
  display: grid;
  gap: 0.75rem;
}

.subscription-benefit-section h5 {
  margin: 0;
}

.subscription-benefit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 0.75rem;
}

.subscription-benefit-item {
  min-width: 0;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.subscription-license-panel {
  display: grid;
}

.subscription-plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 1rem;
  align-items: stretch;
}

.subscription-plan-card {
  display: grid;
  gap: 1rem;
  padding: clamp(1rem, 2vw, 1.5rem);
  min-width: 0;
  border-width: 1px;
}

.subscription-plan-card.is-featured {
  border-color: rgba(var(--primary-rgb), 0.45);
  box-shadow: 0 18px 46px rgba(var(--primary-rgb), 0.14);
}

.subscription-plan-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
}

.subscription-plan-head h3 {
  margin: 0;
  overflow-wrap: anywhere;
}

.subscription-price-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.subscription-price-grid > div {
  display: grid;
  gap: 0.2rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface-2);
}

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

.subscription-feature-list li {
  position: relative;
  padding-left: 1.35rem;
  color: var(--text);
}

.subscription-feature-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--primary);
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.table-actions form {
  margin: 0;
}

.compact-table {
  min-width: 720px;
}

.sales-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: clamp(0.78rem, 0.9vw, 0.96rem);
}

.sales-table th:first-child,
.sales-table td:first-child {
  min-width: 0;
}

.sales-table th,
.sales-table td {
  min-width: 0;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
  padding-inline: clamp(0.42rem, 0.72vw, 0.75rem);
}

.sales-table .sales-id-column {
  width: 19%;
  min-width: 0;
}

.sales-table .sales-date-column {
  width: 22%;
  min-width: 0;
}

.sales-table .sales-seller-column {
  width: 17%;
  min-width: 0;
}

.sales-table .sales-total-column {
  width: 14%;
  min-width: 0;
}

.sales-table .sales-payment-column {
  width: 16%;
  min-width: 0;
}

.sales-table .actions-column {
  min-width: 0;
  width: 12%;
}

.sales-table .badge,
.sales-table .btn,
.sales-table .sales-column-filter summary,
.sales-table .sales-column-search span {
  max-width: 100%;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.sales-table .actions-column,
.sales-table .actions-column .btn {
  overflow: visible;
  text-overflow: clip;
}

.sales-table .action-button {
  min-width: 58px;
  width: 100%;
  max-width: 78px;
}

html[data-text-scale='large'] .sales-table {
  min-width: 0;
}

html[data-text-scale='extra'] .sales-table,
html[data-accessibility-bold='true'] .sales-table {
  min-width: 0;
}

html[data-text-scale='extra'] .sales-table .sales-date-column,
html[data-accessibility-bold='true'] .sales-table .sales-date-column {
  min-width: 0;
}

html[data-text-scale='extra'] .sales-table .sales-total-column,
html[data-accessibility-bold='true'] .sales-table .sales-total-column {
  min-width: 0;
}

.sale-detail-table {
  min-width: 560px;
}

.report-sales-table {
  min-width: 920px;
}

.table-card {
  overflow: hidden;
}

.actions-column {
  min-width: 270px;
  width: 270px;
}

.product-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  min-width: max-content;
}

.product-actions form {
  display: inline-flex;
  margin: 0;
}

.action-button {
  min-width: 82px;
  white-space: nowrap;
  overflow: visible;
  text-align: center;
}

.action-button.btn-sm {
  min-height: 38px;
  padding: 0.45rem 0.7rem;
}

.product-name-button {
  display: grid;
  gap: 0.2rem;
  width: max-content;
  min-width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.product-name-button span {
  font-weight: 700;
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
}

.product-name-button small {
  color: var(--muted);
  line-height: 1.45;
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
}

.product-name-button:hover span {
  color: var(--primary);
}

.product-details-row > td {
  border-top: 0;
  white-space: normal;
}

.product-details-panel {
  display: grid;
  gap: 1rem;
  min-width: 0;
  padding: 1rem;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}

.product-profit-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 0.75rem;
}

.product-profit-summary > div {
  display: grid;
  gap: 0.2rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
}

.product-profit-summary span {
  color: var(--muted);
  font-size: 0.85rem;
}

.product-inline-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(150px, 0.8fr) minmax(170px, 1fr) repeat(3, minmax(110px, 0.55fr)) auto;
  gap: 0.75rem;
  align-items: end;
}

.category-inline-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 0.75rem;
  align-items: end;
}

.product-inline-actions {
  display: flex;
  align-items: end;
}

.product-kit-fields {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 130px minmax(220px, 1fr) 180px;
  gap: 0.75rem;
  align-items: end;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.kit-fields.is-hidden {
  display: none;
}

.product-danger-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.product-danger-actions form {
  margin: 0;
}

.sale-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 1rem;
  align-items: start;
}

.sale-layout > * {
  min-width: 0;
}

.sale-panel {
  padding: 1.25rem;
  overflow: visible;
}

.cash-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.cash-panel {
  display: grid;
  gap: 1.25rem;
  padding: 1.25rem;
  min-width: 0;
}

.cash-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
}

.cash-panel-header > div {
  min-width: 0;
}

.cash-panel-header h5,
.cash-panel-header p {
  overflow-wrap: anywhere;
}

.cash-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 0.85rem;
}

.cash-summary-grid > div,
.cash-history-item > div {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface-2);
}

.cash-summary-grid span,
.cash-history-item span {
  color: var(--muted);
  font-size: 0.9rem;
}

.cash-summary-grid strong,
.cash-history-item strong {
  color: var(--text);
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}

.cash-action-form {
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto;
  gap: 0.75rem;
  align-items: end;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.cash-action-form > div {
  min-width: 0;
}

.cash-action-form .btn {
  min-height: 42px;
  white-space: nowrap;
}

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

.cash-history-item {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(150px, 0.9fr) minmax(130px, 0.8fr);
  gap: 0.75rem;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.cash-history-item:hover > div {
  border-color: var(--primary);
}

.cash-register-table {
  width: 100%;
  min-width: 920px;
}

.cash-register-table th,
.cash-register-table td {
  padding: 0.8rem;
  white-space: nowrap;
}

.cash-register-number {
  color: var(--primary);
  font-weight: 850;
  text-decoration: underline;
  text-underline-offset: 0.2rem;
}

.cash-register-summary-row {
  cursor: pointer;
}

.cash-register-summary-row:hover > td,
.cash-register-summary-row:focus-visible > td {
  background: var(--surface-2);
}

.cash-register-summary-row:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.cash-register-detail-row > td {
  border-top: 0;
  white-space: normal;
}

.cash-register-inline-detail {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  border-block: 1px solid var(--border);
  background: var(--surface-2);
}

.cash-register-meta,
.cash-register-detail-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  gap: 0.75rem;
}

.cash-register-meta > div,
.cash-register-detail-columns > div {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
}

.cash-register-meta span {
  color: var(--muted);
  font-size: 0.84rem;
}

.cash-register-meta strong,
.cash-register-detail-columns strong,
.cash-register-detail-columns p {
  overflow-wrap: anywhere;
}

.cash-inline-list {
  display: grid;
  gap: 0.35rem;
}

.cash-inline-list span,
.cash-inline-list a {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.cash-inline-list a:hover {
  color: var(--primary);
}

.cash-detail-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.cash-detail-list {
  display: grid;
  gap: 0.65rem;
}

.cash-detail-list > div {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface-2);
}

.cash-detail-list span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.cash-detail-list strong {
  color: var(--text);
  font-size: 1.08rem;
  overflow-wrap: anywhere;
}

.cash-detail-list small {
  color: var(--muted);
}

.sale-items {
  display: grid;
  gap: 0.75rem;
  overflow: visible;
}

.sale-product-picker {
  position: relative;
  z-index: 85;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface-2);
}

.sale-items-empty {
  padding: 1rem;
  border: 1px dashed var(--border);
  border-radius: 0.5rem;
  color: var(--muted);
  text-align: center;
}

.sale-items-empty.is-hidden {
  display: none;
}

.sale-discount-summary {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
}

.sale-discount-summary strong {
  color: var(--text);
  text-align: right;
}

.sale-item-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(260px, 1.55fr) minmax(104px, 0.55fr) minmax(104px, 0.55fr) minmax(82px, 0.38fr) minmax(118px, 0.65fr) minmax(96px, auto);
  gap: 0.75rem;
  align-items: end;
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface-2);
  overflow: visible;
}

.sale-item-row > div {
  min-width: 0;
}

.sale-item-row .form-control {
  min-width: 0;
}

.product-autocomplete,
.catalog-autocomplete {
  position: relative;
}

.product-autocomplete:focus-within,
.catalog-autocomplete:focus-within {
  z-index: 80;
}

.product-suggestion-list {
  position: absolute;
  z-index: 90;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  display: none;
  max-height: min(320px, 45vh);
  overflow-y: auto;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.product-suggestion-list.is-open {
  display: grid;
  gap: 0.25rem;
}

.product-suggestion-item {
  display: grid;
  gap: 0.15rem;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 0;
  border-radius: 0.4rem;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.product-suggestion-item:hover,
.product-suggestion-item.is-active {
  background: var(--surface-2);
}

.product-suggestion-title {
  font-weight: 700;
}

.product-suggestion-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.product-suggestion-empty {
  padding: 0.65rem 0.75rem;
  color: var(--muted);
}

.report-period-label {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  color: var(--muted);
}

.report-period-label strong {
  color: var(--text);
}

.report-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1rem;
}

.daily-peak-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.daily-peak-card {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  padding: 1rem;
}

.daily-peak-card span,
.daily-peak-card small {
  color: var(--muted);
}

.daily-peak-card strong,
.daily-peak-card small {
  overflow-wrap: anywhere;
}

.daily-peak-card--primary {
  border-color: var(--success);
  box-shadow: inset 3px 0 0 var(--success);
}

.report-card {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  padding: 1rem;
}

.report-card span {
  color: var(--muted);
  font-size: 0.9rem;
}

.report-card strong {
  font-size: 1.2rem;
}

.report-chart-panel {
  min-width: 0;
  overflow: hidden;
}

.report-chart {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--chart-columns, 1), minmax(0, 1fr));
  gap: clamp(0.18rem, 0.65vw, 0.6rem);
  width: 100%;
  min-width: 0;
  min-height: 280px;
  padding: 1.25rem;
  overflow: hidden;
}

.report-chart-tooltip {
  position: absolute;
  z-index: 5;
  top: 0.45rem;
  left: 0;
  display: grid;
  gap: 0.08rem;
  min-width: 132px;
  max-width: min(220px, calc(100% - 1rem));
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-0.25rem);
  transition: opacity 120ms ease, transform 120ms ease;
}

.report-chart-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.report-chart-tooltip strong,
.report-chart-tooltip span {
  overflow-wrap: anywhere;
}

.report-chart-tooltip span {
  color: var(--muted);
  font-size: 0.78rem;
}

.report-chart-tooltip .report-chart-tooltip-peak {
  color: var(--success);
  font-weight: 800;
}

.report-chart-column {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 0.5rem;
  min-width: 0;
  outline: none;
}

.report-chart-track {
  position: relative;
  display: flex;
  align-items: end;
  min-height: 210px;
  min-width: 0;
  padding: clamp(0.08rem, 0.35vw, 0.35rem);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface-2);
}

.report-chart-bar {
  width: 100%;
  min-height: 3px;
  border-radius: 0.35rem 0.35rem 0.15rem 0.15rem;
  background: var(--primary);
  transition: filter 120ms ease, min-height 120ms ease;
}

.report-chart-bar:hover {
  filter: brightness(1.08);
}

.report-chart-column:hover .report-chart-bar,
.report-chart-column:focus-visible .report-chart-bar {
  filter: brightness(1.16);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.22);
}

.report-chart-column:focus-visible .report-chart-track {
  border-color: var(--primary);
}

.report-chart-column.is-peak .report-chart-track {
  border-color: var(--success);
  background: rgba(var(--success-rgb), 0.1);
}

.report-chart-column.is-peak .report-chart-bar {
  background: var(--success);
  box-shadow: 0 0 0 2px rgba(var(--success-rgb), 0.2);
}

.report-chart-peak-badge {
  position: absolute;
  z-index: 2;
  top: 0.35rem;
  left: 50%;
  padding: 0.14rem 0.3rem;
  border-radius: 0.3rem;
  background: var(--success);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1;
  transform: translateX(-50%);
  white-space: nowrap;
}

.report-chart-column span {
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-chart--dense .report-chart-column:nth-child(even) > span {
  visibility: hidden;
}

.report-chart--dense .report-chart-column:last-child > span {
  visibility: visible;
}

.report-chart--very-dense .report-chart-column > span {
  visibility: hidden;
}

.report-chart--very-dense .report-chart-column:nth-child(5n + 1) > span,
.report-chart--very-dense .report-chart-column:last-child > span {
  visibility: visible;
}

.report-chart--hourly .report-chart-column > span {
  visibility: hidden;
}

.report-chart--hourly .report-chart-column:nth-child(3n + 1) > span,
.report-chart--hourly .report-chart-column:last-child > span {
  visibility: visible;
}

.report-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 1rem;
  align-items: start;
}

.report-section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.report-section-header small {
  color: var(--muted);
}

.report-chart-metric {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  background: var(--surface-2);
}

.report-chart-metric a {
  padding: 0.4rem 0.65rem;
  border-radius: 0.35rem;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
  text-decoration: none;
}

.report-chart-metric a.is-active {
  background: var(--primary);
  color: var(--primary-text);
}

.report-side {
  display: grid;
  gap: 1rem;
}

.settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 1rem;
  align-items: start;
}

.settings-tabs {
  display: grid;
  gap: 1rem;
}

.settings-tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.settings-tab-button {
  min-height: 40px;
  padding: 0.5rem 0.85rem;
  border: 1px solid transparent;
  border-radius: 0.45rem;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.settings-tab-button:hover,
.settings-tab-button.is-active {
  border-color: rgba(var(--primary-rgb), 0.28);
  background: var(--accent-soft);
  color: var(--text);
}

.settings-tab-panel {
  display: none;
}

.settings-tab-panel.is-active {
  display: block;
}

.settings-theme-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 0.75rem;
}

.settings-theme-choice {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
}

.settings-theme-choice:hover,
.settings-theme-choice.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-text);
}

.accessibility-block {
  display: grid;
  gap: 0.75rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}

.accessibility-switches {
  display: grid;
  gap: 0.75rem;
  margin: 1rem 0 0.35rem;
}

.accessibility-switch-row {
  align-items: center;
}

.accessibility-block:first-of-type,
.accessibility-switches + .accessibility-block {
  border-top: 0;
  padding-top: 0.25rem;
}

.accessibility-block h6 {
  margin-bottom: 0.25rem;
  font-weight: 900;
}

.accessibility-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.accessibility-choice {
  min-height: 46px;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: var(--surface);
  color: var(--text);
  font-weight: 850;
  white-space: nowrap;
}

.accessibility-choice:hover,
.accessibility-choice.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

.accessibility-choice.is-disabled {
  opacity: 0.72;
}

.accessibility-choice.is-active {
  box-shadow: inset 0 0 0 2px rgba(var(--accent-rgb), 0.22);
}

.accessibility-preview {
  display: grid;
  gap: 0.85rem;
}

.settings-layout > section:first-child {
  grid-row: span 2;
}

.settings-summary {
  display: grid;
  gap: 0.65rem;
}

.settings-summary > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}

.settings-summary span {
  color: var(--muted);
}

.settings-summary strong {
  text-align: right;
  overflow-wrap: anywhere;
}

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

.key-preset-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.export-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.machine-fee-grid {
  display: grid;
  gap: 0.75rem;
}

.machine-fee-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.55fr) minmax(180px, 1fr);
  gap: 0.75rem;
  align-items: end;
  min-width: 0;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface-2);
}

.machine-fee-row > span {
  min-width: 0;
}

.email-recipient-list {
  display: grid;
  gap: 0.5rem;
}

.email-recipient-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 0.5rem;
  align-items: center;
}

.email-recipient-add {
  min-width: 44px;
  padding-inline: 0;
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1;
}

.email-recipient-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
}

.email-recipient-empty {
  align-self: center;
  color: var(--muted);
  font-size: 0.92rem;
}

.email-recipient-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  gap: 0.4rem;
  padding: 0.32rem 0.42rem 0.32rem 0.65rem;
  border: 1px solid rgba(var(--primary-rgb), 0.22);
  border-radius: 999px;
  background: rgba(var(--primary-rgb), 0.12);
  color: var(--text);
  font-weight: 700;
}

.email-recipient-chip span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-recipient-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  line-height: 1;
}

.email-recipient-remove:hover {
  background: rgba(var(--primary-rgb), 0.14);
  color: var(--text);
}

.employee-list {
  display: grid;
  gap: 0.85rem;
}

.employee-search-panel {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.employee-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
}

.employee-search-row .form-control {
  min-width: 0;
}

.employee-search-row .product-suggestion-list {
  right: auto;
  width: calc(100% - 150px);
  min-width: min(100%, 320px);
}

.employee-search-empty {
  margin: 0;
  padding: 1rem;
  border: 1px dashed var(--border);
  border-radius: 0.5rem;
  color: var(--muted);
  text-align: center;
}

.employee-card {
  display: grid;
  gap: 0;
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface-2);
}

.employee-card:has(.collapse.show) {
  gap: 0.85rem;
}

.employee-card.is-hidden,
.employee-search-empty.is-hidden {
  display: none;
}

.employee-card-summary {
  align-items: center;
}

.employee-name-button {
  padding: 0.15rem 0;
}

.employee-details-panel {
  display: grid;
  gap: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.employee-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
}

.employee-card-header > div {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.employee-card-header strong,
.employee-card-header small {
  overflow-wrap: anywhere;
}

.employee-card-header small {
  color: var(--muted);
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 0.65rem;
}

.permission-grid .form-check {
  min-width: 0;
  padding: 0.5rem 0.65rem 0.5rem 2.1rem;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  background: var(--surface);
}

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

  .sale-item-row {
    grid-template-columns: minmax(260px, 1fr) minmax(112px, 0.45fr) minmax(112px, 0.45fr);
  }
}

@media (max-width: 1280px) {
  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .content-frame {
    padding-inline: 1.25rem;
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .dashboard-detail-grid {
    grid-template-columns: 1fr;
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .product-form-card .col-md-2,
  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .product-form-card .col-md-4,
  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .product-form-card .col-md-6,
  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .product-form-card .col-md-8 {
    width: 50%;
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .category-filter-grid {
    grid-template-columns: minmax(240px, 1fr) 170px;
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .report-filter-form {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .advanced-filters {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .product-profit-summary {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .product-inline-form {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .product-inline-actions {
    grid-column: 1 / -1;
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .product-kit-fields {
    grid-template-columns: 120px minmax(220px, 1fr) 170px;
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .sale-layout {
    grid-template-columns: 1fr;
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .report-layout {
    grid-template-columns: 1fr;
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .company-card-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .company-details-stats {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .company-main-form,
  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .company-subscription-form {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .company-details-form .btn {
    grid-column: 1 / -1;
    width: 100%;
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .settings-layout {
    grid-template-columns: 1fr;
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .settings-layout > section:first-child {
    grid-row: auto;
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .report-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .cash-summary-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .cash-history-item {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .cash-detail-layout {
    grid-template-columns: 1fr;
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .sale-item-row {
    grid-template-columns: minmax(260px, 1fr) minmax(120px, 0.55fr) minmax(110px, 0.5fr);
    min-width: 0;
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .app-table {
    min-width: 900px;
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .compact-table {
    min-width: 640px;
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .sales-table {
    min-width: 1180px;
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .sale-detail-table {
    min-width: 520px;
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .report-sales-table {
    min-width: 820px;
  }
}

@media (max-width: 1080px) {
  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .category-filter-grid,
  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .report-filter-form,
  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .advanced-filters,
  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .product-inline-form,
  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .payable-form,
  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .product-kit-fields {
    grid-template-columns: 1fr;
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .payable-form-notes {
    grid-column: auto;
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .product-profit-summary {
    grid-template-columns: 1fr;
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .product-danger-actions {
    flex-direction: column;
    align-items: stretch;
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .dashboard-grid {
    grid-template-columns: 1fr;
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .dashboard-detail-grid {
    grid-template-columns: 1fr;
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .report-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .cash-summary-grid,
  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .cash-history-item,
  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .cash-detail-layout,
  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .company-card-grid,
  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .company-inline-edit,
  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .cash-action-form {
    grid-template-columns: 1fr;
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .company-details-stats,
  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .company-main-form,
  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .company-subscription-form {
    grid-template-columns: 1fr;
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .cash-action-form .btn {
    width: 100%;
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .product-form-card .col-md-2,
  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .product-form-card .col-md-4,
  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .product-form-card .col-md-6,
  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .product-form-card .col-md-8 {
    width: 100%;
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .sale-item-row,
  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .payment-grid,
  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .sale-payment-layout,
  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .machine-fee-row,
  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .export-action-grid,
  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .settings-form-grid {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .sale-row-action .btn {
    width: 100%;
  }
}

.sale-row-action {
  display: flex;
  align-items: end;
}

.sale-row-action .btn {
  white-space: nowrap;
}

.sale-total-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-radius: 0.5rem;
  background: var(--surface-2);
}

.sale-total-box strong {
  font-size: 1.35rem;
}

.sale-payment-step {
  display: none;
  position: fixed;
  z-index: 1060;
  top: 50%;
  left: 50%;
  width: min(calc(100% - 2rem), 920px);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 100vmax rgba(5, 7, 18, 0.72), var(--shadow);
}

.sale-payment-step.is-open {
  display: block;
}

body.sale-payment-open {
  overflow: hidden;
}

.sale-stock-warning {
  display: none;
  margin-top: 0.3rem;
  color: #d97706;
  font-size: 0.78rem;
  font-weight: 750;
}

.sale-stock-warning.is-visible {
  display: block;
}

.sale-item-row.has-stock-warning {
  border-color: rgba(217, 119, 6, 0.55);
}

.settings-switch-row {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  margin: 0;
  padding: 1rem 1rem 1rem 3rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface-2);
}

.settings-switch-row span {
  display: grid;
  gap: 0.2rem;
}

.settings-switch-row small {
  color: var(--muted);
}

.sale-payment-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1rem;
  align-items: start;
}

.sale-payment-summary {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface-2);
}

.sale-next-actions {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.shortcut-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  min-height: 1.45rem;
  margin-left: 0.4rem;
  padding: 0 0.35rem;
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.shortcut-label-light {
  border-color: rgba(255, 255, 255, 0.4);
  color: inherit;
}

.discount-modal,
.sale-quantity-modal {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.54);
}

.discount-modal.is-open,
.sale-quantity-modal.is-open {
  display: flex;
}

.discount-dialog,
.sale-quantity-dialog {
  width: min(100%, 420px);
  padding: 1.25rem;
}

body.sale-quantity-open,
body.sale-discount-open {
  overflow: hidden;
}

.sale-quantity-meta {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  background: var(--surface-2);
  color: var(--muted);
  overflow-wrap: anywhere;
}

.discount-percent {
  color: var(--muted);
  font-weight: 600;
}

.discount-preview {
  display: grid;
  gap: 0.6rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface-2);
}

.discount-preview > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.discount-preview span {
  color: var(--muted);
}

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

.payment-summary {
  display: grid;
  gap: 0.6rem;
}

.payment-summary > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.payable-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 1rem;
}

.payable-summary-card {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  padding: 1rem;
}

.payable-summary-card span {
  color: var(--muted);
  font-size: 0.9rem;
}

.payable-summary-card strong {
  font-size: 1.25rem;
  overflow-wrap: anywhere;
}

.payable-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(150px, 0.7fr) minmax(130px, 0.55fr) minmax(150px, 0.65fr) auto;
  gap: 0.75rem;
  align-items: end;
}

.payable-form > div {
  min-width: 0;
}

.payable-form-notes {
  grid-column: 1 / -2;
}

.payable-table {
  min-width: 760px;
}

.payable-table td {
  white-space: normal;
}

.payable-table form {
  margin: 0;
}

.payable-paid {
  border-color: rgba(var(--success-rgb), 0.35);
  background: rgba(var(--success-rgb), 0.12);
}

.payable-overdue {
  border-color: rgba(var(--danger-rgb), 0.42);
  background: rgba(var(--danger-rgb), 0.12);
}

.payable-due_today,
.payable-near_due {
  border-color: rgba(var(--warning-rgb), 0.4);
  background: rgba(var(--warning-rgb), 0.14);
}

.badge-accent {
  background: rgba(var(--accent-rgb), 0.16);
  border-color: rgba(var(--accent-rgb), 0.32);
  color: var(--accent);
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    width: 100%;
    flex-basis: auto;
    min-height: auto;
  }

  .app-shell.sidebar-collapsed .sidebar {
    width: 100%;
    flex-basis: auto;
  }

  .sidebar-sticky {
    position: static;
    padding: 1rem;
  }

  .app-shell.sidebar-collapsed .sidebar-sticky {
    padding: 1rem;
  }

  .app-shell.sidebar-collapsed .brand-block {
    display: flex;
  }

  .sidebar .nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .app-shell.sidebar-collapsed .nav-label {
    display: inline;
  }

  .app-shell.sidebar-collapsed .sidebar .nav-link {
    justify-content: flex-start;
  }

  .content-frame {
    padding: 1rem;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar-user-area {
    width: 100%;
  }

  .user-menu {
    flex: 1;
  }

  .user-menu-button {
    width: 100%;
    max-width: none;
  }

  .quick-filter-grid,
  .import-panel,
  .import-form,
  .category-filter-grid,
  .report-filter-form,
  .advanced-filters,
  .dashboard-grid,
  .dashboard-detail-grid,
  .export-action-grid,
  .report-layout,
  .settings-layout,
  .settings-form-grid {
    grid-template-columns: 1fr;
  }

  .product-filter-grid {
    grid-template-columns: minmax(220px, 1fr) minmax(128px, 0.5fr) minmax(170px, 0.7fr) max-content;
  }

  .settings-layout > section:first-child {
    grid-row: auto;
  }

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

  .daily-peak-grid {
    grid-template-columns: 1fr;
  }

  .report-chart {
    gap: 0.14rem;
    min-height: 230px;
    padding: 0.75rem;
  }

  .report-chart-track {
    min-height: 170px;
    padding: 0.08rem;
  }

  .report-chart-column span {
    font-size: 0.68rem;
  }

  .report-chart--dense .report-chart-column > span {
    visibility: hidden;
  }

  .report-chart--dense .report-chart-column:nth-child(4n + 1) > span,
  .report-chart--dense .report-chart-column:last-child > span {
    visibility: visible;
  }

  .cash-panel {
    padding: 1rem;
  }

  .cash-panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .subscription-page-head,
  .subscription-hero-panel,
  .subscription-empty-panel,
  .subscription-meta-row {
    align-items: stretch;
    flex-direction: column;
  }

  .subscription-hero-panel .btn,
  .subscription-empty-panel .btn,
  .subscription-license-panel .btn {
    width: 100%;
  }

  .cash-summary-grid,
  .cash-history-item,
  .cash-detail-layout,
  .company-card-grid,
  .company-inline-edit,
  .company-details-stats,
  .company-main-form,
  .company-subscription-form,
  .master-subscription-actions,
  .cash-action-form {
    grid-template-columns: 1fr;
  }

  .company-details-form .btn {
    width: 100%;
  }

  .cash-action-form .btn {
    width: 100%;
  }

  .filter-actions {
    flex-direction: column;
    align-items: stretch;
  }

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

  .catalog-pagination,
  .catalog-pagination-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .catalog-pagination-actions .btn {
    width: 100%;
  }

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

  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .product-table,
  .product-table {
    min-width: 0;
  }

  .product-table thead {
    display: none;
  }

  .product-table,
  .product-table tbody,
  .product-table tr,
  .product-table td {
    display: block;
    width: 100%;
  }

  .product-table tbody {
    display: grid;
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .product-table .product-summary-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--surface);
  }

  .product-table .product-summary-row td {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.35rem 0;
    border: 0;
    text-align: right !important;
  }

  .product-table .product-summary-row td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
  }

  .product-table .product-summary-row td:first-child {
    grid-column: 1 / -1;
    width: 100%;
    text-align: left !important;
  }

  .product-table .product-summary-row td:first-child::before {
    display: none;
  }

  .product-table .product-details-row > td {
    width: 100%;
    padding: 0;
  }

  .cash-register-table-wrap {
    overflow: visible;
  }

  .cash-register-table,
  .cash-register-table tbody,
  .cash-register-table tr,
  .cash-register-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .cash-register-table thead {
    display: none;
  }

  .cash-register-summary-row {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem 0.75rem;
    margin-top: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
  }

  .cash-register-summary-row td {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.3rem 0;
    border: 0;
    white-space: normal;
    text-align: right !important;
  }

  .cash-register-summary-row td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
  }

  .cash-register-detail-row > td {
    padding: 0;
  }

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

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

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

  .product-danger-actions {
    flex-direction: column;
  }

  .sale-layout,
  .sale-item-row,
  .payable-form,
  .payment-grid,
  .machine-fee-row,
  .export-action-grid,
  .sale-payment-layout {
    grid-template-columns: 1fr;
  }

  .payable-form-notes {
    grid-column: auto;
  }

  .sale-row-action .btn {
    width: 100%;
  }
}

.is-hidden {
  display: none !important;
}

.login-page {
  min-height: calc(100vh - clamp(2rem, 4vw, 4rem));
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 2rem);
}

.login-card-wrap {
  width: min(100%, 480px);
}

.login-card {
  display: grid;
  gap: 1rem;
  padding: clamp(1.15rem, 4vw, 1.75rem);
}

.login-card .settings-tab-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.login-remember-option {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  width: max-content;
  max-width: 100%;
  margin: -0.15rem 0 1rem;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.login-remember-option input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: var(--primary);
  flex: 0 0 auto;
}

.login-remember-option span {
  white-space: nowrap;
}

.topbar {
  position: relative;
  z-index: 40;
}

.notification-menu,
.user-menu {
  isolation: isolate;
}

.notification-dropdown {
  z-index: 80;
}

.user-menu-dropdown {
  z-index: 90;
}

.sales-filter-grid,
.product-report-filter-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: 0.85rem;
  align-items: end;
}

.sales-filter-grid .filter-actions,
.product-report-filter-form .filter-actions {
  align-self: end;
}

.category-chip-nav,
.report-view-tabs {
  display: flex;
  gap: 0.55rem;
  overflow-x: auto;
  padding: 0.1rem 0 0.35rem;
  scrollbar-width: thin;
}

.category-chip,
.report-view-tabs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 40px;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  white-space: nowrap;
}

.category-chip:hover,
.category-chip.is-active,
.report-view-tabs a:hover,
.report-view-tabs a.is-active {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.14);
  color: var(--text);
}

.category-chip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.78rem;
}

.category-chip .category-chip-name {
  display: block;
  min-width: 0;
  height: auto;
  padding: 0;
  overflow: hidden;
  background: transparent;
  color: inherit;
  font-size: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-chip .category-chip-count {
  flex: 0 0 auto;
}

.cash-payment-overview,
.timeline-payment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: 0.75rem;
}

.cash-payment-overview > div,
.timeline-payment-grid > div {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface-2);
}

.cash-payment-overview span,
.timeline-payment-grid span {
  color: var(--muted);
  font-size: 0.84rem;
}

.cash-payment-overview strong,
.timeline-payment-grid strong {
  color: var(--text);
  overflow-wrap: anywhere;
}

.sale-timeline {
  position: relative;
  display: grid;
  gap: 0.85rem;
}

.sale-timeline::before {
  content: '';
  position: absolute;
  left: 49px;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: var(--border);
}

.sale-timeline-item {
  position: relative;
  min-width: 0;
}

.sale-timeline-summary {
  position: relative;
  display: grid;
  grid-template-columns: 98px minmax(0, 1fr) minmax(140px, 0.8fr) auto;
  gap: 0.8rem;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface-2);
  color: var(--text);
  text-align: left;
}

.sale-timeline-summary:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.sale-timeline-marker {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 70px;
  min-height: 34px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-text);
  font-weight: 900;
}

.sale-timeline-main {
  display: grid;
  min-width: 0;
}

.sale-timeline-main strong,
.sale-timeline-main small,
.sale-timeline-payment {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale-timeline-main small,
.sale-timeline-payment {
  color: var(--muted);
}

.sale-timeline-total {
  justify-self: end;
  font-weight: 900;
  white-space: nowrap;
}

.sale-timeline-detail {
  display: grid;
  gap: 0.85rem;
  margin: 0.5rem 0 0 98px;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
}

.timeline-detail-table {
  min-width: 560px;
}

.product-report-table {
  min-width: 980px;
}

.sales-table {
  min-width: 1120px;
}

.product-name-button span,
.product-name-button small {
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 768px) {
  .topbar-user-area {
    width: 100%;
    justify-content: flex-end;
  }

  .notification-dropdown,
  .user-menu-dropdown {
    position: fixed;
    top: calc(clamp(1rem, 2vw, 2rem) + 52px);
    right: 1rem;
    left: 1rem;
    width: auto;
    max-width: none;
  }

  .user-menu-button {
    min-width: 0;
    max-width: min(260px, 68vw);
  }

  .sale-timeline::before {
    left: 32px;
  }

  .sale-timeline-summary {
    grid-template-columns: 70px minmax(0, 1fr);
  }

  .sale-timeline-payment,
  .sale-timeline-total {
    grid-column: 2;
    justify-self: start;
  }

  .sale-timeline-detail {
    margin-left: 0;
  }

  .sales-filter-grid,
  .product-report-filter-form {
    grid-template-columns: 1fr;
  }
}

/* Responsive hardening layer: keep every screen inside the available viewport. */
html,
body {
  max-width: 100%;
  overflow-x: clip;
}

img,
svg,
canvas,
video {
  max-width: 100%;
  height: auto;
}

.app-shell,
.main-content,
.content-frame,
.card,
.card-dark,
.table-card,
.filter-panel,
.sale-panel,
.cash-panel,
.dashboard-panel,
.report-chart-panel,
.settings-tabs,
.settings-tab-panel,
.product-details-panel,
.company-card,
.master-subscription-box {
  min-width: 0;
}

.content-frame {
  width: 100%;
  max-width: min(1480px, calc(100vw - var(--sidebar-width)));
  padding-inline: clamp(0.85rem, 1.6vw, 2rem);
}

.app-shell.sidebar-collapsed .content-frame {
  max-width: min(1480px, calc(100vw - var(--sidebar-collapsed-width)));
}

.app-shell:not(:has(.sidebar)) .content-frame {
  max-width: min(100%, 1480px);
}

.topbar {
  min-width: 0;
}

.topbar-user-area {
  max-width: 100%;
}

.notification-menu,
.user-menu {
  min-width: 0;
}

.user-menu-button {
  min-width: 0;
}

.notification-dropdown,
.user-menu-dropdown {
  max-width: calc(100vw - 1.5rem);
}

.d-flex {
  min-width: 0;
}

h1,
h2,
h3,
h4,
h5,
h6,
p,
span,
small,
strong,
label,
a,
button,
td,
th {
  overflow-wrap: normal;
  word-break: normal;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  max-width: 100%;
  white-space: nowrap;
  text-align: center;
}

.table-responsive {
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

.app-table,
.compact-table,
.sales-table,
.product-table,
.category-table,
.company-table,
.report-sales-table,
.product-report-table,
.payable-table,
.cash-register-table,
.timeline-detail-table,
.sale-detail-table {
  max-width: 100%;
}

.app-table th,
.app-table td {
  white-space: normal;
}

.quick-filter-grid,
.category-filter-grid,
.report-filter-form,
.advanced-filters,
.sales-filter-grid,
.product-report-filter-form,
.settings-form-grid,
.master-key-form,
.company-subscription-form,
.company-details-stats,
.cash-register-meta,
.cash-register-detail-columns,
.permission-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
}

.product-filter-grid {
  grid-template-columns: minmax(220px, 1fr) minmax(128px, 0.5fr) minmax(170px, 0.7fr) max-content;
}

.dashboard-grid,
.dashboard-detail-grid,
.report-summary-grid,
.daily-peak-grid,
.cash-summary-grid,
.company-card-grid,
.subscription-plan-grid,
.subscription-benefit-grid,
.payable-summary-grid,
.master-overview-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
}

.filter-actions,
.table-actions,
.product-actions,
.catalog-pagination,
.catalog-pagination-actions,
.dashboard-panel-header,
.cash-panel-header,
.company-card-header,
.employee-card-header,
.subscription-page-head,
.subscription-hero-panel,
.subscription-empty-panel,
.subscription-license-panel,
.subscription-plan-head,
.master-toolbar {
  min-width: 0;
}

.dashboard-list-item,
.payment-summary > div,
.discount-preview > div,
.settings-summary > div {
  grid-template-columns: minmax(0, 1fr) auto;
}

.dashboard-list-item > span,
.sale-total-box strong,
.sale-discount-summary strong,
.payment-summary strong,
.discount-preview strong,
.settings-summary strong {
  min-width: 0;
  white-space: normal;
}

.sale-layout,
.report-layout,
.settings-layout,
.master-subscription-actions,
.sale-payment-layout {
  grid-template-columns: minmax(0, 1fr) minmax(min(100%, 320px), 0.38fr);
}

.sale-item-row,
.product-inline-form,
.payable-form {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
}

.sale-item-row > div:first-child,
.product-inline-form > div:first-child,
.payable-form > div:first-child {
  grid-column: span 2;
}

.sale-row-action,
.product-inline-actions {
  align-self: end;
}

.sale-row-action .btn,
.product-inline-actions .btn,
.cash-action-form .btn {
  width: 100%;
}

.product-kit-fields,
.machine-fee-row,
.cash-action-form,
.company-main-form,
.company-inline-edit,
.employee-search-row,
.email-recipient-input-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.product-profit-summary,
.activation-status-grid,
.subscription-overview,
.subscription-price-grid,
.cash-payment-overview,
.timeline-payment-grid,
.company-stat-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
}

.report-chart {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.report-chart-column {
  min-width: clamp(18px, 3vw, 46px);
}

.report-chart--hourly .report-chart-column {
  min-width: clamp(22px, 3vw, 42px);
}

.sale-timeline-summary {
  grid-template-columns: minmax(64px, 86px) minmax(0, 1fr) minmax(0, 160px) auto;
}

.sale-timeline-detail {
  max-width: 100%;
  overflow: hidden;
}

@media (max-width: 1180px) {
  .content-frame,
  .app-shell.sidebar-collapsed .content-frame {
    max-width: 100%;
  }

  .sale-layout,
  .report-layout,
  .settings-layout,
  .master-subscription-actions,
  .sale-payment-layout {
    grid-template-columns: 1fr;
  }

  .sale-item-row > div:first-child,
  .product-inline-form > div:first-child,
  .payable-form > div:first-child {
    grid-column: auto;
  }

  .report-summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  }
}

@media (max-width: 960px) {
  html,
  body {
    overflow-x: hidden;
  }

  .app-shell {
    display: block;
  }

  .sidebar,
  .app-shell.sidebar-collapsed .sidebar {
    width: 100%;
    min-height: auto;
    flex-basis: auto;
  }

  .sidebar-sticky,
  .app-shell.sidebar-collapsed .sidebar-sticky {
    position: static;
    padding: 0.85rem;
  }

  .sidebar-header {
    align-items: center;
  }

  .app-shell.sidebar-collapsed .brand-block {
    display: flex;
  }

  .sidebar .nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
    gap: 0.5rem;
    margin-top: 1rem !important;
  }

  .sidebar .nav-link,
  .app-shell.sidebar-collapsed .sidebar .nav-link {
    justify-content: flex-start;
  }

  .app-shell.sidebar-collapsed .nav-label {
    display: inline;
  }

  .content-frame,
  .app-shell.sidebar-collapsed .content-frame {
    max-width: 100%;
    padding: 0.85rem;
  }

  .topbar {
    justify-content: stretch;
  }

  .topbar-user-area {
    width: 100%;
  }

  .user-menu {
    flex: 1 1 auto;
  }

  .user-menu-button {
    width: 100%;
    max-width: none;
  }

  .notification-dropdown,
  .user-menu-dropdown {
    position: fixed;
    top: 4.5rem;
    left: 0.75rem;
    right: 0.75rem;
    width: auto;
    max-width: none;
  }

  .cash-panel-header,
  .dashboard-panel-header,
  .subscription-page-head,
  .subscription-hero-panel,
  .subscription-empty-panel,
  .subscription-license-panel,
  .subscription-plan-head,
  .employee-card-header,
  .company-card-header {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-actions,
  .product-danger-actions,
  .catalog-pagination,
  .catalog-pagination-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-actions .btn,
  .catalog-pagination-actions .btn,
  .subscription-hero-panel .btn,
  .subscription-empty-panel .btn,
  .subscription-license-panel .btn {
    width: 100%;
  }

  .cash-action-form,
  .product-kit-fields,
  .machine-fee-row,
  .company-main-form,
  .company-inline-edit,
  .employee-search-row {
    grid-template-columns: 1fr;
  }

  .employee-search-row .product-suggestion-list {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  .content-frame {
    padding: 0.7rem;
  }

  .brand-logo {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .brand-block h4 {
    font-size: 1.05rem;
  }

  .sidebar-toggle {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .sidebar .nav {
    grid-template-columns: 1fr;
  }

  .topbar-user-area {
    gap: 0.55rem;
  }

  .user-menu-button {
    grid-template-columns: 34px minmax(0, 1fr) 16px;
    gap: 0.5rem;
  }

  .user-menu-avatar {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .notification-button {
    width: 40px;
    height: 40px;
  }

  .card-dark,
  .sale-panel,
  .cash-panel,
  .dashboard-panel,
  .filter-panel,
  .master-log-panel {
    padding: 0.85rem;
  }

  .dashboard-list-item,
  .settings-summary > div,
  .payment-summary > div,
  .discount-preview > div,
  .sale-total-box,
  .sale-discount-summary {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.25rem;
    text-align: left;
  }

  .dashboard-list-item > span,
  .settings-summary strong,
  .payment-summary strong,
  .discount-preview strong,
  .sale-total-box strong,
  .sale-discount-summary strong {
    text-align: left;
  }

  .product-table .product-summary-row,
  .cash-register-summary-row {
    grid-template-columns: 1fr;
  }

  .product-table .product-summary-row td,
  .cash-register-summary-row td {
    text-align: left !important;
  }

  .sale-payment-step {
    inset: 0.55rem;
    width: auto;
    max-height: none;
    transform: none;
  }

  .discount-modal,
  .sale-quantity-modal {
    align-items: stretch;
    padding: 0.7rem;
  }

  .discount-dialog,
  .sale-quantity-dialog {
    align-self: center;
  }

  .sale-timeline::before {
    left: 25px;
  }

  .sale-timeline-summary {
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 0.55rem;
  }

  .sale-timeline-marker {
    width: 50px;
    min-height: 30px;
    font-size: 0.78rem;
  }

  .sale-timeline-payment,
  .sale-timeline-total {
    grid-column: 2;
    justify-self: start;
  }

  .sale-timeline-detail {
    margin-left: 0;
    padding: 0.7rem;
  }

  .report-chart {
    padding: 0.55rem;
  }

  .report-chart-track {
    min-height: 150px;
  }

  .report-section-header {
    padding: 0.85rem;
  }
}

.audit-filter-card {
  padding: 1rem;
  container-type: inline-size;
  overflow: visible;
}

.audit-page {
  --audit-bg: #e9fbf6;
  --audit-surface: #f7fffc;
  --audit-surface-2: #dff7f0;
  --audit-border: rgba(20, 184, 166, 0.34);
  --audit-accent: #0f766e;
  --audit-accent-rgb: 15, 118, 110;
  --audit-gold: #b7791f;
  --audit-gold-rgb: 183, 121, 31;
  display: grid;
  gap: 1rem;
}

[data-theme='dark'] .audit-page {
  --audit-bg: #061c21;
  --audit-surface: #0a242b;
  --audit-surface-2: #10343b;
  --audit-border: rgba(45, 212, 191, 0.28);
  --audit-accent: #2dd4bf;
  --audit-accent-rgb: 45, 212, 191;
  --audit-gold: #f6c453;
  --audit-gold-rgb: 246, 196, 83;
}

.audit-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(1rem, 2vw, 1.25rem);
  border: 1px solid var(--audit-border);
  border-radius: 0.75rem;
  background:
    linear-gradient(135deg, rgba(var(--audit-accent-rgb), 0.16), rgba(var(--audit-gold-rgb), 0.08)),
    var(--audit-surface);
  box-shadow: 0 18px 44px rgba(3, 15, 18, 0.18);
}

.audit-page-header h2 {
  margin-bottom: 0.35rem;
}

.audit-page .audit-filter-card,
.audit-page .audit-table-card {
  border-color: var(--audit-border);
  background:
    linear-gradient(180deg, rgba(var(--audit-accent-rgb), 0.07), transparent 42%),
    var(--audit-surface);
}

.audit-log-table {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
}

.audit-metric-card {
  display: grid;
  align-content: center;
  gap: 0.35rem;
  min-width: 0;
  min-height: 96px;
  padding: 1rem 1.1rem 1rem 1.35rem;
  position: relative;
  overflow: hidden;
  border-color: var(--audit-border);
  border-radius: 0.7rem;
  background: var(--audit-surface);
}

.audit-metric-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--audit-accent);
}

.audit-metric-card-users::before {
  background: var(--info);
}

.audit-metric-card-actions::before {
  background: var(--audit-gold);
}

.audit-metric-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 1rem;
  align-items: stretch;
}

.audit-metric-card span,
.audit-metric-card strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-metric-card span {
  font-size: clamp(0.9rem, 0.78rem + 0.36vw, 1.05rem);
  line-height: 1.15;
}

.audit-metric-card strong {
  font-size: clamp(1.25rem, 1.06rem + 0.6vw, 1.75rem);
  line-height: 1;
}

.stock-filter-card {
  padding: 1rem;
  container-type: inline-size;
}

.stock-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.stock-filter-field,
.stock-filter-actions {
  min-width: 0;
}

.stock-filter-field .form-label,
.stock-filter-actions .btn {
  white-space: nowrap;
}

.stock-filter-field .form-control,
.stock-filter-field .form-select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-inline-size: 0;
  min-height: 42px;
  padding-inline: 0.68rem;
  text-overflow: ellipsis;
}

.stock-filter-date .form-control {
  font-size: clamp(0.86rem, 0.78rem + 0.18vw, 1rem);
}

.stock-filter-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-column: span 2;
  gap: 12px;
}

.stock-filter-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 42px;
  padding-inline: 0.65rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audit-filter-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  width: 100%;
  min-width: 0;
}

.audit-filter-row-master {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-width: 0;
}

.audit-filter-field {
  min-width: 0;
}

.audit-filter-field .form-label,
.audit-filter-actions .btn {
  white-space: nowrap;
}

.audit-filter-field .form-label {
  font-size: 0.95rem;
}

.audit-filter-field .form-control,
.audit-filter-field .form-select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-inline-size: 0;
  min-height: 42px;
  padding-inline: 0.68rem;
  text-overflow: ellipsis;
}

.audit-filter-date .form-control {
  font-size: clamp(0.86rem, 0.78rem + 0.18vw, 1rem);
}

.audit-filter-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  min-width: 0;
}

.audit-filter-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 42px;
  padding-inline: 0.65rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

@container (min-width: 1381px) {
  .audit-filter-row:not(.audit-filter-row-master) .audit-filter-actions {
    grid-column: auto;
  }
}

@container (max-width: 780px) {
  .audit-filter-row,
  .audit-filter-row-master,
  .stock-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .audit-filter-actions,
  .stock-filter-actions {
    grid-column: 1 / -1;
  }
}

@container (max-width: 480px) {
  .audit-filter-row,
  .audit-filter-row-master,
  .audit-filter-actions,
  .stock-filter-grid,
  .stock-filter-actions {
    grid-template-columns: 1fr;
  }

  .audit-filter-actions,
  .stock-filter-actions {
    grid-column: auto;
  }
}

.audit-table {
  width: 100%;
  min-width: 860px;
  table-layout: fixed;
}

.audit-table th,
.audit-table td {
  padding: 0.85rem 0.75rem;
  overflow-wrap: normal;
  word-break: normal;
  vertical-align: middle;
}

.audit-table th:nth-child(1),
.audit-table td:nth-child(1) {
  width: 14%;
}

.audit-table th:nth-child(2),
.audit-table td:nth-child(2) {
  width: 13%;
}

.audit-table th:nth-child(3),
.audit-table td:nth-child(3) {
  width: 16%;
}

.audit-table th:nth-child(4),
.audit-table td:nth-child(4) {
  width: 12%;
}

.audit-table th:nth-child(5),
.audit-table td:nth-child(5) {
  width: 35%;
}

.audit-table th:nth-child(6),
.audit-table td:nth-child(6) {
  width: 10%;
}

.audit-table thead th {
  background: rgba(var(--audit-accent-rgb), 0.1);
  color: var(--text);
  font-size: 0.86rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.audit-table tbody tr.expandable-row {
  transition: background 140ms ease, box-shadow 140ms ease;
}

.audit-table tbody tr.expandable-row:hover {
  background: rgba(var(--audit-accent-rgb), 0.08);
  box-shadow: inset 3px 0 0 var(--audit-accent);
}

.audit-date,
.audit-user,
.audit-description,
.audit-entity,
.audit-id,
.audit-ip {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audit-date,
.audit-user {
  color: var(--text);
  font-weight: 850;
  white-space: nowrap;
}

.audit-table td small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.audit-description {
  max-width: none;
  color: var(--text);
  white-space: nowrap;
}

.audit-entity,
.audit-id,
.audit-ip {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.84rem;
  white-space: nowrap;
}

.audit-action-pill,
.audit-module-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-height: 30px;
  padding: 0.34rem 0.64rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-action-pill {
  border-color: rgba(var(--audit-gold-rgb), 0.36);
  background: rgba(var(--audit-gold-rgb), 0.14);
  color: var(--audit-gold);
}

.audit-module-pill {
  border-color: rgba(var(--audit-accent-rgb), 0.34);
  background: rgba(var(--audit-accent-rgb), 0.13);
  color: var(--audit-accent);
}

.audit-detail-panel {
  display: grid;
  gap: 1rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 1rem;
  overflow: hidden;
  border: 1px solid var(--audit-border);
  border-radius: 0.75rem;
  background:
    linear-gradient(135deg, rgba(var(--audit-accent-rgb), 0.08), rgba(var(--audit-gold-rgb), 0.06)),
    var(--audit-bg);
}

.audit-change-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 1rem;
  align-items: start;
  min-width: 0;
}

.audit-change-card {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--audit-border);
  border-radius: 0.75rem;
  background: var(--audit-surface);
}

.audit-change-card h6 {
  margin: 0;
  color: var(--audit-accent);
  font-size: 0.86rem;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.audit-change-card-after h6 {
  color: var(--audit-gold);
}

.audit-value-list {
  display: grid;
  gap: 0.55rem;
  min-width: 0;
}

.audit-value-item {
  display: grid;
  grid-template-columns: minmax(120px, 0.34fr) minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
  min-width: 0;
  padding: 0.65rem;
  border: 1px solid rgba(var(--audit-accent-rgb), 0.18);
  border-radius: 0.55rem;
  background: rgba(var(--audit-accent-rgb), 0.06);
}

.audit-value-item span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.audit-value-item strong {
  min-width: 0;
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.audit-empty-text,
.audit-user-agent {
  color: var(--muted);
}

.audit-empty-text {
  margin: 0;
}

.audit-request-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 0.65rem;
  min-width: 0;
}

.audit-request-item {
  display: grid;
  grid-template-columns: minmax(84px, 0.28fr) minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  min-width: 0;
  padding: 0.65rem;
  border: 1px solid rgba(var(--audit-accent-rgb), 0.16);
  border-radius: 0.55rem;
  background: var(--audit-surface);
}

.audit-request-item span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
  white-space: nowrap;
}

.audit-request-item strong {
  min-width: 0;
  color: var(--text);
  font-size: clamp(0.78rem, 0.72rem + 0.22vw, 0.92rem);
  font-weight: 800;
  text-align: right;
  overflow-wrap: anywhere;
  white-space: normal;
}

.audit-user-agent {
  padding: 0.75rem;
  border: 1px solid rgba(var(--audit-accent-rgb), 0.16);
  border-radius: 0.55rem;
  background: rgba(var(--audit-accent-rgb), 0.05);
  overflow-wrap: anywhere;
}

@media (max-width: 780px) {
  .audit-change-grid {
    grid-template-columns: 1fr;
  }

  .audit-value-item {
    grid-template-columns: 1fr;
  }

  .audit-request-item {
    grid-template-columns: 1fr;
  }

  .audit-request-item strong {
    text-align: left;
  }
}

@media (max-width: 980px) {
  .audit-log-table {
    overflow-x: visible;
  }

  .audit-table {
    min-width: 0;
  }

  .audit-table thead {
    display: none;
  }

  .audit-table,
  .audit-table tbody,
  .audit-table tr,
  .audit-table td {
    display: block;
    width: 100%;
  }

  .audit-table tbody {
    display: grid;
    gap: 0.75rem;
  }

  .audit-table tbody tr.expandable-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem 0.8rem;
    padding: 0.85rem;
    border: 1px solid var(--audit-border);
    border-radius: 0.75rem;
    background: rgba(var(--audit-accent-rgb), 0.06);
  }

  .audit-table tbody tr.expandable-row td {
    display: grid;
    grid-template-columns: minmax(86px, 0.36fr) minmax(0, 1fr);
    gap: 0.55rem;
    align-items: center;
    min-width: 0;
    padding: 0;
    border: 0;
  }

  .audit-table tbody tr.expandable-row td:nth-child(5),
  .audit-table tbody tr.expandable-row td:nth-child(6) {
    grid-column: 1 / -1;
  }

  .audit-table tbody tr.expandable-row td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 900;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
  }

  .audit-description {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .audit-table tbody tr.expandable-detail-row {
    display: none;
  }

  .audit-table tbody tr.expandable-detail-row.is-visible {
    display: block;
    margin-top: -0.75rem;
  }

  .audit-table tbody tr.expandable-detail-row td {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
  }
}

@media (max-width: 560px) {
  .audit-table tbody tr.expandable-row {
    grid-template-columns: 1fr;
  }

  .audit-table tbody tr.expandable-row td {
    grid-template-columns: minmax(84px, 0.32fr) minmax(0, 1fr);
  }

  .audit-action-pill,
  .audit-module-pill {
    justify-content: flex-start;
  }
}

.stock-operation-card {
  max-width: 1120px;
}

.stock-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.stock-preview span,
.metric-card span {
  color: var(--muted);
  display: block;
  font-weight: 700;
}

.stock-preview strong,
.metric-card strong {
  color: var(--text);
  font-size: 1.25rem;
}

.expandable-row {
  cursor: pointer;
}

.expandable-detail-row {
  display: none;
}

.expandable-detail-row.is-visible {
  display: table-row;
}

.audit-detail-grid {
  display: grid;
  gap: 16px;
}

.audit-detail-grid code {
  display: block;
  width: 100%;
  padding: 6px 8px;
  margin-bottom: 6px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Login polish */
body:has(.login-screen) {
  overflow: hidden;
}

.app-shell:has(.login-screen),
.main-content:has(.login-screen) {
  min-height: 100vh;
}

.content-frame:has(.login-screen) {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 100%;
  height: 100vh;
  padding: clamp(0.75rem, 2vw, 1.25rem);
  overflow: hidden;
}

.login-screen {
  width: 100%;
  min-height: 0 !important;
  margin: 0;
}

.login-screen > [class*='col-'] {
  width: min(100%, 520px);
}

.login-screen .card {
  max-height: calc(100vh - clamp(1.5rem, 4vw, 2.5rem));
  overflow-y: auto;
}

.login-screen .login-brand-logo {
  box-shadow: none;
}

.login-screen .login-tab-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  box-shadow: none;
}

.login-screen .login-tab-nav .nav-item {
  min-width: 0;
  width: 100%;
}

.login-screen .login-tab-nav .settings-tab-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  text-align: center;
  box-shadow: none;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.login-screen .login-tab-nav .nav-item:first-child .settings-tab-button {
  border-radius: 0.5rem 0 0 0.5rem;
}

.login-screen .login-tab-nav .nav-item:last-child .settings-tab-button {
  border-left: 0;
  border-radius: 0 0.5rem 0.5rem 0;
}

.login-screen .login-tab-nav .settings-tab-button.is-active,
.login-screen .login-tab-nav .settings-tab-button.active {
  border-color: var(--border);
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.login-screen .login-tab-nav .settings-tab-button:hover,
.login-screen .login-tab-nav .settings-tab-button:focus-visible,
.login-screen .login-tab-nav .settings-tab-button.is-active:hover,
.login-screen .login-tab-nav .settings-tab-button.active:hover,
.login-screen .login-tab-nav .settings-tab-button.is-active:focus-visible,
.login-screen .login-tab-nav .settings-tab-button.active:focus-visible {
  border-color: var(--primary);
  background: var(--accent-soft);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(var(--primary-rgb), 0.18);
}

.login-screen .login-tab-nav .nav-item:last-child .settings-tab-button:hover,
.login-screen .login-tab-nav .nav-item:last-child .settings-tab-button:focus-visible {
  border-left: 1px solid var(--primary);
}

.login-screen .card {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
}

.login-screen .login-brand,
.login-screen .login-tab-nav {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

.login-screen .login-tab-nav {
  margin-bottom: 1rem !important;
}

.login-screen .login-tab-content {
  position: relative;
  z-index: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.2rem;
  scrollbar-width: thin;
}

.login-screen .tab-pane {
  min-height: 0;
}

.product-list-layout {
  display: grid;
  grid-template-columns: minmax(280px, 330px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.product-category-sidebar {
  position: sticky;
  top: 1rem;
  display: grid;
  gap: 0.75rem;
  max-height: calc(100vh - 2rem);
  padding: 0.9rem;
  overflow: hidden;
}

.product-category-sidebar-title {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.product-list-card {
  min-width: 0;
}

.category-chip-nav.category-chip-nav-vertical {
  display: grid;
  gap: 0.5rem;
  max-height: min(520px, calc(100vh - 8rem));
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.1rem 0.15rem 0.1rem 0;
}

.category-chip-nav.category-chip-nav-vertical .category-chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  justify-content: space-between;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border-radius: 0.5rem;
  text-align: left;
  white-space: nowrap;
}

.category-chip-nav.category-chip-nav-vertical .category-chip .category-chip-name {
  display: block;
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
  line-height: 1.18;
  overflow-wrap: normal;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.category-chip-nav.category-chip-nav-vertical .category-chip .category-chip-count {
  align-self: center;
  justify-self: end;
}

@media (max-height: 760px) {
  .login-screen .card {
    padding: 1rem !important;
  }

  .login-screen .login-brand {
    margin-bottom: 0.7rem;
  }

  .login-screen .login-brand-logo {
    width: 56px;
    height: 56px;
    flex-basis: 56px;
  }
}

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

  .product-category-sidebar {
    position: static;
    max-height: none;
  }

  .category-chip-nav.category-chip-nav-vertical {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
    max-height: none;
    overflow: visible;
    padding: 0;
  }
}

.sales-table thead th {
  vertical-align: bottom;
}

.sales-filter-row th {
  padding-top: 0;
  background: var(--surface);
}

.sales-filter-row .form-control,
.sales-filter-row .form-select {
  width: 100%;
  min-width: 0;
  border-color: rgba(var(--primary-rgb), 0.22);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.82rem;
}

.sales-filter-row .btn {
  min-height: 34px;
  padding-inline: 0.55rem;
}

.sales-table thead {
  position: relative;
  z-index: 12;
}

.sales-table thead th {
  vertical-align: middle;
}

.sales-column-filter {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-width: max-content;
  min-height: 42px;
}

.sales-column-search {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  min-height: 42px;
}

.sales-column-search span {
  color: var(--text);
  font-weight: 900;
  white-space: nowrap;
}

.sales-column-search .form-control {
  width: min(148px, 100%);
  min-width: 0;
  min-height: 34px;
  border-color: rgba(var(--primary-rgb), 0.18);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.82rem;
}

.sales-column-search .form-control::placeholder {
  color: var(--muted);
  opacity: 0.9;
}

.sales-column-search .form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.14);
}

.sales-column-filter--right {
  justify-content: flex-end;
}

.sales-column-filter summary {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 34px;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
  user-select: none;
}

.sales-column-filter summary::-webkit-details-marker {
  display: none;
}

.sales-column-filter summary::after {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-0.1rem);
  transition: transform 120ms ease, border-color 120ms ease;
}

.sales-column-filter[open] summary,
.sales-column-filter summary:hover {
  color: var(--primary);
}

.sales-column-filter[open] summary::after,
.sales-column-filter summary:hover::after {
  border-color: var(--primary);
}

.sales-column-filter[open] summary::after {
  transform: rotate(-135deg) translateY(-0.1rem);
}

.sales-filter-popover {
  position: absolute;
  z-index: 20;
  top: calc(100% + 0.35rem);
  left: 0;
  display: grid;
  gap: 0.5rem;
  width: min(280px, 74vw);
  min-width: 190px;
  padding: 0.75rem;
  border: 1px solid rgba(var(--primary-rgb), 0.32);
  border-radius: 0.55rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.sales-filter-popover--options {
  width: min(320px, 74vw);
  padding: 0.65rem;
}

.sales-filter-popover span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.sales-filter-popover .form-control,
.sales-filter-popover .form-select {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  border-color: rgba(var(--primary-rgb), 0.24);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.86rem;
}

.sales-filter-popover .form-control:focus,
.sales-filter-popover .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.14);
}

.sales-filter-option-list {
  display: grid;
  gap: 0.15rem;
  padding: 0.25rem;
  border: 1px solid rgba(var(--primary-rgb), 0.2);
  border-radius: 0.55rem;
  background: var(--surface-2);
}

.sales-filter-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 34px;
  padding: 0.38rem 0.5rem;
  border: 0;
  border-radius: 0.42rem;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.2;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}

.sales-filter-option::before {
  content: "";
  width: 1rem;
  flex: 0 0 1rem;
  color: var(--primary);
  font-weight: 900;
}

.sales-filter-option.is-active::before {
  content: "✓";
}

.sales-filter-option:hover,
.sales-filter-option:focus-visible {
  background: rgba(var(--primary-rgb), 0.14);
  color: var(--text);
  outline: none;
}

.sales-filter-option.is-active {
  background: rgba(var(--primary-rgb), 0.18);
}

.sales-column-filter--right .sales-filter-popover {
  right: 0;
  left: auto;
}

.sales-column-filter:not([open]) .sales-filter-popover {
  display: none;
}

.sales-column-filter.is-filtered summary::before {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.14);
}

.sales-filter-clear-button {
  min-height: 34px;
  min-width: 0;
  width: 100%;
  max-width: 132px;
  white-space: nowrap;
}

.sale-items-header {
  display: grid;
  grid-template-columns: minmax(260px, 1.55fr) minmax(104px, 0.55fr) minmax(104px, 0.55fr) minmax(82px, 0.38fr) minmax(118px, 0.65fr) minmax(84px, auto);
  gap: 0.55rem;
  align-items: center;
  padding: 0 0.65rem 0.45rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.sale-items-lines {
  gap: 0.45rem;
}

.sale-items-lines .sale-item-row {
  grid-template-columns: minmax(260px, 1.55fr) minmax(104px, 0.55fr) minmax(104px, 0.55fr) minmax(82px, 0.38fr) minmax(118px, 0.65fr) minmax(84px, auto);
  gap: 0.55rem;
  align-items: center;
  padding: 0.6rem 0.65rem;
  border-radius: 0.45rem;
}

.sale-items-lines .sale-item-row > div:first-child {
  grid-column: auto;
}

.sale-items-lines .sale-item-row > div {
  display: flex;
  align-items: center;
  min-height: 42px;
}

.sale-items-lines .sale-item-row .form-label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sale-items-lines .sale-item-row .form-control {
  min-height: 38px;
  padding-block: 0.45rem;
}

.sale-items-lines .sale-stock-warning {
  display: none !important;
}

.sale-items-lines .sale-row-action .btn {
  min-height: 38px;
  padding-inline: 0.55rem;
}

@media (max-width: 1100px) {
  .sale-items-header {
    display: grid;
  }

  .sale-items-lines .sale-item-row {
    grid-template-columns: minmax(220px, 1.65fr) minmax(96px, 0.55fr) minmax(88px, 0.5fr) minmax(70px, 0.35fr) minmax(100px, 0.55fr) minmax(82px, auto);
    padding: 0.6rem 0.65rem;
  }

  .sale-items-lines .sale-item-row > div:first-child {
    grid-column: auto;
  }

  .sale-items-lines .sale-item-row .form-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }
}

.sale-items-header,
.sale-items-lines .sale-item-row,
html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .sale-items-lines .sale-item-row {
  grid-template-columns: minmax(260px, 1.7fr) minmax(108px, 0.55fr) minmax(96px, 0.48fr) minmax(72px, 0.34fr) minmax(108px, 0.55fr) minmax(92px, auto) !important;
}

.sale-items-lines .sale-item-row > div:first-child,
html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .sale-items-lines .sale-item-row > div:first-child {
  grid-column: auto !important;
}

@media (max-width: 860px) {
  .sale-items-header {
    display: none;
  }

  .sale-items-lines .sale-item-row,
  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .sale-items-lines .sale-item-row {
    grid-template-columns: 1fr !important;
    padding: 0.85rem;
  }

  .sale-items-lines .sale-item-row .form-label {
    position: static;
    width: auto;
    height: auto;
    margin: 0 0 0.35rem;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }
}

.sale-page-header h2 {
  margin: 0;
  font-size: clamp(2rem, 1.55rem + 1.45vw, 3.1rem);
  font-weight: 950;
  line-height: 1;
}

.sale-page-header p {
  font-size: clamp(1rem, 0.92rem + 0.35vw, 1.2rem);
}

.sale-page-header {
  padding: clamp(1.1rem, 0.9rem + 0.8vw, 1.65rem);
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  border-radius: 0.9rem;
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.09), transparent 44%),
    linear-gradient(160deg, rgba(var(--primary-rgb), 0.08), transparent 52%),
    var(--surface);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.12);
}

.sale-page-header .btn {
  min-width: 110px;
  min-height: 46px;
  border-radius: 0.65rem;
  font-weight: 850;
}

.sale-form-shell .sale-layout {
  grid-template-columns: minmax(0, 1fr) minmax(380px, 440px);
  gap: clamp(1rem, 1.45vw, 1.35rem);
  align-items: start;
}

.sale-products-panel,
.sale-summary-panel {
  padding: clamp(1.15rem, 0.95rem + 0.7vw, 1.6rem);
  border-color: rgba(var(--accent-rgb), 0.18);
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.055), transparent 28%),
    var(--surface);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.12);
}

.sale-products-panel h5,
.sale-summary-panel h5 {
  font-size: clamp(1.25rem, 1.04rem + 0.58vw, 1.65rem);
  font-weight: 950;
  line-height: 1.1;
}

.sale-product-picker {
  padding: clamp(1rem, 0.85rem + 0.55vw, 1.35rem);
  border-color: rgba(var(--accent-rgb), 0.24);
  border-radius: 0.75rem;
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.08), transparent 52%),
    var(--surface-2);
}

.sale-product-picker .form-label {
  font-size: 1rem;
  font-weight: 900;
}

.sale-product-picker .form-control {
  min-height: 58px;
  font-size: clamp(1.05rem, 0.95rem + 0.35vw, 1.25rem);
  font-weight: 750;
  border-radius: 0.7rem;
}

.sale-summary-panel {
  position: sticky;
  top: 1rem;
  display: grid;
  gap: 0.75rem;
}

.sale-total-box--primary {
  display: grid;
  gap: 0.25rem;
  padding: clamp(1.1rem, 0.9rem + 0.75vw, 1.6rem);
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  border-left: 0.35rem solid var(--accent);
  border-radius: 0.85rem;
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.16), rgba(var(--primary-rgb), 0.1)),
    var(--surface-2);
  box-shadow: 0 16px 34px rgba(var(--accent-rgb), 0.11);
}

.sale-total-box--primary span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sale-total-box--primary strong {
  color: var(--accent);
  font-size: clamp(2.15rem, 1.35rem + 2vw, 3.65rem);
  font-weight: 950;
  line-height: 1;
  text-align: right;
  text-shadow: 0 0 22px rgba(var(--accent-rgb), 0.22);
  white-space: nowrap;
}

.sale-summary-panel .sale-discount-summary {
  align-items: center;
  padding: 0.85rem 0.15rem;
  font-size: 1rem;
}

.sale-summary-panel .sale-discount-summary strong {
  color: var(--warning);
  font-size: 1.08rem;
}

.sale-summary-panel .btn {
  min-height: 56px;
  border-radius: 0.7rem;
  font-size: 1.03rem;
  font-weight: 900;
}

.sale-items-header,
.sale-items-lines .sale-item-row,
html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .sale-items-lines .sale-item-row {
  grid-template-columns: minmax(0, 1.9fr) minmax(112px, 0.56fr) minmax(94px, 0.46fr) minmax(76px, 0.34fr) minmax(120px, 0.58fr) 132px !important;
}

.sale-items-header {
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  border-radius: 0.65rem 0.65rem 0 0;
  background: rgba(var(--accent-rgb), 0.055);
  font-size: 0.82rem;
}

.sale-items-lines {
  gap: 0.65rem;
}

.sale-items-lines .sale-item-row {
  padding: 0.75rem 0.85rem;
  border-color: rgba(var(--accent-rgb), 0.16);
  border-radius: 0;
  background:
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.055), transparent 42%),
    var(--surface-2);
  overflow: hidden;
}

.sale-items-lines .sale-item-row:first-of-type {
  border-top-left-radius: 0.65rem;
  border-top-right-radius: 0.65rem;
}

.sale-items-lines .sale-item-row:last-of-type {
  border-bottom-left-radius: 0.65rem;
  border-bottom-right-radius: 0.65rem;
}

.sale-items-lines .sale-item-row .form-control {
  min-height: 48px;
  border-color: rgba(var(--accent-rgb), 0.18);
  border-radius: 0.55rem;
  font-size: 1rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.025);
}

.sale-items-lines .sale-item-row .form-control[readonly] {
  cursor: default;
}

.sale-items-lines .sale-item-row [data-product-search] {
  border-color: transparent;
  background: transparent;
  font-size: clamp(1.02rem, 0.95rem + 0.28vw, 1.18rem);
  font-weight: 900;
  padding-left: 0.25rem;
}

.sale-items-lines .sale-item-row [data-unit-price],
.sale-items-lines .sale-item-row [data-line-total] {
  color: var(--text);
  font-size: clamp(1.05rem, 0.95rem + 0.38vw, 1.28rem);
  font-weight: 950;
}

.sale-items-lines .sale-item-row [data-line-total] {
  border-color: rgba(var(--accent-rgb), 0.38);
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
}

.sale-items-lines .sale-item-row [data-quantity-input] {
  text-align: center;
  font-size: 1.16rem;
  font-weight: 950;
}

.sale-items-lines .sale-row-action .btn {
  min-height: 48px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  padding-inline: 0.55rem;
  border-radius: 0.55rem;
  font-size: 0.95rem;
  font-weight: 850;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale-items-lines .sale-row-action {
  min-width: 0;
  overflow: hidden;
}

.sale-payment-step {
  width: min(calc(100% - 2rem), 1040px);
  max-height: calc(100vh - 1rem);
  padding: clamp(1rem, 0.8rem + 0.8vw, 1.55rem);
  border-color: rgba(var(--accent-rgb), 0.24);
  border-radius: 0.9rem;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sale-payment-step > .d-flex:first-child {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start !important;
}

.sale-payment-step h5 {
  font-size: clamp(1.35rem, 1.05rem + 0.85vw, 1.85rem);
  font-weight: 950;
  line-height: 1.05;
  white-space: nowrap;
}

.sale-payment-step p {
  max-width: 58rem;
  line-height: 1.35;
}

.sale-payment-step .btn {
  min-height: 48px;
  border-radius: 0.65rem;
  font-weight: 850;
  white-space: nowrap;
}

.sale-payment-step .form-label {
  margin-bottom: 0.45rem;
  font-size: 0.92rem;
  font-weight: 850;
  white-space: nowrap;
}

.sale-payment-step .form-control {
  min-height: 58px;
  border-radius: 0.65rem;
  font-size: clamp(1.18rem, 1.02rem + 0.48vw, 1.45rem);
  font-weight: 950;
}

.sale-payment-step .sale-payment-layout {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: clamp(0.85rem, 1.2vw, 1.25rem);
}

.sale-payment-step .payment-grid {
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  align-items: end;
  margin-top: 0 !important;
}

.sale-payment-step .payment-grid > div {
  min-width: 0;
}

.sale-payment-summary {
  margin-top: 0 !important;
  border-color: rgba(var(--accent-rgb), 0.24);
  border-radius: 0.75rem;
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.08), transparent 48%),
    var(--surface-2);
}

.sale-payment-summary > div {
  display: grid;
  grid-template-columns: minmax(max-content, 0.42fr) minmax(0, 1fr);
  align-items: center;
  column-gap: 0.85rem;
  min-width: 0;
  padding: 0.3rem 0;
}

.sale-payment-summary strong {
  justify-self: end;
  max-width: 100%;
  font-size: clamp(1.12rem, 0.98rem + 0.42vw, 1.45rem);
  font-weight: 950;
  text-align: right;
  white-space: nowrap;
  overflow-wrap: anywhere;
}

.sale-payment-summary span {
  color: var(--muted);
  font-size: clamp(1.05rem, 0.95rem + 0.35vw, 1.25rem);
  font-weight: 850;
  white-space: nowrap;
}

.sale-payment-summary [data-payment-step-total] {
  color: var(--success);
  font-size: clamp(1.75rem, 1.22rem + 1.35vw, 2.45rem);
  font-weight: 950;
}

.sale-payment-summary [data-missing-total] {
  color: var(--danger);
}

.sale-payment-summary [data-change-total] {
  color: var(--info);
}

html[data-text-scale='extra'] .sale-payment-step {
  width: min(calc(100% - 1rem), 960px);
  padding: clamp(0.85rem, 0.7rem + 0.6vw, 1.25rem);
}

html[data-text-scale='extra'] .sale-payment-step > .d-flex:first-child {
  grid-template-columns: minmax(0, 1fr) minmax(180px, auto);
  gap: 0.8rem;
}

html[data-text-scale='extra'] .sale-payment-step h5 {
  font-size: clamp(1.45rem, 1.08rem + 0.8vw, 1.8rem);
  white-space: normal;
}

html[data-text-scale='extra'] .sale-payment-step p {
  max-width: 100%;
  font-size: clamp(0.98rem, 0.86rem + 0.35vw, 1.15rem);
}

html[data-text-scale='extra'] .sale-payment-step .sale-payment-layout {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 330px);
}

html[data-text-scale='extra'] .sale-payment-step .payment-grid {
  grid-template-columns: repeat(2, minmax(130px, 1fr));
}

html[data-text-scale='extra'] .sale-payment-step .form-control {
  min-height: 52px;
  font-size: clamp(1rem, 0.9rem + 0.42vw, 1.25rem);
}

html[data-text-scale='extra'] .sale-payment-summary {
  padding: 0.85rem;
}

html[data-text-scale='extra'] .sale-payment-summary > div {
  grid-template-columns: 1fr;
  align-items: start;
  gap: 0.16rem;
  padding: 0.24rem 0;
}

html[data-text-scale='extra'] .sale-payment-summary strong {
  justify-self: start;
  min-width: 0;
  font-size: clamp(1.04rem, 0.86rem + 0.48vw, 1.34rem);
  line-height: 1.08;
  text-align: left;
  white-space: normal;
}

html[data-text-scale='extra'] .sale-payment-summary span {
  font-size: clamp(0.98rem, 0.84rem + 0.42vw, 1.18rem);
}

html[data-text-scale='extra'] .sale-payment-summary [data-payment-step-total] {
  font-size: clamp(1.72rem, 1.16rem + 1.45vw, 2.25rem);
}

@media (max-width: 1280px) {
  html[data-text-scale='extra'] .sale-payment-step {
    width: min(calc(100% - 1rem), 860px);
  }

  html[data-text-scale='extra'] .sale-payment-step .sale-payment-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1320px) {
  .sale-form-shell .sale-layout {
    grid-template-columns: 1fr;
  }

  .sale-summary-panel {
    position: static;
  }
}

@media (max-width: 1100px) {
  .sale-payment-step {
    width: min(calc(100% - 1rem), 760px);
  }

  .sale-payment-step .sale-payment-layout {
    grid-template-columns: 1fr;
  }

  .sale-payment-step .payment-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .accessibility-options {
    grid-template-columns: 1fr;
  }

  html[data-text-scale='extra'] .sale-payment-step {
    width: min(calc(100% - 0.75rem), 780px);
  }

  html[data-text-scale='extra'] .sale-payment-step > .d-flex:first-child,
  html[data-text-scale='extra'] .sale-payment-step .sale-payment-layout {
    grid-template-columns: 1fr;
  }

  html[data-text-scale='extra'] .sale-payment-step > .d-flex:first-child .btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .sale-payment-step {
    width: calc(100% - 0.75rem);
    max-height: calc(100vh - 0.75rem);
  }

  .sale-payment-step > .d-flex:first-child {
    grid-template-columns: 1fr;
  }

  .sale-payment-step > .d-flex:first-child .btn {
    width: 100%;
  }

  .sale-payment-step h5 {
    white-space: normal;
  }

  .sale-payment-step p {
    font-size: 0.95rem;
  }

  .sale-payment-step .payment-grid {
    grid-template-columns: 1fr;
  }

  .sale-payment-summary [data-payment-step-total] {
    font-size: clamp(1.75rem, 1.35rem + 3vw, 2.25rem);
  }
}

@media (max-width: 760px) {
  .sale-payment-summary > div {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 0.16rem;
  }

  .sale-payment-summary strong {
    justify-self: start;
    text-align: left;
    white-space: normal;
  }
}

@media (max-height: 820px) {
  .sale-payment-step {
    max-height: calc(100vh - 0.5rem);
    padding-block: 0.85rem;
  }

  .sale-payment-step p {
    margin-bottom: 0.75rem !important;
  }

  .sale-payment-step .payment-grid {
    gap: 0.6rem;
  }

  .sale-payment-step .form-control {
    min-height: 50px;
  }

  .sale-payment-summary > div {
    padding: 0.18rem 0;
  }
}

@media (max-height: 820px) and (min-width: 1101px) {
  html[data-text-scale='extra'] .sale-payment-step .sale-payment-layout {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 310px);
  }

  html[data-text-scale='extra'] .sale-payment-step .form-label {
    margin-bottom: 0.25rem;
  }
}

@media (max-width: 860px) {
  .sale-items-header {
    display: none;
  }

  .sale-items-lines .sale-item-row,
  html:not([data-sidebar-state='collapsed']) .app-shell:not(.sidebar-collapsed) .sale-items-lines .sale-item-row {
    grid-template-columns: 1fr !important;
  }

  .sale-total-box--primary strong {
    text-align: left;
  }
}

.product-report-dashboard {
  display: grid;
  gap: 1rem;
}

.product-dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 1rem;
  align-items: stretch;
  padding: 1.1rem;
  border-color: rgba(var(--primary-rgb), 0.36);
  background:
    linear-gradient(135deg, rgba(var(--primary-rgb), 0.16), transparent 42%),
    var(--surface);
}

.dashboard-eyebrow {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.product-dashboard-hero h5,
.product-dashboard-empty h5 {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 2rem);
}

.product-dashboard-hero p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.product-dashboard-hero-metrics,
.product-dashboard-insights {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.product-dashboard-hero-metrics > div,
.product-insight-card {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface-2);
}

.product-dashboard-hero-metrics span,
.product-insight-card span,
.product-insight-card small,
.product-ranking-item span {
  color: var(--muted);
}

.product-dashboard-hero-metrics strong,
.product-insight-card strong,
.product-ranking-item strong,
.product-ranking-item b {
  min-width: 0;
  overflow-wrap: anywhere;
}

.product-insight-card {
  padding: 1rem;
}

.product-insight-card strong {
  font-size: 1rem;
}

.product-dashboard-rankings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.product-ranking-card {
  min-width: 0;
  overflow: hidden;
}

.product-ranking-card .report-section-header {
  padding-bottom: 0.75rem;
}

.product-ranking-list {
  display: grid;
  gap: 0.65rem;
  padding: 0 1rem 1rem;
}

.product-ranking-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  min-width: 0;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface-2);
  overflow: hidden;
}

.product-ranking-item > div {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0.16rem;
  min-width: 0;
}

.product-ranking-item b {
  position: relative;
  z-index: 1;
  color: var(--text);
  white-space: nowrap;
}

.product-ranking-item i {
  position: absolute;
  inset: auto 0 0;
  display: block;
  width: var(--bar-percent, 0%);
  height: 4px;
  background: linear-gradient(90deg, var(--primary), #1f7cff);
}

.product-ranking-item--stock i {
  background: linear-gradient(90deg, #f59e0b, var(--primary));
}

.product-dashboard-empty {
  padding: 1.25rem;
}

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

  .product-dashboard-hero-metrics,
  .product-dashboard-insights {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .product-dashboard-hero-metrics,
  .product-dashboard-insights {
    grid-template-columns: 1fr;
  }

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

  .product-ranking-item b {
    white-space: normal;
  }
}

.product-table th,
.product-table td,
.product-table .product-name-button span,
.product-table .product-name-button small,
.product-table .badge {
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
}

.product-list-card .table-responsive {
  overflow-x: auto;
  overflow-y: visible;
}

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

  .product-category-sidebar {
    position: static;
    max-height: none;
  }

  .category-chip-nav.category-chip-nav-vertical {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    grid-template-columns: none;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.35rem;
  }

  .category-chip-nav.category-chip-nav-vertical .category-chip {
    min-width: max-content;
  }
}

.cash-required-page {
  min-height: min(680px, calc(100vh - 8rem));
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
}

.cash-required-card {
  width: min(100%, 720px);
  display: grid;
  gap: 1rem;
  padding: clamp(1.35rem, 3vw, 2.25rem);
  border-color: rgba(var(--warning-rgb), 0.42);
  background:
    linear-gradient(135deg, rgba(var(--warning-rgb), 0.1), transparent 48%),
    var(--surface);
}

.cash-required-card h2 {
  margin: 0;
  font-size: clamp(1.9rem, 1.35rem + 1.8vw, 3.2rem);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.cash-required-badge {
  width: max-content;
  max-width: 100%;
  padding: 0.45rem 0.75rem;
  border: 1px solid rgba(var(--warning-rgb), 0.55);
  border-radius: 999px;
  color: var(--warning);
  background: rgba(var(--warning-rgb), 0.13);
  font-weight: 800;
  white-space: nowrap;
}

.cash-required-form {
  margin: 0;
}

.cash-required-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 0.35rem;
}

.cash-required-actions .btn {
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  white-space: normal;
}

@media (max-width: 640px) {
  .cash-required-actions {
    grid-template-columns: 1fr;
  }
}

.cash-close-form {
  grid-template-columns: minmax(150px, 220px) max-content;
  justify-content: start;
  align-items: end;
}

.cash-close-form > div,
.cash-close-form .form-control {
  width: 100%;
  max-width: 220px;
}

.cash-close-form .btn {
  width: auto;
  min-width: 128px;
}

@media (max-width: 640px) {
  .cash-close-form {
    grid-template-columns: 1fr;
  }

  .cash-close-form > div,
  .cash-close-form .form-control,
  .cash-close-form .btn {
    width: 100%;
    max-width: none;
  }
}

/* Responsive web foundation: shared navigation, content, forms and data views. */
.mobile-sidebar-toggle,
.mobile-sidebar-backdrop {
  display: none;
}

html,
body {
  max-width: 100%;
}

.app-shell,
.main-content,
.content-frame,
.card,
.card-body,
.modal-content,
.row > * {
  min-width: 0;
}

img,
svg,
video,
canvas {
  max-width: 100%;
}

.table-responsive {
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}

.table-responsive:focus-visible {
  outline: 3px solid rgba(var(--primary-rgb), 0.3);
  outline-offset: 2px;
}

@media (max-width: 1024px) {
  .content-frame {
    padding: clamp(0.9rem, 2vw, 1.4rem);
  }

  .dashboard-grid,
  .cash-summary-grid,
  .report-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .advanced-filters,
  .quick-filter-grid,
  .product-filter-grid,
  .category-filter-grid,
  .report-filter-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
  }

  .filter-panel {
    overflow-x: visible;
  }

  .filter-actions,
  .product-filter-grid .filter-actions {
    min-width: 0;
    flex-wrap: wrap;
  }
}

@media (max-width: 900px) {
  body {
    overflow-x: hidden;
  }

  body.mobile-navigation-open {
    overflow: hidden;
    touch-action: none;
  }

  .app-shell {
    display: block;
    width: 100%;
    min-height: 100dvh;
  }

  .sidebar,
  .app-shell.sidebar-collapsed .sidebar,
  html[data-sidebar-state='collapsed'] .app-shell .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1060;
    width: min(86vw, 320px) !important;
    min-width: min(86vw, 320px) !important;
    max-width: 320px !important;
    min-height: 100dvh;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    contain: none;
    transform: translateX(-105%);
    transition: transform 220ms ease, box-shadow 220ms ease;
    box-shadow: none;
  }

  .app-shell.mobile-sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 18px 0 48px rgba(0, 0, 0, 0.42);
  }

  .sidebar-sticky,
  .app-shell.sidebar-collapsed .sidebar-sticky,
  html[data-sidebar-state='collapsed'] .app-shell .sidebar-sticky {
    position: static;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 100%;
    padding: max(1rem, env(safe-area-inset-top)) 1rem max(1.25rem, env(safe-area-inset-bottom));
    overflow: visible !important;
  }

  .app-shell.sidebar-collapsed .sidebar-header,
  html[data-sidebar-state='collapsed'] .app-shell .sidebar-header {
    justify-content: space-between;
  }

  .app-shell.sidebar-collapsed .brand-block,
  html[data-sidebar-state='collapsed'] .app-shell .brand-block {
    display: flex;
  }

  .app-shell.sidebar-collapsed .sidebar .nav,
  .app-shell.sidebar-collapsed .sidebar .nav-item,
  .app-shell.sidebar-collapsed .sidebar .nav-link,
  html[data-sidebar-state='collapsed'] .app-shell .sidebar .nav,
  html[data-sidebar-state='collapsed'] .app-shell .sidebar .nav-item,
  html[data-sidebar-state='collapsed'] .app-shell .sidebar .nav-link {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: visible !important;
  }

  .app-shell.sidebar-collapsed .sidebar .nav-link,
  html[data-sidebar-state='collapsed'] .app-shell .sidebar .nav-link {
    justify-content: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 0.95rem;
  }

  .app-shell.sidebar-collapsed .nav-label,
  html[data-sidebar-state='collapsed'] .app-shell .nav-label {
    display: inline;
  }

  .sidebar-toggle {
    display: none;
  }

  .mobile-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1050;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgba(2, 6, 23, 0.68);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 220ms ease, visibility 220ms ease;
  }

  .app-shell.mobile-sidebar-open .mobile-sidebar-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .main-content {
    width: 100%;
    max-width: 100%;
  }

  .content-frame {
    width: 100%;
    padding: max(0.85rem, env(safe-area-inset-top)) max(0.85rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(0.85rem, env(safe-area-inset-left));
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 900;
    justify-content: space-between;
    min-height: 56px;
    margin: -0.85rem -0.85rem 1rem;
    padding: max(0.55rem, env(safe-area-inset-top)) max(0.85rem, env(safe-area-inset-right)) 0.55rem max(0.85rem, env(safe-area-inset-left));
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(14px);
  }

  .mobile-sidebar-toggle {
    display: inline-flex;
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    background: var(--surface);
    color: var(--text);
  }

  .mobile-sidebar-toggle span {
    width: 21px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
  }

  .topbar-user-area {
    gap: 0.5rem;
  }

  .topbar .theme-toggle,
  .topbar .notification-button {
    min-width: 44px;
    min-height: 44px;
  }

  .filter-panel {
    overflow-x: visible;
  }

  .quick-filter-grid,
  .product-filter-grid,
  .category-filter-grid,
  .report-filter-form,
  .advanced-filters {
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-actions,
  .product-filter-grid .filter-actions {
    min-width: 0;
    flex-wrap: wrap;
  }

  .modal-dialog {
    max-width: calc(100vw - 1.5rem);
    margin: 0.75rem auto;
  }

  .modal-content {
    max-height: calc(100dvh - 1.5rem);
    overflow-y: auto;
  }

  .table-responsive {
    margin-inline: -0.35rem;
    padding-inline: 0.35rem;
    border-radius: 0.35rem;
  }
}

@media (max-width: 768px) {
  .content-frame > .d-flex.justify-content-between,
  .card-header.d-flex.justify-content-between {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .quick-filter-grid,
  .product-filter-grid,
  .category-filter-grid,
  .report-filter-form,
  .advanced-filters {
    grid-template-columns: 1fr;
  }

  .filter-actions,
  .product-filter-grid .filter-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .filter-actions .btn {
    width: 100%;
    min-width: 0;
    white-space: normal;
  }

  .app-table th,
  .app-table td {
    padding: 0.75rem;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-inline: 1rem;
  }

  .modal-footer {
    gap: 0.6rem;
  }

  .modal-footer .btn {
    flex: 1 1 140px;
  }
}

@media (max-width: 480px) {
  .content-frame {
    padding-inline: max(0.65rem, env(safe-area-inset-left));
  }

  .topbar {
    margin-inline: -0.65rem;
    padding-inline: max(0.65rem, env(safe-area-inset-left));
    gap: 0.4rem;
  }

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

  .theme-toggle {
    margin-right: 0;
  }

  .user-menu-button {
    display: flex;
    min-width: 46px;
    width: 46px;
    padding: 0.3rem;
  }

  .user-menu-identity,
  .user-menu-chevron {
    display: none;
  }

  .notification-dropdown,
  .user-menu-dropdown {
    position: fixed;
    top: calc(62px + env(safe-area-inset-top));
    right: max(0.65rem, env(safe-area-inset-right));
    left: max(0.65rem, env(safe-area-inset-left));
    width: auto;
    max-width: none;
  }

  .filter-panel,
  .card-body {
    padding: 0.9rem;
  }

  .filter-actions,
  .product-filter-grid .filter-actions,
  .modal-footer {
    grid-template-columns: 1fr;
  }

  .modal-dialog {
    max-width: calc(100vw - 1rem);
    margin: 0.5rem auto;
  }

  .modal-content {
    max-height: calc(100dvh - 1rem);
    border-radius: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .mobile-sidebar-backdrop {
    transition-duration: 0.01ms !important;
  }
}

.login-screen .login-brand-logo-horizontal {
  width: min(100%, 430px);
  height: auto;
  max-height: 150px;
  flex: 1 1 auto;
  border-radius: 0.75rem;
  object-fit: contain;
}

@media (max-height: 760px) {
  .login-screen .login-brand-logo-horizontal {
    width: min(100%, 360px);
    height: auto;
    max-height: 100px;
    flex-basis: auto;
  }
}
