:root {
  --bg: #f5f7f8;
  --panel: #ffffff;
  --panel-soft: #f9fafb;
  --ink: #20252b;
  --muted: #606a76;
  --muted-strong: #46515e;
  --line: #dde2e7;
  --line-strong: #cbd2d9;
  --nav: #030d1f;
  --nav-soft: #111d2d;
  --brand: #2563b8;
  --brand-strong: #1d4f94;
  --accent: #8a5a16;
  --ok: #287a52;
  --warn: #b66a14;
  --bad: #b54747;
  --info: #2563b8;
  --focus: #2563eb;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(25, 36, 48, 0.05);
  --shadow-md: 0 14px 34px rgba(25, 36, 48, 0.13);
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
}

body.drawer-open {
  overflow: hidden;
}

body.drawer-open .sidebar,
body.drawer-open .app {
  display: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
input,
select,
textarea,
.clickable-cell {
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

button {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: #fff;
  padding: 8px 14px;
  font-weight: 650;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

button:hover { background: var(--brand-strong); }
button:active { transform: translateY(1px); }
button.ghost {
  border-color: var(--line-strong);
  background: #fff;
  color: var(--ink);
}
button.ghost:hover { background: #f3f4f6; }
button.small {
  min-height: 32px;
  padding: 5px 9px;
  font-size: 12px;
}
button.warn { background: var(--warn); }
button.warn:hover { background: #92400e; }
button.bad { background: var(--bad); }
button.bad:hover { background: #991b1b; }

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
  outline: 0;
}

select {
  padding-right: 28px;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #9ca3af;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible,
.clickable-cell:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

a {
  color: var(--brand);
  text-decoration: none;
}
a:hover { text-decoration: underline; }
.receipt-link {
  display: inline-flex;
  align-items: center;
  max-width: 180px;
  min-height: 30px;
  overflow-wrap: anywhere;
  white-space: normal;
  line-height: 1.3;
}
.receipt-state {
  display: inline-flex;
  align-items: center;
  width: max-content;
  margin-right: 6px;
  margin-bottom: 4px;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 12px;
  white-space: nowrap;
}
.receipt-state.uploaded { background: #e5f6ef; color: var(--ok); }
.receipt-state.missing { background: #fdeaea; color: var(--bad); }
.receipt-state.unavailable { background: #fdeaea; color: var(--bad); }
.receipt-unavailable {
  display: grid;
  min-width: 0;
  gap: 3px;
}
.receipt-unavailable small {
  color: var(--muted-strong);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.receipt-recheck {
  justify-self: start;
  min-height: 26px;
  padding: 1px 0;
  font-size: 11px;
}
.receipt-thumbnail {
  display: grid;
  width: 112px;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 5px;
  color: var(--brand);
  font-size: 12px;
  text-align: center;
}
.receipt-thumbnail:hover {
  border-color: var(--brand);
  background: var(--panel-soft);
}
.receipt-thumbnail img {
  display: block;
  width: 100%;
  height: 72px;
  border-radius: 4px;
  object-fit: contain;
  background: #f3f4f6;
}
.receipt-preview {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 24, 39, 0.76);
}
.receipt-preview.hidden { display: none; }
.receipt-preview-panel {
  display: grid;
  width: min(1080px, 96vw);
  max-height: 94vh;
  gap: 12px;
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  box-shadow: var(--shadow-md);
}
.receipt-preview-head {
  display: flex;
  min-width: 0;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.receipt-preview-head strong {
  min-width: 0;
  overflow-wrap: anywhere;
}
.receipt-preview-image {
  display: block;
  max-width: 100%;
  max-height: calc(94vh - 126px);
  margin: 0 auto;
  object-fit: contain;
}
.receipt-preview-actions {
  display: flex;
  justify-content: flex-end;
}
.receipt-preview-open-link {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 8px 12px;
  background: #fff;
  font-weight: 700;
}
body.receipt-preview-open { overflow: hidden; }
.password-change-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 24, 39, 0.76);
}
.password-change-panel {
  display: grid;
  width: min(480px, 100%);
  max-height: min(620px, calc(100dvh - 40px));
  gap: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 22px;
  box-shadow: var(--shadow-md);
}
.password-change-panel h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.35;
}
.password-change-panel > p {
  margin: 0;
  color: var(--muted-strong);
}
.password-gate-state {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
}
.password-gate-state span { color: var(--muted-strong); }
.password-gate-state.pending { border-color: #f3d2a2; background: #fff8ed; }
.password-gate-state.blocked { border-color: #b8d6f6; background: #f0f7ff; }
.password-change-form { margin-top: 2px; }
.check-label {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 9px;
  color: var(--muted-strong);
}
.check-label input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--brand);
}
body.password-change-required { overflow: hidden; }
.file-feedback {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.file-feedback.selected {
  color: var(--ok);
}
.file-picker input[type="file"] {
  min-height: 42px;
  padding: 9px 10px;
  cursor: pointer;
}
.file-picker input[type="file"]::file-selector-button {
  min-height: 30px;
  margin-right: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-weight: 720;
  cursor: pointer;
}
.file-picker {
  display: grid;
  min-width: 0;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.file-picker > label { color: var(--muted-strong); cursor: pointer; }
.file-picker-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; min-width: 0; }
.file-picker-control input[type="file"] { pointer-events: auto; touch-action: manipulation; }
.file-picker-control .file-clear { min-width: 56px; min-height: 42px; }
.text-link {
  min-height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--brand);
  padding: 0;
  box-shadow: none;
  font-weight: 760;
  text-align: left;
}
.text-link:hover {
  background: transparent;
  color: var(--brand-strong);
  text-decoration: underline;
}

.skip-link {
  position: fixed;
  left: 14px;
  top: 10px;
  z-index: 30;
  transform: translateY(-140%);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 8px 12px;
  box-shadow: var(--shadow-md);
}
.skip-link:focus { transform: translateY(0); }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 244px;
  padding: 18px 14px;
  overflow-y: auto;
  background: var(--nav);
  color: #fff;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px;
  margin-bottom: 18px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f59e0b;
  color: #111827;
  font-weight: 850;
  letter-spacing: 0;
}

.brand strong {
  display: block;
  font-size: 15px;
  line-height: 1.2;
}
.brand span {
  display: block;
  margin-top: 3px;
  color: #a7b0be;
  font-size: 12px;
}

.nav {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border: 1px solid transparent;
  background: transparent;
  color: #d1d5db;
  margin: 3px 0;
  padding: 10px 12px;
  text-align: left;
  box-shadow: none;
}
.nav.active {
  border-color: rgba(255, 255, 255, 0.08);
  background: var(--nav-soft);
  color: #fff;
}
.nav:hover { background: #263244; color: #fff; }
.nav-group {
  margin-top: 3px;
}
.nav-sub {
  min-height: 36px;
  margin: 2px 0 2px 12px;
  width: calc(100% - 12px);
  padding: 7px 10px 7px 18px;
  color: #a7b0be;
  font-size: 13px;
}
.nav-sub::before {
  content: "";
  width: 5px;
  height: 5px;
  margin-right: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.72;
}
.nav-sub.active {
  border-color: rgba(20, 184, 166, 0.28);
  background: rgba(15, 118, 110, 0.24);
  color: #fff;
}

.app {
  margin-left: 244px;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  padding: 22px 28px 16px;
  background: rgba(246, 247, 249, 0.96);
  border-bottom: 1px solid var(--line);
}
.topbar h1 {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
  font-weight: 760;
  line-height: 1.2;
}
.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}
.runtime-environment {
  display: flex;
  width: fit-content;
  max-width: min(720px, 100%);
  align-items: baseline;
  flex-wrap: wrap;
  gap: 5px 8px;
  margin-top: 9px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--muted-strong);
  border-radius: 6px;
  background: var(--panel);
  padding: 6px 9px;
  color: var(--muted-strong);
  font-size: 12px;
  line-height: 1.4;
}
.runtime-environment strong { color: var(--ink); }
.runtime-environment.local_demo { border-left-color: var(--brand); background: #f0fdfa; }
.runtime-environment.business_transition_dev { border-left-color: var(--info); background: #eff6ff; }
.runtime-environment.online_test,
.runtime-environment.production { border-color: #efb6b6; border-left-color: var(--bad); background: #fff5f5; }
.runtime-environment.online_test strong,
.runtime-environment.production strong { color: #991b1b; }

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-start;
}
.actions-toggle {
  display: none;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 8px 12px;
  font-weight: 760;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  list-style: none;
}
.actions-toggle::-webkit-details-marker {
  display: none;
}
.actions-toggle::after {
  content: "⌄";
  margin-left: 8px;
  font-size: 13px;
}
.actions[open] .actions-toggle::after {
  content: "⌃";
}
.role-box {
  display: grid;
  gap: 5px;
  min-width: 280px;
  max-width: 420px;
}
.role-box span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
#roleHint {
  display: grid;
  gap: 4px;
}
.login-state {
  width: fit-content;
  border-radius: 999px;
  padding: 2px 8px;
  font-weight: 760;
}
.login-state.online {
  color: #047857;
  background: #d1fae5;
}
.login-state.offline {
  color: #b45309;
  background: #fef3c7;
}
.db-profile {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  min-height: 22px;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  overflow-wrap: anywhere;
  color: var(--muted-strong);
  background: #eef2f7;
}
.db-profile.temp {
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
}
.db-profile.demo {
  color: var(--ok);
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
}

.view {
  display: none;
  padding: 20px 28px 36px;
}
.view.active { display: block; }

.grid {
  display: grid;
  gap: 14px;
}
.kpis { grid-template-columns: repeat(5, minmax(150px, 1fr)); }
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three { grid-template-columns: repeat(3, minmax(210px, 1fr)); }

.card {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.card h3 {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.3;
}
.card p {
  margin: 7px 0;
  color: var(--muted-strong);
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.metric-value {
  margin-top: 7px;
  color: var(--ink);
  font-size: 24px;
  font-weight: 820;
  line-height: 1.15;
}
.metric-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 0 10px;
}
.section-title h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 760;
  line-height: 1.25;
}
.section-hint {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.dashboard-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}
.segmented .active {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}
.dashboard-custom-range {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.dashboard-custom-range label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.dashboard-custom-range input {
  width: 138px;
  height: 36px;
}
.range-chip {
  display: inline-grid;
  gap: 1px;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  color: var(--info);
  background: #eff6ff;
  font-size: 12px;
  line-height: 1.35;
}
.range-chip strong { font-weight: 760; }
.range-chip span { color: #315a9b; }
.dashboard-scope-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: -2px 0 14px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted-strong);
  font-size: 12px;
}
.dashboard-scope-note strong {
  color: var(--ink);
  white-space: nowrap;
}

.dashboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.dashboard-metric {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 112px;
  align-content: start;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  padding: 14px;
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow-sm);
}
button.dashboard-metric { cursor: pointer; }
button.dashboard-metric:hover { border-color: var(--brand); background: var(--panel-soft); }
.dashboard-metric > span,
.dashboard-metric small { color: var(--muted); font-size: 12px; font-weight: 650; line-height: 1.4; }
.dashboard-metric strong { color: var(--ink); font-size: 22px; line-height: 1.1; letter-spacing: 0; }
.dashboard-metric [data-lucide] { position: absolute; right: 12px; top: 12px; width: 15px; color: var(--brand); }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.dashboard-grid-primary { grid-template-columns: minmax(0, 1.35fr) minmax(340px, .9fr); }
.dashboard-panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--panel); padding: 16px; box-shadow: var(--shadow-sm); }
.dashboard-panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.dashboard-panel-heading h2 { margin: 0; color: var(--ink); font-size: 15px; line-height: 1.35; }
.dashboard-panel-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.dashboard-trend { display: flex; min-height: 190px; align-items: end; gap: 5px; overflow-x: auto; padding: 8px 2px 0; }
.dashboard-trend-point { display: grid; flex: 1 0 26px; min-width: 26px; height: 178px; grid-template-rows: 1fr auto; align-items: end; gap: 7px; border: 0; background: transparent; padding: 0; color: var(--muted); cursor: pointer; }
.dashboard-trend-point:hover i, .dashboard-trend-point:focus-visible i { background: var(--brand-strong); }
.dashboard-trend-point i { display: block; width: 100%; height: var(--trend-height); min-height: 2px; border-radius: 3px 3px 0 0; background: var(--brand); }
.dashboard-trend-point span { overflow: hidden; max-width: 100%; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-ranking, .dashboard-low-stock, .dashboard-state-list { display: grid; gap: 7px; }
.dashboard-ranking button, .dashboard-low-stock button, .dashboard-fact-list button, .dashboard-state-list button, .dashboard-structure-list section > button { display: grid; width: 100%; min-width: 0; align-items: center; border: 0; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.dashboard-ranking button { grid-template-columns: 23px minmax(0, 1fr) auto; gap: 9px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.dashboard-ranking button:last-child { border-bottom: 0; }
.dashboard-ranking em { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 50%; background: var(--panel-soft); color: var(--muted-strong); font-size: 11px; font-style: normal; font-weight: 750; }
.dashboard-ranking span, .dashboard-low-stock span { display: grid; min-width: 0; gap: 2px; }
.dashboard-ranking small, .dashboard-low-stock small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-ranking b, .dashboard-low-stock b { color: var(--ink); font-size: 12px; white-space: nowrap; }
.dashboard-structure-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.dashboard-structure-list section { min-width: 0; }
.dashboard-structure-list h3 { margin: 0 0 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.dashboard-structure-list section > button { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 5px 0; color: var(--muted-strong); font-size: 12px; }
.dashboard-structure-list span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-structure-list strong { color: var(--ink); font-size: 12px; }
.dashboard-fact-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.dashboard-fact-list button { gap: 3px; min-height: 58px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; }
.dashboard-fact-list button:hover, .dashboard-state-list button:hover, .dashboard-low-stock button:hover, .dashboard-structure-list button:hover { color: var(--brand-strong); }
.dashboard-fact-list span { color: var(--muted); font-size: 12px; }
.dashboard-fact-list strong { color: var(--ink); font-size: 17px; }
.dashboard-state-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dashboard-state-list button { grid-template-columns: minmax(0, 1fr) auto; gap: 6px; min-height: 34px; border-bottom: 1px solid var(--line); padding: 5px 0; }
.dashboard-state-list strong { font-size: 12px; white-space: nowrap; }
.dashboard-low-stock button { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.dashboard-low-stock button:last-child { border-bottom: 0; }

@media (max-width: 1180px) {
  .dashboard-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-grid-primary { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .dashboard-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .dashboard-metric { min-height: 98px; padding: 12px; }
  .dashboard-metric strong { font-size: 19px; }
  .dashboard-grid { grid-template-columns: 1fr; gap: 10px; margin-top: 10px; }
  .dashboard-panel { padding: 13px; }
  .dashboard-structure-list { grid-template-columns: 1fr; gap: 10px; }
  .dashboard-state-list { grid-template-columns: 1fr; }
  .dashboard-trend { min-height: 158px; }
  .dashboard-trend-point { height: 145px; flex-basis: 23px; min-width: 23px; }
}

/* Homepage: faithful desktop workbench geometry from the approved reference. */
@media (min-width: 1200px) {
  #homeView .admin-mobile-hero,
  #homeView .sales-workbench-hero { display: none; }
  body.home-workbench-reference .topbar {
    grid-template-columns: minmax(320px, 1fr) auto;
    grid-template-areas:
      "page-title workspace"
      "daily-tip page-actions";
    gap: 12px 20px;
    padding: 18px 26px 16px;
  }
  body.home-workbench-reference .page-header { grid-area: page-title; }
  body.home-workbench-reference .page-header h1 {
    font-size: 25px;
    letter-spacing: 0;
  }
  body.home-workbench-reference .page-header p {
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
  }
  body.home-workbench-reference .header-workspace { grid-area: workspace; }
  body.home-workbench-reference .page-actions {
    grid-area: page-actions;
    align-self: center;
  }
  body.home-workbench-reference .home-admin-tip {
    grid-area: daily-tip;
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
    color: var(--muted-strong);
    font-size: 12px;
  }
  body.home-workbench-reference .home-admin-tip.hidden { display: none; }
  body.home-workbench-reference .home-admin-tip [data-lucide] {
    width: 15px;
    height: 15px;
    color: #d99000;
  }
  body.home-workbench-reference .user-identity-bar {
    border-color: transparent;
    background: transparent;
  }
  #homeView.view {
    padding: 14px 26px 32px;
  }
  #homeView .role-workbench-hero {
    margin: 0 0 20px;
    padding: 0;
  }
  #homeView .role-workbench-hero h2 {
    margin-bottom: 4px;
    font-size: 25px;
  }
  #homeView .role-workbench-hero p {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
  }
  #homeView .admin-reference-performance {
    display: grid;
    grid-template-columns: minmax(190px, 1.22fr) minmax(190px, 1.22fr) repeat(4, minmax(108px, .66fr));
    min-height: 145px;
    align-items: stretch;
    gap: 0;
    margin: 0 0 20px;
    padding: 16px;
  }
  #homeView .admin-reference-performance > article {
    min-width: 0;
    border-left: 1px solid var(--line);
    padding: 0 16px;
  }
  #homeView .admin-reference-performance > article:first-child {
    border-left: 0;
    padding-left: 2px;
  }
  #homeView .admin-reference-performance > article:last-child { padding-right: 2px; }
  #homeView .admin-reference-meter,
  #homeView .admin-reference-fact {
    display: grid;
    align-content: center;
  }
  #homeView .admin-reference-meter > span,
  #homeView .admin-reference-fact > span {
    color: var(--muted-strong);
    font-size: 12px;
  }
  #homeView .admin-reference-meter strong,
  #homeView .admin-reference-fact strong {
    margin-top: 8px;
    color: var(--ink);
    font-size: 21px;
    line-height: 1.1;
    white-space: nowrap;
  }
  #homeView .admin-reference-meter strong small,
  #homeView .admin-reference-fact strong small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
  }
  #homeView .admin-reference-meter b {
    margin-top: 4px;
    color: var(--ink);
    font-size: 22px;
    line-height: 1;
  }
  #homeView .admin-reference-meter .progress-track {
    height: 6px;
    margin: 10px 0 7px;
  }
  #homeView .admin-reference-meter.is-coverage .progress-track span { background: var(--success); }
  #homeView .admin-reference-meter > small,
  #homeView .admin-reference-fact > small {
    margin-top: 8px;
    overflow: hidden;
    color: var(--muted);
    font-size: 10.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #homeView .admin-reference-warning {
    margin-top: 9px;
    color: var(--warn);
    font-size: 11px;
    font-weight: 650;
  }
  #homeView .admin-workbench-primary,
  #homeView .admin-workbench-secondary {
    grid-template-columns: minmax(0, 64fr) minmax(290px, 36fr);
    align-items: start;
    gap: 16px;
    margin-bottom: 20px;
  }
  #homeView .admin-workbench-primary > *,
  #homeView .admin-workbench-secondary > * {
    align-self: start;
    height: auto;
    min-height: 0;
  }
  #homeView .role-workbench-priority,
  #homeView .admin-operating-summary,
  #homeView .admin-management-reminders,
  #homeView .admin-reference-quick {
    padding: 16px;
  }
  #homeView .admin-workbench-primary .section-title,
  #homeView .admin-management-reminders > .section-title {
    margin-bottom: 8px;
  }
  #homeView .admin-workbench-primary .section-title h2,
  #homeView .admin-management-reminders > .section-title h2 {
    font-size: 16px;
  }
  #homeView .admin-workbench-primary .section-hint,
  #homeView .admin-management-reminders > .section-title .section-hint {
    margin-top: 4px;
    font-size: 11px;
  }
  #homeView .admin-workbench-primary .role-action-row {
    min-height: 58px;
    grid-template-columns: 24px 30px minmax(0, 1fr) auto auto;
    gap: 8px;
    padding: 4px 2px;
  }
  #homeView .admin-workbench-primary .role-action-icon {
    width: 30px;
    height: 30px;
  }
  #homeView .admin-workbench-primary .role-action-copy h3 {
    font-size: 13px;
  }
  #homeView .admin-workbench-primary .role-action-copy p,
  #homeView .admin-workbench-primary .role-action-copy span {
    margin-top: 2px;
    font-size: 10.5px;
    line-height: 1.2;
  }
  #homeView .admin-workbench-primary .role-action-count {
    font-size: 17px;
  }
  #homeView .admin-operating-summary {
    display: block;
    background: var(--panel);
  }
  #homeView .admin-operating-summary dl {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    margin: 0 0 8px;
  }
  #homeView .admin-operating-summary dl > div {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    min-height: 66px;
    align-items: center;
    gap: 10px;
    border-top: 1px solid var(--line);
    padding: 8px 0;
  }
  #homeView .admin-operating-summary dl > div:first-child {
    border-top: 0;
  }
  #homeView .admin-operating-summary dt {
    white-space: nowrap;
    font-size: 10px;
  }
  #homeView .admin-operating-summary dd {
    margin: 4px 0 0;
    white-space: nowrap;
    font-size: 18px;
  }
  #homeView .admin-summary-icon {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 50%;
    background: #edf4ff;
    color: var(--brand);
  }
  #homeView .admin-summary-icon.is-payment { background: #edf8f2; color: var(--success); }
  #homeView .admin-summary-icon.is-customer { background: #fff4e8; color: var(--warn); }
  #homeView .admin-summary-icon [data-lucide] { width: 17px; height: 17px; }
  #homeView .admin-operating-summary .section-title {
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
  }
  #homeView .admin-operating-summary .text-button {
    min-height: 28px;
  }
  #homeView .admin-management-reminders {
    margin: 0;
  }
  #homeView .admin-reminder-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    border-top: 1px solid var(--line);
  }
  #homeView .admin-reminder-group {
    min-width: 0;
    padding: 12px 16px 2px 0;
  }
  #homeView .admin-reminder-group + .admin-reminder-group {
    border-left: 1px solid var(--line);
    padding-right: 0;
    padding-left: 16px;
  }
  #homeView .admin-reminder-heading {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
  }
  #homeView .admin-reminder-heading strong {
    font-size: 13px;
  }
  #homeView .admin-reminder-heading span {
    color: var(--muted);
    font-size: 10px;
  }
  #homeView .admin-reminder-group .role-action-row {
    min-height: 60px;
    grid-template-columns: 30px minmax(0, 1fr) auto auto;
    gap: 8px;
    padding: 4px 2px;
  }
  #homeView .admin-reminder-group .role-action-copy p,
  #homeView .admin-reminder-group .role-action-copy span {
    font-size: 10.5px;
    line-height: 1.2;
  }
  #homeView .admin-reminder-group .role-action-index {
    display: none;
  }
  #homeView .admin-reminder-group .role-action-icon {
    width: 30px;
    height: 30px;
  }
  #homeView .admin-reminder-group .role-action-count {
    font-size: 17px;
  }
  #homeView .admin-reference-quick {
    min-height: 164px;
  }
  #homeView .admin-reference-quick-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
  }
  #homeView .admin-reference-quick-grid button {
    display: grid;
    min-width: 0;
    min-height: 82px;
    place-items: center;
    gap: 7px;
    border: 0;
    background: transparent;
    color: var(--muted-strong);
    padding: 4px;
    box-shadow: none;
  }
  #homeView .admin-reference-quick-grid button:hover { color: var(--brand); }
  #homeView .admin-reference-quick-grid button > span {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
  }
  #homeView .admin-reference-quick-grid button [data-lucide] { width: 18px; height: 18px; }
  #homeView .admin-reference-quick-grid small {
    overflow: hidden;
    font-size: 10.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (min-width: 1600px) {
  #homeView .admin-workbench-primary,
  #homeView .admin-workbench-secondary { gap: 18px; }
}

