:root {
  --primary-400: #006ff8;
  --primary-300: #66adff;
  --primary-200: #b3d4ff;
  --primary-100: #ddebf9;
  --primary-50: #f0f7ff;

  --secondary-400: #ff4500;
  --secondary-300: #ff9966;
  --secondary-200: #ffc9b3;
  --secondary-100: #ffe8de;
  --secondary-50: #fff5f0;

  --success-600: #15803d;
  --success-500: #22c55e;
  --success-100: #dcfce7;
  --danger-600: #dc2626;
  --danger-500: #ef4444;
  --danger-100: #fee2e2;

  --gray-900: #111827;
  --gray-800: #2c2c2c;
  --gray-700: #374151;
  --gray-600: #4b5563;
  --gray-500: #6b7280;
  --gray-400: #9ca3af;
  --gray-300: #d1d5db;
  --gray-200: #e5e7eb;
  --gray-100: #f3f4f6;
  --gray-50: #f9fafb;

  --surface-400: #d1d5db;
  --surface-300: #e5e7eb;
  --surface-200: #f3f4f6;
  --surface-100: #f9fafb;
  --surface-50: #ffffff;

  --text: var(--gray-700);
  --text-strong: var(--gray-900);
  --text-muted: var(--gray-500);
  --line: rgba(17, 24, 39, 0.1);
  --shadow-soft: 0 12px 28px rgba(17, 24, 39, 0.08);
  --shadow-panel: 0 8px 18px rgba(17, 24, 39, 0.06);
  --radius: 8px;
  --radius-sm: 6px;
  --sidebar-width: 248px;
  --sidebar-rail: 72px;
  --topbar-height: 58px;
  --font-size: 12px;
}

* {
  box-sizing: border-box;
}

html {
  font-size: var(--font-size);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(0, 111, 248, 0.045), transparent 260px),
    var(--surface-100);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: var(--font-size);
  line-height: 1.5;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

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

svg {
  stroke-linecap: round;
  stroke-linejoin: round;
}

.erp-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 180ms ease;
}

body.sidebar-collapsed .erp-shell {
  grid-template-columns: var(--sidebar-rail) minmax(0, 1fr);
}

.erp-sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  background: var(--gray-900);
  color: rgba(255, 255, 255, 0.8);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--topbar-height);
  padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: var(--radius);
  background: linear-gradient(145deg, var(--primary-400), var(--primary-300));
  color: var(--surface-50);
  font-weight: 800;
}

.brand-text {
  display: grid;
  min-width: 0;
}

.brand-title {
  color: var(--surface-50);
  font-weight: 750;
  line-height: 1.2;
}

.brand-subtitle {
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.2;
}

.sidebar-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  overflow-y: auto;
}

.nav-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
  margin: 8px 4px 4px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.42);
  font-weight: 700;
  text-transform: uppercase;
  list-style: none;
  appearance: none;
  cursor: pointer;
}

.nav-section::-webkit-details-marker {
  display: none;
}

.nav-section::marker {
  content: none;
  font-size: 0;
}

.nav-section > svg {
  display: none;
}

.nav-section::after {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  content: "";
  transform: rotate(45deg);
  transition: transform 160ms ease;
}

.sidebar-group {
  display: grid;
  gap: 2px;
}

.sidebar-group[open] > .nav-section::after {
  transform: rotate(225deg);
}

.sidebar-group.is-active > .nav-section,
.sidebar-group[open] > .nav-section {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.82);
}

.sidebar-group-list {
  display: grid;
  gap: 3px;
}

.sidebar-group-list .nav-link {
  margin-left: 4px;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 10px;
  border-radius: var(--radius);
  color: rgba(255, 255, 255, 0.74);
  transition: background 160ms ease, color 160ms ease;
}

.nav-link svg {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  stroke-width: 1.9;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--surface-50);
}

.nav-link.is-active {
  background: rgba(0, 111, 248, 0.18);
  color: var(--surface-50);
}

.nav-link.is-active::before {
  position: absolute;
  top: 50%;
  left: 0;
  width: 3px;
  height: 18px;
  border-radius: 0 999px 999px 0;
  background: var(--primary-300);
  content: "";
  transform: translateY(-50%);
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.branch-card {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
}

.branch-label {
  color: rgba(255, 255, 255, 0.48);
}

.branch-name {
  color: var(--surface-50);
  font-weight: 700;
}

.erp-main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--topbar-height);
  padding: 0 22px;
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar-title {
  display: grid;
  min-width: 0;
}

.page-title {
  margin: 0;
  color: var(--text-strong);
  font-size: 12px;
  font-weight: 800;
}

.page-kicker {
  color: var(--text-muted);
}

.icon-button {
  display: inline-grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-50);
  color: var(--gray-700);
  transition: border-color 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

.icon-button:hover {
  border-color: rgba(0, 111, 248, 0.34);
  color: var(--primary-400);
  box-shadow: 0 8px 18px rgba(0, 111, 248, 0.1);
}

.icon-button svg {
  width: 17px;
  height: 17px;
}

.logout-button {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 7px;
  width: auto;
  min-width: 86px;
  padding: 0 12px;
  font-weight: 800;
}

.logout-button span {
  line-height: 1;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 5px 8px 5px 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-50);
}

.avatar {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: var(--secondary-100);
  color: var(--secondary-400);
  font-weight: 800;
}

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

.user-name {
  color: var(--text-strong);
  font-weight: 750;
  line-height: 1.2;
}

.user-role {
  color: var(--text-muted);
  line-height: 1.2;
}

.content {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  width: min(100%, 1440px);
  margin: 0 auto;
  padding: 18px 22px 28px;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1fr) 420px;
  background:
    linear-gradient(135deg, rgba(0, 111, 248, 0.12), transparent 42%),
    linear-gradient(315deg, rgba(255, 69, 0, 0.08), transparent 36%),
    var(--surface-100);
}

.auth-visual {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  padding: 34px;
  background: var(--gray-900);
  color: var(--surface-50);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-copy {
  display: grid;
  max-width: 540px;
  gap: 12px;
}

.auth-copy h1 {
  margin: 0;
  color: var(--surface-50);
  font-size: 22px;
  font-weight: 850;
}

.auth-copy p,
.auth-footnote {
  color: rgba(255, 255, 255, 0.66);
}

.auth-feature-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 760px;
}

.auth-feature {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
}

.auth-feature strong {
  color: var(--surface-50);
}

.auth-feature span {
  color: rgba(255, 255, 255, 0.56);
}

.auth-panel {
  display: grid;
  align-items: center;
  padding: 20px;
}

.auth-card {
  display: grid;
  gap: 16px;
  width: 100%;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-soft);
}

.auth-card-header {
  display: grid;
  gap: 4px;
}

.auth-card-title {
  margin: 0;
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 850;
}

.auth-card-subtitle {
  color: var(--text-muted);
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}

.checkbox-row input {
  width: 14px;
  height: 14px;
  accent-color: var(--primary-400);
}

.alert {
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid transparent;
}

.alert-success {
  border-color: rgba(18, 183, 106, 0.22);
  background: #ecfdf3;
  color: #087443;
}

.alert-error {
  border-color: rgba(255, 69, 0, 0.22);
  background: var(--secondary-50);
  color: var(--secondary-400);
}

.alert-warning {
  border-color: rgba(245, 158, 11, 0.28);
  background: #fffbeb;
  color: #92400e;
}

.error-text {
  color: var(--secondary-400);
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

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

.form-grid .span-4 {
  grid-column: span 4;
}

.textarea {
  min-height: 72px;
  padding-top: 9px;
  resize: vertical;
}

.switch-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  color: var(--text-muted);
  font-weight: 700;
}

.switch-row input {
  width: 34px;
  height: 18px;
  accent-color: var(--primary-400);
}

.table-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.inline-form {
  display: inline;
}

.permission-matrix {
  display: grid;
  gap: 10px;
}

.permission-group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-50);
}

.permission-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text-strong);
  font-weight: 800;
}

.permission-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
}

.permission-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-100);
}

.permission-item input {
  flex: 0 0 auto;
  margin-top: 2px;
  accent-color: var(--primary-400);
}

.permission-meta {
  display: grid;
  min-width: 0;
}

.permission-code {
  color: var(--text-strong);
  font-weight: 750;
}

.permission-name {
  color: var(--text-muted);
}

.empty-state {
  display: grid;
  gap: 6px;
  padding: 18px;
  color: var(--text-muted);
  text-align: center;
}

.erp-dialog {
  width: min(calc(100vw - 28px), 760px);
  max-height: min(860px, calc(100vh - 28px));
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-50);
  color: var(--text);
  box-shadow: 0 28px 70px rgba(17, 24, 39, 0.34);
}

.erp-dialog::backdrop {
  background: rgba(17, 24, 39, 0.78);
}

.erp-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 0 22px;
  background: var(--primary-400);
  color: var(--surface-50);
}

.erp-dialog-title {
  margin: 0;
  color: var(--surface-50);
  font-size: 15px;
  font-weight: 850;
}

.dialog-close {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-size: 24px;
  font-weight: 850;
  line-height: 1;
}

