:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --text: #18212f;
  --muted: #667085;
  --line: #d8dee8;
  --line-soft: #e8edf3;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --accent-soft: #e6f4f1;
  --warning: #b45309;
  --warning-soft: #fff7ed;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --success: #047857;
  --success-soft: #ecfdf3;
  --shadow: 0 18px 44px rgba(16, 24, 40, 0.12);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
}

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

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.2);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
}

.watermark-layer {
  position: fixed;
  inset: 0;
  z-index: 45;
  pointer-events: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  grid-auto-rows: 120px;
  gap: 12px 24px;
  overflow: hidden;
  padding: 36px;
}

.watermark-layer span {
  align-self: center;
  justify-self: center;
  transform: rotate(-24deg);
  color: rgba(16, 24, 40, 0.1);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  user-select: none;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #101828;
}

.auth-card {
  width: min(420px, 100%);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 22px;
  background: #fff;
  box-shadow: var(--shadow);
}

.auth-brand {
  padding: 0 0 18px;
  color: var(--text);
}

.auth-brand span {
  color: var(--muted);
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
  margin-bottom: 16px;
  border-radius: 8px;
  padding: 3px;
  background: #eef2f6;
}

.auth-tabs button {
  height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.auth-tabs button.is-active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}

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

.auth-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.auth-form input {
  height: 40px;
  padding: 0 11px;
}

.auth-message {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: #101828;
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 10px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: #0f766e;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 16px;
}

.brand span {
  margin-top: 3px;
  color: #cbd5e1;
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  width: 100%;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 12px;
  background: transparent;
  color: #d7dee8;
  text-align: left;
}

.nav-item:hover,
.nav-item.is-active {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sidebar-panel {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.panel-label,
.sidebar-panel small {
  display: block;
  color: #cbd5e1;
  font-size: 12px;
}

.sidebar-panel strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 28px;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

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

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  margin-bottom: 0;
  font-size: 16px;
}

.topbar-actions,
.toolbar,
.toolbar-controls,
.drawer-footer,
.drawer-footer > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px 3px 3px 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}

.page-view {
  min-width: 0;
}

.search-field {
  width: min(360px, 34vw);
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  background: var(--surface);
  color: var(--muted);
}

.search-field input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.primary-button,
.ghost-button,
.danger-button,
.icon-button {
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 7px;
  border: 1px solid transparent;
  padding: 0 13px;
  white-space: nowrap;
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.ghost-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.ghost-button:hover,
.icon-button:hover {
  background: var(--surface-muted);
}

.danger-button {
  border-color: #fecaca;
  background: var(--danger-soft);
  color: var(--danger);
}

.icon-button {
  width: 40px;
  padding: 0;
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.summary-panel {
  margin-bottom: 14px;
}

.summary-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface);
}

.summary-filter h2 {
  margin: 0 0 3px;
}

.summary-filter span {
  color: var(--muted);
  font-size: 12px;
}

.summary-filter-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.summary-filter label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.summary-filter input[type="date"],
.summary-filter select {
  width: 142px;
  height: 34px;
  padding: 0 8px 0 10px;
}

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

.metric-card {
  min-height: 116px;
  display: grid;
  align-content: space-between;
  gap: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
}

.metric-card span,
.metric-card small {
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  font-size: 26px;
  line-height: 1.1;
}

.toolbar {
  justify-content: space-between;
  margin-bottom: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
}

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

.filter-group {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.filter-group-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.type-filter-group {
  flex: 1 1 360px;
}

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border-radius: 8px;
  background: #eef2f6;
}

.type-segmented {
  max-width: 100%;
  overflow-x: auto;
}

.segmented button {
  height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
}

.segmented button.is-active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}

.toolbar label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.toolbar-search-field input {
  width: 210px;
  height: 34px;
  padding: 0 10px;
}

select,
input,
textarea {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
}

input[readonly] {
  background: var(--surface-muted);
  color: #475467;
  cursor: default;
}

.toolbar select,
.toolbar input[type="date"] {
  height: 34px;
  padding: 0 30px 0 10px;
}

.toolbar input[type="date"] {
  width: 142px;
  padding-right: 8px;
}

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

.table-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.table-heading span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.records-wrap {
  position: relative;
  min-height: 260px;
  padding: 12px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--line-soft);
  background: #fff;
}

