:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #18212f;
  --muted: #697586;
  --line: #d9e0e7;
  --accent: #16756f;
  --accent-dark: #0f5f5a;
  --warn-bg: #fff6df;
  --warn-line: #e6bd54;
  --danger: #b42318;
  --shadow: 0 12px 28px rgba(27, 39, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei",
    sans-serif;
}

body[data-page="h5"] {
  background: #eef3f4;
}

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

button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 14px;
  cursor: pointer;
  white-space: nowrap;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 14px;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

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

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

.secondary {
  background: #243447;
  color: #fff;
}

.ghost {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.danger {
  color: var(--danger);
}

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.admin-shell {
  width: min(1280px, 100%);
}

.h5-shell {
  width: min(1120px, 100%);
}

.h5-phone-shell {
  width: min(480px, 100%);
  height: 100dvh;
  min-height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: #fff;
  box-shadow: 0 18px 50px rgba(24, 33, 47, 0.12);
}

.h5-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 14px 10px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.h5-topbar h1 {
  margin: 0;
  font-size: 20px;
}

.h5-topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.h5-link {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
}

.h5-main {
  min-height: 0;
  overflow: auto;
  display: grid;
  padding: 12px;
}

body.h5-feedback-mode .h5-main {
  padding-bottom: 12px;
}

body.h5-feedback-mode .h5-actionbar {
  display: none;
}

body.h5-login-mode .h5-actionbar {
  display: none;
}

body.h5-home-mode .h5-actionbar {
  display: none;
}

body.h5-login-mode .h5-phone-shell {
  grid-template-rows: minmax(0, 1fr);
}

body.h5-login-mode .h5-topbar {
  display: none;
}

body.h5-login-mode .h5-main {
  padding: 0;
  overflow: auto;
  background: #edf3f2;
}

body.h5-product-mode .h5-actionbar {
  display: none;
}

body.h5-orders-mode .h5-actionbar {
  display: none;
}

.h5-view {
  display: none;
}

.h5-view.active {
  display: grid;
  gap: 12px;
  min-height: 0;
}

#h5InputView.active {
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

#h5HomeView.active {
  height: 100%;
  align-content: start;
  grid-template-rows: auto minmax(0, 1fr);
}

#h5ProductView.active {
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr);
}

#h5OrdersView.active {
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

#h5LoginView.active {
  min-height: 100dvh;
  padding: calc(22px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom));
  align-content: center;
}

.h5-field {
  display: grid;
  gap: 7px;
}

#h5InputView .h5-text-field,
#h5ProductView .h5-text-field {
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
}

.h5-page-head-actions,
.h5-product-head-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.h5-page-head-actions button,
.h5-product-head-actions button {
  min-height: 38px;
  padding: 0 12px;
  white-space: nowrap;
}

.h5-product-panels {
  min-height: 0;
  display: grid;
}

.h5-product-panel {
  display: none;
  min-height: 0;
}

.h5-product-panel.active {
  display: grid;
  min-height: 0;
}

#h5ProductCommandPanel.active {
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
}

.h5-resource-list,
.h5-detail-stack {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 1px 0 8px;
}

.h5-resource-card,
.h5-detail-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.h5-resource-card {
  cursor: pointer;
  display: grid;
  gap: 8px;
  -webkit-tap-highlight-color: rgba(15, 118, 110, 0.12);
}

.h5-resource-card:active {
  background: #f8fbfb;
}

.h5-resource-card strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 15px;
}

.h5-resource-card span,
.h5-resource-card p,
.h5-detail-row span {
  color: var(--muted);
  font-size: 12px;
}

.h5-resource-meta,
.h5-detail-actions,
.h5-child-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.h5-resource-meta span {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
}

.h5-detail-card {
  display: grid;
  gap: 10px;
}

.h5-detail-row {
  display: grid;
  gap: 3px;
}

.h5-detail-row strong {
  overflow-wrap: anywhere;
}

.h5-detail-actions button,
.h5-child-actions button {
  min-height: 36px;
  padding: 0 12px;
}

.h5-login-card {
  display: grid;
  gap: 15px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(24, 33, 47, 0.1);
}

