/* ============================================================================
   CAMCUDA V6 Core Polish — Batch 1 (Customer V6, Orders Collab, AI Settings,
   Product DB, Smart PI)
   ============================================================================ */

/* 1. Customer Center V6 (/crm/customers): Modal & Laptop 1280px Topbar Fixes */
.cv6-modal-mask,
.cv6-modal {
  --cv6-bg: #f6f8fb;
  --cv6-surface: #ffffff;
  --cv6-surface-soft: #f8fafc;
  --cv6-border: #e2e8f0;
  --cv6-border-strong: #cbd5e1;
  --cv6-ink: #0f172a;
  --cv6-ink-2: #334155;
  --cv6-mute: #64748b;
  --cv6-faint: #94a3b8;
  --cv6-pri: #2563eb;
  --cv6-pri-hover: #1d4ed8;
  --cv6-pri-soft: #eff6ff;
  --cv6-radius: 12px;
}

.cv6-modal {
  border: 1px solid #dbe3ef !important;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.22) !important;
}

.cv6-modal .cv6-card-hd {
  background: linear-gradient(90deg, #f8faff 0%, #ffffff 100%);
  border-bottom: 1px solid #e2e8f0 !important;
  padding: 13px 18px !important;
}

.cv6-modal .cv6-input,
.cv6-modal .cv6-textarea,
.cv6-modal select.cv6-input {
  border: 1px solid #cbd5e1 !important;
  background-color: #f8fafc !important;
  color: #0f172a !important;
  border-radius: 8px !important;
  padding: 8px 11px !important;
  font-size: 13px !important;
  transition: border-color 0.14s ease, background-color 0.14s ease, box-shadow 0.14s ease;
}

.cv6-modal .cv6-input:hover,
.cv6-modal .cv6-textarea:hover {
  border-color: #94a3b8 !important;
}

.cv6-modal .cv6-input:focus,
.cv6-modal .cv6-textarea:focus,
.cv6-modal select.cv6-input:focus {
  background-color: #ffffff !important;
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14) !important;
}

.cv6-btn.pri,
button.cv6-btn.pri[type="submit"],
.cv6-modal button[type="submit"].cv6-btn {
  background-color: #2563eb !important;
  background-image: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
  border: 1px solid #1d4ed8 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.28) !important;
}

.cv6-btn.pri:hover:not(:disabled),
button.cv6-btn.pri[type="submit"]:hover:not(:disabled) {
  background-color: #1d4ed8 !important;
  background-image: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%) !important;
  color: #ffffff !important;
}

/* Laptop 1280px-1420px: keep Customer V6 topbar single-row without wrapping [+ 新建客户] */
@media (min-width: 1024px) and (max-width: 1420px) {
  .cv6-topbar {
    padding: 8px 14px !important;
    gap: 10px !important;
    flex-wrap: nowrap !important;
  }
  .cv6-title-group .cv6-sub {
    display: none !important;
  }
  .cv6-search-box {
    width: 260px !important;
    max-width: 28vw !important;
  }
  .cv6-top-actions {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: nowrap !important;
    flex-shrink: 0;
  }
}

@media (max-width: 768px) {
  .cv6-modal {
    max-height: 86vh !important;
    border-radius: 14px !important;
  }
  .cv6-modal .cv6-field-grid {
    grid-template-columns: 1fr !important;
  }
}

/* 2. Orders Collab Workspace (/orders): Module Tabs, Laptop 1280px Grid, Mobile Cards */
.rc-ord-ws .rc-ord-modtabs {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 11px;
  padding: 4px 6px;
  margin: 0 0 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.rc-ord-ws .rc-ord-modtabs::-webkit-scrollbar { display: none; }

.rc-ord-ws .rc-ord-modtab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.14s ease;
  flex-shrink: 0;
}

.rc-ord-ws .rc-ord-modtab:hover {
  color: #0f172a;
  background: #f1f5f9;
}

.rc-ord-ws .rc-ord-modtab.is-active {
  color: #2563eb;
  background: #eff6ff;
  border-color: #bfdbfe;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.08);
}

.rc-ord-ws .rc-ord-modtab small {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #2563eb;
  color: #ffffff;
  font-weight: 700;
}

