/* MIHA Flow: customer directory, separate order index, guided creation. */
:root {
  --flow-gap: 24px;
  --flow-radius: 18px;
}
main.workspace {
  max-width: 1280px;
  padding: 28px 32px 92px;
  margin-inline: auto;
}
.toolbar {
  height: 64px;
}
.head {
  margin-bottom: 24px;
  align-items: center;
  gap: 20px;
}
.head h1,
.case-heading h1 {
  font-size: 26px;
  line-height: 1.55;
  margin: 0;
}
.head p {
  font-size: 14px;
  margin: 5px 0 0;
  color: var(--muted);
}
h2 {
  font-size: 19px;
}
h3 {
  font-size: 16px;
}
.surface {
  padding: 24px;
  border-radius: var(--flow-radius);
}
.head-actions {
  gap: 10px;
  flex-wrap: wrap;
}
.side-note {
  display: none;
}
.dashboard-facts {
  margin: 0 0 24px;
  padding: 0;
  box-shadow: none;
  border-radius: var(--flow-radius);
}
.dashboard-facts > div {
  padding: 15px 20px;
}
.dashboard-facts strong {
  font-size: 21px;
}
.dashboard-grid {
  gap: 24px;
}
.case-link {
  padding: 18px 0;
  min-height: 100px;
}
.case-link-main strong {
  font-size: 16px;
}
.case-link-main small,
.case-reason {
  font-size: 13px;
}
.path-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--muted);
}
.path-nav button {
  border: 0;
  background: transparent;
  box-shadow: none;
  min-height: 36px;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.path-nav > span {
  overflow-wrap: anywhere;
}
.path-nav > .icon {
  width: 14px;
  height: 14px;
  opacity: 0.6;
}
.path-nav button .icon {
  width: 18px;
  height: 18px;
}
.customer-search {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}
.customer-search label {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  max-width: 640px;
  flex: 1;
}
.customer-search input {
  border: 0;
  box-shadow: none;
  background: transparent;
  width: 100%;
  padding: 13px 0;
  outline-offset: 3px;
}
.directory-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
  color: var(--muted);
  padding: 0 4px 12px;
}
.customer-directory,
.order-list {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--flow-radius);
  overflow: hidden;
}
button.customer-entry {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 130px 160px;
  gap: 18px;
  align-items: center;
  text-align: right;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  color: var(--ink);
  padding: 22px 24px;
  min-height: 100px;
}
button.customer-entry:last-child {
  border-bottom: 0;
}
button.customer-entry:hover,
button.order-row:hover {
  background: #f1f7f8;
  transform: none;
}
.customer-entry-name {
  display: grid;
  gap: 5px;
}
.customer-entry-name strong {
  font-size: 17px;
  overflow-wrap: anywhere;
}
.customer-entry-name small {
  font-size: 13px;
  color: var(--muted);
}
.customer-order-count {
  font-size: 14px;
}
.customer-order-count small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}
.customer-entry-action {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
  font-size: 13px;
  color: var(--accent);
}
.customer-summary {
  display: flex;
  gap: 16px 28px;
  flex-wrap: wrap;
  border-block: 1px solid var(--line);
  padding: 18px 0;
  margin-bottom: 28px;
  font-size: 14px;
}
.customer-summary > span {
  display: flex;
  align-items: center;
  gap: 8px;
}
.customer-summary .icon {
  width: 20px;
  height: 20px;
}
.section-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 0 0 16px;
}
.section-bar h2 {
  margin: 0;
}
.segmented {
  display: flex;
  gap: 4px;
  background: #dfe9ec;
  border-radius: 12px;
  padding: 4px;
}
.segmented button {
  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 9px;
  min-height: 40px;
  padding: 7px 13px;
  font-size: 13px;
  color: var(--muted);
}
.segmented button.active {
  background: #fff;
  color: var(--accent);
}
button.order-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 130px 160px 18px;
  align-items: center;
  gap: 18px;
  width: 100%;
  padding: 22px 24px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  text-align: right;
  color: var(--ink);
}
button.order-row:last-child {
  border-bottom: 0;
}
.order-symbol {
  color: var(--accent);
  display: grid;
  place-items: center;
}
.order-symbol > .icon {
  width: 28px;
  height: 28px;
}
.order-name {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.order-name strong {
  font-size: 16px;
  overflow-wrap: anywhere;
}
.order-name small {
  font-size: 12px;
  color: var(--muted);
}
.order-reason {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}
.order-total {
  display: grid;
  gap: 5px;
  font-size: 14px;
}
.order-total small {
  font-size: 12px;
  color: var(--muted);
}
.order-empty {
  padding: 40px 24px;
}
.order-empty > .icon {
  height: 40px;
  width: 40px;
  color: var(--accent);
}
.order-empty p {
  max-width: 50ch;
  margin: 12px auto 20px;
}
.pagination {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
  font-size: 13px;
}
.case-heading {
  margin-bottom: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.case-heading .head-actions {
  flex-shrink: 0;
  flex-wrap: wrap;
  max-width: 100%;
}
.case-person {
  max-width: 100%;
}
.case-heading .client-avatar.large {
  display: none;
}
.case-person > div {
  min-width: 0;
}
.case-heading p {
  font-size: 14px;
  margin: 3px 0 10px;
}
.case-heading .case-meta {
  gap: 10px;
}
.tabs {
  margin-bottom: 24px;
  top: 64px;
}
.status-map {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
}
.status-map button {
  background: transparent;
  border: 0;
  border-inline-end: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  text-align: right;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 18px;
  min-width: 0;
}
.status-map button:last-child {
  border: 0;
}
.status-map button > span {
  display: grid;
  gap: 5px;
  flex: 1;
  min-width: 0;
}
.status-map small {
  font-size: 12px;
  color: var(--muted);
}
.status-map strong {
  font-size: 15px;
  color: var(--ink);
}
.status-map button > .icon {
  color: var(--accent);
  flex-shrink: 0;
}
.status-map button > .icon:last-child {
  width: 14px;
}
.case-grid {
  display: block;
}
.case-primary {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
  gap: 24px;
  align-items: start;
}
.case-primary > .surface {
  margin: 0;
}
.case-primary > .shipment-panel {
  grid-row: span 2;
}
.next {
  border-radius: 16px;
  margin-bottom: 24px;
  padding: 18px 22px;
}
.quantity-strip {
  gap: 12px;
}
.quantity-strip strong {
  font-size: 24px;
}
.quantity-strip span {
  font-size: 12px;
}
.quantity-caption {
  font-size: 12px;
  line-height: 1.8;
}
main.workspace[data-page="order"] {
  max-width: 1040px;
}
.order-steps {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0 0 26px;
  gap: 20px;
}
.order-steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  position: relative;
  color: var(--muted);
  font-size: 14px;
}
.order-steps li:not(:last-child):after {
  content: "";
  height: 1px;
  background: #b9cdd3;
  flex: 1;
}
.order-steps li > span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #dfe9ec;
  flex-shrink: 0;
}
.order-steps li.current {
  color: var(--accent);
}
.order-steps li.current > span {
  background: var(--accent);
  color: white;
}
.order-steps li.done > span {
  background: #d9ece8;
  color: #176354;
}
.order-steps .icon {
  width: 17px;
  height: 17px;
}
.order-section {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
}
.order-section h2 {
  margin: 0 0 18px;
}
.order-section > h2:not(:first-child) {
  margin-top: 30px;
}
.order-section > label {
  max-width: 100%;
  margin: 16px 0;
}
.order-section label {
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
}
.order-section input:not([type="radio"]):not([type="checkbox"]),
.order-section textarea,
.order-section select {
  font-size: 16px;
  min-height: 48px;
  border-radius: 10px;
  box-shadow: none;
  background: #fff;
  border: 1px solid #b9cdd3;
}
.order-section textarea {
  min-height: 100px;
}
.service-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.service-choice .service-option {
  position: relative;
  margin: 0;
  min-width: 0;
  cursor: pointer;
}
/* Keep the native radio keyboard-accessible; its indicator has a reserved grid cell. */
.service-option > input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 0;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}
.service-option > span {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 20px;
  grid-template-rows: auto 1fr;
  align-content: start;
  align-items: center;
  gap: 5px 10px;
  border: 1px solid #b9cdd3;
  border-radius: 12px;
  padding: 14px;
  height: 100%;
}
.service-option > span::after {
  content: "";
  grid-column: 3;
  grid-row: 1;
  width: 20px;
  height: 20px;
  box-sizing: border-box;
  border: 1.5px solid #748d95;
  border-radius: 50%;
  background: #fff;
}
.service-option strong {
  grid-column: 2;
  grid-row: 1;
  font-size: 15px;
}
.service-option small {
  grid-column: 2 / 4;
  grid-row: 2;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}