.h5-login-panel {
  width: 100%;
  max-width: 420px;
  display: grid;
  gap: 18px;
  margin: 0 auto;
}

.h5-login-brand {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 0 2px;
}

.h5-login-brand h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.18;
}

.h5-login-brand p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.h5-login-mark {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #16756f;
}

.h5-login-mark::before,
.h5-login-mark::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  height: 3px;
  border-radius: 2px;
  background: #fff;
}

.h5-login-mark::before {
  top: 14px;
}

.h5-login-mark::after {
  bottom: 14px;
}

.h5-login-card .h5-field {
  gap: 8px;
}

.h5-login-card input {
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  outline: none;
}

.h5-login-card input:focus {
  border-color: #16756f;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(22, 117, 111, 0.12);
}

.h5-login-card button {
  min-height: 50px;
  margin-top: 2px;
  font-weight: 700;
}

.h5-user-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.h5-user-line span {
  color: var(--muted);
  font-size: 13px;
}

.h5-user-line strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.h5-user-line button {
  min-height: 30px;
  padding: 0 9px;
}

.h5-account-row {
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(15, 118, 110, 0.12);
}

.h5-account-row:active {
  background: #f8fbfb;
}

.h5-account-open {
  margin-left: auto;
  color: var(--primary);
  font-size: 13px;
}

.h5-user-line .h5-account-open {
  color: var(--primary);
}

.h5-home-grid {
  display: grid;
  gap: 10px;
  align-content: start;
}

.h5-home-card {
  width: 100%;
  min-height: 92px;
  display: grid;
  gap: 6px;
  justify-items: start;
  align-content: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(15, 118, 110, 0.12);
}

.h5-home-card:active {
  background: #f8fbfb;
}

.h5-home-card strong {
  font-size: 18px;
}

.h5-home-card span {
  color: var(--muted);
  font-size: 13px;
}

.h5-field > span {
  color: var(--muted);
  font-size: 13px;
}

.h5-field input,
.h5-field textarea {
  padding: 11px 12px;
  font-size: 15px;
}

.h5-text-field textarea,
body[data-page="h5"] #orderText {
  width: 100%;
  height: 100%;
  min-height: 0;
  line-height: 1.65;
  resize: none;
}

.h5-switch {
  min-height: 40px;
}

.h5-actionbar {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.h5-actionbar button {
  min-width: 0;
  padding: 0 8px;
}

.h5-feedback-view.active,
.h5-orders-view.active {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: calc(100dvh - 78px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.h5-sheet-head,
.h5-sheet-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.h5-sheet-head h2 {
  margin: 0;
  font-size: 18px;
}

.h5-sheet-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.h5-feedback-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.h5-feedback-actions button {
  min-width: 58px;
  padding: 0 10px;
}

.h5-feedback-actions .h5-icon-action {
  min-width: 66px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.h5-action-icon {
  position: relative;
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.h5-action-icon-void {
  border: 1.5px solid currentColor;
  border-radius: 999px;
}

.h5-action-icon-void::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  top: 6px;
  height: 1.5px;
  border-radius: 2px;
  background: currentColor;
  transform: rotate(-35deg);
}

.h5-action-icon-edit::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 7px;
  width: 11px;
  height: 3px;
  border-radius: 2px;
  background: currentColor;
  transform: rotate(-35deg);
}

.h5-action-icon-edit::after {
  content: "";
  position: absolute;
  left: 1px;
  bottom: 1px;
  width: 11px;
  height: 1.5px;
  border-radius: 2px;
  background: currentColor;
}

.h5-action-icon-copy::before,
.h5-action-icon-copy::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 10px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  background: #fff;
}

.h5-action-icon-copy::before {
  left: 1px;
  top: 4px;
}

.h5-action-icon-copy::after {
  right: 1px;
  top: 1px;
}

.h5-feedback-actions .status-pill {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  font-size: 13px;
}

.h5-sheet-body {
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

.h5-feedback-view.active .h5-sheet-body {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
}

.h5-sheet-foot {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.h5-sheet-foot button {
  flex: 1;
  min-width: 0;
  padding: 0 8px;
}

.h5-two-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.h5-two-actions button {
  width: 100%;
}

.h5-orders-body {
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

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

.h5-order-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(15, 118, 110, 0.12);
  transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.16s ease;
}

.h5-order-card:active {
  transform: scale(0.995);
  background: #f8fbfb;
}

.h5-order-card:focus-visible {
  outline: 2px solid rgba(15, 118, 110, 0.34);
  outline-offset: 2px;
  border-color: var(--primary);
}

.h5-order-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.h5-order-card-head strong,
.h5-order-card-head span,
.h5-order-card-body span {
  min-width: 0;
}

.h5-order-card-head strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 15px;
}

.h5-order-card-head div > span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.h5-order-card-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.h5-order-card-body span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.h5-message-component-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--muted);
}

.h5-message-component-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding-top: 7px;
  border-top: 1px solid rgba(180, 35, 24, 0.16);
}