/* Laptop 769px-1440px: responsive column widths so [✓ 标记已采购] & [详情] never clip */
@media (min-width: 769px) and (max-width: 1460px) {
  .rc-ord-ws .rc-ord-head,
  .rc-ord-ws .rc-ord-row {
    grid-template-columns: 24px 140px minmax(145px, 1.05fr) minmax(165px, 1.3fr) 104px minmax(150px, 1.05fr) 144px !important;
    gap: 8px !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
  }
  .rc-ord-ws .rc-ord-c-acts {
    display: flex;
    justify-content: flex-end;
    gap: 5px;
    flex-wrap: nowrap;
    white-space: nowrap;
  }
  .rc-ord-ws .rc-act-btn {
    padding: 4px 8px !important;
    font-size: 11px !important;
    white-space: nowrap !important;
  }
}

/* 3. AI Settings (/ai/settings): Mobile <= 768px & Compact Laptop Layout */
main.rc-shell-main > div:has(> .rc-ai-ws) {
  height: auto !important;
  min-height: 100% !important;
  overflow: visible !important;
}
@media (max-width: 900px) {
  .rc-ai-ws {
    height: auto !important;
    min-height: 100%;
    overflow: visible !important;
    padding: 10px 10px 24px !important;
    gap: 10px !important;
  }
  .rc-ai-topbar {
    gap: 8px !important;
  }
  .rc-ai-brand {
    flex-wrap: wrap;
    gap: 8px !important;
    width: 100%;
  }
  .rc-ai-tabs {
    margin-left: 0 !important;
    width: 100%;
    display: flex !important;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .rc-ai-tabs::-webkit-scrollbar { display: none; }
  .rc-ai-tab {
    flex: 1 1 auto;
    white-space: nowrap;
    text-align: center;
    padding: 6px 10px !important;
  }
  .rc-ai-acc-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  .rc-ai-split {
    display: flex !important;
    flex-direction: column !important;
    overflow: visible !important;
    min-height: auto !important;
  }
  .rc-ai-left {
    border-right: 0 !important;
    border-bottom: 1px solid #e2e8f0 !important;
    max-height: none !important;
  }
  .rc-ai-right {
    overflow: visible !important;
  }
  .rc-ai-route-row {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    padding: 11px 12px !important;
  }
  .rc-ai-efforts {
    width: 100% !important;
    display: flex !important;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .rc-ai-efforts::-webkit-scrollbar { display: none; }
  .rc-ai-eff-btn {
    flex: 1 1 auto;
    text-align: center;
    padding: 5px 6px !important;
    font-size: 11.5px !important;
  }
  .rc-ai-sc-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }
  .rc-ai-tier-seg {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .rc-ai-tier-seg-btn {
    text-align: center;
    padding: 6px 4px !important;
    font-size: 11.5px !important;
  }
}

/* 4. Product DB (/products) & Smart PI (/pi) Multi-Viewport Fixes */
.pdb-root table th:last-child,
.pdb-root table td:last-child {
  position: sticky;
  right: 0;
  background: #ffffff;
  box-shadow: -4px 0 8px rgba(15, 23, 42, 0.04);
  z-index: 2;
  white-space: nowrap;
}
.pdb-root table thead th:last-child {
  background: #f8fafc;
  z-index: 3;
}
.rc-v6-pdb-mob-picker {
  display: none;
}
@media (max-width: 960px) {
  .rc-v6-pdb-mob-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #eff6ff;
    border-bottom: 1px solid #dbeafe;
  }
  .rc-v6-pdb-mob-select {
    flex: 1;
    min-width: 0;
    height: 32px;
    padding: 0 9px;
    border-radius: 7px;
    border: 1px solid #93c5fd;
    background: #ffffff;
    font-size: 12.5px;
    font-weight: 600;
    color: #0f172a;
  }
  .rc-v6-pdb-mob-toggle {
    flex-shrink: 0;
    height: 32px;
    padding: 0 10px;
    border-radius: 7px;
    border: 1px solid #bfdbfe;
    background: #ffffff;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
  }
  .pdb-root .spu-scroll:not(.is-expanded):not(.is-searching) {
    display: none !important;
  }
  .pdb-root .spu-scroll.is-expanded,
  .pdb-root .spu-scroll.is-searching {
    display: block !important;
    max-height: 340px !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }
}
@media (max-width: 768px) {
  .pdb-root .sub-toolbar,
  .pdb-root [role="dialog"] header,
  .pdb-root .modal-head {
    max-width: 100%;
    flex-wrap: wrap;
  }
  .pdb-root .badge,
  .pdb-root .spu-pill {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Smart PI: Rep badge nowrap + Mobile A4 Zoom Toggle + <=1180px Single Scroll Unification */
@media (max-width: 1180px) {
  .spi-root {
    height: auto !important;
    overflow: visible !important;
    max-width: 100% !important;
  }
  .spi-workspace {
    grid-template-columns: minmax(0, 1fr) !important;
    max-width: 100% !important;
  }
  .spi-left,
  .spi-right,
  .spi-preview-bar,
  .spi-ledger {
    min-width: 0 !important;
    max-height: none !important;
    max-width: 100% !important;
    overflow: visible !important;
    overscroll-behavior: auto !important;
  }
  .spi-preview-bar {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .spi-paper-scroll,
  .spi-ledger-table-wrap {
    min-width: 0 !important;
    max-width: 100% !important;
    max-height: none !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
  }
}
.spi-root table td,
.spi-root table th,
.spi-ledger table td span {
  white-space: nowrap;
}
.rc-spi-zoom-btn {
  display: none;
}
@media (max-width: 768px) {
  .rc-spi-zoom-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
  }
  .spi-root.rc-spi-zoom-100 .pi-paper {
    zoom: 0.88 !important;
    width: 794px !important;
    min-width: 794px !important;
    max-width: none !important;
    flex-shrink: 0 !important;
  }
  .spi-root.rc-spi-zoom-100 .spi-paper-scroll {
    justify-content: flex-start !important;
    overflow-x: auto !important;
  }
}


/* ============================================================================
   CAMCUDA V6 Orders & Inventory Complete Modernization — Batch 2
   Covers: /orders/so/:id, /orders/purchase, /orders/inventory,
   /orders/logistics, /orders/imports, /orders/settings, /orders/billing (.opr)
   ============================================================================ */

/* 1. Shared V6 Workspace Canvas for Legacy v17 / v31 / oi-v25 Surfaces */
[data-orders-prototype],
.oi-v25-surface,
.crm-orders-native-v25,
.crm-order-v17-surface,
.crm-v31-surface {
  --primary: #2563eb !important;
  --primary-foreground: #ffffff !important;
  --ring: rgba(37, 99, 235, 0.25) !important;
  --accent: #eff6ff !important;
  --accent-foreground: #1d4ed8 !important;
  --ink: #0f172a !important;
  --muted: #64748b !important;
  --line: #e2e8f0 !important;
  background: #f6f8fc !important;
  color: #0f172a !important;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "PingFang SC", "Microsoft YaHei", sans-serif !important;
}

.crm-order-v17-surface,
.crm-v31-surface {
  padding: 16px 20px 28px !important;
  min-height: calc(100vh - 16px);
}

[data-orders-prototype] .text-emerald-700,
[data-orders-prototype] .text-emerald-800,
[data-orders-prototype] .text-green-700,
.oi-v25-surface .text-emerald-700,
.oi-v25-surface .text-emerald-800,
.oi-v25-surface .text-green-700,
.oi-v25-surface tbody td:first-child button,
.oi-v25-surface tbody td:first-child a,
[data-orders-prototype] tbody td:first-child button,
[data-orders-prototype] tbody td:first-child a,
[data-orders-prototype] tbody td:last-child button,
[data-orders-prototype] tbody td:last-child a {
  color: #2563eb !important;
}

/* Native v25 /orders/purchase, /inventory, /logistics, /imports, /settings V6 Upgrade */
.oi-shell h1,
.oi-heading h1 {
  font-size: 19px !important;
  font-weight: 700 !important;
  color: #0f172a !important;
}

.oi-tab-bar,
.oi-tabs {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 11px !important;
  padding: 4px 6px !important;
  margin-bottom: 12px !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03) !important;
}

.oi-tab-bar button,
.oi-tab-bar a,
.oi-tabs button,
.oi-tabs a {
  border: 1px solid transparent !important;
  border-radius: 8px !important;
  padding: 6px 12px !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  color: #475569 !important;
  background: transparent !important;
  text-decoration: none !important;
}

.oi-tab-bar [aria-selected="true"],
.oi-tab-bar [aria-current="page"],
.oi-tabs [aria-selected="true"],
.oi-tabs [aria-current="page"] {
  background: #eff6ff !important;
  color: #2563eb !important;
  border-color: #bfdbfe !important;
}

/* Convert black buttons (+ 新建采购, + 数量调整, etc.) & green links inside oi-* to V6 Cobalt Blue */
.oi-v25-surface button.bg-zinc-900,
.oi-v25-surface button.bg-slate-900,
.oi-v25-surface button.bg-ink-950,
.oi-shell button.bg-zinc-900,
.oi-shell button.bg-ink-950,
.oi-toolbar button:last-child:not(.oi-btn),
.oi-v25-surface .oi-btn-primary,
.crm-orders-native-v25 button[style*="#18181b"],
.crm-orders-native-v25 button[style*="#09090b"],
.oi-v25-surface .oi-toolbar > button:last-of-type {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
  border: 1px solid #1d4ed8 !important;
  color: #ffffff !important;
  border-radius: 999px !important;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.22) !important;
}

.oi-v25-surface .oi-link,
.oi-shell .oi-link,
.oi-table td a,
.oi-table td button.oi-link {
  color: #2563eb !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
}

.oi-pagination button {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #334155 !important;
  border-radius: 8px !important;
  padding: 5px 12px !important;
  font-weight: 600 !important;
}
.oi-pagination button:disabled {
  background: #f8fafc !important;
  color: #94a3b8 !important;
  border-color: #e2e8f0 !important;
  opacity: 0.75 !important;
}

.crm-order-v17-surface #main,
.crm-v31-surface #main {
  max-width: 1640px;
  margin: 0 auto;
}

