:root {
  --bg: #f9fafb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #111827;
  --text-muted: #6b7280;
  --primary-50: #f0f4ff;
  --primary-100: #e0e7ff;
  --primary-500: #667eea;
  --primary-600: #5b21b6;
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --line: #e5e7eb;
  --line-soft: #edf1f5;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow: 0 10px 30px rgba(17, 24, 39, 0.05);
  --dashboard-title-size: 16px;
  --dashboard-title-weight: 700;
  --dashboard-title-margin-bottom: 4px;
  --detail-chip-min-height: 28px;
  --detail-chip-font-size: 13px;
  --detail-chip-gap: 6px;
  --detail-chip-padding-y: 5px;
  --detail-chip-padding-x: 10px;
  --list-card-gap: 8px;
  --list-card-line-height: 1.45;
  --list-card-button-height: 38px;
  --list-card-button-padding-x: 14px;
  --list-row-title-size: 16px;
  --list-row-title-weight: 700;
  --list-row-title-color: #0f172a;
  --list-row-subtitle-size: 12px;
  --list-row-subtitle-color: #64748b;
  --control-height: 40px;
  --toolbar-gap: 8px;
  --toolbar-padding-y: 12px;
  --toolbar-padding-x: 12px;
  --form-grid-gap-x: 12px;
  --form-grid-gap-y: 10px;
  --form-card-padding: 14px;
  --detail-block-gap: 8px;
  --section-title-size: 18px;
  --section-title-line-height: 1.35;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 24px 24px calc(24px + env(safe-area-inset-bottom, 0px));
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

body.has-nav {
  padding-left: 248px;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.2px;
}

p {
  margin: 0;
}

.page-subtitle {
  margin: -8px 0 14px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

/* 统一顶部组件：避免被页面通用 header/h1/p 样式覆盖导致错位 */
#global-top-header header {
  display: block;
  width: 100%;
  margin: 0;
}

#global-top-header h1 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.75rem;
  font-weight: 700;
  letter-spacing: 0;
}

#global-top-header p {
  margin: 0;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 2px 0;
  flex-wrap: wrap;
}

.page-head > button {
  min-height: var(--control-height);
  padding: 0 14px;
}

.page-head .page-action {
  min-height: var(--control-height);
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--primary-gradient);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.28);
}

.page-head .page-action:hover {
  filter: brightness(0.97);
}

nav {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 224px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 100;
}

nav .nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 10px;
  border-bottom: 1px solid var(--line-soft);
}

nav .nav-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--primary-gradient);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
}

nav .nav-brand-text {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
}

nav .nav-brand-text strong {
  font-size: 14px;
  line-height: 1.2;
  color: #0f172a;
}

nav .nav-brand-text small {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.2;
}

nav .nav-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

nav a {
  min-height: 40px;
  border-radius: 10px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: #4b5563;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

nav a .nav-link-icon {
  width: 16px;
  margin-right: 8px;
  color: #6b7280;
  text-align: center;
}

nav a:hover {
  color: #374151;
  background: #f3f4f6;
}

nav a.active {
  color: var(--primary-500);
  background: var(--primary-50);
  border-color: var(--primary-100);
}

nav a.active .nav-link-icon {
  color: var(--primary-500);
}

nav .nav-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#roleBadge {
  min-height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--text-muted);
  font-size: 12px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
}

nav button#logout {
  min-height: 38px;
}

a {
  color: var(--primary-500);
}

input,
button,
select,
textarea {
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  min-height: var(--control-height);
  padding: 0 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

textarea {
  min-height: 92px;
  padding: 10px 12px;
  resize: vertical;
}

input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  min-width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
  margin: 0;
  border-radius: 4px;
  box-shadow: none;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.14);
}

input.field-readonly,
textarea.field-readonly,
select.field-readonly {
  border-style: dashed;
  border-color: #cdd8e8;
  background: #f8fafc;
  color: #64748b;
  box-shadow: none;
}

button.field-readonly,
a.field-readonly {
  opacity: 0.72;
  pointer-events: none;
}

.batch-toolbar .batch-toolbar-action.field-readonly,
.batch-toolbar .batch-toolbar-select.field-readonly {
  opacity: 1;
  color: #64748b;
  border-style: dashed;
  border-color: #cdd8e8;
  background: #f8fafc;
  box-shadow: none;
}

button {
  cursor: pointer;
  background: var(--primary-gradient);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.24);
}

button:hover:not(:disabled) {
  filter: brightness(0.97);
}

button:focus-visible,
a:focus-visible,
nav a:focus-visible,
.page-head .page-action:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.btn-secondary,
button#back,
button#retry {
  color: #374151;
  background: #f3f4f6;
  border-color: var(--line);
  box-shadow: none;
}

.btn-danger {
  background: #ef4444;
  border-color: #ef4444;
  box-shadow: none;
}

.btn-success {
  background: #10b981;
  border-color: #10b981;
  box-shadow: none;
}

a.btn-secondary,
a.btn-danger,
a.btn-success {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border-width: 1px;
  border-style: solid;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--toolbar-gap);
  align-items: center;
  margin: 0 0 12px;
  padding: var(--toolbar-padding-y) var(--toolbar-padding-x);
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.toolbar + .toolbar {
  margin-top: -4px;
}

.toolbar .empty {
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
}

.toolbar > .empty:last-child {
  margin-left: auto;
}

.toolbar > input,
.toolbar > select {
  min-height: var(--control-height);
}

.toolbar > button,
.toolbar > a {
  min-height: var(--control-height);
}

.toolbar > button {
  min-width: 96px;
}

.batch-toolbar {
  border-style: dashed;
  border-color: #dbe7ff;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
  align-items: stretch;
  row-gap: 8px;
  width: fit-content;
  max-width: 100%;
  margin-left: 0;
  padding: 10px 14px;
  column-gap: 10px;
}

.batch-toolbar .batch-toolbar-item {
  min-height: var(--control-height);
}

.batch-toolbar .batch-toolbar-field {
  min-width: 160px;
}

.batch-toolbar .batch-toolbar-action,
.batch-toolbar .batch-toolbar-select {
  min-width: 110px;
}

.batch-toolbar .batch-toolbar-action.btn-danger {
  box-shadow: none;
}

.batch-toolbar .batch-toolbar-count,
.batch-toolbar .empty {
  min-height: 32px;
  border: 1px solid #dbe7ff;
  border-radius: 999px;
  background: #eff4ff;
  color: #3b4b6d;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
}

.section-title {
  margin: 10px 0 8px;
  font-size: var(--section-title-size);
  line-height: var(--section-title-line-height);
  font-weight: 600;
  color: #1f2937;
  letter-spacing: 0.1px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  column-gap: var(--form-grid-gap-x);
  row-gap: var(--form-grid-gap-y);
  align-items: center;
  margin-bottom: 12px;
}

.form-grid > input,
.form-grid > select {
  width: 100%;
  min-height: var(--control-height);
}

.form-grid > textarea {
  width: 100%;
  min-height: 92px;
}

.create-form {
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  align-items: end;
}

