:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #132033;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #3658db;
  --primary-dark: #2845b6;
  --accent: #16a394;
  --soft: #eef4ff;
  --success: #16a34a;
  --success-bg: #edfdf3;
  --warning: #d97706;
  --warning-bg: #fff7e6;
  --danger: #dc2626;
  --danger-bg: #fff1f2;
  --shadow: 0 12px 30px rgba(18, 33, 68, 0.08);
  --shadow-soft: 0 8px 22px rgba(18, 33, 68, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC",
    "Noto Sans CJK SC", "Noto Sans SC", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::selection {
  background: rgba(54, 88, 219, 0.18);
}

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

button {
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 460px) 1fr;
  background: linear-gradient(135deg, #f8fbff, #edf4ff);
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.login-card {
  width: 100%;
  max-width: 360px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--primary);
  color: white;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(54, 88, 219, 0.28);
}

.login-visual {
  display: grid;
  place-items: center;
  padding: 48px;
}

.visual-board {
  width: min(760px, 100%);
  aspect-ratio: 1.42;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(54, 88, 219, 0.9) 0 22%, transparent 22%),
    linear-gradient(180deg, #ffffff 0 16%, #f2f6fc 16% 100%);
  border: 1px solid rgba(54, 88, 219, 0.16);
  box-shadow: 0 28px 70px rgba(38, 68, 140, 0.18);
}

.visual-board::before,
.visual-board::after {
  content: "";
  position: absolute;
  left: 26%;
  right: 5%;
  height: 72px;
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.visual-board::before {
  top: 24%;
}

.visual-board::after {
  top: 48%;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.field label {
  font-size: 13px;
  font-weight: 650;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 9px 12px;
  outline: none;
}

.compact-textarea {
  min-height: 72px;
}

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

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(54, 88, 219, 0.12);
}

.password-field {
  position: relative;
}

.password-field .input {
  padding-right: 46px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  width: 30px;
  height: 30px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.password-toggle:hover {
  background: var(--soft);
  color: var(--primary);
}

.password-toggle::before {
  content: "";
  width: 18px;
  height: 11px;
  border: 1.8px solid currentColor;
  border-radius: 50%;
}

.password-toggle::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.password-toggle.active {
  color: var(--primary);
}

.material-hero {
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 208, 92, 0.35), transparent 18%),
    linear-gradient(180deg, #ffffff 0 22%, #edf5ff 22% 100%);
}

.material-hero::before,
.material-hero::after {
  display: none;
}

.hero-title {
  position: absolute;
  left: 44px;
  top: 36px;
  color: #1d2a44;
  font-size: 34px;
  font-weight: 900;
}

.hero-subtitle {
  position: absolute;
  left: 46px;
  top: 82px;
  color: #64748b;
  font-size: 16px;
  font-weight: 650;
}

.hero-sun {
  position: absolute;
  right: 68px;
  top: 52px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #ffd56a;
  box-shadow: 0 12px 28px rgba(255, 186, 74, 0.28);
}

.hero-card {
  position: absolute;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 20px 45px rgba(38, 68, 140, 0.14);
}

.hero-card-a {
  right: 92px;
  top: 152px;
  width: 218px;
  height: 82px;
}

.hero-card-b {
  right: 138px;
  top: 256px;
  width: 272px;
  height: 96px;
}

.hero-truck {
  position: absolute;
  left: 80px;
  bottom: 96px;
  width: 352px;
  height: 150px;
}

.truck-body {
  position: absolute;
  left: 0;
  bottom: 30px;
  width: 222px;
  height: 92px;
  border-radius: 12px 12px 6px 6px;
  background: repeating-linear-gradient(90deg, #c9e0f8 0 18px, #b8d4f1 18px 21px);
  border: 3px solid #8eb7e4;
}

.truck-cab {
  position: absolute;
  left: 220px;
  bottom: 30px;
  width: 112px;
  height: 82px;
  border-radius: 18px 22px 8px 8px;
  background: #4f7ee8;
  box-shadow: inset 34px 0 0 rgba(255, 255, 255, 0.18);
}

.truck-wheel {
  position: absolute;
  bottom: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #24324a;
  border: 9px solid #eef4ff;
}

.wheel-left {
  left: 48px;
}

.wheel-right {
  left: 252px;
}

.hero-stack {
  position: absolute;
  border-radius: 8px;
  box-shadow: 0 14px 28px rgba(38, 68, 140, 0.12);
}

.stack-wood {
  right: 88px;
  bottom: 95px;
  width: 210px;
  height: 86px;
  background: repeating-linear-gradient(0deg, #d8a45b 0 16px, #c98d45 16px 20px);
  transform: rotate(-4deg);
}

.stack-tile {
  right: 250px;
  bottom: 82px;
  width: 124px;
  height: 112px;
  background: repeating-linear-gradient(90deg, #d9e5ee 0 24px, #c8d7e3 24px 28px);
  transform: rotate(5deg);
}

.hero-worker {
  position: absolute;
  left: 430px;
  bottom: 88px;
  width: 66px;
  height: 126px;
  border-radius: 26px 26px 12px 12px;
  background: linear-gradient(#315bdc 0 56%, #23395f 56% 100%);
}

.hero-worker::before {
  content: "";
  position: absolute;
  left: 11px;
  top: -42px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffd0a6;
  box-shadow: 0 -12px 0 #f7b84b;
}

.ai-login-hero {
  isolation: isolate;
  background: #101321;
  border-color: rgba(125, 151, 229, 0.42);
  box-shadow: 0 30px 76px rgba(11, 18, 38, 0.34);
  perspective: 1000px;
}

.ai-login-hero::before,
.ai-login-hero::after {
  display: none;
}

.ai-login-hero .tech-hero-copy {
  position: absolute;
  z-index: 12;
  left: 34px;
  top: 28px;
}

.tech-hero-copy span {
  display: block;
  margin-bottom: 7px;
  color: #70dbe8;
  font-size: 9px;
  font-weight: 800;
}

.tech-hero-copy h2 {
  margin: 0 0 5px;
  color: #fff;
  font-size: 27px;
  letter-spacing: 0;
}

.tech-hero-copy p {
  margin: 0;
  color: #94a7bf;
  font-size: 12px;
}

.tech-grid-floor {
  position: absolute;
  z-index: 0;
  left: -12%;
  right: -12%;
  bottom: -36%;
  height: 78%;
  transform: rotateX(66deg);
  transform-origin: center top;
  background-image:
    linear-gradient(rgba(104, 127, 224, 0.19) 1px, transparent 1px),
    linear-gradient(90deg, rgba(104, 127, 224, 0.19) 1px, transparent 1px);
  background-size: 34px 34px;
  animation: tech-grid-shift 12s linear infinite;
}

.tech-scan-line {
  position: absolute;
  z-index: 1;
  left: 4%;
  right: 4%;
  bottom: 31%;
  height: 1px;
  background: #4ed5e7;
  box-shadow: 0 0 18px rgba(78, 213, 231, 0.9);
  opacity: 0.64;
  animation: tech-scan 6s ease-in-out infinite;
}

.tech-orbit {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 53%;
  border-radius: 50%;
  transform-style: preserve-3d;
}

.tech-orbit-outer {
  width: 390px;
  height: 390px;
  margin: -195px 0 0 -195px;
  border: 1px solid rgba(124, 148, 238, 0.38);
  transform: rotateX(67deg) rotateZ(0deg);
  box-shadow: 0 0 32px rgba(90, 117, 221, 0.12);
  animation: tech-orbit-spin 16s linear infinite;
}

.tech-orbit-outer::before,
.tech-orbit-outer::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #56dbe8;
  box-shadow: 0 0 15px #56dbe8;
}

.tech-orbit-outer::before { left: 28px; top: 112px; }
.tech-orbit-outer::after { right: 42px; bottom: 82px; background: #7f9cff; box-shadow: 0 0 15px #7f9cff; }

.tech-orbit-inner {
  width: 300px;
  height: 300px;
  margin: -150px 0 0 -150px;
  border: 1px dashed rgba(74, 210, 228, 0.55);
  transform: rotateX(67deg) rotateZ(0deg);
  animation: tech-orbit-spin-reverse 11s linear infinite;
}

.tech-ai-core {
  position: absolute;
  z-index: 7;
  left: 50%;
  top: 54%;
  width: 178px;
  height: 178px;
  margin: -89px 0 0 -89px;
  transform-style: preserve-3d;
  animation: tech-core-float 6s ease-in-out infinite;
}

.tech-core-face {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(126, 157, 255, 0.8);
  background: rgba(51, 73, 147, 0.27);
  box-shadow:
    inset 0 0 44px rgba(112, 144, 244, 0.2),
    0 0 36px rgba(85, 111, 218, 0.2);
}

.tech-core-face-back {
  transform: translate(-16px, -12px) rotate(-4deg);
  opacity: 0.58;
}

.tech-core-face-front {
  transform: translate(14px, 12px) rotate(4deg);
}

.tech-core-label {
  position: absolute;
  z-index: 2;
  inset: 46px 18px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.tech-core-label strong {
  color: #73dce9;
  font-size: 31px;
  line-height: 1;
  text-shadow: 0 0 18px rgba(115, 220, 233, 0.52);
}

.tech-category {
  position: absolute;
  z-index: 10;
  width: 164px;
  padding: 11px 13px;
  border: 1px solid rgba(126, 157, 235, 0.48);
  border-radius: 4px;
  background: rgba(19, 39, 61, 0.9);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22), inset 0 1px rgba(255, 255, 255, 0.06);
  color: #dce7ff;
  animation: tech-card-float 5.5s ease-in-out infinite;
}

.tech-category strong {
  display: block;
  margin-bottom: 4px;
  color: #fff;
  font-size: 13px;
}

.tech-category span {
  color: #68d7e5;
  font-size: 9px;
}

.tech-category-water { left: 4%; top: 29%; }
.tech-category-wood { right: 4%; top: 27%; animation-delay: -1.3s; }
.tech-category-tile { left: 5%; bottom: 11%; animation-delay: -2.7s; }
.tech-category-extra { right: 5%; bottom: 11%; animation-delay: -4s; }

.tech-beam {
  position: absolute;
  z-index: 5;
  height: 2px;
  background: #7898f3;
  box-shadow: 0 0 12px rgba(120, 152, 243, 0.95);
  transform-origin: left center;
  animation: tech-beam-pulse 4.8s ease-in-out infinite;
}

.tech-beam-water { left: 24%; top: 39%; width: 28%; transform: rotate(17deg); }
.tech-beam-wood { right: 24%; top: 37%; width: 27%; transform: rotate(-16deg); transform-origin: right center; animation-delay: -1.2s; }
.tech-beam-tile { left: 25%; bottom: 23%; width: 27%; transform: rotate(-18deg); animation-delay: -2.4s; }
.tech-beam-extra { right: 25%; bottom: 22%; width: 27%; transform: rotate(18deg); transform-origin: right center; animation-delay: -3.6s; }

.tech-particle {
  position: absolute;
  z-index: 8;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 13px #65dce9;
  animation: tech-particle-travel 5s linear infinite;
}

.tech-particle-a { left: 27%; top: 40%; }
.tech-particle-b { right: 29%; top: 39%; animation-delay: -1.7s; }
.tech-particle-c { left: 29%; bottom: 24%; animation-delay: -3.3s; }

.tech-confidence {
  position: absolute;
  z-index: 12;
  left: 50%;
  bottom: 18px;
  min-width: 198px;
  padding: 9px 13px;
  transform: translateX(-50%);
  border: 1px solid rgba(72, 206, 224, 0.5);
  border-radius: 4px;
  background: rgba(13, 35, 52, 0.92);
  color: #d9f5f9;
  font-size: 10px;
  text-align: center;
  box-shadow: 0 0 24px rgba(62, 201, 220, 0.1);
  animation: tech-confidence-pulse 4s ease-in-out infinite;
}

.tech-confidence strong {
  color: #55dfbd;
  font-size: 17px;
}

@keyframes tech-grid-shift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 0 34px, 34px 0; }
}

@keyframes tech-scan {
  0%, 100% { transform: translateY(78px); opacity: 0; }
  20%, 80% { opacity: 0.68; }
  50% { transform: translateY(-105px); opacity: 0.9; }
}

@keyframes tech-orbit-spin {
  to { transform: rotateX(67deg) rotateZ(360deg); }
}

@keyframes tech-orbit-spin-reverse {
  to { transform: rotateX(67deg) rotateZ(-360deg); }
}

@keyframes tech-core-float {
  0%, 100% { transform: translateY(7px) rotateY(-8deg); }
  50% { transform: translateY(-8px) rotateY(10deg); }
}

@keyframes tech-card-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

@keyframes tech-beam-pulse {
  0%, 100% { opacity: 0.24; filter: brightness(0.8); }
  45%, 65% { opacity: 1; filter: brightness(1.35); }
}

@keyframes tech-particle-travel {
  0% { opacity: 0; transform: translate(0, 0); }
  20% { opacity: 1; }
  75% { opacity: 1; transform: translate(145px, 52px); }
  100% { opacity: 0; transform: translate(172px, 61px); }
}

@keyframes tech-confidence-pulse {
  0%, 100% { border-color: rgba(72, 206, 224, 0.35); }
  50% { border-color: rgba(85, 223, 189, 0.9); box-shadow: 0 0 26px rgba(85, 223, 189, 0.2); }
}

@media (prefers-reduced-motion: reduce) {
  .ai-login-hero *,
  .ai-login-hero *::before,
  .ai-login-hero *::after {
    animation: none !important;
  }
}

/* AI order result master-detail workspace (selected layout B). */
.modal.ai-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1180px, calc(100vw - 28px));
  max-height: min(92vh, 920px);
  overflow: hidden;
}

.ai-modal .modal-head,
.ai-modal .modal-foot {
  background: #fff;
}

.ai-modal .modal-body {
  min-height: 0;
  overflow-y: auto;
}

.ai-modal.has-results .modal-body {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.ai-source-editor {
  flex: none;
  border-bottom: 1px solid var(--line);
  background: #fbfcff;
}

.ai-source-editor > summary {
  padding: 10px 18px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.ai-source-editor-body {
  max-height: 52vh;
  padding: 4px 18px 16px;
  overflow-y: auto;
}

.ai-source-editor-body .ai-actions {
  margin-bottom: 0;
}

.ai-master-detail {
  display: grid;
  grid-template-columns: minmax(330px, 38%) minmax(0, 62%);
  flex: 1;
  min-height: 0;
  gap: 0;
}

.ai-result-master {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #f8faff;
}

.ai-master-head {
  flex: none;
  padding: 15px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.ai-master-head > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ai-master-head > div:first-child span {
  color: var(--muted);
  font-size: 12px;
}

.ai-status-summary {
  display: flex;
  gap: 7px;
  margin-top: 11px;
  overflow-x: auto;
}

.ai-status-chip,
.ai-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  white-space: nowrap;
  font-style: normal;
  font-weight: 800;
}

.ai-status-chip {
  padding: 5px 9px;
  background: #edf2ff;
  color: #315dde;
  font-size: 11px;
}

.ai-status-chip.is-confirmed,
.ai-status-badge.is-confirmed {
  background: #e8f7f1;
  color: #16805f;
}

.ai-status-chip.is-pending,
.ai-status-badge.is-pending {
  background: #fff4df;
  color: #b66a0b;
}

.ai-status-chip.is-unmatched,
.ai-status-badge.is-unmatched {
  background: #fff0f1;
  color: #c2414b;
}

.ai-master-list {
  min-height: 0;
  padding: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ai-nav-item {
  position: relative;
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr) auto;
  gap: 9px;
  width: 100%;
  margin-bottom: 8px;
  padding: 11px 10px;
  border: 1px solid #dfe6f2;
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.ai-nav-item::before {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 0;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: transparent;
  content: "";
}

.ai-nav-item:hover {
  border-color: #b9c9ed;
}

.ai-nav-item.active {
  border-color: #789cff;
  background: #f2f6ff;
  box-shadow: 0 7px 18px rgba(47, 91, 210, 0.1);
}

.ai-nav-item.active::before {
  background: var(--primary);
}

.ai-nav-index {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: #edf2fb;
  color: #486184;
  font-size: 12px;
  font-weight: 900;
}

.ai-nav-content,
.ai-nav-title,
.ai-nav-original,
.ai-nav-match,
.ai-nav-meta {
  display: block;
  min-width: 0;
}

.ai-nav-title {
  display: flex;
  align-items: center;
  gap: 7px;
}

.ai-nav-title strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-status-badge {
  padding: 3px 7px;
  font-size: 10px;
}

.ai-nav-original,
.ai-nav-meta {
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-nav-match {
  margin-top: 7px;
  overflow: hidden;
  color: #16745e;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-nav-match.is-empty {
  color: #c2414b;
}

.ai-nav-quantity {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.ai-nav-quantity b {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: 13px;
  text-align: right;
}

.ai-result-detail {
  position: relative;
  min-width: 0;
  min-height: 0;
  background: #fff;
}

.ai-detail-panel {
  display: none;
  height: 100%;
  min-height: 0;
  flex-direction: column;
}

.ai-detail-panel.active {
  display: flex;
}

.ai-detail-panel.is-removing {
  opacity: 0;
}

.ai-detail-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px auto;
  gap: 12px;
  align-items: center;
  flex: none;
  padding: 14px 17px;
  border-bottom: 1px solid var(--line);
}

.ai-detail-head > div > span,
.ai-detail-head > div > small,
.ai-detail-head label > span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.ai-detail-head h4 {
  margin: 3px 0;
  font-size: 19px;
}

.ai-detail-head label {
  display: grid;
  gap: 4px;
}

.ai-detail-quantity {
  width: 100%;
  height: 40px;
}

.ai-conversion-note,
.ai-recognized-fields,
.ai-parse-warning {
  flex: none;
  margin: 10px 17px 0;
  padding: 8px 10px;
  border: 1px solid #cfe0ff;
  border-radius: 8px;
  background: #f3f7ff;
  color: #315ea8;
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.ai-conversion-note.has-error,
.ai-parse-warning {
  border-color: #f3d19e;
  background: #fff8eb;
  color: #9a5b00;
}

.ai-recognized-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  border-color: var(--line);
  background: #fff;
  color: var(--muted);
}

.ai-detail-scroll {
  min-height: 0;
  padding: 15px 17px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ai-detail-section + .ai-detail-section {
  margin-top: 16px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

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

.ai-detail-section-head strong,
.ai-detail-section-head span {
  display: block;
}

.ai-detail-section-head > div > span,
.ai-detail-section-head > span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.ai-current-product-card {
  display: grid;
  grid-template-columns: 26px 46px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 70px;
  padding: 10px 12px;
  border: 1px solid #7c9dff;
  border-radius: 8px;
  background: #f0f5ff;
}

.ai-current-product-card:not(:has(img)) {
  grid-template-columns: 26px minmax(0, 1fr) auto;
}

.ai-current-check {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.ai-current-product-card span small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.ai-current-product-card span .ai-recommendation {
  color: #16745e;
}

.ai-current-product-card > b {
  white-space: nowrap;
}

.ai-master-detail .ai-more-candidates {
  display: grid;
  gap: 8px;
}

.ai-master-detail .ai-more-candidates > summary {
  order: -1;
  border: 1px solid #dfe6f2;
  border-radius: 7px;
  background: #fafcff;
  text-align: center;
}

.ai-search-other-section .ai-search-scope {
  margin-bottom: 8px;
}

.ai-master-detail .ai-alias-consent {
  margin: 14px 0 0;
}

@media (max-width: 900px) {
  .ai-master-detail {
    grid-template-columns: minmax(290px, 42%) minmax(0, 58%);
  }

  .ai-current-product-card {
    grid-template-columns: 26px minmax(0, 1fr) auto;
  }

  .ai-current-product-card .ai-candidate-thumb {
    display: none;
  }
}

@media (max-width: 720px) {
  .modal.ai-modal {
    width: 100%;
    height: calc(100vh - 16px);
    max-height: none;
    border-radius: 12px 12px 0 0;
  }

  .ai-modal .modal-head {
    padding: 12px 14px;
  }

  .ai-modal .modal-head .hint {
    display: none;
  }

  .ai-master-detail {
    position: relative;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
  }

  .ai-result-master {
    max-height: none;
    border-right: 0;
    border-bottom: 0;
  }

  .ai-master-head {
    padding: 9px 12px 7px;
  }

  .ai-master-head > div:first-child span {
    display: none;
  }

  .ai-status-summary {
    margin-top: 7px;
  }

  .ai-master-list {
    display: block;
    padding: 8px 10px;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .ai-nav-item {
    margin-bottom: 8px;
  }

  .ai-result-detail {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: block;
    visibility: hidden;
    overflow: hidden;
    background: #fff;
    box-shadow: -12px 0 28px rgba(15, 23, 42, 0.16);
    pointer-events: none;
    transform: translateX(100%);
    transition: transform 180ms ease, visibility 0s linear 180ms;
  }

  .ai-master-detail.mobile-editor-open .ai-result-detail {
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
    transition: transform 180ms ease;
  }

  .ai-detail-head {
    grid-template-columns: minmax(0, 1fr) 78px auto auto;
    padding: 10px 12px;
  }

  .ai-detail-head h4 {
    font-size: 16px;
  }

  .ai-detail-scroll {
    padding: 12px;
  }

  .ai-conversion-note,
  .ai-recognized-fields,
  .ai-parse-warning {
    margin: 8px 12px 0;
    padding: 7px 9px;
    font-size: 11px;
  }

  .ai-detail-head .ai-mobile-editor-close {
    display: grid;
    width: 40px;
    min-width: 40px;
    height: 40px;
    color: var(--text);
    font-size: 24px;
    line-height: 1;
  }

  .ai-detail-section-head {
    display: grid;
  }

  .ai-master-detail .ai-candidate-option,
  .ai-master-detail .ai-candidate-option:has(.ai-candidate-thumb) {
    grid-template-columns: 18px minmax(0, 1fr);
  }

  .ai-master-detail .ai-candidate-thumb {
    display: none;
  }

  .ai-master-detail .ai-candidate-option > b,
  .ai-master-detail .ai-candidate-option:has(.ai-candidate-thumb) > b {
    grid-column: 2;
  }

  .ai-search-scope {
    grid-template-columns: 1fr;
  }
}

.ai-mobile-editor-close {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .ai-result-detail {
    transition: none !important;
  }
}

@media (min-width: 981px) and (max-width: 1180px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-panel {
    min-height: 100vh;
  }

  .login-visual {
    display: none;
  }
}

.hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  width: 236px;
  flex-direction: column;
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 12px 0 28px rgba(35, 61, 147, 0.16);
  z-index: 10;
}

.side-brand {
  height: 66px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.side-brand .brand-mark {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  background: rgba(255, 255, 255, 0.14);
  box-shadow: none;
}

.nav {
  display: grid;
  flex: 1 1 auto;
  gap: 6px;
  align-content: start;
  overflow-y: auto;
  padding: 16px 12px;
}

.nav button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.86);
  padding: 10px 12px;
  text-align: left;
}

.nav button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.nav button.active {
  background: white;
  color: var(--primary);
  font-weight: 700;
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 12px;
  font-weight: 800;
}

.nav button.active .nav-icon {
  background: var(--soft);
}

.side-user {
  flex: 0 0 auto;
  margin: 8px 12px 14px;
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.12);
}

.side-user-avatar {
  display: none;
}

.side-user-details {
  min-width: 0;
}

.side-assistant-entry {
  display: flex;
  min-height: 58px;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  margin: 4px 12px 0;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  text-align: left;
  cursor: pointer;
}

.side-assistant-entry:hover,
.side-assistant-entry.active {
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.2);
}

.side-assistant-entry img {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  object-fit: cover;
}

.side-assistant-entry span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.side-assistant-entry strong {
  font-size: 14px;
}

.side-assistant-entry small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
}

.main {
  margin-left: 236px;
  min-height: 100vh;
}

.topbar {
  height: 66px;
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.content {
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px 28px 40px;
}

.page-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
}

.page-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.filter-toolbar {
  align-items: stretch;
}

.toolbar .input {
  max-width: 560px;
}

.compact-select {
  max-width: 160px;
}

.spacer {
  flex: 1;
}

.btn {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 8px 12px;
  font-weight: 650;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.btn:hover {
  background: #f8fafc;
  transform: translateY(-1px);
}

.btn.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

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

.btn.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn.danger {
  border-color: var(--danger);
  background: var(--danger);
  color: white;
}

.icon-btn {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #d8e1ef;
  border-radius: 8px;
  background: #f8fbff;
  color: var(--muted);
  margin-left: 4px;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.icon-btn:hover {
  border-color: #c7d2fe;
  background: #eef4ff;
  color: var(--primary);
  transform: translateY(-1px);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn.danger-soft {
  background: #fff7f7;
  border-color: #fee2e2;
  color: #ef4444;
}

.icon-btn.danger-soft:hover {
  background: var(--danger-bg);
  border-color: #fecaca;
  color: var(--danger);
}

.grid {
  display: grid;
  gap: 16px;
}

.kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.card-pad {
  padding: 18px;
}

.kpi {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.kpi-value {
  margin-top: 10px;
  font-size: 28px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.kpi-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--soft);
  color: var(--primary);
}

.two-col {
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}

th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

tbody tr:hover {
  background: #f8fbff;
}

.num {
  font-variant-numeric: tabular-nums;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 750;
}

.badge.success {
  background: var(--success-bg);
  color: var(--success);
}

.badge.warning {
  background: var(--warning-bg);
  color: var(--warning);
}

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

.badge.info {
  background: var(--soft);
  color: var(--primary);
}

.badge.status-pending,
.badge.payment-pending {
  border: 1px solid #d9e2ef;
  background: #fff;
  color: #25344d;
}

.badge.status-confirmed {
  background: #3658db;
  color: #fff;
}

.badge.status-shipped {
  background: #e8f4ff;
  color: #2876b9;
}

.badge.status-completed,
.badge.payment-paid {
  background: #1fa64a;
  color: #fff;
}

.badge.status-canceled {
  background: #e53935;
  color: #fff;
}

.status-select {
  border-width: 1px;
  font-weight: 750;
}

.status-select.status-pending,
.status-select.payment-pending {
  border-color: #d9e2ef;
  background-color: #fff;
  color: #25344d;
}

.status-select.status-confirmed {
  border-color: #3658db;
  background-color: #3658db;
  color: #fff;
}

.status-select.status-shipped {
  border-color: #bdddf7;
  background-color: #e8f4ff;
  color: #2876b9;
}

.status-select.status-completed,
.status-select.payment-paid {
  border-color: #1fa64a;
  background-color: #1fa64a;
  color: #fff;
}

.status-select.status-canceled {
  border-color: #e53935;
  background-color: #e53935;
  color: #fff;
}

.status-select option {
  background: #fff;
  color: #25344d;
}

.customer-list,
.order-list {
  display: grid;
  gap: 12px;
}

.customer-card,
.order-card {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(260px, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.customer-card:hover,
.order-card:hover,
.product-card:hover {
  border-color: #c7d2fe;
  box-shadow: 0 14px 28px rgba(54, 88, 219, 0.1);
}

.customer-name,
.order-no {
  font-size: 16px;
  font-weight: 800;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 12px;
}

.product-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 18px;
  align-items: start;
}

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

.product-card {
  min-height: 154px;
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: 14px;
  align-items: start;
  position: relative;
  padding: 14px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.material-thumb {
  width: 96px;
  height: 96px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0) 45%),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.08) 0 2px, transparent 2px 10px),
    var(--thumb, #dbeafe);
}

.product-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 800;
}

.product-spec {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.price {
  color: var(--primary);
  font-weight: 850;
  font-size: 18px;
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.primary-category-tabs {
  margin-bottom: 10px;
}

.category-tabs button,
.subcategory-tabs button {
  border: 1px solid var(--line);
  background: white;
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--muted);
}

.category-tabs button.active,
.subcategory-tabs button.active {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
  font-weight: 750;
}

.subcategory-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 116px;
  overflow: auto;
  padding: 2px;
}

.subcategory-tabs button {
  padding: 6px 11px;
  font-size: 12px;
}

.subcategory-panel {
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.subcategory-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.subcategory-panel-head strong {
  color: var(--text);
}

.product-count-hint {
  margin: 8px 0 12px;
}

.product-add-btn {
  align-self: start;
}

.cart {
  position: sticky;
  top: 86px;
}

.cart h3,
.card h3 {
  margin-top: 0;
}

.cart-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.qty {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.qty button {
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
}

.summary-total {
  font-size: 22px;
  font-weight: 900;
  color: var(--primary);
}

.dashboard-metrics {
  display: grid;
  gap: 10px;
}

.dashboard-filter-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 2px;
}

.dashboard-filter-row > span {
  color: var(--muted);
  font-size: 13px;
}

.dashboard-sales-filter {
  width: 220px;
}

.dashboard-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  font-size: 14px;
}

.dashboard-section-head span {
  color: var(--muted);
  font-size: 12px;
}

.dashboard-section-head.today-head {
  margin-top: 4px;
}

.dashboard-metric-grid {
  display: grid;
  gap: 12px;
}

.dashboard-metric-grid.month-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dashboard-metric-grid.today-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-metric {
  --metric-color: #315dde;
  --metric-bg: #edf2ff;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 118px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-soft);
  color: inherit;
  font: inherit;
  text-align: left;
}

.dashboard-metric.clickable {
  width: 100%;
  cursor: pointer;
}

.dashboard-metric.clickable:hover,
.dashboard-metric.clickable:focus-visible {
  border-color: var(--metric-color);
  box-shadow: 0 10px 26px rgba(38, 73, 145, 0.13);
  outline: none;
}

.dashboard-metric.violet { --metric-color: #7652c7; --metric-bg: #f2edff; }
.dashboard-metric.orange { --metric-color: #c56a16; --metric-bg: #fff4e8; }
.dashboard-metric.cyan { --metric-color: #16809c; --metric-bg: #e9f8fc; }
.dashboard-metric.green { --metric-color: #16856b; --metric-bg: #eaf8f3; }
.dashboard-metric.gold { --metric-color: #a77b0a; --metric-bg: #fff8df; }
.dashboard-metric.red { --metric-color: #cc4e58; --metric-bg: #fff0f1; }

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

.dashboard-metric-value {
  margin-top: 12px;
  color: var(--text);
  font-size: 27px;
  line-height: 1;
  font-weight: 900;
}

.dashboard-metric-note {
  margin-top: 9px;
  color: var(--muted);
  font-size: 11px;
}

.dashboard-metric-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--metric-bg);
  color: var(--metric-color);
  font-size: 15px;
  font-weight: 900;
}

.dashboard-customer-detail {
  padding: 14px;
  border: 1px solid #dfe7f4;
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

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

.dashboard-customer-detail-head button {
  padding: 5px 10px;
  border: 0;
  border-radius: 6px;
  background: #eef3ff;
  color: var(--primary);
  cursor: pointer;
}

.dashboard-customer-table {
  overflow-x: auto;
}

.dashboard-customer-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.4fr) minmax(120px, 1fr) minmax(100px, 1fr) 90px 110px 100px;
  gap: 12px;
  min-width: 760px;
  align-items: center;
  padding: 10px 8px;
  border-top: 1px solid #edf1f7;
  font-size: 13px;
}

.dashboard-customer-row-head {
  border-top: 0;
  background: #f7f9fc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 1100px) {
  .dashboard-metric-grid.month-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .dashboard-filter-row {
    display: grid;
    justify-content: stretch;
  }

  .dashboard-sales-filter {
    width: 100%;
  }

  .dashboard-metric-grid.month-metrics,
  .dashboard-metric-grid.today-metrics {
    grid-template-columns: 1fr;
  }

  .dashboard-metric {
    min-height: 104px;
  }
}

/* Full-screen login scene: city, warehouse, jobsites and delivery network. */
.login-city-shell {
  position: relative;
  display: block;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background: #061321;
}

.login-city-scene {
  position: absolute;
  inset: -2%;
  background:
    linear-gradient(90deg, rgba(3, 13, 26, 0.02) 0 55%, rgba(3, 13, 26, 0.34) 72%, rgba(3, 13, 26, 0.66) 100%),
    url("./assets/login-city-network.png") center center / cover no-repeat;
  transform: scale(1.035);
  transform-origin: 48% 52%;
  animation: login-city-camera 16s ease-in-out infinite alternate;
  will-change: transform;
}

.login-city-shade {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 37% 48%, transparent 0 23%, rgba(2, 12, 25, 0.08) 48%, rgba(2, 10, 22, 0.28) 100%),
    linear-gradient(180deg, rgba(0, 8, 20, 0.08), transparent 32%, rgba(0, 8, 20, 0.18));
}

.login-city-route {
  position: absolute;
  height: 2px;
  border-radius: 999px;
  opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(73, 183, 255, 0.2), #b6edff, rgba(44, 157, 255, 0.5), transparent);
  box-shadow: 0 0 11px rgba(76, 178, 255, 0.88);
  animation: login-route-flow 6.8s ease-in-out infinite;
}

.login-city-route-a {
  left: 11%;
  top: 53%;
  width: 39%;
  transform: rotate(-8deg);
}

.login-city-route-b {
  left: 29%;
  top: 69%;
  width: 31%;
  transform: rotate(13deg);
  animation-delay: -3.4s;
}

.login-city-node {
  position: absolute;
  width: 9px;
  height: 9px;
  border: 2px solid rgba(178, 231, 255, 0.9);
  border-radius: 50%;
  background: #2e9cff;
  box-shadow: 0 0 10px #4fb6ff, 0 0 26px rgba(47, 153, 255, 0.78);
  animation: login-node-pulse 3.4s ease-out infinite;
}

.login-city-node::after {
  content: "";
  position: absolute;
  inset: -8px;
  border: 1px solid rgba(89, 187, 255, 0.72);
  border-radius: inherit;
  animation: login-node-ring 3.4s ease-out infinite;
}

.login-city-node-a { left: 31%; top: 39%; }
.login-city-node-b { left: 47%; top: 32%; animation-delay: -0.8s; }
.login-city-node-c { left: 52%; top: 61%; animation-delay: -1.7s; }
.login-city-node-d { left: 18%; top: 57%; animation-delay: -2.5s; }

.login-city-brand {
  position: absolute;
  z-index: 3;
  left: clamp(28px, 4vw, 72px);
  top: clamp(24px, 4vw, 62px);
  display: flex;
  align-items: center;
  gap: 13px;
  color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.5);
}

.login-city-brand .brand-mark {
  width: 46px;
  height: 46px;
  border: 1px solid rgba(175, 217, 255, 0.62);
  border-radius: 8px;
  background: rgba(42, 97, 218, 0.86);
  box-shadow: 0 12px 30px rgba(10, 48, 126, 0.34);
  backdrop-filter: blur(8px);
}

.login-city-brand strong,
.login-city-brand span {
  display: block;
}

.login-city-brand strong {
  font-size: clamp(18px, 1.45vw, 26px);
  line-height: 1.35;
  font-weight: 800;
}

.login-city-brand span {
  margin-top: 3px;
  color: rgba(224, 239, 255, 0.76);
  font-size: 12px;
}

.login-city-shell .login-panel {
  position: relative;
  z-index: 4;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: clamp(28px, 5vw, 84px) clamp(30px, 7vw, 132px);
  background: transparent;
  box-shadow: none;
}

.login-city-shell .login-card {
  width: min(390px, 100%);
  max-width: none;
  padding: 36px 34px 30px;
  border: 1px solid rgba(218, 231, 246, 0.88);
  border-radius: 8px;
  background: rgba(242, 247, 252, 0.94);
  box-shadow: 0 28px 80px rgba(0, 10, 26, 0.36);
  backdrop-filter: blur(18px) saturate(112%);
}

.login-card-heading {
  margin-bottom: 30px;
}

.login-card-heading > span {
  display: block;
  margin-bottom: 10px;
  color: #2864df;
  font-size: 11px;
  font-weight: 800;
}

.login-card-heading h1 {
  margin: 0;
  color: #132033;
  font-size: 29px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: 0;
}

.login-card-heading p {
  margin: 9px 0 0;
  color: #627189;
  font-size: 13px;
  line-height: 1.65;
}

.login-city-shell .login-card .field {
  margin-bottom: 20px;
}

.login-city-shell .login-card .field label {
  margin-bottom: 8px;
  color: #25344b;
  font-weight: 750;
}

.login-city-shell .login-card .input {
  min-height: 50px;
  border-color: #d6e0ee;
  background: rgba(255, 255, 255, 0.91);
}

.login-city-shell .login-card .input:focus {
  border-color: #3b6fe7;
  box-shadow: 0 0 0 3px rgba(59, 111, 231, 0.12);
}

.login-city-shell .login-card .btn.primary {
  min-height: 50px;
  margin-top: 4px;
  border-radius: 7px;
  box-shadow: 0 12px 25px rgba(44, 92, 209, 0.22);
}

.login-security-note {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 20px;
  color: #7b899d;
  font-size: 11px;
}

.login-security-note i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #23b978;
  box-shadow: 0 0 0 4px rgba(35, 185, 120, 0.12);
}

@keyframes login-city-camera {
  0% { transform: scale(1.035) translate3d(0, 0, 0); }
  100% { transform: scale(1.075) translate3d(-0.65%, -0.35%, 0); }
}

@keyframes login-route-flow {
  0%, 15% { opacity: 0; clip-path: inset(0 100% 0 0); }
  36%, 68% { opacity: 0.95; }
  72% { clip-path: inset(0 0 0 0); }
  100% { opacity: 0; clip-path: inset(0 0 0 100%); }
}

@keyframes login-node-pulse {
  0%, 100% { transform: scale(0.82); filter: brightness(0.82); }
  45% { transform: scale(1.12); filter: brightness(1.35); }
}

@keyframes login-node-ring {
  0% { opacity: 0.85; transform: scale(0.45); }
  75%, 100% { opacity: 0; transform: scale(2.2); }
}

@media (max-width: 980px) {
  .login-city-shell .login-panel {
    justify-content: center;
    padding: 104px 24px 32px;
  }

  .login-city-scene {
    display: block;
    inset: -4%;
    background-position: 42% center;
  }

  .login-city-brand {
    left: 24px;
    top: 24px;
  }

  .login-city-brand strong {
    font-size: 19px;
  }

  .login-city-brand span {
    display: none;
  }
}

@media (max-width: 560px) {
  .login-city-shell .login-panel {
    align-items: flex-end;
    padding: 94px 16px 18px;
  }

  .login-city-shell .login-card {
    width: 100%;
    padding: 28px 22px 24px;
    background: rgba(245, 249, 253, 0.96);
  }

  .login-card-heading {
    margin-bottom: 24px;
  }

  .login-card-heading h1 {
    font-size: 25px;
  }

  .login-city-brand {
    left: 18px;
    top: 18px;
  }

  .login-city-brand .brand-mark {
    width: 40px;
    height: 40px;
  }

  .login-city-node-d {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-city-scene,
  .login-city-route,
  .login-city-node,
  .login-city-node::after {
    animation: none !important;
  }
}

/* Xiaocai AI business assistant */
.xiaocai-assistant {
  position: fixed;
  bottom: 24px;
  z-index: 24;
  pointer-events: none;
}

.xiaocai-assistant.is-right { right: 24px; }
.xiaocai-assistant.is-left { left: 24px; }

.xiaocai-assistant.is-docked {
  right: 24px;
  bottom: 24px;
  left: auto;
}

.xiaocai-launcher {
  position: relative;
  display: grid;
  width: 72px;
  height: 72px;
  padding: 3px;
  border: 1px solid rgba(82, 139, 255, .55);
  border-radius: 50%;
  background: #0d2f73;
  box-shadow: 0 12px 30px rgba(14, 43, 103, .28), 0 0 0 5px rgba(52, 102, 220, .1);
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
  isolation: isolate;
  animation: xiaocai-float 3.4s ease-in-out infinite;
}

.xiaocai-launcher:active { cursor: grabbing; }

.xiaocai-launcher img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
}

.xiaocai-launcher strong {
  position: absolute;
  right: -4px;
  bottom: -7px;
  min-width: 42px;
  padding: 4px 8px;
  border: 2px solid #fff;
  border-radius: 12px;
  background: #2456c7;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.xiaocai-pulse {
  position: absolute;
  inset: -6px;
  z-index: -1;
  border: 1px solid rgba(45, 193, 222, .55);
  border-radius: 50%;
  animation: xiaocai-pulse 2.4s ease-out infinite;
}

.xiaocai-panel {
  position: absolute;
  bottom: 88px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(480px, calc(100vw - 32px));
  height: min(700px, 78vh);
  overflow: hidden;
  border: 1px solid #d7e1f1;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 62px rgba(20, 37, 71, .24);
  pointer-events: auto;
  animation: xiaocai-panel-in .2s ease-out both;
}

.xiaocai-assistant.is-right .xiaocai-panel { right: 0; }
.xiaocai-assistant.is-left .xiaocai-panel { left: 0; }

.xiaocai-assistant.is-docked .xiaocai-panel {
  position: relative;
  right: auto;
  bottom: auto;
  left: auto;
}

.xiaocai-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  background: #f7f9fd;
}

.xiaocai-identity {
  display: flex;
  align-items: center;
  gap: 10px;
}

.xiaocai-identity img {
  width: 46px;
  height: 46px;
  border: 2px solid #fff;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 5px 14px rgba(24, 69, 161, .2);
}

.xiaocai-identity div { display: grid; gap: 3px; }
.xiaocai-identity strong { color: #13213a; font-size: 17px; }

.xiaocai-identity span {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #60708a;
  font-size: 12px;
}

.xiaocai-identity i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #16a36a;
  box-shadow: 0 0 0 3px rgba(22, 163, 106, .12);
}

.xiaocai-head-actions { display: flex; gap: 6px; }
.xiaocai-head-actions .icon-btn { width: 36px; height: 36px; }

.xiaocai-new-chat {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid #cfdaeb;
  border-radius: 6px;
  background: #fff;
  color: #34537f;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.xiaocai-new-chat:hover {
  border-color: #7ca0ea;
  background: #eef4ff;
}

.xiaocai-messages {
  min-height: 0;
  padding: 16px 14px 20px;
  overflow: auto;
  overscroll-behavior: contain;
  background: #f7f9fc;
}

.xiaocai-welcome {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid #dce5f2;
  border-radius: 8px;
  background: #fff;
}

.xiaocai-welcome img {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border-radius: 50%;
  object-fit: cover;
}

.xiaocai-welcome div { display: grid; gap: 4px; }
.xiaocai-welcome strong { color: #13213a; font-size: 16px; }
.xiaocai-welcome p { margin: 0; color: #65748c; font-size: 13px; line-height: 1.55; }

.xiaocai-scope {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 10px 0 14px;
  padding: 9px 10px;
  border-left: 3px solid #2f61d5;
  background: #edf3ff;
  color: #4b607e;
  font-size: 12px;
  line-height: 1.5;
}

.xiaocai-scope svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  fill: none;
  stroke: #2f61d5;
  stroke-width: 1.8;
}

.xiaocai-quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.xiaocai-quick-grid button,
.xiaocai-message-actions button {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #d6e0ef;
  border-radius: 6px;
  background: #fff;
  color: #294875;
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.xiaocai-quick-grid button:hover,
.xiaocai-message-actions button:hover {
  border-color: #7ca0ea;
  background: #f1f5ff;
}

.xiaocai-message {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 16px;
}

.xiaocai-message.is-user { justify-content: flex-end; }

.xiaocai-message-avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 50%;
  object-fit: cover;
}

.xiaocai-message-content {
  display: grid;
  max-width: calc(100% - 38px);
  gap: 8px;
}

.xiaocai-bubble {
  width: fit-content;
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid #dce4f0;
  border-radius: 6px;
  background: #fff;
  color: #24324a;
  font-size: 14px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.xiaocai-message.is-user .xiaocai-bubble {
  border-color: #2f61d5;
  background: #2f61d5;
  color: #fff;
}

.xiaocai-markdown {
  width: 100%;
}

.xiaocai-markdown p,
.xiaocai-markdown h3,
.xiaocai-markdown h4,
.xiaocai-markdown ul,
.xiaocai-markdown ol,
.xiaocai-markdown pre {
  margin: 0 0 8px;
}

.xiaocai-markdown > :last-child { margin-bottom: 0; }
.xiaocai-markdown h3 { color: #182b49; font-size: 16px; line-height: 1.4; }
.xiaocai-markdown h4 { color: #213858; font-size: 14px; line-height: 1.4; }
.xiaocai-markdown ul,
.xiaocai-markdown ol { padding-left: 20px; }
.xiaocai-markdown li + li { margin-top: 4px; }
.xiaocai-markdown a { color: #245dca; text-decoration: underline; text-underline-offset: 2px; }
.xiaocai-markdown code {
  padding: 2px 5px;
  border-radius: 4px;
  background: #edf1f7;
  color: #9b2c4b;
  font-family: Consolas, "Courier New", monospace;
  font-size: .9em;
}

.xiaocai-markdown pre {
  max-width: 100%;
  padding: 10px;
  overflow-x: auto;
  border-radius: 6px;
  background: #172033;
}

.xiaocai-markdown pre code {
  padding: 0;
  background: transparent;
  color: #edf3ff;
}

.xiaocai-markdown-gap { height: 4px; }

.xiaocai-sources {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid #dce5f2;
  border-radius: 6px;
  background: #fff;
}

.xiaocai-sources > b {
  color: #455a79;
  font-size: 11px;
}

.xiaocai-sources a {
  display: grid;
  gap: 2px;
  padding: 7px 8px;
  border-radius: 5px;
  background: #f5f8fd;
  color: #294f93;
  text-decoration: none;
}

.xiaocai-sources a:hover { background: #edf3ff; }
.xiaocai-sources strong { font-size: 12px; line-height: 1.4; }
.xiaocai-sources span { color: #78869b; font-size: 10px; }

.xiaocai-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.xiaocai-metrics > div {
  display: grid;
  min-height: 66px;
  padding: 9px 10px;
  border: 1px solid #dce5f2;
  border-radius: 6px;
  background: #fff;
}

.xiaocai-metrics span { color: #6a7890; font-size: 11px; }
.xiaocai-metrics strong { align-self: end; color: #15377d; font-size: 17px; overflow-wrap: anywhere; }

.xiaocai-table-wrap {
  max-width: 100%;
  padding: 10px;
  overflow-x: auto;
  border: 1px solid #dce5f2;
  border-radius: 6px;
  background: #fff;
}

.xiaocai-block-title {
  display: block;
  margin-bottom: 8px;
  color: #253752;
  font-size: 13px;
}

.xiaocai-table {
  width: 100%;
  min-width: 300px;
  border-collapse: collapse;
  font-size: 11px;
}

.xiaocai-table th,
.xiaocai-table td {
  padding: 7px 6px;
  border-bottom: 1px solid #e6ebf2;
  color: #4d5d75;
  text-align: left;
  vertical-align: top;
}

.xiaocai-table th { color: #273954; font-weight: 700; }
.xiaocai-table tr:last-child td { border-bottom: 0; }

.xiaocai-message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.xiaocai-message-actions button {
  min-height: 30px;
  padding: 5px 8px;
}

.xiaocai-thinking {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid #dce4f0;
  border-radius: 6px;
  background: #fff;
}

.xiaocai-thinking span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2f61d5;
  animation: xiaocai-dot 1.1s ease-in-out infinite;
}

.xiaocai-thinking span:nth-child(2) { animation-delay: .14s; }
.xiaocai-thinking span:nth-child(3) { animation-delay: .28s; }
.xiaocai-thinking em { margin-left: 4px; color: #66758d; font-size: 12px; font-style: normal; }

.xiaocai-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid #f1c6c9;
  border-radius: 6px;
  background: #fff5f5;
  color: #a63f47;
  font-size: 12px;
}

.xiaocai-error button {
  border: 0;
  background: transparent;
  color: #2456c7;
  font-weight: 700;
  cursor: pointer;
}

.xiaocai-compose {
  padding: 10px 12px 11px;
  border-top: 1px solid #e1e7f0;
  background: #fff;
}

.xiaocai-compose textarea {
  display: block;
  width: 100%;
  height: 64px;
  padding: 9px 10px;
  resize: none;
  border: 1px solid #cfd9e8;
  border-radius: 6px;
  outline: none;
  color: #1f2d44;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
}

.xiaocai-compose textarea:focus {
  border-color: #4d78da;
  box-shadow: 0 0 0 3px rgba(47, 97, 213, .1);
}

.xiaocai-compose > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  margin-top: 6px;
}

.xiaocai-compose > div > span { color: #8894a8; font-size: 10px; }

.xiaocai-send,
.xiaocai-stop {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: #2f61d5;
  color: #fff;
  cursor: pointer;
}

.xiaocai-send svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.xiaocai-stop { background: #5e6b80; font-size: 12px; }

@keyframes xiaocai-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -5px; }
}

@keyframes xiaocai-pulse {
  0% { opacity: .8; scale: .92; }
  75%, 100% { opacity: 0; scale: 1.18; }
}

@keyframes xiaocai-panel-in {
  from { opacity: 0; translate: 0 10px; }
  to { opacity: 1; translate: 0 0; }
}

@keyframes xiaocai-dot {
  0%, 60%, 100% { opacity: .3; translate: 0 0; }
  30% { opacity: 1; translate: 0 -3px; }
}

@media (max-width: 720px) {
  .xiaocai-assistant,
  .xiaocai-assistant.is-left,
  .xiaocai-assistant.is-right {
    right: 14px;
    bottom: max(14px, env(safe-area-inset-bottom));
    left: auto;
  }

  .xiaocai-launcher {
    width: 62px;
    height: 62px;
  }

  .xiaocai-launcher img {
    width: 54px;
    height: 54px;
  }

  .xiaocai-assistant.is-open {
    inset: 0;
    z-index: 24;
  }

  .xiaocai-assistant.is-open .xiaocai-launcher { display: none; }

  .xiaocai-panel,
  .xiaocai-assistant.is-left .xiaocai-panel,
  .xiaocai-assistant.is-right .xiaocai-panel {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: min(80dvh, 680px);
    border-width: 1px 0 0;
    border-radius: 8px 8px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .xiaocai-quick-grid { grid-template-columns: 1fr; }
  .xiaocai-messages { padding-right: 12px; padding-left: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .xiaocai-launcher,
  .xiaocai-pulse,
  .xiaocai-panel,
  .xiaocai-thinking span {
    animation: none;
  }
}

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

.address-history-field {
  position: relative;
}

.address-history-combobox {
  position: relative;
}

.address-history-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 45;
  display: none;
  max-height: 220px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid #d8e1ee;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.14);
}

.address-history-menu.open {
  display: grid;
  gap: 3px;
}

.address-history-menu button {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #172033;
  font: inherit;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
}

.address-history-menu button:hover,
.address-history-menu button:focus-visible {
  background: #f1f5ff;
  color: #3158d8;
  outline: none;
}

.address-history-menu svg {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.address-history-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.48);
}

.modal {
  width: min(720px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: white;
  border-radius: 8px;
  box-shadow: 0 26px 80px rgba(15, 23, 42, 0.28);
}

.modal.side {
  width: min(500px, 100%);
  height: 100vh;
  max-height: none;
  margin-left: auto;
  border-radius: 0;
}

.modal.ai-modal {
  width: min(860px, 100%);
}

.modal.large {
  width: min(980px, 100%);
}

.modal.edit-order-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1040px, 100%);
  max-height: min(90vh, 900px);
  overflow: hidden;
}

.edit-order-modal .modal-head,
.edit-order-modal .modal-foot {
  background: #fff;
}

.edit-order-modal .modal-head h3 {
  margin: 0;
  font-size: 20px;
}

.edit-order-modal .modal-body {
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px;
  font-size: 15px;
}

.edit-order-modal .form-grid {
  gap: 11px 14px;
}

.edit-order-modal .field {
  gap: 5px;
}

.edit-order-modal .field label {
  font-size: 14px;
}

.edit-order-modal .input,
.edit-order-modal .select {
  height: 40px;
  font-size: 15px;
}

.edit-order-modal .textarea {
  min-height: 66px;
  height: 66px;
  font-size: 15px;
}

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

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

.modal-body {
  padding: 18px;
}

.ai-textarea {
  min-height: 130px;
}

.ai-group-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
}

.ai-group-tab,
.ai-group-add {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  white-space: nowrap;
  font-weight: 700;
  cursor: pointer;
}

.ai-group-tab.active {
  border-color: var(--primary);
  background: #eef3ff;
  color: var(--primary);
}

.ai-group-tab i {
  font-style: normal;
  font-size: 18px;
}

.ai-group-add {
  border-style: dashed;
  color: var(--primary);
}

.ai-group-panel {
  padding: 14px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.ai-group-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.ai-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.ai-error {
  padding: 10px 12px;
  margin: -6px 0 14px;
  border: 1px solid #f1b8bd;
  border-radius: 7px;
  background: #fff4f5;
  color: #b42332;
  font-size: 13px;
  line-height: 1.6;
}

.ai-result {
  display: grid;
  gap: 14px;
}

.ai-result-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.ai-result-group > summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  background: #f8fafc;
  cursor: pointer;
}

.ai-result-group-body {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.success-text {
  color: #16856b;
}

.warning-text {
  color: #b46a12;
}

.ai-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fbfdff;
}

.ai-section h4 {
  margin: 0;
  padding: 11px 14px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.ai-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.ai-line:last-child {
  border-bottom: 0;
}

.ai-line-wrap {
  border-bottom: 1px solid var(--line);
}

.ai-line-wrap:last-child {
  border-bottom: 0;
}

.ai-line-wrap .ai-line {
  border-bottom: 0;
}

.ai-matched-line {
  transition: opacity .16s ease, transform .16s ease;
}

.ai-matched-line.is-removing {
  opacity: 0;
  transform: translateX(18px);
  pointer-events: none;
}

.ai-matched-row {
  grid-template-columns: minmax(0, 1fr) 110px auto 40px;
}

.ai-matched-product {
  min-width: 0;
}

.ai-matched-quantity {
  display: grid;
  gap: 4px;
  color: #66758d;
  font-size: 11px;
  font-weight: 700;
}

.ai-matched-quantity .ai-small-input {
  width: 100%;
  min-width: 0;
  height: 40px;
}

.ai-matched-price {
  min-width: 58px;
  text-align: right;
}

.ai-matched-delete {
  width: 38px;
  height: 38px;
}

.ai-matched-picker {
  margin: 0 14px 12px;
  padding: 0 11px 11px;
  border: 1px solid #d8e2f2;
  border-radius: 7px;
  background: #fff;
}

.ai-matched-picker > summary {
  padding: 10px 0 0;
}

.ai-matched-picker[open] > summary {
  padding-bottom: 10px;
}

.ai-matched-picker.has-selection {
  border-color: #9fb8ff;
  background: #f7f9ff;
}

.ai-matched-picker.has-selection > summary {
  color: #2456d8;
}

.ai-match-reason,
.ai-recommendation {
  color: #16745e;
  font-size: 12px;
  line-height: 1.5;
}

.ai-match-reason {
  margin-top: 4px;
}

.ai-line-stack {
  grid-template-columns: minmax(160px, 1fr) minmax(220px, 1fr) 120px;
}

.ai-small-input {
  width: 110px;
}

.ai-candidate-block {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.ai-candidate-block:last-child {
  border-bottom: 0;
}

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

.ai-candidate-list {
  display: grid;
  gap: 8px;
}

.ai-candidate-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
}

.ai-candidate-option:has(input:checked) {
  border-color: var(--primary);
  background: #eef3ff;
}

.ai-candidate-option input {
  margin: 0;
}

.ai-candidate-option span,
.ai-candidate-option small {
  display: block;
  min-width: 0;
}

.ai-candidate-option small {
  margin-top: 4px;
  color: var(--muted);
}

.ai-candidate-option .ai-recommendation {
  color: #16745e;
}

.ai-candidate-option b {
  white-space: nowrap;
}

.ai-more-candidates > summary {
  padding: 9px 11px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.ai-more-candidates[open] {
  display: grid;
  gap: 8px;
}

.ai-alias-consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 14px 12px;
  padding: 9px 11px;
  border: 1px solid #c8d6f8;
  border-radius: 7px;
  background: #f4f7ff;
  color: #38507d;
  font-size: 12px;
  line-height: 1.5;
  cursor: pointer;
}

.ai-candidate-block > .ai-alias-consent {
  margin: 10px 0 0;
}

.ai-alias-consent.is-hidden {
  display: none;
}

.ai-alias-consent input {
  margin: 2px 0 0;
}

.ai-unmatched-block {
  background: #fffdfa;
}

.ai-manual-search {
  margin-bottom: 9px;
}

.ai-manual-results {
  max-height: 310px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ai-manual-empty {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 7px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.muted-line {
  color: var(--muted);
}

.document-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.document-actions .export-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
}

.document-actions .export-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.delivery-bottom {
  display: grid;
  gap: 10px;
  margin-top: 22px;
  font-size: 16px;
  line-height: 1.6;
}

.delivery-preview table th:nth-child(2),
.delivery-preview table td:nth-child(2) {
  width: auto;
  text-align: left;
}

.doc-preview {
  width: min(900px, 100%);
  margin: 0 auto;
  background: white;
  border: 1px solid #d5dbe5;
  padding: 46px 42px 34px;
  color: #172033;
  box-shadow: none;
}

.doc-preview h2 {
  text-align: center;
  margin: 0;
  font-size: 31px;
  font-weight: 850;
  letter-spacing: 0;
}

.doc-subtitle {
  margin: 9px 0 28px;
  text-align: center;
  color: #172033;
  font-size: 16px;
  font-weight: 650;
}

.doc-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 28px;
  padding: 0 0 18px;
  border-top: 0;
  font-size: 17px;
  font-weight: 650;
}

.doc-info span {
  color: #172033;
  font-weight: 850;
}

.doc-info .right {
  text-align: right;
}

.doc-address {
  grid-column: 1 / -1;
  padding: 11px 12px;
  border-radius: 4px;
  background: #eef2f7;
}

.doc-preview table {
  min-width: 0;
  margin-top: 20px;
  border: 1px solid #cfcfcf;
  font-size: 16px;
}

.doc-preview th {
  background: #ffffff;
  color: #172033;
  font-size: 16px;
  font-weight: 850;
}

.doc-preview th,
.doc-preview td {
  border-right: 1px solid #cfcfcf;
  border-bottom: 1px solid #cfcfcf;
  padding: 12px 10px;
}

.doc-preview th:last-child,
.doc-preview td:last-child {
  border-right: 0;
}

.doc-total {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 14px;
  padding-top: 24px;
  font-size: 18px;
  color: #172033;
  font-weight: 850;
}

.doc-total strong {
  font-size: 18px;
  color: #172033;
}

.doc-bottom {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: end;
  margin-top: 24px;
  font-size: 16px;
  color: #172033;
}

.doc-bottom strong {
  font-weight: 850;
}

.doc-remark {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #d5dbe5;
  color: #172033;
  font-size: 16px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.doc-remark strong {
  font-weight: 850;
}

.toast {
  position: fixed;
  top: 82px;
  left: 50%;
  z-index: 50;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  padding: 13px 18px;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: #f0fdf4;
  color: #15803d;
  box-shadow: var(--shadow);
  font-weight: 750;
}

.empty {
  display: grid;
  place-items: center;
  min-height: 180px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 980px) {
  .login-shell,
  .two-col,
  .product-layout,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .login-visual {
    display: none;
  }

  .sidebar {
    width: 76px;
  }

  .side-brand strong,
  .nav-label,
  .side-assistant-entry > span,
  .side-user-details {
    display: none;
  }

  .side-brand {
    justify-content: center;
    padding: 0;
  }

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

  .nav button {
    min-height: 48px;
    justify-content: center;
    padding: 6px;
  }

  .nav button .nav-icon {
    display: inline-grid;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 14px;
  }

  .side-assistant-entry {
    min-height: 56px;
    justify-content: center;
    margin: 4px 10px 0;
    padding: 6px;
  }

  .side-assistant-entry img {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }

  .side-user {
    display: flex;
    min-height: 54px;
    align-items: center;
    justify-content: center;
    margin: 8px 10px 12px;
    padding: 6px;
  }

  .side-user-avatar {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    flex: 0 0 38px;
    border: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    color: white;
    font-size: 15px;
    font-weight: 800;
  }

  .main {
    margin-left: 76px;
  }

  .product-grid,
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .customer-card,
  .order-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 13px;
  }

  .login-shell {
    display: block;
  }

  .login-panel {
    min-height: 100vh;
    padding: 24px;
  }

  .sidebar {
    top: auto;
    right: 0;
    width: auto;
    height: 66px;
    display: flex;
    align-items: center;
    overflow-x: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 -10px 28px rgba(35, 61, 147, 0.18);
  }

  .side-brand,
  .side-user {
    display: none;
  }

  .nav {
    width: 100%;
    grid-auto-flow: column;
    grid-auto-columns: minmax(78px, 1fr);
    padding: 8px;
    gap: 6px;
  }

  .nav button {
    min-width: 78px;
    height: 50px;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    padding: 6px 4px;
    font-size: 11px;
  }

  .nav span {
    display: inline;
  }

  .main {
    margin-left: 0;
    padding-bottom: 76px;
  }

  .topbar {
    height: auto;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
  }

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

  .content {
    padding: 16px;
  }

  .page-title {
    font-size: 20px;
  }

  .toolbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .toolbar .input,
  .toolbar .select,
  .toolbar .btn {
    max-width: none;
    flex: 1 1 100%;
  }

  .product-card {
    grid-template-columns: 72px 1fr auto;
    min-height: 126px;
    padding: 12px;
  }

  .material-thumb {
    width: 72px;
    height: 72px;
  }

  .cart {
    position: static;
  }

  table {
    min-width: 680px;
  }

  .modal-backdrop {
    padding: 0;
    align-items: stretch;
  }

  .modal {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .modal-head,
  .modal-foot {
    padding: 12px 14px;
  }

  .modal-body {
    padding: 14px;
  }

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

  .document-actions .export-btn {
    min-height: 40px;
    padding: 0 11px;
  }

  .ai-actions,
  .ai-line,
  .ai-line-stack {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .ai-actions {
    display: grid;
  }

  .ai-small-input {
    width: 100%;
  }

  .ai-candidate-head {
    display: grid;
  }

  .ai-candidate-option {
    grid-template-columns: 18px minmax(0, 1fr);
  }

  .ai-candidate-option > b {
    grid-column: 2;
  }

  .ai-alias-consent {
    margin-left: 12px;
    margin-right: 12px;
  }

  .ai-group-filters {
    grid-template-columns: 1fr;
  }

  .doc-preview {
    padding: 22px 16px;
    overflow-x: auto;
  }

  .doc-info,
  .doc-bottom {
    grid-template-columns: 1fr;
  }

  .doc-info .right,
  .doc-total {
    text-align: left;
    justify-content: flex-start;
  }
}

.product-table table {
  min-width: 980px;
}

.product-mobile-list {
  display: none;
}

.product-name-cell {
  display: grid;
  gap: 4px;
}

.product-name-cell span {
  color: var(--muted);
  font-size: 12px;
}

.product-card.disabled {
  opacity: 0.58;
}

.advanced-box {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 0;
}

.advanced-box summary {
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 700;
  color: var(--text);
}

.advanced-box[open] {
  padding: 0 14px 14px;
}

.row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
}

.product-actions-cell {
  min-width: 136px;
  white-space: nowrap;
}

.stacked-field {
  display: grid;
  gap: 8px;
}

.subcategory-new-input {
  margin-top: 0;
}

.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.btn.small {
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.filter-field {
  display: grid;
  gap: 6px;
  min-width: 150px;
}

.filter-field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.product-list-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.selection-cell {
  width: 42px;
  text-align: center;
}

.selection-cell input {
  width: 17px;
  height: 17px;
  margin: 0;
}

.product-thumb-button {
  width: 76px;
  height: 76px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f3f6fb;
  color: var(--muted);
  cursor: pointer;
}

.product-thumb-button.small {
  width: 46px;
  height: 46px;
}

.product-thumb-button.catalog {
  width: 96px;
  height: 96px;
}

.product-thumb-button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-thumb-button.is-empty {
  background: repeating-linear-gradient(90deg, #edf3fa 0 10px, #e2ebf6 10px 13px);
}

.product-thumb-button.is-empty span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 4px;
  background: rgba(255,255,255,.62);
  font-size: 11px;
}

.product-image-editor {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.product-image-editor img,
.product-image-placeholder {
  width: 128px;
  height: 104px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.product-existing-images,
.product-image-selection {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 128px));
  gap: 10px;
}

.product-existing-image,
.product-image-selection figure {
  position: relative;
  overflow: hidden;
  width: 128px;
  margin: 0;
  border-radius: 7px;
}

.product-existing-image button {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  background: rgba(194, 45, 45, 0.9);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

.product-image-upload {
  display: grid;
  gap: 8px;
  justify-items: start;
}

.product-image-selection {
  width: 100%;
}

.product-image-selection figcaption {
  overflow: hidden;
  padding: 4px 2px 0;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-image-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.product-image-modal {
  width: min(860px, calc(100vw - 32px));
}

.product-image-large {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  margin: 0 auto;
  object-fit: contain;
}

.product-image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.product-image-gallery figure {
  display: grid;
  gap: 6px;
  margin: 0;
}

.product-image-gallery figcaption {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.product-image-empty {
  display: grid;
  place-items: center;
  min-height: 320px;
  color: var(--muted);
  background: #f8fafc;
  border: 1px dashed var(--line);
}

.ai-search-scope {
  display: grid;
  grid-template-columns: minmax(160px, .8fr) minmax(200px, 1.2fr);
  gap: 8px;
  margin-bottom: 8px;
}

.ai-manual-picker {
  margin-top: 10px;
  border-top: 1px solid var(--line);
}

.ai-manual-picker > summary {
  padding: 10px 2px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.ai-candidate-option:has(.ai-candidate-thumb) {
  grid-template-columns: 18px 46px minmax(0, 1fr) auto;
}

.ai-candidate-thumb {
  width: 46px;
  height: 46px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--line);
}

@media (max-width: 760px) {
  .product-list-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .product-thumb-button.catalog {
    width: 72px;
    height: 72px;
  }

  .product-image-editor {
    grid-template-columns: 1fr;
  }

  .product-image-editor img,
  .product-image-placeholder {
    width: 104px;
    height: 84px;
  }

  .product-existing-images,
  .product-image-selection {
    grid-template-columns: repeat(auto-fill, minmax(96px, 104px));
  }

  .product-existing-image,
  .product-image-selection figure {
    width: 104px;
  }

  .product-image-gallery {
    grid-template-columns: 1fr;
  }

  .ai-search-scope {
    grid-template-columns: 1fr;
  }

  .ai-matched-row {
    grid-template-columns: minmax(0, 1fr) auto 38px;
    gap: 9px;
  }

  .ai-matched-product {
    grid-column: 1 / -1;
  }

  .ai-matched-quantity {
    width: min(150px, 100%);
  }

  .ai-matched-price {
    align-self: end;
    padding-bottom: 10px;
  }

  .ai-matched-delete {
    align-self: end;
  }

  .ai-matched-picker {
    margin-inline: 10px;
  }

  .ai-candidate-option:has(.ai-candidate-thumb) {
    grid-template-columns: 18px 40px minmax(0, 1fr);
  }

  .ai-candidate-thumb {
    width: 40px;
    height: 40px;
  }

  .ai-candidate-option:has(.ai-candidate-thumb) > b {
    grid-column: 3;
  }
}

.order-filter-toolbar {
  align-items: end;
}

.order-right {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.order-badges,
.order-status-controls,
.order-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.inline-select {
  height: 34px;
  min-width: 112px;
  padding: 0 30px 0 10px;
  font-size: 13px;
}

.edit-order-table table {
  min-width: 980px;
}

.edit-order-table td {
  vertical-align: top;
}

.edit-order-items {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.edit-order-items-head,
.edit-order-line {
  display: grid;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
}

.edit-order-items-head {
  grid-template-columns: 1fr auto;
  background: #f7f9fc;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}

.edit-order-line {
  grid-template-columns: 34px minmax(260px, 1fr) 88px 98px 100px 34px;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  transform-origin: center;
  transition: opacity .15s ease, background-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.edit-order-line:last-child { border-bottom: 0; }
.edit-order-mobile-summary { display: none; }
.edit-order-product { min-width: 0; display: grid; gap: 4px; }
.edit-order-product strong { overflow-wrap: anywhere; font-size: 16px; line-height: 1.4; }
.edit-order-product span,
.edit-order-line label span,
.edit-product-result span { color: var(--muted); font-size: 13px; }
.edit-order-line label { display: grid; gap: 4px; }
.edit-order-line .input { width: 100%; height: 38px; padding-inline: 10px; font-size: 15px; }
.edit-order-line .icon-btn { width: 32px; height: 32px; }
.edit-order-subtotal { font-size: 15px; font-weight: 800; text-align: right; white-space: nowrap; }

.quantity-input-invalid {
  border-color: #e5484d !important;
  background: #fff8f8 !important;
  box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.1) !important;
}

.quantity-error-text {
  display: block;
  margin-top: 3px;
  color: #c62f35;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.edit-order-drag-handle {
  width: 32px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #7b8ba6;
  cursor: grab;
  touch-action: none;
}

.edit-order-drag-handle:hover,
.edit-order-drag-handle:focus-visible {
  background: #edf3ff;
  color: var(--primary);
  outline: none;
}

.edit-order-drag-handle svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  stroke: none;
}

.edit-order-line.is-dragging {
  position: relative;
  z-index: 3;
  background: #f2f6ff;
  box-shadow: inset 3px 0 0 var(--primary), 0 10px 24px rgba(35, 64, 130, 0.12);
  transform: scale(1.012);
  opacity: .96;
}

.edit-order-line.is-removing {
  pointer-events: none;
  opacity: 0;
  transform: translateX(18px) scale(.985);
}

.is-edit-order-dragging,
.is-edit-order-dragging * {
  cursor: grabbing !important;
  user-select: none !important;
}

.edit-customer-combobox {
  position: relative;
}

.edit-customer-results {
  position: absolute;
  z-index: 50;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(24, 43, 76, 0.16);
}

.edit-customer-results.hidden {
  display: none;
}

.edit-customer-option {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.edit-customer-option:hover,
.edit-customer-option.selected {
  background: #eef3ff;
}

.edit-customer-option span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edit-order-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.edit-order-actions strong {
  font-size: 16px;
}

.edit-product-picker {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.edit-product-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px 180px;
  gap: 10px;
  margin-bottom: 12px;
}

.edit-product-results {
  max-height: 330px;
  overflow-y: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.edit-product-result {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.edit-product-result:last-child { border-bottom: 0; }
.edit-product-result > div { min-width: 0; display: grid; gap: 4px; }
.edit-product-result strong { overflow-wrap: anywhere; }

.mini-select,
.mini-input {
  min-width: 140px;
  height: 38px;
}

.mini-select {
  margin-bottom: 8px;
}

.unit-input {
  min-width: 70px;
}

.num-input {
  min-width: 96px;
}

@media (max-width: 720px) {
  .modal.edit-order-modal {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

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

  .edit-order-modal .field[style] {
    grid-column: auto !important;
  }

  .edit-order-line {
    grid-template-columns: 34px minmax(0, 1fr) minmax(0, 1fr) 34px;
    gap: 5px 8px;
    min-height: 64px;
    padding: 7px 8px;
  }

  .edit-order-product { display: none; }
  .edit-order-drag-handle { grid-column: 1; grid-row: 1; width: 34px; min-width: 34px; height: 54px; align-self: center; }
  .edit-order-mobile-summary { display: grid; grid-column: 2 / -1; grid-row: 1; grid-template-columns: minmax(0, 1fr) auto 18px; gap: 7px; align-items: center; width: 100%; min-height: 54px; padding: 0; border: 0; background: transparent; color: var(--text); text-align: left; font: inherit; }
  .edit-order-mobile-summary > span:first-child { display: grid; min-width: 0; gap: 2px; }
  .edit-order-mobile-summary strong { overflow: hidden; font-size: 13px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
  .edit-order-mobile-summary small { color: var(--muted); font-size: 10px; }
  .edit-order-mobile-summary > span:nth-child(2) { display: grid; justify-items: end; gap: 3px; }
  .edit-order-mobile-summary em { color: var(--muted); font-size: 10px; font-style: normal; white-space: nowrap; }
  .edit-order-mobile-summary b { font-size: 13px; white-space: nowrap; }
  .edit-order-mobile-summary i { color: var(--muted); font-size: 18px; font-style: normal; transition: transform 160ms ease; }
  .edit-order-line.is-expanded .edit-order-mobile-summary i { transform: rotate(180deg); }
  .edit-order-line label,
  .edit-order-subtotal,
  .edit-order-line .icon-btn { display: none; }
  .edit-order-line.is-expanded label { display: grid; gap: 3px; }
  .edit-order-line.is-expanded label:first-of-type { grid-column: 2 / 3; grid-row: 2; }
  .edit-order-line.is-expanded label:nth-of-type(2) { grid-column: 3 / -1; grid-row: 2; }
  .edit-order-line.is-expanded .edit-order-subtotal { display: block; grid-column: 2 / 4; grid-row: 3; align-self: center; text-align: left; }
  .edit-order-line.is-expanded .icon-btn { display: inline-flex; grid-column: 4; grid-row: 3; justify-self: end; }
  .edit-order-line label span { font-size: 10px; }
  .edit-order-line .input { height: 36px; padding-inline: 7px; font-size: 13px; }
  .edit-order-subtotal { font-size: 13px; }
  .edit-product-filters { grid-template-columns: 1fr; }

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

  .product-card {
    grid-template-columns: 1fr auto;
    min-height: 0;
  }

  .pagination,
  .order-badges,
  .order-status-controls,
  .order-actions {
    justify-content: flex-start;
  }

  .filter-field {
    width: 100%;
  }
}

.product-card.selected {
  border-color: #93a9ff;
  box-shadow: 0 0 0 2px rgba(54, 88, 219, 0.14), var(--shadow-soft);
}

.product-card-qty,
.cart-line-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.product-card-qty button,
.cart-line-controls button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  font-weight: 800;
  color: var(--text);
}

.qty-input {
  width: 58px;
  height: 28px;
  border: 0;
  background: transparent;
  text-align: center;
  font-weight: 800;
  color: var(--text);
  outline: none;
}

.cart-line {
  align-items: center;
}

.cart-line-main {
  min-width: 0;
}

.cart-line-side {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.cart-line-total {
  color: var(--text);
}

.cart-line-bottom {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.cart-line-bottom .icon-btn {
  width: 30px;
  height: 30px;
}

@media (prefers-reduced-motion: reduce) {
  .edit-order-line {
    transition: none;
  }
}

.order-card.order-card-compact {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  min-height: 0;
}

.order-card-main {
  min-width: 0;
}

.order-card-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.order-card-title-row h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 900;
}

.order-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.order-card-address {
  margin-top: 7px;
  color: var(--text);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-card-side {
  display: grid;
  justify-items: end;
  gap: 8px;
  min-width: 270px;
}

.order-amount {
  color: var(--primary);
  font-size: 20px;
  font-weight: 900;
}

.order-status-controls.compact {
  display: flex;
  gap: 8px;
}

.order-status-controls.compact .inline-select {
  min-width: 112px;
}

@media (max-width: 900px) {
  .order-card.order-card-compact {
    grid-template-columns: 1fr;
  }

  .order-card-side {
    justify-items: stretch;
    min-width: 0;
  }

  .order-status-controls.compact,
  .order-actions {
    justify-content: flex-start;
  }

  .product-card-qty {
    grid-column: 2 / 4;
    justify-self: start;
  }
}

.order-card.order-card-polished {
  position: relative;
  display: grid;
  grid-template-columns: 6px minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  padding: 0;
  overflow: hidden;
  border-color: #dbe5f5;
  box-shadow: 0 12px 30px rgba(16, 36, 70, 0.06);
}

.order-card-accent {
  background: linear-gradient(180deg, var(--primary), #7da0ff);
}

.order-card-body {
  min-width: 0;
  padding: 14px 16px;
}

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

.order-card-head {
  margin-bottom: 9px;
}

.order-card-title-row {
  min-width: 0;
}

.order-card-title-row h3 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-type-chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: #edf3ff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.order-card-meta-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 16px;
  margin-top: 0;
  margin-bottom: 10px;
  color: var(--text);
}

.order-card-meta-grid span {
  color: var(--text);
  line-height: 1.45;
}

.order-card-meta-grid b {
  margin-right: 5px;
  color: var(--muted);
  font-weight: 800;
}

.order-card-polished .order-card-address {
  margin: 0;
  padding: 9px 11px;
  border: 1px solid #e5edf8;
  border-radius: 8px;
  background: #f8fbff;
  color: var(--text);
}

.order-card-polished .order-status-controls.compact {
  grid-column: 2;
  grid-row: 1;
}

.order-card-polished .order-actions {
  grid-column: 2;
  grid-row: 2;
  justify-content: flex-end;
}

.order-more-menu {
  position: relative;
  flex: 0 0 auto;
}

.order-more-menu > summary {
  width: 40px;
  height: 40px;
  list-style: none;
  cursor: pointer;
}

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

.order-more-menu > summary svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  stroke: none;
}

.order-more-menu[open] > summary {
  border-color: var(--primary);
  color: var(--primary);
  background: #f4f7ff;
}

.order-more-dropdown {
  position: absolute;
  z-index: 30;
  top: calc(100% + 7px);
  right: 0;
  width: 150px;
  padding: 6px;
  border: 1px solid #dce5f3;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(18, 39, 74, 0.16);
}

.order-more-dropdown button {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.order-more-dropdown button:hover {
  background: #f3f6fb;
}

.order-more-dropdown button.danger {
  color: #dc3545;
}

.order-card-polished .order-amount {
  align-self: start;
  font-size: 21px;
}

@media (max-width: 1100px) {
  .order-card-head,
  .order-card-bottom {
    grid-template-columns: 1fr;
  }

  .order-card-polished .order-status-controls.compact,
  .order-card-polished .order-actions {
    grid-column: auto;
    grid-row: auto;
    justify-content: flex-start;
  }
}

.order-card.order-card-polished {
  border: 1px solid #dfe8f7;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(31, 52, 84, 0.055);
  overflow: visible;
}

.order-card-polished .order-card-accent {
  border-radius: 10px 0 0 10px;
}

.order-card-polished .order-card-body {
  padding: 12px 14px;
}

.order-card-polished .order-card-head {
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 10px;
  margin-bottom: 8px;
}

.order-card-polished .order-card-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.order-card-polished .order-card-title-row h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
  font-weight: 700;
}

.order-card-polished .order-card-meta-grid {
  gap: 6px 14px;
  margin-bottom: 8px;
  font-size: 13.5px;
  font-weight: 500;
}

.order-card-polished .order-card-meta-grid b {
  font-weight: 700;
}

.order-card-polished .order-card-bottom {
  grid-template-columns: minmax(260px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}

.order-card-polished .order-card-address {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 7px 10px;
  font-size: 13.5px;
  font-weight: 500;
}

.order-card-polished .order-status-controls.compact {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  gap: 8px;
}

.order-card-polished .order-actions {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.order-card-polished .order-amount {
  color: var(--primary);
  font-size: 22px;
  line-height: 1.1;
}

.order-card-polished .inline-select {
  width: 136px;
  min-width: 136px;
  height: 40px;
}

.order-card-polished .order-action-btn {
  min-width: 64px;
  height: 40px;
  padding: 0 16px;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .order-card-polished .order-card-bottom {
    grid-template-columns: 1fr;
  }

  .order-card-polished .order-status-controls.compact,
  .order-card-polished .order-actions {
    grid-column: auto;
    grid-row: auto;
    justify-content: flex-start;
  }

  .order-card-polished .order-status-controls.compact {
    flex-wrap: wrap;
  }
}

@media (max-width: 620px) {
  .order-card-polished .order-card-body {
    padding: 12px;
  }

  .order-card-polished .order-card-head {
    align-items: start;
  }

  .order-card-polished .order-status-controls.compact,
  .order-card-polished .order-actions {
    width: 100%;
  }

  .order-card-polished .inline-select {
    flex: 1 1 120px;
    width: auto;
    min-width: 0;
  }

  .order-card-polished .order-action-btn {
    flex: 1 1 0;
    min-width: 0;
    padding-inline: 10px;
  }

  .order-more-menu {
    margin-left: auto;
  }
}

@media (max-width: 720px) {
  .product-card {
    grid-template-columns: 72px minmax(0, 1fr) auto;
  }
}

/* Rounded order workflow */
.order-card.order-card-polished {
  border-radius: 12px;
  box-shadow: 0 7px 22px rgba(31, 52, 84, 0.05);
}

.order-card-polished .order-card-accent {
  border-radius: 12px 0 0 12px;
}

.order-card-polished .order-card-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.order-card-polished .order-icon-toolbar {
  grid-column: 1;
  grid-row: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  width: 100%;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid #edf1f6;
}

.order-tool-button,
.order-more-menu > summary {
  display: grid;
  place-items: center;
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #26364d;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.order-tool-button:hover,
.order-more-menu > summary:hover,
.order-popover-menu[open] > summary {
  border-color: #dce6ff;
  background: #eef3ff;
  color: var(--primary);
}

.order-tool-button:active,
.order-more-menu > summary:active {
  transform: scale(0.94);
}

.order-tool-button svg,
.order-more-menu > summary svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  shape-rendering: geometricPrecision;
}

.order-more-menu > summary svg.filled-icon {
  fill: currentColor;
  stroke: none;
}

.order-tool-divider {
  width: 1px;
  height: 20px;
  margin: 0 3px;
  background: #e3e9f2;
}

.order-popover-menu {
  position: relative;
  flex: 0 0 auto;
}

/* Keep an open order menu above the cards rendered after it. */
.order-card.order-card-polished.has-open-popover {
  z-index: 100;
  overflow: visible;
}

.order-card.has-open-popover .order-card-body,
.order-card.has-open-popover .order-card-bottom,
.order-card.has-open-popover .order-actions {
  overflow: visible;
}

.order-popover-menu[open] {
  z-index: 110;
}

.order-popover-menu > summary {
  list-style: none;
  cursor: pointer;
}

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

.order-payment-trigger {
  display: flex;
  grid-template-columns: none;
  gap: 0;
  width: 48px;
  color: #168554;
}

.order-payment-trigger strong {
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.order-payment-trigger svg {
  width: 15px;
  height: 15px;
}

.order-status-dropdown,
.order-more-dropdown {
  position: absolute;
  z-index: 120;
  top: calc(100% + 7px);
  right: 0;
  width: 180px;
  padding: 7px;
  border: 1px solid #dfe6f0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(18, 39, 74, 0.16);
  transform-origin: top right;
  animation: order-menu-in 160ms ease-out;
}

.order-status-menu .order-status-dropdown {
  right: -94px;
}

.order-payment-menu .order-status-dropdown {
  right: -44px;
}

.order-status-option,
.order-more-dropdown button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 40px;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.order-status-option b {
  margin-left: auto;
  font-size: 15px;
}

.order-status-option .status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #adb7c6;
}

.order-status-option:hover {
  background: #f5f7fa;
}

.order-status-option.status-pending.selected,
.order-status-option.payment-pending.selected {
  background: #f4f6f9;
}

.order-status-option.status-confirmed {
  color: #315ed8;
}

.order-status-option.status-confirmed .status-dot {
  background: #4c75e8;
}

.order-status-option.status-confirmed.selected {
  background: #edf3ff;
}

.order-status-option.status-shipped {
  color: #2677ac;
}

.order-status-option.status-shipped .status-dot {
  background: #5db9e5;
}

.order-status-option.status-shipped.selected {
  background: #edf8fd;
}

.order-status-option.status-completed,
.order-status-option.payment-paid {
  color: #16804a;
}

.order-status-option.status-completed .status-dot,
.order-status-option.payment-paid .status-dot {
  background: #24ab64;
}

.order-status-option.status-completed.selected,
.order-status-option.payment-paid.selected {
  background: #ebf8f1;
}

.order-status-option.status-canceled {
  color: #d13f46;
}

.order-status-option.status-canceled .status-dot {
  background: #eb5b62;
}

.order-status-option.status-canceled.selected {
  background: #fff0f1;
}

.order-more-dropdown {
  width: 176px;
}

.order-more-dropdown button span {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  color: var(--primary);
}

.order-more-dropdown button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  shape-rendering: geometricPrecision;
}

.order-more-dropdown button:hover {
  background: #f4f7fb;
}

.order-more-dropdown button.danger,
.order-more-dropdown button.danger span {
  color: #dc3545;
}

@keyframes order-menu-in {
  from { opacity: 0; transform: translateY(-5px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.order-document-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1080px, 100%);
  max-height: min(92vh, 920px);
  overflow: hidden;
  border-radius: 14px;
}

.order-document-modal .modal-head {
  padding: 16px 22px;
  background: #fff;
}

.order-document-modal .modal-body {
  min-height: 0;
  overflow-y: auto;
  padding: 22px;
  background: #fbfcfe;
}

.modal-close-button {
  margin-left: auto;
  border-radius: 10px;
  background: #f8fafd;
}

.document-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(900px, 100%);
  margin: 0 auto 18px;
  padding: 11px 13px;
  border: 1px solid #e1e8f2;
  border-left: 4px solid var(--primary);
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(30, 54, 96, 0.055);
}

.document-phone {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid #e0e6ef;
  border-radius: 9px;
  background: #f8fafd;
}

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

.document-phone strong {
  color: var(--text);
  white-space: nowrap;
}

.document-toolbar .document-actions {
  margin-left: auto;
}

.document-toolbar .btn {
  border-radius: 9px;
}

@media (max-width: 720px) {
  .order-card-polished .order-card-head {
    grid-template-columns: 1fr;
  }

  .order-card-polished .order-amount {
    grid-row: 2;
    justify-self: start;
    margin-top: 3px;
  }

  .order-card-polished .order-card-meta-grid span:nth-child(n + 3) {
    display: none;
  }

  .order-card-polished .order-icon-toolbar {
    justify-content: space-between;
  }

  .order-tool-button,
  .order-more-menu > summary {
    width: 42px;
    min-width: 42px;
    height: 42px;
  }

  .order-payment-trigger {
    width: 52px;
  }

  .order-status-dropdown,
  .order-more-dropdown,
  .order-status-menu .order-status-dropdown,
  .order-payment-menu .order-status-dropdown {
    position: fixed;
    z-index: 120;
    top: auto;
    right: 12px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    left: 12px;
    width: auto;
    padding: 9px;
    border-radius: 15px;
    transform-origin: bottom center;
  }

  .order-status-option,
  .order-more-dropdown button {
    min-height: 46px;
    border-radius: 10px;
  }

  .order-document-modal {
    width: 100%;
    max-height: 94vh;
    border-radius: 14px;
  }

  .order-document-modal .modal-body {
    padding: 12px;
  }

  .document-toolbar {
    align-items: stretch;
    flex-direction: column;
    padding: 10px;
  }

  .document-toolbar .document-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-left: 0;
  }

  .document-toolbar .document-actions .primary {
    grid-column: 1 / -1;
  }

  .doc-preview {
    width: 100%;
    padding: 28px 14px 24px;
    overflow: hidden;
  }

  .doc-preview table {
    table-layout: fixed;
  }

  .doc-preview th,
  .doc-preview td {
    padding: 7px 4px;
    font-size: 11px;
    word-break: break-word;
  }
}

@media (prefers-reduced-motion: reduce) {
  .order-tool-button,
  .order-more-menu > summary,
  .order-status-option,
  .order-more-dropdown button {
    transition: none;
  }

  .order-status-dropdown,
  .order-more-dropdown {
    animation: none;
  }
}

.order-more-menu:not([open]) > .order-more-dropdown {
  display: none;
}

.order-more-menu[open] > .order-more-trigger {
  border-color: #dce6ff;
  background: #eef3ff;
  color: var(--primary);
}

.order-amount-button {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  min-width: 88px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1.1;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.order-amount-button strong {
  color: var(--primary);
  font: inherit;
  font-weight: 800;
}

.order-amount-button:hover,
.order-amount-button:focus-visible {
  border-color: #d9e4ff;
  background: #f2f6ff;
  outline: none;
}

.order-amount-button:active {
  transform: translateY(1px);
}

.order-amount-button.adjusted {
  background: #f7f9ff;
}

.order-original-amount {
  margin-top: 4px;
  color: #8b98ad;
  font-size: 13px;
  font-weight: 600;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.payment-amount-modal {
  width: min(480px, calc(100vw - 28px));
}

.payment-amount-body {
  display: grid;
  gap: 18px;
}

.payment-original-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f7f9fc;
}

.payment-original-row span {
  color: var(--muted);
  font-weight: 600;
}

.payment-original-row strong {
  font-size: 20px;
}

.payment-amount-body .field {
  margin: 0;
}

.payment-amount-body .field > span {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.payment-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.payment-input-wrap > span {
  position: absolute;
  left: 14px;
  z-index: 1;
  color: #516078;
  font-size: 17px;
  font-weight: 800;
  pointer-events: none;
}

.payment-input-wrap .input {
  padding-left: 36px;
  font-size: 18px;
  font-weight: 700;
}

.payment-amount-body .hint {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.payment-amount-note {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #e4eaf4;
  border-radius: 8px;
  background: #f8fafd;
  color: #68768d;
  font-size: 13px;
  line-height: 1.6;
}

@media (max-width: 720px) {
  .order-card-polished .order-amount-button {
    align-items: flex-start;
    justify-self: start;
    margin-top: 3px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .order-amount-button {
    transition: none;
  }
}

/* Cost control */
.cost-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 180px auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.cost-search-wrap {
  min-width: 0;
}

.cost-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.cost-summary-item {
  min-width: 0;
  padding: 18px 20px;
  border: 1px solid #dfe7f3;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(26, 54, 93, 0.05);
}

.cost-summary-item span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.cost-summary-item strong {
  display: block;
  color: var(--text);
  font-size: 25px;
  line-height: 1.2;
}

.cost-order-list {
  display: grid;
  gap: 16px;
}

.cost-order-card {
  overflow: hidden;
  border: 1px solid #dfe7f3;
  border-left: 5px solid #5b82ee;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 9px 24px rgba(26, 54, 93, 0.06);
}

.cost-order-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 18px 20px 10px;
}

.cost-order-title {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
}

.cost-order-title > strong {
  font-size: 20px;
}

.cost-order-view-btn {
  width: 36px;
  min-width: 36px;
  height: 36px;
  margin-left: 2px;
  border-color: #d7e1f0;
  background: #f8faff;
  color: #365fce;
}

.cost-order-view-btn svg {
  width: 18px;
  height: 18px;
}

.cost-order-view-btn:hover {
  border-color: #aebfea;
  background: #edf3ff;
  color: #234fca;
}

.cost-paid-amount {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex: 0 0 auto;
}

.cost-paid-amount span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.cost-paid-amount strong {
  margin-top: 2px;
  color: var(--primary);
  font-size: 24px;
}

.cost-order-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  padding: 0 20px 12px;
  color: #26364f;
  font-size: 14px;
}

.cost-order-meta b {
  margin-right: 6px;
  color: var(--muted);
}

.cost-order-address {
  margin: 0 20px 18px;
  padding: 10px 13px;
  border: 1px solid #e2e9f3;
  border-radius: 7px;
  background: #f7f9fc;
  color: #26364f;
  font-size: 14px;
}

.cost-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.75fr);
  border-top: 1px solid #e5ebf3;
}

.cost-editor-section {
  min-width: 0;
  padding: 18px 20px;
}

.cost-editor-section + .cost-editor-section {
  border-left: 1px solid #e5ebf3;
}

.cost-section-heading {
  margin-bottom: 14px;
}

.cost-section-heading strong,
.cost-section-heading span {
  display: block;
}

.cost-section-heading strong {
  font-size: 16px;
}

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

.cost-option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.cost-option {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #d9e3f0;
  border-radius: 7px;
  background: #fff;
  color: #34445e;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.cost-option:hover {
  border-color: #87a4f3;
}

.cost-option.selected {
  border-color: #4f76e8;
  background: #edf2ff;
  color: #315bd6;
}

.cost-custom-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 12px;
}

.cost-supplier-list {
  display: grid;
  gap: 8px;
}

.cost-supplier-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(180px, 0.8fr) 36px;
  gap: 10px;
  align-items: end;
  padding: 10px 11px;
  border: 1px solid #e3e9f2;
  border-radius: 7px;
  background: #fafbfd;
}

.cost-supplier-row > span {
  align-self: center;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.cost-supplier-row label > span,
.cost-field > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.cost-money-input {
  position: relative;
}

.cost-money-input i {
  position: absolute;
  left: 11px;
  top: 50%;
  z-index: 1;
  color: #68768d;
  font-style: normal;
  transform: translateY(-50%);
}

.cost-money-input input {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px 8px 28px;
  border: 1px solid #d9e3f0;
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.cost-money-input input:focus {
  border-color: #5b82ee;
  outline: 3px solid rgba(76, 118, 232, 0.12);
}

.cost-remove {
  width: 36px;
  height: 40px;
  border: 1px solid #ffd7d7;
  border-radius: 7px;
  background: #fff7f7;
  color: #e43e3e;
  font-size: 20px;
  cursor: pointer;
}

.cost-placeholder {
  padding: 14px;
  border: 1px dashed #d9e3f0;
  border-radius: 7px;
  color: var(--muted);
  text-align: center;
}

.cost-field {
  display: block;
  margin-bottom: 14px;
}

.cost-order-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 14px 20px;
  border-top: 1px solid #e5ebf3;
  background: #fafbfd;
}

.cost-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.cost-totals b {
  margin-left: 5px;
  color: var(--text);
  font-size: 17px;
}

.cost-profit b {
  color: #159553;
}

.cost-profit b.is-negative,
.cost-summary-item strong.is-negative {
  color: #d93838;
}

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

.cost-inline-error {
  margin-bottom: 14px;
  padding: 10px 13px;
  border: 1px solid #ffd2d2;
  border-radius: 7px;
  background: #fff6f6;
  color: #c93636;
}

@media (max-width: 900px) {
  .cost-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cost-editor-grid {
    grid-template-columns: 1fr;
  }

  .cost-editor-section + .cost-editor-section {
    border-top: 1px solid #e5ebf3;
    border-left: 0;
  }
}

@media (max-width: 620px) {
  .cost-toolbar,
  .cost-summary-grid {
    grid-template-columns: 1fr;
  }

  .cost-toolbar .select,
  .cost-toolbar .btn {
    width: 100%;
  }

  .cost-order-head,
  .cost-order-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .cost-paid-amount {
    align-items: flex-start;
  }

  .cost-supplier-row {
    grid-template-columns: minmax(0, 1fr) 40px;
  }

  .cost-supplier-row label {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .cost-remove {
    grid-column: 2;
    grid-row: 1;
  }

  .cost-order-footer .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cost-option {
    transition: none;
  }
}

/* Compact cost control layout */
.cost-toolbar {
  grid-template-columns: minmax(300px, 1fr) 210px 150px 170px auto;
}

.cost-sales-filter {
  position: relative;
  min-width: 0;
}

.cost-sales-trigger {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
}

.cost-chevron {
  color: #728097;
  font-size: 17px;
  line-height: 1;
}

.cost-sales-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 7px);
  left: 0;
  width: 100%;
  min-width: 210px;
  max-height: 270px;
  overflow-y: auto;
  padding: 7px;
  border: 1px solid #dce5f1;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(20, 43, 78, 0.15);
}

.cost-sales-all,
.cost-sales-option {
  display: flex;
  width: 100%;
  min-height: 38px;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #273750;
  font: inherit;
  font-weight: 600;
  text-align: left;
}

.cost-sales-all {
  cursor: pointer;
}

.cost-sales-all:hover,
.cost-sales-option:hover {
  background: #f2f6fd;
}

.cost-sales-option input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
}

.cost-summary-grid {
  gap: 12px;
  margin-bottom: 14px;
}

.cost-summary-item {
  padding: 14px 16px;
  box-shadow: 0 5px 16px rgba(26, 54, 93, 0.04);
}

.cost-summary-item span {
  margin-bottom: 5px;
  font-size: 13px;
}

.cost-summary-item strong {
  font-size: 22px;
}

.cost-order-list {
  gap: 12px;
}

.cost-order-card {
  border-left-width: 4px;
  box-shadow: 0 6px 18px rgba(26, 54, 93, 0.05);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.cost-order-card.is-expanded {
  border-color: #cfdcf2;
  border-left-color: #4f76e8;
  box-shadow: 0 12px 28px rgba(31, 65, 112, 0.1);
}

.cost-order-head {
  align-items: center;
  padding: 13px 16px 8px;
}

.cost-order-title {
  gap: 8px;
}

.cost-order-title > strong {
  font-size: 18px;
  line-height: 1.3;
}

.cost-reconcile-badge {
  display: inline-flex;
  min-height: 27px;
  align-items: center;
  padding: 3px 10px;
  border: 1px solid #d9e2ee;
  border-radius: 999px;
  background: #fff;
  color: #526078;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.cost-reconcile-badge.is-problem {
  border-color: #f2cf72;
  background: #fff6d8;
  color: #9a6900;
}

.cost-reconcile-badge.is-checked {
  border-color: #a9dfc1;
  background: #eaf9f0;
  color: #118047;
}

.cost-card-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(88px, auto));
  gap: 8px;
  flex: 0 0 auto;
}

.cost-card-metrics > span {
  display: flex;
  min-width: 90px;
  flex-direction: column;
  align-items: flex-end;
}

.cost-card-metrics small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.cost-card-metrics strong {
  margin-top: 1px;
  color: #243652;
  font-size: 17px;
  line-height: 1.25;
}

.cost-card-metrics > span:last-child strong {
  color: #159553;
}

.cost-card-metrics strong.is-negative {
  color: #d93838;
}

.cost-order-meta {
  gap: 5px 18px;
  padding: 0 16px 8px;
  font-size: 13px;
}

.cost-order-address {
  margin: 0 16px 10px;
  padding: 7px 10px;
  font-size: 13px;
}

.cost-compact-summary {
  display: flex;
  min-height: 49px;
  align-items: center;
  gap: 8px 22px;
  padding: 9px 16px;
  border-top: 1px solid #e7edf5;
  background: #fafbfd;
  color: #34445e;
  font-size: 13px;
}

.cost-compact-summary > span {
  display: inline-flex;
  min-width: 0;
  align-items: baseline;
  gap: 6px;
}

.cost-compact-summary b {
  color: #758299;
  font-size: 12px;
}

.cost-compact-summary i {
  color: #243652;
  font-style: normal;
  font-weight: 700;
}

.cost-summary-remark {
  flex: 1 1 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cost-expand-btn {
  min-height: 34px;
  margin-left: auto;
  padding: 0 11px;
  white-space: nowrap;
}

.cost-expand-icon {
  display: inline-block;
  margin-left: 5px;
  transition: transform 180ms ease;
}

.cost-order-card.is-expanded .cost-expand-icon {
  transform: rotate(180deg);
}

.cost-expanded-panel {
  overflow: hidden;
  border-top: 1px solid #e5ebf3;
  animation: cost-panel-in 180ms ease-out;
}

@keyframes cost-panel-in {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cost-expanded-panel .cost-editor-grid {
  border-top: 0;
}

.cost-reconcile-editor {
  display: grid;
  grid-template-columns: minmax(190px, 0.55fr) minmax(330px, 1fr);
  gap: 14px 22px;
  align-items: center;
  padding: 15px 20px;
  border-top: 1px solid #e5ebf3;
  background: #fff;
}

.cost-reconcile-editor > div:first-child strong,
.cost-reconcile-editor > div:first-child span {
  display: block;
}

.cost-reconcile-editor > div:first-child strong {
  font-size: 15px;
}

.cost-reconcile-editor > div:first-child span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.cost-reconcile-options {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.cost-reconcile-option {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #d9e2ee;
  border-radius: 7px;
  background: #fff;
  color: #526078;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

.cost-reconcile-option.is-problem {
  border-color: #f2cf72;
  background: #fff9e8;
  color: #9a6900;
}

.cost-reconcile-option.is-checked {
  border-color: #a9dfc1;
  background: #f0fbf4;
  color: #118047;
}

.cost-reconcile-option.selected {
  box-shadow: 0 0 0 3px rgba(76, 118, 232, 0.13);
}

.cost-reconcile-option.is-unchecked.selected {
  border-color: #8797ae;
  background: #f5f7fa;
  color: #2d3b51;
}

.cost-reconcile-option.is-problem.selected {
  border-color: #e2b94e;
  background: #fff1bd;
}

.cost-reconcile-option.is-checked.selected {
  border-color: #55b77f;
  background: #dcf5e7;
}

.cost-remark-field {
  display: block;
  grid-column: 1 / -1;
}

.cost-remark-field > span {
  display: block;
  margin-bottom: 6px;
  color: #34445e;
  font-size: 13px;
  font-weight: 700;
}

.cost-remark-field textarea {
  width: 100%;
  min-height: 74px;
  resize: vertical;
}

.cost-expanded-panel .cost-order-footer {
  padding: 12px 20px;
}

@media (max-width: 1120px) {
  .cost-toolbar {
    grid-template-columns: minmax(260px, 1fr) repeat(2, minmax(145px, 0.45fr));
  }

  .cost-toolbar .cost-sales-filter {
    grid-column: 1;
  }

  .cost-toolbar > .btn {
    width: 100%;
  }

  .cost-card-metrics {
    grid-template-columns: repeat(3, minmax(78px, auto));
  }
}

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

  .cost-search-wrap,
  .cost-sales-filter {
    grid-column: 1 / -1;
  }

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

  .cost-order-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .cost-card-metrics {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .cost-card-metrics > span {
    align-items: flex-start;
  }

  .cost-compact-summary {
    flex-wrap: wrap;
  }

  .cost-expand-btn {
    width: 100%;
    margin-left: 0;
  }

  .cost-reconcile-editor {
    grid-template-columns: 1fr;
  }

  .cost-reconcile-options {
    justify-content: flex-start;
  }
}

@media (max-width: 520px) {
  .cost-toolbar,
  .cost-summary-grid {
    grid-template-columns: 1fr;
  }

  .cost-toolbar > * {
    grid-column: 1;
  }

  .cost-summary-item {
    padding: 12px 14px;
  }

  .cost-order-title > strong {
    font-size: 16px;
    overflow-wrap: anywhere;
  }

  .cost-order-view-btn {
    width: 34px;
    min-width: 34px;
    height: 34px;
    margin-left: 0;
  }

  .cost-card-metrics {
    gap: 5px;
  }

  .cost-card-metrics strong {
    font-size: 15px;
  }

  .cost-order-meta {
    gap: 5px 12px;
  }

  .cost-compact-summary {
    gap: 7px 14px;
  }

  .cost-compact-summary > span {
    flex: 1 1 42%;
  }

  .cost-summary-remark {
    flex-basis: 100%;
  }

  .cost-reconcile-options {
    display: grid;
    grid-template-columns: 1fr;
  }

  .cost-reconcile-option {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cost-order-card,
  .cost-expand-icon,
  .cost-reconcile-option {
    transition: none;
  }

  .cost-expanded-panel {
    animation: none;
  }
}

/* Cost control filters and linked metrics */
.cost-filter-shell {
  margin-bottom: 14px;
}

.cost-filter-toggle {
  display: none;
}

.cost-filter-content .cost-toolbar {
  margin-bottom: 10px;
}

.cost-advanced-filters {
  display: grid;
  grid-template-columns: minmax(390px, 1.2fr) minmax(260px, auto) minmax(210px, 0.65fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid #dfe7f3;
  border-radius: 8px;
  background: #fff;
}

.cost-date-range {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto minmax(150px, 1fr);
  gap: 8px;
  align-items: end;
  min-width: 0;
}

.cost-date-range label {
  min-width: 0;
}

.cost-date-range label > span {
  display: block;
  margin: 0 0 5px 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.cost-date-range i {
  align-self: center;
  margin-top: 18px;
  color: #77859b;
  font-style: normal;
}

.cost-date-range .input {
  width: 100%;
  min-width: 0;
}

.cost-date-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cost-date-presets button {
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid #d9e2ee;
  border-radius: 7px;
  background: #fff;
  color: #526078;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.cost-date-presets button:hover,
.cost-date-presets button.selected {
  border-color: #6e91ee;
  background: #edf2ff;
  color: #315bd6;
}

.cost-supplier-filter {
  width: 100%;
}

.cost-supplier-menu {
  min-width: 230px;
}

.cost-reset-filter {
  white-space: nowrap;
}

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

@media (max-width: 1120px) {
  .cost-advanced-filters {
    grid-template-columns: minmax(360px, 1fr) minmax(240px, auto) minmax(210px, 0.65fr);
  }

  .cost-reset-filter {
    width: 100%;
  }

  .cost-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .cost-filter-toggle {
    display: flex;
    width: 100%;
    min-height: 52px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 12px;
    border: 1px solid #dfe7f3;
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font: inherit;
    text-align: left;
  }

  .cost-filter-toggle > span:first-child {
    min-width: 0;
  }

  .cost-filter-toggle strong,
  .cost-filter-toggle small {
    display: block;
  }

  .cost-filter-toggle small {
    overflow: hidden;
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .cost-filter-toggle[aria-expanded="true"] .cost-chevron {
    transform: rotate(180deg);
  }

  .cost-filter-content {
    display: none;
    padding-top: 10px;
  }

  .cost-filter-content.is-open {
    display: block;
  }

  .cost-advanced-filters {
    grid-template-columns: 1fr 1fr;
  }

  .cost-date-range,
  .cost-date-presets {
    grid-column: 1 / -1;
  }

  .cost-date-presets button {
    flex: 1 1 calc(25% - 6px);
    min-width: 64px;
  }

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

@media (max-width: 520px) {
  .cost-advanced-filters {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .cost-date-range {
    grid-template-columns: 1fr;
  }

  .cost-date-range i {
    display: none;
  }

  .cost-date-presets,
  .cost-supplier-filter,
  .cost-reset-filter {
    grid-column: 1;
  }

  .cost-date-presets button {
    flex-basis: calc(50% - 4px);
  }

  .cost-summary-grid {
    grid-template-columns: 1fr;
  }
}

/* Mobile sales workflow */
.mobile-bottom-nav,
.mobile-sheet-layer,
.mobile-cart-bar,
.mobile-table-head,
.user-mobile-list,
.create-order-summary {
  display: none;
}

.create-order-meta-details {
  display: block;
}

.order-more-dropdown .mobile-only-order-action {
  display: none;
}

@media (max-width: 720px) {
  html,
  body,
  .app-shell,
  .main {
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .sidebar {
    display: none;
  }

  .main {
    margin-left: 0;
    padding-bottom: calc(78px + env(safe-area-inset-bottom));
  }

  .app-shell.has-mobile-cart .main {
    padding-bottom: calc(150px + env(safe-area-inset-bottom));
  }

  .topbar {
    min-height: 64px;
    padding: 12px 14px;
  }

  .topbar .page-subtitle,
  .topbar > .toolbar {
    display: none;
  }

  .content {
    padding: 12px;
  }

  .content > .card.card-pad {
    padding: 13px;
  }

  .form-grid {
    gap: 10px;
  }

  .compact-textarea {
    min-height: 70px;
  }

  .mobile-bottom-nav {
    position: fixed;
    z-index: 60;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    min-height: calc(66px + env(safe-area-inset-bottom));
    padding: 5px 6px env(safe-area-inset-bottom);
    border-top: 1px solid #dce4f2;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 -8px 24px rgba(36, 55, 100, 0.12);
    backdrop-filter: blur(14px);
  }

  .mobile-bottom-nav button {
    display: flex;
    min-width: 0;
    min-height: 56px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 2px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #71809a;
    font-size: 11px;
    font-weight: 700;
  }

  .mobile-bottom-nav button.active {
    background: #eef3ff;
    color: var(--primary);
  }

  .mobile-bottom-nav .nav-icon {
    display: grid;
    width: 27px;
    height: 27px;
    place-items: center;
    border-radius: 8px;
    background: #f2f5fa;
    font-size: 13px;
    font-weight: 900;
  }

  .mobile-bottom-nav button.active .nav-icon {
    background: var(--primary);
    color: #fff;
  }

  .mobile-sheet-layer {
    position: fixed;
    z-index: 90;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(19, 30, 56, 0.42);
    backdrop-filter: blur(2px);
  }

  .modal-backdrop {
    z-index: 80;
  }

  .mobile-sheet {
    width: 100%;
    max-height: min(82dvh, 720px);
    overflow: hidden;
    border-radius: 20px 20px 0 0;
    background: #fff;
    box-shadow: 0 -18px 48px rgba(18, 34, 72, 0.2);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .mobile-sheet-handle {
    width: 42px;
    height: 4px;
    margin: 8px auto 2px;
    border-radius: 999px;
    background: #d7dfec;
  }

  .mobile-sheet-head {
    display: flex;
    min-height: 58px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--line);
  }

  .mobile-sheet-head > div {
    display: grid;
    gap: 2px;
  }

  .mobile-sheet-head strong {
    font-size: 17px;
  }

  .mobile-sheet-head span {
    color: var(--muted);
    font-size: 12px;
  }

  .mobile-sheet-head .icon-btn {
    width: 44px;
    height: 44px;
  }

  .mobile-more-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 14px 16px;
  }

  .mobile-more-grid button,
  .mobile-logout-button {
    display: flex;
    min-height: 56px;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f8faff;
    color: var(--text);
    font-weight: 750;
    text-align: left;
  }

  .mobile-more-grid button.active {
    border-color: #9bb1f1;
    background: #edf2ff;
    color: var(--primary);
  }

  .mobile-more-grid .nav-icon,
  .mobile-logout-button .nav-icon {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    place-items: center;
    border-radius: 9px;
    background: #e9effc;
    color: var(--primary);
  }

  .mobile-more-grid .mobile-assistant-entry .nav-icon {
    overflow: hidden;
    padding: 0;
    border-radius: 50%;
    background: #123b87;
  }

  .mobile-more-grid .mobile-assistant-entry .nav-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .mobile-logout-button {
    width: calc(100% - 32px);
    margin: 0 16px 16px;
    border-color: #ffd9d9;
    background: #fff7f7;
    color: #c33f49;
  }

  .mobile-cart-bar {
    position: fixed;
    z-index: 55;
    right: 10px;
    bottom: calc(70px + env(safe-area-inset-bottom));
    left: 10px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    min-height: 64px;
    padding: 8px;
    border: 1px solid #d7e1f5;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 12px 34px rgba(36, 63, 132, 0.2);
    backdrop-filter: blur(14px);
  }

  .mobile-cart-summary {
    display: flex;
    min-width: 0;
    min-height: 46px;
    align-items: center;
    gap: 10px;
    padding: 2px 6px;
    border: 0;
    background: transparent;
    text-align: left;
  }

  .mobile-cart-summary > span:last-child {
    display: grid;
    min-width: 0;
  }

  .mobile-cart-summary small {
    color: var(--muted);
  }

  .mobile-cart-summary strong {
    color: var(--primary);
    font-size: 18px;
  }

  .mobile-cart-icon {
    position: relative;
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    border-radius: 12px;
    background: #edf2ff;
    color: var(--primary);
  }

  .mobile-cart-icon svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
  }

  .mobile-cart-icon i {
    position: absolute;
    top: -5px;
    right: -5px;
    display: grid;
    min-width: 20px;
    height: 20px;
    place-items: center;
    padding: 0 5px;
    border: 2px solid #fff;
    border-radius: 999px;
    background: #ef5b68;
    color: #fff;
    font-size: 10px;
    font-style: normal;
    font-weight: 850;
  }

  .mobile-cart-open {
    min-width: 108px;
    min-height: 46px;
    border: 0;
    border-radius: 11px;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
  }

  .mobile-cart-sheet {
    display: grid;
    grid-template-rows: auto auto minmax(80px, 1fr) auto;
    max-height: min(86dvh, 760px);
  }

  .mobile-cart-lines {
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 16px 12px;
  }

  .mobile-cart-lines .empty {
    min-height: 180px;
  }

  .mobile-cart-lines .cart-line {
    grid-template-columns: 1fr;
    gap: 8px;
    align-items: stretch;
  }

  .mobile-cart-lines .cart-line-side {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .mobile-cart-lines .cart-line-controls button,
  .mobile-cart-lines .cart-line-bottom .icon-btn {
    width: 44px;
    height: 44px;
  }

  .mobile-cart-lines .qty-input {
    width: 52px;
    height: 42px;
  }

  .mobile-cart-checkout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(128px, auto);
    gap: 12px;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid var(--line);
    background: #fff;
  }

  .mobile-cart-checkout > div {
    display: grid;
  }

  .mobile-cart-checkout span {
    color: var(--muted);
    font-size: 12px;
  }

  .mobile-cart-checkout strong {
    color: var(--primary);
    font-size: 21px;
  }

  .mobile-cart-checkout .btn {
    min-height: 48px;
  }

  .create-product-layout > .cart {
    display: none;
  }

  .mobile-product-filters {
    position: sticky;
    z-index: 8;
    top: 0;
    margin: 0 -12px 10px;
    padding: 8px 12px 6px;
    border-bottom: 1px solid rgba(218, 226, 240, 0.9);
    background: rgba(246, 248, 252, 0.97);
    backdrop-filter: blur(12px);
  }

  .mobile-product-filters .toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    flex-wrap: nowrap;
  }

  .mobile-product-filters .toolbar .input,
  .mobile-product-filters .toolbar .btn {
    width: auto;
    max-width: none;
    min-width: 0;
    min-height: 44px;
    flex: none;
  }

  .mobile-product-filters .toolbar .btn {
    padding-right: 12px;
    padding-left: 12px;
    white-space: nowrap;
  }

  .mobile-product-filters .category-tabs,
  .mobile-product-filters .subcategory-tabs {
    flex-wrap: nowrap;
    max-height: none;
    margin: 7px 0 0;
    padding: 1px 0 4px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }

  .mobile-product-filters .category-tabs::-webkit-scrollbar,
  .mobile-product-filters .subcategory-tabs::-webkit-scrollbar {
    display: none;
  }

  .mobile-product-filters .category-tabs button,
  .mobile-product-filters .subcategory-tabs button {
    min-height: 44px;
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .product-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .product-card {
    grid-template-columns: 64px minmax(0, 1fr) auto;
    gap: 10px;
    width: 100%;
    min-width: 0;
    min-height: 112px;
    padding: 11px;
    overflow: hidden;
  }

  .product-card > :nth-child(2) {
    min-width: 0;
  }

  .product-card .product-thumb-button.catalog {
    width: 64px;
    height: 64px;
  }

  .material-thumb {
    width: 64px;
    height: 64px;
  }

  .product-title {
    overflow-wrap: anywhere;
  }

  .product-card-qty {
    grid-column: 2 / 4;
    justify-self: end;
    max-width: 100%;
  }

  .product-add-btn {
    flex: 0 0 44px;
    justify-self: end;
  }

  .product-card-qty button,
  .product-add-btn {
    width: 44px;
    height: 44px;
  }

  .product-card-qty .qty-input {
    width: 52px;
    height: 42px;
  }

  .dashboard-metric-grid.month-metrics,
  .dashboard-metric-grid.today-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .dashboard-metric-grid.today-metrics > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .dashboard-metric {
    min-height: 104px;
    padding: 12px;
  }

  .dashboard-metric-value {
    margin-top: 8px;
    font-size: clamp(20px, 6vw, 25px);
    overflow-wrap: anywhere;
  }

  .dashboard-metric-note {
    display: none;
  }

  .dashboard-metric-icon {
    width: 32px;
    height: 32px;
  }

  .dashboard-filter-row {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-sales-filter {
    width: 100%;
  }

  .customer-card > div:last-child {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
  }

  .customer-card .icon-btn,
  .order-icon-toolbar .order-tool-button,
  .order-icon-toolbar .order-more-menu > button,
  .order-icon-toolbar summary {
    min-width: 44px;
    width: 44px;
    height: 44px;
  }

  .order-icon-toolbar .order-action-edit {
    display: none;
  }

  .order-more-dropdown .mobile-only-order-action {
    display: flex;
  }

  .order-card-polished .order-card-address {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .modal.ai-modal {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .ai-modal .modal-foot {
    position: relative;
    z-index: 3;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    background: #fff;
  }

  .ai-result-master {
    max-height: 205px;
  }

  .ai-nav-item {
    flex-basis: min(78vw, 280px);
  }

  .xiaocai-assistant,
  .xiaocai-assistant.is-left,
  .xiaocai-assistant.is-right {
    right: 12px;
    bottom: calc(76px + env(safe-area-inset-bottom));
  }

  .xiaocai-assistant.has-mobile-cart:not(.is-open) {
    bottom: calc(148px + env(safe-area-inset-bottom));
  }

  .xiaocai-assistant.is-open {
    z-index: 100;
    inset: 0;
  }

  .xiaocai-panel,
  .xiaocai-assistant.is-left .xiaocai-panel,
  .xiaocai-assistant.is-right .xiaocai-panel {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
}

@media (max-width: 380px) {
  .mobile-cart-open {
    min-width: 98px;
    padding-right: 9px;
    padding-left: 9px;
    font-size: 12px;
  }

  .dashboard-metric {
    padding: 10px;
  }

  .dashboard-metric-label {
    font-size: 12px;
  }
}

/* Shared cart drawer and resilient product cards */
body.cart-drawer-open {
  overflow: hidden;
}

.create-product-layout {
  grid-template-columns: minmax(0, 1fr);
}

.create-product-column,
.product-card > div:nth-child(2) {
  min-width: 0;
}

.filter-toolbar > .input {
  min-width: 220px;
  flex: 1 1 320px;
}

.desktop-cart-trigger {
  display: inline-flex;
  min-width: 210px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.desktop-cart-trigger > strong {
  color: var(--primary);
}

.desktop-cart-trigger-icon {
  position: relative;
  display: inline-flex;
  width: 20px;
  height: 20px;
}

.desktop-cart-trigger-icon svg {
  width: 20px;
  height: 20px;
}

.desktop-cart-trigger-icon i {
  position: absolute;
  top: -11px;
  right: -12px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border: 2px solid white;
  border-radius: 999px;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-style: normal;
  line-height: 14px;
  text-align: center;
}

.cart-drawer-layer {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: flex;
  justify-content: flex-end;
  background: rgba(15, 23, 42, 0.42);
}

.cart-drawer {
  display: grid;
  width: min(520px, calc(100vw - 40px));
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-radius: 0;
  background: white;
  box-shadow: -18px 0 48px rgba(15, 23, 42, 0.2);
}

.cart-drawer .mobile-sheet-handle {
  display: none;
}

.cart-drawer-head {
  min-height: 74px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.cart-drawer-lines {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 22px;
}

.cart-drawer-checkout {
  padding: 16px 22px 20px;
  border-top: 1px solid var(--line);
  background: white;
}

.cart-line {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 16px 0;
}

.cart-line-main strong {
  overflow-wrap: anywhere;
}

.cart-line-main strong span {
  color: var(--muted);
  font-weight: 600;
}

.cart-line-unavailable {
  background: #fff8f8;
}

.cart-unavailable-badge {
  margin-top: 5px;
  color: #dc2626;
  font-size: 12px;
  font-weight: 700;
}

.cart-price-field {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.cart-price-field input {
  width: 88px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--text);
  font-weight: 700;
  text-align: right;
}

.product-card {
  grid-template-columns: 96px minmax(0, 1fr) minmax(42px, auto);
  overflow: hidden;
}

.product-card-qty {
  max-width: 156px;
}

.product-title,
.product-spec {
  overflow-wrap: anywhere;
}

@media (min-width: 721px) and (max-width: 1179px) {
  .create-product-column .product-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .filter-toolbar {
    flex-wrap: wrap;
  }
}

@media (max-width: 720px) {
  .desktop-cart-trigger {
    display: none;
  }

  .cart-drawer-layer {
    align-items: flex-end;
  }

  .cart-drawer {
    width: 100%;
    height: min(82vh, 760px);
    border-radius: 18px 18px 0 0;
  }

  .cart-drawer .mobile-sheet-handle {
    display: block;
  }

  .cart-drawer-head {
    min-height: 58px;
    padding: 10px 14px;
  }

  .cart-drawer-lines {
    padding: 0 12px;
  }

  .cart-drawer-checkout {
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  }

  .cart-line {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 10px 2px;
  }

  .cart-price-field input {
    width: 74px;
  }
}

/* Mobile table-card hybrid layout (option D) */
@media (max-width: 720px) {
  .main {
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }

  .app-shell.has-mobile-cart .main {
    padding-bottom: calc(136px + env(safe-area-inset-bottom));
  }

  .topbar {
    min-height: 52px;
    padding: 8px 10px;
  }

  .topbar .page-title {
    font-size: 18px;
    line-height: 1.25;
  }

  .content {
    padding: 8px;
  }

  .content,
  .product-layout,
  .create-product-layout,
  .create-product-column,
  #createProductResults,
  .mobile-product-filters,
  .mobile-product-filters .toolbar,
  .subcategory-panel,
  .category-tabs,
  .subcategory-tabs {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .create-product-layout,
  .create-product-column,
  .subcategory-panel {
    overflow: hidden;
  }

  .mobile-product-filters .toolbar .input {
    min-width: 0;
  }

  .content > .card.card-pad {
    padding: 10px;
  }

  .toolbar {
    gap: 8px;
    margin-bottom: 10px;
  }

  .input,
  .select,
  .btn {
    min-height: 44px;
  }

  .mobile-bottom-nav {
    min-height: calc(62px + env(safe-area-inset-bottom));
    padding: 4px 5px env(safe-area-inset-bottom);
  }

  .mobile-bottom-nav button {
    min-height: 52px;
    gap: 1px;
  }

  .mobile-bottom-nav .nav-icon {
    width: 25px;
    height: 25px;
  }

  .mobile-cart-bar {
    right: 6px;
    bottom: calc(64px + env(safe-area-inset-bottom));
    left: 6px;
    min-height: 58px;
    padding: 6px;
    border-radius: 13px;
  }

  .mobile-cart-summary {
    min-height: 44px;
    gap: 8px;
    padding: 0 4px;
  }

  .mobile-cart-icon {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
    border-radius: 10px;
  }

  .mobile-cart-summary small {
    font-size: 11px;
  }

  .mobile-cart-summary strong {
    font-size: 17px;
  }

  .mobile-cart-open {
    min-width: 102px;
    min-height: 44px;
  }

  .create-order-meta-card {
    margin-bottom: 8px !important;
    padding: 0 !important;
    overflow: visible;
  }

  .create-order-summary {
    display: flex;
    width: 100%;
    min-height: 54px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border: 0;
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    text-align: left;
  }

  .create-order-summary > span {
    display: grid;
    min-width: 0;
    gap: 2px;
  }

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

  .create-order-summary strong {
    font-size: 14px;
  }

  .create-order-summary small {
    color: var(--muted);
    font-size: 11px;
  }

  .create-order-summary b {
    flex: 0 0 auto;
    color: var(--primary);
    font-size: 12px;
  }

  .create-order-meta-details {
    display: none;
    padding: 0 10px 10px;
    border-top: 1px solid #edf1f6;
  }

  .create-order-meta-details.is-open {
    display: block;
  }

  .create-order-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .create-order-meta-grid .edit-customer-field,
  .create-order-meta-grid .order-address-field,
  .create-order-meta-grid .order-remark-field {
    grid-column: 1 / -1;
  }

  .create-order-meta-grid .field {
    min-width: 0;
  }

  .create-order-meta-grid .field label {
    margin-bottom: 4px;
    font-size: 12px;
  }

  .create-order-meta-grid .input,
  .create-order-meta-grid .select {
    height: 42px;
    min-height: 42px;
    padding-inline: 10px;
  }

  .create-order-meta-grid .compact-textarea {
    min-height: 52px;
    padding: 9px 10px;
  }

  .mobile-product-filters {
    margin: 0 -8px 6px;
    padding: 6px 8px 4px;
  }

  .mobile-product-filters .toolbar {
    gap: 6px;
    margin-bottom: 0;
  }

  .mobile-product-filters .toolbar .input,
  .mobile-product-filters .toolbar .btn {
    min-height: 42px;
  }

  .mobile-product-filters .toolbar .btn {
    padding-inline: 10px;
    font-size: 12px;
  }

  .mobile-product-filters .category-tabs,
  .mobile-product-filters .subcategory-tabs {
    gap: 6px;
    margin-top: 5px;
    padding-bottom: 2px;
  }

  .mobile-product-filters .category-tabs button,
  .mobile-product-filters .subcategory-tabs button {
    min-height: 40px;
    padding: 6px 12px;
  }

  .mobile-product-filters .subcategory-panel {
    margin: 3px 0 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .mobile-product-filters .subcategory-panel-head {
    display: none;
  }

  .create-product-column .product-count-hint {
    margin: 5px 2px 7px;
    font-size: 12px;
  }

  .create-product-column .product-grid {
    display: block;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
  }

  .create-product-column .product-card {
    grid-template-columns: 56px minmax(0, 1fr) auto;
    gap: 9px;
    min-height: 82px;
    padding: 8px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
  }

  .create-product-column .product-card:last-child {
    border-bottom: 0;
  }

  .create-product-column .product-card:hover {
    border-color: var(--line);
    box-shadow: none;
  }

  .create-product-column .product-card.selected {
    background: #f6f8ff;
    box-shadow: inset 3px 0 0 var(--primary);
  }

  .create-product-column .product-card .product-thumb-button.catalog {
    width: 56px;
    height: 56px;
  }

  .create-product-column .product-title {
    display: -webkit-box;
    overflow: hidden;
    margin-bottom: 3px;
    font-size: 14px;
    line-height: 1.3;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .create-product-column .product-spec {
    overflow: hidden;
    font-size: 11.5px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .create-product-column .price {
    margin-top: 2px;
    font-size: 16px;
    line-height: 1.2;
  }

  .create-product-column .product-add-btn {
    align-self: center;
  }

  .create-product-column .product-card-qty {
    grid-column: 3;
    grid-row: 1;
    align-self: center;
    justify-self: end;
    gap: 2px;
    padding: 2px;
  }

  .create-product-column .product-card-qty button,
  .create-product-column .product-add-btn {
    width: 44px;
    height: 44px;
  }

  .create-product-column .product-card-qty .qty-input {
    width: 38px;
    height: 40px;
    padding-inline: 2px;
  }

  .route-customers .content > .filter-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
  }

  .route-customers .content > .filter-toolbar .input {
    grid-column: 1 / -1;
  }

  .route-customers .content > .filter-toolbar .select,
  .route-customers .content > .filter-toolbar .btn {
    width: auto;
    min-width: 0;
  }

  .customer-list,
  .order-list {
    gap: 8px;
  }

  .customer-card {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 10px;
    padding: 11px;
    border-radius: 10px;
  }

  .customer-main {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .customer-name {
    font-size: 15px;
  }

  .customer-card .meta {
    gap: 4px 10px;
    font-size: 11.5px;
  }

  .customer-stats {
    grid-column: 1;
    min-width: 0;
  }

  .customer-actions,
  .customer-card > .customer-actions:last-child {
    grid-column: 2;
    display: flex;
    align-self: end;
    justify-content: flex-end;
    gap: 6px;
  }

  .route-orders .order-filter-toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
  }

  .route-orders .order-filter-toolbar > .input,
  .route-orders .order-filter-toolbar > .btn {
    grid-column: 1 / -1;
  }

  .route-orders .order-filter-toolbar .filter-field,
  .route-orders .order-filter-toolbar .select {
    width: 100%;
    min-width: 0;
  }

  .route-orders .order-filter-toolbar .filter-field label {
    margin-bottom: 3px;
    font-size: 11px;
  }

  .route-orders .order-filter-toolbar .spacer {
    display: none;
  }

  .order-card-polished .order-card-body {
    padding: 9px 10px;
  }

  .order-card-polished .order-card-head {
    gap: 5px;
    margin-bottom: 5px;
  }

  .order-card-polished .order-card-title-row {
    gap: 5px;
  }

  .order-card-polished .order-card-title-row h3 {
    font-size: 15px;
  }

  .order-card-polished .order-amount {
    margin-top: 0;
    font-size: 19px;
  }

  .order-card-polished .order-card-meta-grid {
    gap: 4px 10px;
    margin-bottom: 5px;
    font-size: 12px;
  }

  .order-card-polished .order-card-address {
    min-height: 30px;
    padding: 5px 8px;
    font-size: 12px;
  }

  .order-card-polished .order-icon-toolbar {
    margin-top: 6px;
    padding-top: 6px;
  }

  .route-products .content > .toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .route-products .content > .toolbar .input {
    grid-column: 1 / -1;
  }

  .route-products .content > .toolbar .spacer {
    display: none;
  }

  .route-products .content > .toolbar .btn {
    width: auto;
    min-width: 0;
    padding-inline: 8px;
    font-size: 12px;
  }

  .route-products .category-tabs,
  .route-products .subcategory-tabs {
    flex-wrap: nowrap;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }

  .route-products .category-tabs::-webkit-scrollbar,
  .route-products .subcategory-tabs::-webkit-scrollbar {
    display: none;
  }

  .route-products .category-tabs button,
  .route-products .subcategory-tabs button {
    min-height: 40px;
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .product-list-summary {
    margin: 6px 1px 8px;
    font-size: 12px;
  }

  .route-products .product-table {
    display: none;
  }

  .product-mobile-list {
    display: grid;
    gap: 8px;
  }

  .product-mobile-item {
    position: relative;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    gap: 7px 9px;
    align-items: start;
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    box-shadow: var(--shadow-soft);
  }

  .product-mobile-item .product-thumb-button.small {
    grid-column: 1;
    grid-row: 1;
    width: 46px;
    height: 46px;
  }

  .product-mobile-select {
    position: absolute;
    z-index: 1;
    top: 3px;
    left: 3px;
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
  }

  .product-mobile-info {
    display: grid;
    min-width: 0;
    gap: 2px;
  }

  .product-mobile-info strong {
    overflow: hidden;
    font-size: 14px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .product-mobile-info span,
  .product-mobile-info small {
    overflow: hidden;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .product-mobile-side {
    display: grid;
    gap: 5px;
    justify-items: end;
  }

  .product-mobile-side > strong {
    color: var(--primary);
    font-size: 16px;
  }

  .product-mobile-item > .row-actions {
    grid-column: 2 / 4;
    justify-content: flex-end;
    padding-top: 6px;
    border-top: 1px solid #edf1f6;
  }

  .product-mobile-item > .row-actions .icon-btn {
    width: 44px;
    height: 44px;
  }

  .mobile-table-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 10px;
    align-items: center;
    margin: 0 0 5px;
    padding: 6px 9px;
    border: 1px solid #e1e7f0;
    border-radius: 7px;
    background: #f7f9fc;
    color: #71809a;
    font-size: 10.5px;
    font-weight: 750;
  }

  .mobile-table-head span:nth-child(n + 2) {
    text-align: right;
  }

  .customer-card {
    grid-template-columns: minmax(0, 1fr) minmax(118px, auto);
    gap: 5px 9px;
    padding: 9px;
    border-radius: 8px;
    box-shadow: 0 3px 12px rgba(31, 52, 84, 0.04);
  }

  .customer-main {
    grid-column: 1;
  }

  .customer-stats {
    grid-column: 1;
    grid-row: 2;
    white-space: nowrap;
  }

  .customer-actions,
  .customer-card > .customer-actions:last-child {
    grid-column: 2;
    grid-row: 1 / 3;
    align-self: center;
  }

  .customer-card .customer-actions .icon-btn {
    width: 44px;
    height: 44px;
  }

  .product-mobile-list {
    gap: 5px;
  }

  .product-mobile-item {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 5px 8px;
    padding: 8px;
    border-radius: 8px;
    box-shadow: 0 3px 12px rgba(31, 52, 84, 0.04);
  }

  .product-mobile-item .product-thumb-button.small {
    width: 42px;
    height: 42px;
  }

  .product-mobile-item > .row-actions {
    grid-column: 2 / 4;
    gap: 5px;
    padding-top: 4px;
  }

  .order-mobile-head {
    grid-template-columns: minmax(0, 1fr) auto 54px;
  }

  .order-card.order-card-polished {
    border-radius: 8px;
    box-shadow: 0 3px 12px rgba(31, 52, 84, 0.04);
  }

  .order-card-polished .order-card-accent {
    width: 3px;
    border-radius: 8px 0 0 8px;
  }

  .order-card-polished .order-card-head {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .order-card-polished .order-amount {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .order-card-polished .order-card-meta-grid span:nth-child(-n + 2) {
    display: inline-flex;
  }

  .order-card-polished .order-icon-toolbar {
    justify-content: flex-end;
    gap: 3px;
  }

  .route-users .content > .toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .route-users .content > .toolbar .spacer {
    display: none;
  }

  .route-users .content > .toolbar .input,
  .route-users .content > .toolbar .btn {
    width: auto;
    min-width: 0;
  }

  .route-users .user-table {
    display: none;
  }

  .user-mobile-list {
    display: grid;
    gap: 5px;
  }

  .user-mobile-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 5px 8px;
    align-items: center;
    padding: 8px 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 3px 12px rgba(31, 52, 84, 0.04);
  }

  .user-mobile-item > div:first-child,
  .user-mobile-item > div:nth-child(2) {
    display: grid;
    min-width: 0;
    gap: 2px;
  }

  .user-mobile-item > div:first-child span,
  .user-mobile-item > div:nth-child(2) b,
  .user-mobile-item > small {
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .user-mobile-item > small {
    grid-column: 1 / 3;
  }

  .user-mobile-item > .row-actions {
    grid-column: 3;
    grid-row: 1 / 3;
    gap: 4px;
  }

  .user-mobile-item > .row-actions .icon-btn {
    width: 44px;
    height: 44px;
  }

  .route-costs .cost-summary-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
  }

  .route-costs .cost-summary-item {
    min-width: 0;
    min-height: 68px;
    padding: 7px 5px;
    border-radius: 7px;
  }

  .route-costs .cost-summary-item span {
    font-size: 9.5px;
    line-height: 1.25;
  }

  .route-costs .cost-summary-item strong {
    margin-top: 4px;
    font-size: clamp(12px, 3.3vw, 16px);
    overflow-wrap: anywhere;
  }

  .route-costs .cost-order-list {
    gap: 6px;
  }

  .route-costs .cost-order-card {
    border-radius: 8px;
  }

  .route-costs .cost-order-head {
    gap: 6px;
    padding: 8px 9px 5px;
  }

  .route-costs .cost-order-title > strong {
    font-size: 14px;
  }

  .route-costs .cost-card-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }

  .route-costs .cost-card-metrics > span {
    min-width: 0;
  }

  .route-costs .cost-card-metrics small {
    font-size: 9.5px;
  }

  .route-costs .cost-card-metrics strong {
    font-size: 13px;
    overflow-wrap: anywhere;
  }

  .route-costs .cost-order-meta {
    gap: 4px 9px;
    padding: 0 9px 5px;
    font-size: 11px;
  }

  .route-costs .cost-order-address {
    margin: 0 9px 5px;
    min-height: 28px;
    padding: 4px 7px;
    font-size: 11px;
  }

  .route-costs .cost-compact-summary {
    gap: 5px 9px;
    padding: 6px 9px;
    font-size: 11px;
  }

  .route-costs .cost-expand-btn {
    min-height: 44px;
  }

  .dashboard-metric {
    min-height: 72px;
    padding: 8px;
  }

  .dashboard-metric-value {
    margin-top: 4px;
    font-size: clamp(14px, 4vw, 19px);
  }

  .dashboard-metric-label {
    font-size: 10px;
  }

  .dashboard-metric-icon {
    display: none;
  }

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

  .dashboard-metric-grid.today-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }

  .dashboard-metric-grid.today-metrics > :last-child:nth-child(odd) {
    grid-column: auto;
  }

  .dashboard-section-head {
    margin: 9px 0 5px;
  }

  .route-dashboard .two-col {
    gap: 8px;
    margin-top: 8px !important;
  }

  .route-dashboard .two-col > .card {
    padding: 9px;
  }

  .route-dashboard .two-col > .card h3 {
    margin-bottom: 7px;
    font-size: 14px;
  }

  .xiaocai-assistant,
  .xiaocai-assistant.is-left,
  .xiaocai-assistant.is-right {
    bottom: calc(70px + env(safe-area-inset-bottom));
  }

  .xiaocai-assistant.has-mobile-cart:not(.is-open) {
    bottom: calc(134px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 380px) {
  .create-product-column .product-card {
    grid-template-columns: 50px minmax(0, 1fr) auto;
    gap: 7px;
  }

  .create-product-column .product-card .product-thumb-button.catalog {
    width: 50px;
    height: 50px;
  }

  .create-product-column .product-card-qty {
    gap: 1px;
  }

  .create-product-column .product-card-qty .qty-input {
    width: 34px;
  }
}