/* Page Headings: Replace heavy 26px dark slate with crisp V6 20px title + Cobalt Blue CTA */
.crm-order-v17-surface .page-heading,
.crm-v31-surface .page-heading {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 18px !important;
  margin: 0 0 10px !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.crm-order-v17-surface .page-heading h1,
.crm-v31-surface .page-heading h1 {
  font-size: 18px !important;
  font-weight: 700 !important;
  letter-spacing: -0.01em !important;
  color: #0f172a !important;
}

/* Module Tabs: Match V6 pill bar on /orders & /orders/billing */
.crm-order-v17-surface .module-tabs,
.crm-v31-surface .module-tabs {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  height: auto !important;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 11px !important;
  padding: 4px 6px !important;
  margin: 0 0 12px !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  scrollbar-width: none;
}
.crm-order-v17-surface .module-tabs::-webkit-scrollbar,
.crm-v31-surface .module-tabs::-webkit-scrollbar { display: none; }

.crm-order-v17-surface .module-tabs a,
.crm-order-v17-surface .module-tabs button,
.crm-v31-surface .module-tabs a,
.crm-v31-surface .module-tabs button {
  border: 1px solid transparent !important;
  border-radius: 8px !important;
  padding: 6px 12px !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  color: #475569 !important;
  background: transparent !important;
  transition: all 0.14s ease;
  flex-shrink: 0;
}

.crm-order-v17-surface .module-tabs a:hover,
.crm-order-v17-surface .module-tabs button:hover,
.crm-v31-surface .module-tabs a:hover,
.crm-v31-surface .module-tabs button:hover {
  color: #0f172a !important;
  background: #f1f5f9 !important;
}

.crm-order-v17-surface .module-tabs [aria-current="page"],
.crm-order-v17-surface .module-tabs .active,
.crm-v31-surface .module-tabs [aria-current="page"],
.crm-v31-surface .module-tabs .active {
  color: #2563eb !important;
  background: #eff6ff !important;
  border-color: #bfdbfe !important;
}

/* Primary & Secondary Buttons: Replace #263a52 / #345a80 slate-black with V6 Cobalt Blue */
.crm-order-v17-surface .primary-action,
.crm-order-v17-surface .primary-small,
.crm-order-v17-surface .task-footer .task-primary,
.crm-v31-surface .primary-action,
.crm-v31-surface .primary-small,
.crm-v31-surface .task-footer .task-primary {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
  border: 1px solid #1d4ed8 !important;
  color: #ffffff !important;
  border-radius: 999px !important;
  padding: 7px 15px !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.22) !important;
  white-space: nowrap !important;
}