.h5-message-component-row span {
  min-width: 34px;
  padding: 2px 6px;
  border-radius: 6px;
  background: #ffe1dc;
  color: var(--danger);
  font-size: 12px;
  text-align: center;
}

.h5-message-component-row p {
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.h5-message-modal.ok .h5-message-component-row {
  border-top-color: rgba(22, 126, 114, 0.18);
}

.h5-message-modal.ok .h5-message-component-row span {
  background: #def2ef;
  color: var(--accent-dark);
}

.h5-message-modal.ok .h5-message-component-row p {
  color: var(--text);
}

.h5-message-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  align-items: start;
  justify-items: center;
  padding: calc(18px + env(safe-area-inset-top)) 14px 14px;
  background: rgba(24, 33, 47, 0.26);
}

.h5-message-dialog {
  width: min(452px, 100%);
  max-height: min(70dvh, 560px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.h5-message-modal.ok .h5-message-dialog {
  border-color: #90c8c3;
}

.h5-message-modal.error .h5-message-dialog {
  border-color: #f0b8b1;
}

.h5-message-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.h5-message-dialog-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.h5-message-dialog-title strong {
  font-size: 14px;
}

.h5-message-modal.ok .h5-message-dialog-title strong {
  color: var(--accent-dark);
}

.h5-message-modal.error .h5-message-dialog-title strong {
  color: var(--danger);
}

.h5-message-modal.ok .h5-message-component-dot {
  background: var(--accent);
}

.h5-message-modal.error .h5-message-component-dot {
  background: var(--danger);
}

.h5-message-dialog-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
}

.h5-message-dialog-actions button {
  min-height: 30px;
  padding: 0 9px;
}

.h5-message-dialog-body {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding: 10px;
}

.h5-account-modal {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  align-items: end;
  justify-items: center;
  padding: 14px;
  background: rgba(24, 33, 47, 0.28);
}

.h5-account-dialog {
  width: min(452px, 100%);
  max-height: min(86dvh, 640px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.h5-account-head,
.h5-account-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  background: #fff;
}

.h5-account-head-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.h5-account-head {
  border-bottom: 1px solid var(--line);
}

.h5-account-foot {
  border-top: 1px solid var(--line);
}

.h5-account-head h2 {
  margin: 0;
  font-size: 17px;
}

.h5-account-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.h5-account-body {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 12px;
  padding: 12px;
}

.h5-account-panel {
  display: none;
}

.h5-account-panel.active {
  display: grid;
  gap: 12px;
}

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

.h5-account-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(15, 118, 110, 0.12);
}

.h5-account-card:active {
  background: #f8fbfb;
}

.h5-account-card strong {
  font-size: 15px;
}

.h5-account-card span {
  color: var(--muted);
  font-size: 13px;
}

.h5-account-info {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.h5-account-info div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.h5-account-info span {
  color: var(--muted);
  font-size: 13px;
}

.h5-account-info strong {
  overflow-wrap: anywhere;
}

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

.h5-password-form input {
  min-height: 44px;
}

.h5-account-foot button {
  min-height: 40px;
  padding: 0 12px;
}

.h5-message {
  min-height: 180px;
  max-height: 34dvh;
  margin-top: 10px;
}

.h5-feedback-view.active .h5-message {
  height: 100%;
  min-height: 0;
  max-height: none;
  margin-top: 0;
}

.h5-command-message {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.wechat-shell {
  width: min(980px, 100%);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0 14px;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.topbar p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.topbar-actions,
.button-row,
.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar-actions .button-link {
  flex: 0 0 auto;
}

.tabs {
  display: inline-flex;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 4px;
  margin-bottom: 16px;
}

.tab {
  min-width: 86px;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
}

.tab.active {
  background: #18212f;
  color: #fff;
}

.admin-tabs,
.modal-tabs {
  display: inline-flex;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 4px;
  margin-bottom: 16px;
}

.admin-tab,
.modal-tab {
  min-width: 92px;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
}

.admin-tab.active,
.modal-tab.active {
  background: #18212f;
  color: #fff;
}

.workspace {
  display: none;
}

.workspace.active {
  display: block;
}

.admin-panel,
.modal-tab-panel {
  display: none;
}

.admin-panel.active,
.modal-tab-panel.active {
  display: block;
}

.resource-workbench {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.resource-nav {
  position: sticky;
  top: 12px;
  display: grid;
  gap: 8px;
}

.resource-nav-item {
  display: grid;
  width: 100%;
  min-height: 64px;
  justify-items: start;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px 12px;
}

.resource-nav-item.active {
  border-color: var(--accent);
  background: #edf7f6;
  color: var(--accent-dark);
}

.resource-nav-item span {
  font-weight: 700;
}

.resource-nav-item strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.resource-stage {
  min-width: 0;
}

.order-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.manage-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
  gap: 16px;
}

.child-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.75fr) minmax(0, 1.25fr);
  gap: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}

.resource-shell {
  padding: 0;
  overflow: hidden;
}

.resource-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.resource-toolbar h2 {
  margin: 0 0 4px;
  font-size: 17px;
}

.resource-contract {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.resource-contract span {
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfcfd;
  color: var(--muted);
  font-size: 12px;
}

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

.toolbar-actions .search-input {
  min-width: 230px;
}

.sub-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 14px;
}

.sub-panel.nested {
  margin-top: 16px;
}

.panel-head {
  justify-content: space-between;
  margin-bottom: 12px;
}

.panel h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 117, 111, 0.12);
}