.dialog-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--surface-50);
}

.erp-dialog-body {
  display: grid;
  gap: 14px;
  max-height: calc(100vh - 190px);
  padding: 18px 22px;
  overflow-y: auto;
}

.erp-dialog-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-height: 58px;
  padding: 10px 22px;
  border-top: 1px dashed var(--gray-300);
  background: var(--surface-50);
}

.role-dialog {
  width: min(calc(100vw - 28px), 820px);
}

.user-dialog {
  width: min(calc(100vw - 28px), 620px);
}

.role-access-tree {
  display: grid;
  gap: 16px;
}

.role-tree-module {
  display: grid;
  gap: 8px;
}

.role-tree-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-strong);
  font-weight: 850;
  text-transform: uppercase;
}

.role-tree-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.role-tree-heading svg {
  width: 15px;
  height: 15px;
  color: var(--gray-500);
}

.role-tree-menu {
  position: relative;
  display: grid;
  gap: 8px;
  margin-left: 15px;
  padding-left: 18px;
  border-left: 1px solid var(--gray-200);
}

.role-tree-menu-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-strong);
  font-weight: 800;
}

.role-tree-menu-title svg {
  width: 14px;
  height: 14px;
  color: var(--gray-500);
}

.role-check-all {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid rgba(0, 111, 248, 0.28);
  border-radius: 999px;
  background: var(--primary-50);
  color: var(--primary-400);
  font-weight: 800;
  text-transform: none;
  cursor: pointer;
}

.role-check-all input {
  width: 13px;
  height: 13px;
  accent-color: var(--primary-400);
}

.role-tree-menu-title .role-check-all {
  border-color: rgba(81, 182, 173, 0.38);
  background: #f0fffb;
  color: #339b91;
}

.role-permission-list {
  display: grid;
  gap: 8px;
  margin-left: 18px;
  padding-left: 18px;
  border-left: 1px solid var(--gray-200);
}

.role-permission-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 34px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
}

.role-permission-row:hover {
  background: var(--surface-100);
}

.role-permission-row input {
  width: 14px;
  height: 14px;
  accent-color: var(--primary-400);
}

.role-permission-type {
  min-width: 60px;
  padding: 2px 8px;
  border: 1px solid rgba(0, 111, 248, 0.45);
  border-radius: 999px;
  color: var(--primary-400);
  font-weight: 750;
  text-align: center;
}

.role-permission-type.is-data {
  border-color: rgba(81, 182, 173, 0.5);
  color: #339b91;
}

.role-permission-name {
  min-width: 0;
  color: var(--text-strong);
  font-weight: 750;
}

.dialog-select {
  min-height: 40px;
  border-radius: var(--radius);
}

.user-dialog-form {
  display: grid;
  gap: 14px;
}

.user-dialog-note {
  color: var(--text-muted);
}

.cashier-entry-shell {
  display: grid;
  grid-template-columns: minmax(340px, 0.92fr) minmax(420px, 1.08fr);
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(0, 111, 248, 0.1), transparent 42%),
    linear-gradient(315deg, rgba(81, 182, 173, 0.14), transparent 38%),
    var(--surface-100);
  color: var(--text);
}

.cashier-entry-aside {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  padding: 28px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), transparent 34%),
    var(--gray-900);
  color: var(--surface-50);
}

.cashier-entry-workspace {
  display: grid;
  align-content: center;
  gap: 14px;
  min-width: 0;
  padding: 24px;
}

.cashier-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.cashier-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 850;
}

.cashier-logo-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-50);
  color: var(--primary-400);
  font-weight: 900;
}

.cashier-logo-text {
  display: grid;
  line-height: 1.1;
}

.cashier-logo-text span:first-child {
  color: var(--surface-50);
}

.cashier-logo-text span:last-child {
  color: rgba(255, 255, 255, 0.62);
  font-weight: 700;
}

.cashier-logout {
  min-height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
  color: var(--surface-50);
  font-weight: 850;
}

.cashier-logout:hover {
  background: rgba(255, 255, 255, 0.16);
}

.cashier-aside-copy {
  display: grid;
  gap: 10px;
  max-width: 500px;
}

.cashier-eyebrow {
  width: fit-content;
  padding: 5px 9px;
  border: 1px solid rgba(81, 182, 173, 0.42);
  border-radius: 999px;
  background: rgba(81, 182, 173, 0.12);
  color: #9ae5de;
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.cashier-aside-copy h1 {
  margin: 0;
  color: var(--surface-50);
  font-size: 24px;
  font-weight: 900;
}

.cashier-aside-copy p {
  margin: 0;
  color: rgba(255, 255, 255, 0.68);
  font-weight: 700;
}

.cashier-shift-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.cashier-summary-item {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
}

.cashier-summary-item span,
.cashier-summary-item small {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.56);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cashier-summary-item strong {
  overflow: hidden;
  color: var(--surface-50);
  font-size: 13px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cashier-summary-item.is-primary {
  border-color: rgba(81, 182, 173, 0.38);
  background: rgba(81, 182, 173, 0.12);
}

.cashier-shift-card {
  display: grid;
  gap: 16px;
  width: min(100%, 560px);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.cashier-card-heading {
  display: grid;
  gap: 5px;
}

.cashier-card-heading h2 {
  margin: 0;
  color: var(--text-strong);
  font-size: 16px;
  font-weight: 900;
}

.cashier-card-heading p {
  margin: 0;
  color: var(--text-muted);
  font-weight: 700;
}

.segmented-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--primary-400);
  border-radius: var(--radius);
  background: var(--surface-50);
}

.segmented-tab {
  min-height: 40px;
  border: 0;
  background: var(--surface-50);
  color: var(--primary-400);
  font-weight: 850;
}

.segmented-tab.is-active {
  background: var(--primary-400);
  color: var(--surface-50);
}

.cashier-info {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border-radius: var(--radius);
  background: #d2faf3;
  color: #24596a;
  font-weight: 700;
}

.cashier-info-icon {
  display: grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: #4fb5d6;
  color: var(--surface-50);
  font-weight: 900;
}

.cashier-detected-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(81, 182, 173, 0.24);
  border-radius: var(--radius);
  background: #f0fffb;
}

.cashier-detected-label {
  color: var(--text-muted);
  font-weight: 800;
}

.cashier-detected-box strong {
  color: #08745f;
  font-size: 15px;
  font-weight: 900;
}

.cashier-detected-box span:last-child {
  grid-column: 1 / -1;
  color: #28766a;
  font-weight: 700;
}

.cashier-shift-form,
.cashier-join-form {
  display: grid;
  gap: 14px;
}

.cashier-tab-panel[hidden] {
  display: none;
}

.open-session-list {
  display: grid;
  gap: 8px;
}

.open-session-card {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-100);
}

.open-session-card input {
  margin-top: 3px;
  accent-color: var(--primary-400);
}

.open-session-meta {
  display: grid;
  min-width: 0;
}

.open-session-title {
  color: var(--text-strong);
  font-weight: 800;
}

.open-session-note {
  color: var(--text-muted);
}

.cashier-skip {
  display: flex;
  justify-content: flex-start;
  width: min(100%, 560px);
}

.cashier-skip button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: var(--primary-400);
  font-weight: 850;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.field-compact {
  display: grid;
  gap: 4px;
  min-width: 142px;
}

.field-compact span {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 750;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 750;
  white-space: nowrap;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--primary-400);
  color: var(--surface-50);
}

.btn-primary:hover {
  background: #005fda;
  box-shadow: 0 9px 18px rgba(0, 111, 248, 0.2);
}

.btn-secondary {
  background: var(--secondary-50);
  border-color: var(--secondary-100);
  color: var(--secondary-400);
}

.btn-secondary:hover {
  background: var(--secondary-100);
}

.btn-danger {
  background: #f0645a;
  color: var(--surface-50);
}

.btn-danger:hover {
  background: #df4f45;
  box-shadow: 0 9px 18px rgba(240, 100, 90, 0.22);
}

.btn-ghost {
  background: var(--surface-50);
  border-color: var(--line);
  color: var(--gray-700);
}

.btn-ghost:hover {
  border-color: rgba(0, 111, 248, 0.28);
  color: var(--primary-400);
}

.field {
  display: grid;
  gap: 5px;
}

.field-label {
  color: var(--text-muted);
  font-weight: 700;
}

.inline-field {
  grid-template-columns: auto minmax(150px, 1fr);
  align-items: center;
  gap: 8px;
}

.input-group {
  display: flex;
  align-items: stretch;
  min-width: 0;
}

.input-group > span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: var(--surface-200);
  color: var(--text-muted);
  font-weight: 750;
}

.input-group > span:first-child {
  border-right: 0;
  border-radius: var(--radius) 0 0 var(--radius);
}