.crm-order-v17-surface .primary-action:hover:not(:disabled),
.crm-v31-surface .primary-action:hover:not(:disabled) {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%) !important;
}

.crm-order-v17-surface .utility-button,
.crm-v31-surface .utility-button {
  border-radius: 999px !important;
  border: 1px solid #cbd5e1 !important;
  background: #ffffff !important;
  color: #334155 !important;
  padding: 6px 13px !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
}

/* Overview Strip & Filter Toolbar */
.crm-order-v17-surface .overview,
.crm-v31-surface .overview {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 9px 14px !important;
  margin: 0 0 10px !important;
  flex-wrap: wrap;
  font-size: 12px !important;
}

.crm-order-v17-surface .toolbar,
.crm-v31-surface .toolbar {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 11px;
  padding: 10px 14px !important;
  margin-bottom: 12px !important;
}

.crm-order-v17-surface .toolbar .search,
.crm-v31-surface .toolbar .search {
  border-radius: 999px !important;
  background: #f1f5f9 !important;
  border: 1px solid #dbe3ef !important;
  padding: 0 12px !important;
}

/* Data Tables: Crisp V6 Card Container + Zero Single-Character Vertical Stacking */
.crm-order-v17-surface table,
.crm-v31-surface table {
  background: #ffffff;
  border-radius: 12px;
}