#orderText {
  min-height: 370px;
  resize: vertical;
  line-height: 1.7;
  padding: 14px;
}

.csv-box {
  min-height: 110px;
  resize: vertical;
  padding: 12px;
  line-height: 1.6;
}

.task-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.task-steps span {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.task-steps span.active {
  border-color: var(--accent);
  background: #edf7f6;
  color: var(--accent-dark);
  font-weight: 700;
}

.task-form {
  margin-bottom: 12px;
}

.task-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  min-height: 56px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--muted);
}

/* PC admin low-code shell */
body[data-page="admin"] {
  min-height: 100dvh;
  overflow: hidden;
  background: #fff5f8;
  color: #263437;
  font-size: 14px;
}

body[data-page="admin"] .admin-shell {
  width: 100%;
  max-width: none;
  min-height: 100dvh;
  height: 100dvh;
  display: grid;
  grid-template-rows: 46px minmax(0, 1fr);
  gap: 0;
  margin: 0;
  padding: 0;
  background: #fff5f8;
}

.erp-global-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 46px;
  padding: 0 16px;
  border-bottom: 1px solid #f3cbd8;
  background: #fff;
}

.erp-app-grid {
  width: 32px;
  min-height: 32px;
  display: grid;
  grid-template-columns: repeat(2, 6px);
  align-content: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
  border: 0;
  background: transparent;
}

.erp-app-grid span {
  width: 6px;
  height: 6px;
  border: 2px solid #8b5a6a;
  border-radius: 2px;
}

.erp-bookmark {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #5f3342;
  font-weight: 600;
}

.erp-bookmark::before {
  content: "";
  width: 18px;
  height: 13px;
  border: 2px solid #8b5a6a;
  border-top-left-radius: 3px;
  border-top-right-radius: 3px;
}

.erp-admin-body {
  min-height: 0;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
}

.admin-sidebar {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: start;
  gap: 28px;
  padding: 24px 14px;
  border-right: 1px solid #f3cbd8;
  background: #fff;
  color: #263437;
}

.admin-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 44px;
  padding: 0 0 22px;
  border-bottom: 1px solid #f3cbd8;
}