.input-group > span:last-child {
  border-left: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.input-group > .control {
  flex: 1 1 auto;
  min-width: 0;
  border-radius: 0;
}

.input-group > .control:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.input-group > .control:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.control {
  min-height: 34px;
  width: 100%;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-50);
  color: var(--text);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.control:focus {
  border-color: rgba(0, 111, 248, 0.5);
  box-shadow: 0 0 0 3px rgba(0, 111, 248, 0.12);
}

.search-field {
  position: relative;
  width: min(100%, 320px);
}

.search-field svg {
  position: absolute;
  top: 50%;
  left: 10px;
  width: 15px;
  height: 15px;
  color: var(--gray-400);
  transform: translateY(-50%);
}

.search-field .control {
  padding-left: 32px;
}

.grid {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

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

.panel,
.metric-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-panel);
}

.metric-card {
  display: grid;
  gap: 9px;
  min-height: 108px;
  padding: 14px;
}

.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.metric-label {
  color: var(--text-muted);
  font-weight: 750;
}

.metric-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--primary-50);
  color: var(--primary-400);
}

.metric-icon.is-accent {
  background: var(--secondary-50);
  color: var(--secondary-400);
}

.metric-icon svg {
  width: 16px;
  height: 16px;
}

.metric-value {
  color: var(--text-strong);
  font-weight: 850;
}

.metric-note {
  color: var(--text-muted);
}

.report-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.report-toolbar {
  margin-bottom: 12px;
}

.filter-note {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  font-weight: 750;
}

.report-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.text-success {
  color: var(--success-600);
  font-weight: 800;
}

.text-danger {
  color: var(--danger-600);
  font-weight: 800;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  margin: 0;
  color: var(--text-strong);
  font-size: 12px;
  font-weight: 800;
}

.panel-body {
  padding: 14px;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.data-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.transaction-link {
  display: inline-flex;
  max-width: 260px;
  align-items: center;
  color: var(--primary-500);
  font-weight: 850;
  line-height: 1.25;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.transaction-link:hover {
  color: var(--primary-600);
  text-decoration: underline;
}

.editable-table {
  min-width: 100%;
}

.shift-session-table {
  min-width: 1120px;
}

.activity-log-table {
  min-width: 980px;
}

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

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

.pareto-table {
  min-width: 1380px;
}

.inventory-report-table {
  min-width: 1540px;
}

.pareto-basis {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 36px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.pareto-basis label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 104px;
  height: 36px;
  padding: 0 12px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.pareto-basis label + label {
  border-left: 1px solid var(--line);
}

.pareto-basis label.is-active {
  background: var(--primary-400);
  color: #fff;
}

.pareto-basis input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pareto-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.pareto-class-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.pareto-class-card strong,
.pareto-class-card span {
  display: block;
}

.pareto-class-card strong {
  color: var(--text-strong);
  font-weight: 850;
}

.pareto-class-card div > span {
  margin-top: 3px;
  color: var(--text-muted);
  font-weight: 750;
}

.pareto-grade {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  font-weight: 900;
  letter-spacing: 0;
}

.pareto-grade.is-a {
  background: rgba(46, 125, 76, 0.12);
  color: var(--success-600);
}

.pareto-grade.is-b {
  background: rgba(242, 171, 55, 0.16);
  color: #9a6407;
}

.pareto-grade.is-c {
  background: rgba(86, 101, 119, 0.12);
  color: var(--text-muted);
}

.pareto-progress {
  width: 124px;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.pareto-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary-400), var(--accent-500));
}

.payment-method-table {
  min-width: 1080px;
}

.master-menu-table {
  min-width: 1780px;
}

.master-module-table {
  min-width: 1160px;
}

.master-branch-table {
  min-width: 1180px;
}

.master-warehouse-table {
  min-width: 1460px;
}

.master-shift-table {
  min-width: 1320px;
}

.master-manufacturer-table {
  min-width: 1180px;
}

.master-unit-table {
  min-width: 1080px;
}

.master-contact-table {
  min-width: 1120px;
}

.contact-page-toolbar {
  margin-bottom: 14px;
}

.reference-filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 220px) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.contact-page-toolbar .contact-filter-bar {
  flex: 1 1 720px;
}

.contact-form-grid {
  align-items: end;
}

.contact-switches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.contact-filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(150px, 0.7fr) minmax(130px, 0.55fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.contact-dialog {
  width: min(calc(100vw - 28px), 900px);
}

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

.contact-detail-item {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-100);
}

.contact-detail-item span {
  color: var(--text-muted);
  font-weight: 750;
}

.contact-detail-item strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text-strong);
}

.contact-dialog-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.contact-dialog-form .span-2 {
  grid-column: span 2;
}

.contact-dialog-footer {
  flex-wrap: wrap;
}

.purchase-toolbar {
  margin-bottom: 14px;
}

.purchase-loader {
  flex: 1 1 620px;
}

.purchase-loader .control {
  min-width: min(100%, 360px);
}

.purchase-document-form {
  display: grid;
  gap: 14px;
}

.purchase-actionbar {
  position: sticky;
  top: calc(var(--topbar-height) + 8px);
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-panel);
}

.purchase-header-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.purchase-list-table {
  min-width: 1180px;
}

.purchase-line-table {
  min-width: 1440px;
}

.purchase-invoice-line-table {
  min-width: 1840px;
}

.purchase-line-table td {
  vertical-align: top;
}

.purchase-line-table .control {
  min-width: 0;
}

.purchase-entry-row td {
  background: var(--primary-50);
}

.purchase-entry-row .btn {
  width: 100%;
  min-height: 36px;
}

.purchase-entry-message {
  min-height: 28px;
  padding-top: 8px;
  color: var(--text-muted);
  font-weight: 750;
}

.purchase-entry-message.is-error {
  color: var(--danger-500);
}

.purchase-entry-message.is-success {
  color: var(--success-500);
}

.purchase-line-table td:nth-child(1) {
  width: 68px;
  min-width: 68px;
}

.purchase-line-table td:nth-child(2) {
  min-width: 280px;
}

.purchase-line-table td:nth-child(4),
.purchase-line-table td:nth-child(6),
.purchase-line-table td:nth-child(7),
.purchase-line-table td:nth-child(8),
.purchase-line-table td:nth-child(9),
.purchase-line-table td:nth-child(12) {
  min-width: 140px;
}

.purchase-line-table tr.requires-batch [data-row-batch],
.purchase-line-table tr.requires-batch [data-row-expired] {
  border-color: rgba(0, 111, 248, 0.42);
  background: var(--primary-50);
}

.purchase-footer-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 14px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-50);
  box-shadow: var(--shadow-panel);
}

.purchase-footer-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.purchase-invoice-totals {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.purchase-discount-grid {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 8px;
}

.purchase-total-box {
  display: grid;
  justify-items: end;
  gap: 6px;
  min-height: 70px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--primary-50);
  color: var(--primary-400);
}

.purchase-total-box span {
  color: var(--text-muted);
  font-weight: 850;
  text-transform: uppercase;
}

.purchase-total-box strong {
  color: var(--primary-400);
  font-size: 22px;
  font-weight: 900;
}

.purchase-detail-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.purchase-detail-grid > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-100);
}

.purchase-detail-grid span {
  color: var(--text-muted);
  font-weight: 750;
}

.purchase-detail-grid strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text-strong);
}

.sales-cashier-form {
  display: grid;
  gap: 14px;
}

.sales-actionbar {
  position: sticky;
  top: calc(var(--topbar-height) + 8px);
  z-index: 8;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, auto) minmax(160px, auto);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-panel);
}

.sales-live-total {
  display: grid;
  justify-items: end;
  gap: 2px;
  color: var(--text-muted);
  font-weight: 800;
}

.sales-live-total strong {
  color: var(--primary-400);
  font-size: 20px;
  font-weight: 900;
}

.sales-header-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.sales-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.sales-main-panel {
  min-width: 0;
}

.sales-side-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  min-width: 0;
}

.sales-summary-grid {
  display: grid;
  gap: 10px;
}

.sales-payment-compact,
.sales-relation-compact {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.sales-payment-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  min-width: 0;
}

.sales-relation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
}

.sales-money-field .control {
  max-width: 190px;
}

.sales-payment-fields > .field,
.sales-relation-grid > .field,
.sales-fee-grid > .field {
  min-width: 0;
}

.sales-payment-compact .sales-money-field .control {
  max-width: none;
}

.sales-discount-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
}

.sales-compact-details {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-100);
}

.sales-compact-details summary {
  display: flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  color: var(--primary-500);
  font-weight: 850;
  cursor: pointer;
}

.sales-compact-details summary::marker {
  color: var(--primary-400);
}

.sales-fee-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
}

.sales-compact-details:not([open]) .sales-fee-grid {
  display: none;
}

.sales-total-card {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary-50), var(--secondary-50));
  color: var(--text-muted);
  font-weight: 800;
}

.sales-total-card strong {
  min-width: 0;
  color: var(--primary-400);
  font-size: 22px;
  font-weight: 900;
  text-align: right;
}

.sales-total-card small {
  justify-self: end;
  color: var(--text-muted);
  white-space: nowrap;
}

.sales-total-card small b {
  color: var(--text-muted);
}

.sales-list-table {
  min-width: 980px;
}

.sales-history-table {
  min-width: 900px;
}

