:root {
  --bg: #f1f5fb;
  --surface: #ffffff;
  --surface-soft: #f7faff;
  --border: #d8e2f3;
  --text: #15223e;
  --muted: #5a6f94;
  --primary: #2457d6;
  --primary-2: #4f46e5;
  --emerald: #059669;
  --teal: #0d9488;
  --coral: #dc2626;
  --amber: #d97706;
  --violet: #6d28d9;
  --shadow: 0 10px 28px -14px rgba(24, 52, 114, 0.18);
  --radius: 16px;
}

body[data-theme="dark"] {
  --bg: #0b1224;
  --surface: #121c35;
  --surface-soft: #172444;
  --border: #263965;
  --text: #eef4ff;
  --muted: #98aed4;
  --shadow: 0 12px 30px -14px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

.wms-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 0.18s ease;
}

body.wms-sidebar-collapsed .wms-shell {
  grid-template-columns: 0 minmax(0, 1fr);
}
body.wms-sidebar-collapsed .wms-sidebar {
  padding-left: 0;
  padding-right: 0;
  border-right: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.wms-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 14px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
}

.wms-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 4px 10px;
  border-bottom: 1px solid var(--border);
}

.wms-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 0.05em;
  color: #fff;
  background: linear-gradient(135deg, #2457d6, #0d9488);
  box-shadow: 0 8px 18px -6px rgba(36, 87, 214, 0.45);
  flex-shrink: 0;
}

.wms-brand-copy { min-width: 0; }
.wms-brand h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.wms-brand small {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 1px;
}

.wms-nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wms-nav-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.wms-nav-group-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 2px 10px 4px;
  text-transform: uppercase;
  opacity: 0.85;
}

.wms-nav-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: background 0.14s ease, color 0.14s ease, transform 0.12s ease;
}

.wms-nav-btn:hover {
  background: var(--surface-soft);
}

.wms-nav-btn.is-active {
  background: linear-gradient(135deg, #2457d6, #4f46e5);
  color: #fff;
  box-shadow: 0 8px 18px -8px rgba(36, 87, 214, 0.55);
}

.wms-nav-ico {
  width: 22px;
  text-align: center;
  font-size: 16px;
}

.wms-nav-btn b {
  margin-left: auto;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(36, 87, 214, 0.12);
  color: var(--primary);
}

.wms-nav-btn.is-active b {
  background: rgba(255, 255, 255, 0.24);
  color: #fff;
}

.wms-nav-btn b.is-alert {
  background: #ffe4e6;
  color: #be123c;
}

.wms-dot {
  margin-left: auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #94a3b8;
}

.wms-dot.is-online { background: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22); }
.wms-dot.is-offline { background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.22); }

.wms-sidebar-foot {
  margin-top: auto;
}

.wms-bridge-card {
  padding: 11px 12px;
  border-radius: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.wms-bridge-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 4px;
}

.wms-bridge-card p {
  margin: 0 0 8px;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.4;
}

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

.wms-mini-btn, .wms-mini-link {
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--primary);
  text-decoration: none;
  cursor: pointer;
}

.wms-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.wms-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: nowrap;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
body[data-theme="dark"] .wms-topbar {
  background: rgba(18, 28, 53, 0.9);
}

.wms-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.wms-topbar-heading {
  min-width: 0;
}

.wms-topbar h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wms-topbar p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wms-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.wms-top-action {
  min-height: 36px !important;
  padding: 6px 13px !important;
  font-size: 13.5px !important;
  border-radius: 10px !important;
}

