:root {
  --bg: #0b0c0b;
  --surface: #141613;
  --surface-raised: #1a1d18;
  --surface-press: #20241e;
  --line: #292d27;
  --line-strong: #373d33;
  --text: #f1f4ec;
  --muted: #969d90;
  --dim: #666d61;
  --accent: #c8ff3d;
  --accent-ink: #11150a;
  --danger: #ff6e66;
  --warning: #e8c968;
  --success: #a8dc48;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.35;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding-top: var(--safe-top);
}

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  min-height: 50px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid rgba(41, 45, 39, 0.75);
  background: rgba(11, 12, 11, 0.94);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 760;
}

.brand-mark {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.connection-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.connection-state::before {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 3px;
  background: var(--success);
  content: "";
}

.connection-state.is-error::before {
  background: var(--danger);
}

.connection-state.is-preview::before {
  background: var(--warning);
}

.connection-state.is-guidance::before {
  background: var(--muted);
  box-shadow: none;
}

.main {
  padding: 20px 16px calc(88px + var(--safe-bottom));
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 25px;
  line-height: 1.08;
  font-weight: 780;
}

h2 {
  margin-bottom: 0;
  font-size: 16px;
  line-height: 1.2;
  font-weight: 720;
}

h3 {
  margin-bottom: 2px;
  font-size: 14px;
  line-height: 1.25;
  font-weight: 690;
  overflow-wrap: anywhere;
}

.subtitle,
.row-meta,
.empty-copy {
  color: var(--muted);
}

.subtitle {
  margin: 5px 0 0;
  font-size: 12px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 22px;
}

.metric {
  min-width: 0;
  padding: 12px 10px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.metric-value {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  font-weight: 760;
  overflow-wrap: anywhere;
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.section {
  margin-top: 22px;
}

.section:first-child {
  margin-top: 0;
}

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

.count {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

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

.row-card {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.row-top,
.row-bottom,
.account-line,
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.row-main {
  min-width: 0;
  flex: 1;
}

.row-bottom {
  align-items: flex-end;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.row-meta {
  margin: 0;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.row-amount {
  flex: none;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.badge {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
  font-weight: 700;
  white-space: nowrap;
}

.badge::before {
  width: 5px;
  height: 5px;
  flex: none;
  border-radius: 3px;
  background: currentColor;
  content: "";
}

.badge.is-good {
  border-color: rgba(168, 220, 72, 0.3);
  color: var(--success);
}

.badge.is-warn {
  border-color: rgba(232, 201, 104, 0.3);
  color: var(--warning);
}

.badge.is-bad {
  border-color: rgba(255, 110, 102, 0.3);
  color: var(--danger);
}

.button,
.icon-button,
.segmented button,
.nav-item,
.text-button,
.language-control button {
  border: 0;
  cursor: pointer;
  transition: transform 140ms var(--ease-out), background-color 140ms ease, color 140ms ease, border-color 140ms ease, opacity 140ms ease;
}

.button:active,
.icon-button:active,
.segmented button:active,
.nav-item:active,
.text-button:active,
.language-control button:active {
  transform: scale(0.97);
}

.button:disabled,
.icon-button:disabled,
.segmented button:disabled,
.text-button:disabled,
.language-control button:disabled {
  cursor: default;
  opacity: 0.42;
  transform: none;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-raised);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.button-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.button-danger {
  border-color: rgba(255, 110, 102, 0.38);
  color: var(--danger);
}

.button-full {
  width: 100%;
}

.button-compact {
  min-height: 34px;
  padding: 7px 10px;
}

.button svg,
.icon-button svg,
.nav-item svg,
.text-button svg,
.empty-state svg {
  width: 16px;
  height: 16px;
  flex: none;
  stroke-width: 1.8;
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  margin-bottom: 16px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.segmented button {
  min-width: 0;
  min-height: 34px;
  padding: 7px 5px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 680;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.segmented button.is-active {
  background: var(--surface-press);
  color: var(--text);
  box-shadow: none;
}

.empty-state,
.error-state {
  display: grid;
  min-height: 150px;
  place-items: center;
  padding: 26px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  text-align: center;
}

.empty-state svg,
.error-state svg {
  width: 22px;
  height: 22px;
  margin-bottom: 8px;
  color: var(--dim);
}

.empty-state h3,
.error-state h3 {
  color: var(--text);
}

.empty-copy {
  max-width: 260px;
  margin: 4px auto 0;
  font-size: 12px;
}

.empty-state .button,
.error-state .button {
  margin-top: 15px;
}

.account-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  flex: none;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 760;
}

.account-line {
  justify-content: flex-start;
}

.account-actions,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 11px;
}

.message-card.is-unread {
  border-left-color: var(--accent);
}

.message-preview {
  display: -webkit-box;
  margin: 8px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.settings-list {
  border-top: 1px solid var(--line);
  background: transparent;
  box-shadow: none;
}

.setting-row {
  min-height: 58px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  box-shadow: none;
}

.setting-label {
  min-width: 0;
}

.setting-label strong {
  display: block;
  margin-bottom: 2px;
  font-size: 13px;
}

.setting-label span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.language-control {
  display: flex;
  flex: none;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.language-control button {
  min-width: 42px;
  min-height: 30px;
  padding: 5px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.language-control button.is-active {
  background: var(--surface-press);
  color: var(--text);
}

.toggle {
  position: relative;
  width: 46px;
  height: 28px;
  flex: none;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: transparent;
}

.toggle::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--muted);
  content: "";
  transition: transform 160ms var(--ease-out), background-color 160ms ease;
}

.toggle[aria-checked="true"] {
  border-color: var(--accent);
  background: transparent;
}

.toggle[aria-checked="true"]::after {
  background: var(--accent);
  transform: translateX(18px);
}

.bottom-nav {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  width: min(100%, 520px);
  grid-template-columns: repeat(3, 1fr);
  margin: 0 auto;
  padding: 5px 8px calc(5px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: rgba(15, 17, 14, 0.96);
  backdrop-filter: blur(18px);
}

.nav-item {
  display: grid;
  min-width: 0;
  min-height: 52px;
  place-items: center;
  align-content: center;
  gap: 3px;
  border-radius: 6px;
  background: transparent;
  color: var(--dim);
  font-size: 10px;
  font-weight: 650;
}

.nav-item svg {
  width: 19px;
  height: 19px;
}

.nav-item.is-active {
  color: var(--accent);
}

.scrim {
  position: fixed;
  z-index: 40;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
  opacity: 0;
  transition: opacity 160ms ease;
}

.scrim.is-open {
  opacity: 1;
}

.drawer {
  position: fixed;
  z-index: 50;
  right: 0;
  bottom: 0;
  left: 0;
  width: min(100%, 520px);
  max-height: min(88vh, 720px);
  margin: 0 auto;
  overflow-y: auto;
  padding: 8px 16px calc(18px + var(--safe-bottom));
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: var(--surface);
  box-shadow: none;
  transform: translateY(100%);
  transition: transform 180ms var(--ease-drawer);
}

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

.drawer-handle {
  width: 34px;
  height: 4px;
  margin: 0 auto 14px;
  border-radius: 2px;
  background: var(--line-strong);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

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

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: 0;
  background: #0f110e;
  color: var(--text);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.field textarea {
  min-height: 94px;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--dim);
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: none;
}

.field-hint {
  color: var(--dim);
  font-size: 10px;
}

.field-hint.is-error {
  color: var(--danger);
}

.account-usage {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 11px;
}

.account-usage strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.order-media {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.order-media-strip {
  display: grid;
  grid-auto-columns: minmax(96px, 32%);
  grid-auto-flow: column;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.order-media-item {
  min-width: 0;
}

.media-caption,
.media-preview-caption {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.media-preview-caption {
  font-size: 12px;
}

.order-media-button {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #0f110e;
  color: var(--dim);
}

.order-media-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 160ms ease;
}

.order-media-button.is-ready img {
  opacity: 1;
}

.media-loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.order-media-button.is-ready .media-loader {
  display: none;
}

.media-preview {
  display: block;
  width: 100%;
  max-height: min(72vh, 720px);
  object-fit: contain;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #0f110e;
}

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

.request-entries {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 22px;
}

.entry-button {
  display: grid;
  min-width: 0;
  min-height: 74px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform 140ms var(--ease-out), border-color 160ms ease, background-color 160ms ease;
}

.entry-button:active {
  transform: scale(0.98);
}

.entry-button:disabled {
  cursor: default;
  opacity: 0.42;
  transform: none;
}

.entry-button > svg:first-child {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.entry-button > svg:last-child {
  width: 15px;
  height: 15px;
  color: var(--dim);
}

.entry-button span {
  min-width: 0;
}

.entry-button strong,
.entry-button small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-button strong {
  font-size: 12px;
}

.entry-button small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.order-card {
  padding: 14px;
}

.orders-workspace {
  display: grid;
  min-width: 0;
  gap: 10px;
}

.order-rail,
.history-rail {
  display: grid;
  grid-auto-columns: minmax(244px, 86%);
  grid-auto-flow: column;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 3px;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}

.order-rail {
  grid-auto-columns: auto;
  grid-auto-flow: row;
  overflow-x: hidden;
}

.order-rail-item {
  display: flex;
  min-width: 0;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
  transition: border-color 160ms ease, background-color 160ms ease, transform 140ms var(--ease-out);
}

.order-rail-item:active {
  transform: scale(0.98);
}

.order-rail-item.is-selected {
  border-color: var(--accent);
  background: rgba(200, 255, 61, 0.06);
}

.order-rail-item > span:first-child {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.order-rail-item strong,
.order-rail-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-rail-item strong {
  font-size: 11px;
}

.order-rail-item small,
.rail-id {
  color: var(--muted);
  font-size: 9px;
}

.rail-id {
  flex: none;
  font-variant-numeric: tabular-nums;
}

.selected-order {
  min-width: 0;
}

.next-action {
  display: grid;
  gap: 3px;
  margin-top: 11px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.next-action span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.next-action strong {
  color: var(--text);
  font-size: 13px;
}

.request-summary {
  margin-top: 12px;
}

.request-summary dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 12px;
  margin: 7px 0 0;
}

.request-summary dl > div {
  min-width: 0;
}

.request-summary dt {
  color: var(--dim);
  font-size: 8.5px;
  font-weight: 650;
  text-transform: uppercase;
}

.request-summary dd {
  margin: 2px 0 0;
  color: var(--text);
  font-size: 10px;
  overflow-wrap: anywhere;
}

.order-progress {
  --stage-marker-size: 24px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 15px 0 0;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-raised);
  list-style: none;
}

.order-stage {
  position: relative;
  display: grid;
  min-height: 46px;
  min-width: 0;
  grid-template-columns: var(--stage-marker-size) minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  padding: 6px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--dim);
  transition: border-color 180ms var(--ease-out), background-color 180ms var(--ease-out), color 180ms ease;
}

.stage-marker {
  position: relative;
  z-index: 1;
  display: grid;
  width: var(--stage-marker-size);
  height: var(--stage-marker-size);
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
}

.stage-marker svg {
  width: 12px;
  height: 12px;
  stroke-width: 2;
}

.stage-name {
  display: -webkit-box;
  min-width: 0;
  max-height: 2.35em;
  overflow: hidden;
  font-size: 9.5px;
  font-weight: 620;
  line-height: 1.17;
  overflow-wrap: normal;
  word-break: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.order-stage.is-complete {
  color: var(--muted);
}

.order-rail-group {
  display: grid;
  gap: 6px;
}

.order-rail-group + .order-rail-group {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.order-rail-label {
  margin: 0;
  color: var(--dim);
  font-size: 8.5px;
  font-weight: 720;
  text-transform: uppercase;
}

.order-stage.is-complete .stage-marker {
  border-color: rgba(168, 220, 72, 0.36);
  background: rgba(168, 220, 72, 0.08);
  color: var(--success);
}

.order-stage.is-current {
  border-color: rgba(200, 255, 61, 0.34);
  background: rgba(200, 255, 61, 0.07);
  color: var(--text);
}

.order-stage.is-current .stage-marker {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.order-stage.is-current .stage-marker::after {
  position: absolute;
  inset: -4px;
  border: 1px solid rgba(200, 255, 61, 0.5);
  border-radius: 6px;
  animation: stage-current 1.8s var(--ease-out) infinite;
  content: "";
  pointer-events: none;
}

.order-stage.is-upcoming .stage-marker {
  border-color: var(--line);
  color: var(--dim);
}

@keyframes stage-current {
  0%, 45% {
    opacity: 0.55;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.16);
  }
}

.order-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.quote-block {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding: 11px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
}

.detail-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.detail-title svg {
  width: 13px;
  height: 13px;
}

.quote-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
}

.quote-row strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.quote-total {
  margin-top: 3px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
  color: var(--text);
}

.fulfillment-details {
  margin-top: 12px;
  border-bottom: 1px solid var(--line);
}

.order-details {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-top: 12px;
}

.order-details > summary {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  cursor: pointer;
  list-style: none;
}

.order-details > summary::-webkit-details-marker {
  display: none;
}

.order-details > summary > span:nth-child(2) {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.order-details > summary strong {
  color: var(--text);
  font-size: 12px;
}

.order-details > summary small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
}

.order-details-icon,
.details-chevron {
  color: var(--accent);
}

.order-details-icon svg,
.details-chevron svg {
  width: 16px;
  height: 16px;
}

.details-chevron {
  display: grid;
  place-items: center;
  transition: transform 160ms var(--ease-out);
}

.order-details[open] .details-chevron {
  transform: rotate(180deg);
}

.order-details-content {
  padding-bottom: 12px;
}

.order-details[open] .order-details-content {
  animation: details-enter 180ms var(--ease-out);
}

@keyframes details-enter {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.fulfillment-section {
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.fulfillment-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 720;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.fulfillment-title svg {
  width: 13px;
  height: 13px;
  color: var(--accent);
}

.fulfillment-row {
  display: grid;
  min-width: 0;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 7px;
  padding: 9px 0;
}

.fulfillment-row + .fulfillment-row {
  border-top: 1px solid rgba(41, 45, 39, 0.72);
}

.fulfillment-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: var(--accent);
}

.fulfillment-icon svg {
  width: 14px;
  height: 14px;
}

.fulfillment-row-body {
  min-width: 0;
}

.fulfillment-row-head {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
}

.fulfillment-row-head > strong {
  min-width: 0;
  color: var(--text);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.state-label {
  flex: none;
  max-width: 58%;
  padding: 2px 5px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 700;
  line-height: 1.2;
  text-align: right;
}

.state-label.is-good {
  border-color: rgba(168, 220, 72, 0.38);
  color: var(--success);
}

.state-label.is-bad {
  border-color: rgba(255, 110, 102, 0.38);
  color: var(--danger);
}

.fulfillment-facts {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 10px;
  margin-top: 7px;
}

.fulfillment-facts > span,
.warehouse-facts > span {
  min-width: 0;
}

.fulfillment-facts .is-wide {
  grid-column: 1 / -1;
}

.fulfillment-facts small,
.payment-amount small,
.warehouse-facts small {
  display: block;
  margin-bottom: 2px;
  color: var(--dim);
  font-size: 8.5px;
  font-weight: 650;
  text-transform: uppercase;
}

.fulfillment-facts strong,
.payment-amount strong,
.warehouse-facts strong {
  display: block;
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 620;
  overflow-wrap: anywhere;
}

.tracking-value {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
}

.tracking-value a {
  min-width: 0;
  color: var(--text);
  text-decoration-color: var(--line-strong);
  text-underline-offset: 2px;
}

.tracking-value code {
  color: var(--text);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 10px;
  overflow-wrap: anywhere;
}

.copy-icon {
  display: grid;
  width: 24px;
  height: 24px;
  flex: none;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.copy-icon svg {
  width: 11px;
  height: 11px;
}

.payment-amount {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
}

.payment-amount small {
  margin: 0;
}

.payment-amount strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.address-row p,
.issue-row p,
.evidence-row p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.warehouse-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 9px 0 2px 31px;
}

.warehouse-facts > span {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  column-gap: 5px;
}

.warehouse-facts svg {
  width: 13px;
  height: 13px;
  grid-row: 1 / span 2;
  color: var(--accent);
}

.warehouse-facts small,
.warehouse-facts strong {
  grid-column: 2;
}

.order-media.is-warehouse {
  margin-top: 9px;
  padding-left: 31px;
}

.section-copy {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.team-updates-section .order-media {
  margin-top: 3px;
}

.team-message-list {
  display: grid;
  margin-top: 8px;
}

.team-message {
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.team-message p {
  margin: 0;
  color: var(--text);
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.team-message time {
  display: block;
  margin-top: 4px;
  color: var(--dim);
  font-size: 9px;
}

.confirmation-totals {
  display: grid;
  margin: 16px 0;
  border-top: 1px solid var(--line);
}

.confirmation-totals > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.confirmation-totals strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.confirmation-totals .confirmation-total {
  color: var(--text);
  font-size: 13px;
}

.confirmation-totals .is-secondary {
  color: var(--muted);
  font-size: 11px;
}

.order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 11px;
}

.order-actions .button {
  flex: 1 1 auto;
  text-decoration: none;
}

.request-mode {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0f110e;
}

.request-mode button {
  display: inline-flex;
  min-width: 0;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms var(--ease-out), background-color 160ms ease, color 160ms ease;
}

.request-mode button:active {
  transform: scale(0.98);
}

.request-mode button.is-active {
  background: var(--surface-press);
  color: var(--text);
}

.request-mode svg {
  width: 14px;
  height: 14px;
}

.field-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.screenshot-control {
  display: flex;
  min-height: 34px;
  align-items: center;
  gap: 12px;
}

.field-pair {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(82px, 0.5fr);
  gap: 9px;
}

.form-actions {
  display: grid;
  grid-template-columns: 0.75fr 1.25fr;
  gap: 8px;
  margin-top: 5px;
}

.toast-region {
  position: fixed;
  z-index: 80;
  top: calc(12px + var(--safe-top));
  right: 12px;
  left: 12px;
  display: grid;
  justify-items: center;
  pointer-events: none;
}

.toast {
  width: min(100%, 430px);
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #20231e;
  box-shadow: none;
  color: var(--text);
  font-size: 12px;
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 160ms ease, transform 180ms var(--ease-out);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.is-error {
  border-color: rgba(255, 110, 102, 0.5);
}

.skeleton {
  border-radius: 6px;
  background: #171a16;
  opacity: 0.72;
}

.skeleton-head {
  width: 48%;
  height: 29px;
  margin-bottom: 18px;
}

.skeleton-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-bottom: 22px;
}

.skeleton-block {
  height: 72px;
}

.skeleton-row {
  height: 76px;
  margin-bottom: 8px;
}

.fatal-state {
  margin: 24px;
  color: var(--danger);
}

@media (min-width: 900px) {
  .app-shell {
    display: grid;
    width: min(100%, 1280px);
    grid-template-columns: 188px minmax(0, 1fr);
    grid-template-rows: auto minmax(calc(100vh - 51px), auto);
  }

  .topbar {
    grid-column: 1 / -1;
  }

  .main {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    padding: 28px 32px 48px;
  }

  .bottom-nav {
    position: sticky;
    top: 51px;
    right: auto;
    bottom: auto;
    left: auto;
    display: grid;
    width: auto;
    min-height: calc(100vh - 51px);
    grid-column: 1;
    grid-row: 2;
    grid-template-columns: 1fr;
    align-content: start;
    gap: 4px;
    margin: 0;
    padding: 18px 12px;
    border-top: 0;
    border-right: 1px solid var(--line);
    background: var(--bg);
    backdrop-filter: none;
  }

  .nav-item {
    min-height: 44px;
    grid-template-columns: 22px minmax(0, 1fr);
    place-items: center start;
    align-content: center;
    gap: 9px;
    padding: 0 10px;
    font-size: 11px;
  }

  .nav-item.is-active {
    background: var(--surface);
  }

  .page-head {
    margin-bottom: 22px;
  }

  h1 {
    font-size: 32px;
  }

  .request-entries {
    max-width: 720px;
  }

  .metrics {
    max-width: 720px;
  }

  .orders-workspace {
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
    align-items: start;
    gap: 18px;
  }

  .order-rail,
  .history-rail {
    position: sticky;
    top: 78px;
    display: grid;
    max-height: calc(100vh - 106px);
    grid-auto-columns: auto;
    grid-auto-flow: row;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0 5px 0 0;
  }

  .order-rail-item {
    width: 100%;
  }

  .order-card {
    padding: 20px;
  }

  .order-progress {
    grid-template-columns: repeat(9, minmax(0, 1fr));
  }

  .order-stage {
    min-height: 74px;
    grid-template-columns: 1fr;
    align-content: center;
    justify-items: center;
    text-align: center;
  }

  .stage-name {
    font-size: 9px;
  }

  .request-summary dl,
  .fulfillment-facts {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .fulfillment-facts .is-wide {
    grid-column: span 2;
  }

  .order-media-strip {
    grid-auto-columns: minmax(132px, 22%);
  }

  .drawer {
    right: 0;
    left: auto;
    width: min(460px, 100%);
    max-height: 100vh;
    min-height: 100vh;
    padding: 18px 22px 28px;
    border-right: 0;
    border-bottom: 0;
    border-radius: 6px 0 0 6px;
    transform: translateX(100%);
  }

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

  .drawer-handle {
    display: none;
  }
}

@media (max-width: 350px) {
  .topbar,
  .main {
    padding-right: 12px;
    padding-left: 12px;
  }

  h1 {
    font-size: 23px;
  }

  .metric {
    padding-right: 7px;
    padding-left: 7px;
  }

  .metric-value {
    font-size: 18px;
  }

  .button {
    padding-right: 10px;
    padding-left: 10px;
  }

  .request-entries {
    grid-template-columns: 1fr;
  }

  .entry-button {
    min-height: 62px;
  }

  .order-card {
    padding: 12px;
  }

  .order-progress {
    --stage-marker-size: 22px;
    gap: 4px;
    padding: 5px;
  }

  .order-stage {
    min-height: 48px;
    gap: 4px;
    padding: 5px 4px;
  }

  .stage-name {
    font-size: 8.5px;
  }

  .fulfillment-row {
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 5px;
  }

  .fulfillment-icon {
    width: 22px;
    height: 22px;
  }

  .fulfillment-row-head {
    align-items: flex-start;
  }

  .state-label {
    max-width: 62%;
  }

  .fulfillment-facts {
    column-gap: 6px;
  }

  .warehouse-facts,
  .order-media.is-warehouse {
    padding-left: 27px;
  }
}

@media (hover: hover) and (pointer: fine) {
  .button:hover,
  .icon-button:hover {
    border-color: var(--line-strong);
    background: var(--surface-press);
  }

  .button-primary:hover {
    border-color: #d5ff68;
    background: #d5ff68;
  }

  .nav-item:hover,
  .text-button:hover {
    color: var(--text);
  }

  .entry-button:hover {
    border-color: var(--line-strong);
    background: var(--surface-press);
  }
}

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

  .order-stage.is-current .stage-marker::after {
    animation: none;
    opacity: 0.35;
    transform: none;
  }
}