@media (max-width: 1199px) {
  body.home-workbench-reference .topbar .page-header,
  body.home-workbench-reference .topbar .home-admin-tip { display: none; }
  #homeView .admin-workbench-primary,
  #homeView .admin-workbench-secondary { align-items: start; }
  #homeView .admin-workbench-primary > *,
  #homeView .admin-workbench-secondary > * {
    align-self: start;
    height: auto;
    min-height: 0;
  }
  #homeView .admin-reference-performance {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
  }
  #homeView .admin-reference-performance > article {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 12px;
  }
  #homeView .admin-reference-meter .progress-track { margin: 8px 0; }
  #homeView .admin-workbench-secondary { grid-template-columns: 1fr; }
  #homeView .admin-reminder-grid {
    display: grid;
    gap: 16px;
  }
  #homeView .admin-reminder-group + .admin-reminder-group {
    padding-top: 16px;
    border-top: 1px solid var(--line);
  }
  #homeView .admin-reference-quick-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
  }
  #homeView .admin-reference-quick-grid button {
    display: grid;
    min-width: 0;
    min-height: 64px;
    place-items: center;
    border: 0;
    background: transparent;
    padding: 4px;
    box-shadow: none;
  }
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.toolbar input { width: min(320px, 100%); }
.toolbar select { width: auto; min-width: 150px; }
.toolbar select.advanced-filter {
  border-style: dashed;
  background: #fffaf0;
}
.toolbar .scope-select {
  min-width: 180px;
  border-color: #99f6e4;
  background: #f0fdfa;
  font-weight: 650;
}
.compact-toolbar {
  align-items: flex-end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}
.compact-toolbar > input {
  flex: 1 1 260px;
  max-width: 320px;
}
.compact-toolbar select {
  flex: 0 0 132px;
  width: 132px;
  min-width: 0;
}
.compact-toolbar input,
.compact-toolbar select {
  height: 40px;
  min-height: 40px;
}
.order-filter-toolbar {
  align-items: flex-start;
}
.order-filter-toolbar > .scope-select,
.order-filter-toolbar > input,
.order-filter-toolbar > select {
  margin-top: 0;
}
.filter-panel {
  flex: 1 1 100%;
  min-width: 0;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.filter-panel summary {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.filter-panel summary:hover {
  background: #f3f4f6;
}
.filter-panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.filter-panel-grid input,
.filter-panel-grid select {
  width: 100%;
}
.inline-filter {
  display: flex;
  flex: 0 0 128px;
  flex-direction: column;
  gap: 4px;
  margin: 0;
}
.inline-filter input {
  width: 100%;
}
.inline-filter span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.table-wrap {
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 860px;
}
th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}
th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f9fafb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}
tbody tr:last-child td { border-bottom: 0; }
tr:hover td { background: #fbfcfd; }
.payments-table table { min-width: 1420px; }
.payments-table td:nth-child(7) {
  min-width: 190px;
  max-width: 220px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.payments-table td:nth-child(8) {
  min-width: 180px;
  max-width: 260px;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}
.orders-table table { min-width: 1460px; }
.payments-card-list { display: none; }
.orders-card-list { display: none; }
.customers-card-list { display: none; }
.settings-user-cards { display: none; }
.customers-table table { min-width: 1120px; }
.customers-priority-table th:nth-child(1) { width: 260px; }
.customers-priority-table th:nth-child(2) { width: 130px; }
.customers-priority-table th:nth-child(3) { width: 140px; }
.customers-priority-table th:nth-child(4) { width: 120px; }
.customers-priority-table th:nth-child(5) { width: 150px; }
.customers-priority-table th:nth-child(6) { width: 230px; }
.customers-priority-table th:nth-child(7) { width: 104px; }
.customer-list-identity,
.customer-owner-cell,
.customer-value-cell,
.customer-date-cell,
.customer-next-cell {
  display: grid;
  min-width: 0;
  gap: 2px;
}
.customer-list-identity .text-link {
  width: fit-content;
  min-height: 28px;
  padding: 0;
  font-size: 14px;
  font-weight: 740;
}
.customer-list-identity strong { color: var(--muted-strong); font-size: 12px; font-weight: 650; }
.customer-list-identity span,
.customer-list-identity small,
.customer-owner-cell span,
.customer-value-cell span,
.customer-date-cell span,
.customer-next-cell span { color: var(--muted); font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; }
.customer-list-identity small { margin-top: 2px; }
.customer-value-cell strong { color: var(--ink); font-size: 14px; font-variant-numeric: tabular-nums; }
.customer-next-cell strong { max-width: 30ch; overflow-wrap: anywhere; font-size: 12px; font-weight: 680; white-space: normal; }
.customer-risk-summary { display: flex; min-width: 0; flex-wrap: wrap; gap: 5px 10px; }
.customer-risk-summary > span { position: relative; color: var(--muted-strong); font-size: 12px; font-weight: 650; white-space: nowrap; }
.customer-risk-summary > span + span::before { content: "·"; position: absolute; left: -7px; color: var(--line-strong); }
.customer-risk-summary .is-risk { color: var(--bad); }
.customer-risk-summary .is-positive { color: var(--ok); }
.customer-risk-summary.is-compact { display: inline-flex; }
.row-actions .row-action-danger { margin-top: 4px; border-top: 1px solid var(--line); padding-top: 4px; }
.row-actions .row-action-danger button { color: var(--bad); }
.row-actions .row-action-danger button:hover { background: #fff5f5; }
.settings-product-table table { min-width: 940px; }
.settings-audit-table table { min-width: 980px; }
.reconciliation-difference-table table { min-width: 1120px; }
.reconciliation-difference-cards { display: none; }
.reconciliation-title { align-items: flex-start; }
.title-with-badge {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.title-with-badge h2 { margin: 0; }
.reconciliation-protection {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--info);
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a5f;
  font-size: 13px;
  line-height: 1.55;
}
.reconciliation-protection strong { color: #1d4ed8; white-space: nowrap; }
.reconciliation-toolbar { align-items: center; }
.reconciliation-toolbar select { min-width: 148px; }
.reconciliation-toolbar input { min-width: 220px; }
.reconciliation-summary { margin-bottom: 16px; }
.reconciliation-period-section,
.reconciliation-difference-section { margin-top: 20px; }
.reconciliation-period-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.reconciliation-period-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.reconciliation-period-card.active { border-color: var(--brand); box-shadow: 0 0 0 1px rgba(13, 148, 136, .16); }
.reconciliation-period-card > div:first-child { min-width: 0; display: grid; gap: 3px; }
.reconciliation-period-card > div:first-child span { color: var(--muted); font-size: 12px; }
.reconciliation-period-card dl,
.reconciliation-difference-card dl,
.reconciliation-detail-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}
.reconciliation-period-card dl div,
.reconciliation-difference-card dl div,
.reconciliation-detail-grid > div {
  min-width: 0;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.reconciliation-period-card dt,
.reconciliation-difference-card dt,
.reconciliation-detail-grid dt { color: var(--muted); font-size: 11px; }
.reconciliation-period-card dd,
.reconciliation-difference-card dd,
.reconciliation-detail-grid dd { margin: 3px 0 0; overflow-wrap: anywhere; font-size: 12px; }
.reconciliation-detail { display: grid; gap: 18px; }
.reconciliation-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.reconciliation-comparison,
.reconciliation-approval { display: grid; gap: 10px; }
.reconciliation-comparison h3,
.reconciliation-approval h3 { margin: 0; font-size: 15px; }
.reconciliation-comparison > div { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.reconciliation-comparison article {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}
.reconciliation-comparison article strong { color: var(--brand); }
.reconciliation-comparison article span { overflow-wrap: anywhere; white-space: pre-wrap; font-size: 13px; }
.reconciliation-trace { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.reconciliation-trace li { padding: 10px 12px; border-left: 3px solid var(--brand); background: var(--panel-soft); }
.reconciliation-trace strong,
.reconciliation-trace span { display: block; }
.reconciliation-trace span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.reconciliation-trace p { margin: 6px 0 0; overflow-wrap: anywhere; }
.compact-empty { padding: 14px; min-height: auto; }
.order-detail-table table { min-width: 680px; }
.order-payments-table table { min-width: 1120px; }
.order-payments-table td:nth-child(8) {
  min-width: 180px;
  max-width: 220px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.order-payments-table td:nth-child(9) {
  min-width: 160px;
  max-width: 240px;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}
.order-log-table table { min-width: 920px; }
.exception-request-table table { min-width: 1240px; }

@media (max-width: 860px) {
  .payments-table {
    display: none;
  }
  .payments-card-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .payment-card {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 12px;
    box-shadow: var(--shadow-sm);
  }
  .payment-card-head,
  .payment-card-links,
  .payment-card-note {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    justify-content: space-between;
  }
  .payment-card-head span,
  .payment-card-note span {
    color: var(--muted);
    font-size: 12px;
  }
  .payment-card-amount {
    display: grid;
    gap: 2px;
    margin: 8px 0 10px;
  }
  .payment-card-amount strong {
    font-size: 20px;
    line-height: 1.2;
  }
  .payment-card-amount span {
    color: var(--muted);
    font-size: 12px;
  }
  .payment-card-links {
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-bottom: 10px;
  }
  .payment-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 10px;
  }
  .payment-card-grid div {
    min-width: 0;
    border-top: 1px solid var(--line);
    padding-top: 7px;
  }
  .payment-card-grid dt {
    color: var(--muted);
    font-size: 11px;
  }
  .payment-card-grid dd {
    margin: 2px 0 0;
    overflow-wrap: anywhere;
  }
  .payment-card-note {
    flex-direction: column;
    border-top: 1px solid var(--line);
    padding-top: 8px;
  }
  .payment-card-action {
    margin-top: 10px;
  }
.payment-card-action select {
    width: 100%;
  }
}
.payment-filter-workbench {
  display: grid;
  gap: 9px;
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}
.payment-quick-filters,
.payment-active-filters,
.payment-scan-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}
.payment-quick-filters > span,
.payment-active-filters > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}
.payment-quick-filters button {
  min-height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--muted-strong);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 720;
}
.payment-quick-filters button:hover { background: var(--panel-soft); }
.payment-quick-filters button.selected {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-strong);
}
.payment-filter-toolbar {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.payment-filter-toolbar .filter-panel {
  flex: 1 1 100%;
  border-top: 1px solid var(--line);
}
.payment-advanced-filter-panel summary { min-height: 36px; }
.payment-active-filters {
  min-height: 22px;
  border-top: 1px solid var(--line);
  padding-top: 9px;
}
.payment-active-filters b {
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 720;
}
.payment-active-filters .text-link { min-height: 28px; font-size: 12px; }
.payments-scan-table table {
  min-width: 1055px;
  table-layout: fixed;
}
.payments-scan-table td { white-space: normal; }
.payments-scan-table th:nth-child(1) { width: 15%; }
.payments-scan-table th:nth-child(2) { width: 19%; }
.payments-scan-table th:nth-child(3) { width: 13%; }
.payments-scan-table th:nth-child(4) { width: 16%; }
.payments-scan-table th:nth-child(5) { width: 11%; }
.payments-scan-table th:nth-child(6) { width: 14%; }
.payments-scan-table th:nth-child(7) { width: 12%; }
.payment-amount-summary,
.payment-order-customer,
.payment-owner-cell,
.payment-action-cell {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.payment-amount-summary strong { color: var(--ink); font-size: 15px; }
.payment-amount-summary span,
.payment-order-customer > span,
.payment-owner-cell span,
.payment-process-label {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.payment-order-customer .text-link {
  width: fit-content;
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: left;
}
.payment-card-head > div,
.customer-card-head > div,
.order-card-head > div { min-width: 0; }
.payment-owner-cell strong { font-size: 13px; }
.payment-scan-status { align-items: flex-start; }
.payment-scan-status .badge,
.payment-scan-status .receipt-state { margin: 0; }
.payment-receipt-cell { min-width: 0; }
.payment-note-cell {
  max-width: 280px;
  margin: 0;
  color: var(--ink);
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.payment-action-cell { gap: 6px; }
.payment-action-cell .compact-select {
  min-width: 0;
  width: 100%;
}

.payment-action-cell .badge {
  display: inline-block;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
  vertical-align: middle;
}
.payment-action-cell > span {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
}
.payment-card-scan { position: relative; }
.payment-card-scan.missing-receipt { border-left: 3px solid var(--bad); }
.payment-card-scan.needs-review { border-left: 3px solid var(--warn); }
.payment-card-scan .payment-card-head { align-items: flex-start; }
.payment-card-scan .payment-card-head > div { min-width: 0; }
.payment-card-scan .payment-amount-summary { margin: 8px 0; }
.payment-card-scan .payment-scan-status { margin: 0 0 10px; }
.payment-card-scan .payment-card-grid { margin: 0 0 10px; }
.payment-card-receipt {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  border-top: 1px solid var(--line);
  padding-top: 9px;
}
.payment-card-receipt > strong,
.payment-card-note > strong,
.payment-card-action > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
}
.payment-card-receipt > div { min-width: 0; }
.payment-card-note {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 8px;
  margin: 9px 0 0;
  color: var(--ink);
  line-height: 1.55;
}
.payment-card-note span { overflow-wrap: anywhere; }
.payment-card-action {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}
.payment-card-action select { width: 100%; }
.payment-card-skeleton {
  gap: 10px;
  pointer-events: none;
}
.payment-card-skeleton span {
  display: block;
  height: 14px;
  border-radius: 4px;
  background: #e5e7eb;
}
.payment-card-skeleton span:nth-child(2) { width: 72%; }
.payment-card-skeleton span:nth-child(3) { width: 88%; }
.list-card-skeleton {
  display: grid;
  gap: 10px;
  min-height: 108px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}
.list-card-skeleton span {
  display: block;
  height: 14px;
  border-radius: 4px;
  background: #e5e7eb;
}
.list-card-skeleton span:nth-child(2) { width: 72%; }
.list-card-skeleton span:nth-child(3) { width: 88%; }
.order-mobile-cards,
.order-mobile-action-bar {
  display: none;
}
.mobile-detail-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}
.mobile-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}
.mobile-card-head strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}
.mobile-card-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.mobile-detail-card p {
  margin: 6px 0 10px;
  color: var(--muted-strong);
}
.mobile-detail-card dl {
  display: grid;
  gap: 8px;
  margin: 0;
}
.mobile-detail-card dl > div {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 8px;
}
.mobile-detail-card dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.mobile-detail-card dd {
  margin: 0;
  min-width: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.detail-state {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 18px;
}
.detail-state strong {
  color: var(--ink);
  font-size: 16px;
}
.detail-state span {
  color: var(--muted-strong);
}
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(100px, 1fr));
  gap: 10px;
}
.skeleton-grid i {
  height: 58px;
  border-radius: 8px;
  background: linear-gradient(90deg, #eef2f7, #f8fafc, #eef2f7);
}
.empty-cell {
  color: var(--muted);
  text-align: center;
  padding: 28px 12px;
}
.empty-card strong {
  display: block;
  color: var(--ink);
}
.empty-card span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.link {
  display: inline-block;
  color: var(--brand);
  cursor: pointer;
  font-weight: 700;
}
td > .link {
  display: block;
  width: 100%;
}
td.clickable-cell {
  cursor: pointer;
  min-height: 40px;
}
td.clickable-cell:hover {
  background: #f0fdfa;
}

.muted { color: var(--muted); }
.hidden { display: none !important; }

/* Authentication is a hard visual and interaction boundary: no app shell before login. */
#loginGate { display: none; }
body.unauthenticated {
  min-height: 100vh;
  background: #111820;
}
body.unauthenticated #authenticatedShell {
  display: none !important;
}
body.unauthenticated #loginGate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 28px;
  color: #edf2f7;
  background: #111820;
}
.login-gate-ambient {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: #111820;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}
.login-gate-content {
  position: relative;
  z-index: 1;
  width: min(100%, 432px);
  display: grid;
  gap: 28px;
}
.login-brand-lockup {
  display: grid;
  justify-items: center;
  gap: 8px;
}
.login-brand-lockup img {
  display: block;
  width: min(270px, 80vw);
  height: 58px;
  object-fit: contain;
}
.login-brand-lockup span {
  color: #9dabb9;
  font-size: 12px;
  letter-spacing: 0;
}
.login-panel {
  border: 1px solid rgba(201, 213, 225, 0.2);
  border-radius: 12px;
  padding: 28px;
  background: rgba(21, 30, 40, 0.94);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}
.login-panel-heading { margin-bottom: 22px; }
.login-panel-heading .eyebrow { color: #8fb9eb; }
.login-panel h1 {
  margin: 7px 0 8px;
  color: #f8fafc;
  font-size: 24px;
  line-height: 1.25;
}
.login-panel-heading p,
.login-security-note {
  margin: 0;
  color: #aebbc8;
  font-size: 13px;
  line-height: 1.65;
}
.login-form { display: grid; gap: 15px; }
.login-form label { display: grid; gap: 7px; }
.login-form label span {
  color: #d5dee7;
  font-size: 13px;
  font-weight: 650;
}
.login-form input {
  min-height: 42px;
  border: 1px solid #3a4a5a;
  border-radius: 8px;
  padding: 0 12px;
  background: #17212c;
  color: #f8fafc;
}
.login-form input:focus {
  border-color: #4d91d8;
  outline: 2px solid rgba(77, 145, 216, 0.22);
  outline-offset: 1px;
}
.login-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  margin-top: 3px;
  border-radius: 8px;
  background: #2563a6;
  color: #fff;
}
.login-form button [data-lucide] {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
}
.login-form button:hover { background: #1f568f; }
.login-form button:disabled { opacity: 0.65; cursor: wait; }
.login-form-status {
  min-height: 18px;
  margin: -3px 0 0;
  color: #f1b68a;
  font-size: 12px;
}
.login-security-note {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(201, 213, 225, 0.14);
}
@media (max-width: 520px) {
  body.unauthenticated #loginGate { padding: 20px; }
  .login-gate-content { gap: 22px; }
  .login-panel { padding: 23px 20px; }
  .login-brand-lockup img { height: 50px; }
  .login-panel h1 { font-size: 22px; }
}

.login-required {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.login-required h2 {
  margin: 0 0 8px;
}
.login-required p {
  margin: 6px 0 0;
  color: var(--muted);
}

.list-summary,
.pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  color: var(--muted);
  font-size: 13px;
}
.list-summary {
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 9px 11px;
}
.list-summary div {
  display: grid;
  gap: 2px;
}
.list-summary strong {
  color: var(--ink);
}
.list-loading-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  color: var(--muted-strong);
  font-size: 13px;
}
.list-loading-strip [data-lucide],
.list-refresh-status [data-lucide] {
  width: 15px;
  height: 15px;
  animation: ui-spin .9s linear infinite;
}
.list-loading-strip small {
  color: var(--muted);
  font-size: 12px;
}
.list-refresh-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.list-refresh-status.is-error { color: var(--bad); }
.list-refresh-status .text-button { color: inherit; margin-left: 2px; }
.table-loading {
  opacity: .78;
}
.table-loading td {
  height: 52px;
}
.table-skeleton-line {
  display: block;
  width: min(100%, 92px);
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(90deg, #eef2f7, #f8fafc, #eef2f7);
  background-size: 180% 100%;
  animation: list-skeleton-shimmer 1.15s ease-in-out infinite;
}
.table-loading td:nth-child(2n) .table-skeleton-line { width: min(100%, 132px); }
@keyframes list-skeleton-shimmer {
  0% { background-position: 180% 0; }
  100% { background-position: -20% 0; }
}
.compact-summary {
  margin: 8px 0;
  padding: 8px 10px;
}
.compact-summary .small {
  min-height: 34px;
}

.pagination {
  justify-content: flex-end;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.pagination-info {
  margin-right: auto;
  color: var(--muted-strong);
}
.pager-size,
.pager-jump,
.pager-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pager-size.readonly {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  padding: 6px 9px;
}
.pager-size.readonly strong {
  color: var(--ink);
}
.pager-size span,
.pager-jump span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.pager-size select {
  width: 96px;
  min-width: 96px;
}
.pager-jump input {
  width: 76px;
}
.pager-actions {
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 680;
  background: #f3f4f6;
  color: #374151;
  white-space: nowrap;
}
.badge.ok { background: #ecfdf5; color: var(--ok); border-color: #bbf7d0; }
.badge.warn { background: #fffbeb; color: var(--warn); border-color: #fde68a; }
.badge.bad { background: #fef2f2; color: var(--bad); border-color: #fecaca; }
.badge.info { background: #eff6ff; color: var(--info); border-color: #bfdbfe; }

.stacked-cell {
  max-width: 360px;
  white-space: normal;
  line-height: 1.7;
}

.exception-panel .section-hint {
  margin-bottom: 12px;
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  justify-content: flex-end;
  background: rgba(17, 24, 39, 0.42);
  min-height: 100dvh;
}
.drawer.hidden { display: none; }
.drawer-panel {
  width: min(1040px, calc(100vw - 32px));
  height: 100%;
  overflow: auto;
  background: #fff;
  padding: 0 22px 22px;
  box-shadow: var(--shadow-md);
}
.drawer-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin: 0 -22px 18px;
  padding: 28px 22px 16px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
}
.drawer-head h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}
.drawer-head > button { flex: 0 0 auto; white-space: nowrap; }
.drawer-head p {
  margin: 5px 0 0;
  color: var(--muted);
}
.drawer-identity {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin-top: 9px;
  color: #7c2d12;
  font-size: 12px;
  font-weight: 650;
}
.drawer-identity span,
.drawer-identity strong {
  min-width: 0;
  padding: 3px 7px;
  border: 1px solid #fed7aa;
  border-radius: 4px;
  background: #fff7ed;
}
.drawer-identity strong { color: #9a3412; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 13px;
}
.form-grid > * { min-width: 0; }
.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.form-grid label span { color: var(--muted-strong); }
.full { grid-column: 1 / -1; }

.nested-panel,
.mini-list,
.customer-preview,
.reference-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}
.nested-panel { padding: 13px; }
.mini-list { padding: 10px 12px; }
.mini-list p {
  margin: 5px 0;
  color: var(--ink);
}
.small-note {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 8px;
}
.reference-note {
  color: var(--muted-strong);
  font-size: 12px;
  margin: 0 0 12px;
  padding: 9px 11px;
}
.customer-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 9px 11px;
  font-size: 12px;
}
.customer-preview span {
  color: var(--ink);
  white-space: normal;
}

.customer-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.customer-metrics > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 10px 12px;
  min-width: 0;
}
.customer-metrics > div > span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  margin-bottom: 5px;
}
.customer-metrics strong {
  display: block;
  color: var(--ink);
  font-size: 16px;
  font-weight: 760;
}

.payment-ref {
  display: grid;
  gap: 2px;
}
.payment-ref strong { color: var(--brand); }
.payment-ref span {
  color: var(--muted);
  font-size: 12px;
}
.compact-select {
  min-width: 112px;
  min-height: 34px;
  padding: 4px 8px;
  font-size: 12px;
}
.payment-status-select {
  min-width: 132px;
  min-height: 38px;
}

.product-lines { min-width: 0; }
.product-lines .table-wrap { border-radius: 8px; }
.order-create-form .line-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}
.order-create-form .line-table th,
.order-create-form .line-table td { min-width: 0; }
.order-create-form .line-table th:nth-child(1) { width: 23%; }
.order-create-form .line-table th:nth-child(2) { width: 11%; }
.order-create-form .line-table th:nth-child(3) { width: 15%; }
.order-create-form .line-table th:nth-child(4) { width: 7%; }
.order-create-form .line-table th:nth-child(5) { width: 9%; }
.order-create-form .line-table th:nth-child(6) { width: 8%; }
.order-create-form .line-table th:nth-child(7) { width: 14%; }
.order-create-form .line-table th:nth-child(8) { width: 8%; }
.order-create-form .line-table input {
  width: 100%;
  min-width: 0;
}
.order-create-form .line-table .product-lookup,
.order-create-form .line-table .sku,
.order-create-form .line-table .product-name { min-width: 0; }
.order-create-form .line-table button {
  width: 100%;
  min-width: 0;
  padding-right: 5px;
  padding-left: 5px;
}
.order-create-form { gap: 16px; }
.order-form-section {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.form-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 14px;
}
.form-section-heading > div:first-child { min-width: 0; }
.form-section-heading h2 {
  display: inline;
  margin: 0 0 0 7px;
  color: var(--ink);
  font-size: 16px;
}
.form-section-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.section-step {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
}
.customer-create-toggle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.customer-create-toggle span,
.nested-panel-heading span {
  color: var(--muted);
  font-size: 12px;
}
.nested-panel-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 0 0 12px;
}
.lookup-feedback,
.product-row-status,
.field-error {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
  line-height: 1.45;
}
.lookup-feedback.loading,
.product-row-status.loading { color: var(--brand); }
.lookup-feedback.placeholder { visibility: hidden; }
.lookup-feedback.ready,
.product-row-status.ready { color: var(--muted-strong); }
.lookup-feedback.selected,
.product-row-status.selected { color: var(--ok); }
.lookup-feedback.empty,
.lookup-feedback.error,
.product-row-status.empty,
.product-row-status.error,
.product-row-status.invalid,
.field-error { color: var(--bad); }
.warehouse-inventory-notice {
  display: grid;
  gap: 6px;
  margin-top: 6px;
  padding: 9px 10px;
  border: 1px solid #fecaca;
  border-radius: 6px;
  background: #fff7f7;
  color: var(--bad);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}