.crm-order-v17-surface table th,
.crm-v31-surface table th {
  background: #f8fafc !important;
  color: #475569 !important;
  font-weight: 600 !important;
  font-size: 12px !important;
  white-space: nowrap !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

.crm-order-v17-surface table td,
.crm-v31-surface table td {
  border-bottom: 1px solid #f1f5f9 !important;
  vertical-align: middle !important;
}

/* Prevent narrow columns (主仓, 明细, 状态, 币种, 操作) from wrapping 1 char per line */
.crm-order-v17-surface table td a,
.crm-order-v17-surface table td button,
.crm-order-v17-surface table td .status-pill,
.crm-order-v17-surface table td small,
.crm-v31-surface table td a,
.crm-v31-surface table td button {
  white-space: nowrap;
}

.crm-order-v17-surface a,
.crm-v31-surface a {
  color: #2563eb !important;
  text-decoration: none !important;
}
.crm-order-v17-surface a:hover,
.crm-v31-surface a:hover {
  text-decoration: underline !important;
}

/* 2. Order 360 Detail (/orders/so/:id) V6 Modernization */
.crm-v31-surface .detail-breadcrumb {
  margin-bottom: 10px !important;
  font-size: 12.5px !important;
}

.crm-v31-surface .order-heading {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px 20px !important;
  margin-bottom: 14px !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  flex-wrap: wrap;
}

.crm-v31-surface .order-heading h1 {
  font-size: 20px !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  border-bottom: none !important;
  text-decoration: none !important;
}

.crm-v31-surface .order-summary {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 14px !important;
  padding: 16px 20px !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
}

.crm-v31-surface .order-summary strong {
  color: #0f172a !important;
  font-weight: 700 !important;
  font-size: 19px !important;
}

.crm-v31-surface .detail-tabs {
  background: #ffffff;
  border: 1px solid #e2e8f0 !important;
  border-radius: 11px;
  padding: 4px 8px !important;
  height: auto !important;
  gap: 6px !important;
  margin: 0 0 14px !important;
}

.crm-v31-surface .detail-tabs button {
  border-radius: 8px !important;
  border: 1px solid transparent !important;
  padding: 7px 14px !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  color: #475569 !important;
}

.crm-v31-surface .detail-tabs button[aria-selected="true"],
.crm-v31-surface .detail-tabs button.active {
  background: #eff6ff !important;
  color: #2563eb !important;
  border-color: #bfdbfe !important;
}

.crm-v31-surface .detail-panel,
.crm-order-v17-surface .detail-panel {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 14px !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
}

/* 3. Operating Report (/orders/billing .opr) Laptop & Mobile Responsive Polish */
.opr .op-nav {
  background: #ffffff;
  border: 1px solid #e2e8f0 !important;
  border-radius: 11px;
  padding: 4px 6px !important;
  gap: 6px !important;
  margin: 10px 0 14px !important;
}
.opr .op-nav a {
  padding: 6px 12px !important;
  border-radius: 8px;
  border-bottom: 0 !important;
  font-size: 12.5px;
  font-weight: 600 !important;
}
.opr .op-nav a[aria-current] {
  background: #eff6ff;
  color: #2563eb !important;
  border: 1px solid #bfdbfe;
}

@media (max-width: 1380px) {
  .opr {
    padding: 14px 16px 24px !important;
  }
  .opr .op-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 768px) {
  .crm-order-v17-surface,
  .crm-v31-surface,
  .opr {
    padding: 10px 10px 24px !important;
  }
  .crm-order-v17-surface .page-heading,
  .crm-v31-surface .page-heading,
  .opr .op-heading {
    padding: 10px 12px !important;
    flex-wrap: wrap;
    gap: 8px !important;
  }
  .crm-v31-surface .order-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
    padding: 12px 14px !important;
  }
  .crm-order-v17-surface table,
  .crm-v31-surface table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .opr .op-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }
  .opr .op-kpi:last-child {
    grid-column: 1 / -1;
  }
  .opr .op-kpi {
    padding: 12px !important;
  }
  .opr .op-kpi strong {
    font-size: 18px !important;
  }
  .opr .op-filters {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px !important;
    padding: 10px 12px !important;
  }
  .opr .op-filters small[data-date-label],
  .opr .op-filters input[type="search"],
  .opr .op-filters button[data-action="clear"] {
    grid-column: 1 / -1;
    width: 100% !important;
  }
  .opr .op-filters small:not([data-date-label]) {
    display: none;
  }
  .opr .op-filters input[type="date"],
  .opr .op-filters select {
    width: 100% !important;
    min-width: 0 !important;
  }
}


