:root {
  color-scheme: light;
  --ink: #17212f;
  --muted: #64748b;
  --line: #d8e0ea;
  --page: #f1f5f9;
  --panel: #fff;
  --blue: #075ca8;
  --blue-dark: #083f71;
  --green: #0f7b58;
  --red: #b42318;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-card {
  width: min(100%, 420px);
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(23, 33, 47, 0.14);
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
}

.login-card h1,
.topbar h2,
.topbar p,
.panel h3,
.panel p {
  margin: 0;
}

label {
  display: grid;
  gap: 7px;
  color: #34465b;
  font-weight: 800;
}

input,
select {
  min-height: 40px;
  border: 1px solid #cbd6e2;
  border-radius: 8px;
  padding: 0 11px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(7, 92, 168, 0.12);
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
}

.secondary,
.ghost {
  border: 1px solid #b7c8d9;
  background: #e9f1f8;
  color: var(--blue-dark);
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 22px;
  background: #fff;
  border-right: 1px solid var(--line);
}

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

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

.brand span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button {
  justify-content: flex-start;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.nav button.is-active {
  border-color: #b7c8d9;
  background: #e9f1f8;
  color: var(--blue-dark);
}

.nav-section {
  margin: 10px 10px 0;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.nav .nav-child { padding-left: 26px; }

.ghost {
  margin-top: auto;
}

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

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

.topbar p {
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.topbar h2 {
  margin-top: 4px;
  font-size: 28px;
}

.current-user { display: grid; justify-items: end; gap: 3px; }
.current-user strong { font-size: 14px; }
.current-user span { color: var(--muted); font-size: 12px; font-weight: 800; }

.view {
  display: none;
}

.view.is-active {
  display: grid;
  gap: 16px;
}

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

.metric-grid article,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric-grid article {
  padding: 18px;
}

.metric-grid span {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.metric-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.panel {
  padding: 16px;
}

.panel p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.6;
}

.import-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 240px 260px 120px;
  gap: 12px;
  align-items: end;
}

.employee-import-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.employee-import-actions h3, .employee-import-actions p { margin: 0; }
.employee-import-actions p { margin-top: 6px; }
.employee-filters { display: grid; grid-template-columns: 160px 160px minmax(220px, 1fr) 100px; gap: 12px; align-items: end; }
.employee-filters #employee-filter-id,
.employee-filters #employee-filter-name { width: 160px; }
.product-filters { display: flex; align-items: end; padding: 12px; }
.product-filters label { width: 220px; }
.product-filters input { width: 220px; }
.list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.list-toolbar h3, .list-toolbar p { margin: 0; }
.list-toolbar p { margin-top: 6px; }
.list-toolbar > .row-actions { flex-wrap: wrap; justify-content: flex-end; }

.import-panel h3,
.import-panel p {
  margin: 0;
}

.import-panel p {
  margin-top: 6px;
  font-size: 13px;
}

.file-field input {
  padding-top: 8px;
}

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

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

.table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.record-toolbar {
  padding: 12px;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
}

.record-toolbar h3 {
  white-space: nowrap;
}

.export-controls {
  display: grid;
  grid-template-columns: minmax(108px, 0.8fr) minmax(120px, 0.9fr) minmax(168px, 1.25fr) 124px 124px 92px 60px;
  gap: 8px;
  align-items: end;
  min-width: 0;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.pagination div {
  display: flex;
  gap: 8px;
}

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

dialog {
  width: min(1180px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  border: 0;
  border-radius: 10px;
  padding: 20px;
  color: var(--ink);
  box-shadow: 0 28px 90px rgba(23, 33, 47, 0.3);
}

dialog::backdrop { background: rgba(15, 23, 42, 0.45); }
.dialog-head, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dialog-head { margin-bottom: 16px; }
.dialog-head h3, .dialog-head p { margin: 0; }
.dialog-head p { margin-top: 4px; color: var(--muted); }
.measurement-form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.record-measurement-products { display: grid; gap: 14px; max-height: min(620px, calc(100vh - 280px)); overflow-y: auto; padding-right: 4px; }
.record-measurement-product { min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: #f8fafc; }
.record-measurement-product > legend { padding: 0 7px; color: var(--blue-dark); font-weight: 900; }
.record-measurement-product .measurement-form-grid { margin-bottom: 0; }
.record-choice-field { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; min-width: 0; border: 1px solid #cbd6e2; border-radius: 8px; padding: 8px 10px; background: #fff; }
.record-choice-field > legend { padding: 0 4px; color: #34465b; font-size: 12px; font-weight: 800; }
.record-choice-field label { display: inline-flex; grid-template-columns: none; align-items: center; gap: 5px; min-height: 26px; border-radius: 999px; padding: 3px 8px; background: #eef3f8; }
.record-choice-field input { width: 16px; height: 16px; min-height: auto; margin: 0; }
.analysis-product-list { margin-top: 16px; }
textarea { width: 100%; border: 1px solid #cbd6e2; border-radius: 8px; padding: 10px; font: inherit; resize: vertical; }
.archive-dialog td:nth-child(6) { min-width: 320px; max-width: 520px; white-space: normal; line-height: 1.55; }
.dialog-actions { justify-content: flex-end; margin-top: 16px; }
.dialog-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.employee-dialog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dialog-tip { margin: 14px 0 0; color: var(--muted); font-size: 13px; }
.dialog-form-grid small { color: var(--muted); font-size: 12px; font-weight: 600; }
.subaccount-dialog { width: min(760px, calc(100vw - 40px)); overflow-y: auto; }
.permission-fieldset { display: grid; gap: 10px; margin: 16px 0 0; border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.permission-fieldset legend { padding: 0 6px; font-weight: 900; }
.permission-fieldset > label, .order-scope-list label { display: flex; align-items: center; gap: 9px; font-weight: 700; }
.permission-fieldset input[type="checkbox"], .permission-fieldset input[type="radio"] { width: 18px; height: 18px; min-height: auto; }
.order-scope-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; border-top: 1px dashed var(--line); padding-top: 12px; }
.account-summary { display: flex; gap: 22px; color: var(--muted); font-size: 14px; font-weight: 800; }
.account-summary strong { color: var(--ink); font-size: 20px; }
.status-pill { display: inline-flex; align-items: center; min-height: 26px; border-radius: 999px; padding: 0 9px; background: #e8f6f0; color: var(--green); font-size: 12px; font-weight: 900; }
.status-pill.is-disabled { background: #f1f5f9; color: var(--muted); }
.status-pill.is-pending { background: #fff7e6; color: #9a5b00; }
.followup-note { margin-top: 14px; }
.followup-meta { display: grid; gap: 4px; white-space: normal; min-width: 180px; }
.followup-meta small { color: var(--muted); line-height: 1.45; }

.order-dialog { width: min(1120px, calc(100vw - 40px)); overflow-y: auto; }
.order-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 18px; padding: 0; list-style: none; }
.order-steps li { border-radius: 8px; padding: 10px 12px; background: #eef3f8; color: var(--muted); font-size: 13px; font-weight: 900; }
.order-steps li.is-active { background: var(--blue); color: #fff; }
.order-step { display: none; }
.order-step.is-active { display: block; }
.order-basic-grid { margin-bottom: 16px; }
.garment-gender-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.garment-section { min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: #f8fafc; }
.garment-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.garment-section-head h4, .garment-section-head p, .quantity-rule-head h4, .quantity-rule-head p, .quantity-constraint-head h4, .quantity-constraint-head p { margin: 0; }
.garment-section-head p, .quantity-rule-head p, .quantity-constraint-head p { margin-top: 4px; color: var(--muted); font-size: 13px; font-weight: 600; }
.garment-section-head button { flex: 0 0 auto; min-height: 34px; }
.garment-type-list, .garment-rule-list { display: grid; gap: 8px; }
.garment-type-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.garment-type-row button { min-height: 40px; }
.garment-empty { margin: 0; border: 1px dashed #b7c8d9; border-radius: 8px; padding: 14px; color: var(--muted); text-align: center; font-size: 13px; font-weight: 700; }
.quantity-rule-head { margin-bottom: 12px; }
.garment-rule-group { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.garment-rule-group h5 { margin: 0; padding: 10px 12px; background: #eef3f8; font-size: 14px; }
.garment-rule-row { display: grid; grid-template-columns: minmax(180px, 1fr) 164px 132px 136px; gap: 10px; align-items: end; padding: 11px 12px; border-top: 1px solid var(--line); }
.garment-rule-row:first-of-type { border-top: 0; }
.garment-rule-name { align-self: center; font-weight: 900; }
.garment-rule-row label { min-width: 0; }
.garment-rule-row label span { font-size: 12px; }
.garment-rule-row input[type="number"] { width: 100%; min-width: 0; }
.toggle-field { display: flex; align-items: center; gap: 9px; min-height: 40px; }
.toggle-field input { width: 18px; min-height: auto; height: 18px; }
.quantity-constraint-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.quantity-constraint-head button { flex: 0 0 auto; }
.quantity-constraint-list { display: grid; gap: 8px; overflow-x: auto; }
.quantity-constraint-row { display: grid; grid-template-columns: 52px 110px minmax(320px, 1fr) 130px 110px 72px; gap: 10px; align-items: end; min-width: 900px; border: 1px solid var(--line); border-radius: 8px; padding: 11px 12px; background: #f8fafc; }
.quantity-constraint-index { align-self: center; color: var(--blue-dark); font-weight: 900; }
.quantity-constraint-row label span { font-size: 12px; }
.constraint-products { min-width: 0; }
.constraint-product-options { min-height: 40px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; border: 1px solid #cbd6e2; border-radius: 8px; padding: 6px 8px; background: #fff; }
.constraint-product-option { display: inline-flex; align-items: center; gap: 5px; min-height: 26px; border-radius: 999px; padding: 3px 9px; background: #e9f1f8; color: var(--blue-dark); font-size: 12px; white-space: nowrap; }
.constraint-product-option input { width: 16px; height: 16px; min-height: auto; margin: 0; }
.constraint-product-empty { color: var(--muted); font-size: 12px; font-weight: 700; }
.quantity-constraint-row > button { min-height: 40px; }
.form-error { margin: 12px 0 0; color: var(--red); font-weight: 800; }
.order-dialog-actions { justify-content: space-between; }
.order-dialog-actions #order-step-next, .order-dialog-actions #save-order { margin-left: auto; }

.product-dialog { width: min(1380px, calc(100vw - 32px)); overflow-y: auto; }
.product-basic-grid { grid-template-columns: minmax(260px, 420px) 150px; justify-content: start; margin-bottom: 18px; }
.product-field-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.product-field-head h4, .product-field-head p { margin: 0; }
.product-field-head p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.product-field-list { display: grid; gap: 8px; overflow-x: auto; }
.product-field-row { display: grid; grid-template-columns: minmax(160px, 1fr) 110px 76px 76px 88px 88px minmax(190px, 1.2fr) 64px; gap: 8px; align-items: end; min-width: 1040px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: #f8fafc; }
.product-field-row input, .product-field-row select { width: 100%; min-width: 0; }
.product-field-row label span { font-size: 12px; }
.product-field-row .required-field { display: flex; align-items: center; gap: 7px; min-height: 40px; }
.product-field-row .required-field input { width: 18px; height: 18px; min-height: auto; }
.product-field-row button { min-height: 40px; }
.product-option-editor { grid-column: 1 / -1; border-top: 1px dashed #cbd6e2; padding-top: 10px; }
.product-option-editor > span { display: block; margin-bottom: 7px; color: #34465b; font-size: 12px; font-weight: 800; }
.product-option-entry { display: grid; grid-template-columns: minmax(180px, 1fr) auto; gap: 8px; }
.product-option-entry button { min-width: 72px; }
.product-option-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.product-option-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; border: 1px solid #b7c8d9; border-radius: 999px; padding: 3px 5px 3px 11px; background: #fff; }
.product-option-chip strong { font-size: 13px; }
.product-option-chip button { min-height: 24px; width: 24px; border-radius: 999px; padding: 0; }
.product-option-empty { color: var(--muted); font-size: 12px; }
.product-choice { display: grid; grid-template-columns: minmax(0, 1fr) 78px; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: #fff; }
.product-choice-toggle { display: flex; align-items: flex-start; gap: 9px; min-width: 0; }
.product-choice-toggle input { flex: 0 0 auto; width: 18px; height: 18px; min-height: auto; margin-top: 2px; }
.product-choice-toggle span, .product-choice-toggle small { display: block; }
.product-choice-toggle small { margin-top: 3px; color: var(--muted); }
.product-sort-field { gap: 4px; }
.product-sort-field span { font-size: 12px; }
.product-sort-field input { width: 100%; min-width: 0; }
.product-sort-field input:disabled { background: #eef3f8; color: #94a3b8; }
.garment-rule-row input[type="checkbox"] { width: 18px; height: 18px; min-height: auto; }

.comparison-dialog,
.analysis-results-dialog {
  width: min(1500px, calc(100vw - 20px));
  height: min(900px, calc(100vh - 20px));
  max-height: calc(100vh - 20px);
  overflow-y: auto;
}
.analysis-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 0 20px; padding: 0; list-style: none; }
.analysis-steps li { border-radius: 8px; padding: 10px 12px; background: #eef3f8; color: var(--muted); font-size: 13px; font-weight: 900; }
.analysis-steps li.is-active { background: var(--blue); color: #fff; }
.analysis-step { display: none; min-height: 360px; }
.analysis-step.is-active { display: block; }
.analysis-step h4, .analysis-condition-head h4 { margin: 0 0 14px; font-size: 18px; }
.analysis-option-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.choice-card { display: flex; grid-template-columns: none; align-items: flex-start; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 14px; cursor: pointer; }
.choice-card:has(input:checked) { border-color: var(--blue); background: #f0f7fd; box-shadow: 0 0 0 2px rgba(7, 92, 168, 0.1); }
.choice-card input { min-height: auto; margin-top: 3px; }
.choice-card span, .choice-card strong { display: block; }
.choice-card span { color: var(--muted); font-weight: 600; }
.choice-card strong { margin-bottom: 4px; color: var(--ink); }
.analysis-custom-versions { display: grid; grid-template-columns: repeat(2, minmax(0, 220px)); gap: 12px; margin-top: 16px; }
.analysis-condition-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.analysis-condition-head h4, .analysis-condition-head p { margin: 0; }
.analysis-condition-head p { margin-top: 5px; color: var(--muted); }
.analysis-condition-list { display: grid; gap: 8px; max-height: min(520px, calc(100vh - 330px)); overflow-y: auto; overflow-x: hidden; padding-right: 4px; }
.analysis-condition-row { display: grid; grid-template-columns: minmax(280px, 1fr) 150px 116px 116px; gap: 12px; align-items: end; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.analysis-field-toggle { display: flex; grid-template-columns: none; align-items: center; gap: 9px; min-height: 40px; }
.analysis-field-toggle input { min-height: auto; }
.analysis-condition-row label span { font-size: 12px; }
.analysis-condition-row .analysis-min,
.analysis-condition-row .analysis-max { width: 116px; max-width: 100%; }
.analysis-summary { display: grid; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 16px; background: #f8fafc; }
.analysis-summary p { margin: 0; }
.analysis-error { margin: 12px 0 0; color: var(--red); font-weight: 800; }
.analysis-actions { justify-content: space-between; }
.analysis-actions #analysis-next, .analysis-actions #analysis-run { margin-left: auto; }
.analysis-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.analysis-metrics article { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #f8fafc; }
.analysis-metrics span, .analysis-metrics strong { display: block; }
.analysis-metrics span { color: var(--muted); font-size: 12px; font-weight: 800; }
.analysis-metrics strong { margin-top: 5px; font-size: 24px; }
.analysis-result-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.analysis-result-toolbar label { width: min(320px, 100%); }
.analysis-results-dialog .table-wrap { overflow-x: hidden; }
.analysis-results-dialog table { min-width: 0; table-layout: fixed; }
.analysis-results-dialog th,
.analysis-results-dialog td { white-space: normal; overflow-wrap: anywhere; }
.analysis-results-dialog th:nth-child(1) { width: 9%; }
.analysis-results-dialog th:nth-child(2) { width: 8%; }
.analysis-results-dialog th:nth-child(3) { width: 17%; }
.analysis-results-dialog th:nth-child(4) { width: 8%; }
.analysis-results-dialog th:nth-child(5) { width: 17%; }
.analysis-results-dialog th:nth-child(6),
.analysis-results-dialog th:nth-child(7) { width: 12%; }
.analysis-results-dialog th:nth-child(8) { width: 8%; }
.analysis-results-dialog th:nth-child(9) { width: 9%; }
.analysis-results-dialog td:nth-child(7) { font-weight: 900; }
.analysis-results-dialog .delta-large { color: var(--red); }

.export-controls label {
  gap: 4px;
}

.export-controls label span {
  font-size: 12px;
}

.export-controls input,
.export-controls select,
.export-controls button {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding-left: 8px;
  padding-right: 8px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 840px;
}

th,
td {
  border-bottom: 1px solid #e5ebf2;
  padding: 11px 10px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

td {
  font-size: 14px;
}

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

.row-actions button {
  min-height: 32px;
  padding: 0 10px;
}

.danger {
  border: 1px solid #f0b7b2;
  background: #fff1f0;
  color: var(--red);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: 360px;
  border-radius: 8px;
  padding: 12px 14px;
  background: #17212f;
  color: #fff;
  box-shadow: 0 18px 40px rgba(23, 33, 47, 0.26);
}

@media (max-width: 1280px) {
  .record-toolbar {
    grid-template-columns: 1fr;
  }
}

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

#login-error {
  margin: 0;
  color: var(--red);
  font-weight: 800;
}

@media (max-width: 1080px) {
  .admin-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .form-grid,
  .employee-form,
  .import-panel,
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .table-head.record-toolbar {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

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

  .list-toolbar > .row-actions {
    flex-wrap: wrap;
  }


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

  .analysis-condition-row { grid-template-columns: minmax(220px, 1fr) 140px 108px 108px; gap: 8px; }
  .analysis-condition-row .analysis-min,
  .analysis-condition-row .analysis-max { width: 108px; }
}

@media (max-width: 760px) {
  .employee-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .employee-filters #employee-filter-id,
  .employee-filters #employee-filter-name { width: 100%; }
  .product-filters label, .product-filters input { width: 100%; }
  .product-basic-grid { grid-template-columns: 1fr; }
  .product-field-list { overflow-x: visible; }
  .product-field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); min-width: 0; }
  .order-steps { grid-template-columns: 1fr; }
  .garment-gender-grid { grid-template-columns: 1fr; }
  .garment-rule-list { overflow-x: auto; }
  .garment-rule-row { min-width: 760px; }
  .quantity-constraint-head { align-items: stretch; flex-direction: column; }
  .quantity-constraint-row { min-width: 820px; }
  .comparison-dialog,
  .analysis-results-dialog { width: calc(100vw - 10px); height: calc(100vh - 10px); max-height: calc(100vh - 10px); padding: 14px; }
  .analysis-steps { grid-template-columns: repeat(2, 1fr); }
  .analysis-option-grid,
  .analysis-metrics,
  .analysis-custom-versions { grid-template-columns: 1fr; }
  .analysis-condition-head { align-items: stretch; flex-direction: column; }
  .analysis-condition-row { grid-template-columns: minmax(180px, 1fr) 130px 96px 96px; }
  .analysis-condition-row .analysis-min,
  .analysis-condition-row .analysis-max { width: 96px; }
  .analysis-results-dialog .table-wrap { overflow-x: auto; }
  .analysis-results-dialog table { min-width: 900px; }
  .record-measurement-product .measurement-form-grid { grid-template-columns: 1fr; }
}