.wms-btn-teal {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  border: 0;
  border-radius: 10px;
  padding: 6px 13px;
  min-height: 36px;
  color: #fff;
  background: linear-gradient(135deg, #0284c7, #0e7490);
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.14s ease, transform 0.12s ease;
}
.wms-btn-teal:hover { opacity: 0.93; }

.wms-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: inline-grid;
  place-items: center;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.wms-icon-btn:hover {
  background: var(--surface-soft);
  border-color: var(--primary);
}

.wms-menu-toggle { display: none; }

.wms-content {
  padding: 18px 24px 36px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 1580px;
  width: 100%;
  margin: 0 auto;
}

/* Streamline EquipmentPage hero inside 4181 since topbar already shows the page title */
.wms-content .eq-hero {
  padding: 12px 16px;
  border-radius: 14px;
  align-items: center;
}
.wms-content .eq-hero-copy .eq-eyebrow,
.wms-content .eq-hero-copy h2 {
  display: none;
}
.wms-content .eq-hero-copy p {
  font-size: 13px;
  opacity: 0.88;
}

.wms-loading {
  padding: 40px 20px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 600;
}

/* KPI Grid */
.wms-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.wms-kpi {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.wms-kpi.is-clickable { cursor: pointer; transition: transform 0.14s ease; }
.wms-kpi.is-clickable:hover { transform: translateY(-2px); }

.wms-kpi-icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 20px;
  color: #fff;
  flex-shrink: 0;
}

.wms-kpi-icon.is-blue { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.wms-kpi-icon.is-teal { background: linear-gradient(135deg, #14b8a6, #0f766e); }
.wms-kpi-icon.is-coral { background: linear-gradient(135deg, #fb7185, #dc2626); }
.wms-kpi-icon.is-violet { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }

.wms-kpi-body { min-width: 0; flex: 1; }
.wms-kpi-body > span { display: block; font-size: 13.5px; font-weight: 700; color: var(--muted); }
.wms-kpi-body > strong { display: block; font-size: 26px; font-weight: 800; line-height: 1.2; margin: 4px 0; font-variant-numeric: tabular-nums; }
.wms-kpi-body > strong.is-alert { color: var(--coral); }
.wms-kpi-body > strong small { font-size: 13px; font-weight: 600; color: var(--muted); }
.wms-kpi-body > small { display: block; font-size: 12.5px; color: var(--muted); }

/* Panels */
.wms-panel {
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.wms-panel h3 { margin: 0 0 6px; font-size: 17px; font-weight: 800; }
.wms-sub { margin: 0 0 14px; font-size: 13.5px; color: var(--muted); }

.wms-onboarding {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(36, 87, 214, 0.08), rgba(13, 148, 136, 0.08));
  border-color: rgba(36, 87, 214, 0.35);
}

.wms-drawer {
  border-color: rgba(36, 87, 214, 0.48);
  background: var(--surface-soft);
}

.wms-row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

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

/* Buttons */
.wms-btn-primary, .wms-btn-secondary, .wms-btn-success, .wms-btn-chip {
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.14s ease, transform 0.12s ease;
}

.wms-btn-primary {
  border: 0;
  padding: 9px 16px;
  min-height: 40px;
  color: #fff;
  background: linear-gradient(135deg, #2457d6, #4f46e5);
}

.wms-btn-success {
  border: 0;
  padding: 9px 16px;
  min-height: 40px;
  color: #fff;
  background: linear-gradient(135deg, #0d9488, #059669);
}

.wms-btn-secondary {
  border: 1.5px solid var(--border);
  padding: 8px 14px;
  min-height: 40px;
  background: var(--surface);
  color: var(--text);
}

.wms-btn-chip {
  border: 1px solid var(--border);
  padding: 5px 10px;
  min-height: 32px;
  font-size: 13.5px;
  background: var(--surface-soft);
  color: var(--primary);
}

.wms-btn-chip.is-in { background: #e1f8ee; border-color: #a7ebd0; color: #0b7350; }
.wms-btn-chip.is-out { background: #fff3da; border-color: #f6d58e; color: #9c5508; }
.wms-btn-chip.is-danger { background: #fff1f2; border-color: #fecdd3; color: #be123c; }
.wms-btn-chip.is-active { background: linear-gradient(135deg, #2457d6, #4f46e5); border-color: transparent; color: #fff; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Category Pills */
.wms-cat-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.wms-cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 6px 13px;
  min-height: 36px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
}

.wms-cat-pill b { font-size: 12px; padding: 1px 7px; border-radius: 999px; background: rgba(36, 87, 214, 0.12); color: var(--primary); }
.wms-cat-pill em { font-style: normal; font-size: 11.5px; padding: 1px 6px; border-radius: 999px; background: #ffe4e6; color: #be123c; }
.wms-cat-pill.is-active { background: linear-gradient(135deg, #2457d6, #4f46e5); border-color: transparent; color: #fff; }
.wms-cat-pill.is-active b { background: rgba(255, 255, 255, 0.22); color: #fff; }

/* Forms */
.wms-search-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.wms-search-form label, .wms-form label, .wms-meta-bar label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.wms-grow { flex: 1; min-width: 210px; }

input, select, textarea {
  font-family: inherit;
  font-size: 14.5px;
  padding: 8px 11px;
  min-height: 40px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  width: 100%;
}

input[type="checkbox"], input[type="radio"] {
  width: auto;
  min-height: auto;
  padding: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(36, 87, 214, 0.15);
}

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

.wms-form-grid .is-wide { grid-column: 1 / -1; }

.wms-meta-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  margin-bottom: 14px;
}

.wms-strip {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  margin-bottom: 14px;
  font-size: 14px;
}

.wms-strip b { color: var(--primary); }

/* Table */
.wms-table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
}

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

.wms-table th {
  background: var(--surface-soft);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 800;
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

.wms-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.wms-table tbody tr:hover td { background: var(--surface-soft); }
.wms-table tr.is-alert-row td:first-child { box-shadow: inset 4px 0 0 #ef4444; }
.wms-table th.is-num, .wms-table td.is-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wms-table td small { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.wms-edit-table td { padding: 6px 8px; }
.wms-edit-table input, .wms-edit-table select { min-height: 36px; padding: 5px 8px; }

.wms-mono { font-family: Consolas, monospace; font-weight: 600; }
.wms-qty { font-weight: 800; color: var(--primary); }
.wms-qty.is-alert, .wms-qty.is-coral { color: var(--coral); }
.wms-qty.is-emerald { color: var(--emerald); }
.wms-qty.is-teal { color: var(--teal); }
.wms-qty.is-amber { color: var(--amber); }
.wms-qty.is-violet { color: var(--violet); }

.wms-meter {
  margin-top: 4px;
  margin-left: auto;
  width: 78px;
  height: 5px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.wms-meter i { display: block; height: 100%; border-radius: 999px; }
.wms-meter i.is-emerald { background: #10b981; }
.wms-meter i.is-amber { background: #f59e0b; }
.wms-meter i.is-coral { background: #ef4444; }

.wms-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}
.wms-pill.is-emerald { background: #e1f8ee; color: #0d7a55; }
.wms-pill.is-teal { background: #dcfaf6; color: #0c746c; }
.wms-pill.is-coral { background: #ffe4e6; color: #be123c; }
.wms-pill.is-amber { background: #fff3da; color: #a65c09; }
.wms-pill.is-violet { background: #ede9fe; color: #6d28d9; }
.wms-pill.is-neutral { background: #e8eef9; color: #475d85; }

.wms-empty { text-align: center !important; padding: 28px 16px !important; color: var(--muted) !important; }

.wms-pager, .wms-export-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  font-size: 13.5px;
  color: var(--muted);
}

.wms-export-bar {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text);
}

/* Integration & Market Cards */
.wms-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

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

.wms-market-card {
  padding: 14px;
  border-radius: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.wms-market-card strong { display: block; font-size: 20px; margin: 4px 0; font-variant-numeric: tabular-nums; }
.wms-market-card small { display: block; font-size: 12.5px; color: var(--muted); }

.wms-ocr-preview {
  margin-top: 10px;
  padding: 8px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  text-align: center;
}
.wms-ocr-preview img { max-width: 100%; max-height: 240px; border-radius: 8px; }

.wms-review-box {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fffbeb;
  border: 1px solid #f59e0b;
  color: #92400e;
  font-size: 13.5px;
}
.wms-review-box ul { margin: 6px 0 0; padding-left: 18px; }
.wms-review-box li { margin: 2px 0; }
.wms-review-box code { background: rgba(245, 158, 11, 0.14); padding: 1px 5px; border-radius: 4px; }
body[data-theme="dark"] .wms-review-box {
  background: rgba(146, 64, 14, 0.2);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fde68a;
}

.wms-cost-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wms-cost-bar-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 150px 70px;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.wms-cost-track {
  height: 12px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  overflow: hidden;
}

.wms-cost-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2457d6, #0d9488);
}

.wms-calc-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.wms-calc-box {
  padding: 14px;
  border-radius: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.wms-calc-box span { display: block; font-size: 13px; color: var(--muted); font-weight: 700; }
.wms-calc-box strong { display: block; font-size: 22px; font-weight: 800; margin-top: 4px; color: var(--primary); font-variant-numeric: tabular-nums; }
.wms-calc-box strong.is-good { color: var(--emerald); }
.wms-calc-box strong.is-bad { color: var(--coral); }

@media (max-width: 920px) {
  .wms-cost-bar-row { grid-template-columns: 92px minmax(0, 1fr) 110px; }
  .wms-cost-bar-row > :last-child { display: none; }
  .wms-calc-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* AI Assistant Workspace */
.wms-ai-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.95fr);
  gap: 16px;
  align-items: start;
}

.wms-ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.wms-ai-chat-log {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 320px;
  max-height: 520px;
  overflow-y: auto;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  margin-bottom: 12px;
}

.wms-ai-msg {
  padding: 11px 14px;
  border-radius: 13px;
  max-width: 92%;
  line-height: 1.55;
  font-size: 14.5px;
}

.wms-ai-msg.is-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #2457d6, #4f46e5);
  color: #ffffff;
}

.wms-ai-msg.is-assistant {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}

.wms-ai-msg h4 { margin: 0 0 6px; font-size: 15px; }
.wms-ai-msg p { margin: 4px 0; }
.wms-ai-msg ul { margin: 6px 0; padding-left: 18px; }
.wms-ai-msg code { background: rgba(36, 87, 214, 0.1); padding: 1px 5px; border-radius: 4px; font-family: Consolas, monospace; font-size: 13px; }

.wms-ai-action-card {
  margin-top: 10px;
  padding: 12px;
  border-radius: 11px;
  background: rgba(13, 148, 136, 0.08);
  border: 1.5px solid rgba(13, 148, 136, 0.42);
}

.wms-ai-input-form {
  display: flex;
  gap: 10px;
  align-items: center;
}

.wms-ai-score-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(36, 87, 214, 0.09), rgba(13, 148, 136, 0.09));
  border: 1px solid var(--border);
  margin-bottom: 14px;
}

.wms-ai-score-ring {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(135deg, #2457d6, #0d9488);
  flex-shrink: 0;
}

.wms-ai-score-ring.is-warn { background: linear-gradient(135deg, #f59e0b, #d97706); }
.wms-ai-score-ring.is-risk { background: linear-gradient(135deg, #fb7185, #dc2626); }

.wms-ai-risk-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.wms-ai-risk {
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.wms-ai-risk strong { display: block; margin: 4px 0 2px; font-size: 14px; }
.wms-ai-risk small { display: block; color: var(--muted); font-size: 12.5px; }

@media (max-width: 1080px) {
  .wms-ai-grid { grid-template-columns: minmax(0, 1fr); }
}

.wms-toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 99;
  padding: 12px 18px;
  border-radius: 12px;
  background: #15223e;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  max-width: 440px;
}
.wms-toast.is-error { background: #be123c; }

.wms-btn-coral {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #e11d48, #ea580c);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 16px -6px rgba(225, 29, 72, 0.5);
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.wms-btn-coral:hover { transform: translateY(-1px); }
.wms-btn-coral:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.wms-mode-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.wms-mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 10px;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease, background 0.15s ease;
}
.wms-mode-btn strong { font-size: 15px; font-weight: 800; }
.wms-mode-btn small { font-size: 12px; color: var(--muted); }
.wms-mode-btn:hover { transform: translateY(-1px); }
.wms-mode-btn.is-active.is-in {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.13);
  color: #047857;
}
.wms-mode-btn.is-active.is-out {
  border-color: #e11d48;
  background: rgba(225, 29, 72, 0.12);
  color: #be123c;
}
.wms-mode-btn.is-active.is-other {
  border-color: var(--primary);
  background: rgba(36, 87, 214, 0.12);
  color: var(--primary);
}
[data-theme="dark"] .wms-mode-btn.is-active.is-in { color: #6ee7b7; }
[data-theme="dark"] .wms-mode-btn.is-active.is-out { color: #fda4af; }
[data-theme="dark"] .wms-mode-btn.is-active.is-other { color: #93c5fd; }

.wms-mode-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 14px;
  font-size: 13.5px;
  font-weight: 600;
}
.wms-mode-banner.is-in {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #065f46;
}
.wms-mode-banner.is-out {
  background: rgba(225, 29, 72, 0.09);
  border: 1px solid rgba(225, 29, 72, 0.32);
  color: #9f1239;
}
.wms-mode-banner.is-other {
  background: rgba(36, 87, 214, 0.09);
  border: 1px solid rgba(36, 87, 214, 0.3);
  color: var(--text);
}
[data-theme="dark"] .wms-mode-banner.is-in { color: #6ee7b7; }
[data-theme="dark"] .wms-mode-banner.is-out { color: #fda4af; }

.wms-backdrop {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(2px);
}
.wms-backdrop[hidden] { display: none; }

.wms-mobile-tabbar {
  display: none;
}
.wms-mobile-only { display: none; }
.wms-mobile-mode-bar { display: none; }

.wms-scan-cta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.wms-scan-status {
  margin-top: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--primary);
}
.wms-verify-strip {
  margin-top: 8px;
  margin-bottom: 0;
  padding: 8px 12px;
  font-size: 13.5px;
}
.wms-fold {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
}
.wms-fold summary {
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wms-fold summary::-webkit-details-marker { display: none; }
.wms-fold summary::after { content: "▾"; font-size: 13px; opacity: 0.7; }
.wms-fold[open] summary::after { content: "▴"; }
.wms-fold-body {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border);
}
.wms-essential-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.wms-essential-bar label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
}
.wms-quick-team-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.wms-mhead-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.wms-batch-box {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}
.wms-batch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 6px;
}
.wms-batch-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.wms-batch-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), #10b981);
  transition: width 0.25s ease;
}
.wms-batch-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}
.wms-batch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  padding: 5px 8px;
  border-radius: 8px;
  background: var(--surface);
}
.wms-batch-row.is-err { color: #be123c; }
.wms-batch-row.is-warn { color: #a65c09; }
.wms-batch-row.is-dup { color: var(--muted); }
.wms-batch-row small { color: var(--muted); flex-shrink: 0; }
.wms-date-presets {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: -6px 0 12px;
  font-size: 12.5px;
  color: var(--muted);
}
.wms-btn-chip.is-att {
  margin-top: 4px;
  border-color: rgba(36, 87, 214, 0.35);
  color: var(--primary);
  background: rgba(36, 87, 214, 0.08);
}
.wms-att-strip {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wms-att-label {
  font-size: 12.5px;
  color: var(--muted);
}
.wms-att-label b { color: var(--primary); }
.wms-att-thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 2px;
}
.wms-att-thumb {
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
}
.wms-att-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.wms-lb-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9990;
  background: rgba(15, 23, 42, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}
.wms-lb-card {
  width: min(940px, 100%);
  max-height: 92dvh;
  background: var(--surface);
  color: var(--text);
  border-radius: 14px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}
.wms-lb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.wms-lb-head small { display: block; color: var(--muted); font-size: 12px; }
.wms-lb-body {
  position: relative;
  flex: 1;
  min-height: 240px;
  background: #0b1020;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 10px;
}
.wms-lb-body img {
  max-width: 100%;
  max-height: 76dvh;
  border-radius: 6px;
  object-fit: contain;
}
.wms-lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 0;
  background: rgba(15, 23, 42, 0.72);
  color: #ffffff;
  font-size: 24px;
  cursor: pointer;
}
.wms-lb-nav.is-prev { left: 10px; }
.wms-lb-nav.is-next { right: 10px; }

@media (max-width: 1120px) {
  .wms-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wms-form-grid, .wms-market-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wms-grid-2 { grid-template-columns: minmax(0, 1fr); }
  .wms-mode-bar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  body { -webkit-tap-highlight-color: transparent; }
  .wms-shell, body.wms-sidebar-collapsed .wms-shell { grid-template-columns: minmax(0, 1fr); }
  .wms-sidebar-collapse-btn { display: none !important; }
  .wms-menu-toggle { display: inline-grid !important; }
  .wms-top-action { display: none !important; }
  .wms-topbar { padding: 10px 14px; }
  .wms-topbar h2 { font-size: 16.5px; }
  .wms-topbar p { display: none; }
  body.wms-sidebar-collapsed .wms-sidebar {
    padding: 16px 14px;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    opacity: 1;
    pointer-events: auto;
  }
  .wms-sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: min(82vw, 290px);
    height: 100dvh;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 12px 0 32px rgba(0, 0, 0, 0.28);
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }
  .wms-sidebar.is-open { transform: translateX(0); }
  .wms-menu-toggle { display: inline-flex; min-height: 38px; padding: 6px 11px; }

  /* Compact single-row mobile topbar */
  .wms-topbar {
    padding: 10px 14px;
    padding-top: max(10px, env(safe-area-inset-top));
    gap: 8px;
    flex-wrap: nowrap;
  }
  .wms-topbar-left { min-width: 0; gap: 8px; }
  .wms-topbar h2 { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .wms-topbar p { display: none; }
  .wms-topbar-right { gap: 6px; flex-wrap: nowrap; flex-shrink: 0; }
  #top-photo-in, #top-photo-out, #top-ai-btn, #top-sync-btn { display: none; }
  #top-create-btn, #theme-toggle { min-height: 38px; padding: 7px 11px; font-size: 13.5px; }

  /* Content padding leaves room for fixed bottom tab bar */
  .wms-content {
    padding: 12px 12px calc(86px + env(safe-area-inset-bottom));
    gap: 12px;
  }
  .wms-panel { padding: 14px 12px; border-radius: 14px; }
  .wms-panel h3 { font-size: 16px; }
  .wms-sub { font-size: 13px; margin-bottom: 10px; }

  /* Prevent iOS Safari auto-zoom on form inputs */
  input, select, textarea { font-size: 16px; min-height: 44px; }

  /* Compact 2x2 KPI cards on phone */
  .wms-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .wms-kpi { padding: 12px; gap: 10px; border-radius: 13px; }
  .wms-kpi-icon { width: 36px; height: 36px; font-size: 16px; border-radius: 10px; }
  .wms-kpi-body > span { font-size: 12px; }
  .wms-kpi-body > strong { font-size: 19px; }
  .wms-kpi-body > small { font-size: 11.5px; line-height: 1.3; }

  /* Swipeable single-row category pills */
  .wms-cat-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    margin-bottom: 10px;
  }
  .wms-cat-bar::-webkit-scrollbar { display: none; }
  .wms-cat-pill { flex-shrink: 0; min-height: 36px; padding: 5px 11px; font-size: 13px; }

  /* Forms stack cleanly */
  .wms-form-grid, .wms-market-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .wms-search-form { gap: 8px; }
  .wms-search-form label { flex: 1 1 140px; }
  .wms-search-form .wms-grow { flex: 1 1 100%; min-width: 0; }
  .wms-meta-bar { padding: 10px; gap: 8px; }
  .wms-meta-bar label { flex: 1 1 44%; min-width: 130px; }
  .wms-meta-bar .wms-grow { flex: 1 1 100%; }

  /* Clean decluttered mobile photo entry */
  .wms-desktop-only { display: none !important; }
  .wms-mobile-only { display: inline-flex; }
  .wms-mobile-mode-bar {
    display: grid;
    grid-template-columns: 1fr 1fr 0.9fr;
    gap: 8px;
    margin-bottom: 10px;
  }
  .wms-mmode-btn {
    min-height: 40px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: var(--surface-soft);
    color: var(--text);
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
  }
  .wms-mmode-btn.is-active.is-in { border-color: #10b981; background: rgba(16, 185, 129, 0.13); color: #059669; }
  .wms-mmode-btn.is-active.is-out { border-color: #f43f5e; background: rgba(244, 63, 94, 0.11); color: #be123c; }
  .wms-mmode-select {
    min-height: 40px !important;
    padding: 4px 8px !important;
    font-size: 13.5px !important;
    font-weight: 700;
  }
  .wms-scan-cta-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
  }
  [data-ocr-pick="camera"] {
    min-height: 50px;
    font-size: 16px;
    border-radius: 12px;
  }
  [data-ocr-pick="upload"] {
    min-height: 50px;
    padding: 0 14px;
    border-radius: 12px;
  }
  .wms-entry-scan-panel { padding: 12px; }
  .wms-entry-draft-panel { padding: 12px; }
  .wms-quick-team-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .wms-quick-team-bar::-webkit-scrollbar { display: none; }
  .wms-quick-team-bar .wms-btn-chip { flex-shrink: 0; }
  .wms-essential-bar { gap: 8px; margin-bottom: 10px; }
  .wms-essential-bar input { min-height: 40px; padding: 6px 10px; }
  [data-save-draft] {
    width: 100%;
    min-height: 50px;
    font-size: 16px;
    border-radius: 12px;
  }
  .wms-export-bar { flex-direction: column; align-items: stretch; gap: 10px; }
  .wms-export-bar .wms-actions { width: 100%; flex-direction: column; }
  .wms-export-bar .wms-actions button { width: 100%; min-height: 44px; }

  /* Smooth touch table scroll for secondary tables */
  .wms-table-wrap { -webkit-overflow-scrolling: touch; }

  /* Card-mode layout for Draft Edit Table on mobile (zero horizontal dragging!) */
  .wms-edit-wrap { border: 0; overflow: visible; }
  .wms-edit-table { min-width: 0 !important; display: block; }
  .wms-edit-table thead { display: none; }
  .wms-edit-table tbody { display: flex; flex-direction: column; gap: 12px; }
  .wms-edit-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 10px;
    padding: 12px;
    border-radius: 14px;
    border: 1.5px solid var(--border);
    background: var(--surface-soft);
  }
  .wms-edit-table tbody tr.is-alert-row { border-color: #ef4444; background: rgba(239, 68, 68, 0.05); }
  .wms-edit-table tbody tr.is-alert-row td:first-child { box-shadow: none; }
  .wms-edit-table tbody td {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0;
    border: 0;
  }
  .wms-edit-table tbody td::before {
    content: attr(data-label);
    font-size: 11.5px;
    font-weight: 700;
    color: var(--muted);
  }
  .wms-edit-table tbody td.is-mfull { grid-column: 1 / -1; }
  .wms-edit-table tbody td.is-mhead {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 6px;
    border-bottom: 1px dashed var(--border);
  }
  .wms-edit-table tbody td.is-mhead::before { content: "明细 #" attr(data-row-num); font-size: 13px; color: var(--primary); }
  .wms-edit-table tbody td.is-mdel { grid-column: 1 / -1; align-items: flex-end; }
  .wms-edit-table tbody td.is-mdel::before { display: none; }
  .wms-edit-table input, .wms-edit-table select { min-height: 42px; padding: 7px 10px; font-size: 16px; }

  /* Card-mode layout for Material Ledger Table on mobile */
  .wms-materials-wrap { border: 0; overflow: visible; }
  .wms-materials-table { min-width: 0 !important; display: block; }
  .wms-materials-table thead { display: none; }
  .wms-materials-table tbody { display: flex; flex-direction: column; gap: 10px; }
  .wms-materials-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 10px;
    padding: 12px;
    border-radius: 14px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
  }
  .wms-materials-table tbody tr.is-alert-row { border-left: 4px solid #ef4444; }
  .wms-materials-table tbody tr.is-alert-row td:first-child { box-shadow: none; }
  .wms-materials-table tbody td {
    padding: 0;
    border: 0;
    text-align: left !important;
    white-space: normal !important;
  }
  .wms-materials-table tbody td:nth-child(1) { grid-column: 1 / -1; font-size: 15.5px; }
  .wms-materials-table tbody td:nth-child(2) { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .wms-materials-table tbody td:nth-child(2) small { margin-top: 0; }
  .wms-materials-table tbody td:nth-child(4) .wms-meter { margin-left: 0; width: 100%; }
  .wms-materials-table tbody td:nth-child(8) {
    grid-column: 1 / -1;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
  }
  .wms-materials-table tbody td:nth-child(8) .wms-actions { gap: 6px; }
  .wms-materials-table tbody td:nth-child(8) .wms-btn-chip { flex: 1 1 auto; min-height: 38px; text-align: center; justify-content: center; }

  /* AI chat mobile sizing */
  .wms-ai-log { max-height: 52dvh; }
  .wms-ai-input-form { flex-direction: row; gap: 8px; }
  .wms-ai-input-form button { min-height: 44px; padding: 0 16px; }

  /* Fixed Mobile Bottom Tabbar (auto-balanced flex for RBAC-filtered tabs) */
  .wms-mobile-tabbar {
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 30;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 6px 2px max(6px, env(safe-area-inset-bottom));
    box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.08);
  }
  .wms-mtab {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-family: inherit;
    padding: 4px 2px;
    border-radius: 10px;
    cursor: pointer;
  }
  .wms-mtab[hidden] { display: none !important; }
  .wms-mtab span { font-size: 19px; line-height: 1.1; }
  .wms-mtab b { font-size: 11px; font-weight: 700; }
  .wms-mtab.is-active { color: var(--primary); background: rgba(36, 87, 214, 0.09); }
  .wms-mtab.is-rack.is-active { color: #d97706; background: rgba(217, 119, 6, 0.12); }
  .wms-mtab.is-in.is-active { color: #059669; background: rgba(16, 185, 129, 0.12); }
  .wms-mtab.is-out.is-active { color: #e11d48; background: rgba(225, 29, 72, 0.11); }

  /* Keep toast above bottom tabbar */
  .wms-toast {
    left: 12px; right: 12px;
    bottom: calc(74px + env(safe-area-inset-bottom));
    max-width: none;
    text-align: center;
  }
}

/* AI 3.0 Enhanced Workbench Styles */
.wms-ai-md-table-wrap { overflow-x: auto; margin: 8px 0; border-radius: 10px; border: 1px solid var(--border); }
.wms-ai-md-table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--surface); }
.wms-ai-md-table th, .wms-ai-md-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.wms-ai-md-table th { background: var(--surface-soft); font-weight: 800; font-size: 12px; white-space: nowrap; }
.wms-ai-quote { margin: 6px 0; padding: 6px 10px; border-left: 3px solid var(--primary); background: rgba(36, 87, 214, 0.06); border-radius: 0 8px 8px 0; font-size: 13.5px; }
.wms-ai-msg-meta { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.wms-ai-copy-btn { border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 7px; padding: 2px 8px; font-size: 11.5px; font-weight: 700; cursor: pointer; }
.wms-ai-copy-btn:hover { color: var(--primary); border-color: var(--primary); }
.wms-ai-action-desc { font-size: 13.5px; margin: 4px 0 8px; }
.wms-ai-done-tag { margin-top: 6px; }
.wms-ai-followups { margin-top: 8px; }
.wms-ai-rtabs { margin-bottom: 12px; }
.wms-grid-compact-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wms-ai-form-btns { margin-top: 10px; }
.wms-ai-quote-res { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.wms-ai-quote-sum { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-bottom: 0; font-size: 13px; }
.wms-ai-tier-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 680px) { .wms-ai-tier-grid { grid-template-columns: 1fr; } }
.wms-ai-tier { padding: 10px; border-radius: 10px; background: var(--surface-soft); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.wms-ai-tier span { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.wms-ai-tier strong { font-size: 16px; color: var(--primary); font-variant-numeric: tabular-nums; }
.wms-ai-tier small { font-size: 11.5px; color: var(--muted); }
.wms-ai-score-title { font-size: 16px; font-weight: 800; }
.wms-ai-score-sub { color: var(--muted); }
.wms-ai-eq-strip { margin-top: 5px; font-size: 12px; font-weight: 700; color: #0e7490; }
body[data-theme="dark"] .wms-ai-eq-strip { color: #38bdf8; }
.wms-ai-voice-btn.is-listening { background: #ffe4e6; border-color: #dc2626; animation: wmsVoicePulse 1s infinite; }
@keyframes wmsVoicePulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* AI 5.0 Streaming, Web Sources, Attachment & CSP-clean Helpers */
.wms-hidden { display: none !important; }
.wms-ai-check-row { flex-direction: row !important; align-items: center !important; gap: 8px; padding-top: 22px; }
.wms-ai-cfg-actions { margin-top: 14px; }
.wms-ai-stream-status { font-size: 12px; font-weight: 700; color: var(--primary); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.wms-ai-msg.is-streaming { border-color: rgba(36, 87, 214, 0.45); box-shadow: 0 0 0 2px rgba(36, 87, 214, 0.08); }
.wms-ai-sources { margin-top: 8px; padding: 8px 10px; border-radius: 9px; background: var(--surface-soft); border: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 12px; }
.wms-ai-sources-title { font-weight: 800; color: var(--muted); }
.wms-ai-source-link { color: var(--primary); text-decoration: none; font-weight: 600; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wms-ai-source-link:hover { text-decoration: underline; }
.wms-ai-att-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 12px; margin-bottom: 8px; border-radius: 10px; background: rgba(36, 87, 214, 0.08); border: 1px dashed rgba(36, 87, 214, 0.35); font-size: 12.5px; }
.wms-ai-att-badge { font-size: 11.5px; font-weight: 700; opacity: 0.9; margin-bottom: 4px; }
.wms-btn-danger { min-height: 40px; padding: 0 16px; border: 0; border-radius: 11px; background: #dc2626; color: #fff; font-weight: 700; cursor: pointer; }
.wms-btn-danger:hover { background: #b91c1c; }

/* Workshop PIN Unlock Portal (Modeled after Data Platform 4173 dataos-v4) */
.wms-top-user { font-size: 13px; padding: 0 12px; white-space: nowrap; }
body.wms-auth-locked .wms-sidebar,
body.wms-auth-locked .wms-topbar,
body.wms-auth-locked .wms-mobile-tabbar,
body.wms-auth-locked .wms-backdrop { display: none !important; }
body.wms-auth-locked .wms-shell { display: block; min-height: 100dvh; }
body.wms-auth-locked .wms-main { margin-left: 0 !important; min-height: 100dvh; }
body.wms-auth-locked .wms-content { padding: 0 !important; max-width: none !important; margin: 0 !important; min-height: 100dvh; }

.wms-login-screen {
  position: relative;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 56px max(5vw, 24px);
  background:
    radial-gradient(circle at 12% 18%, #dce9ff 0%, transparent 45%),
    radial-gradient(circle at 88% 82%, #d9f3ef 0%, transparent 42%),
    #f3f6fb;
  color: #0f172a;
  overflow: hidden;
}
body[data-theme="dark"] .wms-login-screen {
  background:
    radial-gradient(ellipse at 14% 12%, rgba(45, 96, 178, 0.42) 0%, transparent 52%),
    radial-gradient(ellipse at 86% 84%, rgba(13, 148, 136, 0.24) 0%, transparent 48%),
    linear-gradient(145deg, #10243d 0%, #091525 100%);
  color: #f1f5f9;
}
.wms-login-inner {
  width: min(1140px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.88fr);
  align-items: center;
  gap: clamp(32px, 6vw, 76px);
}
.wms-login-brand { position: relative; z-index: 1; max-width: 600px; }
.wms-login-brand-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 26px; }
.wms-login-emblem {
  position: relative;
  display: inline-grid;
  place-content: center;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2457d6, #0d9488);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 14px 32px rgba(36, 87, 214, 0.28);
  color: #ffffff;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.04em;
}
.wms-login-emblem span { position: absolute; right: 6px; top: 4px; font-size: 13px; font-weight: 800; opacity: 0.92; }
.wms-login-theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #d5e0f0;
  background: rgba(255, 255, 255, 0.78);
  color: #334155;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.wms-login-theme-btn:hover { background: #ffffff; border-color: #93b4f0; color: #1d4ed8; }
body[data-theme="dark"] .wms-login-theme-btn {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(148, 163, 184, 0.28);
  color: #cbd5e1;
}
.wms-login-kicker {
  display: inline-block;
  margin-bottom: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #e6efff;
  color: #2457d6;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
body[data-theme="dark"] .wms-login-kicker {
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
  border: 1px solid rgba(147, 197, 253, 0.25);
}
.wms-login-brand h1 {
  margin: 0 0 16px;
  font-size: clamp(34px, 3.4vw, 52px);
  line-height: 1.18;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #0f172a;
}
body[data-theme="dark"] .wms-login-brand h1 { color: #f8fafc; }
.wms-login-desc {
  margin: 0;
  max-width: 500px;
  font-size: 15.5px;
  line-height: 1.75;
  color: #475569;
}
body[data-theme="dark"] .wms-login-desc { color: #b6cbe3; }
.wms-login-pillars { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 22px; }
.wms-login-pillars span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid #dfe5f0;
  color: #334155;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}
.wms-login-pillars b { color: #2457d6; font-weight: 800; letter-spacing: 0.02em; }
body[data-theme="dark"] .wms-login-pillars span {
  background: rgba(15, 23, 42, 0.56);
  border-color: rgba(148, 163, 184, 0.22);
  color: #dbeafe;
}
body[data-theme="dark"] .wms-login-pillars b { color: #60a5fa; }

.wms-login-glass-art { position: relative; width: 300px; height: 108px; margin-top: 28px; pointer-events: none; }
.wms-login-glass-art i {
  position: absolute;
  left: 16px;
  top: 8px;
  width: 165px;
  height: 64px;
  transform: skewY(-16deg) rotate(9deg);
  border-radius: 8px;
  border: 1px solid rgba(37, 86, 198, 0.24);
  background: linear-gradient(150deg, rgba(37, 86, 198, 0.14), rgba(13, 148, 136, 0.10));
  box-shadow: 6px 12px 24px rgba(15, 23, 42, 0.06);
}
.wms-login-glass-art i:nth-child(2) { left: 58px; top: 22px; border-color: rgba(13, 148, 136, 0.26); }
.wms-login-glass-art i:nth-child(3) { left: 100px; top: 36px; border-color: rgba(37, 86, 198, 0.28); }
body[data-theme="dark"] .wms-login-glass-art i {
  background: linear-gradient(156deg, rgba(121, 178, 253, 0.24), rgba(91, 225, 193, 0.12));
  border-color: rgba(160, 201, 247, 0.42);
}

.wms-login-card {
  position: relative;
  z-index: 1;
  width: min(470px, 100%);
  justify-self: center;
  background: #ffffff;
  border: 1px solid #dbe4f2;
  border-radius: 18px;
  padding: 32px 30px 26px;
  box-shadow: 0 20px 54px rgba(15, 23, 42, 0.10);
  display: flex;
  flex-direction: column;
  gap: 15px;
}
body[data-theme="dark"] .wms-login-card {
  background: rgba(15, 23, 42, 0.90);
  border-color: rgba(148, 163, 184, 0.22);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.42);
}
.wms-login-card-head h2 { margin: 0 0 6px; font-size: 24px; font-weight: 800; color: #0f172a; letter-spacing: -0.02em; }
body[data-theme="dark"] .wms-login-card-head h2 { color: #f8fafc; }
.wms-login-status {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #64748b;
}
body[data-theme="dark"] .wms-login-status { color: #94a3b8; }
.wms-login-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.16);
  flex-shrink: 0;
}
.wms-login-form { display: flex; flex-direction: column; gap: 14px; }
.wms-login-field { display: flex; flex-direction: column; gap: 7px; margin: 0; }
.wms-login-label { font-size: 13px; font-weight: 650; color: #334155; }
body[data-theme="dark"] .wms-login-label { color: #cbd5e1; }
.wms-login-form input {
  min-height: 44px;
  padding: 0 13px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
  font-size: 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.wms-login-form input:focus {
  outline: none;
  background: #ffffff;
  border-color: #2457d6;
  box-shadow: 0 0 0 3px rgba(36, 87, 214, 0.16);
}
body[data-theme="dark"] .wms-login-form input {
  background: #0f172a;
  border-color: #334155;
  color: #f8fafc;
}
body[data-theme="dark"] .wms-login-form input:focus {
  background: #111f36;
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.22);
}
.wms-login-pin-wrap { position: relative; display: flex; align-items: center; }
.wms-login-pin-wrap input { width: 100%; padding-right: 44px; }
.wms-login-pin-eye {
  position: absolute;
  right: 6px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.wms-login-pin-eye:hover { background: rgba(148, 163, 184, 0.15); }
.wms-login-submit {
  width: 100%;
  min-height: 46px;
  margin-top: 4px;
  border-radius: 11px;
  font-size: 15px;
  font-weight: 700;
  background: linear-gradient(135deg, #2457d6, #1d4ed8);
  box-shadow: 0 10px 24px rgba(36, 87, 214, 0.26);
}
.wms-login-submit:hover:not(:disabled) { filter: brightness(1.06); transform: translateY(-1px); }
.wms-login-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid #e8eef6;
  font-size: 12px;
  line-height: 1.6;
  color: #64748b;
}
body[data-theme="dark"] .wms-login-foot { border-top-color: rgba(148, 163, 184, 0.18); color: #94a3b8; }
.wms-login-foot a { color: #2457d6; font-weight: 650; text-decoration: none; white-space: nowrap; }
.wms-login-foot a:hover { text-decoration: underline; }
body[data-theme="dark"] .wms-login-foot a { color: #60a5fa; }

.wms-auth-ops { display: flex; flex-wrap: wrap; gap: 7px; }
.wms-auth-hint { padding: 9px 12px; border-radius: 10px; background: rgba(36, 87, 214, 0.08); border: 1px solid rgba(36, 87, 214, 0.2); font-size: 12.5px; color: var(--text); }
.wms-auth-err { padding: 9px 12px; border-radius: 10px; background: rgba(220, 38, 38, 0.09); border: 1px solid rgba(220, 38, 38, 0.32); font-size: 13px; font-weight: 700; color: #dc2626; }
.wms-auth-modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(4px); z-index: 90; display: grid; place-items: center; padding: 16px; }
.wms-auth-modal { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 20px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25); display: flex; flex-direction: column; gap: 14px; }
.wms-auth-divider { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }

@media (max-width: 920px) {
  .wms-login-inner { grid-template-columns: 1fr; gap: 24px; max-width: 560px; }
  .wms-login-brand { max-width: none; }
  .wms-login-glass-art { display: none; }
  .wms-login-card { width: 100%; }
}
@media (max-width: 760px) {
  .wms-login-screen { padding: 20px 14px 32px; align-content: start; }
  .wms-login-brand-top { margin-bottom: 14px; }
  .wms-login-emblem { width: 46px; height: 46px; font-size: 20px; border-radius: 12px; }
  .wms-login-kicker { margin-bottom: 8px; font-size: 11px; }
  .wms-login-brand h1 { font-size: 28px; line-height: 1.18; margin-bottom: 8px; }
  .wms-login-desc { font-size: 13.5px; line-height: 1.6; }
  .wms-login-pillars { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
  .wms-login-pillars span { padding: 6px 10px; font-size: 12px; }
  .wms-login-card { padding: 22px 18px 20px; border-radius: 16px; }
  .wms-login-card-head h2 { font-size: 21px; }
  .wms-login-form input { font-size: 16px; }
}

/* RBAC User & Permission Management UI */
.wms-users-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.wms-users-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}
.wms-users-tab {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}
.wms-users-tab.is-active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}
.wms-users-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.wms-users-toolbar input { flex: 1 1 240px; min-height: 40px; }
.wms-users-toolbar select { flex: 0 0 180px; min-height: 40px; }
.wms-perm-chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.wms-pill.is-blue { background: rgba(36, 87, 214, 0.12); color: #1d4ed8; border: 1px solid rgba(36, 87, 214, 0.25); }
.wms-pill.is-teal { background: rgba(13, 148, 136, 0.12); color: #0f766e; border: 1px solid rgba(13, 148, 136, 0.25); }
.wms-pill.is-purple { background: rgba(124, 58, 237, 0.12); color: #6d28d9; border: 1px solid rgba(124, 58, 237, 0.25); }
body[data-theme="dark"] .wms-pill.is-blue { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
body[data-theme="dark"] .wms-pill.is-teal { background: rgba(20, 184, 166, 0.2); color: #5eead4; }
body[data-theme="dark"] .wms-pill.is-purple { background: rgba(139, 92, 246, 0.2); color: #c4b5fd; }
.wms-users-table tr.is-user-disabled { opacity: 0.62; }
.wms-users-table td small { display: block; color: var(--muted); margin-top: 2px; font-size: 12px; }
.wms-user-editor-modal { width: min(760px, 100%); max-height: 90dvh; overflow-y: auto; }
.wms-user-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.wms-role-preset-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.wms-role-preset-btn {
  text-align: left;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.wms-role-preset-btn strong { font-size: 13.5px; }
.wms-role-preset-btn small { font-size: 11.5px; line-height: 1.45; color: var(--muted); }
.wms-role-preset-btn:hover { border-color: #60a5fa; }
.wms-role-preset-btn.is-active {
  background: rgba(36, 87, 214, 0.1);
  border-color: #2457d6;
  box-shadow: 0 0 0 2px rgba(36, 87, 214, 0.14);
}
.wms-perm-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 8px; }
.wms-perm-group-card {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}
.wms-perm-group-title { font-size: 12.5px; font-weight: 800; color: var(--muted); margin-bottom: 8px; letter-spacing: 0.03em; }
.wms-perm-check-list { display: flex; flex-direction: column; gap: 8px; }
.wms-perm-check-item {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  gap: 8px !important;
  margin: 0 !important;
  cursor: pointer;
}
.wms-perm-check-item input[type="checkbox"] { width: 17px; height: 17px; margin: 2px 0 0; flex-shrink: 0; accent-color: #2457d6; }
.wms-perm-check-item span { display: flex; flex-direction: column; gap: 2px; }
.wms-perm-check-item b { font-size: 13px; color: var(--text); }
.wms-perm-check-item small { font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.wms-btn-chip.is-warn { border-color: rgba(217, 119, 6, 0.35); color: #b45309; background: rgba(245, 158, 11, 0.1); }
.wms-btn-chip.is-ok { border-color: rgba(16, 185, 129, 0.35); color: #047857; background: rgba(16, 185, 129, 0.1); }

@media (max-width: 860px) {
  .wms-top-user {
    max-width: 116px;
    min-height: 36px;
    padding: 0 9px;
    font-size: 12.5px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .wms-top-user-role { display: none; }
}

@media (max-width: 720px) {
  /* Compact above-the-fold login portal for phones & WeChat WebView */
  .wms-login-screen { padding: 14px 12px 24px; }
  .wms-login-inner { gap: 14px; }
  .wms-login-brand-top { margin-bottom: 10px; }
  .wms-login-emblem { width: 42px; height: 42px; font-size: 18px; border-radius: 11px; }
  .wms-login-brand h1 { font-size: 24px; margin-bottom: 6px; }
  .wms-login-desc { font-size: 13px; line-height: 1.5; }
  .wms-login-pillars { gap: 6px; margin-top: 10px; }
  .wms-login-pillars span { padding: 5px 8px; font-size: 11.5px; }
  .wms-login-card { padding: 18px 16px 16px; gap: 12px; }
  .wms-login-card-head h2 { font-size: 19px; }

  /* Mobile bottom-sheet modals for auth & RBAC editor */
  .wms-auth-modal-bg {
    align-items: end;
    padding: 0;
  }
  .wms-auth-modal,
  .wms-user-editor-modal {
    width: 100%;
    max-height: 92dvh;
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
    padding: 18px 16px max(22px, env(safe-area-inset-bottom));
    border-bottom: 0;
  }
  .wms-auth-modal .wms-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .wms-auth-modal .wms-actions button { width: 100%; min-height: 44px; justify-content: center; }

  /* RBAC page mobile layout */
  .wms-users-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .wms-users-tabs { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .wms-users-tab { min-height: 40px; padding: 0 8px; font-size: 13px; }
  .wms-users-head-actions button { width: 100%; min-height: 42px; justify-content: center; }
  .wms-users-toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .wms-users-toolbar input,
  .wms-users-toolbar select { flex: 1 1 auto; width: 100%; min-height: 44px; font-size: 16px; }

  .wms-user-form-grid,
  .wms-role-preset-grid,
  .wms-perm-groups { grid-template-columns: 1fr; }
  .wms-perm-check-item input[type="checkbox"] { width: 20px; height: 20px; }

  .wms-users-table thead { display: none; }
  .wms-users-table,
  .wms-users-table tbody,
  .wms-users-table tr,
  .wms-users-table td { display: block; width: 100%; }
  .wms-users-table tr {
    margin-bottom: 12px;
    padding: 12px 13px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
  }
  .wms-users-table td {
    padding: 6px 0 !important;
    border: 0 !important;
    text-align: left !important;
  }
  .wms-users-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 4px;
  }
  .wms-user-row-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 4px;
  }
  .wms-user-row-actions .wms-btn-chip {
    min-height: 38px;
    justify-content: center;
    text-align: center;
    width: 100%;
  }
}

/* CSP-safe native progress bars & utility classes */
.wms-batch-progress, .wms-cost-progress { width: 100%; height: 10px; border-radius: 999px; overflow: hidden; border: 0; background: var(--surface-soft); appearance: none; }
.wms-batch-progress::-webkit-progress-bar, .wms-cost-progress::-webkit-progress-bar { background: var(--surface-soft); border-radius: 999px; }
.wms-batch-progress::-webkit-progress-value { background: linear-gradient(90deg, #2457d6, #0d9488); border-radius: 999px; }
.wms-cost-progress::-webkit-progress-value { background: linear-gradient(90deg, #2457d6, #4f46e5); border-radius: 999px; }
.wms-meter-bar { display: block; width: 100%; height: 6px; margin-top: 4px; border-radius: 999px; overflow: hidden; border: 0; background: var(--surface-soft); appearance: none; }
.wms-meter-bar::-webkit-progress-bar { background: var(--surface-soft); border-radius: 999px; }
.wms-meter-bar.is-emerald::-webkit-progress-value { background: var(--emerald); border-radius: 999px; }
.wms-meter-bar.is-amber::-webkit-progress-value { background: var(--amber); border-radius: 999px; }
.wms-meter-bar.is-coral::-webkit-progress-value { background: var(--coral); border-radius: 999px; }
.wms-verify-strip.is-ok { border-color: var(--emerald); }
.wms-verify-strip.is-warn { border-color: var(--amber); }
.wms-mt-8 { margin-top: 8px; }
.wms-mt-12 { margin-top: 12px; }
.wms-mt-14 { margin-top: 14px; }
.wms-mb-0 { margin-bottom: 0; }
.wms-mb-8 { margin-bottom: 8px; }
.wms-mb-10 { margin-bottom: 10px; }
.wms-mb-12 { margin-bottom: 12px; }
.wms-mb-14 { margin-bottom: 14px; }
.wms-muted { color: var(--muted); }
.wms-fw-700 { font-weight: 700; }
.wms-fw-800 { font-weight: 800; }
.wms-fs-13 { font-size: 13px; }
.wms-fs-14 { font-size: 14px; }
.wms-strip-block { display: block; }
.wms-strip-between { justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.wms-table-scroll-240 { max-height: 240px; overflow-y: auto; }
.wms-table-min-340 { min-width: 340px; }
.wms-table-min-420 { min-width: 420px; }
.wms-table-min-460 { min-width: 460px; }
.wms-inline-field { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.wms-inp-88 { width: 88px !important; padding: 4px 8px !important; min-height: 32px !important; }
.wms-inp-102 { width: 102px !important; padding: 4px 8px !important; min-height: 32px !important; }
.wms-num-right { text-align: right; font-variant-numeric: tabular-nums; }
.wms-col-40 { width: 40px; }
.wms-col-90 { width: 90px; }
.wms-col-116 { width: 116px; }
.wms-col-140 { width: 140px; }
.wms-col-150 { width: 150px; }
.wms-col-170 { width: 170px; }
.wms-ocr-engine-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 10px; border-radius: 11px; background: rgba(36, 87, 214, 0.06); border: 1px solid rgba(36, 87, 214, 0.22); font-size: 13px; }
.wms-ocr-engine-pill { color: var(--text); }

/* AI 7.0 Workshop Mobile & Editorial Reading Polish */
.wms-ai-mobile-seg {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  margin-bottom: 10px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.wms-ai-mobile-seg button {
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}
.wms-ai-mobile-seg button.is-active {
  background: linear-gradient(135deg, #2457d6, #3b82f6);
  color: #ffffff;
  box-shadow: 0 4px 12px -4px rgba(36, 87, 214, 0.45);
}
.wms-ai-chips .wms-btn-chip.is-highlight {
  background: rgba(36, 87, 214, 0.1);
  border-color: rgba(36, 87, 214, 0.35);
  color: var(--primary);
  font-weight: 700;
}
.wms-ai-msg.is-assistant {
  max-width: 100%;
  border-radius: 15px;
  padding: 13px 15px;
  box-shadow: 0 3px 12px -8px rgba(15, 23, 42, 0.14);
}
.wms-ai-msg h2, .wms-ai-msg h3 {
  margin: 10px 0 6px;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
}
.wms-ai-msg h3 {
  padding-left: 8px;
  border-left: 3px solid var(--primary);
}
.wms-ai-md-table-wrap { -webkit-overflow-scrolling: touch; max-width: 100%; }
.wms-ai-md-table tbody tr:nth-child(even) { background: rgba(36, 87, 214, 0.03); }

@media (max-width: 960px) {
  .wms-ai-mobile-seg { display: grid; }
  .wms-ai-grid.is-mpane-chat .wms-ai-tools-panel { display: none; }
  .wms-ai-grid.is-mpane-tools .wms-ai-chat-panel { display: none; }
}
@media (max-width: 768px) {
  .wms-ai-chat-panel { padding: 12px !important; }
  .wms-ai-chat-panel .wms-row-between { gap: 8px; flex-wrap: wrap; }
  .wms-ai-chat-panel h3 { font-size: 15px; margin: 0; }
  .wms-ai-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    margin-bottom: 10px;
  }
  .wms-ai-chips::-webkit-scrollbar { display: none; }
  .wms-ai-chips .wms-btn-chip { flex-shrink: 0; min-height: 34px; font-size: 12.5px; }
  .wms-ai-chat-log {
    min-height: 44dvh;
    max-height: calc(100dvh - 330px);
    padding: 10px;
    gap: 10px;
    overscroll-behavior: contain;
  }
  .wms-ai-msg { padding: 10px 12px; font-size: 14px; line-height: 1.6; }
  .wms-ai-msg.is-user { max-width: 88%; }
  .wms-ai-md-table { min-width: 420px; font-size: 12px; }
  .wms-ai-md-table th, .wms-ai-md-table td { padding: 6px 8px; }
  .wms-ai-followups { flex-direction: column; align-items: stretch; gap: 6px; }
  .wms-ai-followups .wms-btn-chip { text-align: left; justify-content: flex-start; min-height: 36px; font-size: 12.5px; }
  .wms-ai-input-form {
    gap: 6px;
    padding: 6px;
    border-radius: 14px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
  }
  .wms-ai-input-form input {
    font-size: 16px !important;
    min-height: 40px !important;
    border: 0 !important;
    background: transparent !important;
    padding: 4px 6px !important;
  }
  .wms-ai-input-form .wms-icon-btn { width: 38px; min-width: 38px; height: 38px; min-height: 38px; padding: 0; border-radius: 10px; }
  .wms-ai-input-form .wms-btn-primary,
  .wms-ai-input-form .wms-btn-danger { min-height: 38px; padding: 0 14px; border-radius: 10px; font-size: 13.5px; flex-shrink: 0; }
}

/* Handwritten Slip Workbench, Proof Viewer, Draft Queue, Alias Dictionary & Electronic Voucher */
.wms-sr-copy-ta { position: fixed; top: -9999px; left: -9999px; opacity: 0; }
.wms-col-idx { width: 40px; }
.wms-col-code { width: 116px; }
.wms-col-stock { width: 112px; }
.wms-col-mfr { width: 105px; }
.wms-col-qty { width: 92px; }
.wms-col-unit { width: 74px; }
.wms-col-price { width: 104px; }
.wms-col-area { width: 96px; }
.wms-col-del { width: 56px; }
.wms-over-stock { color: #be123c; font-weight: 700; display: block; }
.wms-freight-strip { margin-bottom: 0; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.wms-freight-inputs { gap: 10px; align-items: center; }
.wms-inline-input { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; margin: 0; }
.wms-inline-input input { width: 92px; padding: 4px 8px; }
.wms-mov-doc-btns { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }

.wms-entry-subtabs {
  display: inline-flex;
  gap: 6px;
  padding: 5px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  width: fit-content;
}
.wms-entry-subtab {
  min-height: 38px;
  padding: 0 15px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.wms-entry-subtab b {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(217, 119, 6, 0.16);
  color: #b45309;
  font-size: 11.5px;
}
.wms-entry-subtab.is-active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(36, 87, 214, 0.24);
}
.wms-entry-subtab.is-active b {
  background: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}

.wms-spoken-hint-bar {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(36, 87, 214, 0.05);
  border: 1px dashed rgba(36, 87, 214, 0.28);
}
.wms-spoken-hint-field { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.wms-spoken-hint-field > span { font-size: 12.5px; font-weight: 700; color: var(--primary); }
.wms-spoken-hint-row { display: flex; gap: 8px; align-items: center; }
.wms-spoken-hint-row input { flex: 1 1 auto; min-height: 40px; }
.wms-spoken-hint-row button { flex-shrink: 0; min-height: 40px; white-space: nowrap; }

.wms-proof-viewer {
  margin-top: 12px;
  border-radius: 14px;
  border: 1px solid rgba(36, 87, 214, 0.26);
  background: var(--surface-soft);
  overflow: hidden;
}
.wms-proof-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 12px;
  background: rgba(36, 87, 214, 0.06);
  border-bottom: 1px solid var(--border);
}
.wms-proof-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; }
.wms-proof-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wms-proof-stage {
  max-height: 320px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px;
  background: #0f172a10;
  text-align: center;
}
.wms-proof-img {
  display: inline-block;
  border-radius: 8px;
  cursor: zoom-in;
  transition: width 0.18s ease;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.14);
}
.wms-proof-img.is-zoom-1 { width: min(100%, 560px); height: auto; }
.wms-proof-img.is-zoom-2 { width: 175%; max-width: none; height: auto; cursor: zoom-in; }
.wms-proof-img.is-zoom-3 { width: 250%; max-width: none; height: auto; cursor: zoom-out; }
.wms-proof-thumbs { padding: 8px 10px; border-top: 1px solid var(--border); background: var(--surface); }
.wms-att-thumb.is-active { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(36, 87, 214, 0.22); }

/* Handwriting confidence row highlights & 1-tap candidate chips */
.wms-edit-table tbody tr.is-conf-low { background: rgba(225, 29, 72, 0.06); }
.wms-edit-table tbody tr.is-conf-low td:first-child { box-shadow: inset 4px 0 0 #e11d48; }
.wms-edit-table tbody tr.is-conf-med { background: rgba(245, 158, 11, 0.06); }
.wms-edit-table tbody tr.is-conf-med td:first-child { box-shadow: inset 4px 0 0 #d97706; }
.wms-hw-assist {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  font-size: 12px;
}
.wms-hw-reason { color: #b45309; font-weight: 700; line-height: 1.4; }
.wms-edit-table tbody tr.is-conf-low .wms-hw-reason { color: #be123c; }
.wms-hw-raw { color: var(--muted); }
.wms-hw-cands { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.wms-hw-cands > span { color: var(--muted); font-weight: 600; }
.wms-cand-chip { border-color: rgba(36, 87, 214, 0.35); color: var(--primary); background: rgba(36, 87, 214, 0.07); }
.wms-learn-chip { align-self: flex-start; border-color: rgba(13, 148, 136, 0.38); color: #0f766e; background: rgba(13, 148, 136, 0.08); }

/* Pending draft thumbnail & hint */
.wms-draft-thumb-btn {
  position: relative;
  display: inline-block;
  width: 66px;
  height: 52px;
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  background: var(--surface-soft);
}
.wms-draft-thumb-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wms-draft-thumb-btn span {
  position: absolute;
  right: 3px;
  bottom: 3px;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
}
.wms-draft-hint-tag {
  margin-top: 4px;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(36, 87, 214, 0.08);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
}

/* Searchable SKU Picker Modal */
.wms-sku-picker-modal { width: min(620px, 100%); max-height: 86dvh; }
.wms-sku-picker-input { min-height: 44px; font-size: 15px; }
.wms-sku-picker-list {
  max-height: 52dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.wms-sku-picker-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.wms-sku-picker-item:hover { border-color: var(--primary); background: rgba(36, 87, 214, 0.06); }
.wms-sku-picker-item b { display: block; font-size: 13.5px; }
.wms-sku-picker-item small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }

/* Electronic Order Voucher Modal */
.wms-voucher-modal { width: min(760px, 100%); max-height: 92dvh; overflow-y: auto; }
.wms-voucher-sheet {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.wms-voucher-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary);
}
.wms-voucher-title strong { font-size: 18px; color: var(--text); }
.wms-voucher-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 13px;
  color: var(--muted);
}
.wms-voucher-meta b { color: var(--text); }
.wms-voucher-total {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-soft);
  font-size: 13.5px;
}
.wms-voucher-atts { border-top: 1px dashed var(--border); padding-top: 10px; }
.wms-voucher-att-head { font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.wms-voucher-att-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.wms-voucher-att-item {
  width: 96px;
  height: 74px;
  padding: 0;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  background: var(--surface-soft);
}
.wms-voucher-att-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

@media (max-width: 720px) {
  .wms-entry-subtabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    padding: 4px;
    gap: 4px;
  }
  .wms-entry-subtab {
    min-height: 40px;
    padding: 0 6px;
    font-size: 12.5px;
    justify-content: center;
  }
  .wms-spoken-hint-row { flex-direction: column; align-items: stretch; }
  .wms-spoken-hint-row input { font-size: 16px; min-height: 44px; }
  .wms-spoken-hint-row button { width: 100%; min-height: 42px; justify-content: center; }
  .wms-proof-stage { max-height: 230px; padding: 6px; }
  .wms-proof-tools { width: 100%; }
  .wms-proof-tools .wms-btn-chip { min-height: 34px; }
  .wms-sku-picker-modal,
  .wms-voucher-modal {
    width: 100%;
    max-height: 92dvh;
    border-radius: 20px 20px 0 0;
    padding: 16px 14px max(22px, env(safe-area-inset-bottom));
  }
  .wms-sku-picker-input { font-size: 16px; }
  .wms-voucher-sheet { padding: 12px; }
  .wms-voucher-title strong { font-size: 15.5px; }
  .wms-voucher-table { min-width: 440px; font-size: 12px; }
}

@media print {
  body * { visibility: hidden; }
  #wms-voucher-printable, #wms-voucher-printable * { visibility: visible; }
  #wms-voucher-printable {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    border: 0;
    padding: 12px;
    background: #ffffff;
    color: #000000;
  }
  .wms-no-print { display: none !important; }
}