.service-option > span > .icon {
  grid-column: 1;
  grid-row: 1;
  width: 24px;
  height: 24px;
  color: var(--accent);
}
.service-option > input:checked + span {
  border-color: var(--accent);
  background: #f0f8f8;
}
.service-option > input:checked + span::after {
  border: 6px solid var(--accent);
}
.service-option > input:focus-visible + span {
  outline: 3px solid #83c6ce;
  outline-offset: 3px;
}
@media (forced-colors: active) {
  .service-option > input:checked + span::after {
    border-color: Highlight;
  }
}
.order-intro > label {
  margin: 0 0 16px;
}
.order-intro > label:last-child {
  margin-bottom: 0;
}
.order-customer-actions:empty {
  display: none;
}
.order-customer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}
.order-customer-actions .text-button {
  padding: 4px 0;
  min-height: 44px;
}
.order-intro .service-choice {
  margin-bottom: 16px;
}
.order-footer {
  position: sticky;
  bottom: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 20px;
  margin-top: 20px;
  background: var(--glass-strong);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  border: 1px solid #fff;
  border-radius: 16px;
  box-shadow: 0 10px 30px #254a591a;
}
.order-footer > span {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 6px;
  align-items: center;
}
.order-footer > div {
  display: flex;
  gap: 10px;
}
.order-footer button {
  min-height: 48px;
}
body:has(#orderForm) .bottom-nav {
  display: none;
}
.catalog-picker {
  border: 1px solid var(--line);
  border-radius: 12px;
  max-height: 250px;
  overflow: auto;
  overscroll-behavior: contain;
}
.catalog-pick {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}
.catalog-pick[hidden] {
  display: none;
}
.catalog-pick:last-child {
  border-bottom: 0;
}
.catalog-pick > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.catalog-pick strong {
  font-size: 14px;
  overflow-wrap: anywhere;
}
.catalog-pick small {
  font-size: 12px;
  color: var(--muted);
}
.catalog-pick button {
  flex-shrink: 0;
  min-height: 44px;
  font-size: 13px;
}
.picked-label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #176354;
  font-size: 12px;
  white-space: nowrap;
}
.selection-heading {
  margin: 26px 0 14px;
}
.selection-heading h3 {
  margin: 0 0 4px;
}
.selection-heading p {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}
.selected-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 44px;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.selected-line > div {
  display: grid;
  gap: 5px;
  min-width: 0;
}
.selected-line strong {
  font-size: 14px;
  overflow-wrap: anywhere;
}
.selected-line small {
  font-size: 12px;
  color: var(--muted);
}
.selected-line label {
  margin: 0;
  font-size: 12px;
}
.selected-line input {
  min-width: 0;
  width: 100%;
  text-align: center;
}
.empty-inline {
  padding: 20px;
  background: #f4f7f8;
  border-radius: 10px;
  font-size: 14px;
  color: var(--muted);
}
.order-tools {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}
.order-tools details {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 16px;
}
.order-tools summary {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 52px;
  font-size: 14px;
  cursor: pointer;
}
.order-tools details[open] {
  padding-bottom: 18px;
}
.order-tools p {
  font-size: 13px;
}
.form-grid label {
  margin: 0 0 12px;
}
.form-help {
  font-size: 13px;
  color: var(--muted);
  margin: 22px 0 0;
}
.review-meta {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  margin: 0 0 22px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.review-meta > div {
  display: flex;
  gap: 10px;
  align-items: center;
}
.review-meta span {
  display: grid;
  gap: 3px;
}
.review-meta small {
  font-size: 12px;
  color: var(--muted);
}
.review-meta strong {
  font-size: 16px;
}
.block {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}
.after-order {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin-top: 24px;
}
.after-order h3 {
  margin: 0 0 16px;
}
.after-order ol {
  list-style: none;
  display: flex;
  gap: 16px;
  padding: 0;
  margin: 0;
}
.after-order li {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1;
  font-size: 13px;
}
.after-order .icon {
  color: var(--accent);
  flex-shrink: 0;
}
.after-order p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 18px;
}
.order-error {
  padding: 14px 18px;
  border: 1px solid #cda8a3;
  background: #fff1ee;
  color: #81352b;
  border-radius: 12px;
  margin: 16px 0;
}
@media (min-width: 761px) {
  body.demo-mode .tabs {
    top: 100px;
  }
}
@media (max-width: 1000px) {
  button.customer-entry {
    grid-template-columns: 44px minmax(0, 1fr) 110px;
  }
  .customer-entry-action {
    grid-column: 2/4;
    justify-content: flex-start;
  }
  .case-primary {
    display: block;
  }
  .case-primary > .surface {
    margin-bottom: 20px;
  }
  button.order-row {
    grid-template-columns: 32px minmax(0, 1fr) 140px;
  }
  .order-state {
    grid-column: 2;
  }
  .order-total {
    grid-column: 3;
    grid-row: 1/3;
  }
  button.order-row > .icon:last-child {
    display: none;
  }
}
@media (max-width: 760px) {
  main.workspace {
    padding: 20px 18px 108px;
  }
  .toolbar {
    height: 60px;
  }
  .head {
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 22px;
  }
  .head h1,
  .case-heading h1 {
    font-size: 23px;
  }
  .head p {
    font-size: 13px;
  }
  .head-actions button {
    padding: 10px 13px;
    font-size: 13px;
  }
  .path-nav {
    margin-bottom: 12px;
    gap: 3px;
    font-size: 12px;
  }
  .path-nav button {
    font-size: 12px;
  }
  .surface {
    padding: 20px;
  }
  .directory-heading {
    font-size: 12px;
  }
  .directory-heading span:last-child {
    display: none;
  }
  button.customer-entry {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 10px 14px;
    padding: 18px;
    min-height: 128px;
  }
  .customer-entry-name strong {
    font-size: 16px;
  }
  .customer-entry-name small {
    font-size: 12px;
  }
  .customer-order-count {
    grid-column: 2;
    font-size: 13px;
  }
  .customer-order-count small {
    display: inline;
    margin-inline-start: 8px;
  }
  .customer-entry-action {
    grid-column: 2;
    font-size: 12px;
    margin-top: 4px;
  }
  .customer-summary {
    gap: 12px 20px;
    padding: 16px 0;
    margin-bottom: 24px;
    font-size: 13px;
  }
  .customer-summary > span:nth-child(3) {
    width: 100%;
  }
  .section-bar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
  .segmented {
    width: 100%;
  }
  .segmented button {
    flex: 1;
    padding: 7px;
    font-size: 12px;
    min-height: 44px;
  }
  button.order-row {
    padding: 18px;
    gap: 12px;
    grid-template-columns: 28px minmax(0, 1fr);
  }
  .order-name strong {
    font-size: 15px;
  }
  .order-state {
    grid-column: 2;
  }
  .order-total {
    grid-column: 2;
    grid-row: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .order-reason {
    font-size: 12px;
  }
  .case-heading {
    display: block;
    margin-bottom: 16px;
  }
  .case-heading .head-actions {
    margin-top: 14px;
  }
  .case-meta {
    font-size: 12px;
  }
  .tabs {
    top: 60px;
    margin-bottom: 18px;
  }
  .status-map {
    grid-template-columns: 1fr;
    margin-bottom: 18px;
  }
  .status-map button {
    border-inline-end: 0;
    border-bottom: 1px solid var(--line);
    padding: 14px 16px;
  }
  .status-map button > span {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }
  .status-map strong {
    font-size: 14px;
  }
  .status-map button > .icon {
    width: 20px;
    height: 20px;
  }
  .next {
    padding: 18px;
    margin-bottom: 20px;
  }
  .order-steps {
    gap: 8px;
    margin: 0 0 20px;
  }
  .order-steps li {
    flex-direction: column;
    gap: 7px;
    font-size: 12px;
    text-align: center;
  }
  .order-steps li:not(:last-child):after {
    position: absolute;
    top: 16px;
    right: calc(50% + 22px);
    width: calc(100% - 32px);
  }
  .order-steps li > span {
    z-index: 1;
  }
  .order-section {
    padding: 20px 16px;
    border-radius: 16px;
  }
  .order-section h2 {
    font-size: 18px;
  }
  .service-choice {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .order-footer {
    bottom: max(8px, env(safe-area-inset-bottom));
    padding: 12px;
    margin-top: 16px;
    flex-direction: column;
    gap: 8px;
  }
  .order-footer > span {
    font-size: 13px;
  }
  .order-footer > div {
    width: 100%;
  }
  .order-footer button {
    flex: 1;
    padding: 10px 12px;
    font-size: 14px;
  }
  .order-footer .primary {
    flex: 1.5;
  }
  .catalog-picker {
    max-height: 230px;
  }
  .catalog-pick {
    padding: 12px;
    gap: 10px;
  }
  .catalog-pick strong {
    font-size: 13px;
  }
  .catalog-pick small {
    font-size: 13px;
  }
  .catalog-pick button {
    padding: 8px 12px;
  }
  .picked-label {
    font-size: 13px;
  }
  .selected-line {
    grid-template-columns: minmax(0, 1fr) 80px 36px;
    gap: 8px;
  }
  .selected-line .icon-button {
    width: 36px;
    min-width: 36px;
  }
  .selected-line strong {
    font-size: 13px;
  }
  .selected-line small {
    font-size: 13px;
  }
  .selected-line input {
    padding: 10px;
  }
  .review-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
  }
  .review-meta > div {
    min-width: 0;
    align-items: flex-start;
  }
  .review-meta strong {
    font-size: 14px;
    overflow-wrap: anywhere;
  }
  .after-order ol {
    flex-direction: column;
    gap: 14px;
  }
  .after-order li {
    min-height: 28px;
  }
  .dashboard-facts {
    order: 0;
  }
  .dashboard-grid {
    display: block;
  }
  .recent-panel {
    display: none;
  }
  .dashboard-facts > div {
    padding: 10px;
  }
  .dashboard-facts .symbol {
    display: none;
  }
  .dashboard-facts strong {
    font-size: 16px;
  }
  .dashboard-facts small {
    font-size: 13px;
  }
}
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .order-footer {
    background: #fff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-color: var(--line);
  }
}
@supports not (backdrop-filter: blur(1px)) {
  .order-footer {
    background: #fff;
  }
}
@media print {
  .path-nav,
  .order-footer,
  .order-steps {
    display: none;
  }
}