.warehouse-inventory-notice.loading {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: var(--brand);
}
.warehouse-inventory-notice.info {
  border-color: #b9c9e6;
  background: #f4f7fc;
  color: #315f9f;
}
.warehouse-inventory-notice strong,
.warehouse-inventory-notice span,
.warehouse-inventory-notice small { overflow-wrap: anywhere; }
.warehouse-inventory-notice ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.warehouse-inventory-notice li {
  display: grid;
  min-width: 0;
  gap: 2px;
  padding-top: 5px;
  border-top: 1px solid rgba(220, 38, 38, 0.18);
}
.warehouse-inventory-notice small {
  color: #991b1b;
  font-weight: 700;
}
.order-field-invalid > input,
.order-field-invalid > select { border-color: var(--bad); }
.order-form-error {
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 6px;
  background: #fff7f7;
  color: var(--bad);
  font-size: 13px;
  font-weight: 700;
}
.product-row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}
.count-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 700;
}
.product-lines-wrap { margin-top: 10px; }
.product-row.selected td { background: #f0fdfa; }
.product-row-status { min-width: 190px; }
.order-create-save-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.05);
}
.order-create-save-bar > div { display: grid; gap: 3px; min-width: 0; }
.order-create-save-bar strong { color: var(--ink); font-size: 13px; }
.order-create-save-bar span { color: var(--muted); font-size: 12px; }
.order-create-save-bar button { flex: 0 0 auto; min-width: 120px; }
.order-create-form.is-submitting .order-create-save-bar {
  border-color: var(--brand);
  background: #f8fbff;
}
.order-create-form.is-submitting .order-create-save-bar button:disabled {
  cursor: wait;
  opacity: 0.78;
}
.product-row.invalid td,
.inbound-row.invalid {
  background: #fff7f7;
}
.product-row.invalid .product-lookup,
.inbound-row.invalid .inbound-product {
  border-color: var(--bad);
}

.option-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.option-row:last-child { border-bottom: 0; }
.settings-grid {
  align-items: stretch;
}
.setting-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.setting-card .section-title {
  margin-top: 0;
}
.setting-card .badge {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
.settings-split {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.settings-filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) repeat(2, minmax(140px, 0.8fr)) auto auto;
  gap: 10px;
  align-items: end;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}
.settings-filter-bar label {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.settings-filter-bar label span {
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 700;
}
.settings-filter-bar input,
.settings-filter-bar select {
  width: 100%;
  min-width: 0;
}
.settings-filter-bar button { white-space: nowrap; }
.settings-crud-header {
  align-items: flex-start;
  margin-bottom: 12px;
}
.settings-crud-header .button-row > button,
.inventory-primary-action {
  min-height: 36px;
}
.settings-row-actions { justify-content: flex-end; }
.settings-row-actions details > div { width: 156px; }
.settings-row-actions details > div button { white-space: normal; }
.settings-entity-tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 16px;
  border-bottom: 1px solid var(--line);
}
.settings-entity-tabs button {
  min-height: 40px;
  padding: 8px 16px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted-strong);
}
.settings-entity-tabs button.active {
  border-bottom-color: var(--brand);
  color: var(--brand);
  font-weight: 700;
}
.settings-user-group-cards { display: none; }
.settings-user-group-table code,
.settings-user-group-card code {
  font-size: 11px;
  color: var(--muted-strong);
}
.permission-safety-note { margin-bottom: 14px; }
.user-group-form {
  display: grid;
  gap: 20px;
  padding-bottom: 72px;
}
.user-group-meta-form {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}
.user-group-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  color: var(--muted-strong);
  font-size: 12px;
}
.permission-editor { min-width: 0; }
.permission-editor-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.permission-editor-header h3,
.permission-editor-header p { margin: 0; }
.permission-editor-header p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.permission-editor-header input { width: min(340px, 38vw); }
.permission-module {
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}
.permission-module > summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  color: var(--text);
  font-weight: 700;
  list-style-position: inside;
}
.permission-module > summary strong { color: var(--muted-strong); font-size: 12px; }
.permission-module[open] > summary { border-bottom: 1px solid var(--line); }
.permission-module-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 8px 14px;
  background: var(--panel-soft);
  border-bottom: 1px solid var(--line);
}
.permission-module-toolbar button { min-height: 32px; }
.permission-list { display: grid; }
.permission-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 24px minmax(220px, 1fr) minmax(140px, auto) 64px;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line-soft, #eef1f4);
  cursor: pointer;
}
.permission-row:last-child { border-bottom: 0; }
.permission-row:hover { background: var(--panel-soft); }
.permission-row.is-forbidden { cursor: not-allowed; background: #fafafa; }
.permission-row input { width: 18px; height: 18px; margin: 0; }
.permission-row-copy { min-width: 0; display: grid; gap: 2px; }
.permission-row-copy strong { font-size: 13px; }
.permission-row-copy small { color: var(--muted); font-size: 12px; font-weight: 400; }
.permission-row-copy code { color: var(--muted-strong); font-size: 10px; }
.permission-state,
.permission-risk {
  display: inline-flex;
  width: auto;
  justify-self: start;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted-strong);
  background: var(--panel);
  font-size: 11px;
  white-space: nowrap;
}
.permission-state.allowed { border-color: #bbf7d0; color: #166534; background: #f0fdf4; }
.permission-state.protected { border-color: #bfdbfe; color: #1d4ed8; background: #eff6ff; }
.permission-state.dependency { border-color: #fde68a; color: #92400e; background: #fffbeb; }
.permission-state.forbidden { color: var(--muted); background: #f3f4f6; }
.permission-risk.risk-high { color: #b42318; }
.permission-risk.risk-medium { color: #a15c00; }
.sticky-form-actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  margin: 0 -22px -22px;
  padding: 12px 22px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}
.settings-mobile-nav { display: none; }
.settings-inner-nav {
  display: grid;
  gap: 8px;
}
.settings-inner-nav button {
  min-height: 44px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
  text-align: left;
}
.settings-inner-nav button.active {
  border-color: var(--brand);
  color: var(--brand);
  background: #edf6f6;
}
.settings-option-table table {
  min-width: 680px;
}
.settings-warehouse-table table {
  min-width: 860px;
}
.settings-option-cards,
.settings-warehouse-cards,
.settings-product-cards,
.inventory-item-cards,
.inventory-log-cards {
  display: none;
}
.inventory-filters {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(220px, 1.4fr) minmax(150px, 1fr) minmax(130px, 0.8fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}
.inventory-filters .checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  cursor: pointer;
}
.inventory-filters .checkbox-field input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}
.inventory-page-heading { align-items: flex-start; }
.inventory-active-filters { margin: -4px 0 14px; }
.warehouse-operating-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.warehouse-operating-header h2 { margin: 0; font-size: 16px; }
.warehouse-operating-header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.warehouse-operating-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, auto));
  gap: 14px;
  margin: 0;
}
.warehouse-operating-facts div { display: grid; gap: 2px; }
.warehouse-operating-facts dt { color: var(--muted); font-size: 11px; }
.warehouse-operating-facts dd { margin: 0; color: var(--ink); font-size: 14px; font-weight: 760; font-variant-numeric: tabular-nums; }
.warehouse-operating-facts .is-low dd { color: var(--warn-strong, #a05a00); }
.product-type-groups,
.warehouse-stack {
  display: grid;
  gap: 16px;
}
.product-type-groups > *,
.warehouse-stack > * {
  min-width: 0;
}
.product-type-card,
.warehouse-card {
  min-width: 0;
  padding: 16px;
}
.warehouse-log {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.inventory-log-restricted {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.warehouse-log summary {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  color: var(--brand);
  font-weight: 700;
  cursor: pointer;
}
.warehouse-log summary span {
  margin-left: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.target-settings-panel.is-warning {
  border-color: color-mix(in srgb, var(--warn, #c78316) 45%, var(--line));
  background: color-mix(in srgb, var(--warn, #c78316) 5%, var(--panel));
}
.target-settings-panel.is-warning strong { color: var(--warn-strong, #9a5b00); }
.settings-audit-filter-bar { grid-template-columns: minmax(220px, 1.4fr) minmax(150px, .8fr) minmax(150px, .8fr); }
.inventory-stock-badge,
.inventory-change {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted-strong);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.inventory-stock-badge.is-low { border-color: #e7c387; background: #fffaf0; color: #9b5c09; }
.inventory-stock-badge:not(.is-low) { border-color: var(--line); background: transparent; color: var(--muted-strong); }
.inventory-locked-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 26px;
  border: 1px solid #b9c9e6;
  border-radius: 999px;
  background: #f4f7fc;
  color: #315f9f;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.inventory-locked-badge.is-empty { border-color: var(--line); background: transparent; color: var(--muted); font-weight: 500; }
.inventory-mobile-lock { display: none; }
.inventory-stock-badge.is-low,
.inventory-change.is-out {
  color: var(--bad);
  border-color: #fecaca;
  background: #fff1f2;
}
.inventory-change.is-in {
  color: var(--ok);
  border-color: #a7f3d0;
  background: #ecfdf5;
}
.inventory-empty { margin: 14px 0 4px; }
.warehouse-inventory-table table {
  min-width: 680px;
}
.inbound-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.inbound-row:last-child { border-bottom: 0; }

.order-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.customer-detail-body {
  position: relative;
}
.customer-summary-header {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 0 14px;
}
.customer-id-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-bottom: 10px;
}
.customer-detail-body .customer-id-strip .copy-meta {
  min-height: 30px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 2px 0;
}
.customer-detail-body .customer-id-strip .copy-meta + .copy-meta {
  border-left: 1px solid var(--line);
  padding-left: 14px;
}
.customer-detail-body .customer-id-strip .copy-meta button {
  min-height: 28px;
  border-color: transparent;
  background: transparent;
  color: var(--brand);
  padding-right: 2px;
  padding-left: 2px;
  box-shadow: none;
}
.customer-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(270px, 320px);
  gap: 18px;
  align-items: start;
}
.customer-summary-content { min-width: 0; }
.customer-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
}
.customer-summary > div,
.customer-identity-facts > div {
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 3px 12px 8px;
}
.customer-summary > div:first-child,
.customer-identity-facts > div:nth-child(3n + 1) { padding-left: 0; }
.customer-summary > div + div { border-left: 1px solid var(--line); }
.customer-identity-facts > div { border-bottom: 1px solid var(--line); padding-top: 8px; }
.customer-identity-facts > div:not(:nth-child(3n + 1)) {
  border-left: 1px solid var(--line);
}
.customer-summary span,
.customer-identity-facts span,
.customer-risk-grid > div > span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.customer-summary strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
  font-weight: 750;
  overflow-wrap: anywhere;
}
.customer-summary > div:first-child strong { font-size: 19px; }
.customer-identity-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-top: 7px;
}
.customer-identity-facts strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 740;
  overflow-wrap: anywhere;
}
.customer-health-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 9px;
  color: var(--muted-strong);
  font-size: 12px;
}
.customer-health-strip span:not(.badge) {
  overflow-wrap: anywhere;
}
.customer-next-action-panel {
  top: 86px;
  border-color: var(--line);
  background: #fbfcfd;
  box-shadow: none;
}
.customer-next-action-panel .panel-label { color: var(--muted); font-weight: 650; }
.customer-next-action-panel > div:first-child > strong { font-size: 16px; }
.customer-detail-body .customer-section-chips {
  gap: 0;
  margin-top: 8px;
  padding: 7px 0 0;
}
.customer-detail-body .customer-section-chips button {
  min-height: 36px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted-strong);
  padding: 7px 12px 8px;
  box-shadow: none;
  font-weight: 620;
}
.customer-detail-body .customer-section-chips button:hover,
.customer-detail-body .customer-section-chips button:focus-visible {
  border-bottom-color: var(--brand);
  background: transparent;
  color: var(--brand-strong);
}
.customer-overview-section { margin-top: 2px; }
.customer-overview-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.customer-detail-group { min-width: 0; }
.customer-detail-group .compact-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.customer-detail-group .compact-fields > div {
  min-width: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 9px 0 10px;
}
.customer-detail-group .compact-fields strong { font-size: 13px; font-weight: 690; }
.customer-detail-table table { min-width: 900px; }
.customer-order-reference {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  color: var(--muted-strong);
}
.customer-order-reference span { overflow-wrap: anywhere; }
.customer-order-reference button { flex: 0 0 auto; }
.customer-detail-mobile-list { display: none; }
.customer-risk-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 18px;
}
.customer-risk-grid > div {
  min-width: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 10px 0 12px;
}
.customer-risk-grid strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 760;
}
.customer-risk-grid small {
  display: block;
  margin-top: 6px;
  color: var(--muted-strong);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.customer-ownership-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: 0 0 10px;
  color: var(--muted-strong);
  font-size: 12px;
}
.customer-ownership-summary > span { color: var(--muted); font-weight: 650; }
.customer-ownership-summary > strong { color: var(--ink); font-size: 13px; }
.customer-danger-actions { position: relative; }
.customer-danger-actions > summary {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  border: 1px solid #e7b4b4;
  border-radius: var(--radius-sm);
  color: var(--bad);
  padding: 5px 9px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  list-style: none;
}
.customer-danger-actions > summary::-webkit-details-marker { display: none; }
.customer-danger-actions > div { margin-top: 5px; border-top: 1px solid var(--line); padding-top: 5px; }
.customer-card-details { margin-top: 9px; border-top: 1px solid var(--line); padding-top: 7px; }
.customer-card-details summary { display: flex; min-height: 36px; align-items: center; justify-content: space-between; color: var(--muted-strong); cursor: pointer; list-style: none; }
.customer-card-details summary::-webkit-details-marker { display: none; }
.customer-card-details dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin: 5px 0 0; }
.customer-card-details dt { color: var(--muted); font-size: 10px; }
.customer-card-details dd { margin: 1px 0 0; overflow-wrap: anywhere; }
.customer-owner-label { color: var(--muted-strong); font-size: 12px; font-weight: 680; }
.order-detail-body {
  position: relative;
}
.order-id-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.copy-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 6px 8px 6px 10px;
}
.copy-meta span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.copy-meta strong {
  max-width: 260px;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.copy-meta button {
  flex: 0 0 auto;
}
.icon-like {
  min-height: 30px;
  padding: 4px 8px;
}
.order-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 14px;
  align-items: start;
}
.order-summary > div,
.compact-fields > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 10px 12px;
}
.order-summary span,
.compact-fields span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}
.order-summary strong,
.compact-fields strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 740;
  overflow-wrap: anywhere;
}
.compact-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
}
.next-action-panel {
  position: sticky;
  top: 86px;
  display: grid;
  gap: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  padding: 13px;
  box-shadow: var(--shadow-sm);
}
.panel-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  margin-bottom: 4px;
}
.next-action-panel strong {
  display: block;
  color: var(--ink);
  font-size: 16px;
  font-weight: 780;
}
.next-action-panel.is-submitting {
  border-color: #b9cdea;
  background: #f7faff;
}
.next-action-panel.is-submitting .panel-label {
  color: var(--brand);
}
.action-pending-note {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted-strong);
  font-size: 12px;
}
.action-pending-note::before {
  width: 7px;
  height: 7px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  content: "";
  animation: ui-spin .9s linear infinite;
}
.next-action-buttons button.is-submitting,
.next-action-panel button.is-submitting {
  color: var(--brand);
  background: #eef4ff;
  border-color: #c8d8f2;
  cursor: wait;
  opacity: 1;
}
.next-action-panel p {
  margin: 4px 0 0;
  color: var(--muted-strong);
  font-size: 12px;
}
.next-action-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  margin-top: 7px;
  color: var(--muted-strong);
  font-size: 12px;
}
.next-action-facts span + span { padding-left: 10px; border-left: 1px solid var(--line); }
.next-action-buttons {
  display: grid;
  gap: 8px;
}
.next-action-buttons button {
  width: 100%;
}
.section-chips {
  position: sticky;
  top: 73px;
  z-index: 2;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  margin: 0 -2px 14px;
  padding: 6px 2px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
}
.section-chips button {
  flex: 0 0 auto;
}
.detail-section .section-title { margin-top: 10px; }
.order-overview-section { margin-top: 2px; }
.order-overview-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.order-detail-group { min-width: 0; }
.detail-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 9px;
}
.detail-group-head h3 { margin: 0; color: var(--ink); font-size: 14px; }
.detail-group-head span { color: var(--muted); font-size: 12px; text-align: right; }
.order-detail-group .compact-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.logistics-detail-block { border-top: 1px solid var(--line); }
.logistics-detail-block .section-title { margin-top: 14px; }
.payment-amount-cell,
.payment-note-cell {
  display: grid;
  min-width: 0;
  gap: 3px;
}
.payment-amount-cell small { color: var(--muted); }
.payment-note-cell { max-width: 220px; overflow-wrap: anywhere; }
.order-payments-compact-table table { min-width: 980px; }
.inventory-impact-block { border-top: 1px solid var(--line); }
.inventory-impact-note { margin: 0 0 10px; }
.inventory-impact-table table { min-width: 940px; }
.detail-block {
  margin-top: 16px;
  padding-top: 2px;
  scroll-margin-top: 132px;
}
.detail-section {
  scroll-margin-top: 132px;
}
.detail-block + .detail-block {
  border-top: 1px solid var(--line);
}
.detail-block .section-title {
  margin-top: 14px;
}