.sales-main-panel .sales-line-table {
  width: 100%;
  min-width: 1146px;
  table-layout: fixed;
}

.sales-main-panel .table-wrap {
  max-height: min(58vh, 560px);
  overflow: auto;
  border-bottom: 1px solid var(--line);
}

.sales-main-panel .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.sales-main-panel .sales-line-table td {
  vertical-align: top;
}

.sales-main-panel .sales-line-table th,
.sales-main-panel .sales-line-table td {
  padding: 6px;
  white-space: normal;
}

.sales-main-panel .sales-line-table .control {
  min-width: 0;
}

.sales-product-search {
  position: relative;
  width: 100%;
  min-width: 0;
}

.sales-product-search .control {
  width: 100%;
}

.sales-autocomplete-list {
  position: fixed;
  z-index: 80;
  top: var(--autocomplete-top, 0);
  left: var(--autocomplete-left, 0);
  width: var(--autocomplete-width, 420px);
  max-width: calc(100vw - 24px);
  max-height: min(280px, calc(100vh - var(--autocomplete-top, 0px) - 16px));
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-50);
  box-shadow: 0 18px 42px rgba(17, 24, 39, 0.22);
}

.sales-autocomplete-option {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.sales-autocomplete-option + .sales-autocomplete-option {
  border-top: 1px solid var(--line);
}

.sales-autocomplete-option strong {
  color: var(--text-strong);
  font-weight: 850;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.sales-autocomplete-option span {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.25;
}

.sales-autocomplete-option:hover,
.sales-autocomplete-option.is-active {
  background: var(--primary-50);
}

.sales-autocomplete-option:hover strong,
.sales-autocomplete-option.is-active strong {
  color: var(--primary-500);
}

.sales-entry-row td {
  background: color-mix(in srgb, var(--secondary-50) 72%, #fff);
}

.sales-entry-row .btn {
  width: 100%;
  min-height: 36px;
}

.sales-entry-row.requires-batch .sales-info-button,
.sales-main-panel .sales-line-table tr.requires-batch .sales-info-button {
  border-color: var(--primary-200);
  background: var(--primary-50);
  color: var(--primary-500);
}

.sales-entry-row.stock-warning [data-entry-stock],
.sales-main-panel .sales-line-table tr.stock-warning [data-row-stock] {
  color: var(--danger-500);
  font-weight: 850;
}

.sales-entry-message {
  min-height: 28px;
  padding-top: 8px;
  color: var(--text-muted);
  font-weight: 750;
}

.sales-entry-message.is-error {
  color: var(--danger-500);
}

.sales-entry-message.is-success {
  color: var(--success-500);
}

.sales-info-cell {
  position: relative;
  text-align: center;
}

.sales-batch-info-wrap {
  position: relative;
  display: inline-grid;
  place-items: center;
}

.sales-info-button {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-50);
  color: var(--text-muted);
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.sales-info-button:hover,
.sales-info-button:focus-visible {
  border-color: var(--primary-300);
  color: var(--primary-500);
  outline: 0;
}

.sales-batch-popover {
  position: absolute;
  z-index: 8;
  top: calc(100% + 8px);
  right: 0;
  width: min(320px, 78vw);
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-50);
  box-shadow: 0 18px 42px rgba(17, 24, 39, 0.22);
  text-align: left;
}

.sales-main-panel .sales-line-table tbody tr:nth-last-child(-n + 2) .sales-batch-popover {
  top: auto;
  bottom: calc(100% + 8px);
}

.sales-batch-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 11px;
}

.sales-batch-head strong {
  color: var(--primary-500);
}

.sales-batch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px 82px;
  gap: 8px;
  align-items: center;
  padding: 5px 0;
  border-top: 1px solid var(--line);
  color: var(--text);
  font-size: 11px;
}

.sales-batch-row > span,
.sales-batch-row > strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-batch-row.is-header {
  color: var(--text-muted);
  font-weight: 850;
}

.sales-batch-empty,
.sales-batch-warning {
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 750;
}

.sales-batch-warning {
  margin-top: 8px;
  color: var(--danger-500);
}

.sales-main-panel .sales-line-table th:nth-child(1),
.sales-main-panel .sales-line-table td:nth-child(1) {
  width: 42px;
  min-width: 42px;
}

.sales-main-panel .sales-line-table th:nth-child(2),
.sales-main-panel .sales-line-table td:nth-child(2) {
  width: 320px;
  min-width: 280px;
  white-space: normal;
}

.sales-main-panel .sales-line-table td:nth-child(2) strong {
  overflow-wrap: anywhere;
}

.sales-main-panel .sales-line-table th:nth-child(3),
.sales-main-panel .sales-line-table td:nth-child(3) {
  width: 58px;
  min-width: 58px;
}

.sales-main-panel .sales-line-table th:nth-child(4),
.sales-main-panel .sales-line-table td:nth-child(4) {
  width: 72px;
  min-width: 72px;
}

.sales-main-panel .sales-line-table td:nth-child(4) .control {
  width: 64px;
}

.sales-main-panel .sales-line-table th:nth-child(5),
.sales-main-panel .sales-line-table td:nth-child(5) {
  width: 54px;
  min-width: 54px;
}

.sales-main-panel .sales-line-table th:nth-child(6),
.sales-main-panel .sales-line-table td:nth-child(6) {
  width: 96px;
  min-width: 96px;
}

.sales-main-panel .sales-line-table th:nth-child(7),
.sales-main-panel .sales-line-table td:nth-child(7) {
  width: 92px;
  min-width: 92px;
}

.sales-main-panel .sales-line-table td:nth-child(7) .control {
  width: 84px;
}

.sales-main-panel .sales-line-table th:nth-child(8),
.sales-main-panel .sales-line-table td:nth-child(8) {
  width: 80px;
  min-width: 80px;
}

.sales-main-panel .sales-line-table td:nth-child(8) .input-group {
  width: 76px;
}

.sales-main-panel .sales-line-table td:nth-child(8) .input-group > span {
  padding: 0 6px;
}

.sales-main-panel .sales-line-table th:nth-child(9),
.sales-main-panel .sales-line-table td:nth-child(9) {
  width: 50px;
  min-width: 50px;
}

.sales-main-panel .sales-line-table th:nth-child(10),
.sales-main-panel .sales-line-table td:nth-child(10) {
  width: 96px;
  min-width: 96px;
}

.sales-main-panel .sales-line-table th:nth-child(11),
.sales-main-panel .sales-line-table td:nth-child(11) {
  width: 88px;
  min-width: 88px;
}

.sales-main-panel .sales-line-table td:nth-child(11) .control {
  width: 82px;
}

.sales-main-panel .sales-line-table th:nth-child(12),
.sales-main-panel .sales-line-table td:nth-child(12) {
  width: 98px;
  min-width: 98px;
}

.sales-main-panel .sales-line-table td:nth-child(12) .btn {
  min-height: 32px;
  padding-right: 10px;
  padding-left: 10px;
}

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

.sales-detail-table th,
.sales-detail-table td {
  vertical-align: top;
}

.sales-detail-table th:nth-child(1),
.sales-detail-table td:nth-child(1) {
  width: 54px;
}

.sales-detail-table th:nth-child(2),
.sales-detail-table td:nth-child(2) {
  min-width: 230px;
}

.sales-detail-table th:nth-child(3),
.sales-detail-table td:nth-child(3) {
  min-width: 110px;
  white-space: nowrap;
}

.sales-detail-table th:nth-child(7),
.sales-detail-table td:nth-child(7) {
  min-width: 280px;
  white-space: normal;
}