.pagination span {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.good-value {
  color: var(--success);
  font-weight: 700;
}

.low-value {
  color: var(--danger);
  font-weight: 700;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

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

.record-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 1.1fr) minmax(520px, 1.8fr) 40px;
  align-items: center;
  gap: 14px;
  min-height: 92px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.record-card:hover {
  border-color: #cbd5e1;
  background: #fbfdfd;
}

.record-main {
  min-width: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.record-index {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-muted);
  color: #475467;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.record-title {
  min-width: 0;
}

.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 5px;
}

.record-meta span {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  background: #eef2f6;
  color: #475467;
  font-size: 12px;
  font-weight: 700;
}

.record-title h3 {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-title p {
  margin: 5px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-numbers {
  display: grid;
  grid-template-columns: repeat(6, minmax(72px, 1fr));
  gap: 8px;
}

.record-numbers div {
  min-width: 0;
  display: grid;
  gap: 5px;
  border-left: 1px solid var(--line-soft);
  padding-left: 10px;
}

.record-numbers span {
  color: var(--muted);
  font-size: 12px;
}

.record-numbers strong {
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-numbers .good-value {
  color: var(--success);
}

.record-numbers .low-value {
  color: var(--danger);
}

.profit-cell strong {
  font-size: 17px;
}

.record-edit {
  width: 30px;
  height: 30px;
  opacity: 0.32;
}

.record-card:hover .record-edit,
.record-edit:focus-visible {
  opacity: 1;
}

.empty-state {
  position: absolute;
  inset: 64px 16px 16px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--text);
}

.empty-state p {
  margin: 0;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(16, 24, 40, 0.34);
}

.order-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 80;
  min-height: 0;
  width: min(660px, 100vw);
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: var(--shadow);
  transform: translateX(104%);
  transition: transform 160ms ease;
}

.order-drawer.is-open {
  transform: translateX(0);
}

.order-drawer form {
  min-height: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.drawer-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid var(--line-soft);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 20px 0;
}

.form-grid label,
.full-label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.form-grid input,
.form-grid select,
.full-label textarea {
  width: 100%;
  min-width: 0;
  padding: 0 11px;
}

.form-grid input,
.form-grid select {
  height: 40px;
}

.sku-section {
  display: grid;
  gap: 10px;
  padding: 16px 20px 0;
}

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

.sku-heading h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.sku-heading span {
  color: var(--muted);
  font-size: 12px;
}

.sku-grid-head,
.sku-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.5fr) minmax(84px, 0.8fr) minmax(84px, 0.8fr) minmax(76px, 0.7fr) 34px;
  gap: 8px;
  align-items: center;
}

.sku-grid-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.sku-rows {
  display: grid;
  gap: 8px;
}

.sku-row {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface-muted);
}

.sku-row input {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 9px;
}

.sku-remove {
  width: 34px;
  height: 34px;
  color: var(--danger);
}

.full-label {
  padding: 0 20px 20px;
}

.full-label textarea {
  padding-top: 10px;
  resize: vertical;
}

.calc-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 20px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-muted);
}

.calc-panel div {
  display: grid;
  gap: 5px;
}

.calc-panel span {
  color: var(--muted);
  font-size: 12px;
}

.calc-panel strong {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.drawer-footer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  justify-content: space-between;
  margin-top: auto;
  padding: 14px 20px;
  border-top: 1px solid var(--line-soft);
  background: #fff;
  box-shadow: 0 -10px 24px rgba(16, 24, 40, 0.06);
}

.customer-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(420px, 1.2fr);
  gap: 14px;
  align-items: start;
}

.management-forms,
.management-lists {
  display: grid;
  gap: 14px;
}

.customer-form,
.management-form {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.customer-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.single-field-grid {
  grid-template-columns: 1fr;
}

.customer-form-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.customer-form-grid input,
.customer-form-grid textarea {
  width: 100%;
  min-width: 0;
  padding: 0 11px;
}

.customer-form-grid input {
  height: 40px;
}

.customer-form-grid textarea {
  padding-top: 10px;
  resize: vertical;
}

.wide-label {
  grid-column: 1 / -1;
}

.customer-form-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--line-soft);
}

.customer-list-section {
  position: relative;
  min-height: 380px;
}