/* Phase 2: order detail uses one decision path instead of an equal-weight card wall. */
body.order-detail-drawer-open .drawer-panel {
  width: min(980px, calc(100vw - 40px));
}
body.order-detail-drawer-open #drawerBody {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}
.order-summary-header {
  display: grid;
  gap: 10px;
  margin-bottom: 4px;
}
.order-summary-context {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.order-identity-block {
  display: grid;
  min-width: 0;
  gap: 4px;
}
.order-customer-context {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 8px;
}
.order-customer-context > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.order-customer-context .link {
  min-width: 0;
  min-height: auto;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  box-shadow: none;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.order-customer-context .link:hover { color: var(--brand); }
.order-detail-utility {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
}
.order-detail-more { position: relative; }
.order-detail-more > summary {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  padding: 5px 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  list-style: none;
}
.order-detail-more > summary::-webkit-details-marker { display: none; }
.order-detail-more > summary::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
}
.order-detail-more[open] > summary { background: var(--panel-soft); }
.order-detail-more-menu {
  position: absolute;
  top: 38px;
  right: 0;
  z-index: 8;
  display: grid;
  width: 190px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  padding: 5px;
  box-shadow: var(--shadow-md);
}
.order-detail-more-menu > button,
.order-detail-danger-zone button {
  width: 100%;
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 7px 9px;
  box-shadow: none;
  text-align: left;
}
.order-detail-more-menu > button:hover { background: var(--panel-soft); }
.order-detail-danger-zone {
  margin-top: 4px;
  border-top: 1px solid var(--line);
  padding-top: 4px;
}
.order-detail-danger-zone button { color: var(--bad); }
.order-detail-danger-zone button:hover { background: #fff5f5; }
.confirm-dialog-details {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 5px 12px;
  margin: 14px 0 0;
  padding: 10px 0 0;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
}
.confirm-dialog-details dt { color: var(--muted); }
.confirm-dialog-details dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-weight: 650; }
.order-detail-body .order-id-strip {
  gap: 6px 14px;
  margin: 0;
}
.order-detail-body .copy-meta {
  min-height: 30px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 2px 0;
}
.order-detail-body .copy-meta + .copy-meta {
  border-left: 1px solid var(--line);
  padding-left: 14px;
}
.order-detail-body .copy-meta button {
  min-height: 28px;
  border-color: transparent;
  background: transparent;
  color: var(--brand);
  padding-right: 2px;
  padding-left: 2px;
  box-shadow: none;
}
.order-summary-surface {
  min-width: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 15px 0 12px;
}
.order-summary-surface .order-summary {
  grid-template-columns: 1.25fr repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0;
}
.order-summary-surface .order-summary > div {
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 1px 14px;
}
.order-summary-surface .order-summary > div:first-child { padding-left: 0; }
.order-summary-surface .order-summary > div + div { border-left: 1px solid var(--line); }
.order-summary-surface .order-summary span,
.order-state-summary span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
}
.order-summary-surface .order-summary span small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}
.order-summary-surface .order-summary strong {
  color: var(--ink);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  font-weight: 760;
}
.order-summary-surface .order-summary .order-total strong { font-size: 21px; }
.order-state-summary {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr);
  gap: 18px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.order-summary-group { min-width: 0; }
.order-summary-group + .order-summary-group {
  border-left: 1px solid var(--line);
  padding-left: 18px;
}
.order-state-summary .order-summary-group-label {
  margin-bottom: 7px;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 720;
}
.order-summary-group-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.order-summary-group-content > div { min-width: 0; }
.order-summary-group-content > div > strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}
.order-summary-surface > .reference-note {
  margin: 12px 0 0;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--muted);
}
.order-detail-body .next-action-panel {
  border-color: var(--line);
  background: #fbfcfd;
  box-shadow: none;
}
.order-detail-body .next-action-panel .panel-label {
  color: var(--muted);
  font-weight: 650;
}
.order-detail-body .next-action-panel > div:first-child > strong { font-size: 16px; }
.order-detail-body .section-chips {
  gap: 0;
  margin-top: 8px;
  padding: 7px 0 0;
}
.order-detail-body .section-chips button {
  min-height: 36px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted-strong);
  padding: 7px 11px 8px;
  box-shadow: none;
  font-weight: 620;
}
.order-detail-body .section-chips button:hover,
.order-detail-body .section-chips button:focus-visible {
  border-bottom-color: var(--brand);
  background: transparent;
  color: var(--brand-strong);
}
body.order-detail-drawer-open .drawer-identity {
  gap: 6px 12px;
  border: 1px solid #fed7aa;
  border-radius: var(--radius-sm);
  background: #fffaf3;
  padding: 7px 9px;
}
body.order-detail-drawer-open .drawer-identity span,
body.order-detail-drawer-open .drawer-identity strong {
  width: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}
body.order-detail-drawer-open .drawer-identity strong {
  margin-left: auto;
  white-space: nowrap;
}
.order-detail-body .order-detail-group .compact-fields {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 18px;
}
.order-detail-body .order-detail-group .compact-fields > div {
  min-width: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 9px 0 10px;
}
.order-detail-body .order-detail-group .compact-fields strong {
  font-size: 13px;
  font-weight: 690;
}
.order-detail-body .detail-block,
.order-detail-body .detail-section {
  padding-top: 6px;
}
.detail-disclosure {
  border-top: 1px solid var(--line);
  padding-top: 0 !important;
}
.detail-disclosure > summary {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}
.detail-disclosure > summary::-webkit-details-marker { display: none; }
.detail-disclosure > summary::after {
  content: "+";
  color: var(--muted);
  font-size: 18px;
  font-weight: 450;
}
.detail-disclosure[open] > summary::after { content: "−"; }
.detail-disclosure > summary span { font-size: 16px; font-weight: 760; }
.detail-disclosure > summary small { margin-left: auto; color: var(--muted); font-size: 12px; }
.detail-disclosure-body { padding: 0 0 12px; }
.detail-disclosure-body .list-summary { margin-top: 0; }
.exception-panel .detail-disclosure-body > .section-title { margin-top: 0; }

.flow {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}
.compact-flow {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}
.flow-step {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  background: #fff;
}
.flow-step.active {
  border-color: #99f6e4;
  background: #f0fdfa;
}
.order-timeline-table table {
  min-width: 860px;
}
.order-timeline-table td:first-child,
.order-timeline-table th:first-child {
  min-width: 170px;
}
.order-timeline-table td:last-child {
  color: var(--muted);
  max-width: 260px;
}

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 12px 0;
}
.inline-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}
.compact-actions { margin: 0; }

.bars {
  display: grid;
  gap: 10px;
}
.bar-row {
  display: grid;
  grid-template-columns: minmax(92px, 120px) minmax(120px, 1fr) 90px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}
.bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}
.bar span {
  display: block;
  height: 100%;
  background: var(--brand);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.simulation-control {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding-top: 4px;
}
.simulation-status {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 210px) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  border: 1px solid #b7d8d4;
  border-radius: 7px;
  background: #f0fdfa;
  padding: 8px 9px;
}
.simulation-status.pending {
  grid-template-columns: 1fr;
  border-color: var(--line);
  background: var(--panel-soft);
}
.simulation-status strong,
.simulation-status span {
  display: block;
  min-width: 0;
}
.simulation-status strong { color: var(--ink); font-size: 12px; }
.simulation-status span { color: var(--muted-strong); font-size: 12px; overflow-wrap: anywhere; }
.simulation-status select { min-height: 36px; font-size: 12px; }
.simulation-status button { min-height: 36px; white-space: nowrap; }
.simulation-write-warning {
  border-left: 3px solid var(--warn);
  background: #fffbeb;
  color: #78350f;
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 700;
}

.home-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  padding: 4px 0 2px;
}
.home-hero h2 {
  margin: 3px 0 5px;
  color: var(--ink);
  font-size: 23px;
  line-height: 1.2;
}
.home-hero p { max-width: 640px; margin: 0; color: var(--muted); }
.eyebrow {
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 780;
}
.home-quick-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.home-identity-context {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px 10px;
  margin: -4px 0 14px;
  border-left: 3px solid var(--brand);
  background: #f0fdfa;
  color: var(--muted-strong);
  padding: 8px 10px;
  font-size: 12px;
}
.home-identity-context strong { color: var(--brand-strong); }
.home-identity-context span { min-width: 0; overflow-wrap: anywhere; }
.home-identity-context button { margin-left: auto; }
.home-identity-context.is-simulating {
  border-color: var(--warn);
  background: #fffbeb;
}
.home-identity-context.is-simulating strong { color: #92400e; }
.home-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.home-grid-priority { grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr); }
.home-panel,
.home-admin-overview,
.target-settings-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 15px;
  box-shadow: var(--shadow-sm);
}
.home-panel .section-title,
.home-admin-overview .section-title,
.target-management-list .section-title { margin-top: 0; }
.home-entry-list { display: grid; gap: 0; }
.home-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.home-entry:first-child { border-top: 0; padding-top: 2px; }
.home-entry > div { display: grid; min-width: 0; gap: 2px; }
.home-entry .text-link { min-height: 32px; display: inline-flex; align-items: center; }
.home-entry > div > span { overflow-wrap: anywhere; color: var(--muted); font-size: 12px; }
.home-entry .badge { flex: 0 0 auto; }
.role-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}
.role-action-card {
  display: grid;
  min-width: 0;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  padding: 11px;
}
.role-action-card.actionable { border-color: #b7d8d4; background: #f7fdfc; }
.role-action-card.actionable { cursor: pointer; }
.role-action-card.actionable:hover { border-color: var(--brand); background: #f0fdfa; box-shadow: var(--shadow-sm); }
.role-action-card.actionable:focus-visible { outline: 3px solid rgba(13, 148, 136, 0.28); outline-offset: 2px; }
.role-action-card.is-empty { background: #fbfbfc; }
.role-action-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.role-action-card h3 { margin: 0; color: var(--ink); font-size: 13px; line-height: 1.35; }
.role-action-card-head strong { color: var(--brand-strong); font-size: 20px; }
.role-action-card p { min-height: 18px; margin: 0; color: var(--muted); font-size: 12px; }
.home-priority-target {
  display: grid;
  gap: 2px;
  min-width: 0;
  margin-top: 2px;
}
.home-priority-target > span {
  color: var(--muted-strong);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.role-action-cta { color: var(--brand-strong); font-size: 13px; font-weight: 760; }
.role-action-empty { color: var(--muted); font-size: 12px; }
.home-empty {
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  color: var(--muted);
  padding: 14px;
  text-align: center;
}
.home-data-state,
.home-loading {
  display: grid;
  justify-items: start;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.home-data-state strong { color: var(--ink); }
.home-data-state span,
.home-loading p { margin: 0; color: var(--muted); }
.home-data-state.pending { border-style: dashed; }
.home-data-state.error { border-color: #fecaca; background: #fffafa; }
.target-state {
  display: grid;
  gap: 5px;
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  padding: 14px;
}
.target-state strong { color: var(--ink); }
.target-state span { color: var(--muted); font-size: 12px; }
.target-state.unset { border-color: #f5cf86; background: #fffbeb; }
.target-coverage-state { align-items: start; }
.target-coverage-state button { margin-top: 2px; }
.target-progress { display: grid; gap: 11px; }
.target-progress-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.target-progress-head strong { color: var(--brand-strong); font-size: 22px; }
.target-progress-head span { color: var(--muted-strong); font-size: 12px; }
.progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}
.progress-track span { display: block; height: 100%; background: var(--brand); }
.target-progress dl,
.admin-overview-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}
.target-progress dl div,
.admin-overview-metrics div {
  min-width: 0;
  border-top: 1px solid var(--line);
  padding-top: 7px;
}
.target-progress dt,
.admin-overview-metrics span { color: var(--muted); font-size: 11px; }
.target-progress dd,
.admin-overview-metrics strong { display: block; margin: 2px 0 0; overflow-wrap: anywhere; color: var(--ink); font-size: 13px; font-weight: 760; }
.home-admin-overview { margin-top: 14px; }
.admin-overview-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.target-settings-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 12px 0 16px;
  background: var(--panel-soft);
}
.target-settings-panel strong { display: block; color: var(--ink); font-size: 16px; }
.target-settings-panel p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.target-management-list { min-width: 0; }
.sales-targets-table table { min-width: 820px; }
.target-batch-list {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 10px;
}
.target-batch-row {
  display: grid !important;
  grid-template-columns: minmax(120px, 1fr) minmax(180px, 0.8fr);
  align-items: center;
  gap: 12px;
  color: var(--ink) !important;
  font-size: 13px !important;
}
.target-batch-row + .target-batch-row { border-top: 1px solid var(--line); padding-top: 8px; }

@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
  .three { grid-template-columns: repeat(2, minmax(210px, 1fr)); }
  .order-hero {
    grid-template-columns: 1fr;
  }
  .customer-hero {
    grid-template-columns: 1fr;
  }
  .order-overview-groups { grid-template-columns: 1fr; }
  .customer-overview-groups { grid-template-columns: 1fr; }
  .next-action-panel {
    position: static;
  }
  .dashboard-controls {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .dashboard-custom-range {
    margin-left: 0;
    flex-wrap: wrap;
  }
  .compact-fields,
  .compact-flow { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
  .home-grid-priority { grid-template-columns: 1fr; }
  .admin-overview-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inventory-filters {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 860px) {
  .sidebar {
    position: static;
    z-index: 12;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(128px, 1fr));
    gap: 6px;
    padding: 10px;
    overflow-x: auto;
  }
  .brand {
    grid-column: 1 / -1;
    margin: 0;
    padding: 4px;
  }
  .nav {
    margin: 0;
    justify-content: center;
    min-height: 40px;
    white-space: nowrap;
  }
  .nav-group {
    display: contents;
  }
  .nav-sub {
    width: 100%;
    margin: 0;
    justify-content: center;
    padding: 8px 10px;
  }
  .nav-sub::before {
    display: none;
  }
  .app { margin-left: 0; }
  .topbar {
    position: static;
    flex-direction: column;
    gap: 10px;
    padding: 18px 18px 12px;
  }
  .topbar h1 { font-size: 22px; }
  .actions {
    display: grid;
    width: 100%;
    gap: 8px;
  }
  .actions-toggle {
    display: flex;
    width: 100%;
  }
  .actions:not([open]) > :not(.actions-toggle) {
    display: none;
  }
  .actions[open] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .actions[open] .actions-toggle,
  .actions[open] .role-box {
    grid-column: 1 / -1;
  }
  .actions > button,
  .role-box,
  .role-box select {
    width: 100%;
  }
  .view { padding: 16px 18px 28px; }
  .simulation-status {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .simulation-status select,
  .simulation-status button { width: 100%; }
  .home-hero {
    align-items: stretch;
    flex-direction: column;
  }
  .home-identity-context button { margin-left: 0; }
  .home-quick-actions { justify-content: flex-start; }
  .home-grid { grid-template-columns: 1fr; }
  .role-action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two,
  .three,
  .order-summary,
  .compact-fields,
  .compact-flow,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .customer-detail-group .compact-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }
  .toolbar,
  .inventory-filters,
  .toolbar input,
  .toolbar select {
    width: 100%;
  }
  .inline-filter {
    flex-basis: 100%;
    width: 100%;
  }
  .compact-toolbar input,
  .compact-toolbar select,
  .compact-toolbar .inline-filter {
    flex: 1 1 100%;
  }
  .reconciliation-toolbar select,
  .reconciliation-toolbar input { min-width: 0; }
  .reconciliation-protection { grid-template-columns: 1fr; gap: 4px; }
  .reconciliation-period-grid { grid-template-columns: 1fr; }
  .reconciliation-difference-table { display: none; }
  .reconciliation-difference-cards { display: grid; gap: 10px; }
  .reconciliation-difference-card {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
  }
  .reconciliation-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
  }
  .reconciliation-card-head strong { overflow-wrap: anywhere; }
  .reconciliation-difference-card > span { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
  .reconciliation-difference-card dl,
  .reconciliation-detail-grid,
  .reconciliation-comparison > div { grid-template-columns: 1fr; }
  .reconciliation-difference-card button { width: 100%; }
  .filter-panel {
    width: 100%;
  }
  .filter-panel summary {
    width: 100%;
    justify-content: center;
    min-height: 40px;
  }
  .filter-panel-grid {
    grid-template-columns: 1fr;
  }
  .list-summary {
    align-items: flex-start;
    flex-direction: column;
  }
  .pagination {
    justify-content: stretch;
  }
  .pagination-info,
  .pager-size,
  .pager-jump,
  .pager-actions {
    width: 100%;
  }
  .pager-size select,
  .pager-jump input {
    flex: 1 1 auto;
    width: auto;
  }
  .pager-actions button {
    flex: 1 1 0;
  }
  .payments-table {
    display: none;
  }
  .payments-card-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }
  #customersTable {
    display: none;
  }
  .customers-card-list {
    display: grid;
    gap: 10px;
  }
  #ordersTable {
    display: none;
  }
  .orders-card-list {
    display: grid;
    gap: 10px;
  }
  .settings-user-table {
    display: none;
  }
  .settings-user-group-table {
    display: none;
  }
  .settings-user-cards {
    display: grid;
    gap: 10px;
  }
  .settings-user-group-cards {
    display: grid;
    gap: 10px;
  }
  .settings-user-group-card {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
  }
  .user-group-card-title {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
  }
  .user-group-card-title > div { min-width: 0; display: grid; gap: 3px; }
  .settings-user-group-card dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
  }
  .settings-user-group-card dt { color: var(--muted); font-size: 11px; }
  .settings-user-group-card dd { margin: 2px 0 0; font-size: 13px; font-weight: 650; }
  .settings-user-group-card p { margin: 0; color: var(--muted-strong); font-size: 12px; }
  .permission-editor-header { align-items: stretch; flex-direction: column; }
  .permission-editor-header input { width: 100%; }
  .permission-row {
    grid-template-columns: 24px minmax(0, 1fr);
    min-height: 68px;
    padding: 10px 12px;
  }
  .permission-state,
  .permission-risk { grid-column: 2; }
  .permission-state { margin-top: 2px; }
  .permission-risk { display: none; }
  .permission-module-toolbar { justify-content: flex-start; overflow-x: auto; }
  .permission-module-toolbar button { min-height: 44px; flex: 0 0 auto; }
  .settings-user-card {
    display: grid;
    gap: 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 12px;
    box-shadow: var(--shadow-sm);
  }
  .settings-user-card strong,
  .settings-user-card span {
    overflow-wrap: anywhere;
  }
  .settings-user-card > div:first-child {
    display: grid;
    gap: 2px;
  }
  .settings-user-card > div:first-child span {
    color: var(--muted);
    font-size: 12px;
  }
  .settings-user-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    color: var(--muted-strong);
    font-size: 12px;
  }
  .settings-user-card button {
    width: 100%;
  }
  .settings-user-card .inline-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .payment-card,
  .customer-card,
  .order-card,
  .empty-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 12px;
    box-shadow: var(--shadow-sm);
  }
  .payment-card .text-link,
  .customer-card .text-link,
  .order-card .text-link {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    border-radius: 6px;
    padding: 4px 0;
  }
  .payment-card-head,
  .customer-card-head,
  .order-card-head,
  .payment-card-links,
  .customer-card-note,
  .payment-card-note {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    justify-content: space-between;
  }
  .payment-card-head span,
  .customer-card-note span,
  .order-card-head span,
  .payment-card-note span {
    color: var(--muted);
    font-size: 12px;
  }
  .customer-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 8px 0 10px;
  }
  .customer-card-grid div {
    min-width: 0;
    border-top: 1px solid var(--line);
    padding-top: 7px;
  }
  .customer-card-grid dt {
    color: var(--muted);
    font-size: 11px;
  }
  .customer-card-grid dd {
    margin: 2px 0 0;
    overflow-wrap: anywhere;
  }
  .customer-card-note {
    flex-direction: column;
    border-top: 1px solid var(--line);
    padding-top: 8px;
  }
  .order-card-meta {
    display: grid;
    gap: 2px;
    margin: 8px 0 10px;
  }
  .order-card-meta strong {
    overflow-wrap: anywhere;
    font-size: 16px;
  }
  .order-card-meta span {
    color: var(--muted);
    font-size: 12px;
  }
  .payment-card-amount {
    display: grid;
    gap: 2px;
    margin: 8px 0 10px;
  }
  .payment-card-amount strong {
    font-size: 20px;
    line-height: 1.2;
  }
  .payment-card-amount span {
    color: var(--muted);
    font-size: 12px;
  }
  .payment-card-links {
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-bottom: 10px;
  }
  .payment-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 10px;
  }
  .order-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
  }
  .payment-card-grid div {
    min-width: 0;
    border-top: 1px solid var(--line);
    padding-top: 7px;
  }
  .order-card-grid div {
    min-width: 0;
    border-top: 1px solid var(--line);
    padding-top: 7px;
  }
  .payment-card-grid dt {
    color: var(--muted);
    font-size: 11px;
  }
  .order-card-grid dt {
    color: var(--muted);
    font-size: 11px;
  }
  .payment-card-grid dd {
    margin: 2px 0 0;
    overflow-wrap: anywhere;
  }
  .order-card-grid dd {
    margin: 2px 0 0;
    overflow-wrap: anywhere;
  }
  .order-card-grid dd span {
    display: block;
    color: var(--muted);
    font-size: 12px;
  }
  .payment-card-note {
    flex-direction: column;
    border-top: 1px solid var(--line);
    padding-top: 8px;
  }
  .payment-card-action {
    margin-top: 10px;
  }
  .payment-card-action select {
    width: 100%;
  }
  .drawer-panel {
    width: calc(100vw - 18px);
    padding: 0 18px 18px;
  }
  .drawer-head {
    margin: 0 -18px 16px;
    padding: 24px 18px 12px;
  }
  table { min-width: 760px; }
}