/* ============================================================================
   CAMCUDA V6 Enterprise Modernization — Batches 3, 4 & 5
   Covers:
   - Batch 3: Prospects (/crm/prospects) & Commissions (/crm/commissions)
   - Batch 4: Growth (/growth/operations, /growth/inquiry-tracking)
   - Batch 5: System Management (10 pages) + Global Shell Header + /login
   ============================================================================ */

/* 1. Responsive Helpers for GM Topbar & Toolbars (Prospects & Commissions) */
.rc-gm-mob-only { display: none !important; }
@media (max-width: 768px) {
  .rc-gm-desk-only { display: none !important; }
  .rc-gm-mob-only { display: inline-flex !important; }

  .rc-gm-topbar {
    padding: 8px 10px !important;
    gap: 8px !important;
  }
  .rc-gm-tb-right {
    gap: 6px !important;
  }
  .rc-gm-tb-cta {
    padding: 0 11px !important;
    height: 32px !important;
    font-size: 12px !important;
    flex-shrink: 0 !important;
  }
}

@media (min-width: 769px) and (max-width: 1366px) {
  .rc-gm-topbar {
    padding: 8px 14px !important;
    gap: 10px !important;
  }
  .rc-gm-search {
    max-width: 340px !important;
  }
}

/* 2. Batch 3: Commissions (/crm/commissions), Prospects (/crm/prospects) & FAQ V6 Alignment */
[data-commission-prototype],
[data-prospect-prototype],
[data-workbench-prototype],
[data-faq-messages-prototype],
[data-customer-prototype],
.prospects-v3 {
  --primary: #2563eb !important;
  --primary-foreground: #ffffff !important;
  --ring: rgba(37, 99, 235, 0.25) !important;
  --ink-950: #0f172a;
}

/* Convert stark black buttons & active pills in Commissions to V6 Cobalt Blue & Semantic Pills */
.rc-gm-avatar {
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 5px rgba(37, 99, 235, 0.24) !important;
}

[data-commission-prototype] button.bg-zinc-900,
[data-commission-prototype] button.bg-slate-900,
[data-commission-prototype] button.bg-neutral-900,
[data-commission-prototype] button.bg-ink-950,
[data-commission-prototype] .cm-primary-btn,
[data-commission-prototype] button[aria-pressed="true"],
[data-commission-prototype] [role="tab"][aria-selected="true"],
[data-commission-prototype] button[type="submit"]:not(.rc-gm-tb-pill) {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
  border-color: #1d4ed8 !important;
  color: #ffffff !important;
  border-radius: 999px !important;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.22) !important;
}

