: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;
  }
}

@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;
  width: 236px;
  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 {
  padding: 16px 12px;
  display: grid;
  gap: 6px;
}

.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 {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 14px;
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.12);
}

.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-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);
}

.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;
}

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

@media (max-width: 720px) {
  .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-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(408px, calc(100vw - 32px));
  height: min(640px, 72vh);
  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-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-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-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 span,
  .side-user {
    display: none;
  }

  .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-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;
}

.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: 128px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  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-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-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: 88px minmax(0, 1fr);
  }

  .product-image-editor img,
  .product-image-placeholder {
    width: 88px;
    height: 76px;
  }

  .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-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 1fr 1fr;
  }

  .edit-order-product { grid-column: 2 / -1; }
  .edit-order-drag-handle { grid-column: 1; grid-row: 1; align-self: center; }
  .edit-order-line label:first-of-type { grid-column: 1 / 3; }
  .edit-order-line label:nth-of-type(2) { grid-column: 3; }
  .edit-order-subtotal { grid-column: 1 / 3; align-self: center; text-align: left; }
  .edit-order-line .icon-btn { justify-self: end; }
  .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;
}

.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: 40;
  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);
}