@media (min-width: 521px) and (max-width: 860px) {
  .order-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .order-form-section { padding: 14px; }
  .form-section-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
  .product-row-actions { justify-content: flex-start; }
  .product-lines .table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }
  .line-table,
  .line-table tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }
  .line-table thead { display: none; }
  .line-table tbody { display: grid; gap: 10px; }
  .line-table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }
  .line-table td {
    display: grid;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
  }
  .line-table td::before {
    content: attr(data-label);
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
  }
  .line-table td:nth-child(1),
  .line-table td:nth-child(2),
  .line-table td:nth-child(3),
  .line-table td:nth-child(7),
  .line-table td:nth-child(8) { grid-column: 1 / -1; }
  .line-table .product-lookup,
  .line-table .sku,
  .line-table .product-name { min-width: 0; }
  .product-row-status { min-width: 0; }
  .product-row.selected td { background: transparent; }
  .product-row.selected { border-color: #99f6e4; background: #f0fdfa; }
}

@media (max-width: 520px) {
  body { font-size: 13px; }
  button,
  input,
  select,
  textarea {
    min-height: 44px;
  }
  button.small { min-height: 38px; }
  .password-change-gate { padding: 12px; }
  .password-change-panel {
    width: 100%;
    max-height: calc(100dvh - 24px);
    padding: 18px 16px;
  }
  .password-change-panel h2 { font-size: 18px; }
  .password-change-form .button-row { display: grid; grid-template-columns: 1fr; }
  .order-create-form { gap: 12px; padding-bottom: 84px; }
  .order-form-section { padding: 13px; }
  .form-section-heading h2 { font-size: 15px; }
  .customer-create-toggle { align-items: flex-start; flex-direction: column; }
  .product-row-actions { width: 100%; }
  .product-row-actions button,
  .count-badge { flex: 1 1 auto; justify-content: center; }
  .line-table tr { grid-template-columns: 1fr; }
  .line-table td { grid-column: 1 / -1 !important; }
  .order-create-save-bar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 34;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.98);
  }
  .order-create-save-bar strong { font-size: 12px; }
  .order-create-save-bar span { display: none; }
  .order-create-save-bar button { min-width: 112px; }
  .sidebar {
    grid-template-columns: repeat(2, minmax(136px, 1fr));
  }
  .sidebar .nav-sub { display: none; }
  .settings-mobile-nav {
    display: grid;
    gap: 6px;
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }
  .settings-mobile-nav select { width: 100%; min-height: 44px; }
  .brand-mark {
    width: 34px;
    height: 34px;
  }
  .topbar,
  .view {
    padding-left: 14px;
    padding-right: 14px;
  }
  .topbar {
    padding-top: 12px;
    padding-bottom: 10px;
  }
  .topbar h1 {
    font-size: 20px;
  }
  .topbar p {
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.35;
  }
  .runtime-environment {
    width: 100%;
    margin-top: 8px;
  }
  .actions[open] {
    grid-template-columns: 1fr;
  }
  .kpis { grid-template-columns: 1fr; }
  .home-hero h2 { font-size: 21px; }
  .home-quick-actions { display: grid; grid-template-columns: 1fr; }
  .home-quick-actions button { width: 100%; }
  .home-identity-context {
    align-items: stretch;
    display: grid;
  }
  .home-identity-context button { width: 100%; min-height: 42px; }
  .home-panel,
  .home-admin-overview,
  .target-settings-panel { padding: 13px; }
  .target-progress dl,
  .admin-overview-metrics { grid-template-columns: 1fr; }
  .target-settings-panel { align-items: stretch; flex-direction: column; }
  .target-settings-panel button { width: 100%; }
  .role-action-grid { grid-template-columns: 1fr; }
  .target-batch-row { grid-template-columns: 1fr; gap: 5px; }
  .card { padding: 14px; }
  .metric-value { font-size: 22px; }
  .dashboard-controls,
  .dashboard-custom-range {
    display: grid;
    grid-template-columns: 1fr;
  }
  .segmented {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dashboard-custom-range input {
    width: 100%;
  }
  .range-chip {
    justify-content: stretch;
  }
  .dashboard-scope-note {
    display: grid;
  }
  th,
  td {
    padding: 9px 10px;
  }
  .compact-select,
  .payment-status-select {
    min-height: 44px;
  }
  .drawer {
    background: rgba(17, 24, 39, 0.5);
  }
  .drawer-panel {
    width: 100vw;
    height: 100dvh;
    padding: 0 16px 16px;
  }
  .drawer-head {
    margin: 0 -16px 16px;
    padding: 24px 16px 12px;
  }
  .drawer-head h2 { font-size: 18px; }
  .drawer-identity { gap: 4px; font-size: 11px; }
  .drawer-identity span,
  .drawer-identity strong { width: 100%; padding: 3px 6px; }
  .customer-id-strip { display: grid; grid-template-columns: 1fr; }
  .customer-id-strip .copy-meta { width: 100%; }
  .customer-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .customer-summary > div,
  .customer-identity-facts > div,
  .customer-risk-grid > div { padding: 10px; }
  .customer-identity-facts,
  .customer-risk-grid { grid-template-columns: 1fr; }
  .customer-health-strip {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 6px;
  }
  .customer-health-strip .badge { width: fit-content; }
  .customer-detail-group .compact-fields { grid-template-columns: 1fr; }
  .customer-detail-table { display: none; }
  .customer-detail-mobile-list {
    display: grid;
    gap: 10px;
  }
  .customer-order-cards .mobile-detail-card p {
    display: grid;
    gap: 5px;
  }
  .customer-order-reference { align-items: center; }
  .customer-followup-cards .button-row { margin-bottom: 0; }
  .customer-ownership-summary {
    align-items: flex-start;
    flex-direction: column;
  }
  .order-detail-body {
    padding-bottom: 78px;
  }
  .order-id-strip {
    display: grid;
    grid-template-columns: 1fr;
  }
  .copy-meta {
    align-items: flex-start;
  }
  .copy-meta strong {
    max-width: none;
    white-space: normal;
  }
  .section-chips {
    position: static;
    top: auto;
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
  }
  .next-action-panel {
    gap: 10px;
  }
  .next-action-buttons {
    grid-template-columns: 1fr;
  }
  .next-action-facts { display: grid; gap: 3px; }
  .next-action-facts span + span { padding-left: 0; border-left: 0; }
  .order-detail-group .compact-fields { grid-template-columns: 1fr; }
  .detail-group-head { align-items: flex-start; flex-direction: column; gap: 3px; }
  .detail-group-head span { text-align: left; }
  .order-product-table,
  .order-payments-table,
  .inventory-impact-table {
    display: none;
  }
  .order-mobile-cards {
    display: grid;
    gap: 10px;
  }
  .order-mobile-action-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.97);
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    box-shadow: 0 -10px 28px rgba(15, 23, 42, 0.12);
  }
  .order-mobile-action-bar span {
    min-width: 0;
    color: var(--muted-strong);
    font-size: 12px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .order-mobile-action-bar button {
    min-width: 132px;
  }
  .skeleton-grid {
    grid-template-columns: 1fr;
  }
  .bar-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }
  .option-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .warehouse-inventory-table table {
    min-width: 100%;
    table-layout: fixed;
  }
  .warehouse-inventory-table th,
  .warehouse-inventory-table td {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .warehouse-inventory-table,
  .warehouse-log-table,
  .settings-option-table,
  .customer-value-rules-table,
  .settings-warehouse-table,
  .settings-product-table {
    display: none;
  }
  .inventory-item-cards,
  .inventory-log-cards,
  .settings-option-cards,
  .settings-warehouse-cards,
  .settings-product-cards {
    display: grid;
    gap: 9px;
  }
  .inventory-item-card,
  .inventory-log-card,
  .settings-option-card,
  .settings-warehouse-card,
  .settings-product-card {
    display: grid;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--panel-soft);
    padding: 11px;
  }
  .inventory-item-card > div,
  .inventory-log-card > div,
  .settings-option-card > div,
  .settings-warehouse-card > div,
  .settings-product-card > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  .inventory-item-card p,
  .inventory-log-card p,
  .settings-option-card p,
  .settings-warehouse-card p,
  .settings-product-card p { margin: 0; color: var(--muted-strong); overflow-wrap: anywhere; }
  .inventory-item-card > span,
  .settings-product-card small,
  .inventory-log-card small { color: var(--muted); overflow-wrap: anywhere; }
  .inventory-log-card dl,
  .settings-warehouse-card dl,
  .settings-product-card dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin: 2px 0 0;
  }
  .inventory-log-card dl > div:last-child,
  .settings-warehouse-card dl > div:last-child { grid-column: 1 / -1; }
  .inventory-log-card dt,
  .settings-warehouse-card dt,
  .settings-product-card dt { color: var(--muted); font-size: 11px; }
  .inventory-log-card dd,
  .settings-warehouse-card dd,
  .settings-product-card dd { margin: 1px 0 0; color: var(--ink); overflow-wrap: anywhere; }
  .warehouse-log summary { min-height: 44px; }
  .warehouse-log summary span { display: none; }
  .settings-split {
    grid-template-columns: 1fr;
  }
  .settings-inner-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .settings-filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .settings-audit-filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-audit-filter-bar label:first-child { grid-column: 1 / -1; }
  .settings-filter-bar label:first-child {
    grid-column: 1 / -1;
  }
  .settings-filter-bar button {
    width: 100%;
  }
}

/* Phase 1 design system: shell, shared states, home and order list. */
[data-lucide] { width: 17px; height: 17px; flex: 0 0 auto; }
button > [data-lucide], .text-button > [data-lucide] { pointer-events: none; }
.hidden { display: none !important; }
.mobile-appbar { display: none; }
.icon-button {
  display: inline-flex;
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--muted-strong);
  padding: 0;
  box-shadow: none;
}
.icon-button:hover { border-color: var(--line-strong); background: var(--panel-soft); color: var(--ink); }
.text-button {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: var(--brand);
  padding: 4px;
  box-shadow: none;
}
.text-button:hover { background: transparent; color: var(--brand-strong); }