[data-commission-prototype] input[type="checkbox"] {
  accent-color: #2563eb !important;
}

[data-commission-prototype] .cm-v2-card-options > label,
[data-commission-prototype] .cm-v2-card-options > article,
[data-commission-prototype] section,
[data-commission-prototype] table {
  border-color: #e2e8f0 !important;
  border-radius: 12px !important;
}

[data-commission-prototype] table th,
.prospects-v3 table th {
  background: #f8fafc !important;
  color: #475569 !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
}

[data-commission-prototype] table td,
.prospects-v3 table td {
  vertical-align: middle !important;
}

/* 3. Global Shell Header (<header>) V6 Upgrade */
header.border-ink-200 {
  background: rgba(255, 255, 255, 0.96) !important;
  border-bottom: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

/* Upgrade stark black RO avatar circle & monochrome active pills in Header / System / Growth */
header .bg-ink-950.text-ink-0.rounded-full,
header span.rounded-full.bg-ink-900 {
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 5px rgba(37, 99, 235, 0.25);
}

.rc-v6-tab-active {
  background: #eff6ff !important;
  color: #2563eb !important;
  border: 1px solid #bfdbfe !important;
}

/* 4. Batches 4 & 5: System Management, Growth & Login V6 Surface Unification */
main.rc-main-scroll {
  background: #f6f8fc !important;
}

/* Upgrade V1 30px/24px stark black page H1s inside scrollable System/Growth pages into V6 20px titles */
main.rc-main-scroll h1.text-2xl,
main.rc-main-scroll h1.text-3xl,
main.rc-main-scroll h1.text-xl,
.research-page h1,
.seo-config-page h1 {
  font-size: 20px !important;
  line-height: 1.35 !important;
  font-weight: 700 !important;
  letter-spacing: -0.015em !important;
  color: #0f172a !important;
}

/* Convert V1 monochrome black primary buttons & active tabs (.bg-ink-950.text-ink-0) into V6 Cobalt Blue */
main.rc-main-scroll button.bg-ink-950.text-ink-0,
main.rc-main-scroll a.bg-ink-950.text-ink-0,
body:not(.crm-v19-route) form button[type="submit"].bg-ink-950 {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
  border-color: #1d4ed8 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.22) !important;
}

main.rc-main-scroll button.bg-ink-950.text-ink-0:hover:not(:disabled),
body:not(.crm-v19-route) form button[type="submit"].bg-ink-950:hover:not(:disabled) {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%) !important;
}

/* Segmented Tablists (e.g. /access, /email-tracking, /sites, /growth): V6 Soft Blue Active Pill */
main.rc-main-scroll [role="tablist"] {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 11px !important;
  padding: 4px !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

main.rc-main-scroll [role="tablist"] [role="tab"][aria-selected="true"] {
  background: #eff6ff !important;
  color: #2563eb !important;
  border: 1px solid #bfdbfe !important;
  font-weight: 600 !important;
  box-shadow: none !important;
}

/* Cards & Panels across System & Growth */
main.rc-main-scroll .border-ink-200.bg-ink-0,
main.rc-main-scroll .border-ink-200.bg-white,
.research-page .plan-board,
.research-page .plan-card,
.seo-config-page .seo-section {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  border-radius: 14px !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.035) !important;
}

/* Unified V6 Form Controls across /sites, /email-tracking, /access, /settings/branding, /login */
main.rc-main-scroll input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]),
main.rc-main-scroll select,
main.rc-main-scroll textarea {
  border-radius: 8px !important;
  border-color: #cbd5e1 !important;
}

main.rc-main-scroll input:not([type="checkbox"]):not([type="radio"]):focus,
main.rc-main-scroll select:focus,
main.rc-main-scroll textarea:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12) !important;
  outline: none !important;
}

/* Zero Single-Character Vertical Stacking in All System & Growth Tables */
main.rc-main-scroll table th,
main.rc-main-scroll table td span.inline-flex,
main.rc-main-scroll table td button,
main.rc-main-scroll table td a {
  white-space: nowrap !important;
}

main.rc-main-scroll table {
  border-collapse: collapse;
}