.admin-brand-mark {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  background: #d94f7d;
  color: #fff;
  font-weight: 800;
}

.admin-brand strong {
  min-width: 0;
  color: #263437;
  font-size: 16px;
  font-weight: 800;
}

body[data-page="admin"] .resource-nav {
  position: static;
  min-height: 0;
  align-content: start;
  overflow: auto;
  gap: 14px;
}

body[data-page="admin"] .resource-nav-item {
  min-height: 52px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto 12px;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: #fff;
  color: #263437;
  text-align: left;
  text-decoration: none;
}

.resource-nav-icon {
  width: 18px;
  height: 18px;
  border: 2px solid #7f4a5c;
  border-radius: 4px;
}

body[data-page="admin"] .resource-nav-item strong {
  min-width: 0;
  color: inherit;
  font-size: 15px;
  font-weight: 800;
}

body[data-page="admin"] .resource-nav-item em {
  min-width: 38px;
  padding: 3px 7px;
  border: 1px solid #f0bfd0;
  border-radius: 4px;
  color: #c43b70;
  font-style: normal;
  font-weight: 800;
  text-align: center;
}

body[data-page="admin"] .resource-nav-item b {
  width: 8px;
  height: 8px;
  border-top: 2px solid #667678;
  border-right: 2px solid #667678;
  transform: rotate(45deg);
}

body[data-page="admin"] .resource-nav-item:hover,
body[data-page="admin"] .resource-nav-item.active {
  border-color: #f3cbd8;
  background: #fff5f8;
  color: #263437;
}

body[data-page="admin"] .resource-nav-item.admin-tab.active {
  border-color: #f0bfd0;
  background: #fff0f6;
}

.admin-main {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 20px 24px 32px;
  background: #fff5f8;
}

.erp-context-bar {
  min-width: 0;
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 14px;
  border: 1px solid #f3cbd8;
  background: #fff;
  box-shadow: 0 1px 2px rgba(29, 45, 48, 0.04);
}

.erp-context-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.erp-context-fields label {
  display: grid;
  gap: 5px;
  color: #6b7b7e;
  font-size: 13px;
  font-weight: 700;
}

.erp-context-fields select {
  width: 230px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid #edc4d1;
  border-radius: 4px;
  color: #263437;
  background: #fff;
}

.erp-user-chip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 12px;
  align-items: center;
  gap: 10px;
  min-width: 190px;
}

.erp-user-avatar {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff0f6;
  color: #c43b70;
  font-weight: 900;
}

.erp-user-chip strong,
.erp-user-chip small {
  display: block;
}

.erp-user-chip strong {
  color: #263437;
  font-size: 15px;
}

.erp-user-chip small {
  margin-top: 2px;
  color: #6b7b7e;
  font-size: 12px;
}

.erp-user-chip i {
  width: 8px;
  height: 8px;
  border-right: 2px solid #627174;
  border-bottom: 2px solid #627174;
  transform: rotate(45deg);
}

.erp-page-tabs {
  display: flex;
  align-items: flex-end;
  min-height: 58px;
  padding: 0 28px;
  border-right: 1px solid #f3cbd8;
  border-bottom: 1px solid #f3cbd8;
  border-left: 1px solid #f3cbd8;
  background: #fff;
}

.erp-page-tab {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px 0 18px;
  border: 0;
  border-right: 1px solid transparent;
  border-left: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #6b7b7e;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.erp-page-tab.admin-tab.active {
  border-color: #f0bfd0;
  border-top: 3px solid #d94f7d;
  background: #fff;
  color: #c43b70;
  box-shadow: 0 -1px 0 #fff inset;
}

.erp-tab-close {
  width: 22px;
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #7f4a5c;
  font-size: 15px;
  line-height: 1;
}

.erp-tab-close:hover {
  background: #ffe2eb;
  color: #b4235b;
}

body[data-page="admin"] main {
  min-width: 0;
  padding-top: 12px;
}

body[data-page="admin"] .resource-workbench {
  display: block;
}

body[data-page="admin"] .panel.resource-shell {
  margin: 0;
  padding: 0;
  border: 1px solid #f3cbd8;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(29, 45, 48, 0.05);
}