.sidebar { width: 220px; padding: 16px 12px 12px; z-index: 20; }
.app { margin-left: 220px; transition: margin-left .18s ease; }
.brand { margin-bottom: 14px; padding: 7px 8px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark { display: none; width: 34px; height: 34px; border-radius: 8px; background: #fff; color: var(--nav); font-size: 12px; }
.brand-lockup { min-width: 0; width: 100%; }
.brand-logo-compact,
.mobile-brand-logo { display: none; }
.brand-logo {
  display: block;
  width: min(184px, 100%);
  height: auto;
  aspect-ratio: 894 / 174;
  object-fit: contain;
  object-position: left center;
}
.brand-lockup span { margin-top: 4px; padding-left: 2px; }
.brand span { margin-top: 2px; color: #8f9aa8; font-size: 11px; }
.nav { gap: 10px; min-height: 40px; border-radius: 7px; color: #b9c1cb; padding: 8px 10px; font-weight: 560; }
.nav [data-lucide] { width: 18px; height: 18px; color: #8f9aa8; }
.nav.active { border-color: transparent; background: #17263a; color: #fff; box-shadow: inset 3px 0 0 var(--brand); }
.nav.active [data-lucide] { color: #9ec5ff; }
.nav:hover { background: #111d2d; }
.nav-sub { min-height: 32px; margin-left: 28px; width: calc(100% - 28px); padding: 6px 9px; font-size: 12px; }
.nav-sub::before { display: none; }
.nav-sub.active { border-color: transparent; background: rgba(255,255,255,.07); box-shadow: none; }
.sidebar-collapse {
  display: flex;
  width: 100%;
  min-height: 36px;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  border: 0;
  background: transparent;
  color: #8f9aa8;
  padding: 8px 10px;
  box-shadow: none;
}
.sidebar-collapse:hover { background: #111d2d; color: #fff; }
.sidebar-collapsed .sidebar { width: 72px; }
.sidebar-collapsed .app { margin-left: 72px; }
.sidebar-collapsed .brand > div:last-child,
.sidebar-collapsed .nav span,
.sidebar-collapsed .nav-sub,
.sidebar-collapsed .sidebar-collapse span { display: none; }
.sidebar-collapsed .brand, .sidebar-collapsed .nav, .sidebar-collapsed .sidebar-collapse { justify-content: center; }
.sidebar-collapsed .brand-mark { display: none; }
.sidebar-collapsed .brand-logo-compact {
  display: block;
  width: 48px;
  height: 28px;
  object-fit: contain;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  gap: 10px 20px;
  padding: 16px 24px 12px;
  background: rgba(245,247,248,.97);
  backdrop-filter: blur(10px);
}
.page-header h1, .topbar h1 { font-size: 22px; font-weight: 720; }
.page-header p, .topbar p { margin-top: 3px; font-size: 12px; }
.header-workspace { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.page-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }
.page-actions button { display: inline-flex; align-items: center; gap: 7px; }
.global-order-search { position: relative; width: min(320px, 24vw); }
.global-order-search > [data-lucide] { position: absolute; top: 10px; left: 10px; z-index: 1; color: var(--muted); }
.global-order-search input { min-height: 36px; padding-left: 34px; border-radius: var(--radius-sm); background: var(--panel); }
.user-identity-bar { display: flex; min-height: 38px; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); padding: 3px 5px 3px 8px; }
#roleHint { display: block; }
.identity-segment { display: grid; grid-template-columns: auto auto; gap: 0 6px; align-items: center; min-width: 0; }
.identity-segment small { grid-row: 1 / 3; color: var(--muted); font-size: 10px; writing-mode: horizontal-tb; }
.identity-segment strong { color: var(--ink); font-size: 12px; line-height: 1.2; }
.identity-segment > span { color: var(--muted); font-size: 10px; line-height: 1.2; }
.identity-segment.effective { padding-left: 7px; border-left: 1px solid var(--line); }
.runtime-environment { width: auto; max-width: 150px; min-height: auto; gap: 5px; margin: 0; border: 0; border-radius: 5px; background: transparent !important; padding: 3px 5px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.runtime-environment [data-lucide] { width: 13px; height: 13px; }
.simulation-control { display: flex; align-items: center; }
.simulation-status { display: flex; align-items: center; gap: 5px; }
.simulation-status select { width: 130px; min-height: 30px; border-color: transparent; background: var(--panel-soft); padding: 4px 24px 4px 7px; font-size: 11px; }
.simulation-status .text-button { min-height: 28px; font-size: 11px; }
.account-menu { position: relative; }
.account-menu summary { list-style: none; gap: 0; }
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu summary [data-lucide]:last-child { width: 12px; height: 12px; margin-left: -2px; }
.account-menu-popover { position: absolute; top: 42px; right: 0; z-index: 30; display: grid; width: 180px; gap: 4px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--panel); padding: 6px; box-shadow: var(--shadow-md); }
.account-menu-popover button { justify-content: flex-start; width: 100%; border-color: transparent; box-shadow: none; text-align: left; }

.view { padding: 20px 24px 36px; }
.home-hero { align-items: flex-end; min-height: 62px; margin-bottom: 14px; border: 0; background: transparent; padding: 0; box-shadow: none; }
.home-hero h2 { font-size: 22px; font-weight: 720; }
.home-hero p { max-width: 760px; }
.home-generated { color: var(--muted); font-size: 11px; }
.home-grid { gap: 12px; margin-bottom: 12px; }
.home-grid-priority { grid-template-columns: minmax(0, 1.75fr) minmax(260px, .7fr); }
.home-grid-secondary { grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); }
.home-grid-tertiary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.home-panel { border-radius: var(--radius-md); padding: 14px; box-shadow: none; }
.priority-panel { border-top: 3px solid var(--brand); padding: 16px; }
.priority-panel .section-title h2 { font-size: 18px; }
.role-action-list { display: grid; }
.role-action-row { display: grid; grid-template-columns: 28px 34px minmax(0,1fr) auto auto; align-items: center; gap: 10px; min-width: 0; border-top: 1px solid var(--line); padding: 11px 2px; }
.role-action-row:first-child { border-top: 0; }
.role-action-row.actionable { cursor: pointer; }
.role-action-row.actionable:hover { background: var(--panel-soft); }
.role-action-row:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.role-action-index { color: #9aa3ae; font-size: 11px; font-variant-numeric: tabular-nums; }
.role-action-icon { display: grid; width: 32px; height: 32px; place-items: center; border: 1px solid var(--line); border-radius: 8px; color: var(--muted-strong); background: #fff; }
.role-action-row.is-exception .role-action-icon { color: var(--warn); }
.role-action-copy { min-width: 0; }
.role-action-copy h3 { margin: 0; font-size: 13px; }
.role-action-copy p, .role-action-copy span { display: block; margin: 2px 0 0; overflow-wrap: anywhere; color: var(--muted); font-size: 11px; }
.role-action-count { color: var(--ink); font-size: 20px; font-variant-numeric: tabular-nums; }
.role-action-cta { display: inline-flex; align-items: center; gap: 4px; color: var(--brand); font-size: 12px; font-weight: 650; white-space: nowrap; }
.role-action-cta [data-lucide] { width: 14px; height: 14px; }
.home-quick-actions { display: grid; grid-template-columns: 1fr; gap: 0; }
.home-shortcut { display: flex; width: 100%; min-height: 38px; align-items: center; justify-content: flex-start; gap: 8px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--ink); padding: 8px 2px; box-shadow: none; }
.home-shortcut:first-child { border-top: 0; }
.home-shortcut:hover { background: var(--panel-soft); color: var(--brand); }
.home-admin-overview { display: grid; grid-template-columns: minmax(150px,.7fr) minmax(0,2fr) auto; align-items: center; gap: 14px; margin-top: 0; border-radius: var(--radius-md); padding: 10px 14px; box-shadow: none; }
.home-admin-overview > div:first-child { display: grid; }
.home-admin-overview > div:first-child span { color: var(--muted); font-size: 11px; }
.admin-overview-metrics { grid-template-columns: repeat(4,minmax(0,1fr)); }

.order-workbench { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--panel); margin-bottom: 12px; }
.quick-filter-bar { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line); padding: 8px 10px 0; scrollbar-width: thin; }
.quick-filter { min-height: 34px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--muted-strong); padding: 6px 12px 8px; box-shadow: none; white-space: nowrap; }
.quick-filter:hover { background: var(--panel-soft); color: var(--ink); }
.quick-filter.active { border-bottom-color: var(--brand); background: transparent; color: var(--brand); }
.page-toolbar { display: grid; grid-template-columns: auto minmax(260px,1fr) 150px 150px auto; align-items: center; gap: 8px; padding: 10px; }
.toolbar-search { position: relative; }
.toolbar-search [data-lucide] { position: absolute; top: 10px; left: 10px; z-index: 1; color: var(--muted); }
.toolbar-search input { padding-left: 34px; }
.page-toolbar input, .page-toolbar select { min-height: 36px; }
.filter-panel summary { display: inline-flex; min-height: 36px; align-items: center; gap: 6px; border-radius: var(--radius-sm); }
.active-filter-chips { display: flex; min-height: 42px; align-items: center; flex-wrap: wrap; gap: 6px; border-top: 1px solid var(--line); padding: 7px 10px; }
.active-filter-label, .active-filter-empty { color: var(--muted); font-size: 11px; }
.filter-chip { display: inline-flex; min-height: 28px; align-items: center; gap: 5px; border: 1px solid #b9cbe2; border-radius: 999px; background: #f7faff; color: #294f7c; padding: 3px 8px; box-shadow: none; font-size: 11px; }
.filter-chip:hover { background: #edf4fd; color: var(--brand-strong); }
.filter-chip [data-lucide] { width: 12px; height: 12px; }
.clear-filters { min-height: 28px; border: 0; background: transparent; color: var(--muted); padding: 3px 6px; box-shadow: none; font-size: 11px; }
.clear-filters:hover { background: transparent; color: var(--bad); }
.orders-table table { min-width: 1120px; }
.orders-table th:nth-child(1) { width: 150px; }
.orders-table th:nth-child(2) { width: 190px; }
.orders-table th:nth-child(3) { width: 120px; }
.orders-table th:nth-child(4) { width: 130px; }
.orders-table th:nth-child(8) { width: 170px; }
.orders-table th:nth-child(9) { width: 150px; }
.order-id-cell, .order-customer-cell { display: grid; min-width: 0; gap: 2px; }
.order-id-cell span, .order-customer-cell span { color: var(--muted); font-size: 11px; }
.order-customer-cell strong { overflow-wrap: anywhere; }
.system-reference { color: var(--ink); }
.system-reference strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.system-reference span, .system-reference small { display: block; color: var(--muted); font-size: 11px; }
.human-judgement { display: grid; justify-items: start; gap: 3px; }
.human-judgement small { color: var(--muted); font-size: 10px; }
.row-actions { display: flex; align-items: center; gap: 5px; }
.row-actions details { position: relative; }
.row-actions summary { list-style: none; }
.row-actions summary::-webkit-details-marker { display: none; }
.row-actions details > div { position: absolute; top: 36px; right: 0; z-index: 12; width: 140px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); padding: 5px; box-shadow: var(--shadow-md); }
.row-actions details > div button { width: 100%; min-height: 32px; border: 0; background: transparent; color: var(--ink); padding: 6px 8px; box-shadow: none; text-align: left; }
.mobile-row-actions { display: none; }
.order-card-details { margin-top: 9px; border-top: 1px solid var(--line); padding-top: 7px; }
.order-card-details summary { display: flex; min-height: 36px; align-items: center; justify-content: space-between; color: var(--muted-strong); cursor: pointer; list-style: none; }
.order-card-details summary::-webkit-details-marker { display: none; }
.order-card-details dl { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; margin: 5px 0 0; }
.order-card-details dt { color: var(--muted); font-size: 10px; }
.order-card-details dd { margin: 1px 0 0; overflow-wrap: anywhere; }
.state-panel { display: flex; min-height: 96px; align-items: center; justify-content: center; gap: 12px; border: 1px dashed var(--line-strong); border-radius: var(--radius-md); background: var(--panel); padding: 18px; color: var(--muted); }
.state-panel > div { display: grid; gap: 2px; }
.state-panel strong { color: var(--ink); }
.state-panel span { font-size: 12px; }
.state-panel.loading [data-lucide] { animation: ui-spin .9s linear infinite; }
.state-panel.error { border-color: #e8b7b7; background: #fffafa; color: var(--bad); }
@keyframes ui-spin { to { transform: rotate(360deg); } }

.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 120; display: grid; width: min(360px, calc(100vw - 28px)); gap: 8px; }
.toast { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 9px; border: 1px solid var(--line); border-left: 3px solid var(--ok); border-radius: var(--radius-sm); background: var(--panel); padding: 9px 10px; box-shadow: var(--shadow-md); }
.toast.error { border-left-color: var(--bad); }
.toast.warning { border-left-color: var(--warn); }
.toast .icon-button { width: 28px; min-width: 28px; min-height: 28px; border: 0; }
.confirm-dialog { position: fixed; inset: 0; z-index: 110; display: grid; place-items: center; padding: 16px; background: rgba(22,29,37,.5); }
.confirm-dialog-panel { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 12px; width: min(430px,100%); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); padding: 18px; box-shadow: var(--shadow-md); }
.confirm-dialog-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 50%; background: #fff2f2; color: var(--bad); }
.confirm-dialog-panel h2 { margin: 0; font-size: 17px; }
.confirm-dialog-panel p { margin: 5px 0 0; color: var(--muted); }
.confirm-dialog-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
body.confirm-dialog-open { overflow: hidden; }

@media (max-width: 1180px) {
  .header-workspace { flex-wrap: wrap; }
  .global-order-search { width: 240px; }
  .home-grid-priority, .home-grid-secondary { grid-template-columns: 1fr; }
  .home-grid-tertiary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .page-toolbar { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .page-toolbar .toolbar-search { grid-column: 1 / -1; }
}

@media (max-width: 860px) {
  .mobile-appbar { position: sticky; top: 0; z-index: 25; display: grid; grid-template-columns: 44px 1fr auto; min-height: 52px; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); background: var(--panel); padding: 6px 10px; }
  .mobile-appbar > div { display: flex; gap: 4px; }
  .mobile-brand-logo {
    display: block;
    width: 104px;
    height: 34px;
    justify-self: start;
    object-fit: contain;
  }
  .sidebar { position: fixed; inset: 0 auto 0 0; display: block; width: 240px; transform: translateX(-102%); transition: transform .18s ease; box-shadow: var(--shadow-md); }
  body.mobile-nav-open { overflow: hidden; }
  body.mobile-nav-open .sidebar { transform: translateX(0); }
  body.mobile-nav-open::after { content: ""; position: fixed; inset: 0; z-index: 15; background: rgba(22,29,37,.42); }
  .sidebar .brand { display: flex; }
  .sidebar .brand-mark { display: none; }
  .sidebar .brand-lockup { display: none; }
  .sidebar .brand-logo-compact {
    display: block;
    width: 176px;
    height: 58px;
    object-fit: contain;
  }
  .sidebar .nav { display: flex; justify-content: flex-start; }
  .sidebar .nav-sub { display: flex; }
  .sidebar-collapse { display: none; }
  .app, .sidebar-collapsed .app { margin-left: 0; }
  .topbar { position: sticky; top: 52px; grid-template-columns: 1fr; gap: 8px; padding: 12px 16px 10px; }
  .header-workspace { justify-content: flex-start; }
  .global-order-search, .desktop-notification, .account-menu { display: none; }
  .account-menu[open] {
    position: fixed;
    top: 48px;
    right: 12px;
    z-index: 90;
    display: block;
  }
  .account-menu[open] > summary { display: none; }
  .account-menu[open] .account-menu-popover {
    position: static;
    width: min(220px, calc(100vw - 24px));
  }
  .user-identity-bar { width: 100%; justify-content: space-between; overflow: visible; }
  .runtime-environment { margin-left: auto; }
  .simulation-status select { max-width: 132px; }
  .file-picker-control { grid-template-columns: 1fr; }
  .file-picker-control .file-clear { width: 100%; min-height: 44px; }
  .page-actions { grid-column: 1; justify-content: stretch; }
  .page-actions button { flex: 1 1 0; justify-content: center; }
  .view { padding: 14px 16px 28px; }
  .home-grid-tertiary { grid-template-columns: 1fr; }
  .home-admin-overview { grid-template-columns: 1fr; align-items: start; }
  .admin-overview-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); width: 100%; }
  .page-toolbar { grid-template-columns: 1fr 1fr; }
  .page-toolbar .toolbar-search, .page-toolbar .filter-panel { grid-column: 1 / -1; }
  .page-toolbar .filter-panel, .page-toolbar .filter-panel summary { width: 100%; }
  .orders-table { display: none; }
  .orders-card-list { display: grid; }
  .order-card { padding: 13px; box-shadow: none; }
  .order-card-head > div { display: grid; gap: 2px; }
  .order-card-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
  .order-card-grid { margin-top: 10px; }
  .mobile-row-actions { display: flex; justify-content: flex-end; margin-top: 9px; }
}

@media (max-width: 520px) {
  .topbar { padding-left: 14px; padding-right: 14px; }
  .page-header h1, .topbar h1 { font-size: 19px; }
  .header-workspace { min-width: 0; }
  .user-identity-bar { align-items: flex-start; flex-wrap: wrap; gap: 5px; }
  .runtime-environment { order: 3; width: 100%; max-width: none; border-top: 1px solid var(--line); padding-top: 4px; }
  .simulation-control { max-width: 100%; }
  .simulation-status { flex-wrap: wrap; }
  .simulation-status .identity-segment { flex: 1 1 auto; }
  .home-hero { align-items: flex-start; flex-direction: column; gap: 4px; min-height: auto; }
  .priority-panel { padding: 13px; }
  .role-action-row { grid-template-columns: 24px 32px minmax(0,1fr) auto; gap: 7px; }
  .role-action-cta { grid-column: 3 / -1; justify-self: start; }
  .role-action-empty { display: none; }
  .page-toolbar { grid-template-columns: 1fr; }
  .page-toolbar .toolbar-search, .page-toolbar .filter-panel { grid-column: 1; }
  .quick-filter-bar { padding-left: 7px; padding-right: 7px; }
  .quick-filter { padding-left: 10px; padding-right: 10px; }
  .active-filter-chips { align-items: flex-start; }
  .active-filter-label, .active-filter-empty { width: 100%; }
  .order-card-head { align-items: flex-start; }
  .order-card-grid, .order-card-details dl { grid-template-columns: 1fr 1fr; }
  .order-card-grid .system-reference, .order-card-grid .human-judgement { min-height: 68px; }
  .pagination { border-radius: var(--radius-sm); background: var(--panel); padding: 10px; }
  .toast-region { right: 14px; bottom: 14px; }
}

@media (max-width: 860px) {
  body.order-detail-drawer-open .drawer-panel {
    width: 100vw;
  }
  body.order-detail-drawer-open #drawerBody {
    max-width: none;
  }
  .order-summary-context {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .order-identity-block { flex: 1 1 360px; }
  .order-detail-utility { margin-left: auto; }
  .order-summary-surface .order-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .order-summary-surface .order-summary > div {
    border-left: 0 !important;
    padding: 8px 10px 9px 0;
  }
  .order-summary-surface .order-summary > div:nth-child(even) {
    border-left: 1px solid var(--line) !important;
    padding-left: 14px;
  }
  .order-summary-surface .order-summary > div:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }
  .order-state-summary {
    grid-template-columns: 1fr;
  }
  .order-summary-group + .order-summary-group {
    border-top: 1px solid var(--line);
    border-left: 0;
    padding-top: 10px;
    padding-left: 0;
  }
  .order-detail-body .order-detail-group .compact-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .detail-disclosure > summary {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 12px 0;
  }
  .detail-disclosure > summary small {
    order: 2;
    width: calc(100% - 28px);
    margin-left: 0;
  }
  .detail-disclosure > summary::after {
    position: absolute;
    right: 16px;
  }
}

@media (max-width: 520px) {
  .confirm-dialog-details { grid-template-columns: 1fr; gap: 2px; }
  .confirm-dialog-details dd { margin-bottom: 7px; }
  .order-detail-utility {
    width: auto;
    margin-left: 0;
  }
  .order-detail-utility > button { flex: 0 0 auto; }
  .order-detail-more { flex: 0 0 auto; }
  .order-detail-more-menu {
    left: 0;
    right: auto;
    width: min(220px, calc(100vw - 32px));
  }
  .order-detail-body .order-id-strip { gap: 2px; }
  .order-detail-body .copy-meta + .copy-meta {
    border-top: 1px solid var(--line);
    border-left: 0;
    padding-top: 7px;
    padding-left: 0;
  }
  .order-summary-surface { padding-top: 10px; }
  .order-summary-surface .order-summary .order-total strong { font-size: 19px; }
  .order-state-summary { gap: 10px 12px; }
  .order-summary-group-content { gap: 10px; }
  body.order-detail-drawer-open .drawer-identity {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 3px 10px;
  }
  body.order-detail-drawer-open .drawer-identity span {
    grid-column: 1;
  }
  body.order-detail-drawer-open .drawer-identity strong {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    margin-left: 0;
  }
  .order-detail-body .order-detail-group .compact-fields {
    grid-template-columns: 1fr;
  }
  .order-detail-body .section-chips {
    margin-top: 6px;
  }
}

@media (max-width: 860px) {
  body.customer-detail-drawer-open .drawer-panel {
    width: 100vw;
  }
  body.customer-detail-drawer-open #drawerBody {
    max-width: none;
  }
  .customer-hero {
    grid-template-columns: 1fr;
  }
  .customer-next-action-panel {
    position: static;
  }
  .customer-overview-groups {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

@media (min-width: 861px) {
  body.customer-detail-drawer-open .drawer-panel {
    width: min(1020px, calc(100vw - 48px));
  }
  body.customer-detail-drawer-open #drawerBody {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
  }
}

@media (max-width: 520px) {
  body.customer-detail-drawer-open .drawer-identity {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 3px 10px;
    border: 1px solid #fed7aa;
    border-radius: var(--radius-sm);
    background: #fffaf3;
    padding: 7px 9px;
  }
  body.customer-detail-drawer-open .drawer-identity span,
  body.customer-detail-drawer-open .drawer-identity strong {
    width: auto;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
  }
  body.customer-detail-drawer-open .drawer-identity span { grid-column: 1; }
  body.customer-detail-drawer-open .drawer-identity strong {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
  }
  .customer-summary-header { padding-top: 8px; }
  .customer-detail-body .customer-id-strip { display: grid; grid-template-columns: 1fr; gap: 2px; }
  .customer-detail-body .customer-id-strip .copy-meta + .copy-meta {
    border-top: 1px solid var(--line);
    border-left: 0;
    padding-top: 7px;
    padding-left: 0;
  }
  .customer-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .customer-summary > div {
    border-left: 0 !important;
    padding: 8px 10px 9px 0;
  }
  .customer-summary > div:nth-child(even) {
    border-left: 1px solid var(--line) !important;
    padding-left: 12px;
  }
  .customer-summary > div:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .customer-identity-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .customer-identity-facts > div:nth-child(3n + 1) { padding-left: 10px; }
  .customer-identity-facts > div:nth-child(odd) { border-left: 0; padding-left: 0; }
  .customer-identity-facts > div:nth-child(even) { border-left: 1px solid var(--line); padding-left: 12px; }
  .customer-health-strip { display: flex; gap: 5px 10px; }
  .customer-detail-body .customer-section-chips {
    margin-right: -16px;
    margin-left: -16px;
    overflow-x: auto;
    padding-right: 16px;
    padding-left: 16px;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }
  .customer-detail-body .customer-section-chips button { flex: 0 0 auto; }
  .customer-detail-group .compact-fields { grid-template-columns: 1fr; }
  .customer-risk-grid { grid-template-columns: 1fr; }
  .customer-card-head > div { display: grid; min-width: 0; gap: 1px; }
  .customer-card-head > div > span { overflow-wrap: anywhere; }
  .customer-card-value dd { font-size: 16px; font-weight: 760; }
  .customer-card-value small { color: var(--muted); font-size: 11px; }
  .customer-card-note strong { overflow-wrap: anywhere; font-size: 13px; }
  .mobile-customer-row-actions { justify-content: flex-end; margin-top: 10px; }
  .mobile-customer-row-actions > button { min-width: 88px; }
}

/* Phase 3.1: customer identity continuity and tablet shell. */
.customer-list-identity small {
  color: #9aa3ad;
  font-size: 10px;
  font-weight: 500;
}
.customer-card-head > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  min-width: 0;
}
.customer-card-head .text-link {
  display: block;
  width: fit-content;
  max-width: 100%;
  min-height: 0;
  padding: 0;
  overflow-wrap: anywhere;
  text-align: left;
}
.customer-card-head > div > span {
  display: block;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.customer-card-head > .customer-owner-label {
  flex: 0 1 auto;
  max-width: 42%;
  overflow-wrap: anywhere;
  text-align: right;
}
.customer-next-action-panel.is-empty {
  position: static;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 14px;
  border-style: dashed;
  background: transparent;
  padding: 10px 12px;
}
.customer-next-action-panel.is-empty > div:first-child > strong {
  color: var(--muted-strong);
  font-size: 14px;
  font-weight: 680;
}
.customer-next-action-panel.is-empty .next-action-buttons {
  min-width: 132px;
}
.customer-next-action-panel.is-empty .next-action-buttons button {
  border-color: var(--line-strong);
  background: var(--panel);
  color: var(--brand);
}
.customer-next-action-panel.is-empty .section-hint {
  grid-column: 1 / -1;
  margin: 0;
}

@media (min-width: 861px) and (max-width: 1100px) {
  .mobile-appbar {
    position: sticky;
    top: 0;
    z-index: 25;
    display: grid;
    grid-template-columns: 44px 1fr auto;
    min-height: 52px;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
    padding: 6px 10px;
  }
  .mobile-appbar > div { display: flex; gap: 4px; }
  .sidebar,
  .sidebar-collapsed .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    display: block;
    width: 240px;
    transform: translateX(-102%);
    transition: transform .18s ease;
    box-shadow: var(--shadow-md);
  }
  body.mobile-nav-open { overflow: hidden; }
  body.mobile-nav-open .sidebar,
  body.mobile-nav-open.sidebar-collapsed .sidebar { transform: translateX(0); }
  body.mobile-nav-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 15;
    background: rgba(22,29,37,.42);
  }
  .sidebar .brand { display: flex; }
  .sidebar .brand > div:last-child { display: block; }
  .sidebar .nav { display: flex; justify-content: flex-start; }
  .sidebar .nav span { display: inline; }
  .sidebar .nav-sub { display: flex; }
  .sidebar-collapse { display: none; }
  .app,
  .sidebar-collapsed .app { margin-left: 0; }
  .topbar {
    position: sticky;
    top: 52px;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px 16px 10px;
  }
  .header-workspace { justify-content: flex-start; }
  .global-order-search,
  .desktop-notification,
  .account-menu { display: none; }
  .user-identity-bar { width: 100%; justify-content: space-between; overflow: visible; }
  .runtime-environment { margin-left: auto; }
}

@media (max-width: 860px) {
  .customer-card-head { align-items: flex-start; }
  .customer-card-grid dd,
  .customer-card-grid small,
  .customer-card-note strong { overflow-wrap: anywhere; word-break: normal; }
  .customer-card-details { color: var(--muted); }
}

@media (max-width: 520px) {
  .customer-next-action-panel.is-empty {
    grid-template-columns: 1fr;
  }
  .customer-next-action-panel.is-empty .next-action-buttons { min-width: 0; }
}