.order-fields {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}

/* Keep the creation task visible without oversized headers. */
main.workspace[data-page="order"] .head {
  margin-bottom: 18px;
}
main.workspace[data-page="order"] .head h1 {
  font-size: 24px;
}
.order-section > h2:not(:first-child) {
  margin-top: 22px;
}
.service-choice {
  margin-bottom: 18px;
}
@media (max-width: 760px) {
  main.workspace[data-page="order"] {
    padding-top: 12px;
  }
  main.workspace[data-page="order"] .head p {
    display: none;
  }
  main.workspace[data-page="order"] .head {
    margin-bottom: 16px;
    align-items: center;
  }
  main.workspace[data-page="order"] .path-nav {
    margin-bottom: 10px;
  }
  .order-steps {
    margin-bottom: 16px;
  }
  .order-section .section-bar {
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }
  .order-section .section-bar h2 {
    font-size: 17px;
    margin-bottom: 0;
  }
  #selectionCount {
    font-size: 13px;
    white-space: nowrap;
  }
}

/* One shared rail width prevents overlap at desktop and tablet breakpoints. */
:root {
  --rail-width: 244px;
}
@media (min-width: 701px) {
  .app-shell {
    grid-template-columns: var(--rail-width) minmax(0, 1fr);
  }
  .sidebar {
    width: var(--rail-width);
  }
}
@media (min-width: 1500px) {
  :root {
    --rail-width: 264px;
  }
}
@media (min-width: 901px) and (max-width: 1150px) {
  :root {
    --rail-width: 200px;
  }
}
@media (min-width: 701px) and (max-width: 900px) {
  :root {
    --rail-width: 84px;
  }
}
.path-nav button {
  min-height: 44px;
}
.case-heading h1,
.order-name strong,
.customer-entry-name strong,
.file-row strong {
  overflow-wrap: anywhere;
}
.case-person > div,
.file-row > div {
  min-width: 0;
}
#orderError:focus {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
#orderForm [aria-invalid="true"] {
  border-color: #ad3c4a;
}
.order-footer > span {
  min-width: 0;
  line-height: 1.65;
}
.order-footer #orderDraftStatus {
  display: inline;
}
@media (max-width: 760px) {
  .head p,
  .customer-entry-name small,
  .order-reason,
  .selected-line small,
  .catalog-pick small,
  .quantity-strip span,
  .quantity-caption,
  .form-help {
    font-size: 14px;
  }
  .catalog-pick strong,
  .selected-line strong {
    font-size: 15px;
    line-height: 1.7;
  }
  .catalog-pick {
    align-items: flex-start;
  }
  .catalog-pick small {
    overflow-wrap: anywhere;
  }
  .selected-line {
    grid-template-columns: minmax(0, 1fr) 84px 44px;
    gap: 8px;
  }
  .selected-line .icon-button {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
  }
  .order-steps li {
    font-size: 13px;
  }
  .order-section .section-bar {
    flex-wrap: wrap;
  }
  #selectionCount {
    white-space: normal;
  }
  .status-map button > span {
    flex-wrap: wrap;
  }
  .row {
    gap: 12px;
    flex-wrap: wrap;
  }
  .file-row {
    flex-wrap: wrap;
    gap: 12px;
  }
  .case-heading .head-actions {
    flex-wrap: wrap;
  }
  .catalog-picker {
    max-height: 280px;
  }
  .order-fields {
    scroll-margin-bottom: 150px;
  }
  #orderForm input,
  #orderForm textarea {
    scroll-margin-block: 100px 160px;
  }
}