.customer-list {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.customer-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.type-list {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.type-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}

.type-card span {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  margin-top: 2px;
}

.record-group-title span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid #cce7e3;
  border-radius: 999px;
  padding: 2px 10px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.customer-card:hover {
  border-color: #cbd5e1;
  background: #fbfdfd;
}

.customer-card h3 {
  margin: 0 0 5px;
  font-size: 15px;
}

.customer-card p,
.customer-card small {
  display: block;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-empty {
  inset: 74px 16px 16px;
}

.account-section {
  min-height: 420px;
}

.user-list {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.user-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.user-card h3 {
  margin: 0 0 5px;
  font-size: 15px;
}

.user-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.user-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-pill {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  padding: 2px 9px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.status-pill.is-active {
  background: var(--success-soft);
  color: var(--success);
}

.status-pill.is-pending {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-pill.is-disabled {
  background: var(--danger-soft);
  color: var(--danger);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  color: var(--text);
}

.confirm-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 110;
  width: min(420px, calc(100vw - 32px));
  transform: translate(-50%, -50%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: #fff;
  box-shadow: var(--shadow);
}

.confirm-dialog h2 {
  margin: 0;
  font-size: 18px;
}

.confirm-dialog p {
  margin: 10px 0 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.confirm-dialog div {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.lucide {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

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

  .watermark-layer {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    grid-auto-rows: 110px;
    padding: 22px;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: 12px;
  }

  .nav-list {
    display: flex;
    flex: 1;
    overflow-x: auto;
  }

  .nav-item {
    width: auto;
    min-width: max-content;
  }

  .sidebar-panel {
    display: none;
  }

  .topbar {
    flex-direction: column;
  }

  .topbar-actions,
  .search-field {
    width: 100%;
  }

  .account-chip {
    width: 100%;
    justify-content: space-between;
  }

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

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

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

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

  .toolbar-segments {
    align-items: flex-start;
  }

  .filter-group {
    max-width: 100%;
  }

  .toolbar-controls {
    flex-wrap: wrap;
  }

  .record-card {
    grid-template-columns: 1fr 40px;
  }

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

@media (max-width: 620px) {
  .workspace {
    padding: 16px;
  }

  .brand span,
  .nav-item span:last-child {
    display: none;
  }

  .sidebar {
    gap: 8px;
  }

  h1 {
    font-size: 24px;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr 40px;
  }

  .account-chip {
    grid-column: 1 / -1;
  }

  #newOrderButton {
    grid-column: 1 / -1;
  }

  .summary-grid,
  .calc-panel {
    grid-template-columns: 1fr;
  }

  .summary-filter-controls,
  .summary-filter label,
  .summary-filter input[type="date"],
  .toolbar-search-field,
  .toolbar-search-field input,
  .toolbar label,
  .toolbar select,
  .toolbar input[type="date"] {
    width: 100%;
  }

  .confirm-dialog div {
    flex-direction: column-reverse;
  }

  .confirm-dialog button {
    width: 100%;
  }

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

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

  .customer-form-footer {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .customer-form-footer button {
    width: 100%;
  }

  .user-card {
    grid-template-columns: 1fr;
  }

  .user-actions {
    justify-content: stretch;
  }

  .user-actions button,
  .user-actions select {
    flex: 1;
  }

  .metric-card {
    min-height: 98px;
  }

  .segmented {
    width: 100%;
    overflow-x: auto;
  }

  .filter-group {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
    gap: 5px;
  }

  .segmented button {
    min-width: max-content;
  }

  .drawer-footer {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .drawer-footer > div,
  .drawer-footer button {
    width: 100%;
  }

  .records-wrap {
    padding: 10px;
  }

  .record-card {
    grid-template-columns: 1fr 34px;
    align-items: start;
    gap: 12px;
    min-height: 0;
  }

  .record-main {
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: start;
  }

  .record-index {
    width: 38px;
    height: 38px;
  }

  .record-title h3 {
    white-space: normal;
  }

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

  .record-numbers div {
    min-height: 52px;
    border: 1px solid var(--line-soft);
    border-radius: 7px;
    padding: 8px;
    background: var(--surface-muted);
  }

  .sku-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .sku-heading .ghost-button {
    width: 100%;
  }

  .sku-grid-head {
    display: none;
  }

  .sku-row {
    grid-template-columns: 1fr 1fr;
  }

  .sku-name {
    grid-column: 1 / -1;
  }

  .sku-remove {
    width: 100%;
  }
}