main.rc-main-scroll table thead th {
  background: #f8fafc !important;
  color: #475569 !important;
  font-weight: 600 !important;
  padding-top: 10px !important;
  padding-bottom: 10px !important;
}

/* Knowledge Base: prevent "3353 个文件" orphan line break + Mobile NocoDB Table Selector */
.rc-v6-knowledge-hub span.text-ink-500 {
  white-space: nowrap;
}

.rc-v6-kb-mob-picker {
  display: none;
}

/* /system/jobs JSON Summary Badge & Diagnostics Collapsible */
.rc-v6-job-summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #334155;
}
.rc-v6-job-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  color: #1d4ed8;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.rc-v6-job-raw-btn {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #64748b;
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 11px;
  cursor: pointer;
}
.rc-v6-diag-details {
  width: 100%;
  margin-top: 6px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 8px 12px;
  background: #f8fafc;
}
.rc-v6-diag-details > summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  user-select: none;
}
.rc-v6-diag-body {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

/* /billing Module Capability Chips */
.rc-v6-mod-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  vertical-align: middle;
}
.rc-v6-mod-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 11.5px;
  font-weight: 600;
}

/* /growth/operations Shimmer Loading Skeleton instead of plain dashed box */
main.rc-main-scroll [role="status"].border-dashed {
  border-style: solid !important;
  border-color: #e2e8f0 !important;
  background: linear-gradient(90deg, #ffffff 25%, #f1f5f9 50%, #ffffff 75%) !important;
  background-size: 200% 100% !important;
  animation: rcV6Shimmer 1.6s infinite linear !important;
  border-radius: 14px !important;
  color: #475569 !important;
  font-weight: 500;
}
@keyframes rcV6Shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* /login Brand Card V6 Cobalt Styling */
.rc-v6-login-badge {
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28) !important;
}
.rc-v6-login-cta,
body:has(.rc-v6-login-badge) button.bg-ink-950,
body:has(.rc-v6-login-badge) a.bg-ink-950 {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
  border-color: #1d4ed8 !important;
  color: #ffffff !important;
  border-radius: 10px !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28) !important;
}

/* 5. Mobile (<= 768px) Responsive Polish across All System, V6 Canvas & Growth Pages */
:is(main.rc-main-scroll, .v6w-canvas) table th,
:is(main.rc-main-scroll, .v6w-canvas) table td span.inline-flex,
:is(main.rc-main-scroll, .v6w-canvas) table td button,
:is(main.rc-main-scroll, .v6w-canvas) table td a {
  white-space: nowrap !important;
}

@media (max-width: 768px) {
  :is(main.rc-main-scroll, .v6w-canvas) form.flex.flex-wrap {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  :is(main.rc-main-scroll, .v6w-canvas) form.flex.flex-wrap > label,
  :is(main.rc-main-scroll, .v6w-canvas) form.flex.flex-wrap > div,
  :is(main.rc-main-scroll, .v6w-canvas) form.flex.flex-wrap input:not([type="checkbox"]):not([type="radio"]),
  :is(main.rc-main-scroll, .v6w-canvas) form.flex.flex-wrap select {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Responsive Horizontal Scroll Container for Wide Tables on /access, /system/jobs, /growth/inquiry-tracking, /access/audit */
  :is(main.rc-main-scroll, .v6w-canvas) div:has(> table) {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  :is(main.rc-main-scroll, .v6w-canvas) table {
    min-width: 580px;
  }

  /* Knowledge Base FAQ (.crm-fm-page) Mobile Grid & Button Clipping Fix */
  .crm-fm-page main {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  .crm-fm-page .grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .crm-fm-page button.whitespace-nowrap {
    max-width: 100% !important;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .crm-fm-page section {
    max-width: 100% !important;
  }

  /* Knowledge Base Mobile Table Picker */
  .rc-v6-kb-mob-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 11px;
    margin-bottom: 10px;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
  .rc-v6-kb-mob-picker label {
    font-size: 12px;
    font-weight: 700;
    color: #1e40af;
    white-space: nowrap;
  }
  .rc-v6-kb-mob-picker select {
    flex: 1;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 34px;
    padding: 0 10px;
    background: #ffffff;
    border: 1px solid #93c5fd !important;
    border-radius: 8px !important;
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .rc-v6-kb-sidebar-hidden {
    display: none !important;
  }
}