.sales-detail-table td:nth-child(7) .status-meta {
  display: block;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.sales-detail-table th:nth-child(8),
.sales-detail-table td:nth-child(8) {
  min-width: 130px;
  white-space: nowrap;
}

.sales-detail-table th:nth-child(9),
.sales-detail-table td:nth-child(9) {
  min-width: 170px;
  white-space: nowrap;
}

.sales-detail-table td:nth-child(9) .btn {
  white-space: nowrap;
}

.master-menu-table th:nth-child(1),
.master-menu-table td:nth-child(1) {
  width: 150px;
  min-width: 150px;
}

.master-menu-table th:nth-child(2),
.master-menu-table td:nth-child(2) {
  width: 170px;
  min-width: 170px;
}

.master-menu-table th:nth-child(3),
.master-menu-table td:nth-child(3),
.master-menu-table th:nth-child(4),
.master-menu-table td:nth-child(4),
.master-menu-table th:nth-child(5),
.master-menu-table td:nth-child(5) {
  width: 330px;
  min-width: 330px;
}

.master-menu-table th:nth-child(6),
.master-menu-table td:nth-child(6) {
  width: 150px;
  min-width: 150px;
}

.master-menu-table th:nth-child(7),
.master-menu-table td:nth-child(7) {
  width: 180px;
  min-width: 180px;
}

.master-module-table th:nth-child(1),
.master-module-table td:nth-child(1),
.master-module-table th:nth-child(3),
.master-module-table td:nth-child(3),
.master-module-table th:nth-child(4),
.master-module-table td:nth-child(4) {
  width: 160px;
  min-width: 160px;
}

.master-module-table th:nth-child(2),
.master-module-table td:nth-child(2) {
  width: 220px;
  min-width: 220px;
}

.master-module-table th:nth-child(5),
.master-module-table td:nth-child(5) {
  width: 300px;
  min-width: 300px;
}

.master-module-table th:nth-child(6),
.master-module-table td:nth-child(6) {
  width: 180px;
  min-width: 180px;
}

.master-branch-table th:nth-child(1),
.master-branch-table td:nth-child(1) {
  width: 240px;
  min-width: 240px;
}

.master-branch-table th:nth-child(3),
.master-branch-table td:nth-child(3) {
  width: 300px;
  min-width: 300px;
}

.master-branch-table th:nth-child(2),
.master-branch-table td:nth-child(2) {
  width: 400px;
  min-width: 400px;
}

.master-branch-table th:nth-child(4),
.master-branch-table td:nth-child(4),
.master-branch-table th:nth-child(5),
.master-branch-table td:nth-child(5) {
  width: 150px;
  min-width: 150px;
}

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

.master-warehouse-table th:nth-child(4),
.master-warehouse-table td:nth-child(4) {
  width: 320px;
  min-width: 320px;
}

.master-warehouse-table th:nth-child(3),
.master-warehouse-table td:nth-child(3) {
  width: 300px;
  min-width: 300px;
}

.master-warehouse-table th:nth-child(5),
.master-warehouse-table td:nth-child(5),
.master-warehouse-table th:nth-child(6),
.master-warehouse-table td:nth-child(6) {
  width: 160px;
  min-width: 160px;
}

.master-shift-table th:nth-child(1),
.master-shift-table td:nth-child(1) {
  width: 220px;
  min-width: 220px;
}

.master-shift-table th:nth-child(2),
.master-shift-table td:nth-child(2) {
  width: 430px;
  min-width: 430px;
}

.master-shift-table th:nth-child(3),
.master-shift-table td:nth-child(3) {
  width: 320px;
  min-width: 320px;
}

.master-shift-table th:nth-child(4),
.master-shift-table td:nth-child(4) {
  width: 150px;
  min-width: 150px;
}

.master-shift-table th:nth-child(5),
.master-shift-table td:nth-child(5) {
  width: 210px;
  min-width: 210px;
}

.master-shift-table th:nth-child(6),
.master-shift-table td:nth-child(6) {
  width: 220px;
  min-width: 220px;
}

.master-shift-table td {
  white-space: normal;
}

.master-manufacturer-table th:nth-child(1),
.master-manufacturer-table td:nth-child(1),
.master-unit-table th:nth-child(1),
.master-unit-table td:nth-child(1) {
  width: 72px;
  min-width: 72px;
}

.master-manufacturer-table th:nth-child(2),
.master-manufacturer-table td:nth-child(2) {
  width: 250px;
  min-width: 250px;
}

.master-manufacturer-table th:nth-child(3),
.master-manufacturer-table td:nth-child(3) {
  width: 220px;
  min-width: 220px;
}

.master-manufacturer-table th:nth-child(4),
.master-manufacturer-table td:nth-child(4) {
  width: 340px;
  min-width: 340px;
}

.master-manufacturer-table th:nth-child(5),
.master-manufacturer-table td:nth-child(5),
.master-manufacturer-table th:nth-child(6),
.master-manufacturer-table td:nth-child(6),
.master-manufacturer-table th:nth-child(7),
.master-manufacturer-table td:nth-child(7) {
  width: 130px;
  min-width: 130px;
}

.master-unit-table th:nth-child(2),
.master-unit-table td:nth-child(2) {
  width: 220px;
  min-width: 220px;
}

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

.master-unit-table th:nth-child(4),
.master-unit-table td:nth-child(4) {
  width: 190px;
  min-width: 190px;
}

.master-unit-table th:nth-child(5),
.master-unit-table td:nth-child(5) {
  width: 270px;
  min-width: 270px;
}

.master-unit-table th:nth-child(6),
.master-unit-table td:nth-child(6),
.master-unit-table th:nth-child(7),
.master-unit-table td:nth-child(7) {
  width: 130px;
  min-width: 130px;
}

.master-contact-table th:nth-child(1),
.master-contact-table td:nth-child(1) {
  width: 68px;
  min-width: 68px;
}

.master-contact-table th:nth-child(2),
.master-contact-table td:nth-child(2) {
  width: 220px;
  min-width: 220px;
}

.master-contact-table th:nth-child(3),
.master-contact-table td:nth-child(3) {
  width: 150px;
  min-width: 150px;
}

.master-contact-table th:nth-child(4),
.master-contact-table td:nth-child(4) {
  width: 210px;
  min-width: 210px;
}

.master-contact-table th:nth-child(5),
.master-contact-table td:nth-child(5) {
  width: 210px;
  min-width: 210px;
}

.master-contact-table th:nth-child(6),
.master-contact-table td:nth-child(6) {
  width: 170px;
  min-width: 170px;
}

.master-contact-table th:nth-child(7),
.master-contact-table td:nth-child(7) {
  width: 130px;
  min-width: 130px;
}

.master-contact-table th:nth-child(8),
.master-contact-table td:nth-child(8) {
  width: 120px;
  min-width: 120px;
}

.master-contact-table td {
  vertical-align: top;
}

.master-contact-table td > strong {
  display: block;
  color: var(--text-strong);
}

.shift-code-name-fields,
.shift-time-fields {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.shift-code-name-fields {
  grid-template-columns: minmax(120px, 0.72fr) minmax(180px, 1fr);
}

.shift-time-fields {
  grid-template-columns: repeat(2, minmax(118px, 1fr));
}

.shift-order-control {
  max-width: 112px;
}

.shift-status-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  white-space: nowrap;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.editable-table td {
  vertical-align: top;
  white-space: normal;
}

.editable-table .control {
  min-width: 0;
}

.editable-table td > .control + .control,
.editable-table td > .textarea {
  margin-top: 6px;
}

.editable-table .switch-row,
.editable-table .table-actions {
  white-space: nowrap;
}

.editable-table .table-actions {
  flex-wrap: nowrap;
}

.usage-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.usage-list span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-100);
  color: var(--text-muted);
  font-weight: 700;
  white-space: nowrap;
}

.usage-list strong {
  color: var(--text-strong);
}

.data-table th {
  color: var(--text-muted);
  font-weight: 800;
  background: var(--surface-100);
}

.data-table tr:hover td {
  background: var(--primary-50);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-weight: 750;
}

.badge::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  content: "";
}

.badge-success {
  background: #ecfdf3;
  color: #087443;
}

.badge-success::before {
  background: #12b76a;
}

.badge-warning {
  background: var(--secondary-50);
  color: var(--secondary-400);
}

.badge-warning::before {
  background: var(--secondary-400);
}

.badge-info {
  background: var(--primary-50);
  color: var(--primary-400);
}

.badge-info::before {
  background: var(--primary-400);
}

.badge-danger-soft {
  background: #fff1f0;
  color: #d92d20;
}

.badge-danger-soft::before {
  background: #f04438;
}

.expiry-report-table {
  min-width: 1160px;
}

.product-movement-table {
  min-width: 1240px;
}

.dead-stock-table {
  min-width: 1280px;
}

.movement-progress {
  width: 120px;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--primary-50);
}

.movement-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--secondary-400), var(--primary-400));
}

.expiry-return-dialog {
  width: min(calc(100vw - 28px), 680px);
}

.expiry-return-summary {
  display: grid;
  gap: 5px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--primary-50);
  color: var(--text);
}

.expiry-return-summary strong {
  color: var(--text-strong);
  font-size: 13px;
}

.expiry-return-summary span {
  color: var(--text-muted);
  font-weight: 700;
}

.cash-diff-positive {
  color: #087443;
  font-weight: 800;
}

.cash-diff-negative {
  color: var(--secondary-400);
  font-weight: 800;
}

.pagination-wrap {
  display: flex;
  width: 100%;
  justify-content: center;
  margin-top: 14px;
}

.pagination-wrap nav[role="navigation"] svg,
nav[aria-label="Pagination Navigation"] svg {
  display: inline-block;
  width: 16px;
  height: 16px;
  max-width: 16px;
  max-height: 16px;
  vertical-align: middle;
}

.erp-pagination {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto minmax(180px, 1fr);
  grid-template-areas: "summary pages controls";
  align-items: center;
  width: 100%;
  gap: 10px 14px;
  padding: 10px 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 750;
}

.erp-pagination__summary {
  grid-area: summary;
  min-width: 0;
}

.erp-pagination__pages {
  grid-area: pages;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}

.erp-page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-strong);
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.erp-page:hover {
  border-color: var(--primary-300);
  color: var(--primary-400);
}

.erp-page.is-active {
  border-color: var(--primary-400);
  background: var(--primary-400);
  color: #fff;
}

.erp-page.is-disabled {
  color: var(--text-soft);
  cursor: not-allowed;
  opacity: 0.7;
}

.erp-page--arrow {
  min-width: 112px;
}