/* Phase 4: finance workbench and actionable todo queue. */
.payment-grouped-table table {
  min-width: 960px;
  table-layout: fixed;
}
.payment-grouped-table th:nth-child(1) { width: 24%; }
.payment-grouped-table th:nth-child(2) { width: 34%; }
.payment-grouped-table th:nth-child(3) { width: 42%; }
.payment-grouped-table th {
  border-bottom: 1px solid var(--line-strong);
  background: #f7f8fa;
  color: var(--muted-strong);
  font-size: 11px;
  letter-spacing: 0;
}
.payment-grouped-table th + th,
.payment-grouped-table td + td { border-left: 1px solid var(--line); }
.payment-grouped-table td {
  vertical-align: top;
  padding-top: 14px;
  padding-bottom: 14px;
  white-space: normal;
}
.payment-fact-group,
.payment-context-group,
.payment-finance-group { display: grid; min-width: 0; gap: 8px; }
.payment-fact-primary,
.payment-original-amount { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.payment-fact-primary strong { color: var(--ink); font-size: 18px; font-weight: 780; font-variant-numeric: tabular-nums; }
.payment-fact-primary span,
.payment-original-amount span,
.payment-oa-reference { color: var(--muted); font-size: 11px; }
.payment-original-amount strong { font-size: 13px; font-weight: 720; }
.payment-fact-group dl,
.payment-context-group dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 10px;
  margin: 0;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.payment-fact-group dt,
.payment-context-group dt,
.payment-card-status-grid dt,
.payment-card-details dt { color: var(--muted); font-size: 10px; }
.payment-fact-group dd,
.payment-context-group dd,
.payment-card-status-grid dd,
.payment-card-details dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.payment-fact-group dl > div:last-child { grid-column: 1 / -1; }
.payment-anomaly-flag {
  width: fit-content;
  color: var(--bad);
  font-size: 11px;
  font-weight: 680;
}
.payment-customer-link {
  width: fit-content;
  max-width: 100%;
  color: var(--ink);
  font-size: 14px;
  font-weight: 760;
  overflow-wrap: anywhere;
  text-align: left;
}
.payment-order-link {
  width: fit-content;
  max-width: 100%;
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
  text-align: left;
}
.payment-judgement-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.payment-judgement-line span { color: var(--muted); font-size: 10px; }
.payment-judgement-line strong { font-size: 12px; }
.payment-finance-group { grid-template-columns: minmax(120px, .8fr) minmax(150px, 1fr); gap: 10px 14px; }
.payment-finance-receipt,
.payment-finance-review,
.payment-finance-note { display: grid; min-width: 0; gap: 6px; }
.payment-finance-receipt > span,
.payment-finance-review > span,
.payment-finance-note > span { color: var(--muted); font-size: 10px; font-weight: 680; }
.payment-finance-review > div { display: grid; justify-items: start; gap: 7px; }
.payment-finance-review .compact-select { width: 100%; min-width: 0; }
.payment-finance-note { grid-column: 1 / -1; padding-top: 8px; border-top: 1px solid var(--line); }
.payment-finance-note p { margin: 0; color: var(--ink); line-height: 1.5; overflow-wrap: anywhere; }
.payment-finance-receipt .receipt-thumbnail { width: 100%; max-width: 150px; }

.payment-card-scan.missing-receipt,
.payment-card-scan.needs-review { border-left-width: 1px; }
.payment-card-primary { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.payment-card-primary > div { display: grid; min-width: 0; gap: 2px; }
.payment-card-primary strong { color: var(--ink); font-size: 20px; font-weight: 780; font-variant-numeric: tabular-nums; }
.payment-card-primary span,
.payment-card-primary time { color: var(--muted); font-size: 11px; }
.payment-card-context { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); }
.payment-card-context .payment-order-customer { gap: 4px; }
.payment-card-context .payment-order-customer button:first-child { order: 2; }
.payment-card-context .payment-order-customer > span { order: 3; }
.payment-card-context .payment-order-customer button:last-child { order: 1; color: var(--ink); font-size: 14px; font-weight: 750; }
.payment-card-review { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 9px; }
.payment-card-review > span { color: var(--muted); font-size: 11px; font-weight: 680; }
.payment-card-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 9px 0 0;
}
.payment-card-status-grid > div { min-width: 0; padding-top: 7px; border-top: 1px solid var(--line); }
.payment-card-status-grid > div:last-child { grid-column: 1 / -1; }
.payment-card-details { margin-top: 9px; border-top: 1px solid var(--line); padding-top: 7px; }
.payment-card-details summary { display: flex; min-height: 36px; align-items: center; justify-content: space-between; color: var(--muted-strong); cursor: pointer; list-style: none; }
.payment-card-details summary::-webkit-details-marker { display: none; }
.payment-card-details dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 10px; margin: 5px 0 0; }
.payment-card-details dl > div { min-width: 0; }
.payment-card-detail-note { grid-column: 1 / -1; }
.payment-card-detail-note dd { line-height: 1.5; overflow-wrap: anywhere; }

.page-leading-tools {
  display: flex;
  min-height: 36px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.page-leading-tools p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.page-leading-tools > button { flex: 0 0 auto; }

.mobile-scroll-tabs {
  overscroll-behavior-inline: contain;
  scroll-padding-inline: 12px;
  -webkit-overflow-scrolling: touch;
}

.todo-page-header { align-items: flex-end; }
.todo-filter-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  padding: 8px 10px 0;
  scrollbar-width: thin;
}
.todo-filter-bar button {
  display: inline-flex;
  min-height: 35px;
  align-items: center;
  gap: 7px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted-strong);
  padding: 6px 11px 8px;
  box-shadow: none;
  white-space: nowrap;
}
.todo-filter-bar button:hover { background: var(--panel-soft); color: var(--ink); }
.todo-filter-bar button.active { border-bottom-color: var(--brand); color: var(--brand); }
.todo-filter-bar button strong { min-width: 18px; color: inherit; font-size: 11px; text-align: center; }
.todo-list-summary { margin-bottom: 10px; }
.todo-queue {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
}
.todo-queue-item {
  display: grid;
  grid-template-columns: 116px minmax(120px, .8fr) minmax(220px, 1.6fr) 140px 120px 112px;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}
.todo-queue-item:first-child { border-top: 0; }
.todo-queue-item:hover { background: #fafbfc; }
.todo-type-mark { display: flex; align-items: center; gap: 7px; color: var(--muted-strong); font-size: 11px; font-weight: 680; }
.todo-type-mark [data-lucide] { width: 16px; height: 16px; color: var(--muted); }
.todo-object-block,
.todo-copy,
.todo-status-block { display: grid; min-width: 0; gap: 3px; }
.todo-object-block span,
.todo-copy span,
.todo-status-block small,
.todo-created-at { color: var(--muted); font-size: 10px; }
.todo-object-block strong,
.todo-copy strong { overflow-wrap: anywhere; }
.todo-object-block strong { color: var(--brand); font-size: 12px; }
.todo-copy strong { color: var(--ink); font-size: 13px; }
.status-badge.neutral {
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel-soft);
  color: var(--muted-strong);
  padding: 3px 6px;
  font-size: 10px;
  font-weight: 680;
  overflow-wrap: anywhere;
}
.todo-created-at { font-variant-numeric: tabular-nums; }
.todo-primary-action { display: flex; justify-content: flex-end; }
.todo-primary-action button { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.todo-primary-action span { color: var(--muted); font-size: 10px; }
.todo-empty-state { flex-wrap: wrap; }
.todo-empty-state > button { margin-left: auto; }

@media (max-width: 1180px) {
  .todo-queue-item { grid-template-columns: 102px minmax(110px,.75fr) minmax(190px,1.5fr) 132px 100px; }
  .todo-primary-action { grid-column: 3 / -1; justify-content: flex-end; }
}

@media (max-width: 860px) {
  .payment-filter-workbench { padding: 10px; }
  .mobile-scroll-tabs {
    position: relative;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }
  .mobile-scroll-tabs::-webkit-scrollbar { display: none; }
  .mobile-scroll-tabs::after { content: ""; flex: 0 0 max(12px, env(safe-area-inset-right)); height: 1px; }
  .mobile-scroll-tabs > button { flex: 0 0 auto; min-height: 44px; }
  .payment-quick-filters { padding-bottom: 2px; }
  .payment-quick-filters > span { flex: 0 0 auto; }
  .payment-card-scan { border-left-width: 1px; }
  .todo-filter-bar { margin-right: -16px; margin-left: -16px; border-right: 0; border-left: 0; border-radius: 0; padding-right: 16px; padding-left: 16px; }
  .todo-queue { display: grid; gap: 10px; overflow: visible; border: 0; border-radius: 0; background: transparent; }
  .todo-queue-item {
    grid-template-columns: minmax(0,1fr) auto;
    gap: 9px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--panel);
    padding: 13px;
  }
  .todo-queue-item:first-child { border-top: 1px solid var(--line); }
  .todo-type-mark { grid-column: 1; }
  .todo-status-block { grid-column: 2; grid-row: 1; align-items: end; justify-items: end; }
  .todo-status-block small { display: none; }
  .todo-object-block { grid-column: 1 / -1; }
  .todo-object-block strong { font-size: 13px; }
  .todo-copy { grid-column: 1 / -1; padding-top: 8px; border-top: 1px solid var(--line); }
  .todo-created-at { grid-column: 1; }
  .todo-primary-action { grid-column: 2; justify-content: flex-end; }
}

@media (max-width: 520px) {
  .payment-card-primary strong { font-size: 19px; }
  .payment-card-details dl { grid-template-columns: 1fr; }
  .payment-card-detail-note { grid-column: 1; }
  .payment-card-receipt { grid-template-columns: 48px minmax(0,1fr); }
  .payment-card-action { grid-template-columns: 48px minmax(0,1fr); }
  .page-leading-tools { align-items: flex-start; margin-bottom: 8px; }
  .page-leading-tools p { max-width: 250px; font-size: 11px; }
  .page-leading-tools .text-button { min-height: 32px; padding: 2px 0; white-space: nowrap; }
  .payment-page-tools { align-items: center; }
  .payment-page-tools p { max-width: 235px; }
  .todo-list-summary .render-note { max-width: none; }
  .todo-primary-action button { min-height: 40px; }
}