body[data-page="admin"] .resource-toolbar {
  display: grid;
  grid-template-columns: auto minmax(320px, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 10px 14px;
  border-bottom: 1px solid #f3cbd8;
  background: #fff;
}

.erp-resource-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 160px;
}

.erp-resource-title h2 {
  margin: 0;
  color: #263437;
  font-size: 16px;
  font-weight: 800;
}

.erp-resource-title span {
  color: #748386;
  font-weight: 800;
}

.erp-toolbar-search {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.erp-toolbar-search .search-input {
  height: 38px;
  border-radius: 4px;
  padding-left: 36px;
  background:
    linear-gradient(#8b5a6a, #8b5a6a) 18px 18px / 12px 2px no-repeat,
    radial-gradient(circle at 14px 15px, transparent 5px, #8b5a6a 6px, #8b5a6a 7px, transparent 8px) 0 0 / 28px 28px no-repeat,
    #fff;
}

body[data-page="admin"] .toolbar-actions {
  flex-wrap: nowrap;
  gap: 8px;
}

body[data-page="admin"] .toolbar-actions .search-input {
  min-width: 132px;
  height: 38px;
  border-radius: 4px;
}

body[data-page="admin"] .table-wrap {
  max-height: calc(100dvh - 300px);
  min-height: 360px;
  overflow: auto;
  border-top: 0;
  background: #fff;
}

body[data-page="admin"] .erp-data-table {
  min-width: 1010px;
  border-collapse: collapse;
  color: #263437;
  font-size: 14px;
}

body[data-page="admin"] [data-resource="orders"] .erp-data-table {
  min-width: 1900px;
}

body[data-page="admin"] .erp-data-table th,
body[data-page="admin"] .erp-data-table td {
  height: 54px;
  padding: 8px 10px;
  border-bottom: 1px solid #f3cbd8;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

body[data-page="admin"] .erp-data-table .erp-action-cell {
  position: sticky;
  right: 0;
  z-index: 2;
  min-width: 190px;
  background: #fff;
  box-shadow: -1px 0 0 #f3cbd8;
}

body[data-page="admin"] .erp-head-row th {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 48px;
  background: #f2f4f5;
  color: #69787b;
  font-size: 14px;
  font-weight: 800;
}

body[data-page="admin"] .erp-head-row th:not(.erp-menu-cell) {
  min-width: 78px;
}

body[data-page="admin"] .erp-head-row th > span {
  display: inline-flex;
  vertical-align: middle;
}

.erp-column-filter {
  width: 20px;
  min-height: 20px;
  display: inline-flex;
  vertical-align: middle;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
}

.erp-column-filter::before {
  content: "";
  width: 12px;
  height: 9px;
  background:
    linear-gradient(#8b5a6a, #8b5a6a) 0 0 / 12px 2px no-repeat,
    linear-gradient(#8b5a6a, #8b5a6a) 0 4px / 12px 2px no-repeat,
    linear-gradient(#8b5a6a, #8b5a6a) 0 8px / 12px 2px no-repeat;
}

.erp-column-filter:hover {
  background: #ffe2eb;
}

body[data-page="admin"] .erp-head-row .erp-action-cell {
  z-index: 7;
  background: #f2f4f5;
}

body[data-page="admin"] .erp-filter-row th {
  position: sticky;
  top: 48px;
  z-index: 5;
  height: 40px;
  padding: 4px 4px;
  background: #fbfcfc;
  box-shadow: 0 1px 0 #f3cbd8;
}

body[data-page="admin"] .erp-filter-row .erp-action-cell {
  z-index: 7;
  background: #fbfcfc;
}

body[data-page="admin"] .erp-filter-row input {
  width: 100%;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #edc4d1;
  border-radius: 0;
  color: #263437;
  text-align: center;
}

body[data-page="admin"] .erp-filter-row input::placeholder {
  color: #9aa6a8;
}

body[data-page="admin"] .erp-menu-cell {
  width: 34px;
  min-width: 34px;
  color: #6b7b7e;
}

body[data-page="admin"] .erp-menu-cell::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 10px;
  background:
    linear-gradient(#8b5a6a, #8b5a6a) 0 0 / 14px 2px no-repeat,
    linear-gradient(#8b5a6a, #8b5a6a) 0 4px / 14px 2px no-repeat,
    linear-gradient(#8b5a6a, #8b5a6a) 0 8px / 14px 2px no-repeat;
}

body[data-page="admin"] .erp-data-table tbody tr:hover {
  background: #f8fbfb;
  cursor: default;
}

body[data-page="admin"] .erp-data-table tbody tr:hover .erp-action-cell {
  background: #f8fbfb;
}

body[data-page="admin"] .erp-data-table tbody tr[data-product-row],
body[data-page="admin"] .erp-data-table tbody tr[data-order-row] {
  cursor: pointer;
}

body[data-page="admin"] .row-actions {
  justify-content: center;
  flex-wrap: nowrap;
}

body[data-page="admin"] .row-actions button {
  min-height: 34px;
  border-radius: 4px;
  padding: 0 12px;
}

body[data-page="admin"] .row-actions .danger {
  border-color: #b4235b;
  background: #b4235b;
  color: #fff;
}

.erp-pagination {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid #f3cbd8;
  color: #69787b;
  font-weight: 700;
}

.erp-pagination select {
  width: 72px;
  height: 38px;
  border-radius: 4px;
}

.erp-pagination button {
  margin-left: auto;
}

.erp-pagination button + button {
  margin-left: 0;
}

body[data-page="admin"] button,
body[data-page="admin"] .button-link {
  min-height: 38px;
  border-radius: 4px;
  padding: 0 13px;
  font-weight: 700;
}

body[data-page="admin"] .primary {
  background: #d94f7d;
  color: #fff;
}

body[data-page="admin"] .primary:hover {
  background: #c43b70;
}

body[data-page="admin"] .ghost {
  border-color: #edc4d1;
  background: #fff;
  color: #263437;
}

.task-preview div {
  min-width: 0;
}

.task-preview span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
}

.task-preview strong {
  color: var(--ink);
  font-size: 13px;
  word-break: break-all;
}

.message-box {
  min-height: 370px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
  white-space: pre-wrap;
  line-height: 1.65;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 14px;
}

.message-box.short {
  min-height: 180px;
}

.message-box.compact {
  min-height: 120px;
  margin-top: 12px;
}

.button-row {
  justify-content: flex-end;
  margin-top: 12px;
}

.button-row.inline {
  margin-top: 0;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  user-select: none;
}

.switch input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.warning-box {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--warn-line);
  border-radius: 7px;
  background: var(--warn-bg);
  color: #604200;
  line-height: 1.5;
  font-size: 14px;
}

.hidden {
  display: none !important;
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

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

[data-resource="orders"] table {
  min-width: 1180px;
}

th,
td {
  height: 44px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-weight: 600;
  background: #f9fafb;
}

.empty {
  color: var(--muted);
  text-align: center;
}

.product-form {
  display: grid;
  grid-template-columns: 1fr 1.2fr 0.8fr 0.8fr 0.6fr 0.7fr auto auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.color-form {
  display: grid;
  grid-template-columns: 1fr 1.2fr auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.supplier-form {
  display: grid;
  grid-template-columns: 0.8fr 1fr 0.9fr 1.2fr 0.7fr 0.7fr 0.6fr 0.6fr 0.7fr auto 1fr auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.color-map-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.product-form input,
.color-form input,
.supplier-form input,
.color-map-form input,
.search-input {
  height: 40px;
  padding: 0 11px;
}

.search-input {
  max-width: 260px;
}

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

.config-grid > div,
.pipeline-grid > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.system-body {
  padding: 16px;
}

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

.label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  max-width: min(520px, calc(100vw - 28px));
  padding: 11px 14px;
  border-radius: 8px;
  background: #18212f;
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 14px;
  z-index: 20;
}

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

.order-row-actions {
  flex-wrap: wrap;
  min-width: 290px;
}

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

.mini-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  padding: 0 10px;
  font-size: 14px;
}

.mini-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.selected-row td {
  background: #edf7f6;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(24, 33, 47, 0.38);
}

.modal {
  display: flex;
  flex-direction: column;
  width: min(960px, calc(100vw - 32px));
  max-height: calc(100vh - 36px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 64px rgba(24, 33, 47, 0.22);
  overflow: hidden;
}

.resource-modal {
  width: min(1120px, calc(100vw - 32px));
}

.record-modal {
  width: min(620px, calc(100vw - 32px));
}

.record-modal.wide-record {
  width: min(980px, calc(100vw - 32px));
}

.task-modal {
  width: min(920px, calc(100vw - 32px));
}

.confirm-modal {
  width: min(420px, calc(100vw - 32px));
}

.modal-head,
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
}

.modal-head {
  border-bottom: 1px solid var(--line);
}

.modal-foot {
  border-top: 1px solid var(--line);
  justify-content: flex-end;
}

.modal-head h2 {
  margin: 0;
  font-size: 18px;
}

.modal-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.modal-body {
  overflow: auto;
  padding: 16px;
}

.icon-btn {
  min-height: 34px;
  border-color: var(--line);
  background: #fff;
  color: var(--muted);
}

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

.document-form.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.document-form label {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.document-form label > span {
  color: var(--muted);
  font-size: 13px;
}

.document-form input {
  height: 38px;
  padding: 0 10px;
}

.document-form select {
  height: 38px;
  padding: 0 10px;
}

.document-form input:disabled {
  background: #f3f5f7;
  color: #4b5563;
}

.span-2 {
  grid-column: span 2;
}

.span-4 {
  grid-column: span 4;
}

.check-field {
  display: inline-flex !important;
  grid-template-columns: auto 1fr !important;
  justify-content: flex-start;
}

.check-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

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

.child-toolbar h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.child-toolbar p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.detail-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfd;
}

.detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 5px;
}

.detail-grid strong {
  font-size: 14px;
  font-weight: 600;
}

.order-editor {
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(0, 1.08fr);
  gap: 16px;
}

.order-editor h3 {
  margin: 0;
  font-size: 16px;
}

.order-editor-input,
.order-editor-preview {
  min-width: 0;
}

.textarea-field {
  display: block;
  margin-top: 12px;
}

.textarea-field > span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 7px;
}

.order-edit-text {
  min-height: 430px;
  resize: vertical;
  padding: 12px;
  line-height: 1.7;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.status-draft {
  border-color: #c8d1dc;
  background: #f4f7fa;
  color: #526171;
}

.status-submitted {
  border-color: #90c8c3;
  background: #edf7f6;
  color: #0f5f5a;
}

.status-confirmed {
  border-color: #a9c7e8;
  background: #eef6ff;
  color: #225a93;
}

.status-voided,
.status-deleted {
  border-color: #f0b8b1;
  background: #fff4f2;
  color: var(--danger);
}

.danger-bg {
  background: var(--danger);
}

.danger-bg:hover {
  background: #8f1d14;
}

.master-table table {
  min-width: 900px;
}

.supplier-table table {
  min-width: 760px;
}

.compact-table table {
  min-width: 360px;
}

@media (max-width: 860px) {
  .app-shell {
    padding: 12px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions button {
    flex: 1;
  }

  .topbar-actions .button-link {
    flex: 1;
  }

  .tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
  }

  .admin-tabs,
  .modal-tabs {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .tab {
    min-width: 0;
  }

  .order-grid,
  .manage-grid,
  .child-grid,
  .resource-workbench,
  .task-steps,
  .task-preview {
    grid-template-columns: 1fr;
  }

  .resource-nav {
    position: static;
  }

  .resource-toolbar,
  .child-toolbar,
  .modal-head,
  .modal-foot {
    align-items: stretch;
    flex-direction: column;
  }

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

  .toolbar-actions button,
  .toolbar-actions .search-input,
  .modal-foot button {
    width: 100%;
    max-width: none;
  }

  #orderText,
  .message-box {
    min-height: 300px;
  }

  .product-form,
  .color-form,
  .supplier-form,
  .color-map-form,
  .order-editor,
  .document-form,
  .document-form.two-col,
  .detail-grid,
  .config-grid {
    grid-template-columns: 1fr;
  }

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

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

  .span-2,
  .span-4 {
    grid-column: span 1;
  }

  .search-input {
    max-width: none;
  }

  .panel {
    padding: 12px;
  }
}