.erp-page--edge {
  min-width: 38px;
  padding: 0 8px;
}

.erp-page svg {
  width: 16px;
  height: 16px;
}

.erp-pagination__controls {
  grid-area: controls;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px 12px;
  min-width: 0;
}

.erp-pagination__jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.erp-pagination__jump label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.erp-pagination__jump input {
  width: 68px;
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-strong);
  font: inherit;
}

.erp-pagination__jump button {
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-strong);
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.erp-pagination__jump button:hover {
  border-color: var(--primary-300);
  color: var(--primary-400);
}

.erp-pagination__size {
  display: flex;
  justify-content: flex-end;
}

.erp-pagination__size label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.erp-pagination__size select {
  width: 72px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-strong);
  font: inherit;
}

@media (max-width: 1360px) {
  .erp-pagination {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "summary controls"
      "pages pages";
  }

  .erp-pagination__pages {
    justify-content: center;
  }
}

@media (max-width: 720px) {
  .pagination-wrap {
    justify-content: center;
    overflow-x: auto;
  }

  .erp-pagination {
    grid-template-columns: 1fr;
    grid-template-areas:
      "summary"
      "pages"
      "controls";
  }

  .erp-pagination__summary,
  .erp-pagination__controls,
  .erp-pagination__size {
    justify-content: center;
    text-align: center;
  }

  .erp-pagination__pages {
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 2px;
  }
}

.shift-session-dialog {
  width: min(calc(100vw - 28px), 1060px);
}

.activity-log-dialog {
  width: min(calc(100vw - 28px), 920px);
}

.payment-method-dialog {
  width: min(calc(100vw - 28px), 720px);
}

.log-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 20px;
}

.log-json-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.json-box {
  min-height: 170px;
  max-height: 280px;
  margin: 0;
  padding: 10px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--gray-900);
  color: var(--surface-50);
  font: 11px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.settings-actionbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.settings-form {
  display: grid;
  gap: 12px;
}

.settings-section {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-50);
}

.settings-section summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 14px;
  color: var(--primary-400);
  font-weight: 850;
  list-style: none;
  cursor: pointer;
}

.settings-section summary::-webkit-details-marker {
  display: none;
}

.settings-section summary::after {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-50);
  color: var(--primary-400);
  content: "+";
  font-weight: 900;
  text-align: center;
  line-height: 18px;
}

.settings-section[open] summary {
  border-bottom: 1px solid var(--line);
}

.settings-section[open] summary::after {
  content: "-";
}

.settings-section-body {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.stock-policy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stock-policy-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  align-items: start;
  min-height: 126px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-50);
  cursor: pointer;
}

.stock-policy-option input {
  margin-top: 4px;
  accent-color: var(--primary-400);
}

.stock-policy-option.is-selected,
.stock-policy-option:has(input:checked) {
  border-color: var(--primary-300);
  background: var(--primary-50);
  box-shadow: 0 0 0 3px rgba(47, 107, 225, 0.08);
}

.stock-policy-mark {
  grid-row: span 2;
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--surface-100);
  color: var(--primary-500);
  font-weight: 900;
}

.stock-policy-option strong {
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 900;
}

.stock-policy-option small {
  grid-column: 2;
  color: var(--text-muted);
  font-weight: 700;
  line-height: 1.45;
}

.info-strip {
  padding: 10px 12px;
  border: 1px solid var(--info-200);
  border-radius: var(--radius-sm);
  background: var(--info-50);
  color: var(--text);
  font-weight: 750;
}

.business-profile-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.profile-logo-field {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-width: 150px;
}

.profile-logo-field input {
  display: none;
}

.profile-logo-field small {
  max-width: 180px;
  color: var(--text-muted);
  text-align: center;
  word-break: break-word;
}

.profile-logo-preview {
  display: grid;
  width: 86px;
  height: 86px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--primary-50);
  color: var(--primary-400);
  font-size: 28px;
  font-weight: 900;
}

.settings-location-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.suggestion-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.suggestion-list span {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-100);
  color: var(--text-muted);
  font-weight: 700;
}

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

.receipt-settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  gap: 16px;
  align-items: start;
}

.receipt-preview-column {
  position: sticky;
  top: calc(var(--topbar-height) + 16px);
  display: grid;
  gap: 12px;
  min-width: 0;
}

.receipt-recommendations,
.receipt-preview-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-panel);
}

.receipt-recommendations {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.receipt-recommendations h2,
.receipt-preview-header h2 {
  margin: 0;
  color: var(--primary-400);
  font-size: 14px;
  font-weight: 850;
}

.receipt-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

.receipt-paper-stage {
  display: grid;
  justify-items: center;
  min-height: 520px;
  padding: 16px;
  overflow: auto;
  background:
    linear-gradient(90deg, rgba(0, 111, 248, 0.05), transparent 34%),
    var(--surface-100);
}

.receipt-paper {
  --receipt-paper-width: 368px;
  --receipt-scale: 1;
  --receipt-font-size: 12px;
  --receipt-margin: 4px;
  display: grid;
  gap: 9px;
  width: min(100%, var(--receipt-paper-width));
  padding: calc(var(--receipt-margin) * 3);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-50);
  color: var(--text-strong);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: var(--receipt-font-size);
  line-height: 1.35;
  transform: scale(var(--receipt-scale));
  transform-origin: top center;
  box-shadow: 0 18px 32px rgba(17, 24, 39, 0.14);
}

.receipt-paper[data-spacing="compact"] {
  line-height: 1.2;
}

.receipt-paper[data-spacing="relaxed"] {
  line-height: 1.55;
}

.receipt-paper-header,
.receipt-footer,
.receipt-loyalty {
  display: grid;
  gap: 4px;
  text-align: center;
}

.receipt-paper-header.is-left {
  text-align: left;
}

.receipt-paper-header h3 {
  margin: 0;
  font-family: inherit;
  font-size: 15px;
  font-weight: 900;
}

.receipt-paper-header p,
.receipt-footer p,
.receipt-loyalty p {
  margin: 0;
}

.receipt-logo {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  justify-self: center;
  border-radius: 50%;
  background: var(--primary-400);
  color: var(--surface-50);
  font-weight: 900;
}

.receipt-paper-header.is-left .receipt-logo {
  justify-self: start;
}

.receipt-rule {
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--gray-300), var(--gray-300) 5px, transparent 5px, transparent 9px);
}

.receipt-meta,
.receipt-total {
  display: grid;
  gap: 3px;
}

.receipt-meta div,
.receipt-total div {
  display: grid;
  grid-template-columns: minmax(94px, 0.8fr) minmax(0, 1fr);
  gap: 8px;
}

.receipt-meta span,
.receipt-total span {
  color: var(--text-muted);
}

.receipt-items {
  display: grid;
  gap: 9px;
}

.receipt-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.receipt-item > div {
  display: grid;
  min-width: 0;
}

.receipt-item span,
.receipt-note,
.receipt-footer small {
  color: var(--text-muted);
}

.receipt-grand-total {
  padding-top: 4px;
  border-top: 1px solid var(--gray-300);
  font-size: 15px;
  font-weight: 900;
}

.receipt-barcode {
  justify-self: center;
  width: 170px;
  height: 34px;
  background: repeating-linear-gradient(90deg, var(--text-strong) 0 2px, transparent 2px 5px, var(--text-strong) 5px 7px, transparent 7px 11px);
}

.receipt-qr {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  justify-self: center;
  border: 2px solid var(--text-strong);
  color: var(--text-strong);
  font-weight: 900;
}

.receipt-option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.payment-method-form {
  display: grid;
  gap: 14px;
}

.payment-switch {
  align-self: end;
}

.payment-type-tabs {
  min-height: 40px;
}

.payment-config-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-50);
}

.discount-panel {
  background: linear-gradient(180deg, rgba(0, 111, 248, 0.035), rgba(255, 255, 255, 0.92));
}

.payment-config-heading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.payment-config-heading h3 {
  margin: 0;
  color: var(--primary-400);
  font-size: 14px;
  font-weight: 850;
}

.info-dot {
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: #51b6ad;
  color: var(--surface-50);
  font-weight: 900;
}

.payment-money-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: end;
}

.unit-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, 42px);
  overflow: hidden;
  min-height: 34px;
  border: 1px solid var(--primary-400);
  border-radius: var(--radius);
  background: var(--surface-50);
}

.unit-button {
  border: 0;
  background: var(--surface-50);
  color: var(--primary-400);
  font-weight: 850;
}

.unit-button.is-active {
  background: var(--primary-400);
  color: var(--surface-50);
}

.btn.is-disabled,
.btn:disabled,
.icon-button:disabled {
  pointer-events: none;
  opacity: 0.48;
}

.btn-count {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--primary-50);
  color: var(--primary-400);
  font-size: 11px;
  font-weight: 850;
}

.filter-control {
  width: auto;
  min-width: 136px;
}

.product-table {
  min-width: 1260px;
}

.product-name-cell {
  min-width: 260px;
  white-space: normal;
}

.product-name-cell strong,
.product-name-cell span {
  display: block;
}

