: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;
}

.historical-import-summary {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.historical-import-preview {
  max-height: 34rem;
}

.historical-import-preview thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.historical-row--invalid,
.historical-row--duplicate {
  background: rgba(220, 53, 69, 0.08);
}

.historical-row--existing {
  background: rgba(255, 193, 7, 0.08);
}

.historical-status--valid { background: #198754; }
.historical-status--invalid,
.historical-status--duplicate { background: #dc3545; }
.historical-status--existing { background: #a66b00; }

.historical-import-confirm {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.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);
}

input.form-control,
textarea.form-control,
textarea,
input[type='text'],
input[type='search'],
input[type='email'],
input[type='password'],
input[type='tel'],
input[type='url'],
input[type='number'] {
  direction: ltr;
  text-align: left;
  text-indent: 0;
}

input.form-control::placeholder,
textarea.form-control::placeholder,
textarea::placeholder {
  direction: ltr;
  text-align: left;
  text-indent: 0;
}

.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 create/edit: structured, fluid form for desktop and mobile. */
.product-create-page {
  width: min(100%, 1440px);
  margin-inline: auto;
}

.product-create-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.product-create-header h2 {
  margin: 0.15rem 0 0.35rem;
}

.product-create-eyebrow {
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.product-create-form {
  display: grid;
  gap: 0;
  padding: clamp(1rem, 2vw, 1.5rem);
  overflow: visible;
}

.product-form-section {
  display: grid;
  gap: 1.15rem;
  min-width: 0;
  padding: 0.25rem 0 1.5rem;
}

.product-form-section + .product-form-section {
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.product-form-section-heading {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.product-form-section-heading h3 {
  margin: 0;
  font-size: 1.05rem;
}

.product-form-section-heading p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.product-form-section-number {
  display: inline-grid;
  flex: 0 0 30px;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(var(--primary-rgb), 0.5);
  border-radius: 50%;
  background: rgba(var(--primary-rgb), 0.12);
  color: var(--primary);
  font-weight: 800;
}

.product-form-grid {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.product-identity-grid {
  grid-template-columns: minmax(260px, 1.5fr) minmax(220px, 0.8fr);
}

.product-field-category,
.product-field-wide {
  grid-column: 1 / -1;
}

.product-commercial-grid {
  grid-template-columns: repeat(3, minmax(150px, 1fr));
}

.product-stock-grid {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

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

.product-field > small {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.product-money-field {
  position: relative;
}

.product-money-field > span {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 0.85rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  transform: translateY(-50%);
  pointer-events: none;
}

.product-money-field .form-control {
  padding-left: 2.75rem;
}

.product-profit-field {
  display: grid;
  align-content: center;
  gap: 0.15rem;
  min-height: 72px;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: var(--surface-2);
}

.product-profit-field > span,
.product-profit-field small {
  color: var(--muted);
  font-size: 0.78rem;
}

.product-profit-field strong {
  color: var(--success);
  font-size: 1.15rem;
}

.product-profit-field strong.is-negative {
  color: var(--danger);
}

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

.product-option-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.product-option-card:hover,
.product-option-card:focus-within {
  border-color: rgba(var(--primary-rgb), 0.65);
  background: rgba(var(--primary-rgb), 0.08);
}

.product-option-card > span:first-child {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.product-option-card small {
  color: var(--muted);
  font-size: 0.8rem;
}

.product-option-card .form-check {
  flex: 0 0 auto;
  margin: 0;
  padding-left: 2.5rem;
}

.product-kit-builder {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid rgba(var(--primary-rgb), 0.45);
  border-radius: 0.75rem;
  background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.1), var(--surface-2));
}

.product-kit-builder-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.product-kit-builder-heading > div {
  display: grid;
  gap: 0.2rem;
}

.product-kit-builder-heading small {
  color: var(--muted);
}

.product-kit-builder-grid {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(160px, 0.3fr);
  gap: 1rem;
  align-items: start;
}

.product-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 900px) {
  .product-commercial-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .product-create-header {
    align-items: stretch;
    flex-direction: column;
  }

  .product-create-header .btn {
    width: 100%;
  }

  .product-create-form {
    padding: 0.9rem;
  }

  .product-identity-grid,
  .product-commercial-grid,
  .product-stock-grid,
  .product-option-grid,
  .product-kit-builder-grid {
    grid-template-columns: 1fr;
  }

  .product-field-category,
  .product-field-wide {
    grid-column: auto;
  }

  .product-option-card {
    padding: 0.85rem;
  }

  .product-kit-builder-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .product-kit-builder-heading .badge {
    align-self: flex-start;
  }

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

.product-form-actions .btn {
    width: 100%;
  }

  .product-form-actions .btn-primary {
    grid-row: 1;
  }
}

.product-suggestion-loading,
.product-suggestion-error {
  padding: 0.8rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.product-suggestion-error {
  color: var(--danger);
}

.product-form-actions .btn.is-loading {
  cursor: wait;
  opacity: 0.75;
}

.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-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.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-control-label {
  padding: 0.4rem 0.35rem 0.4rem 0.45rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  white-space: nowrap;
}

.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-method-label,
.payment-method-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.payment-method-icon {
  display: inline-grid;
  width: 1.9rem;
  height: 1.9rem;
  flex: 0 0 1.9rem;
  place-items: center;
  border: 1px solid rgba(var(--accent-rgb), 0.24);
  border-radius: 0.55rem;
  color: var(--primary-hover, #a78bfa);
  background: rgba(139, 92, 246, 0.1);
}

.payment-method-icon svg {
  width: 1.15rem;
  height: 1.15rem;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.payment-method-icon-compact {
  width: 1.55rem;
  height: 1.55rem;
  flex-basis: 1.55rem;
  border-radius: 0.45rem;
}

.payment-method-icon-compact svg {
  width: 0.95rem;
  height: 0.95rem;
}

.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;
}

/* System feedback */
.system-flash-stack {
  display: grid;
  gap: 0.45rem;
  position: fixed;
  top: clamp(0.65rem, 1.4vw, 1rem);
  right: clamp(0.65rem, 1.4vw, 1rem);
  width: min(320px, calc(100vw - 1.3rem));
  margin: 0;
  z-index: 1080;
}

.system-flash.alert {
  display: grid;
  grid-template-columns: 1.75rem minmax(0, 1fr) 1.6rem;
  align-items: center;
  gap: 0.55rem;
  min-height: 50px;
  margin: 0;
  padding: 0.55rem 0.45rem 0.55rem 0.6rem;
  overflow: hidden;
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--flash-accent) 42%, var(--border));
  border-radius: 0.8rem;
  background: color-mix(in srgb, var(--surface) 94%, var(--flash-accent) 6%);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.24), inset 3px 0 0 var(--flash-accent);
  backdrop-filter: blur(16px);
}

.system-flash-success { --flash-accent: #32d296; }
.system-flash-info { --flash-accent: #48bff7; }
.system-flash-warning { --flash-accent: #f5b942; }
.system-flash-danger { --flash-accent: #ff647c; }

.system-flash-icon {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  color: var(--flash-accent);
  border: 1px solid color-mix(in srgb, var(--flash-accent) 48%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--flash-accent) 14%, transparent);
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1;
}

.system-flash-success .system-flash-icon::before { content: '✓'; }
.system-flash-info .system-flash-icon::before { content: 'i'; }
.system-flash-warning .system-flash-icon::before { content: '!'; }
.system-flash-danger .system-flash-icon::before { content: '×'; }

.system-flash-content {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.system-flash-content strong {
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.system-flash-content > span {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.system-flash .system-flash-close {
  align-self: center;
  justify-self: center;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0.45rem;
  border-radius: 50%;
  filter: var(--close-button-filter, invert(1) grayscale(1));
  opacity: 0.52;
  transition: background-color 140ms ease, opacity 140ms ease;
}

[data-theme='light'] .system-flash .system-flash-close {
  filter: none;
}

.system-flash .system-flash-close:hover,
.system-flash .system-flash-close:focus-visible {
  background-color: color-mix(in srgb, var(--text) 10%, transparent);
  opacity: 0.9;
}

/* Login polish */
body:has(.login-screen) {
  overflow: hidden;
}

body:has(.login-screen) .system-flash-stack {
  left: auto;
}

@media (max-width: 575.98px) {
  .system-flash.alert {
    grid-template-columns: 1.65rem minmax(0, 1fr) 1.5rem;
    gap: 0.5rem;
    min-height: 48px;
    padding: 0.5rem 0.4rem 0.5rem 0.55rem;
    border-radius: 0.7rem;
  }

  .system-flash-icon {
    width: 1.65rem;
    height: 1.65rem;
  }

  .system-flash-content > span {
    font-size: 0.78rem;
  }
}

.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);
}

/* Public navigation shown on the shared login/registration screen. */
.content-frame:has(.login-screen) {
  display: flex;
  flex-direction: column;
  place-items: initial;
  padding: 0;
}

.auth-public-header {
  position: relative;
  z-index: 20;
  flex: 0 0 auto;
  width: 100%;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 7, 17, 0.88);
  backdrop-filter: blur(18px);
}

.auth-public-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(calc(100% - 2.5rem), 1180px);
  min-height: 76px;
  margin-inline: auto;
}

.auth-public-brand img {
  display: block;
  width: 156px;
  height: auto;
}

.auth-public-navigation {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2vw, 1.6rem);
}

.auth-public-navigation a {
  color: #c7c3d4;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.auth-public-navigation a:hover,
.auth-public-navigation a:focus-visible {
  color: #fff;
}

.auth-public-menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0.65rem;
  border: 0;
  background: transparent;
}

.auth-public-menu-toggle > span:not(.visually-hidden) {
  display: block;
  height: 2px;
  margin: 5px 0;
  border-radius: 2px;
  background: #fff;
}

.content-frame:has(.login-screen) .login-screen {
  flex: 1 1 auto;
  min-height: 0 !important;
  padding: 1rem;
  overflow-y: auto;
}

.content-frame:has(.login-screen) .login-screen .card {
  max-height: calc(100vh - 108px);
}

@media (max-width: 960px) {
  .auth-public-menu-toggle {
    display: block;
  }

  .auth-public-navigation {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 1.25rem;
    left: 1.25rem;
    display: none;
    align-items: stretch;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    background: #121022;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  }

  .auth-public-navigation.is-open {
    display: flex;
    flex-direction: column;
  }

  .auth-public-navigation a {
    padding: 0.55rem 0.4rem;
  }

}

@media (max-width: 575.98px) {
  .auth-public-header-inner {
    width: calc(100% - 1.5rem);
    min-height: 66px;
  }

  .auth-public-brand img {
    width: 140px;
  }

  .content-frame:has(.login-screen) .login-screen {
    align-items: flex-start !important;
    padding: 0.75rem;
  }

  .content-frame:has(.login-screen) .login-screen .card {
    max-height: none;
  }
}

.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;
  }
}

/* Master panel: keep every section inside the available viewport. */
.master-page,
.master-page > *,
.audit-page-master,
.audit-page-master > * {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.master-page {
  overflow: hidden;
}

.master-page-header > div,
.master-page .card,
.master-page form,
.master-page .table-responsive,
.master-page .master-log-details,
.audit-page-master .card,
.audit-page-master form {
  min-width: 0;
  max-width: 100%;
}

.master-page .form-control,
.master-page .form-select,
.audit-page-master .form-control,
.audit-page-master .form-select {
  max-width: 100%;
}

.master-log-trace {
  max-width: 100%;
  overflow-wrap: anywhere;
}

@media (max-width: 1280px) {
  .master-page .table-responsive {
    overflow: visible;
  }

  .master-responsive-table,
  .master-responsive-table tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .master-responsive-table thead {
    display: none;
  }

  .master-responsive-table tbody {
    display: grid;
    gap: 0.75rem;
  }

  .master-responsive-table tbody > tr:not(.product-details-row) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    padding: 0.65rem;
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    background: var(--surface-2);
  }

  .master-responsive-table tbody > tr:not(.product-details-row) > td {
    display: grid;
    align-content: start;
    gap: 0.25rem;
    min-width: 0;
    padding: 0.55rem;
    border: 0;
    text-align: left !important;
    overflow-wrap: anywhere;
  }

  .master-responsive-table tbody > tr:not(.product-details-row) > td[data-label]::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .master-responsive-table .product-details-row {
    display: block;
    width: 100%;
    margin-top: -0.75rem;
  }

  .master-responsive-table .product-details-row > td {
    display: block;
    width: 100%;
    max-width: 100%;
  }

  .master-responsive-table .activation-key-copy,
  .master-responsive-table .table-actions,
  .master-responsive-table .table-actions form,
  .master-responsive-table .table-actions .btn {
    width: 100%;
  }
}

@media (max-width: 960px) {
  .master-page-header {
    align-items: stretch !important;
  }

  .master-page-header > div:first-child,
  .master-toolbar {
    width: 100%;
  }

  .master-toolbar > a {
    flex: 1 1 120px;
  }

  .master-subscription-actions {
    grid-template-columns: 1fr;
  }

  .master-user-search {
    display: grid;
    grid-template-columns: 1fr;
  }

  .master-user-search > div,
  .master-user-search .btn {
    width: 100%;
  }

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

  .master-user-item > form .btn {
    width: 100%;
  }

  .master-log-item summary {
    grid-template-columns: 1fr;
  }

  .master-log-item summary small {
    grid-column: 1;
  }

  .audit-page-master .audit-page-header {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .master-responsive-table tbody > tr:not(.product-details-row) {
    grid-template-columns: 1fr;
  }

  .master-user-item summary {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .master-user-avatar {
    width: 38px;
    height: 38px;
  }

  .master-user-item summary > .badge {
    grid-column: 2;
    justify-self: start;
  }

  .master-key-presets .btn {
    flex: 1 1 120px;
  }

  .master-compact-list > a,
  .company-card-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

@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(auto-fit, minmax(min(100%, 260px), 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(auto-fit, minmax(min(100%, 260px), 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;
  }
}

@media (max-width: 1280px) {
  html body .master-page .master-responsive-table {
    width: 100%;
    min-width: 0 !important;
  }
}

/* Products: adapt filters and rows to the space left by the sidebar. */
.product-filter-grid {
  grid-template-columns: minmax(220px, 1.4fr) minmax(130px, 0.55fr) minmax(180px, 0.75fr) auto;
  min-width: 0;
}

.product-list-layout {
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
}

.product-list-card,
.product-list-card .table-responsive,
.product-table {
  width: 100%;
  min-width: 0;
}

.product-table {
  table-layout: fixed;
}

.product-table th:first-child,
.product-table td:first-child {
  width: 42%;
  min-width: 0;
}

.product-table th:nth-child(2),
.product-table td:nth-child(2) {
  width: 20%;
  min-width: 0;
}

.product-table th:nth-child(3),
.product-table td:nth-child(3) {
  width: 16%;
  min-width: 0;
}

.product-table th:nth-child(4),
.product-table td:nth-child(4) {
  width: 12%;
  min-width: 0;
}

.product-table th:nth-child(5),
.product-table td:nth-child(5) {
  width: 10%;
  min-width: 0;
}

.product-table th,
.product-table td,
.product-table .product-name-button span,
.product-table .product-name-button small,
.product-table .badge {
  max-width: 100%;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
}

.product-table .product-name-button {
  width: 100%;
  min-width: 0;
}

@media (max-width: 1500px) {
  .product-filter-grid {
    grid-template-columns: minmax(220px, 1fr) minmax(130px, 0.45fr) minmax(180px, 0.65fr);
  }

  .product-filter-grid .filter-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 1280px) {
  .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;
  }
}

@media (max-width: 900px) {
  .product-table {
    table-layout: auto;
  }

  .product-table th:first-child,
  .product-table td:first-child,
  .product-table th:nth-child(2),
  .product-table td:nth-child(2),
  .product-table th:nth-child(3),
  .product-table td:nth-child(3),
  .product-table th:nth-child(4),
  .product-table td:nth-child(4),
  .product-table th:nth-child(5),
  .product-table td:nth-child(5) {
    width: 100%;
  }
}

@media (max-width: 820px) {
  .product-filter-grid {
    grid-template-columns: 1fr;
  }

  .product-filter-grid .filter-actions {
    grid-column: auto;
    min-width: 0;
  }
}

/* Master panel: respond to its real content width, not only to the viewport. */
.master-page {
  container-name: master-panel;
  container-type: inline-size;
  overflow: visible;
}

.master-page-header,
.master-subscription-panel,
.master-subscription-box,
.master-key-list,
.master-user-panel,
.master-log-panel,
.company-card-grid,
.company-card,
.company-details-form,
.master-page .table-card,
.master-page .table-responsive {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.master-subscription-panel,
.master-user-panel,
.master-log-panel,
.company-card {
  padding: clamp(0.85rem, 1.5cqi, 1.25rem);
}

.master-subscription-actions {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
}

.master-key-form,
.company-subscription-form,
.company-main-form,
.company-details-stats,
.master-user-details,
.company-stat-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
}

.master-key-form > .btn,
.master-key-form > div,
.company-subscription-form > div,
.company-main-form > div {
  width: 100%;
  min-width: 0;
}

.master-key-presets {
  align-items: stretch;
}

.master-key-presets .btn {
  flex: 1 1 82px;
  min-width: 0;
}

.master-key-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.master-key-table th,
.master-key-table td {
  min-width: 0 !important;
  white-space: normal;
  overflow-wrap: anywhere;
}

.master-key-table th:first-child,
.master-key-table td:first-child {
  width: 36%;
}

.master-key-table th:nth-child(2),
.master-key-table td:nth-child(2) {
  width: 16%;
}

.master-key-table th:nth-child(3),
.master-key-table td:nth-child(3),
.master-key-table th:nth-child(4),
.master-key-table td:nth-child(4),
.master-key-table th:nth-child(5),
.master-key-table td:nth-child(5) {
  width: 14%;
}

.master-key-table th:last-child,
.master-key-table td:last-child {
  width: 6%;
}

.master-key-table .activation-key-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.master-key-table .activation-key-copy .btn,
.master-key-table td:last-child .btn {
  min-width: 0;
  max-width: 100%;
}

@container master-panel (max-width: 1100px) {
  .master-page-header {
    align-items: stretch !important;
  }

  .master-page-header > div:first-child,
  .master-toolbar {
    width: 100%;
  }

  .master-toolbar > a {
    flex: 1 1 120px;
  }

  .master-subscription-actions,
  .master-user-search,
  .company-main-form {
    grid-template-columns: 1fr;
  }

  .master-user-search {
    display: grid;
  }

  .master-user-search > div,
  .master-user-search .btn {
    width: 100%;
  }

  .master-page .table-responsive {
    overflow: visible;
  }

  .master-responsive-table,
  .master-responsive-table tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .master-responsive-table thead {
    display: none;
  }

  .master-responsive-table tbody {
    display: grid;
    gap: 0.75rem;
  }

  .master-responsive-table tbody > tr:not(.product-details-row) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    padding: 0.65rem;
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    background: var(--surface-2);
  }

  .master-responsive-table tbody > tr:not(.product-details-row) > td {
    display: grid;
    width: 100%;
    align-content: start;
    gap: 0.25rem;
    min-width: 0;
    padding: 0.55rem;
    border: 0;
    text-align: left !important;
    overflow-wrap: anywhere;
  }

  .master-responsive-table tbody > tr:not(.product-details-row) > td[data-label]::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .master-responsive-table .product-details-row,
  .master-responsive-table .product-details-row > td {
    display: block;
    width: 100%;
    max-width: 100%;
  }

  .master-responsive-table .product-details-row {
    margin-top: -0.75rem;
  }

  .master-responsive-table .activation-key-copy,
  .master-responsive-table .table-actions,
  .master-responsive-table .table-actions form,
  .master-responsive-table .table-actions .btn {
    width: 100%;
  }

  .master-key-table .activation-key-copy {
    grid-template-columns: 1fr;
  }
}

@container master-panel (max-width: 680px) {
  .master-overview-grid,
  .company-card-grid,
  .master-user-details,
  .company-stat-grid,
  .company-subscription-form,
  .master-key-form {
    grid-template-columns: 1fr;
  }

  .master-responsive-table tbody > tr:not(.product-details-row) {
    grid-template-columns: 1fr;
  }

  .master-user-item summary {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .master-user-item summary > .badge {
    grid-column: 2;
    justify-self: start;
  }

  .master-compact-list > a,
  .company-card-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .master-page .btn,
  .master-user-item > form .btn {
    max-width: 100%;
  }
}

/* The master audit route lives outside .master-page, so it owns its container. */
.audit-page-master {
  container-name: master-audit-panel;
  container-type: inline-size;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.audit-page-master > *,
.audit-page-master .audit-table-card,
.audit-page-master .audit-log-table {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

@container master-audit-panel (max-width: 900px) {
  .audit-page-master .audit-log-table {
    overflow-x: visible;
  }

  .audit-page-master .audit-table {
    min-width: 0;
  }

  .audit-page-master .audit-table thead {
    display: none;
  }

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

  .audit-page-master .audit-table tbody {
    display: grid;
    gap: 0.75rem;
  }

  .audit-page-master .audit-table tbody tr.expandable-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem 0.8rem;
    min-width: 0;
    padding: 0.85rem;
  }

  .audit-page-master .audit-table tbody tr.expandable-row > td {
    display: grid;
    grid-template-columns: minmax(92px, 0.38fr) minmax(0, 1fr);
    gap: 0.6rem;
    min-width: 0;
    padding: 0.5rem;
    border: 0;
  }

  .audit-page-master .audit-table tbody tr.expandable-row > td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .audit-page-master .expandable-detail-row,
  .audit-page-master .expandable-detail-row > td {
    display: block;
    width: 100%;
  }
}

@container master-audit-panel (max-width: 560px) {
  .audit-page-master .audit-page-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .audit-page-master .audit-table tbody tr.expandable-row {
    grid-template-columns: 1fr;
  }

  .audit-page-master .audit-table tbody tr.expandable-row > td {
    grid-template-columns: 1fr;
  }

  .audit-page-master .audit-change-grid,
  .audit-page-master .audit-value-item,
  .audit-page-master .audit-request-item {
    grid-template-columns: 1fr;
  }

  .audit-page-master .audit-request-item strong {
    text-align: left;
  }
}

/* Master subscriptions workspace */
.master-subscription-dashboard {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.master-subscription-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.master-subscription-metric {
  --metric-color: 139, 92, 246;
  display: grid;
  gap: 0.25rem;
  min-width: 0;
  padding: 1rem;
  border: 1px solid rgba(var(--metric-color), 0.3);
  border-radius: 0.75rem;
  background: linear-gradient(145deg, rgba(var(--metric-color), 0.13), transparent 68%), var(--surface);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.12);
  transition: transform 180ms ease, border-color 180ms ease;
}

.master-subscription-metric:hover {
  border-color: rgba(var(--metric-color), 0.5);
  transform: translateY(-2px);
}

.master-subscription-metric span,
.master-subscription-metric small { color: var(--muted); }
.master-subscription-metric strong { font-size: clamp(1.35rem, 2.2cqi, 2rem); overflow-wrap: anywhere; }
.master-subscription-metric i { height: 4px; margin-top: 0.4rem; border-radius: 999px; background: linear-gradient(90deg, rgb(var(--metric-color)) var(--usage), rgba(var(--metric-color), 0.15) var(--usage)); }
.master-subscription-metric.metric-cyan { --metric-color: 34, 211, 238; }
.master-subscription-metric.metric-blue { --metric-color: 59, 130, 246; }
.master-subscription-metric.metric-gold { --metric-color: 245, 158, 11; }

.master-subscription-box {
  padding: clamp(0.9rem, 1.6cqi, 1.25rem);
  border-radius: 0.75rem;
}

.master-subscription-box > header,
.master-company-renewal > summary {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.master-company-renewal > summary { cursor: pointer; list-style: none; }
.master-company-renewal > summary::-webkit-details-marker { display: none; }
.master-subscription-box h3,
.master-key-list h3 { margin: 0 0 0.2rem; font-size: 1.05rem; }
.master-subscription-box p,
.master-key-list p { margin: 0; color: var(--muted); }

.master-section-icon {
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  min-height: 36px;
  border: 1px solid rgba(var(--primary-rgb), 0.35);
  border-radius: 0.6rem;
  background: rgba(var(--primary-rgb), 0.12);
  color: var(--primary);
  font-size: 1.2rem;
  font-weight: 900;
}

.master-key-create-card .master-key-form,
.master-company-renewal .master-key-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.master-form-wide { grid-column: 1 / -1; }
.master-form-wide small { color: var(--muted); font-weight: 500; }
.master-expiry-field { display: grid; gap: 0.6rem; min-width: 0; margin: 0; padding: 0; border: 0; }
.master-expiry-field legend { margin: 0; font-size: 0.9rem; font-weight: 800; }
.master-generate-key { grid-column: 1 / -1; }

.master-renewal-preview {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  grid-column: 1 / -1;
  padding: 0.7rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: var(--surface);
}

.master-key-list {
  min-width: 0;
  padding: clamp(0.85rem, 1.5cqi, 1.2rem);
  border-radius: 0.75rem;
}

.master-key-list-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.master-key-list-heading > span { color: var(--muted); white-space: nowrap; }
.master-key-list-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.65rem; }
.master-key-list-tools > span { color: var(--muted); white-space: nowrap; }
.master-key-filters { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(5, minmax(120px, 1fr)) auto auto; gap: 0.65rem; align-items: end; margin-bottom: 1rem; }
.master-key-filters > * { min-width: 0; }

.master-key-list .master-key-table { width: 100%; min-width: 1050px; table-layout: auto; }
.master-key-list .master-key-table th,
.master-key-list .master-key-table td { width: auto; min-width: 0 !important; }
.master-key-list .master-key-table th:first-child { min-width: 210px !important; }
.master-key-list .master-key-table th:last-child { width: 120px; }

.master-key-row-actions { display: flex; gap: 0.4rem; align-items: center; }
.master-key-row-actions details { position: relative; }
.master-key-row-actions summary { list-style: none; cursor: pointer; }
.master-key-row-actions summary::-webkit-details-marker { display: none; }
.master-key-action-menu { position: absolute; z-index: 20; top: calc(100% + 0.35rem); right: 0; display: grid; min-width: 180px; padding: 0.35rem; border: 1px solid var(--border); border-radius: 0.55rem; background: var(--surface); box-shadow: 0 18px 38px rgba(0, 0, 0, 0.3); }
.master-key-action-menu button { width: 100%; padding: 0.65rem; border: 0; border-radius: 0.4rem; background: transparent; color: var(--text); text-align: left; }
.master-key-action-menu button:hover,
.master-key-action-menu button:focus-visible { background: var(--surface-2); }
.master-key-action-menu button.is-danger { color: var(--danger); }

.master-key-details { display: grid; gap: 1rem; padding: 1rem; background: var(--surface-2); }
.master-key-detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.65rem; }
.master-key-detail-grid > div { display: grid; gap: 0.2rem; min-width: 0; padding: 0.7rem; border: 1px solid var(--border); border-radius: 0.55rem; }
.master-key-detail-grid span { color: var(--muted); font-size: 0.78rem; }
.master-key-detail-grid strong { overflow-wrap: anywhere; }
.master-key-management-forms { display: grid; grid-template-columns: 2fr 1fr; gap: 0.75rem; }
.master-key-management-forms form { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0.65rem; align-items: end; min-width: 0; }
.master-key-renew-form label { grid-column: 1 / -1; color: var(--muted); }
.master-inline-preview { color: var(--muted); font-size: 0.85rem; }
.master-key-empty { display: grid; place-items: center; gap: 0.3rem; min-height: 160px; text-align: center; }
.master-key-list .pagination-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem; margin-top: 1rem; }

.master-company-list-row {
  cursor: pointer;
  transition: background 180ms ease, box-shadow 180ms ease;
}

.master-page-companies .company-table {
  table-layout: fixed;
  min-width: 0;
}

.master-page-companies .company-table th:first-child,
.master-page-companies .master-company-list-row > td:first-child {
  width: 38%;
}

.master-page-companies .company-table th:nth-child(2),
.master-page-companies .master-company-list-row > td:nth-child(2) {
  width: 16%;
}

.master-page-companies .company-table th:nth-child(3),
.master-page-companies .master-company-list-row > td:nth-child(3) {
  width: 16%;
}

.master-page-companies .company-table th:last-child,
.master-page-companies .master-company-list-row > td:last-child {
  width: 30%;
}

.master-page-companies .product-details-row > td,
.master-page-companies .product-details-row .collapse,
.master-page-companies .product-details-panel {
  width: 100%;
  max-width: 100%;
}

.master-company-list-row:hover,
.master-company-list-row:focus-visible,
.master-company-list-row.is-expanded {
  background: rgba(var(--primary-rgb), 0.08);
  box-shadow: inset 3px 0 0 var(--primary);
  outline: none;
}

.master-company-list-row .product-name-button {
  cursor: inherit;
  pointer-events: none;
}

.master-company-list-row td:last-child::after {
  content: "⌄";
  display: inline-grid;
  place-items: center;
  width: 28px;
  min-height: 28px;
  margin-left: 0.45rem;
  color: var(--muted);
  transition: transform 180ms ease;
}

.master-company-list-row.is-expanded td:last-child::after { transform: rotate(180deg); }

.company-details-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.company-details-heading h4 {
  margin: 0.15rem 0 0;
}

.master-page-companies .company-details-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 0;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  background: var(--surface-2);
}

.master-page-companies .company-details-stats > div {
  min-height: 66px;
  padding: 0.7rem 0.85rem;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.master-page-companies .company-details-stats > div:not(:nth-child(5n + 1)) {
  border-left: 1px solid var(--border);
}

.master-page-companies .company-details-stats > div:nth-child(n + 6) {
  border-top: 1px solid var(--border);
}

.master-page-companies .company-details-stats strong {
  font-size: 1rem;
}

@container master-panel (max-width: 900px) {
  .master-page-companies .company-details-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .master-page-companies .company-details-stats > div {
    border: 0 !important;
  }

  .master-page-companies .company-details-stats > div:not(:nth-child(3n + 1)) {
    border-left: 1px solid var(--border) !important;
  }

  .master-page-companies .company-details-stats > div:nth-child(n + 4) {
    border-top: 1px solid var(--border) !important;
  }
}

@container master-panel (max-width: 560px) {
  .master-page-companies .company-details-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .master-page-companies .company-details-stats > div {
    border: 0 !important;
  }

  .master-page-companies .company-details-stats > div:nth-child(even) {
    border-left: 1px solid var(--border) !important;
  }

  .master-page-companies .company-details-stats > div:nth-child(n + 3) {
    border-top: 1px solid var(--border) !important;
  }
}

@container master-panel (max-width: 1200px) {
  .master-subscription-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .master-key-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .master-key-search { grid-column: 1 / -1; }
  .master-key-management-forms { grid-template-columns: 1fr; }
  .master-key-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@container master-panel (max-width: 760px) {
  .master-subscription-actions,
  .master-key-create-card .master-key-form,
  .master-company-renewal .master-key-form { grid-template-columns: 1fr; }
  .master-form-wide,
  .master-generate-key,
  .master-renewal-preview { grid-column: auto; }
  .master-company-renewal:not([open]) > form { display: none; }
  .master-key-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .master-key-search { grid-column: 1 / -1; }
  .master-key-list .table-responsive { overflow: visible; }
  .master-key-list .master-key-table { min-width: 0; }
}

@container master-panel (max-width: 480px) {
  .master-subscription-summary,
  .master-key-filters,
  .master-key-detail-grid { grid-template-columns: 1fr; }
  .master-key-search { grid-column: auto; }
  .master-key-presets .btn { min-height: 44px; flex-basis: calc(50% - 0.25rem); }
  .master-key-list-heading { flex-direction: column; }
  .master-key-management-forms form { grid-template-columns: 1fr; }
  .master-key-row-actions .btn { min-height: 44px; }
}
/* Dashboard analytics */
.dashboard-page {
  --dashboard-positive: #047857;
  --dashboard-negative: #be123c;
  --dashboard-chart-1: #0891b2;
  --dashboard-chart-2: #7c3aed;
  --dashboard-chart-3: #059669;
  --dashboard-chart-4: #b45309;
  --dashboard-chart-5: #e11d48;
  --dashboard-chart-6: #2563eb;
  --dashboard-chart-7: #a21caf;
}

[data-theme='dark'] .dashboard-page {
  --dashboard-positive: #2dd4bf;
  --dashboard-negative: #fb7185;
  --dashboard-chart-1: #22d3ee;
  --dashboard-chart-2: #8b5cf6;
  --dashboard-chart-3: #34d399;
  --dashboard-chart-4: #fbbf24;
  --dashboard-chart-5: #fb7185;
  --dashboard-chart-6: #60a5fa;
  --dashboard-chart-7: #c084fc;
}

[data-theme='dark'] .dashboard-period-form select,
[data-theme='dark'] .dashboard-period-form input {
  color-scheme: dark;
}

.dashboard-page {
  display:grid;
  gap:22px;
}

.dashboard-toolbar {
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:20px;
}

.dashboard-eyebrow, .dashboard-card-heading span {
  color:var(--primary);
  font-size:.72rem;
  font-weight:800;
  letter-spacing:.12em;
}

.dashboard-toolbar h2 {
  margin:.18rem 0;
}

.dashboard-toolbar-actions, .dashboard-period-form, .dashboard-custom-dates {
  display:flex;
  align-items:center;
  gap:8px;
}

.dashboard-period-form select, .dashboard-period-form input {
  min-height:42px;
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--surface);
  color:var(--text);
  color-scheme:light;
  padding:0 12px;
}

.dashboard-kpis-modern {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:14px;
}

.dashboard-metric {
  min-height:145px;
  padding:22px;
  border:1px solid var(--border);
  border-radius:18px;
  background:linear-gradient(145deg,var(--surface),var(--surface-2));
  color:var(--text);
  box-shadow:var(--shadow);
  display:flex;
  flex-direction:column;
}

.dashboard-metric-featured {
  border-color:rgba(var(--accent-rgb),.42);
  background:linear-gradient(145deg,rgba(var(--accent-rgb),.1),rgba(var(--primary-rgb),.06)),var(--surface);
}

.dashboard-metric>span {
  color:var(--muted);
  font-size:.82rem;
}

.dashboard-metric>strong {
  font-size:clamp(1.55rem,2.1vw,2.25rem);
  margin:.65rem 0;
}

.dashboard-metric small {
  color:var(--muted);
  display:flex;
  gap:7px;
  align-items:center;
  flex-wrap:wrap;
}

.dashboard-change {
  font-weight:750;
}

.dashboard-change.positive {
  color:var(--dashboard-positive);
}

.dashboard-change.negative {
  color:var(--dashboard-negative);
}

.dashboard-change.neutral, .dashboard-unavailable {
  color:var(--muted);
}

.dashboard-analytics-grid, .dashboard-operations-grid {
  display:grid;
  grid-template-columns:minmax(0,1.65fr) minmax(320px,1fr);
  gap:18px;
}

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

.dashboard-card {
  min-width:0;
  padding:22px;
  border:1px solid var(--border);
  border-radius:18px;
  background:var(--surface);
  color:var(--text);
  box-shadow:var(--shadow);
}

.dashboard-card-heading {
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
  margin-bottom:18px;
}

.dashboard-card-heading h5 {
  margin:3px 0 0;
}

.dashboard-card-heading>a {
  color:var(--primary);
  font-size:.82rem;
  text-decoration:none;
}

.dashboard-line-chart {
  display:block;
  width:100%;
  height:260px;
}

.dashboard-category-content {
  display:grid;
  grid-template-columns:210px 1fr;
  align-items:center;
  gap:20px;
}

.dashboard-donut-chart {
  width:210px;
  height:210px;
}

.dashboard-legend {
  display:grid;
  gap:10px;
}

.dashboard-legend>div {
  display:grid;
  grid-template-columns:10px 1fr auto;
  gap:8px;
  align-items:center;
  font-size:.8rem;
}

.dashboard-legend i {
  width:9px;
  height:9px;
  border-radius:50%;
  background:var(--dashboard-chart-1);
}

.dashboard-ranking, .dashboard-sales-list {
  display:grid;
}

.dashboard-ranking-row, .dashboard-sales-list>div {
  display:grid;
  grid-template-columns:34px 1fr auto;
  gap:12px;
  align-items:center;
  padding:14px 0;
  border-top:1px solid var(--border);
}

.dashboard-ranking-row:first-child, .dashboard-sales-list>div:first-child {
  border-top:0;
}

.dashboard-ranking-row>b {
  display:grid;
  place-items:center;
  width:28px;
  height:28px;
  border-radius:9px;
  background:rgba(var(--primary-rgb),.12);
  color:var(--primary);
}

.dashboard-ranking-row div, .dashboard-sales-list span {
  display:flex;
  min-width:0;
  flex-direction:column;
}

.dashboard-ranking-row strong, .dashboard-sales-list span {
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.dashboard-ranking-row small, .dashboard-sales-list small {
  color:var(--muted);
}

.dashboard-sales-list>div {
  grid-template-columns:52px 1fr auto;
}

.dashboard-empty {
  min-height:240px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  color:var(--muted);
  gap:5px;
}

.dashboard-empty.compact {
  min-height:150px;
}

.dashboard-empty strong {
  color:var(--text);
}
@media(max-width:1200px){.dashboard-kpis-modern{grid-template-columns:repeat(2,minmax(0,1fr))}.dashboard-analytics-grid{grid-template-columns:1fr}.dashboard-category-content{grid-template-columns:210px minmax(0,1fr)}}
@media(max-width:800px){.dashboard-toolbar{align-items:stretch;flex-direction:column}.dashboard-toolbar-actions,.dashboard-period-form{align-items:stretch;flex-direction:column}.dashboard-custom-dates{display:grid;grid-template-columns:1fr 1fr}.dashboard-period-form select,.dashboard-period-form input,.dashboard-toolbar-actions .btn{width:100%}.dashboard-kpis-modern,.dashboard-operations-grid{grid-template-columns:1fr}.dashboard-metric{min-height:128px}.dashboard-category-content{grid-template-columns:1fr;justify-items:center}.dashboard-legend{width:100%}.dashboard-card{padding:17px}.dashboard-ranking-row{grid-template-columns:30px minmax(0,1fr)}.dashboard-ranking-row>span{grid-column:2}.dashboard-sales-list>div{grid-template-columns:46px minmax(0,1fr)}.dashboard-sales-list>div>strong{grid-column:2}}

/* O dashboard responde à largura útil após a sidebar e também ao zoom do navegador. */
.dashboard-page {
  container: dashboard-page / inline-size;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: clip;
}

.dashboard-toolbar,
.dashboard-toolbar-actions,
.dashboard-period-form {
  min-width: 0;
  flex-wrap: wrap;
}

.dashboard-toolbar > div:first-child,
.dashboard-card-heading > div,
.dashboard-category-content > *,
.dashboard-legend,
.dashboard-legend > div,
.dashboard-ranking-row > div,
.dashboard-sales-list > div > span {
  min-width: 0;
}

.dashboard-kpis-modern {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
}

.dashboard-analytics-grid {
  grid-template-columns: minmax(0, 1.65fr) minmax(340px, 1fr);
}

.dashboard-operations-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
}

.dashboard-category-card {
  container: category-card / inline-size;
}

.dashboard-category-content {
  grid-template-columns: minmax(150px, 210px) minmax(220px, 340px);
  justify-content: start;
  column-gap: clamp(18px, 3vw, 42px);
}

.dashboard-donut-chart {
  width: min(100%, 210px);
  height: auto;
  aspect-ratio: 1;
  justify-self: center;
}

.dashboard-legend > div {
  grid-template-columns: 10px minmax(0, 1fr) auto;
}

.dashboard-legend {
  width: min(100%, 340px);
}

.dashboard-legend span {
  overflow-wrap: anywhere;
}

.dashboard-legend strong {
  white-space: nowrap;
}

.dashboard-line-chart {
  min-height: 190px;
  height: clamp(190px, 22vw, 260px);
}

.dashboard-line-chart,
.dashboard-donut-chart {
  cursor: crosshair;
  touch-action: none;
}

.dashboard-chart-tooltip {
  position: fixed;
  z-index: 9999;
  display: grid;
  min-width: 150px;
  max-width: min(260px, calc(100vw - 20px));
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .12s ease, transform .12s ease;
}

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

.dashboard-chart-tooltip strong { font-size: .8rem; }
.dashboard-chart-tooltip span { color: var(--primary); font-size: .92rem; font-weight: 800; }
.dashboard-chart-tooltip small { color: var(--muted); font-size: .7rem; }

@container category-card (max-width: 620px) {
  .dashboard-category-content {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .dashboard-legend {
    width: min(100%, 420px);
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  }
}

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

  .dashboard-toolbar {
    align-items: stretch;
  }

  .dashboard-toolbar-actions {
    justify-content: flex-start;
  }
}

@container dashboard-page (max-width: 720px) {
  .dashboard-toolbar {
    flex-direction: column;
  }

  .dashboard-toolbar-actions,
  .dashboard-period-form {
    width: 100%;
  }

  .dashboard-period-form select,
  .dashboard-period-form .btn,
  .dashboard-toolbar-actions > .btn {
    flex: 1 1 180px;
  }

  .dashboard-custom-dates {
    flex: 1 1 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-card-heading {
    flex-wrap: wrap;
  }
}

@container dashboard-page (max-width: 480px) {
  .dashboard-kpis-modern,
  .dashboard-operations-grid {
    grid-template-columns: 1fr;
  }

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

  .dashboard-period-form select,
  .dashboard-period-form .btn,
  .dashboard-toolbar-actions > .btn {
    width: 100%;
    flex-basis: 100%;
  }

  .dashboard-ranking-row,
  .dashboard-sales-list > div {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .dashboard-ranking-row > span,
  .dashboard-sales-list > div > strong {
    grid-column: 2;
    justify-self: start;
  }
}

/* Keep the HTML legend synchronized with the dashboard canvas palette. */
.dashboard-legend > div:nth-child(7n+1) i { background: var(--dashboard-chart-1); }
.dashboard-legend > div:nth-child(7n+2) i { background: var(--dashboard-chart-2); }
.dashboard-legend > div:nth-child(7n+3) i { background: var(--dashboard-chart-3); }
.dashboard-legend > div:nth-child(7n+4) i { background: var(--dashboard-chart-4); }
.dashboard-legend > div:nth-child(7n+5) i { background: var(--dashboard-chart-5); }
.dashboard-legend > div:nth-child(7n+6) i { background: var(--dashboard-chart-6); }
.dashboard-legend > div:nth-child(7n+7) i { background: var(--dashboard-chart-7); }

.dashboard-sales-list > .dashboard-empty-panel {
  display: flex;
  width: 100%;
  min-width: 100%;
  min-height: 170px;
  grid-template-columns: none;
  gap: 7px;
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: var(--surface-2);
}

.dashboard-empty-panel .dashboard-empty-icon {
  width: 38px;
  height: 38px;
  margin-bottom: 5px;
  padding: 8px;
  border: 1px solid rgba(var(--primary-rgb), .3);
  border-radius: 12px;
  background: rgba(var(--primary-rgb), .1);
  color: var(--primary);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.dashboard-sales-list > .dashboard-empty-panel > strong,
.dashboard-sales-list > .dashboard-empty-panel > span {
  display: block;
  max-width: 100%;
  text-align: center;
  white-space: normal;
}

.dashboard-sales-list > .dashboard-empty-panel > span {
  color: var(--muted);
  font-size: .8rem;
}

/* Auth experience — shared login and registration */
.app-shell:has(.auth-page),
.main-content:has(.auth-page),
.content-frame:has(.auth-page) {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  padding: 0;
}

.content-frame:has(.auth-page) {
  overflow: visible;
}

.auth-page {
  --auth-panel: #0e0d17;
  --auth-panel-soft: #151320;
  --auth-border: rgba(255, 255, 255, .1);
  min-height: 100vh;
  background: #09080f;
  color: #f8f7fb;
}

.auth-page .auth-public-header {
  position: fixed;
  inset: 0 0 auto;
  background: rgba(7, 6, 12, .76);
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(390px, 37%) minmax(0, 63%);
  min-height: 100vh;
  padding-top: 76px;
}

.auth-brand-panel {
  position: relative;
  min-height: calc(100vh - 76px);
  overflow: hidden;
  border-right: 1px solid rgba(151, 85, 255, .18);
  background:
    radial-gradient(circle at 18% 18%, rgba(132, 53, 255, .2), transparent 24rem),
    linear-gradient(145deg, #080710 0%, #100a1d 58%, #080711 100%);
}

.auth-brand-grid {
  position: absolute;
  inset: 0;
  opacity: .22;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, #000, transparent 85%);
}

.auth-brand-glow {
  position: absolute;
  width: 22rem;
  height: 22rem;
  border: 1px solid rgba(141, 68, 255, .24);
  border-radius: 50%;
  filter: blur(.2px);
}

.auth-brand-glow::after {
  content: '';
  position: absolute;
  inset: 22%;
  border: 1px solid rgba(82, 211, 255, .14);
  border-radius: inherit;
}

.auth-brand-glow-one { top: 9%; right: -12rem; }
.auth-brand-glow-two { bottom: -13rem; left: -9rem; width: 28rem; height: 28rem; }

.auth-brand-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 76px);
  padding: clamp(2rem, 5vh, 4.5rem) clamp(2rem, 4.5vw, 5rem) clamp(1.5rem, 4vh, 3rem);
}

.auth-brand-logo { width: 188px; height: auto; margin-bottom: clamp(3rem, 8vh, 7rem); }
.auth-brand-copy { max-width: 570px; }
.auth-eyebrow, .auth-form-kicker {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  margin-bottom: 1rem;
  color: #b89afd;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.auth-eyebrow > span { width: 7px; height: 7px; border-radius: 50%; background: #57dff0; box-shadow: 0 0 14px rgba(87,223,240,.8); }
.auth-brand-copy h1 { margin: 0; color: #fff; font-size: clamp(2.65rem, 4.2vw, 5rem); font-weight: 850; line-height: .98; letter-spacing: -.055em; }
.auth-brand-copy h1 em { color: #a16cff; font-style: normal; }
.auth-brand-copy > p { max-width: 540px; margin: 1.5rem 0 0; color: #aaa6b8; font-size: clamp(1rem, 1.25vw, 1.18rem); line-height: 1.75; }

.auth-benefits { display: grid; gap: .75rem; width: min(100%, 510px); margin-top: clamp(2.2rem, 5vh, 4.5rem); }
.auth-benefit { display: flex; align-items: center; gap: .9rem; min-height: 66px; padding: .75rem .95rem; border: 1px solid rgba(255,255,255,.07); border-radius: 14px; background: rgba(255,255,255,.025); backdrop-filter: blur(8px); transition: border-color 180ms ease, transform 180ms ease, background 180ms ease; }
.auth-benefit:hover { transform: translateX(3px); border-color: rgba(156,92,255,.28); background: rgba(156,92,255,.055); }
.auth-benefit-icon { display: grid; place-items: center; width: 39px; height: 39px; flex: 0 0 39px; border: 1px solid rgba(157,91,255,.3); border-radius: 11px; background: rgba(132,62,255,.1); color: #ae7aff; }
.auth-benefit-icon svg, .auth-input-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.auth-benefit > span:last-child { display: grid; gap: .12rem; }
.auth-benefit strong { color: #f5f3fa; font-size: .92rem; }
.auth-benefit small { color: #898493; font-size: .76rem; }
.auth-brand-signature { margin: auto 0 0; padding-top: 2rem; color: #777281; font-size: .78rem; }

.auth-form-panel { display: grid; place-items: center; min-width: 0; padding: clamp(2rem, 5vw, 6rem); background: radial-gradient(circle at 55% 42%, rgba(109,52,203,.07), transparent 30rem), #0a090f; }
.auth-form-wrap { width: min(100%, 590px); padding: clamp(1.5rem, 3.2vw, 2.65rem); border: 1px solid var(--auth-border); border-radius: 24px; background: linear-gradient(160deg, rgba(20,18,30,.96), rgba(12,11,18,.98)); box-shadow: 0 30px 80px rgba(0,0,0,.38), 0 0 0 1px rgba(130,68,230,.025); }
.auth-mobile-brand { display: none; }

.auth-page .login-tab-nav { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; width: 100%; margin: 0 0 2rem; padding: .3rem; border: 1px solid rgba(255,255,255,.075); border-radius: 12px; background: #09080f; }
.auth-page .login-tab-nav .settings-tab-button { width: 100%; min-height: 42px; border: 0; border-radius: 9px; background: transparent; color: #817c8b; font-size: .86rem; font-weight: 750; box-shadow: none; }
.auth-page .login-tab-nav .settings-tab-button.active, .auth-page .login-tab-nav .settings-tab-button.is-active { background: #20172e; color: #fff; box-shadow: inset 0 0 0 1px rgba(164,102,255,.22); }
.auth-page .login-tab-nav .settings-tab-button:hover, .auth-page .login-tab-nav .settings-tab-button:focus-visible { color: #fff; background: #181321; box-shadow: none; }

.auth-form-heading { margin-bottom: 1.65rem; }
.auth-form-heading h2 { margin: 0 0 .5rem; color: #fff; font-size: clamp(1.85rem, 2.7vw, 2.5rem); font-weight: 820; letter-spacing: -.035em; }
.auth-form-heading > p { margin: 0; color: #918c9c; font-size: .94rem; }
.auth-form-kicker { margin-bottom: .55rem; font-size: .64rem; }
.auth-step-meta { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: .55rem; color: #777281; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.auth-step-meta strong { color: #a78bdb; }
.auth-step-track { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; margin-bottom: 1.6rem; }
.auth-step-track span { height: 3px; border-radius: 99px; background: #292531; }
.auth-step-track .is-current { background: linear-gradient(90deg, #8b45ee, #b279ff); box-shadow: 0 0 12px rgba(144,75,239,.32); }

.auth-field { margin-bottom: 1rem; }
.auth-field .form-label, .auth-label-row .form-label { margin: 0 0 .45rem; color: #d8d5df; font-size: .78rem; font-weight: 700; }
.auth-field .form-label > span { color: #a975ff; }
.auth-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.auth-label-row a, .auth-switch-copy a, .auth-terms-option a { color: #ac7aff; font-size: .76rem; font-weight: 650; text-decoration: none; }
.auth-label-row a:hover, .auth-switch-copy a:hover, .auth-terms-option a:hover { color: #c6a3ff; text-decoration: underline; }
.auth-input-shell { position: relative; display: flex; align-items: center; min-height: 50px; border: 1px solid #34303d; border-radius: 11px; background: #0b0a10; transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease; }
.auth-input-shell:hover { border-color: #4b4555; }
.auth-input-shell:focus-within { border-color: #9153ef; background: #0d0b13; box-shadow: 0 0 0 3px rgba(144,75,239,.11), 0 0 24px rgba(121,53,224,.06); }
.auth-input-shell.has-error { border-color: #d35b6c; }
.auth-input-icon { display: grid; place-items: center; width: 46px; flex: 0 0 46px; color: #706a79; }
.auth-input-icon svg { width: 18px; height: 18px; }
.auth-input-shell:focus-within .auth-input-icon { color: #a36aff; }
.auth-page .auth-input-shell .form-control { min-height: 48px; padding: .7rem 2.8rem .7rem 0; border: 0 !important; border-radius: 0; background: transparent !important; color: #f4f2f7; font-size: .9rem; box-shadow: none !important; }
.auth-page .auth-input-shell .form-control::placeholder { color: #585360; opacity: 1; }
.auth-page .auth-input-shell .form-control.is-invalid { background-image: none; }
.auth-password-toggle { position: absolute; right: .4rem; display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 8px; background: transparent; color: #77717f; }
.auth-password-toggle:hover, .auth-password-toggle:focus-visible { background: rgba(255,255,255,.055); color: #fff; }
.auth-password-toggle > span { position: relative; width: 18px; height: 12px; border: 1.7px solid currentColor; border-radius: 50% / 65%; }
.auth-password-toggle > span::after { content: ''; position: absolute; top: 50%; left: 50%; width: 4px; height: 4px; border-radius: 50%; background: currentColor; transform: translate(-50%,-50%); }
.auth-password-toggle[aria-pressed='true'] > span::before { content: ''; position: absolute; z-index: 2; top: 5px; left: -2px; width: 22px; height: 1.5px; background: currentColor; transform: rotate(-35deg); }
.auth-field-help { display: block; margin-top: .38rem; color: #66616e; font-size: .7rem; }
.auth-field-error { display: flex; align-items: center; gap: .35rem; margin-top: .42rem; color: #ff8795; font-size: .72rem; }
.auth-field-error > span { display: grid; place-items: center; width: 15px; height: 15px; border: 1px solid currentColor; border-radius: 50%; font-size: .6rem; font-weight: 900; }

.auth-password-feedback { display: flex; align-items: center; gap: .65rem; margin-top: .55rem; color: #716b79; font-size: .68rem; }
.auth-password-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; width: 92px; }
.auth-password-meter span { height: 3px; border-radius: 9px; background: #2f2b35; transition: background 180ms ease, box-shadow 180ms ease; }
.auth-password-feedback[data-score='1'] .auth-password-meter span:nth-child(-n+1) { background: #df6475; }
.auth-password-feedback[data-score='2'] .auth-password-meter span:nth-child(-n+2) { background: #e4a34d; }
.auth-password-feedback[data-score='3'] .auth-password-meter span:nth-child(-n+3) { background: #a476fa; }
.auth-password-feedback[data-score='4'] .auth-password-meter span { background: #49c990; box-shadow: 0 0 8px rgba(73,201,144,.22); }
.auth-password-rule { display: flex; align-items: center; gap: .35rem; margin-top: .4rem; color: #6f6977; font-size: .68rem; }
.auth-password-rule > span { color: #514b59; }
.auth-password-rule.is-valid { color: #6fbf99; }
.auth-password-rule.is-valid > span { color: #4fce90; }

.login-remember-option, .auth-terms-option { display: flex; align-items: flex-start; gap: .65rem; margin: .25rem 0 1.15rem; color: #8c8795; font-size: .75rem; line-height: 1.5; cursor: pointer; }
.login-remember-option input, .auth-terms-option input { width: 17px; height: 17px; flex: 0 0 17px; margin-top: .05rem; accent-color: #9252ee; }
.auth-legal-label { color: #ac7aff; font-weight: 650; }
.auth-submit-button { position: relative; width: 100%; min-height: 51px; overflow: hidden; border: 1px solid #9b61f2; border-radius: 11px; background: linear-gradient(110deg, #7835db, #9c56ed 52%, #6f65ee); color: #fff; font-size: .88rem; font-weight: 800; box-shadow: 0 12px 30px rgba(111,48,208,.24); transition: transform 150ms ease, box-shadow 180ms ease, filter 180ms ease; }
.auth-submit-button:hover, .auth-submit-button:focus-visible { color: #fff; filter: brightness(1.08); box-shadow: 0 16px 36px rgba(117,54,216,.32); transform: translateY(-1px); }
.auth-submit-button:active { transform: translateY(0); }
.auth-submit-arrow { position: absolute; right: 1.1rem; font-size: 1.1rem; transition: transform 160ms ease; }
.auth-submit-button:hover .auth-submit-arrow { transform: translateX(3px); }
.auth-submit-spinner { display: none; width: 17px; height: 17px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: auth-spin .7s linear infinite; }
.auth-submit-button.is-loading .auth-submit-spinner { display: block; }
.auth-submit-button.is-loading .auth-submit-arrow { display: none; }
.auth-submit-button:disabled { opacity: .72; cursor: wait; transform: none; }
@keyframes auth-spin { to { transform: rotate(360deg); } }
.auth-switch-copy { margin: 1.15rem 0 0; color: #77717f; font-size: .76rem; text-align: center; }
.auth-switch-copy a { font-size: inherit; }
.auth-security-note { display: flex; align-items: center; justify-content: center; gap: .4rem; margin: 1rem 0 0; color: #57525e; font-size: .66rem; text-align: center; }
.auth-security-note > span { color: #8e5bd8; }

/* Password recovery — same authentication system, focused recovery states */
.auth-recovery-card { width: min(100%, 540px); }
.auth-recovery-heading { margin-bottom: 1.8rem; }
.auth-status-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 1.35rem;
  border: 1px solid rgba(163, 102, 255, .32);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(139, 69, 238, .2), rgba(74, 37, 114, .08));
  color: #b77dff;
  box-shadow: 0 12px 30px rgba(92, 37, 170, .13);
}
.auth-status-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.auth-benefit-check { display: grid; place-items: center; width: 39px; height: 39px; flex: 0 0 39px; border: 1px solid rgba(157, 91, 255, .3); border-radius: 11px; background: rgba(132, 62, 255, .1); color: #b782ff; font-size: 1rem; font-weight: 900; }
.auth-footer-link { display: flex; align-items: center; justify-content: center; gap: .45rem; width: max-content; margin: 1.35rem auto 0; color: #827c8b; font-size: .78rem; font-weight: 700; text-decoration: none; transition: color 160ms ease, transform 160ms ease; }
.auth-footer-link:hover, .auth-footer-link:focus-visible { color: #b989ff; transform: translateX(-2px); }
.auth-success-state { display: grid; justify-items: center; text-align: center; animation: auth-state-in 280ms ease both; }
.auth-success-state .auth-status-icon { margin-bottom: 1rem; }
.auth-status-icon-success { border-color: rgba(73, 201, 144, .32); background: rgba(42, 151, 101, .1); color: #58d79c; box-shadow: 0 12px 32px rgba(42, 151, 101, .1); }
.auth-success-state .auth-form-kicker { margin-bottom: .65rem; color: #70d6a4; }
.auth-success-state h2 { margin: 0 0 .75rem; color: #fff; font-size: clamp(2rem, 3vw, 2.55rem); font-weight: 850; letter-spacing: -.04em; }
.auth-success-state > p { max-width: 430px; margin: 0; color: #9791a0; font-size: .93rem; line-height: 1.65; }
.auth-success-email { max-width: 100%; margin: 1rem 0; padding: .68rem 1rem; overflow-wrap: anywhere; border: 1px solid rgba(164, 102, 255, .2); border-radius: 10px; background: rgba(142, 76, 234, .075); color: #c8a7ff; font-size: .9rem; }
.auth-success-state .auth-success-hint { margin-bottom: 1.5rem; color: #716b79; font-size: .78rem; }
.auth-submit-link { display: flex; align-items: center; justify-content: center; gap: .75rem; text-decoration: none; }
.auth-success-state .auth-footer-link { margin-top: 1rem; }
@keyframes auth-state-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1100px) {
  .auth-layout { grid-template-columns: minmax(320px, 34%) minmax(0, 66%); }
  .auth-brand-content { padding-inline: 2rem; }
  .auth-brand-copy h1 { font-size: clamp(2.5rem, 4.5vw, 3.8rem); }
  .auth-benefit small { display: none; }
}

@media (max-width: 820px) {
  .auth-page .auth-public-header { position: relative; }
  .auth-layout { display: block; min-height: calc(100vh - 66px); padding-top: 0; }
  .auth-brand-panel { display: none; }
  .auth-form-panel { min-height: calc(100vh - 66px); padding: 1.5rem; }
  .auth-mobile-brand { display: grid; justify-items: center; margin-bottom: 1.5rem; text-align: center; }
  .auth-mobile-brand img { width: 158px; }
  .auth-mobile-brand p { margin: .45rem 0 0; color: #77717f; font-size: .75rem; }
}

@media (max-width: 575.98px) {
  .auth-page .auth-public-navigation { z-index: 5; }
  .auth-form-panel { align-items: start; padding: .85rem; }
  .auth-form-wrap { padding: 1.25rem; border-radius: 18px; }
  .auth-mobile-brand { margin-bottom: 1.1rem; }
  .auth-page .login-tab-nav { margin-bottom: 1.4rem; }
  .auth-form-heading { margin-bottom: 1.25rem; }
  .auth-form-heading h2 { font-size: 1.8rem; }
  .auth-submit-button { min-height: 52px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-page *, .auth-page *::before, .auth-page *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