/* Customer value model: one system level plus one manual tier. */
.customer-identity-primary,
.customer-detail-identity-primary {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 6px 9px;
  align-items: center;
}
.customer-identity-primary > .text-link {
  min-width: 0;
  max-width: 100%;
}
.customer-detail-identity-primary {
  margin-bottom: 9px;
}
.customer-detail-identity-primary h2 {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.customer-classification-detail {
  display: grid;
  margin: 2px 0 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.customer-classification-detail-row {
  display: grid;
  min-width: 0;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 9px 0;
}
.customer-classification-detail-row + .customer-classification-detail-row { border-top: 1px solid var(--line); }
.customer-classification-detail-row > span { color: var(--muted); font-size: 12px; font-weight: 650; }
.customer-classification-detail-value {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
}
.customer-classification-detail-value small { color: var(--muted-strong); font-size: 11px; line-height: 1.4; }
.customer-classification-detail-value small.is-next { color: var(--brand-strong); font-weight: 680; }
.customer-classification-detail-value small.is-complete { color: var(--ok); }
.customer-classification-detail-value small.is-pending { color: var(--muted); }
.customer-classification-detail-value .text-button { margin-left: auto; white-space: nowrap; }
.customer-classification-row {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}
.customer-value-level,
.customer-manual-tier {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  line-height: 1;
  white-space: nowrap;
}
.customer-value-level {
  min-height: 24px;
  gap: 4px;
  padding: 3px 8px 3px 6px;
  color: #425466;
  border-radius: 8px;
  box-shadow: inset 0 1px rgba(255, 255, 255, .76);
}
.customer-value-level [data-lucide] { width: 13px; height: 13px; stroke-width: 1.9; }
.customer-value-level strong { color: currentColor; font-size: 11px; font-weight: 780; letter-spacing: 0; }
.customer-manual-tier {
  min-width: 28px;
  min-height: 22px;
  padding: 3px 7px;
  background: #f7f8f9;
  color: var(--muted-strong);
}
.customer-manual-tier strong { color: currentColor; font-size: 10px; font-weight: 700; letter-spacing: 0; }
.customer-value-level.level-l0 { border-color: #cfd4d9; background: linear-gradient(#fafafa, #eceff1); color: #7c858d; }
.customer-value-level.level-l1 { border-color: #bfc7ce; background: linear-gradient(#f6f7f8, #e4e8eb); color: #505a63; }
.customer-value-level.level-l2 { border-color: #9fb6c9; background: linear-gradient(#f3f8fb, #dce9f2); color: #3f6380; }
.customer-value-level.level-l3 { border-color: #7eabc7; background: linear-gradient(#eff8fb, #d1e6f0); color: #1f6288; }
.customer-value-level.level-l4 { border-color: #8997c2; background: linear-gradient(#f3f4fa, #dce0f0); color: #42568e; }
.customer-value-level.level-l5 { border-color: #a48cba; background: linear-gradient(#f8f4fa, #e8deef); color: #684d7e; }
.customer-value-level.level-l6 { border-color: #b28a70; background: linear-gradient(#faf5f1, #ead9cd); color: #754b34; }
.customer-value-level.level-l7 { border-color: #9fa9b2; background: linear-gradient(135deg, #f7f8f9, #d8dde1 48%, #eef1f3); color: #4c565e; }
.customer-value-level.level-l8,
.customer-value-level.level-l9plus { border-color: #b79b57; background: linear-gradient(135deg, #fbf8ef, #e7d6a5 48%, #f7f1df); color: #705720; }
.customer-value-level.level-pending { border-style: dashed; color: var(--muted); }
.customer-manual-tier { border-color: #d7dce0; background: #f6f7f8; color: #65717b; }
.customer-manual-tier.tier-b,
.customer-manual-tier.tier-a { border-color: #ced7df; background: #f2f5f7; color: #5c6e7d; }
.customer-manual-tier.tier-s { border-color: #d7cfdd; background: #f5f2f7; color: #74677c; }
.customer-manual-tier.tier-s-plus,
.customer-manual-tier.tier-sss { border-color: #c7b8d2; background: #f6f2f8; color: #6c5578; }
.customer-value-level::after,
.customer-manual-tier::after {
  position: absolute;
  z-index: 80;
  top: calc(100% + 7px);
  left: 0;
  width: max-content;
  max-width: min(250px, 75vw);
  border-radius: 6px;
  background: #222a33;
  padding: 7px 9px;
  color: #fff;
  content: attr(data-tooltip);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-2px);
  transition: opacity .12s ease, transform .12s ease;
  white-space: pre-line;
}
.customer-value-level:hover::after,
.customer-value-level:focus-visible::after,
.customer-manual-tier:hover::after,
.customer-manual-tier:focus-visible::after { opacity: 1; transform: translateY(0); }
.customer-list-identity .customer-classification-row { flex: 0 0 auto; }
.customer-kingdee-id { color: var(--muted-strong) !important; font-size: 11px !important; font-weight: 650 !important; }
.customer-value-cell small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.customer-next-contact-value {
  display: inline-flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 4px 6px;
  align-items: center;
}
.customer-next-contact-value > span { overflow-wrap: anywhere; }
.customer-next-contact-value small {
  display: inline-flex;
  min-height: 20px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--muted-strong);
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 680;
  white-space: nowrap;
}
.customer-next-contact-value small.is-overdue { border-color: #e3b9b9; background: #fff5f5; color: var(--bad); }
.customer-next-contact-value small.is-today { border-color: #e2cf9b; background: #fffaf0; color: #8a650d; }

.customer-sales-trend {
  margin: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 14px 0 16px;
}
.trend-range-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.trend-range-actions button.active { border-color: var(--brand); background: #f4f7fb; color: var(--brand-strong); }
.customer-trend-chart {
  display: grid;
  height: 180px;
  grid-auto-columns: minmax(18px, 1fr);
  grid-auto-flow: column;
  gap: 7px;
  align-items: end;
  border-bottom: 1px solid var(--line-strong);
  padding: 12px 8px 0;
  overflow-x: auto;
}
.customer-trend-column {
  position: relative;
  display: grid;
  min-width: 20px;
  height: 100%;
  grid-template-rows: 1fr auto;
  gap: 5px;
  align-items: end;
  text-align: center;
}
.customer-trend-bar {
  display: block;
  width: min(24px, 80%);
  height: var(--trend-height);
  justify-self: center;
  border-radius: 3px 3px 0 0;
  background: #667b91;
}
.customer-trend-column small { color: var(--muted); font-size: 10px; }

.finance-dense-table {
  max-height: min(680px, calc(100dvh - 280px));
  overflow: auto;
  scrollbar-color: var(--line-strong) transparent;
}
.finance-dense-table table { min-width: 1410px; table-layout: fixed; }
.finance-dense-table th,
.finance-dense-table td { vertical-align: top; white-space: normal; }
.finance-dense-table thead th {
  position: sticky;
  z-index: 2;
  top: 0;
  border-bottom-color: var(--line-strong);
  background: #f8fafb;
  box-shadow: 0 1px 0 var(--line);
}
.finance-dense-table th,
.finance-dense-table td { padding: 8px 9px; }
.finance-dense-table th:nth-child(1) { width: 78px; }
.finance-dense-table th:nth-child(2) { width: 120px; }
.finance-dense-table th:nth-child(3) { width: 92px; }
.finance-dense-table th:nth-child(4) { width: 76px; }
.finance-dense-table th:nth-child(5) { width: 96px; }
.finance-dense-table th:nth-child(6) { width: 88px; }
.finance-dense-table th:nth-child(7) { width: 108px; }
.finance-dense-table th:nth-child(8) { width: 88px; }
.finance-dense-table th:nth-child(9) { width: 104px; }
.finance-dense-table th:nth-child(10) { width: 92px; }
.finance-dense-table th:nth-child(11) { width: 136px; }
.finance-dense-table th:nth-child(12) { width: 96px; }
.finance-dense-table th:nth-child(13) { width: 76px; }
.finance-dense-table th:nth-child(13),
.finance-dense-table td:nth-child(13) {
  position: sticky;
  z-index: 1;
  right: 0;
  background: var(--panel);
  box-shadow: -1px 0 0 var(--line), -8px 0 12px rgba(25, 36, 48, 0.03);
}
.finance-dense-table thead th:nth-child(13) { z-index: 3; background: #f8fafb; }
.finance-dense-table td + td { border-left: 1px solid #edf0f2; }
.finance-dense-table td:nth-child(4),
.finance-dense-table td:nth-child(5),
.finance-dense-table td:nth-child(11) {
  min-width: 0;
  max-width: none;
  white-space: normal;
}
.finance-dense-amount,
.finance-dense-judgement,
.finance-dense-table td > div { display: grid; min-width: 0; gap: 3px; }
.finance-check-date { color: var(--muted-strong); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.finance-order-date { color: var(--muted-strong); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.finance-order-amount { color: var(--ink); font-size: 12px; font-variant-numeric: tabular-nums; }
.finance-customer-country { display: block; color: var(--muted-strong); font-size: 12px; overflow-wrap: anywhere; }
.finance-dense-amount strong { font-size: 13px; font-variant-numeric: tabular-nums; }
.finance-dense-amount span,
.finance-dense-judgement small,
.finance-dense-table td small { color: var(--muted); font-size: 10px; }
.finance-customer-cell,
.finance-order-cell .text-link { min-width: 0; overflow-wrap: anywhere; text-align: left; }
.finance-customer-cell { color: var(--ink); font-weight: 720; }
.finance-order-cell small { line-height: 1.35; }
.finance-owner-cell strong { font-size: 12px; }
.finance-channel-cell,
.finance-judgement-cell { display: block; overflow-wrap: anywhere; color: var(--muted-strong); font-size: 12px; }
.finance-judgement-cell { font-weight: 680; }
.finance-receipt-cell { align-content: start; }
.finance-dense-note {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted-strong);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.finance-dense-table .receipt-state { margin: 0; font-size: 10px; }
.finance-dense-table .receipt-unavailable { gap: 2px; }
.finance-dense-table .receipt-unavailable small { font-size: 10px; }
.finance-dense-table .receipt-thumbnail { width: 50px; gap: 2px; padding: 3px; }
.finance-dense-table .receipt-thumbnail img { height: 36px; }
.finance-dense-table .receipt-thumbnail span { display: none; }
.finance-row-actions { align-items: start; justify-items: start; gap: 6px; }
.finance-row-actions .text-button { min-height: 28px; padding: 2px 0; font-size: 12px; }
.finance-dense-table .payment-status-select { min-width: 88px; min-height: 32px; padding: 3px 20px 3px 6px; font-size: 10px; }

@media (max-width: 860px) {
  .finance-dense-table { max-height: none; }
  .inventory-page-heading .button-row { width: 100%; }
  .inventory-page-heading .button-row button { flex: 1 1 0; min-height: 42px; }
  .warehouse-operating-header { display: grid; gap: 10px; }
  .warehouse-operating-facts { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .warehouse-operating-facts div { border-top: 1px solid var(--line); padding-top: 7px; }
  .inventory-mobile-lock { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 6px 8px; }
  .inventory-mobile-lock > span { color: var(--muted); font-size: 11px; }
  .inventory-active-filters { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; scrollbar-width: thin; }
  .inventory-active-filters > * { flex: 0 0 auto; }
  .settings-crud-header { gap: 10px; }
  .settings-crud-header .button-row { width: 100%; }
  .settings-crud-header .button-row > button { width: 100%; min-height: 42px; }
  .settings-row-actions { width: 100%; justify-content: stretch; }
  .settings-row-actions > button { flex: 1 1 auto; min-height: 38px; }
  .settings-row-actions summary { min-height: 38px; }
  .settings-row-actions details > div { position: fixed; right: 14px; left: 14px; top: auto; bottom: 14px; width: auto; z-index: 48; padding: 8px; }
  .settings-row-actions details > div button { min-height: 44px; }
}

@media (max-width: 520px) {
  .customer-identity-primary { align-items: flex-start; }
  .customer-detail-identity-primary { align-items: flex-start; }
  .customer-detail-identity-primary h2 { flex: 1 1 100%; font-size: 18px; }
  .customer-classification-row { align-items: center; }
  .customer-classification-detail-row { grid-template-columns: 1fr; gap: 5px; }
  .customer-classification-detail-value .text-button { margin-left: 0; }
  .customer-value-level::after,
  .customer-manual-tier::after { right: 0; left: auto; }
  .customer-trend-chart { height: 150px; gap: 5px; padding-inline: 4px; }
}

/* Mobile navigation always opens at its full usable width, even when desktop
   sidebar collapse preference is persisted in localStorage. */
@media (max-width: 860px) {
  body.sidebar-collapsed .sidebar {
    width: 240px;
  }
  body.sidebar-collapsed .brand {
    justify-content: flex-start;
  }
  body.sidebar-collapsed .brand-lockup {
    display: none;
  }
  body.sidebar-collapsed .brand-logo-compact {
    display: block;
    width: 176px;
    height: 58px;
    object-fit: contain;
  }
  body.sidebar-collapsed .nav {
    justify-content: flex-start;
  }
  body.sidebar-collapsed .nav span {
    display: inline;
  }
  body.sidebar-collapsed .nav-sub {
    display: flex;
  }
}

/* The compact brand belongs to the tablet/mobile app bar. The navigation
   drawer starts below it so branding is never duplicated or clipped. */
@media (max-width: 1100px) {
  .mobile-brand-logo {
    display: block;
    width: 104px;
    height: 34px;
    justify-self: start;
    object-fit: contain;
  }
  .sidebar,
  body.sidebar-collapsed .sidebar {
    top: 52px;
  }
  .sidebar .brand,
  body.sidebar-collapsed .brand {
    display: none;
  }
}
/* Sales workbench and annual target plan: shared surfaces, not a second dashboard theme. */
.sales-workbench-hero{display:flex;align-items:flex-end;justify-content:space-between;gap:20px;padding:4px 0 18px}.sales-workbench-hero h2{margin:3px 0 6px;font-size:28px}.sales-workbench-hero p{margin:0;color:var(--text-secondary,#67717e)}.sales-workbench-actions{display:flex;gap:8px;flex-wrap:wrap}.sales-workbench-actions button{display:inline-flex;align-items:center;gap:6px}.sales-performance-section{margin-bottom:16px}.sales-performance-grid{display:grid;grid-template-columns:1fr 1fr .9fr;gap:16px}.sales-performance-meter{padding:4px 8px}.sales-performance-meter-head{display:flex;justify-content:space-between;gap:12px;align-items:baseline}.sales-performance-meter-head span,.sales-performance-target,.sales-performance-meter small{color:var(--text-secondary,#67717e);font-size:12px}.sales-performance-meter-head strong{font-size:20px;color:var(--text-primary,#18212b)}.sales-performance-target{margin:5px 0 8px}.sales-performance-meter .progress-track{margin:0 0 7px}.sales-performance-meter .progress-track.is-neutral span{background:#9aa4ae}.sales-performance-facts{border-left:1px solid var(--border,#e3e7eb);padding-left:18px;display:grid;gap:14px}.sales-performance-facts div{display:grid;gap:3px}.sales-performance-facts span,.sales-performance-facts small{font-size:12px;color:var(--text-secondary,#67717e)}.sales-performance-facts strong{font-size:18px}.sales-performance-facts .text-button{justify-self:start;padding:0}.sales-workbench-layout{display:grid;grid-template-columns:minmax(0,1.55fr) minmax(280px,.85fr);gap:16px;margin-bottom:16px}.sales-workbench-secondary{grid-template-columns:1fr 1fr}.sales-priority-list{list-style:none;padding:0;margin:0}.sales-priority-list li{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:13px 0;border-top:1px solid var(--border,#e3e7eb)}.sales-priority-list li:first-child{border-top:0;padding-top:3px}.sales-priority-list div{min-width:0;display:grid;gap:3px}.sales-priority-list strong{font-size:14px;display:flex;align-items:center;gap:6px;flex-wrap:wrap}.sales-priority-list span{font-size:12px;color:var(--text-secondary,#67717e)}.sales-tip-panel{display:grid;align-content:start;gap:8px;background:#fbfcfd}.sales-tip-panel>strong{font-size:15px}.sales-tip-panel p{margin:0;line-height:1.65;color:var(--text-secondary,#67717e)}.sales-tip-tags{font-size:12px;color:#5b6f86}.sales-customer-opportunities,.sales-ongoing-orders{display:grid}.sales-customer-opportunities button,.sales-ongoing-order{border:0;border-top:1px solid var(--border,#e3e7eb);background:transparent;padding:12px 0;text-align:left;display:grid;grid-template-columns:1fr auto;align-items:center;gap:10px;color:inherit}.sales-customer-opportunities button:first-child,.sales-ongoing-order:first-child{border-top:0;padding-top:3px}.sales-customer-opportunities span,.sales-order-main{display:grid;gap:4px;min-width:0}.sales-customer-opportunities strong{display:flex;align-items:center;gap:5px;flex-wrap:wrap}.sales-customer-opportunities small,.sales-order-main small{color:var(--text-secondary,#67717e);font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sales-ongoing-order{grid-template-columns:minmax(0,1fr) auto auto}.sales-order-flow{font-size:12px;color:#315f96;background:#eff4fa;border-radius:6px;padding:3px 7px}.sales-today-achievements{display:flex;justify-content:space-between;align-items:center;gap:20px;border-top:1px solid var(--border,#e3e7eb);padding:18px 2px 2px}.sales-today-achievements>div{display:grid;gap:4px}.sales-today-achievements span{font-size:12px;color:var(--text-secondary,#67717e)}.sales-today-achievements dl{display:grid;grid-template-columns:repeat(4,minmax(80px,1fr));gap:18px;margin:0}.sales-today-achievements dt{font-size:12px;color:var(--text-secondary,#67717e)}.sales-today-achievements dd{margin:4px 0 0;font-weight:700}.annual-target-controls{display:grid;grid-template-columns:180px 130px 1fr;gap:12px;align-items:end;margin:16px 0}.annual-target-controls label{display:grid;gap:5px;font-size:12px;color:var(--text-secondary,#67717e)}.annual-target-summary{display:grid;justify-items:end;gap:2px}.annual-target-summary span,.annual-target-summary small{font-size:12px;color:var(--text-secondary,#67717e)}.annual-target-summary strong{font-size:18px}.annual-target-month-grid{display:grid;grid-template-columns:repeat(6,minmax(112px,1fr));gap:10px}.annual-target-month-grid label{display:grid;gap:4px;border:1px solid var(--border,#e3e7eb);border-radius:8px;padding:10px}.annual-target-month-grid label>span{font-weight:700;font-size:12px}.annual-target-month-grid small{font-size:11px;color:var(--text-secondary,#67717e)}.annual-target-actions{grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;gap:12px;padding-top:4px;color:var(--text-secondary,#67717e);font-size:12px}.table-secondary{display:block;color:var(--text-secondary,#67717e);font-size:12px;max-width:300px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.role-workbench-hero{display:flex;justify-content:space-between;align-items:flex-end;padding:4px 0 18px}.role-workbench-hero h2{margin:0 0 6px;font-size:28px}.role-workbench-hero p{margin:0;color:var(--text-secondary,#67717e)}.role-workbench-grid{display:grid;grid-template-columns:minmax(0,1.55fr) minmax(280px,.85fr);gap:16px;margin-bottom:16px}.role-workbench-priority{min-width:0}.role-workbench-personal{display:grid;align-content:start;gap:14px;background:#fbfcfd}.role-workbench-personal dl{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:0}.role-workbench-personal dt{font-size:12px;color:var(--text-secondary,#67717e)}.role-workbench-personal dd{margin:4px 0 0;font-weight:700}.role-workbench-personal .text-button{justify-self:start;padding:0}.role-workbench-big-number{font-size:34px;line-height:1;color:var(--text-primary,#18212b)}.role-workbench-personal>span{font-size:12px;color:var(--text-secondary,#67717e)}.role-workbench-order-list,.manager-member-list{display:grid}.role-workbench-order-list button{display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:10px;border:0;border-top:1px solid var(--border,#e3e7eb);background:transparent;color:inherit;text-align:left;padding:12px 0}.role-workbench-order-list button:first-child{border-top:0;padding-top:2px}.role-workbench-order-list button>span:first-child{display:grid;gap:4px;min-width:0}.role-workbench-order-list small{font-size:12px;color:var(--text-secondary,#67717e);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.role-workbench-status{font-size:12px;color:#315f96;background:#eff4fa;border-radius:6px;padding:3px 7px;max-width:120px;text-align:center}.manager-member-list button{display:grid;grid-template-columns:minmax(130px,.8fr) minmax(180px,1fr) minmax(145px,.8fr) auto;gap:14px;align-items:center;border:0;border-top:1px solid var(--border,#e3e7eb);background:transparent;color:inherit;text-align:left;padding:13px 0}.manager-member-list button:first-child{border-top:0;padding-top:2px}.manager-member-main,.manager-member-progress{display:grid;gap:4px;min-width:0}.manager-member-main small,.manager-member-progress small,.manager-member-reason{font-size:12px;color:var(--text-secondary,#67717e)}.manager-member-progress .progress-track{height:5px;margin:0}.manager-member-reason{line-height:1.45}.role-workbench-guidance{display:flex;gap:12px;align-items:baseline;margin-top:16px;background:#fbfcfd}.role-workbench-guidance strong{font-size:14px}.role-workbench-guidance span{font-size:13px;color:var(--text-secondary,#67717e);line-height:1.6}
@media (max-width:1024px){.sales-performance-grid{grid-template-columns:1fr 1fr}.sales-performance-facts{grid-column:1/-1;grid-template-columns:1fr 1fr;border-left:0;border-top:1px solid var(--border,#e3e7eb);padding:14px 0 0}.annual-target-month-grid{grid-template-columns:repeat(4,minmax(112px,1fr))}}
@media (max-width:768px){.sales-workbench-hero,.role-workbench-hero{align-items:flex-start;flex-direction:column}.sales-workbench-layout,.sales-workbench-secondary,.role-workbench-grid{grid-template-columns:1fr}.sales-today-achievements{align-items:flex-start;flex-direction:column}.sales-today-achievements dl{width:100%;grid-template-columns:repeat(2,1fr)}.annual-target-controls{grid-template-columns:1fr 1fr}.annual-target-summary{justify-items:start}.annual-target-month-grid{grid-template-columns:repeat(3,minmax(100px,1fr))}.manager-member-list button{grid-template-columns:minmax(120px,1fr) minmax(170px,1fr) auto}.manager-member-reason{grid-column:1/-1}}
@media (max-width:430px){.sales-workbench-hero h2,.role-workbench-hero h2{font-size:24px}.sales-workbench-actions{width:100%}.sales-workbench-actions button{flex:1;justify-content:center}.sales-performance-grid{grid-template-columns:1fr}.sales-performance-facts{grid-column:auto;grid-template-columns:1fr}.sales-priority-list li{align-items:flex-start;flex-direction:column;gap:6px}.sales-priority-list .text-button{padding-left:0}.sales-today-achievements dl{gap:12px}.annual-target-controls{grid-template-columns:1fr}.annual-target-month-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.annual-target-actions{align-items:flex-start;flex-direction:column}.sales-order-flow{max-width:90px;text-align:center}.sales-ongoing-order{gap:6px}.role-workbench-personal dl{grid-template-columns:1fr 1fr}.role-workbench-order-list button{align-items:start}.role-workbench-status{max-width:88px}.manager-member-list button{grid-template-columns:minmax(0,1fr) auto;gap:8px}.manager-member-progress,.manager-member-reason{grid-column:1/-1}.role-workbench-guidance{align-items:flex-start;flex-direction:column;gap:4px}}

.manager-member-new-customer{color:#56708a!important}
.role-workbench-operations{margin-top:16px}

/* Home workbench density correction: keep the shared app shell compact and
   let the sales guidance panel follow its content instead of its neighbour. */
.topbar {
  gap: 8px 16px;
  padding: 12px 24px;
}
.header-workspace { min-width: 0; }
.user-identity-bar {
  min-height: 34px;
  gap: 5px;
  padding: 2px 4px 2px 7px;
}
.user-identity-bar .identity-segment {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.user-identity-bar .identity-segment small { display: none; }
.user-identity-bar .identity-segment strong { font-size: 11px; }
.user-identity-bar .identity-segment > span { font-size: 10px; }
.user-identity-bar #roleHint .identity-segment::before {
  content: "真实";
  color: var(--muted);
  font-size: 10px;
}
.user-identity-bar .identity-segment.effective::before {
  content: "模拟";
  color: #9a5a12;
  font-size: 10px;
}
.user-identity-bar .identity-segment.effective { padding-left: 5px; }
.runtime-environment { max-width: 112px; padding-inline: 3px; }
.simulation-control { min-width: 0; }
.user-identity-bar .simulation-status {
  min-width: 0;
  flex-wrap: nowrap;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}
.user-identity-bar .simulation-status.is-simulating {
  background: transparent;
}
.user-identity-bar .simulation-status .identity-segment.effective {
  border-left-color: #d8b46a;
}
.user-identity-bar .simulation-status .text-button { white-space: nowrap; }
.simulation-status select { width: 118px; }
.sales-workbench-hero { padding: 0 0 10px; }
.sales-workbench-hero h2 { font-size: 26px; }
.sales-performance-section { margin-bottom: 12px; }
.sales-workbench-layout { align-items: start; gap: 12px; margin-bottom: 12px; }
.sales-tip-panel { min-height: 0; padding: 14px; }
.sales-priority-panel { padding: 14px; }
.sales-priority-list li { padding: 10px 0; }

@media (min-width: 1181px) {
  .topbar {
    grid-template-columns: minmax(210px, 1fr) minmax(0, auto) auto;
    align-items: center;
  }
  .page-actions {
    grid-column: auto;
    align-self: center;
  }
  .header-workspace { flex-wrap: nowrap; }
}

@media (min-width: 861px) {
  .topbar {
    grid-template-columns: minmax(220px, 1fr) auto;
  }
  .page-actions {
    grid-column: 1 / -1;
    align-self: auto;
  }
  .user-identity-bar {
    min-height: 32px;
    border-color: transparent;
    background: transparent;
    padding: 0;
  }
  .user-identity-bar .home-identity-context.is-simulating {
    border-color: transparent !important;
    background: transparent !important;
    padding: 0 !important;
  }
  .user-identity-bar .home-identity-context.is-simulating strong {
    color: var(--ink) !important;
  }
}

@media (max-width: 1180px) {
  .topbar { padding: 12px 20px; }
  .page-actions { margin-top: 0; }
}

@media (max-width: 860px) {
  .topbar { padding: 10px 16px 8px; }
  .user-identity-bar .identity-segment { white-space: normal; }
  .sales-workbench-hero { padding-bottom: 8px; }
}

/* Homepage density closure: business priority sets the rhythm, not equal cards. */
#homeView .customer-value-level,
#homeView .customer-manual-tier,
#homeView .sales-order-flow,
#homeView .badge {
  box-sizing: border-box;
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  min-height: 22px;
  height: 22px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  align-self: center;
  line-height: 1;
  padding: 3px 7px;
  white-space: nowrap;
}
#homeView .customer-value-level { min-height: 24px; height: 24px; gap: 4px; padding: 3px 8px 3px 6px; }
#homeView .customer-value-level strong,
#homeView .customer-manual-tier strong { line-height: 1; }
#homeView .section-card {
  border-color: #e0e5ea;
  border-style: solid;
  border-width: 1px;
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: none;
}
#homeView .sales-workbench-hero {
  margin: 0;
  padding: 2px 0 14px;
}
body:has(#homeView.active) .topbar > p {
  display: none;
}
#homeView .sales-workbench-hero h2 { margin: 0 0 4px; font-size: 27px; }
#homeView .sales-workbench-hero p { font-size: 14px; line-height: 1.5; }
#homeView .sales-performance-section { margin-bottom: 24px; padding: 18px 20px 14px; }
#homeView .sales-performance-section .section-title { margin-bottom: 14px; }
#homeView .sales-performance-grid { align-items: start; gap: 0; }
#homeView .sales-performance-meter { padding: 0 20px 0 0; }
#homeView .sales-performance-meter + .sales-performance-meter { border-left: 1px solid var(--line); padding-left: 20px; }
#homeView .sales-performance-meter-head strong { font-size: 24px; }
#homeView .sales-performance-target {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 6px 0 8px;
}
#homeView .sales-performance-target strong { color: var(--brand-strong); font-size: 12px; }
#homeView .sales-performance-meter .progress-track { height: 7px; margin-bottom: 7px; background: #e7ebef; }
#homeView .sales-performance-meter .progress-track span { background: #2b6bb2; }
#homeView .sales-target-warning {
  display: inline-flex;
  width: fit-content;
  margin: 8px 0;
  border: 1px solid #ebc877;
  border-radius: 6px;
  background: #fffaf0;
  padding: 4px 7px;
  color: #8a5a11;
  font-size: 12px;
  font-weight: 700;
}
#homeView .sales-performance-facts { align-content: start; margin-left: 20px; padding-left: 20px; gap: 12px; }
#homeView .sales-source-note {
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}
#homeView .sales-source-note summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  color: var(--muted-strong);
  list-style: none;
}
#homeView .sales-source-note summary::-webkit-details-marker { display: none; }
#homeView .sales-source-note span { display: block; margin-top: 6px; line-height: 1.55; }
#homeView .sales-workbench-layout {
  align-items: start;
  gap: 24px;
  margin-bottom: 24px;
}
#homeView .sales-workbench-priority-only { grid-template-columns: minmax(0, 1fr); }
#homeView .sales-workbench-secondary { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); }
#homeView .sales-priority-panel,
#homeView .sales-tip-panel,
#homeView .sales-workbench-secondary > .section-card { min-height: 0; padding: 16px 18px; }
#homeView .sales-tip-panel { gap: 6px; background: #fbfcfd; }
#homeView .sales-tip-panel .section-title { margin-bottom: 3px; }
#homeView .sales-tip-panel p { line-height: 1.55; }
#homeView .sales-priority-list li { min-height: 54px; padding: 10px 0; }
#homeView .sales-priority-list strong,
#homeView .sales-customer-opportunities strong { align-items: center; }
#homeView .sales-customer-opportunities button,
#homeView .sales-ongoing-order { min-height: 58px; padding: 10px 0; }
#homeView .sales-today-achievements { margin-top: 0; padding: 16px 2px 4px; }

@media (max-width: 1024px) {
  #homeView .sales-performance-section { padding: 16px; }
  #homeView .sales-performance-facts { margin-left: 0; padding-left: 0; }
  #homeView .sales-workbench-layout { gap: 16px; margin-bottom: 16px; }
}

@media (max-width: 768px) {
  #homeView .sales-workbench-hero { padding: 0 0 12px; }
  #homeView .sales-performance-section { margin-bottom: 16px; }
  #homeView .sales-performance-meter { padding: 0 0 16px; }
  #homeView .sales-performance-meter + .sales-performance-meter { border-left: 0; border-top: 1px solid var(--line); padding: 16px 0; }
  #homeView .sales-performance-facts { padding-top: 14px; }
  #homeView .sales-workbench-secondary { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
  #homeView .sales-workbench-hero h2 { font-size: 23px; }
  #homeView .sales-workbench-hero p { font-size: 13px; }
  #homeView .sales-performance-section { padding: 14px; }
  #homeView .sales-performance-section .section-title { align-items: center; margin-bottom: 12px; }
  #homeView .sales-performance-meter-head strong { font-size: 22px; }
  #homeView .sales-performance-facts { gap: 10px; }
  #homeView .sales-workbench-layout { gap: 12px; margin-bottom: 12px; }
  #homeView .sales-priority-panel,
  #homeView .sales-tip-panel { padding: 14px; }
  #homeView .sales-priority-list li { min-height: 0; padding: 10px 0; }
  #homeView .sales-priority-list .text-button { min-height: 36px; }
  #homeView .sales-today-achievements { padding-top: 14px; }
}

@media (max-width: 520px) {
  body:has(#homeView.active) .topbar { gap: 6px; padding-top: 9px; padding-bottom: 8px; }
  body:has(#homeView.active) .topbar > div:first-child p { display: none; }
  body:has(#homeView.active) .user-identity-bar {
    min-height: 34px;
    flex-wrap: nowrap;
    gap: 4px;
    padding: 3px 4px 3px 6px;
  }
  body:has(#homeView.active) #roleHint .identity-segment > span,
  body:has(#homeView.active) .simulation-status .identity-segment > span { display: none; }
  body:has(#homeView.active) .user-identity-bar .identity-segment { gap: 3px; }
  body:has(#homeView.active) .user-identity-bar .identity-segment strong { font-size: 10px; }
  body:has(#homeView.active) .simulation-status { min-width: 0; gap: 3px; flex-wrap: nowrap; }
  body:has(#homeView.active) .simulation-status select { width: 98px; max-width: 98px; min-height: 28px; padding-left: 5px; font-size: 10px; }
  body:has(#homeView.active) .simulation-status .text-button { min-height: 28px; padding-inline: 4px; font-size: 10px; }
  body:has(#homeView.active) .runtime-environment {
    order: 0;
    width: auto;
    max-width: 72px;
    margin-left: auto;
    border-top: 0;
    padding: 2px 0;
    overflow: hidden;
    font-size: 9px;
    text-overflow: ellipsis;
  }
  #homeView .sales-performance-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #homeView .sales-performance-meter { min-width: 0; padding: 0 10px 12px 0; }
  #homeView .sales-performance-meter + .sales-performance-meter { border-top: 0; border-left: 1px solid var(--line); padding: 0 0 12px 10px; }
  #homeView .sales-performance-meter-head { display: grid; gap: 3px; }
  #homeView .sales-performance-meter-head strong { font-size: 19px; }
  #homeView .sales-performance-target { align-items: start; flex-direction: column; gap: 2px; }
  #homeView .sales-performance-facts { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
  #homeView .sales-source-note { margin-top: 10px; }
}