.product-name-cell span {
  color: var(--text-muted);
}

.product-name-cell .batch-meta {
  display: inline-flex;
  width: fit-content;
  margin-top: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--primary-50);
  color: var(--primary-400);
  font-weight: 800;
}

.row-action-menu {
  position: relative;
}

.row-action-menu summary {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  list-style: none;
  cursor: pointer;
}

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

.row-action-menu summary::marker {
  content: none;
}

.row-action-menu summary svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.4;
}

.row-action-menu[open] summary,
.row-action-menu summary:hover {
  border-color: var(--line);
  background: var(--surface-100);
  color: var(--primary-400);
}

.row-action-panel {
  position: absolute;
  right: 0;
  z-index: 30;
  display: grid;
  min-width: 170px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-50);
  box-shadow: var(--shadow-soft);
}

.row-action-panel a,
.row-action-panel button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-weight: 750;
  text-align: left;
}

.row-action-panel a:hover,
.row-action-panel button:hover {
  background: var(--primary-50);
  color: var(--primary-400);
}

.row-action-panel button {
  color: var(--secondary-400);
}

.panel:has(.row-action-menu[open]),
.table-wrap:has(.row-action-menu[open]) {
  overflow: visible;
}

.product-condition-panel {
  overflow: hidden;
}

.product-condition-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  padding: 14px;
}

.product-condition-item {
  display: grid;
  gap: 4px;
  min-height: 58px;
  padding: 10px 12px;
  border-right: 1px solid var(--line);
}

.product-condition-item:last-child {
  border-right: 0;
}

.product-condition-item span {
  color: var(--text-muted);
  font-weight: 750;
}

.product-condition-item strong {
  color: var(--text-strong);
  font-weight: 850;
}

.product-page-form {
  gap: 16px;
}

.product-actionbar {
  position: sticky;
  top: calc(var(--topbar-height) + 8px);
  z-index: 20;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-panel);
  backdrop-filter: blur(12px);
}

.product-form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(270px, 320px);
  gap: 16px;
  align-items: start;
}

.product-form-main {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.product-form-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, auto);
  gap: 14px;
  align-items: center;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(0, 111, 248, 0.09), rgba(81, 182, 173, 0.08)),
    var(--surface-50);
  box-shadow: var(--shadow-panel);
}

.product-form-eyebrow {
  color: var(--primary-400);
  font-weight: 850;
  text-transform: uppercase;
}

.product-form-hero h2,
.product-summary-card h3,
.product-guidance-card h3 {
  margin: 0;
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 850;
}

.product-form-hero p,
.product-guidance-card p,
.product-guidance-card li {
  margin: 0;
  color: var(--text-muted);
}

.product-hero-status {
  display: grid;
  gap: 3px;
  min-width: 140px;
  padding: 10px;
  border: 1px solid rgba(0, 111, 248, 0.16);
  border-radius: var(--radius);
  background: var(--surface-50);
}

.product-hero-status span {
  color: var(--text-muted);
  font-weight: 750;
}

.product-hero-status strong {
  color: var(--primary-400);
}

.product-type-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.product-type-card {
  position: relative;
  display: grid;
  gap: 4px;
  min-height: 70px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-50);
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.product-type-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.product-type-card strong {
  color: var(--text-strong);
}

.product-type-card span {
  color: var(--text-muted);
}

.product-type-card.is-selected,
.product-type-card:has(input:checked) {
  border-color: rgba(0, 111, 248, 0.5);
  background: var(--primary-50);
  box-shadow: 0 0 0 3px rgba(0, 111, 248, 0.1);
}

.input-with-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
}

.input-with-button .icon-button {
  width: 38px;
  height: 34px;
}

.product-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.product-mini-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-100);
}

.product-mini-card strong {
  color: var(--text-strong);
}

.product-form-aside {
  position: sticky;
  top: calc(var(--topbar-height) + 86px);
  display: grid;
  gap: 12px;
  min-width: 0;
}

.product-summary-card,
.product-guidance-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-50);
  box-shadow: var(--shadow-panel);
}

.product-summary-row {
  display: grid;
  grid-template-columns: minmax(90px, 0.8fr) minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.product-summary-row span {
  color: var(--text-muted);
}

.product-summary-row strong {
  min-width: 0;
  color: var(--text-strong);
  word-break: break-word;
}

.product-guidance-card ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 16px;
}

.field-hint {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 650;
  white-space: normal;
}

.batch-switch-row {
  align-items: flex-start;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-100);
}

.batch-switch-row span {
  display: grid;
  gap: 2px;
}

.batch-switch-row small {
  color: var(--text-muted);
  font-weight: 650;
}

.batch-expiry-fields,
.stock-batch-grid {
  display: grid;
  gap: 10px;
}

.stock-note {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(0, 111, 248, 0.16);
  border-radius: var(--radius);
  background: var(--primary-50);
}

.stock-note strong {
  color: var(--primary-400);
}

.stock-note span {
  color: var(--text-muted);
  font-weight: 650;
}

.stock-summary-panel {
  overflow: hidden;
}

.stock-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  padding: 14px;
}

.stock-summary-grid > div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 8px 12px;
  border-right: 1px solid var(--line);
}

.stock-summary-grid > div:last-child {
  border-right: 0;
}

.stock-summary-grid span {
  color: var(--text-muted);
  font-weight: 750;
}

.stock-summary-grid strong {
  min-width: 0;
  color: var(--text-strong);
  font-weight: 850;
  word-break: break-word;
}

.stock-card-table {
  min-width: 1380px;
}

.stock-batch-table {
  min-width: 940px;
}

.stock-adjustment-filter {
  margin-bottom: 12px;
}

.stock-adjustment-search {
  min-width: min(100%, 340px);
}

.stock-adjustment-actionbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
}

.stock-adjustment-actionbar__left,
.stock-adjustment-actionbar__right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.stock-adjustment-note {
  min-width: min(100%, 360px);
}

.stock-adjustment-table {
  min-width: 1260px;
}

.stock-adjustment-table tr.is-checking {
  background: #f8fbff;
}

.stock-adjustment-table tr.is-dirty {
  box-shadow: inset 4px 0 0 var(--primary-500);
}

.stock-location,
.stock-product-cell,
.stock-batch-cell,
.last-adjusted-cell,
.stock-system-cell {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.stock-location span,
.stock-product-cell span,
.stock-batch-cell span,
.last-adjusted-cell span,
.stock-location small {
  color: var(--text-muted);
  font-weight: 650;
}

.stock-system-cell small {
  min-height: 16px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 750;
}

.stock-system-cell small[data-mode="dirty"] {
  color: var(--primary-600);
}

.stock-system-cell small[data-mode="changed"] {
  color: #087443;
}

.stock-system-cell small[data-mode="loading"]::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border: 2px solid #bfdbfe;
  border-top-color: var(--primary-500);
  border-radius: 999px;
  vertical-align: -1px;
  animation: stock-adjustment-spin 0.75s linear infinite;
}

.stock-system-cell small[data-mode="error"] {
  color: var(--secondary-400);
}

.stock-product-cell strong {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stock-adjustment-input {
  display: grid;
  grid-template-columns: minmax(88px, 118px) auto;
  align-items: center;
  gap: 7px;
}

.stock-adjustment-input span {
  color: var(--text-muted);
  font-weight: 750;
}

.stock-adjustment-delta {
  font-weight: 850;
}

.stock-adjustment-delta.is-positive {
  color: #087443;
}

.stock-adjustment-delta.is-negative {
  color: var(--secondary-400);
}

.stock-adjustment-footer {
  display: flex;
  justify-content: flex-end;
}

.stock-history-button {
  min-height: 32px;
  margin-top: 6px;
  padding: 6px 10px;
}

.stock-history-dialog {
  width: min(760px, calc(100vw - 28px));
}

.stock-history-heading {
  display: grid;
  gap: 3px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.stock-history-heading span {
  color: var(--text-muted);
  font-weight: 650;
}

.stock-history-list {
  display: grid;
  gap: 10px;
}

.stock-history-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.stock-history-item > div:first-child {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.stock-history-item span,
.stock-history-item small,
.stock-history-item p {
  color: var(--text-muted);
  font-weight: 650;
}

.stock-history-item p {
  margin: 0;
  white-space: pre-line;
}

.stock-history-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.stock-history-grid span {
  display: grid;
  gap: 2px;
  padding: 8px;
  border-radius: 7px;
  background: #fff;
}

@keyframes stock-adjustment-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 760px) {
  .stock-history-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.text-muted {
  color: var(--text-muted);
  font-weight: 650;
}

.stock-operation-layout {
  grid-template-columns: minmax(0, 1fr) minmax(270px, 320px);
  align-items: start;
}

.stock-operation-main {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.stock-operation-aside {
  position: sticky;
  top: calc(var(--topbar-height) + 86px);
  display: grid;
  gap: 12px;
  min-width: 0;
}

.shift-dialog-header {
  justify-content: center;
  position: relative;
}

.shift-dialog-header .dialog-close {
  position: absolute;
  right: 16px;
}

.shift-dialog-body {
  gap: 22px;
}

.shift-session-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}

.shift-summary-column {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.summary-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.summary-row span {
  color: var(--text);
}

.summary-row strong {
  min-width: 0;
  color: var(--text-strong);
  font-weight: 750;
}

.shift-history-action {
  display: flex;
  justify-content: center;
}

.shift-close-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr);
  gap: 24px;
  align-items: start;
}

.shift-close-section {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.shift-close-section h3,
.shift-log-header h3 {
  margin: 0;
  color: var(--primary-400);
  font-size: 14px;
  font-weight: 850;
}

.shift-close-section p {
  margin: 0;
  color: var(--text);
}

.cash-calculation {
  display: grid;
  gap: 6px;
}

.cash-calculation span {
  color: var(--text-strong);
  font-weight: 800;
}

.cash-calculation strong {
  font-weight: 850;
}

.shift-log-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-100);
}

.shift-log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.shift-log-list {
  display: grid;
  gap: 8px;
}

.shift-log-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, auto);
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-50);
}