.create-page {
  background: radial-gradient(1100px 430px at 50% -180px, #e9f2ff 0%, var(--bg) 60%);
}

.detail-page {
  background: radial-gradient(1100px 430px at 50% -180px, #eaf2ff 0%, var(--bg) 60%);
}

.create-page-form {
  margin-top: 4px;
}

.create-section {
  grid-column: 1 / -1;
}

.create-block-card {
  border-color: #dbe7f3;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.create-section-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  column-gap: var(--form-grid-gap-x);
  row-gap: var(--form-grid-gap-y);
  align-items: end;
}

.create-block-grid {
  align-items: end;
}

.create-block-grid > button[type='button'] {
  min-height: var(--control-height);
}

.create-section-grid .section-title {
  grid-column: 1 / -1;
  margin: 0 0 2px;
}

.create-submit {
  grid-column: 1 / -1;
  max-width: 220px;
}

.create-primary-submit {
  min-height: 42px;
  box-shadow: 0 10px 22px rgba(79, 70, 229, 0.26);
}

.create-order-form .order-notes {
  min-height: 42px;
}

.create-order-page .create-order-scope-meta {
  margin: 2px 0 10px;
}

.create-order-page .create-order-scope-meta .detail-scope-chip {
  min-height: 30px;
}

.create-items-list {
  margin-top: 6px;
}

.create-items-list .card {
  border-color: #dde7f5;
  background: #fbfdff;
}

.create-order-page.create-order-readonly-mode .create-block-card,
.create-order-page .create-block-card.create-order-card-readonly {
  border-style: dashed;
  border-color: #cdd8e8;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  box-shadow: none;
}

.create-order-page .create-items-list.create-order-list-readonly .order-item-row,
.create-order-page .create-items-list .order-item-row.create-order-item-readonly {
  border-color: #d6dde8;
  background: #f8fafc;
  box-shadow: none;
}

.list-page {
  background: radial-gradient(1200px 460px at 50% -190px, #eaf2ff 0%, var(--bg) 58%);
}

.list-page .list {
  margin-top: 10px;
}

.list-page .list > .card {
  border-color: #dfe7f2;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  animation: list-card-rise-in 0.24s ease both;
}

.list-page .list > .card:nth-child(2) { animation-delay: 0.02s; }
.list-page .list > .card:nth-child(3) { animation-delay: 0.04s; }
.list-page .list > .card:nth-child(4) { animation-delay: 0.06s; }
.list-page .list > .card:nth-child(5) { animation-delay: 0.08s; }
.list-page .list > .card:nth-child(6) { animation-delay: 0.1s; }

.list-page .list > .card:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(17, 24, 39, 0.08);
}

@keyframes list-card-rise-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.management-page {
  background: radial-gradient(1100px 430px at 50% -180px, #e8f1ff 0%, var(--bg) 60%);
}

.management-create-card {
  border-color: #dfe7f2;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.management-create-grid {
  margin-bottom: 0;
}

.management-filter-toolbar {
  border-color: #dfe7f2;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}

.list-filter-toolbar {
  border-color: #dfe7f2;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}

.list-filter-toolbar + .list-filter-toolbar {
  margin-top: 6px;
}

.list-filter-toolbar .empty {
  min-height: 30px;
  border: 1px solid #dbe7ff;
  border-radius: 999px;
  background: #eff4ff;
  color: #3b4b6d;
  padding: 3px 10px;
  display: inline-flex;
  align-items: center;
}

.list-filter-toolbar.dense-filter-toolbar {
  border-color: #d6e2fa;
  background: linear-gradient(180deg, #f5f9ff 0%, #ffffff 100%);
}

.order-list-page .order-list-scope-meta {
  margin: 2px 0 10px;
}

.order-list-page .order-list-scope-meta .detail-scope-chip {
  min-height: 30px;
}

.product-list-page .product-list-scope-meta {
  margin: 2px 0 10px;
}

.product-list-page .product-list-scope-meta .detail-scope-chip {
  min-height: 30px;
}

.customer-list-page .customer-list-scope-meta {
  margin: 2px 0 10px;
}

.customer-list-page .customer-list-scope-meta .detail-scope-chip {
  min-height: 30px;
}

.order-list-page .orders-filter-toolbar {
  border-color: #d6e2fa;
  background: linear-gradient(180deg, #f5f9ff 0%, #ffffff 100%);
}

.product-list-page .products-filter-toolbar {
  border-color: #d6e2fa;
  background: linear-gradient(180deg, #f5f9ff 0%, #ffffff 100%);
}

.customer-list-page .customers-filter-toolbar {
  border-color: #d6e2fa;
  background: linear-gradient(180deg, #f5f9ff 0%, #ffffff 100%);
}

.product-list-page .product-batch-toolbar {
  border-color: #cfdbff;
  background: linear-gradient(180deg, #f4f8ff 0%, #ffffff 100%);
}

.order-list-page .order-batch-toolbar {
  border-color: #cfdbff;
  background: linear-gradient(180deg, #f4f8ff 0%, #ffffff 100%);
}

.customer-list-page .customer-batch-toolbar {
  border-color: #cfdbff;
  background: linear-gradient(180deg, #f4f8ff 0%, #ffffff 100%);
}

.order-list-page.list-readonly-mode .orders-filter-toolbar {
  border-style: dashed;
  border-color: #cdd8e8;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  box-shadow: none;
}

.customer-list-page.list-readonly-mode .customers-filter-toolbar,
.customer-list-page .customers-filter-toolbar.customers-filter-readonly {
  border-style: dashed;
  border-color: #cdd8e8;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  box-shadow: none;
}

.order-list-page.list-readonly-mode .order-batch-toolbar {
  border-style: solid;
  border-color: #cdd8e8;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  box-shadow: none;
}

.product-list-page .product-batch-toolbar.product-batch-readonly {
  border-style: solid;
  border-color: #cdd8e8;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  box-shadow: none;
}

.customer-list-page.list-readonly-mode .customer-batch-toolbar,
.customer-list-page .customer-batch-toolbar.customer-batch-readonly {
  border-style: solid;
  border-color: #cdd8e8;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  box-shadow: none;
}

.order-list-page.list-readonly-mode .order-batch-toolbar .batch-toolbar-count {
  border-color: #d5deea;
  background: #f1f5f9;
  color: #64748b;
}

.product-list-page .product-batch-toolbar.product-batch-readonly .batch-toolbar-count {
  border-color: #d5deea;
  background: #f1f5f9;
  color: #64748b;
}

.customer-list-page.list-readonly-mode .customer-batch-toolbar .batch-toolbar-count,
.customer-list-page .customer-batch-toolbar.customer-batch-readonly .batch-toolbar-count {
  border-color: #d5deea;
  background: #f1f5f9;
  color: #64748b;
}

.list-filter-toolbar.lookup-filter-toolbar {
  border-style: dashed;
  border-color: #d7e7ff;
}

.list-filter-toolbar.compact-filter-toolbar {
  background: linear-gradient(180deg, #f9fbff 0%, #ffffff 100%);
}

.list-pager {
  border-color: #dfe7f2;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}

.list-batch-anchor {
  min-height: 0;
}

.management-batch-anchor {
  min-height: 0;
}

.management-page .muted-tip {
  margin: 8px 0 10px;
}

.order-create-form {
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  align-items: end;
}

.order-field-group {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  column-gap: var(--form-grid-gap-x);
  row-gap: var(--form-grid-gap-y);
}

.order-field-group .section-title {
  grid-column: 1 / -1;
  margin: 0 0 2px;
}

.order-items-editor {
  grid-column: 1 / -1;
}

.order-items-inputs {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr) auto;
  column-gap: var(--form-grid-gap-x);
  row-gap: var(--form-grid-gap-y);
  align-items: end;
}

.order-items-list {
  margin-top: 0;
  gap: 8px;
}

.order-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}

.order-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.order-item-remove {
  min-width: 72px;
}

.order-notes {
  grid-column: 1 / -1;
}

.order-submit {
  grid-column: 1 / -1;
  max-width: 220px;
}

.order-detail-inline {
  grid-template-columns: minmax(240px, 1fr) auto;
  column-gap: var(--form-grid-gap-x);
  row-gap: var(--form-grid-gap-y);
  align-items: end;
  margin-bottom: 0;
}

.order-detail-ship-grid {
  grid-template-columns: minmax(140px, 1fr) minmax(160px, 1fr) auto;
  column-gap: var(--form-grid-gap-x);
  row-gap: var(--form-grid-gap-y);
  align-items: end;
  margin-bottom: 0;
}

.input-with-scan {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  column-gap: 8px;
  align-items: center;
}

.input-with-scan > input {
  width: 100%;
  min-width: 0;
}

.btn-scan {
  min-width: 44px;
  width: 44px;
  min-height: var(--control-height);
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f3f4f6;
  color: #4b5563;
  box-shadow: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-scan:hover:not(:disabled) {
  filter: brightness(0.98);
}

.btn-scan > i {
  font-size: 14px;
}

.scanner-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(2px);
}

.scanner-dialog {
  width: min(520px, 100%);
  border-radius: 12px;
  border: 1px solid #dbe5f3;
  background: #ffffff;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.24);
  padding: 14px;
}

.scanner-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.scanner-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  font-weight: 700;
  color: #0f172a;
}

.scanner-close {
  min-height: 34px;
  min-width: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: #64748b;
  box-shadow: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.scanner-reader {
  width: 100%;
  min-height: 220px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  overflow: hidden;
  background: #f8fafc;
}

.scanner-tip {
  margin: 10px 0 0;
  font-size: 12px;
  color: #64748b;
}

.scanner-result {
  margin-top: 8px;
  border-radius: 10px;
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #166534;
  padding: 8px 10px;
  font-size: 12.5px;
  line-height: 1.45;
}

.order-detail-action-btn {
  max-width: 220px;
}

.levels-create-grid {
  grid-template-columns: minmax(120px, 0.9fr) minmax(180px, 1fr) minmax(240px, 1.5fr) auto;
  column-gap: var(--form-grid-gap-x);
  row-gap: var(--form-grid-gap-y);
  align-items: end;
}

.levels-create-grid > button[type='submit'] {
  grid-column: auto;
}

.levels-row-grid {
  grid-template-columns: minmax(180px, 1fr) minmax(260px, 1.5fr) auto auto;
  margin-bottom: 0;
}

.levels-card {
  padding: 14px;
}

.form-grid > button[type='submit'],
.form-grid > .full-row,
.form-grid > .card,
.form-grid > .form-card {
  grid-column: 1 / -1;
}

.form-card {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: var(--form-card-padding);
}

.form-card > .section-title:first-child {
  margin-top: 0;
}

.form-card:not(.list-card-compact) .dashboard-title {
  margin: 0 0 6px;
  font-size: 17px;
  line-height: 1.35;
  color: #0f172a;
}

.form-card:not(.list-card-compact) .detail-meta {
  gap: var(--detail-block-gap);
  margin: 2px 0;
}

.detail-hero-card {
  border-color: #dbe7ff;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}

.detail-hero-card .dashboard-title {
  margin-bottom: 6px;
}

.detail-edit-form {
  margin-top: 2px;
}

.detail-scope-meta {
  margin: 2px 0 10px;
}

.detail-scope-chip {
  border-style: dashed;
  border-color: #cdd8e8;
  background: #f8fafc;
  color: #475569;
}

.detail-scope-chip.scope-chip-ok {
  border-style: solid;
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.detail-scope-chip.scope-chip-readonly {
  border-style: solid;
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.detail-scope-chip.scope-chip-error {
  border-style: solid;
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.detail-edit-card {
  border-color: #dfe7f2;
  background: #fbfdff;
}

.detail-edit-form.detail-form-readonly .detail-edit-card {
  border-style: dashed;
  border-color: #cdd8e8;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.detail-edit-form.detail-form-identity-lock .detail-edit-card {
  box-shadow: inset 2px 0 0 #c7d2fe;
}

.detail-action-card {
  border-color: #e3e8f1;
  background: #fcfdff;
}

.detail-action-card .section-title {
  margin-bottom: 10px;
}

.detail-action-card .form-grid {
  margin-bottom: 0;
}

.detail-order-notes-card {
  border-color: #dbe5f3;
  background: linear-gradient(180deg, #fcfdff 0%, #f8fbff 100%);
}

.detail-order-refund-card {
  border-color: #fde68a;
  background: linear-gradient(180deg, #fffbeb 0%, #fff7ed 100%);
}

.detail-action-card.detail-order-card-readonly {
  border-style: dashed;
  border-color: #cdd8e8;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  box-shadow: none;
}

.detail-action-card.detail-order-card-readonly .section-title {
  color: #475569;
}

.detail-danger-card {
  border-color: #fecaca;
  background: #fff7f7;
}

.detail-danger-card .section-title {
  color: #9f1239;
}

.detail-section-title {
  margin: 14px 0 8px;
  font-size: 16px;
  line-height: 1.35;
  color: #334155;
}

.detail-list {
  margin-top: 6px;
  gap: 10px;
}

.detail-list .card.form-card {
  padding: 12px;
  box-shadow: inset 2px 0 0 #dbe5f3, var(--shadow);
}

.detail-list .dashboard-title {
  font-size: 15px;
  margin-bottom: 4px;
}

.detail-related-order-card {
  border-color: #dbe5f3;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.detail-related-order-desc {
  margin: 0 0 4px;
  color: #64748b;
  font-size: 12.5px;
  line-height: 1.35;
}

.detail-order-item-card {
  border-color: #dbe5f3;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.detail-order-shipment-card {
  border-color: #dbeafe;
  background: linear-gradient(180deg, #f8fbff 0%, #f0f7ff 100%);
}

.detail-empty {
  margin-top: 6px;
}

.form-grid > .form-actions {
  grid-column: 1 / -1;
}

.form-grid > .form-actions > button,
.form-grid > .form-actions > a {
  min-height: var(--control-height);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.muted-tip {
  margin: 6px 0 10px;
  color: var(--text-muted);
}

.scope-tip {
  margin: 6px 0 10px;
  padding: 9px 10px;
  border-style: solid;
  border-color: #c7d2fe;
  background: linear-gradient(180deg, #f8fbff 0%, #f3f7ff 100%);
  color: #475569;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.scope-tip::before {
  content: '';
  width: 8px;
  min-width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, #6366f1 0%, #3b82f6 100%);
}

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

.dashboard-page {
  background: radial-gradient(1100px 460px at 50% -180px, #e8f0ff 0%, var(--bg) 56%);
}

.agent-dashboard-page .agent-dashboard-scope-meta {
  margin: 2px 0 10px;
}

.agent-dashboard-page .agent-dashboard-scope-meta .detail-scope-chip {
  min-height: 30px;
}

.dashboard-entry-grid {
  margin-top: 6px;
}

.agent-dashboard-page.dashboard-readonly-mode .dashboard-entry-grid,
.agent-dashboard-page .dashboard-entry-grid.dashboard-entry-readonly {
  border-radius: 12px;
  border: 1px dashed #d7e0ec;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  padding: 8px;
}

.dashboard-card {
  display: block;
  text-decoration: none;
  color: var(--text);
}

.dashboard-entry-card {
  position: relative;
  min-height: 112px;
  padding: 14px;
  border-color: #dfe7f2;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
  box-shadow: 0 10px 26px rgba(17, 24, 39, 0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.dashboard-entry-card:hover {
  transform: translateY(-2px);
  border-color: #bfdbfe;
  box-shadow: 0 14px 30px rgba(30, 64, 175, 0.14);
}

.dashboard-entry-card.field-readonly {
  opacity: 1;
  border-style: dashed;
  border-color: #cdd8e8;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  box-shadow: none;
  transform: none;
}

.dashboard-entry-card.field-readonly:hover {
  transform: none;
  border-color: #cdd8e8;
  box-shadow: none;
}

.dashboard-entry-card.field-readonly .dashboard-title {
  color: #334155;
}

.dashboard-entry-card.field-readonly .dashboard-desc {
  color: #64748b;
}

.dashboard-entry-card.field-readonly::after {
  content: '只读';
  position: absolute;
  top: 10px;
  right: 10px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #64748b;
  font-size: 11px;
  line-height: 1.2;
  padding: 2px 7px;
  letter-spacing: 0.01em;
}

.dashboard-title {
  margin-bottom: var(--dashboard-title-margin-bottom);
  font-size: var(--dashboard-title-size);
  font-weight: var(--dashboard-title-weight);
  line-height: 1.35;
}

.dashboard-desc {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.auth-wrap {
  max-width: 430px;
  margin: 56px auto 0;
}

.auth-page {
  background: radial-gradient(900px 380px at 50% -170px, #dbe7ff 0%, var(--bg) 58%);
}

.auth-card {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.role-auth-card {
  border-color: #dbe7ff;
  background: linear-gradient(180deg, #fdfefe 0%, #f8fbff 100%);
}

.auth-head {
  margin-bottom: 8px;
}

.auth-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.auth-form-stack {
  gap: 10px;
}

.auth-form-stack > button {
  min-height: 42px;
}

.auth-msg {
  min-height: 18px;
  margin-top: 8px;
  color: #475569;
  font-size: 13px;
}

.stats-page {
  background: radial-gradient(1000px 420px at 50% -180px, #e9f2ff 0%, var(--bg) 58%);
}

.agent-stats-page .agent-stats-scope-meta {
  margin: 2px 0 10px;
}

.agent-stats-page .agent-stats-scope-meta .detail-scope-chip {
  min-height: 30px;
}

.stats-toolbar {
  border-color: #dbe7ff;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}

.agent-stats-page .agent-stats-toolbar {
  border-color: #d6e2fa;
  background: linear-gradient(180deg, #f5f9ff 0%, #ffffff 100%);
}

.stats-toolbar > button {
  min-width: 120px;
}

.stats-panel-card {
  margin-top: 10px;
  border-color: #dfe7f2;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.agent-stats-page .agent-stats-panel {
  border-color: #dbe7ff;
  background: linear-gradient(180deg, #fdfefe 0%, #f8fbff 100%);
}

.agent-stats-page.stats-readonly-mode .agent-stats-toolbar,
.agent-stats-page .agent-stats-toolbar.stats-toolbar-readonly {
  border-style: dashed;
  border-color: #cdd8e8;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  box-shadow: none;
}

.agent-stats-page.stats-readonly-mode .agent-stats-panel,
.agent-stats-page .agent-stats-panel.stats-panel-readonly {
  border-style: dashed;
  border-color: #cdd8e8;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  box-shadow: none;
}

.agent-stats-page.stats-readonly-mode .agent-stats-panel .section-title,
.agent-stats-page .agent-stats-panel.stats-panel-readonly .section-title {
  color: #475569;
}

.stats-summary-card .section-title,
.stats-chart-card .section-title {
  margin-bottom: 10px;
}

.stats-chart-card .stats-row {
  padding: 2px 0;
}

.list {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.card {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 12px;
  line-height: 1.55;
}

.card:hover {
  border-color: #d1d5db;
}

.empty {
  margin-top: 10px;
  border-radius: 10px;
  border: 1px dashed #d1d5db;
  background: var(--surface);
  color: var(--text-muted);
  padding: 10px 12px;
}

.error {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.loading {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #dbeafe;
  background: #eff6ff;
  color: #1d4ed8;
}

.success {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.hidden {
  display: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  border-radius: 10px;
  background: #111827;
  color: #fff;
  padding: 10px 14px;
  font-size: 13px;
  z-index: 1200;
}

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 9999;
  padding: 16px;
  background: rgba(17, 24, 39, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-mask.hidden {
  display: none !important;
}

.modal-card {
  width: min(560px, 100%);
  max-height: 80vh;
  overflow: auto;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 20px 40px rgba(17, 24, 39, 0.15);
  padding: 14px;
}

.modal-card:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2), 0 20px 40px rgba(17, 24, 39, 0.15);
}

.modal-body {
  margin: 10px 0 12px;
  white-space: pre-wrap;
  color: var(--text);
}

.modal-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.pager {
  margin-top: 12px;
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: center;
  justify-content: end;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.pager > button {
  min-width: 96px;
  min-height: var(--control-height);
}

.pager #page {
  min-width: 72px;
  min-height: var(--control-height);
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: var(--surface-soft);
  color: #334155;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.stats-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}

.stats-label {
  width: 92px;
  color: var(--text-muted);
}

.stats-track {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.stats-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--primary-gradient);
  min-width: 6px;
  max-width: 100%;
}

.stats-value {
  color: #0f172a;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

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

.stat-card {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 12px;
}

.stat-label {
  color: var(--text-muted);
  font-size: 12px;
}

.stat-value {
  margin-top: 6px;
  font-size: 22px;
  line-height: 1.2;
  font-weight: 700;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--detail-block-gap);
  align-items: center;
}

.detail-chip {
  min-height: var(--detail-chip-min-height);
  border-radius: 999px;
  border: 1px solid #dbe2ea;
  background: #f8fafc;
  color: #1f2937;
  font-size: var(--detail-chip-font-size);
  line-height: 1.25;
  padding: var(--detail-chip-padding-y) var(--detail-chip-padding-x);
  display: inline-flex;
  align-items: center;
  gap: var(--detail-chip-gap);
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.list-select-chip {
  user-select: none;
  min-height: 30px;
  padding: 2px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  white-space: nowrap;
  justify-self: end;
  margin-left: auto;
}

.list-select-chip input[type="checkbox"],
.list-select-chip input[type="radio"] {
  margin-right: 0;
}

.admin-user-grid {
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  align-items: end;
  margin-bottom: 0;
}

.admin-user-grid .form-actions {
  grid-column: 1 / -1;
  justify-content: flex-end;
  margin-top: 2px;
}

.admin-user-grid input,
.admin-user-grid select {
  min-height: 38px;
}

.list-card-compact {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--list-card-gap);
  line-height: var(--list-card-line-height);
  padding: 14px;
}

.list-card-compact .form-grid {
  margin-bottom: 0;
}

.list-card-compact .form-actions {
  margin-top: 0;
  align-items: center;
}

.list-card-compact .form-actions > button,
.list-card-compact .form-actions > a {
  min-height: var(--list-card-button-height);
  padding: 0 var(--list-card-button-padding-x);
}

.list-card-compact .list-detail-toggle {
  min-width: 112px;
  justify-content: center;
}

.list-card-compact .list-detail-toggle[disabled] {
  opacity: 0.75;
}

.list-card-compact .dashboard-title,
.list-card-compact .detail-meta,
.list-card-compact .dashboard-desc {
  margin: 0;
}

.list-card-compact .dashboard-title {
  font-size: var(--list-row-title-size);
  font-weight: var(--list-row-title-weight);
  line-height: 1.35;
  color: var(--list-row-title-color);
  letter-spacing: 0.1px;
}

a.dashboard-title.list-row-title {
  color: var(--list-row-title-color);
  text-decoration: none;
}

a.dashboard-title.list-row-title:hover {
  color: #3730a3;
  text-decoration: underline;
}

.list-row-subtitle {
  margin: -2px 0 1px;
  font-size: var(--list-row-subtitle-size);
  line-height: 1.4;
  color: var(--list-row-subtitle-color);
}

.list-card-compact .detail-meta {
  align-items: center;
}

.list-card-compact .detail-meta.list-row-meta {
  row-gap: 6px;
}

.list-card-compact .form-actions.list-row-actions {
  gap: 10px;
}

.list-card-compact .list-select-chip {
  background: #f3f6fb;
  border-color: #dde6f1;
  color: #334155;
}

.list-row-products {
  box-shadow: inset 3px 0 0 #93c5fd, var(--shadow);
}

.list-row-agents {
  box-shadow: inset 3px 0 0 #a7f3d0, var(--shadow);
}

.list-row-customers {
  box-shadow: inset 3px 0 0 #bfdbfe, var(--shadow);
}

.list-row-orders {
  box-shadow: inset 3px 0 0 #c7d2fe, var(--shadow);
}

.list-row-orders.list-row-order-readonly {
  border-color: #e2e8f0;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  box-shadow: inset 3px 0 0 #e2e8f0, var(--shadow);
}

.list-row-orders.list-row-order-readonly .list-select-chip-readonly {
  border-style: dashed;
  border-color: #d6dde8;
  background: #f8fafc;
  color: #64748b;
}

.list-row-users {
  box-shadow: inset 3px 0 0 #ddd6fe, var(--shadow);
}

.list-row-logs {
  box-shadow: inset 3px 0 0 #fde68a, var(--shadow);
}

.list-row-levels {
  box-shadow: inset 3px 0 0 #86efac, var(--shadow);
}

.log-changes {
  margin: 0;
  border-radius: 8px;
  border: 1px dashed #dbe2ea;
  background: #f8fafc;
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1.45;
  color: #475569;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-variant-numeric: tabular-nums;
}

.select-row {
  user-select: none;
}

.chip-status-pending {
  border-color: #fcd9a8;
  background: #fef3c7;
  color: #b45309;
}

.chip-status-shipped {
  border-color: #bae6fd;
  background: #e0f2fe;
  color: #0369a1;
}

.chip-status-completed {
  border-color: #bbf7d0;
  background: #dcfce7;
  color: #166534;
}

.chip-status-refunding {
  border-color: #fbcfe8;
  background: #fce7f3;
  color: #be185d;
}

.chip-status-cancelled {
  border-color: #fecaca;
  background: #fee2e2;
  color: #b91c1c;
}

.chip-payment-paid {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.chip-payment-partial {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.chip-payment-unpaid {
  border-color: #d1d5db;
  background: #f9fafb;
  color: #4b5563;
}

.chip-refund-none {
  border-color: #d1d5db;
  background: #f9fafb;
  color: #4b5563;
}

.chip-refund-requested,
.chip-refund-approved {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.chip-refund-rejected {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.chip-role-admin {
  border-color: #ddd6fe;
  background: #f5f3ff;
  color: #5b21b6;
}

.chip-role-agent {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.chip-role-fahuo {
  border-color: #bae6fd;
  background: #ecfeff;
  color: #0e7490;
}

.chip-user-active {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.chip-user-inactive {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.chip-log-login {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.chip-log-setting {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.chip-log-order {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.chip-log-agent {
  border-color: #ddd6fe;
  background: #f5f3ff;
  color: #6d28d9;
}

.chip-log-product {
  border-color: #fbcfe8;
  background: #fdf2f8;
  color: #be185d;
}

.chip-product-online {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.chip-product-offline {
  border-color: #e5e7eb;
  background: #f8fafc;
  color: #475569;
}

.order-detail-panel {
  margin-top: 8px;
  border-radius: 10px;
  border: 1px solid #eef2f7;
  background: #fbfdff;
  padding: 8px;
}

.flash-input {
  outline: 2px solid var(--primary-500);
  background: var(--primary-50);
}

.flash-card {
  outline: 2px solid var(--primary-500);
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 1024px) {
  body {
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  }

  body.has-nav {
    padding-left: 16px;
    padding-top: 16px;
  }

  nav {
    position: static;
    width: auto;
    border-right: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 14px;
    box-shadow: var(--shadow);
  }

  nav .nav-brand {
    padding: 0 0 8px;
  }

  nav .nav-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-content: start;
    flex: 0 0 auto;
    overflow: visible;
    padding-right: 0;
  }

  nav .nav-links > a {
    width: 100%;
  }

  nav .nav-footer {
    margin-top: 10px;
    display: grid;
    grid-template-columns: minmax(150px, 1fr) auto;
    gap: 8px;
    align-items: center;
  }

  #roleBadge {
    grid-column: 1 / -1;
    min-width: 0;
    justify-content: flex-start;
  }

  nav button#logout {
    width: auto;
    min-width: 96px;
    justify-self: end;
  }

  .list-filter-toolbar,
  .management-filter-toolbar {
    display: grid;
    align-items: stretch;
    gap: 8px;
  }

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

  .list-filter-toolbar.dense-filter-toolbar > input:first-child,
  .list-filter-toolbar.dense-filter-toolbar > .empty {
    grid-column: 1 / -1;
  }

  .list-filter-toolbar.lookup-filter-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .list-filter-toolbar.lookup-filter-toolbar > input:first-child {
    grid-column: 1 / -1;
  }

  .list-filter-toolbar.compact-filter-toolbar,
  .management-filter-toolbar.compact-filter-toolbar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .management-filter-toolbar.compact-filter-toolbar > input:first-child {
    grid-column: 1 / -1;
  }

  .stats-toolbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 8px;
  }

  .stats-toolbar > button {
    min-width: 0;
  }

  .stats-toolbar > button:first-child {
    grid-column: 1 / -1;
  }

  .create-form,
  .create-section-grid,
  .order-create-form,
  .order-field-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .order-items-inputs > button {
    grid-column: 1 / -1;
  }

  .order-detail-inline,
  .order-detail-ship-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-detail-ship-grid > .input-with-scan {
    grid-column: 1 / -1;
  }

  .order-detail-ship-grid > button,
  .order-detail-inline > button {
    grid-column: 1 / -1;
  }

  .levels-create-grid,
  .admin-user-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .levels-create-grid > button[type='submit'] {
    grid-column: 1 / -1;
  }

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

  .list-pager > button {
    min-width: 84px;
  }
}

@media (max-width: 768px) {
  body {
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  }

  h1 {
    font-size: 24px;
  }

  .page-subtitle {
    margin: -4px 0 10px;
    font-size: 13px;
    line-height: 1.45;
  }

  .scope-tip {
    margin: 4px 0 8px;
    padding: 8px 10px;
    gap: 6px;
    font-size: 13px;
    line-height: 1.4;
  }

  .scope-tip::before {
    width: 7px;
    min-width: 7px;
    height: 7px;
    margin-top: 5px;
  }

  .dashboard-entry-card.field-readonly::after {
    top: 8px;
    right: 8px;
    font-size: 11px;
    padding: 1px 6px;
  }

  nav .nav-links {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    flex: 0 0 auto;
    overflow: visible;
    padding-right: 0;
  }

  nav {
    padding: 10px;
    gap: 8px;
  }

  nav .nav-brand {
    padding-bottom: 6px;
  }

  nav a {
    min-height: 44px;
    padding: 0 10px;
  }

  nav .nav-footer {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    align-items: stretch;
  }

  #roleBadge {
    width: 100%;
    justify-content: flex-start;
  }

  nav button#logout {
    width: 100%;
    min-width: 0;
    justify-self: stretch;
  }

  input,
  textarea,
  select,
  button {
    width: 100%;
    min-height: 42px;
    margin: 0;
    font-size: 15px;
  }

  input[type="checkbox"],
  input[type="radio"] {
    width: 16px;
    min-width: 16px;
    height: 16px;
    min-height: 16px;
  }

  .page-head {
    align-items: stretch;
    gap: 8px;
    margin-bottom: 10px;
  }

  .page-head > button,
  .page-head .page-action {
    width: 100%;
  }

  .detail-page .page-head > h1 {
    width: 100%;
  }

  .page-head > button#back {
    width: auto;
    min-width: 88px;
    padding: 0 12px;
    align-self: flex-start;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
  }

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

  .stats-toolbar > button:first-child {
    grid-column: 1 / -1;
  }

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

  .order-list-page .order-list-scope-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 8px;
    row-gap: 6px;
    margin-bottom: 8px;
  }

  .order-list-page .order-list-scope-meta .detail-scope-chip {
    width: 100%;
    justify-content: flex-start;
  }

  .create-order-page .create-order-scope-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 8px;
    row-gap: 6px;
    margin-bottom: 8px;
  }

  .create-order-page .create-order-scope-meta .detail-scope-chip {
    width: 100%;
    justify-content: flex-start;
  }

  .product-list-page .product-list-scope-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 8px;
    row-gap: 6px;
    margin-bottom: 8px;
  }

  .product-list-page .product-list-scope-meta .detail-scope-chip {
    width: 100%;
    justify-content: flex-start;
  }

  .agent-dashboard-page .agent-dashboard-scope-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 8px;
    row-gap: 6px;
    margin-bottom: 8px;
  }

  .agent-dashboard-page .agent-dashboard-scope-meta .detail-scope-chip {
    width: 100%;
    justify-content: flex-start;
  }

  .agent-stats-page .agent-stats-scope-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 8px;
    row-gap: 6px;
    margin-bottom: 8px;
  }

  .agent-stats-page .agent-stats-scope-meta .detail-scope-chip {
    width: 100%;
    justify-content: flex-start;
  }

  .customer-list-page .customer-list-scope-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 8px;
    row-gap: 6px;
    margin-bottom: 8px;
  }

  .customer-list-page .customer-list-scope-meta .detail-scope-chip {
    width: 100%;
    justify-content: flex-start;
  }

  .list-filter-toolbar > input:first-child,
  .list-filter-toolbar > .empty {
    grid-column: 1 / -1;
  }

  .list-filter-toolbar > button,
  .list-filter-toolbar > a {
    min-height: 42px;
  }

  .list-filter-toolbar.lookup-filter-toolbar > select:first-of-type {
    grid-column: 1 / -1;
  }

  .list-filter-toolbar.dense-filter-toolbar > .empty {
    justify-content: center;
  }

  .batch-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    margin-left: 0;
  }

  .batch-toolbar .batch-toolbar-item {
    min-width: 0;
  }

  .batch-toolbar .batch-toolbar-field,
  .batch-toolbar .batch-toolbar-count {
    grid-column: 1 / -1;
  }

  .batch-toolbar .batch-toolbar-action,
  .batch-toolbar .batch-toolbar-select {
    min-height: 42px;
  }

  .batch-toolbar .batch-toolbar-count {
    justify-content: center;
  }

  .toolbar > .empty:last-child {
    margin-left: 0;
  }

  .section-title {
    font-size: 16px;
    margin: 8px 0 6px;
  }

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

  .order-create-form,
  .create-form,
  .create-section-grid,
  .order-field-group,
  .order-items-inputs,
  .order-detail-inline,
  .order-detail-ship-grid {
    grid-template-columns: 1fr;
    align-items: center;
  }

  .order-detail-ship-grid > .input-with-scan {
    grid-column: auto;
  }

  .scanner-modal {
    padding: 10px;
  }

  .scanner-dialog {
    padding: 12px;
  }

  .scanner-reader {
    min-height: 210px;
  }

  .create-submit,
  .order-submit,
  .order-detail-action-btn {
    max-width: none;
  }

  .create-primary-submit {
    min-height: 44px;
  }

  .management-page .muted-tip {
    margin: 6px 0 8px;
  }

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

  .management-filter-toolbar > input {
    grid-column: 1 / -1;
  }

  .management-filter-toolbar > button,
  .management-filter-toolbar > a {
    min-height: 42px;
  }

  .order-item-row button {
    width: auto;
  }

  .order-item-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 8px;
    row-gap: 6px;
    align-items: stretch;
    min-width: 0;
  }

  .order-item-meta .detail-chip {
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
  }

  .list-page .order-detail-panel .order-item-meta,
  .detail-page .detail-list .order-item-meta {
    grid-template-columns: 1fr;
  }

  .create-page .order-items-list .order-item-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .create-page .order-items-list .order-item-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .create-page .order-items-list .order-item-meta {
    width: 100%;
  }

  .create-page .order-items-list .order-item-remove {
    width: 100%;
    min-height: 42px;
  }

  .levels-create-grid,
  .levels-row-grid {
    grid-template-columns: 1fr;
    align-items: center;
  }

  .form-actions {
    flex-direction: column;
  }

  .list-card-compact .form-actions.list-row-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .list-card-compact .detail-meta.list-row-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 8px;
    row-gap: 6px;
    align-items: stretch;
  }

  .list-card-compact .detail-meta.list-row-meta .detail-chip {
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
    overflow-wrap: anywhere;
  }

  .list-card-compact .dashboard-title,
  .list-card-compact .list-row-subtitle {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .list-card-compact .list-select-chip {
    width: 100%;
    min-height: 40px;
    padding: 4px 8px;
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 6px;
    align-items: center;
    line-height: 1.35;
  }

  .list-card-compact .list-select-chip input[type="checkbox"],
  .list-card-compact .list-select-chip input[type="radio"] {
    align-self: center;
  }

  .log-changes {
    max-height: 140px;
    overflow: auto;
    padding: 6px 8px;
    line-height: 1.5;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  }

  .list-card-compact .form-actions.list-row-actions > button,
  .list-card-compact .form-actions.list-row-actions > a {
    width: 100%;
    min-height: 42px;
    justify-content: center;
  }

  .form-grid > .form-actions > a {
    width: 100%;
    min-height: 42px;
    justify-content: center;
  }

  .detail-section-title {
    margin: 8px 0 6px;
    font-size: 14px;
  }

  .detail-hero-card,
  .detail-action-card,
  .detail-danger-card,
  .detail-list .card.form-card {
    padding: 10px;
  }

  .detail-page .detail-meta {
    row-gap: 6px;
  }

  .detail-page .detail-hero-card .detail-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 8px;
    row-gap: 6px;
  }

  .order-detail-page .order-scope-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-page .detail-scope-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 8px;
    row-gap: 6px;
    margin-bottom: 8px;
  }

  .detail-page .detail-scope-meta .detail-scope-chip {
    width: 100%;
    justify-content: flex-start;
  }

  .detail-page .detail-hero-card .detail-chip {
    width: 100%;
    justify-content: flex-start;
  }

  .detail-page .detail-related-order-desc {
    font-size: 12px;
    line-height: 1.35;
  }

  .order-detail-page .detail-action-card {
    padding: 10px;
  }

  .order-detail-page .detail-action-card .section-title {
    margin-bottom: 8px;
  }

  .detail-page .detail-list .order-item-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .detail-page .detail-list .order-item-meta {
    width: 100%;
  }

  .detail-page .detail-list .detail-chip {
    width: 100%;
    justify-content: flex-start;
  }

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

  .dashboard-entry-card {
    min-height: 96px;
  }

  .auth-wrap {
    max-width: 100%;
    margin-top: 20px;
  }

  .auth-head {
    margin-bottom: 6px;
  }

  .modal-mask {
    padding: 12px;
  }

  .modal-card {
    max-height: 88vh;
    padding: 12px;
  }

  .modal-body {
    margin: 8px 0 10px;
  }

  .stats-toolbar > button {
    min-width: 0;
  }

  .card,
  .list-card-compact,
  .form-card:not(.list-card-compact) {
    padding: 10px;
  }

  .list-card-compact .dashboard-title {
    font-size: 15px;
  }

  .form-card:not(.list-card-compact) .dashboard-title {
    font-size: 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(100px, 1fr));
  }

  .stat-value {
    font-size: 20px;
  }

  .stats-row {
    display: grid;
    grid-template-columns: minmax(64px, auto) minmax(0, 1fr) minmax(46px, auto);
    column-gap: 6px;
    align-items: center;
  }

  .stats-label {
    width: auto;
    white-space: nowrap;
  }

  .stats-value {
    min-width: 46px;
    text-align: right;
  }

  .pager {
    grid-template-columns: 1fr auto 1fr;
    gap: 6px;
    padding: 8px 10px;
  }

  .pager > button {
    min-width: 0;
  }

  .pager > button:first-child {
    grid-column: 1;
  }

  .pager > button:last-child {
    grid-column: 3;
  }

  .pager #page {
    grid-column: 2;
    min-width: 56px;
  }

  .list-pager {
    margin-top: 8px;
  }
}

@media (max-width: 420px) {
  nav {
    padding: 8px;
    gap: 6px;
  }

  nav .nav-brand {
    gap: 8px;
    padding-bottom: 6px;
    align-items: flex-start;
  }

  nav .nav-logo {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 13px;
  }

  nav .nav-brand-text strong {
    font-size: 12.5px;
  }

  nav .nav-brand-text small {
    font-size: 11px;
    line-height: 1.25;
  }

  nav .nav-links {
    gap: 6px;
  }

  nav a {
    min-height: 40px;
    padding: 0 10px;
    font-size: 13px;
  }

  input:not([type="checkbox"]):not([type="radio"]),
  textarea,
  select,
  button,
  a.btn-secondary,
  a.btn-danger,
  a.btn-success {
    border-radius: 9px;
    padding: 0 10px;
  }

  textarea {
    padding: 8px 10px;
  }

  h1 {
    font-size: 21px;
    line-height: 1.25;
  }

  .page-subtitle {
    margin: -3px 0 8px;
    font-size: 12px;
    line-height: 1.4;
  }

  .order-list-page .order-list-scope-meta {
    grid-template-columns: 1fr;
    row-gap: 5px;
    margin-bottom: 6px;
  }

  .create-order-page .create-order-scope-meta {
    grid-template-columns: 1fr;
    row-gap: 5px;
    margin-bottom: 6px;
  }

  .product-list-page .product-list-scope-meta {
    grid-template-columns: 1fr;
    row-gap: 5px;
    margin-bottom: 6px;
  }

  .agent-dashboard-page .agent-dashboard-scope-meta {
    grid-template-columns: 1fr;
    row-gap: 5px;
    margin-bottom: 6px;
  }

  .agent-stats-page .agent-stats-scope-meta {
    grid-template-columns: 1fr;
    row-gap: 5px;
    margin-bottom: 6px;
  }

  .customer-list-page .customer-list-scope-meta {
    grid-template-columns: 1fr;
    row-gap: 5px;
    margin-bottom: 6px;
  }

  .scope-tip {
    margin: 3px 0 6px;
    padding: 6px 8px;
    gap: 5px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.35;
  }

  .scope-tip::before {
    width: 6px;
    min-width: 6px;
    height: 6px;
    margin-top: 4px;
  }

  .dashboard-entry-card.field-readonly::after {
    top: 6px;
    right: 6px;
    font-size: 10.5px;
    padding: 1px 5px;
  }

  .page-head {
    gap: 6px;
    margin-bottom: 8px;
    padding: 0;
  }

  .auth-wrap {
    margin-top: 12px;
  }

  .auth-card {
    padding: 10px;
    border-radius: 10px;
  }

  .auth-head {
    margin-bottom: 4px;
  }

  .auth-head h1 {
    font-size: 20px;
  }

  .auth-page .page-subtitle {
    margin: 0 0 6px;
    font-size: 12px;
    line-height: 1.35;
  }

  .auth-form,
  .auth-form-stack {
    gap: 6px;
  }

  .auth-form-stack > button {
    min-height: 40px;
    font-size: 13.5px;
  }

  .auth-msg {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.35;
  }

  .create-page .form-grid {
    column-gap: 6px;
    row-gap: 6px;
  }

  .create-page .form-card {
    padding: 10px;
  }

  .create-page .section-title {
    font-size: 14px;
    margin: 4px 0;
  }

  .create-page .create-section-grid .section-title,
  .create-page .order-field-group .section-title {
    margin: 2px 0;
  }

  .create-page .order-items-inputs {
    column-gap: 6px;
    row-gap: 6px;
  }

  .create-page .create-primary-submit,
  .create-page .order-submit {
    min-height: 42px;
    font-size: 14px;
  }

  .create-page .order-notes {
    min-height: 40px;
    font-size: 14px;
  }

  .create-page .order-items-list .order-item-remove {
    min-height: 40px;
    font-size: 13px;
  }

  .page-head > button#back {
    width: 100%;
  }

  .detail-page .detail-hero-card .detail-meta {
    grid-template-columns: 1fr;
  }

  .order-detail-page .order-scope-meta {
    grid-template-columns: 1fr;
  }

  .detail-page .detail-scope-meta {
    grid-template-columns: 1fr;
    row-gap: 5px;
    margin-bottom: 6px;
  }

  .detail-page .section-title {
    margin: 4px 0;
    font-size: 14px;
  }

  .detail-page .detail-section-title {
    margin: 4px 0;
    font-size: 13px;
    line-height: 1.3;
  }

  .detail-page .detail-hero-card,
  .detail-page .detail-action-card,
  .detail-page .detail-danger-card,
  .detail-page .detail-list .card.form-card {
    padding: 8px;
  }

  .detail-page .detail-list {
    gap: 6px;
  }

  .detail-page .detail-list .dashboard-title {
    font-size: 13px;
    margin-bottom: 2px;
    line-height: 1.3;
  }

  .detail-page .detail-related-order-desc {
    margin-bottom: 3px;
    font-size: 11.5px;
    line-height: 1.35;
  }

  .order-detail-page .detail-order-notes-card,
  .order-detail-page .detail-order-refund-card,
  .order-detail-page .detail-order-item-card,
  .order-detail-page .detail-order-shipment-card {
    border-width: 1px;
  }

  .detail-page .detail-meta {
    row-gap: 6px;
  }

  .detail-page .detail-chip,
  .detail-page .order-detail-panel .detail-chip {
    min-height: 28px;
    padding: 3px 8px;
    font-size: 12px;
    gap: 4px;
  }

  .detail-page .form-actions {
    gap: 6px;
  }

  .detail-page .form-actions > button,
  .detail-page .form-actions > a {
    min-height: 40px;
    padding: 0 10px;
    font-size: 13px;
  }

  .detail-page .detail-list .order-item-row {
    gap: 6px;
    padding: 6px 8px;
  }

  .detail-page .detail-list .order-item-meta {
    row-gap: 6px;
  }

  .detail-page .detail-list .order-item-remove {
    min-height: 40px;
    padding: 0 10px;
    font-size: 13px;
  }

  .modal-mask {
    padding:
      calc(8px + env(safe-area-inset-top, 0px))
      calc(8px + env(safe-area-inset-right, 0px))
      calc(8px + env(safe-area-inset-bottom, 0px))
      calc(8px + env(safe-area-inset-left, 0px));
  }

  .modal-card {
    max-height: calc(88vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    border-radius: 10px;
    padding: 10px;
  }

  .modal-card .section-title {
    font-size: 13px;
    margin-bottom: 6px;
    line-height: 1.35;
  }

  .modal-body {
    margin: 6px 0;
    font-size: 12px;
    line-height: 1.4;
  }

  .modal-list {
    padding-left: 16px;
    gap: 4px;
    font-size: 12px;
    line-height: 1.35;
  }

  .modal-card .form-actions {
    gap: 6px;
  }

  .modal-card .form-actions > button,
  .modal-card .form-actions > a {
    min-height: 40px;
    padding: 0 10px;
    font-size: 13px;
  }

  .toast {
    width: calc(100% - 16px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 12.5px;
    line-height: 1.35;
    text-align: center;
  }

  .empty,
  .error,
  .loading,
  .success {
    margin-top: 6px;
    padding: 8px 10px;
    border-radius: 9px;
    font-size: 12.5px;
    line-height: 1.35;
  }

  .detail-page .detail-empty,
  .detail-page .empty,
  .detail-page .error,
  .detail-page .loading,
  .detail-page .success {
    margin-top: 6px;
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.35;
  }

  .stats-toolbar {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .stats-toolbar > button:first-child {
    grid-column: auto;
  }

  .stats-toolbar > button {
    min-height: 40px;
    padding: 0 10px;
    font-size: 13px;
  }

  .stats-panel-card {
    margin-top: 8px;
    padding: 10px;
  }

  .stats-summary-card .section-title,
  .stats-chart-card .section-title {
    margin-bottom: 6px;
    font-size: 13px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .stat-card {
    padding: 10px;
  }

  .stat-label {
    font-size: 11.5px;
    line-height: 1.25;
  }

  .stat-value {
    margin-top: 4px;
    font-size: 18px;
  }

  .stats-row {
    grid-template-columns: 1fr;
    row-gap: 4px;
    margin: 6px 0;
  }

  .stats-label {
    font-size: 11.5px;
    line-height: 1.25;
  }

  .stats-track {
    width: 100%;
    height: 8px;
  }

  .stats-bar {
    height: 8px;
  }

  .stats-value {
    font-size: 13.5px;
    justify-self: end;
  }

  .batch-toolbar {
    grid-template-columns: 1fr;
    gap: 6px;
    width: 100%;
    margin-left: 0;
  }

  .dashboard-page .page-subtitle {
    margin: -2px 0 8px;
    font-size: 12px;
    line-height: 1.35;
  }

  .dashboard-page .dashboard-grid {
    gap: 6px;
  }

  .dashboard-page .dashboard-entry-grid {
    margin-top: 4px;
  }

  .dashboard-page .dashboard-entry-card {
    min-height: 88px;
    padding: 10px;
  }

  .dashboard-page .dashboard-title {
    font-size: 14px;
    margin-bottom: 4px;
    line-height: 1.3;
  }

  .dashboard-page .dashboard-desc {
    font-size: 12px;
    line-height: 1.35;
  }

  .card,
  .list-card-compact,
  .form-card:not(.list-card-compact) {
    border-radius: 10px;
  }

  .toolbar {
    padding: 8px;
    gap: 6px;
    margin-bottom: 8px;
    border-radius: 10px;
  }

  .list-filter-toolbar + .list-filter-toolbar {
    margin-top: 4px;
  }

  .list-filter-toolbar .empty,
  .management-filter-toolbar .empty,
  .batch-toolbar .batch-toolbar-count {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .list-filter-toolbar > input,
  .list-filter-toolbar > select,
  .management-filter-toolbar > input,
  .management-filter-toolbar > select,
  .batch-toolbar .batch-toolbar-field {
    min-height: 40px;
    padding: 0 10px;
    border-radius: 9px;
    font-size: 13.5px;
  }

  .list-card-compact .form-actions.list-row-actions {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .list-card-compact {
    padding: 10px;
    gap: 6px;
  }

  .list-card-compact .dashboard-title {
    font-size: 14px;
    line-height: 1.3;
  }

  .list-card-compact .list-row-subtitle {
    font-size: 12px;
    line-height: 1.35;
  }

  .list-card-compact .detail-chip {
    min-height: 28px;
    padding: 3px 8px;
    font-size: 12px;
  }

  .list-card-compact .detail-meta.list-row-meta {
    row-gap: 6px;
  }

  .list-card-compact .detail-meta.list-row-meta .detail-chip {
    min-height: 28px;
    padding: 3px 8px;
    font-size: 12px;
  }

  .list-card-compact .form-actions.list-row-actions > button,
  .list-card-compact .form-actions.list-row-actions > a {
    min-height: 40px;
    padding: 0 10px;
    font-size: 13px;
  }

  .list-card-compact .detail-meta.list-row-meta {
    grid-template-columns: 1fr;
  }

  .order-item-meta {
    grid-template-columns: 1fr;
  }

  .list-card-compact .list-select-chip {
    min-height: 36px;
    padding: 3px 8px;
    column-gap: 6px;
    font-size: 12px;
    line-height: 1.3;
  }

  .log-changes {
    max-height: 156px;
    padding: 6px;
    border-radius: 8px;
    font-size: 11.5px;
    line-height: 1.45;
  }

  .management-filter-toolbar {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .management-page .management-create-card,
  .management-page .levels-card {
    padding: 10px;
  }

  .management-page .management-create-card .section-title,
  .management-page .levels-card .section-title {
    font-size: 14px;
    margin: 4px 0;
  }

  .management-page .muted-tip {
    margin: 4px 0;
    font-size: 12px;
    line-height: 1.35;
  }

  .management-page .management-create-grid,
  .management-page .levels-create-grid,
  .management-page .levels-row-grid {
    row-gap: 6px;
    column-gap: 6px;
  }

  .management-filter-toolbar > button,
  .management-filter-toolbar > a {
    min-height: 40px;
    font-size: 13.5px;
  }

  .management-filter-toolbar > input,
  .management-filter-toolbar > select {
    font-size: 13.5px;
  }

  .management-page .levels-row-grid > button {
    min-height: 40px;
    font-size: 13.5px;
  }

  .list-filter-toolbar > button,
  .list-filter-toolbar > a,
  .batch-toolbar .batch-toolbar-action,
  .batch-toolbar .batch-toolbar-select {
    min-height: 40px;
    font-size: 13.5px;
  }

  .list-filter-toolbar .empty,
  .management-filter-toolbar .empty,
  .batch-toolbar .batch-toolbar-count {
    min-height: 28px;
    padding: 3px 8px;
    font-size: 11.5px;
    line-height: 1.25;
  }

  .list-filter-toolbar {
    grid-template-columns: 1fr;
  }

  .pager {
    grid-template-columns: 1fr 1fr;
    column-gap: 6px;
    row-gap: 6px;
    margin-top: 8px;
    padding: 8px;
    border-radius: 10px;
  }

  .pager > button {
    min-height: 40px;
    padding: 0 10px;
    font-size: 13px;
  }

  .pager #page {
    grid-column: 1 / -1;
    order: -1;
    min-height: 38px;
    min-width: 0;
    border-radius: 9px;
    padding: 0 10px;
    font-size: 12px;
  }

  .list-pager {
    margin-top: 8px;
  }

  .list-batch-anchor,
  .management-batch-anchor {
    margin-top: 8px;
  }
}