/* Phone density: retain touch targets, spend less space on repeated chrome. */
@media (max-width: 700px) {
  .catalog-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 10px;
    padding: 14px 0;
  }
  .catalog-row > div:first-child {
    display: contents;
  }
  .catalog-row h3,
  .catalog-row p {
    grid-column: 1 / -1;
  }
  .catalog-row h3 {
    font-size: 14px;
    line-height: 1.7;
  }
  .catalog-row p {
    margin: 0;
    font-size: 12px;
    line-height: 1.7;
  }
  .catalog-row details {
    min-width: 0;
    margin-top: 4px;
    grid-column: 1;
  }
  .catalog-row details[open] {
    grid-column: 1 / -1;
  }
  .catalog-row summary {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 6px 0;
  }
  .catalog-row > div:last-child {
    grid-column: 2;
    align-self: center;
  }
  .catalog-row button {
    min-height: 44px;
    padding: 8px 10px;
  }
  main.workspace {
    padding: 10px 14px 88px;
  }
  .toolbar {
    height: 52px;
    padding-inline: 14px;
  }
  .toolbar .mobile-brand {
    font-size: 17px;
    gap: 8px;
  }
  .toolbar .appmark {
    width: 28px;
    height: 28px;
    font-size: 25px;
    border-radius: 9px;
  }
  .toolbar .tools {
    gap: 2px;
  }
  .toolbar .tools > button {
    min-width: 44px;
    min-height: 44px;
    padding: 8px;
  }
  .bottom-nav {
    left: 10px;
    right: 10px;
    bottom: max(8px, env(safe-area-inset-bottom));
    padding: 4px;
    gap: 2px;
    border-radius: 20px;
  }
  .bottom-nav button {
    min-height: 48px;
    height: 48px;
    padding: 3px 4px;
    gap: 1px;
    border-radius: 15px;
    font-size: 11px;
    line-height: 1.5;
  }
  .bottom-nav button .icon {
    width: 20px;
    height: 20px;
  }
  .path-nav {
    flex-wrap: nowrap;
    white-space: nowrap;
    overflow: auto;
    margin-bottom: 6px;
    gap: 2px;
    scrollbar-width: none;
  }
  .path-nav button {
    flex-shrink: 0;
    padding: 4px;
    min-height: 44px;
  }
  .path-nav > span,
  .path-nav > .icon:last-of-type {
    display: none;
  }
  .head {
    gap: 8px;
    margin-bottom: 14px;
  }
  .head h1,
  .case-heading h1,
  .case-person h1 {
    font-size: 20px;
    line-height: 1.5;
  }
  .head p {
    font-size: 13px;
    line-height: 1.65;
  }
  .head-actions {
    gap: 6px;
  }
  .head-actions button,
  .case-heading .head-actions button {
    min-height: 44px;
    padding: 7px 11px;
    font-size: 13px;
  }
  .case-heading {
    margin-bottom: 10px;
  }
  .case-heading p {
    display: none;
  }
  .case-heading .case-meta {
    margin-top: 5px;
    gap: 6px;
    font-size: 12px;
  }
  .case-heading .head-actions {
    margin-top: 6px;
    gap: 6px;
  }
  .case-heading .head-actions .icon-button {
    width: 44px;
  }
  .tabs {
    top: 52px;
    padding: 3px;
    border-radius: 14px;
    margin-bottom: 12px;
    width: 100%;
    max-width: 100%;
    margin-inline: 0;
  }
  .tabs button {
    min-height: 44px;
    padding: 6px 11px;
    font-size: 12px;
    border-radius: 11px;
  }
  .status-map {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 12px;
    border-radius: 14px;
  }
  .status-map button {
    display: grid;
    gap: 4px;
    padding: 10px 7px;
    border-bottom: 0;
    border-inline-end: 1px solid var(--line);
    text-align: center;
    align-content: start;
  }
  .status-map button > .icon {
    display: none;
  }
  .status-map button > span {
    display: grid;
    justify-content: stretch;
    gap: 4px;
  }
  .status-map small {
    font-size: 12px;
    line-height: 1.5;
  }
  .status-map strong,
  .status-map .money {
    font-size: 13px;
    line-height: 1.65;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .surface {
    padding: 14px;
    border-radius: 14px;
    margin-bottom: 12px;
  }
  .surface h2,
  .surface .list-heading h2 {
    font-size: 16px;
    margin-bottom: 10px;
  }
  .surface h3 {
    font-size: 15px;
  }
  .surface .list-heading {
    gap: 8px;
    margin-bottom: 8px;
  }
  .surface .list-heading h2 {
    margin-bottom: 0;
  }
  .case-primary,
  .dashboard-grid {
    gap: 12px;
  }
  .next {
    padding: 12px 14px;
    margin-bottom: 12px;
    border-radius: 14px;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
  .next > .symbol {
    display: none;
  }
  .next strong {
    font-size: 14px;
    line-height: 1.6;
  }
  .next p {
    font-size: 13px;
    line-height: 1.7;
    margin: 4px 0 0;
  }
  .next > .primary {
    min-height: 44px;
    margin: 0;
    padding: 8px 12px;
  }
  .quantity-strip {
    margin: 12px 0;
    gap: 8px;
  }
  .quantity-strip strong {
    font-size: 21px;
    line-height: 1.4;
  }
  .quantity-strip span,
  .quantity-caption {
    font-size: 12px;
    line-height: 1.7;
  }
  .quantity-caption {
    margin: 8px 0 12px;
  }
  .shipment-track {
    padding-block: 12px;
  }
  .dashboard-facts {
    margin-bottom: 14px;
  }
  .dashboard-facts > div {
    padding: 10px;
  }
  .case-link {
    min-height: 0;
    padding: 12px 0;
    gap: 10px;
  }
  .case-link-main strong {
    font-size: 14px;
  }
  button.customer-entry {
    min-height: 0;
    padding: 12px;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 5px 10px;
  }
  .customer-entry .client-avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    font-size: 16px;
  }
  .customer-entry-name strong {
    font-size: 14px;
  }
  .customer-entry-name small {
    font-size: 12px;
    line-height: 1.6;
  }
  .customer-entry-action {
    display: none;
  }
  .customer-order-count {
    font-size: 12px;
  }
  .customer-summary {
    margin-bottom: 14px;
    padding: 10px 0;
    gap: 6px 14px;
  }
  button.order-row {
    padding: 12px;
    gap: 6px 10px;
    grid-template-columns: 22px minmax(0, 1fr);
  }
  .order-name strong {
    font-size: 14px;
  }
  .order-reason {
    font-size: 12px;
    line-height: 1.6;
  }
  .order-state,
  .order-total {
    font-size: 12px;
  }
  .section-bar {
    gap: 8px;
    margin-bottom: 10px;
  }
  main.workspace[data-page="order"] {
    padding-top: 8px;
  }
  main.workspace[data-page="order"] .head {
    margin-bottom: 10px;
  }
  main.workspace[data-page="order"] .head h1 {
    font-size: 20px;
  }
  main.workspace[data-page="order"] .path-nav {
    margin-bottom: 4px;
  }
  .order-steps {
    gap: 6px;
    margin-bottom: 10px;
  }
  .order-steps li {
    flex-direction: row;
    justify-content: center;
    min-width: 0;
    gap: 4px;
    font-size: 12px;
    line-height: 1.5;
    text-align: start;
  }
  .order-steps li > span {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }
  .order-steps li:not(:last-child):after {
    display: none;
  }
  .order-section {
    padding: 14px;
    border-radius: 14px;
  }
  .order-section h2 {
    font-size: 16px;
    margin-bottom: 10px;
  }
  .order-section > h2:not(:first-child) {
    margin-top: 12px;
  }
  .service-choice {
    gap: 8px;
    margin-bottom: 12px;
  }
  .service-option > span {
    grid-template-columns: 20px minmax(0, 1fr) 20px;
    grid-template-rows: auto auto;
    gap: 4px 8px;
    padding: 10px 12px;
  }
  .service-option > span > .icon {
    width: 20px;
    height: 20px;
  }
  .service-option small {
    grid-column: 1 / -1;
    text-align: start;
    line-height: 1.6;
  }
  .order-intro > label {
    margin-bottom: 12px;
  }
  .order-intro .service-choice {
    margin-bottom: 12px;
  }
  .order-footer {
    padding: 8px;
    gap: 5px;
    margin-top: 10px;
    border-radius: 14px;
  }
  .order-footer > span {
    font-size: 12px;
    margin: 0;
  }
  .order-footer > span > .icon {
    width: 18px;
    height: 18px;
  }
  .order-footer button {
    min-height: 44px;
  }
  .catalog-pick {
    padding: 10px;
    gap: 8px;
  }
  .catalog-pick strong,
  .selected-line strong {
    font-size: 14px;
  }
  .catalog-pick small,
  .selected-line small {
    font-size: 12px;
  }
  .selected-line {
    padding-block: 10px;
  }
}