.shift-log-item > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.shift-log-item strong {
  color: var(--text-strong);
}

.shift-log-item span {
  color: var(--text-muted);
}

.status-list {
  display: grid;
  gap: 10px;
}

.status-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-50);
}

.status-title {
  color: var(--text-strong);
  font-weight: 750;
}

.status-meta {
  color: var(--text-muted);
}

.progress {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-300);
}

.progress-full {
  grid-column: 1 / -1;
}

.progress-bar {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary-400), var(--primary-300));
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: none;
  background: rgba(17, 24, 39, 0.42);
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-section,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .branch-card {
  display: none;
}

body.sidebar-collapsed .sidebar-group {
  justify-items: center;
  width: 44px;
}

body.sidebar-collapsed .sidebar-group:not([open]) {
  display: none;
}

body.sidebar-collapsed .sidebar-group-list .nav-link {
  margin-left: 0;
}

body.sidebar-collapsed .sidebar-brand,
body.sidebar-collapsed .sidebar-nav,
body.sidebar-collapsed .sidebar-footer {
  align-items: center;
}

body.sidebar-collapsed .nav-link {
  justify-content: center;
  width: 44px;
  padding: 0;
}

body.sidebar-collapsed .nav-link.is-active::before {
  left: -6px;
}

@media (max-width: 1180px) {
  .grid-4,
  .report-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pareto-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .auth-feature-list,
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cashier-entry-shell {
    grid-template-columns: minmax(300px, 0.86fr) minmax(390px, 1.14fr);
  }

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

  .receipt-settings-layout {
    grid-template-columns: 1fr;
  }

  .receipt-preview-column {
    position: static;
  }

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

  .product-form-aside,
  .stock-operation-aside {
    position: static;
  }

  .stock-operation-layout {
    grid-template-columns: 1fr;
  }

  .product-type-grid,
  .product-condition-grid,
  .stock-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sales-payment-fields,
  .sales-fee-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-condition-item:nth-child(2) {
    border-right: 0;
  }
}

@media (max-width: 840px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-visual {
    min-height: 280px;
    padding: 24px;
  }

  .auth-panel {
    padding: 14px;
  }

  .auth-feature-list,
  .permission-list {
    grid-template-columns: 1fr;
  }

  .cashier-entry-shell {
    grid-template-columns: 1fr;
  }

  .cashier-entry-aside {
    min-height: 360px;
    gap: 34px;
    padding: 22px;
  }

  .cashier-entry-workspace {
    align-content: start;
    padding: 16px;
  }

  .cashier-shift-card,
  .cashier-skip {
    width: 100%;
  }

  .erp-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .erp-dialog-header,
  .erp-dialog-body,
  .erp-dialog-footer {
    padding-right: 14px;
    padding-left: 14px;
  }

  .role-permission-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .role-permission-type {
    display: none;
  }

  .erp-shell,
  body.sidebar-collapsed .erp-shell {
    display: block;
  }

  .erp-sidebar {
    position: fixed;
    left: 0;
    width: min(var(--sidebar-width), calc(100vw - 42px));
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

  body.sidebar-open .erp-sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .sidebar-overlay {
    display: block;
  }

  body.sidebar-collapsed .brand-text,
  body.sidebar-collapsed .nav-section,
  body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .branch-card {
    display: grid;
  }

  body.sidebar-collapsed .nav-section {
    display: flex;
  }

  body.sidebar-collapsed .sidebar-group {
    justify-items: stretch;
    width: auto;
  }

  body.sidebar-collapsed .sidebar-group:not([open]) {
    display: grid;
  }

  body.sidebar-collapsed .sidebar-group-list .nav-link {
    margin-left: 4px;
  }

  body.sidebar-collapsed .nav-link {
    justify-content: flex-start;
    width: auto;
    padding: 0 10px;
  }

  .topbar {
    padding: 0 14px;
  }

  .content {
    padding: 14px;
  }

  .user-meta {
    display: none;
  }

  .grid-4,
  .grid-3,
  .report-metrics {
    grid-template-columns: 1fr;
  }

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

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

  .toolbar {
    align-items: stretch;
  }

  .toolbar,
  .toolbar-group,
  .settings-actionbar,
  .search-field {
    width: 100%;
  }

  .toolbar-group .btn,
  .toolbar-group .control {
    flex: 1 1 auto;
  }

  .inline-field {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .shift-session-summary,
  .shift-close-grid,
  .log-detail-grid,
  .log-json-grid,
  .payment-money-row {
    grid-template-columns: 1fr;
  }

  .unit-toggle {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .summary-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

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

  .business-profile-top {
    flex-direction: column;
  }

  .profile-logo-field {
    width: 100%;
  }

  .settings-actionbar > .toolbar-group {
    justify-content: stretch;
  }

  .form-grid,
  .form-grid .span-2,
  .form-grid .span-4 {
    grid-template-columns: 1fr;
    grid-column: auto;
  }

  .contact-filter-bar,
  .reference-filter-bar,
  .contact-detail-grid,
  .contact-dialog-form,
  .purchase-header-grid,
  .purchase-footer-panel,
  .purchase-footer-fields,
  .purchase-invoice-totals,
  .purchase-detail-grid,
  .sales-header-grid,
  .sales-workspace,
  .sales-side-panel {
    grid-template-columns: 1fr;
  }

  .contact-dialog-form .span-2 {
    grid-column: auto;
  }

  .purchase-actionbar,
  .sales-actionbar {
    position: static;
  }

  .sales-actionbar {
    grid-template-columns: 1fr;
  }

  .sales-payment-fields,
  .sales-relation-grid,
  .sales-fee-grid {
    grid-template-columns: 1fr;
  }

  .sales-money-field .control {
    max-width: none;
  }

  .sales-total-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .sales-live-total {
    justify-items: start;
  }

  .sales-side-panel {
    position: static;
  }

  .purchase-total-box {
    justify-items: start;
  }

  .contact-dialog-footer .btn {
    flex: 1 1 auto;
  }

  .receipt-option-grid {
    grid-template-columns: 1fr;
  }

  .stock-policy-grid {
    grid-template-columns: 1fr;
  }

  .receipt-paper-stage {
    padding: 12px;
  }

  .filter-control,
  .product-actionbar .btn {
    width: 100%;
  }

  .product-form-hero,
  .product-mini-grid {
    grid-template-columns: 1fr;
  }

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

  .stock-summary-grid > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .stock-summary-grid > div:last-child {
    border-bottom: 0;
  }

  .product-hero-status {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .auth-copy h1 {
    font-size: 18px;
  }

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

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

  .cashier-entry-header {
    align-items: flex-start;
  }

  .cashier-logo-mark {
    width: 36px;
    height: 36px;
  }

  .cashier-logout {
    padding: 0 12px;
  }

  .cashier-entry-aside {
    min-height: auto;
    padding: 16px;
  }

  .cashier-aside-copy h1 {
    font-size: 20px;
  }

  .cashier-shift-card {
    padding: 16px;
  }

  .segmented-tabs {
    grid-template-columns: 1fr;
  }

  .cashier-skip {
    justify-content: flex-start;
  }

  .topbar-title {
    max-width: 150px;
  }

  .page-kicker {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .content {
    gap: 12px;
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding: 10px 14px;
  }

  .status-item {
    grid-template-columns: 1fr;
  }

  .product-type-grid,
  .product-condition-grid {
    grid-template-columns: 1fr;
  }

  .product-condition-item {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .product-condition-item:last-child {
    border-bottom: 0;
  }

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

@media print {
  body {
    background: var(--surface-50);
  }

  .erp-sidebar,
  .topbar,
  .settings-actionbar,
  .receipt-recommendations,
  .receipt-settings-layout > .panel {
    display: none !important;
  }

  .erp-shell,
  .erp-main,
  .content,
  .receipt-settings-layout,
  .receipt-preview-column,
  .receipt-preview-panel,
  .receipt-paper-stage {
    display: block;
    width: auto;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: var(--surface-50);
  }

  .receipt-preview-header {
    display: none;
  }

  .receipt-paper {
    transform: none;
    box-shadow: none;
  }
}
