﻿:root {
  --bg: #f6f4ff;
  --surface: #ffffff;
  --surface-soft: #faf9ff;
  --ink: #171528;
  --muted: #6f6a85;
  --line: #ddd8f3;
  --accent: #6750e8;
  --accent-2: #4f35c8;
  --warn: #b06a00;
  --danger: #bd2f2f;
  --ok: #2b7a41;
  --hold: #7c5cff;
  --nav: #21194a;
  --nav-2: #2d235e;
  --shadow: 0 18px 48px rgba(50, 35, 120, 0.1);
  --shadow-soft: 0 8px 22px rgba(50, 35, 120, 0.07);
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Malgun Gothic", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: hidden;
}

body.auth-locked {
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 18%, rgba(103, 80, 232, 0.11), transparent 28%),
    linear-gradient(145deg, #fbfaff 0%, #f4f1ff 54%, #ffffff 100%);
}

/* Menu ordering must not alter label spacing; the menu item itself is the drag handle. */
body.menu-order-editing:not(.auth-locked) .nav-item {
  cursor: grab !important;
  padding-left: 10px !important;
  text-shadow: none !important;
  letter-spacing: 0 !important;
}

body.menu-order-editing:not(.auth-locked) .nav-item::before {
  content: none !important;
  display: none !important;
}

body.menu-order-editing:not(.auth-locked) .nav-list {
  outline: 1px dashed #b9adff !important;
  outline-offset: 4px;
}

body.auth-locked .app-shell {
  display: none;
}

button,
input,
select {
  font: inherit;
}

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 18%, rgba(103, 80, 232, 0.11), transparent 28%),
    linear-gradient(145deg, #fbfaff 0%, #f4f1ff 54%, #ffffff 100%);
}

body.auth-locked .login-gate {
  display: grid;
}

.login-card {
  width: min(390px, 100%);
  display: grid;
  gap: 14px;
  padding: 32px;
  border: 1px solid #e4defb;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(50, 35, 120, 0.14);
}

.login-title {
  display: grid;
  gap: 6px;
  margin-bottom: 4px;
}

.login-title strong {
  font-size: 24px;
  color: var(--ink);
}

.login-title span,
.login-help {
  color: var(--muted);
  font-size: 14px;
}

.login-card select,
.login-card input,
.login-card button {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
}

.login-card select,
.login-card input {
  border: 1px solid var(--line);
  background: #fbfaff;
  padding: 0 14px;
  outline: 0;
}

.login-card select:focus,
.login-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(103, 80, 232, 0.12);
}

.login-help {
  margin-top: 4px;
  line-height: 1.6;
  text-align: center;
}

body:not(.auth-locked) .login-gate {
  display: none;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width, 210px) minmax(0, 1fr);
  width: 100%;
  max-width: 100vw;
  min-width: 0;
}

.sidebar {
  position: relative;
  background: var(--nav);
  color: #f8fafc;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--accent);
  border-radius: 8px;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 10px 24px rgba(103, 80, 232, 0.3);
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 15px;
}

.brand span {
  color: #a6b0bf;
  font-size: 11px;
  margin-top: 2px;
}

.common-system-shortcuts {
  position: relative;
  z-index: 5;
}

.common-system-shortcuts summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid #405066;
  border-radius: 7px;
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  user-select: none;
  font-weight: 700;
  font-size: 12px;
}

.common-system-shortcuts summary::-webkit-details-marker {
  display: none;
}

.common-system-shortcuts summary::after {
  content: "^";
  color: #dbe4ef;
  font-size: 12px;
  line-height: 1;
}

.common-system-shortcuts[open] summary::after {
  transform: rotate(0deg);
}

.common-system-shortcuts:not([open]) summary::after {
  transform: rotate(180deg);
}

.common-system-shortcuts__menu {
  position: static;
  display: grid;
  gap: 1px;
  max-height: 260px;
  overflow-y: auto;
  margin-top: 6px;
  padding: 8px;
  border: 1px solid rgba(226, 222, 250, 0.22);
  border-radius: 8px;
  background: rgba(16, 12, 40, 0.72);
  box-shadow: none;
}

.common-system-shortcuts__menu a {
  display: block;
  padding: 7px 5px;
  border-radius: 7px;
  color: #f8fafc;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}

.common-system-shortcuts__menu a:hover {
  background: rgba(255, 255, 255, 0.09);
}

.common-system-shortcuts__menu a.is-active,
.common-system-shortcuts__menu a.active,
.common-system-shortcuts__menu a[aria-current="page"] {
  background: var(--accent);
  color: #ffffff;
  box-shadow: inset 3px 0 0 #d8ccff;
}

.nav-list {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.menu-order-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 2px 0 7px;
}

.menu-order-toolbar .tiny {
  min-height: 28px;
  padding: 5px 6px;
  font-size: 11px;
}

.nav-item {
  border: 0;
  border-radius: 6px;
  padding: 9px 10px;
  color: #dbe4ef;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
}

body.menu-order-editing .nav-list {
  outline: 1px dashed rgba(103, 80, 232, 0.45);
  outline-offset: 3px;
  border-radius: 8px;
}

body.menu-order-editing .nav-item {
  cursor: grab;
  position: relative;
}

body.menu-order-editing .nav-item:active {
  cursor: grabbing;
}

.nav-item.is-dragging {
  opacity: 0.45;
  box-shadow: 0 8px 18px rgba(39, 31, 86, 0.18);
}

body.menu-order-editing #toggleMenuOrderEdit {
  background: #6750e8;
  color: #ffffff;
  border-color: #6750e8;
}

.nav-item:hover,
.nav-item.active {
  background: var(--nav-2);
  color: #ffffff;
}

.mode-switch {
  margin-top: auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid #334257;
  border-radius: 8px;
  overflow: hidden;
}

.mode-switch button {
  border: 0;
  color: #dbe4ef;
  background: transparent;
  padding: 7px 3px;
  cursor: pointer;
  font-size: 12px;
}

.mode-switch .selected {
  background: var(--accent);
  color: #ffffff;
}

.main {
  min-width: 0;
  padding: 24px 28px;
  max-width: 1800px;
  width: 100%;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  position: relative;
  z-index: 30;
  padding: 0 0 12px;
  background: rgba(246, 244, 255, 0.92);
  backdrop-filter: blur(12px);
  min-height: 72px;
  overflow: visible;
}

.topbar > div:first-child {
  flex: 0 0 230px;
  min-width: 210px;
}

.frame-resize-handle {
  position: absolute;
  z-index: 70;
  touch-action: none;
}

.sidebar-width-handle {
  top: 0;
  right: -5px;
  width: 10px;
  height: 100%;
  cursor: col-resize;
}

.sidebar-width-handle::after {
  content: "";
  position: absolute;
  top: 16px;
  bottom: 16px;
  left: 4px;
  width: 2px;
  border-radius: 999px;
  background: rgba(219, 228, 239, 0.24);
}

.sidebar-width-handle:hover::after,
.frame-resizing-x .sidebar-width-handle::after {
  background: rgba(103, 80, 232, 0.9);
}

.topbar-height-handle {
  left: 0;
  right: 0;
  bottom: -6px;
  height: 12px;
  cursor: row-resize;
}

.topbar-height-handle::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 5px;
  height: 2px;
  border-radius: 999px;
  background: rgba(39, 69, 105, 0.12);
}

.topbar-height-handle:hover::after,
.frame-resizing-y .topbar-height-handle::after {
  background: rgba(103, 80, 232, 0.85);
}

.frame-resizing {
  user-select: none;
}

.frame-resizing-x {
  cursor: col-resize;
}

.frame-resizing-y {
  cursor: row-resize;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  letter-spacing: 0;
}

h2 {
  font-size: 17px;
  letter-spacing: 0;
}

.topbar p {
  color: var(--muted);
  margin-top: 7px;
}

.top-actions,
.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-actions {
  flex: 1 1 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.auth-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px;
  flex: 0 0 auto;
}

.auth-box select,
.auth-box input {
  min-height: 34px;
  width: 130px;
}

.auth-box input {
  width: 82px;
}

.guide-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(16, 24, 35, 0.58);
}

.guide-modal.open {
  display: flex;
}

.guide-panel {
  width: min(980px, 100%);
  max-height: min(86vh, 860px);
  overflow: hidden;
  border: 1px solid rgba(213, 221, 232, 0.88);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(16, 24, 40, 0.28);
  display: grid;
  grid-template-rows: auto 1fr;
}

.sku-edit-panel {
  width: min(1040px, 100%);
}

.location-edit-panel {
  width: min(900px, 100%);
}

.inbound-batch-panel {
  width: min(1180px, 100%);
}

.guide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.guide-head span {
  display: block;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 4px;
}

.guide-body {
  overflow: auto;
  padding: 18px 20px 22px;
  display: block;
}

.modal-sku-grid {
  margin-top: 14px;
}

.modal-location-grid {
  margin-top: 14px;
}

.modal-inbound-detail {
  display: grid;
  gap: 12px;
}

.inbound-modal-notice {
  margin: 0;
}

.registration-confirm-panel {
  width: min(820px, 100%);
}

.registration-history-box {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfe;
  overflow: hidden;
}

.registration-history-box summary {
  cursor: pointer;
  padding: 10px 12px;
  color: var(--text);
  font-weight: 900;
}

.inbound-detail-blocked td {
  background: #fff5f5;
}

.inbound-detail-ready td {
  background: #f0fdf8;
}

.inbound-detail-waiting td {
  background: #f8fafc;
}

.inbound-detail-confirmed td {
  background: #ecfdf3;
}

.is-hidden-until-measured {
  display: none !important;
}

.location-master-panel {
  margin-top: 0;
}

.location-map-only {
  display: none !important;
}

body.editing-rack-location .location-flat-only {
  display: none !important;
}

body.editing-flat-location .location-rack-only {
  display: none !important;
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 16px;
}

.guide-tabs,
.guide-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.guide-tab {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 900;
  padding: 9px 12px;
  cursor: pointer;
}

.guide-tab.is-active {
  border-color: var(--accent);
  background: #e9fbf6;
  color: var(--accent);
}

.guide-tab-panel {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.guide-tab-panel.is-active {
  display: grid;
}

.guide-tab-panel section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
}

.guide-body h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.guide-body p,
.guide-body li {
  color: #475467;
  line-height: 1.62;
  font-size: 14px;
}

.guide-body p,
.guide-body ul {
  margin: 0;
}

.guide-body ul {
  padding-left: 18px;
}

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

.linehaul-group-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.linehaul-group-card:hover,
.linehaul-group-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.12);
  transform: translateY(-1px);
  outline: none;
}

.linehaul-group-card header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.linehaul-group-card h3 {
  margin: 0;
  font-size: 14px;
}

.linehaul-group-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.linehaul-detail-button {
  margin-top: 10px;
  width: 100%;
}

.linehaul-detail-panel {
  width: min(1080px, 100%);
}

.linehaul-detail-body {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 12px;
}

.linehaul-group-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.linehaul-group-metrics span {
  display: grid;
  gap: 2px;
  border-radius: 7px;
  background: #f8fafc;
  padding: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.linehaul-group-metrics strong {
  color: var(--text);
  font-size: 14px;
}

.linehaul-basis-box {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.linehaul-basis-box p {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px;
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.linehaul-basis-box strong {
  color: var(--text);
}

.linehaul-source-groups {
  display: grid;
  gap: 8px;
}

.linehaul-source-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.linehaul-source-group summary {
  cursor: pointer;
  padding: 9px 10px;
  font-weight: 900;
  background: #f8fafc;
}

.linehaul-source-list {
  display: grid;
  gap: 5px;
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
}

.location-editor-form label span,
.manual-move-form label span {
  font-weight: 900;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

.search span {
  color: var(--muted);
  font-size: 13px;
}

.search input {
  border: 0;
  outline: 0;
  width: 220px;
}

.primary-button,
.ghost-button {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  white-space: nowrap;
}

.primary-button {
  color: #ffffff;
  background: var(--accent);
  box-shadow: 0 8px 18px rgba(103, 80, 232, 0.2);
}

.ghost-button {
  color: var(--ink);
  background: #fbfaff;
  border-color: var(--line);
}

.ghost-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
}

.small {
  padding: 8px 11px;
  font-size: 14px;
}

.tiny {
  padding: 5px 8px;
  font-size: 11px;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.file-button input[type="file"] {
  display: none;
}

.slot-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  min-width: 0;
}

.slot-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  background: #ffffff;
  font-size: 13px;
  font-weight: 800;
  min-width: 86px;
}

.slot-check input {
  margin: 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric,
.panel,
.client-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.dashboard-visual {
  position: relative;
  min-height: 190px;
  margin-bottom: 16px;
  border: 1px solid rgba(213, 221, 232, 0.85);
  border-radius: 8px;
  overflow: hidden;
  background: #111827;
  box-shadow: var(--shadow);
}

.dashboard-visual img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.74;
}

.dashboard-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(16, 24, 35, 0.84), rgba(16, 24, 35, 0.42) 46%, rgba(16, 24, 35, 0.18));
}

.dashboard-visual-copy {
  position: relative;
  z-index: 1;
  max-width: 620px;
  padding: 30px;
  color: #ffffff;
  display: grid;
  gap: 9px;
}

.dashboard-visual-copy span {
  font-size: 12px;
  font-weight: 800;
  color: #9ee4dc;
}

.dashboard-visual-copy strong {
  font-size: 30px;
  letter-spacing: 0;
}

.dashboard-visual-copy small {
  font-size: 15px;
  line-height: 1.55;
  color: #d6e3ef;
}

.metric {
  padding: 18px;
  display: grid;
  gap: 7px;
  box-shadow: var(--shadow-soft);
}

.metric span,
.settlement-summary span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  font-size: 25px;
}

.metric small {
  color: var(--muted);
}

.metric.urgent {
  border-color: #ead6a5;
  background: #fffaf0;
}

.dashboard-layout,
.section-grid,
.quote-layout,
.map-layout,
.outbound-layout,
.portal-layout {
  display: grid;
  gap: 16px;
}

.dashboard-layout {
  grid-template-columns: minmax(320px, 0.9fr) minmax(500px, 1.2fr);
}

.section-grid {
  grid-template-columns: 380px 1fr;
}

.quote-layout,
.outbound-layout {
  grid-template-columns: 420px 1fr;
}

.portal-layout {
  grid-template-columns: 420px 1fr;
}

.map-layout {
  grid-template-columns: 1fr;
  align-items: start;
}

.map-panel,
.location-detail {
  width: 100%;
}

.split-layout-resizable {
  position: relative;
  grid-template-columns: minmax(280px, var(--split-left, 420px)) minmax(300px, 1fr) !important;
  align-items: stretch;
}

.split-layout-resizable > .panel {
  width: auto !important;
  min-width: 0;
}

.split-layout-resizable > .split-layout-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--split-left, 420px) + 8px);
  width: 18px;
  margin-left: -9px;
  cursor: col-resize;
  z-index: 25;
  touch-action: none;
}

.split-layout-resizable > .split-layout-handle::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 8px;
  width: 2px;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.36);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.68);
}

.split-layout-resizable > .split-layout-handle:hover::before,
.frame-resizing-x .split-layout-resizable > .split-layout-handle::before {
  background: rgba(103, 80, 232, 0.95);
  box-shadow: 0 0 0 5px rgba(103, 80, 232, 0.16);
}

.panel {
  padding: 18px;
  box-shadow: var(--shadow-soft);
}

.user-resizable-panel {
  position: relative;
  resize: none;
  overflow: auto;
  min-width: min(280px, 100%);
  min-height: 180px;
  max-width: none;
}

.resize-handle {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 18px;
  height: 18px;
  border-right: 3px solid rgba(98, 112, 123, 0.58);
  border-bottom: 3px solid rgba(98, 112, 123, 0.58);
  cursor: nwse-resize;
  z-index: 8;
  touch-action: none;
}

.resize-handle:hover {
  border-color: var(--accent);
}

.collapse-handle {
  position: absolute;
  top: 8px;
  right: 8px;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--muted);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 800;
  z-index: 9;
  cursor: pointer;
}

.collapse-handle:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.collapsed-layout {
  height: 64px !important;
  min-height: 64px !important;
  overflow: hidden !important;
}

.collapsed-layout > :not(.panel-head):not(h2):not(.collapse-handle):not(.resize-handle) {
  display: none !important;
}

.resizing-layout {
  user-select: none;
  cursor: nwse-resize;
}

.panel-resize-tools {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.panel-resize-tools button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  padding: 6px 7px;
  cursor: pointer;
}

.panel-resize-tools button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #f4f9ff;
}

.panel-head {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  color: #5d5678;
  font-size: 12px;
  background: var(--surface-soft);
  position: sticky;
  top: 0;
  z-index: 1;
}

.selected-row td {
  background: #f4f1ff;
}

.work-list,
.client-list,
.quote-form,
.portal-form,
.scan-box,
.check-list {
  display: grid;
  gap: 10px;
}

.portal-actions {
  margin-top: 14px;
}

.work-item {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.tag,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  writing-mode: horizontal-tb;
}

.tag.inbound {
  background: #e4f5ee;
  color: var(--ok);
}

.tag.outbound {
  background: #e9eefb;
  color: var(--accent-2);
}

.tag.alert {
  background: #fff2d8;
  color: var(--warn);
}

.client-card {
  padding: 14px;
  cursor: pointer;
  box-shadow: none;
}

.client-card.active {
  border-color: var(--accent);
}

.client-card strong,
.client-card span {
  display: block;
}

.client-card span {
  color: var(--muted);
  margin-top: 5px;
  font-size: 13px;
}

.detail-panel {
  min-height: 440px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.detail-stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
}

.detail-stat span,
.detail-stat small {
  color: var(--muted);
}

.detail-stat strong {
  display: block;
  margin-top: 5px;
  font-size: 20px;
}

label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 13px;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #ffffff;
  color: var(--ink);
}

.quote-result-list {
  display: grid;
  gap: 9px;
}

.upload-box {
  border: 1px dashed #b6c2d0;
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 10px;
  background: var(--surface-soft);
}

.upload-box strong,
.upload-box span {
  display: block;
}

.upload-box span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.upload-box input {
  border: 0;
  background: transparent;
  min-height: auto;
  padding: 0;
}

.quick-inbound-grid {
  display: grid;
  grid-template-columns: 0.8fr 1.7fr;
  gap: 12px;
  margin-bottom: 14px;
}

.quick-inbound-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

.quick-inbound-search {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  align-items: end;
}

.quick-inbound-search label,
.quick-inbound-entry label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.quick-product-result {
  margin-top: 10px;
}

.quick-inbound-entry {
  display: grid;
  grid-template-columns: 1.5fr 0.6fr 0.5fr auto;
  gap: 8px;
  align-items: end;
  margin-top: 10px;
}

.manual-sku-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin: 14px 0;
  background: #f8fbfc;
}

.compact-head {
  margin-bottom: 12px;
  min-height: auto;
}

.compact-head h3 {
  margin: 0;
  font-size: 15px;
}

.manual-sku-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.table-filter-head {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 800;
  padding: 0;
  cursor: pointer;
  text-align: left;
}
.table-filter-head::after {
  content: "↕";
  color: var(--muted);
  font-size: 10px;
}

.table-filter-head.is-active[data-direction="asc"]::after {
  content: "↑";
  color: var(--accent);
}

.table-filter-head.is-active[data-direction="desc"]::after {
  content: "↓";
  color: var(--accent);
}

.universal-filter-head {
  display: grid;
  gap: 6px;
  min-width: 86px;
}

.universal-filter-sort {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.universal-filter-sort::after {
  content: "↕";
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}

.universal-filter-sort.is-asc::after {
  content: "↑";
  color: var(--accent);
}

.universal-filter-sort.is-desc::after {
  content: "↓";
  color: var(--accent);
}

.universal-filter-input {
  width: 100%;
  min-width: 72px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 11px;
  font-weight: 600;
}

.batch-summary-panel {
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fbfc;
}

.batch-filter-bar {
  display: grid;
  grid-template-columns: minmax(140px, 220px) minmax(220px, 1fr);
  gap: 8px;
  margin: 10px 0;
  align-items: end;
}

.batch-filter-bar label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.batch-filter-bar input,
.batch-filter-bar select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  background: #fff;
}

.inbound-batch-detail {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.soft-selected-row td {
  background: #f3f7fa;
}

.batch-method-select {
  min-width: 130px;
  min-height: 34px;
}

.batch-meta-input {
  width: 100%;
  min-width: 110px;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
}

.batch-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.manual-move-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 8px;
  align-items: end;
}

.manual-move-form label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.manual-move-wide {
  grid-column: span 2;
}

.location-editor-form {
  margin-top: 12px;
}

.bulk-location-editor {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}

.inbound-field-panel {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 8px;
  background: #f0fdfa;
}

.mini-panel-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}

.mini-panel-actions span {
  margin-right: 4px;
}

.table-filter-input {
  width: 100%;
  min-width: 74px;
  margin-top: 6px;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 11px;
  font-weight: 600;
}

.linehaul-upload-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.linehaul-direct-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 8px;
  align-items: end;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.linehaul-direct-form label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.upload-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.upload-status {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
}

.upload-preview-panel {
  margin-top: 16px;
}

.quote-document-panel {
  margin-top: 16px;
  display: none;
}

.rate-card-panel {
  margin-top: 16px;
}

.operation-panel,
.operation-table {
  margin-top: 16px;
}

.operation-table tr[data-work-id],
.operation-table tr[data-rework-order] {
  cursor: pointer;
}

.operation-table tr[data-work-id]:hover td,
.operation-table tr[data-rework-order]:hover td {
  background: #f0f6fb;
}

.field-log-summary,
.field-work-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.field-log-summary div,
.field-work-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px 12px;
}

.field-log-summary span,
.field-work-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.field-log-summary strong,
.field-work-summary strong {
  font-size: 20px;
}

.mini-progress {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #e6eaf0;
  overflow: hidden;
  margin-top: 8px;
}

.mini-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.field-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.field-filter-row select {
  min-height: 36px;
}

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

.field-handling-tabs button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}

.field-handling-tabs button.is-active {
  border-color: var(--accent);
  background: #e9fbf6;
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.18);
}

.field-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.field-card-actions button {
  min-height: 30px;
}

.ghost-button.danger {
  border-color: #fecaca;
  background: #fff5f5;
  color: #b42318;
}

.field-worker-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 8px;
  margin: 10px 0 12px;
}

.worker-chip {
  text-align: left;
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
}

.worker-chip:hover {
  border-color: #a9c7df;
  background: #f3f8fc;
}

.worker-chip strong,
.worker-chip span {
  display: block;
}

.worker-chip span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.portal-ai-panel {
  grid-column: 1 / -1;
}

.portal-ai-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.ai-report-box {
  border: 1px solid #cce7df;
  border-radius: 8px;
  background: #f2faf7;
  margin-top: 12px;
  padding: 12px 14px;
}

.ai-report-box p {
  margin: 0 0 8px;
  color: var(--ink);
  line-height: 1.55;
  font-size: 14px;
}

.ai-report-box p:last-child {
  margin-bottom: 0;
}

.portal-ai-item {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 10px 12px;
}

.portal-ai-item strong,
.portal-ai-item small {
  display: block;
}

.portal-ai-item small {
  color: var(--muted);
  margin-top: 3px;
}

.rework-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 260px;
}

.rework-checklist span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.rework-checklist .pass {
  background: #e4f5ee;
  color: var(--ok);
}

.rework-checklist .fail {
  background: #ffe2e2;
  color: var(--danger);
}

.rework-memo {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.ai-stock-summary,
.outbound-summary,
.rework-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.ai-stock-summary div,
.outbound-summary div,
.rework-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px 12px;
}

.ai-stock-summary span,
.outbound-summary span,
.rework-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.ai-stock-summary strong,
.outbound-summary strong,
.rework-summary strong {
  font-size: 20px;
}

@media (max-width: 720px) {
  .field-log-summary,
  .field-work-summary,
  .ai-stock-summary,
  .outbound-summary,
  .rework-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field-worker-summary {
    grid-template-columns: 1fr;
  }
}

.quote-document-panel.open {
  display: block;
}

.quote-document {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 26px;
}

.quote-doc-head {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  border-bottom: 2px solid #17212b;
  padding-bottom: 18px;
  margin-bottom: 20px;
}

.quote-doc-title h3 {
  font-size: 28px;
  margin: 0 0 8px;
}

.quote-doc-title p,
.quote-doc-info p,
.quote-doc-note,
.empty-doc {
  color: var(--muted);
}

.quote-doc-info {
  display: grid;
  gap: 6px;
  justify-content: end;
  text-align: right;
}

.quote-doc-section {
  margin-top: 18px;
}

.quote-doc-section h4 {
  margin: 0 0 10px;
  font-size: 16px;
}

.quote-doc-total {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.quote-doc-total div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
}

.quote-doc-total span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.quote-doc-total strong {
  font-size: 18px;
}

.quote-doc-note {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  font-size: 13px;
  line-height: 1.6;
}

.table-scroll {
  overflow: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

.table-scroll table {
  min-width: 980px;
}

.charge-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.charge-row span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 3px;
}

.total-row {
  margin-top: 12px;
  padding: 14px;
  background: #f4f1ff;
  border: 1px solid #ddd8f3;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.warehouse-map {
  min-height: 560px;
  padding: 14px;
  background: #eef2f6;
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 100%;
}

.warehouse-plan {
  position: relative;
  min-height: clamp(520px, 58vw, 760px);
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(100, 116, 139, 0.18) 1px, transparent 1px) 0 0 / 12.5% 100%,
    linear-gradient(0deg, rgba(100, 116, 139, 0.16) 1px, transparent 1px) 0 0 / 100% 20%,
    #f8fafc;
}

.location-detail {
  display: grid;
  gap: 14px;
}

.location-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.location-summary-grid > div {
  display: grid;
  gap: 4px;
  min-height: 70px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.location-summary-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.location-summary-grid strong {
  font-size: 18px;
}

.location-detail > table {
  width: 100%;
  border-collapse: collapse;
}

.location-detail > table th,
.location-detail > table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.location-detail > table th {
  width: 150px;
  color: var(--muted);
  font-size: 13px;
}

.plan-title {
  position: absolute;
  left: 18px;
  top: 16px;
  z-index: 5;
  display: grid;
  gap: 3px;
}

.plan-title strong {
  font-size: 15px;
}

.plan-title span {
  font-size: 12px;
  color: var(--muted);
}

.plan-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 11px;
  color: #334155;
  font-weight: 800;
}

.plan-legend em {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
  margin-right: -4px;
  border: 2px solid currentColor;
}

.legend-red {
  color: #dc2626;
  background: rgba(254, 226, 226, 0.85);
}

.legend-yellow {
  color: #eab308;
  background: rgba(254, 249, 195, 0.95);
}

.legend-green {
  color: #16a34a;
  background: rgba(220, 252, 231, 0.95);
}

.legend-blue {
  color: #2563eb;
  background: rgba(219, 234, 254, 0.95);
}

.plan-grid span {
  position: absolute;
  top: 58px;
  z-index: 4;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 2px solid #111827;
  border-radius: 999px;
  background: #fff;
  font-weight: 800;
}

.plan-used-area {
  position: absolute;
  left: 5%;
  top: 18%;
  width: 91%;
  height: 76%;
  clip-path: polygon(0 8%, 10% 0, 96% 1%, 100% 5%, 100% 100%, 58% 100%, 58% 80%, 42% 80%, 42% 55%, 18% 55%, 18% 100%, 8% 100%, 8% 68%, 0 68%);
  background: repeating-linear-gradient(150deg, rgba(211, 73, 73, 0.08), rgba(211, 73, 73, 0.08) 18px, rgba(211, 73, 73, 0.34) 20px, rgba(211, 73, 73, 0.34) 23px);
  border: 3px solid rgba(211, 73, 73, 0.82);
}

.plan-wall {
  position: absolute;
  z-index: 3;
  background: #111827;
  border-radius: 999px;
}

.plan-wall.top {
  left: 8%;
  top: 19%;
  width: 88%;
  height: 7px;
  transform: rotate(-1deg);
}

.plan-wall.right {
  left: 96%;
  top: 20%;
  width: 7px;
  height: 74%;
}

.plan-wall.bottom {
  left: 58%;
  top: 94%;
  width: 38%;
  height: 7px;
}

.plan-wall.inner-a {
  left: 57%;
  top: 19%;
  width: 7px;
  height: 38%;
}

.plan-wall.inner-b {
  left: 42%;
  top: 55%;
  width: 7px;
  height: 26%;
}

.plan-core {
  position: absolute;
  z-index: 4;
  display: grid;
  place-items: center;
  border: 2px solid #111827;
  background: #e5e7eb;
  border-radius: 6px;
  color: #111827;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.plan-core.eps {
  left: 13%;
  top: 32%;
  width: 7%;
  height: 9%;
}

.plan-core.stairs {
  left: 74%;
  top: 34%;
  width: 8%;
  height: 13%;
}

.plan-core.dock {
  left: 58%;
  top: 84%;
  width: 12%;
  height: 9%;
}

.plan-location {
  position: absolute;
  z-index: 6;
  border: 2px solid #1d4ed8;
  border-radius: 8px;
  padding: 9px;
  display: grid;
  align-content: start;
  gap: 3px;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.14);
}

.plan-location strong {
  font-size: 22px;
}

.plan-location span,
.plan-location small {
  font-size: 12px;
  font-weight: 800;
}

.plan-location.hot {
  background: rgba(254, 226, 226, 0.9);
  border-color: #dc2626;
}

.plan-location.rack {
  background: rgba(219, 234, 254, 0.92);
}

.plan-location.reserve {
  background: rgba(220, 252, 231, 0.92);
  border-color: #15803d;
}

.plan-location.flat {
  background: rgba(254, 249, 195, 0.96);
  border-color: #eab308;
}

.plan-location.dock {
  background: rgba(220, 252, 231, 0.94);
  border-color: #16a34a;
}

.plan-location.office {
  background: rgba(224, 231, 255, 0.94);
  border-color: #4f46e5;
}

.plan-location.free {
  box-shadow: inset 0 0 0 999px rgba(236, 253, 245, 0.32), 0 8px 22px rgba(15, 23, 42, 0.14);
}

.plan-location.busy {
  border-color: #f59e0b;
  box-shadow: inset 0 0 0 999px rgba(254, 243, 199, 0.48), 0 8px 22px rgba(180, 83, 9, 0.2);
}

.plan-location.full {
  border-color: #dc2626;
  box-shadow: inset 0 0 0 999px rgba(254, 226, 226, 0.56), 0 8px 22px rgba(185, 28, 28, 0.24);
}

.plan-location.selected {
  outline: 4px solid #111827;
}

body.map-placement-mode .warehouse-plan {
  cursor: crosshair;
  outline: 3px solid rgba(0, 132, 117, 0.36);
  outline-offset: 4px;
}

body.map-placement-mode .plan-location {
  cursor: crosshair;
}

.plan-location.real-rack-zone {
  z-index: 8;
  padding: 12px;
  border-width: 3px;
  justify-content: center;
  text-align: center;
}

.plan-location.real-rack-zone strong {
  font-size: 30px;
  line-height: 1;
}

.plan-location.real-rack-zone span {
  font-size: 13px;
}

.plan-location.real-rack-zone small {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 26px;
  margin-top: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  font-size: 15px;
  color: #111827;
}

.allocation-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin: 2px 4px 2px 0;
  padding: 4px 8px;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 999px;
  background: #ecfdf5;
  color: #0f766e;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.map-slot-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
  max-height: 280px;
  overflow: auto;
}

.map-empty {
  color: var(--muted);
  font-weight: 700;
}

.loc {
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  min-width: 0;
}

.loc strong,
.loc span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.loc strong {
  font-size: 13px;
}

.loc span {
  font-size: 12px;
}

.loc.free {
  background: #dbf3e4;
  color: #14542b;
}

.loc.busy {
  background: #fff0c2;
  color: #6f4300;
}

.loc.full {
  background: #ffdada;
  color: #842121;
}

.loc.hold {
  background: #e9e4ff;
  color: #4b3a91;
}

.loc.selected {
  outline: 3px solid #17212b;
}

.detail-chip-group {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 12px;
}

.detail-chip-group strong {
  width: 100%;
  font-size: 13px;
}

.detail-chip {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  background: #fff;
  cursor: pointer;
  font-weight: 800;
}

.location-stock-box {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  overflow: hidden;
}

.stock-box-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.stock-box-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.compact-table table {
  min-width: 760px;
}

.compact-table th,
.compact-table td {
  font-size: 12px;
  padding: 8px;
}

.table-link {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 900;
  cursor: pointer;
  padding: 0;
}

#fieldRows td:nth-child(6) {
  font-size: 12px;
  color: var(--muted);
  font-weight: 800;
}

.legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

.legend .free {
  background: #83d59b;
}

.legend .busy {
  background: #f0c24e;
}

.legend .full {
  background: #e87575;
}

.legend .hold {
  background: #9d8ddb;
}

.recommendation {
  border-left: 4px solid var(--accent);
  padding: 12px;
  background: #f2faf7;
  border-radius: 6px;
  margin-top: 12px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.status-pill.waiting {
  background: #eef2f6;
  color: #475467;
}

.status-pill.hold {
  background: #fff4d6;
  color: #9a6700;
}

.status-pill.pass {
  background: #e4f5ee;
  color: var(--ok);
}

.status-pill.fail {
  background: #ffe2e2;
  color: var(--danger);
}

.status-pill.working {
  background: #fff4d6;
  color: #8a5a00;
}

.check-list {
  padding: 0;
  margin: 0;
  list-style: none;
}

.check-list li {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.check-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #eef2f6;
  color: #667085;
  font-size: 13px;
  font-weight: 800;
}

.check-list li.pass .check-icon {
  background: #dff3e6;
  color: var(--ok);
}

.check-list li.fail .check-icon {
  background: #ffdada;
  color: var(--danger);
}

.field-step-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.field-step {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
  min-width: 0;
}

.field-step strong,
.field-step span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-step strong {
  font-size: 12px;
  color: var(--muted);
}

.field-step span {
  margin-top: 4px;
  font-weight: 800;
  color: var(--text);
}

.field-step.done {
  border-color: #b9dfc4;
  background: #eaf8ee;
}

.field-step.todo {
  border-color: #f1c2c2;
  background: #fff5f5;
}

.product-preview {
  margin-top: 12px;
}

.product-preview-empty,
.product-preview-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.product-preview-empty {
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
}

.product-preview-card {
  display: grid;
  grid-template-columns: 98px 1fr;
  gap: 14px;
  padding: 12px;
}

.oms-queue-panel {
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
}

.oms-queue-panel.prominent {
  margin: 0 0 18px;
  border-color: #b7d5f5;
  background: linear-gradient(180deg, #f4f9ff 0%, #ffffff 100%);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.oms-queue-panel h3 {
  margin: 0;
  font-size: 16px;
}

.oms-queue-panel .panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.shipper-admin-grid,
.shipper-account-form {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.shipper-admin-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.shipper-account-form {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items: end;
}

.product-image-box {
  min-height: 98px;
  border-radius: 8px;
  background: linear-gradient(135deg, #23313f, #607383);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #fff;
  font-weight: 900;
  font-size: 24px;
}

.product-image-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-preview-body {
  min-width: 0;
}

.product-preview-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.product-preview-title strong,
.product-preview-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-preview-title strong {
  color: var(--text);
}

.product-preview-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.product-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.product-meta-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
  min-width: 0;
}

.product-meta-grid span,
.product-meta-grid strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-meta-grid span {
  font-size: 11px;
  color: var(--muted);
}

.product-meta-grid strong {
  margin-top: 3px;
  font-size: 13px;
}

.spec-chip-row,
.guard-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.spec-chip-row span,
.guard-item {
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 800;
}

.spec-chip-row span {
  background: #edf2f7;
  color: #405162;
}

.guard-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eef2f6;
  color: #465567;
}

.guard-item.pass {
  background: #e4f5ee;
  color: var(--ok);
}

.guard-item.warn {
  background: #fff4d6;
  color: #8a5a00;
}

.guard-item.fail {
  background: #ffe2e2;
  color: var(--danger);
}

.settlement-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.settlement-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
}

.settlement-summary strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

.settlement-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 16px;
}

.settlement-flow span {
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.settlement-flow span.done {
  border-color: #b9dfc4;
  background: #eaf8ee;
  color: var(--ok);
}

.settlement-flow span.active:last-child {
  border-color: #c9d5e8;
  background: #eef4fb;
  color: var(--accent);
}

.settlement-ledger-panel {
  margin-top: 16px;
}

.permission-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 520px;
}

.permission-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  padding: 4px 9px 4px 7px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.permission-check input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--accent);
  padding: 0;
}

.permission-check:has(input:checked) {
  border-color: #cfc5ff;
  background: #f4f1ff;
  color: var(--accent);
}

/* Product-master aligned compact management UI */
body:not(.auth-locked) {
  background: #f7f7fb;
}

body:not(.auth-locked) .app-shell {
  grid-template-columns: var(--sidebar-width, 196px) minmax(0, 1fr);
}

body:not(.auth-locked) .sidebar {
  background: #21194a;
  color: #ffffff;
  padding: 12px;
  gap: 9px;
}

body:not(.auth-locked) .brand {
  min-height: 38px;
}

body:not(.auth-locked) .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
}

body:not(.auth-locked) .brand strong,
body:not(.auth-locked) .nav-item,
body:not(.auth-locked) .common-system-shortcuts__menu a,
body:not(.auth-locked) .mode-switch button {
  color: #ffffff;
  opacity: 1;
  text-shadow: none;
}

body:not(.auth-locked) .brand span {
  color: #d9d3ff;
}

body:not(.auth-locked) .common-system-shortcuts summary {
  min-height: 28px;
  padding: 5px 9px;
  border-color: rgba(235, 231, 255, 0.24);
  color: #ffffff;
  font-size: 12px;
}

body:not(.auth-locked) .common-system-shortcuts__menu {
  max-height: 190px;
  padding: 6px;
}

body:not(.auth-locked) .common-system-shortcuts__menu a {
  padding: 6px 7px;
}

body:not(.auth-locked) .nav-list {
  gap: 2px;
}

body:not(.auth-locked) .nav-item {
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.15;
}

body:not(.auth-locked) .nav-item:hover,
body:not(.auth-locked) .nav-item.active {
  background: #33236f;
}

body:not(.auth-locked) .mode-switch {
  border-color: rgba(235, 231, 255, 0.22);
}

body:not(.auth-locked) .mode-switch button {
  min-height: 30px;
  padding: 5px 3px;
  font-weight: 800;
}

body:not(.auth-locked) .main {
  padding: 16px 20px;
  max-width: none;
}

body:not(.auth-locked) .topbar {
  align-items: center;
  gap: 12px;
  min-height: 54px;
  margin-bottom: 12px;
  padding: 0 0 10px;
  background: rgba(247, 247, 251, 0.94);
}

body:not(.auth-locked) .topbar > div:first-child {
  flex: 0 0 260px;
  min-width: 240px;
}

body:not(.auth-locked) h1 {
  font-size: 25px;
  line-height: 1.15;
}

body:not(.auth-locked) h2 {
  font-size: 16px;
  line-height: 1.25;
}

body:not(.auth-locked) .topbar p {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.35;
}

body:not(.auth-locked) .top-actions,
body:not(.auth-locked) .filter-row,
body:not(.auth-locked) .panel-head {
  gap: 7px;
}

body:not(.auth-locked) .auth-box {
  padding: 4px;
  border-radius: 10px;
}

body:not(.auth-locked) .auth-box select,
body:not(.auth-locked) .auth-box input {
  min-height: 32px;
}

body:not(.auth-locked) .search {
  min-height: 38px;
  padding: 6px 9px;
  border-radius: 10px;
}

body:not(.auth-locked) .search input {
  width: 190px;
}

body:not(.auth-locked) .primary-button,
body:not(.auth-locked) .ghost-button {
  min-height: 36px;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 800;
}

body:not(.auth-locked) .small {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

body:not(.auth-locked) .tiny {
  min-height: 26px;
  padding: 4px 7px;
  font-size: 11px;
}

body:not(.auth-locked) .metric-grid {
  gap: 10px;
  margin-bottom: 12px;
}

body:not(.auth-locked) .metric,
body:not(.auth-locked) .panel,
body:not(.auth-locked) .client-card {
  border-color: #e3e0f4;
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(39, 31, 86, 0.06);
}

body:not(.auth-locked) .metric {
  min-height: 88px;
  padding: 13px 16px;
  gap: 4px;
}

body:not(.auth-locked) .metric span,
body:not(.auth-locked) .settlement-summary span {
  font-size: 12px;
}

body:not(.auth-locked) .metric strong {
  font-size: 23px;
  line-height: 1.15;
}

body:not(.auth-locked) .metric small {
  font-size: 12px;
}

body:not(.auth-locked) .dashboard-layout,
body:not(.auth-locked) .section-grid,
body:not(.auth-locked) .quote-layout,
body:not(.auth-locked) .map-layout,
body:not(.auth-locked) .outbound-layout,
body:not(.auth-locked) .portal-layout {
  gap: 10px;
}

body:not(.auth-locked) .dashboard-layout {
  grid-template-columns: minmax(360px, 0.78fr) minmax(520px, 1.22fr);
}

body:not(.auth-locked) .panel {
  padding: 14px 16px;
}

body:not(.auth-locked) .panel-head {
  min-height: 30px;
  margin-bottom: 10px;
  align-items: center;
}

body:not(.auth-locked) .work-list,
body:not(.auth-locked) .client-list,
body:not(.auth-locked) .quote-form,
body:not(.auth-locked) .portal-form,
body:not(.auth-locked) .scan-box,
body:not(.auth-locked) .check-list {
  gap: 7px;
}

body:not(.auth-locked) table {
  font-size: 13px;
}

body:not(.auth-locked) th,
body:not(.auth-locked) td {
  padding: 8px 9px;
  border-bottom-color: #e7e4f5;
}

body:not(.auth-locked) th {
  height: 34px;
  font-size: 11px;
  font-weight: 900;
  color: #50466f;
  background: #f4f2fb;
}

body:not(.auth-locked) .table-scroll {
  border-radius: 10px;
}

body:not(.auth-locked) .upload-box {
  padding: 12px;
  border-radius: 10px;
}

body:not(.auth-locked) input,
body:not(.auth-locked) select,
body:not(.auth-locked) textarea {
  border-radius: 9px;
  border-color: #ddd8f3;
}

body:not(.auth-locked) .tag,
body:not(.auth-locked) .status-pill {
  min-height: 23px;
  padding: 2px 8px;
  font-size: 11px;
}

body:not(.auth-locked) .collapse-handle {
  min-height: 24px;
  padding: 2px 7px;
}

body:not(.auth-locked) .dashboard-visual {
  display: none;
}

@media (max-width: 980px) {
  body:not(.auth-locked) .app-shell {
    grid-template-columns: 1fr;
  }

  body:not(.auth-locked) .sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 8px;
    gap: 7px;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
  }

  body:not(.auth-locked) .brand {
    min-height: 32px;
  }

  body:not(.auth-locked) .brand-mark {
    width: 30px;
    height: 30px;
    font-size: 11px;
  }

  body:not(.auth-locked) .brand span {
    display: none;
  }

  body:not(.auth-locked) .common-system-shortcuts summary {
    min-height: 28px;
  }

  body:not(.auth-locked) .common-system-shortcuts__menu {
    max-height: 120px;
  }

  body:not(.auth-locked) .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
  }

  body:not(.auth-locked) .nav-item {
    text-align: center;
    padding: 8px 4px;
    font-size: 12px;
    white-space: normal;
  }

  body:not(.auth-locked) .mode-switch {
    min-height: 32px;
  }

  body:not(.auth-locked) .main {
    padding: 10px;
  }

  body:not(.auth-locked) .topbar,
  body:not(.auth-locked) .top-actions {
    align-items: stretch;
  }

  body:not(.auth-locked) .topbar {
    flex-direction: column;
    min-height: 0;
  }

  body:not(.auth-locked) .topbar > div:first-child {
    flex: 0 1 auto;
    min-width: 0;
  }

  body:not(.auth-locked) .top-actions {
    justify-content: stretch;
  }

  body:not(.auth-locked) .auth-box,
  body:not(.auth-locked) .search {
    width: 100%;
  }

  body:not(.auth-locked) .search input {
    width: 100%;
  }

  body:not(.auth-locked) .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body:not(.auth-locked) .dashboard-layout,
  body:not(.auth-locked) .section-grid,
  body:not(.auth-locked) .quote-layout,
  body:not(.auth-locked) .outbound-layout,
  body:not(.auth-locked) .portal-layout {
    grid-template-columns: 1fr;
  }

  body:not(.auth-locked) .table-scroll table {
    min-width: 720px;
  }
}

@media (max-width: 620px) {
  body:not(.auth-locked) {
    font-size: 14px;
  }

  body:not(.auth-locked) .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body:not(.auth-locked) .main {
    padding: 8px;
  }

  body:not(.auth-locked) h1 {
    font-size: 23px;
  }

  body:not(.auth-locked) .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  body:not(.auth-locked) .metric {
    min-height: 78px;
    padding: 10px 12px;
  }

  body:not(.auth-locked) .metric strong {
    font-size: 20px;
  }

  body:not(.auth-locked) .panel {
    padding: 12px;
  }

  body:not(.auth-locked) .primary-button,
  body:not(.auth-locked) .ghost-button,
  body:not(.auth-locked) input,
  body:not(.auth-locked) select,
  body:not(.auth-locked) button {
    min-height: 38px;
  }

  body:not(.auth-locked) th,
  body:not(.auth-locked) td {
    padding: 8px;
    font-size: 12px;
  }
}

/* Final dark-mode override. Keep at EOF because compact PM-style rules are duplicated above. */
body.dark-mode:not(.auth-locked),
body.dark-mode:not(.auth-locked) .main,
body.dark-mode:not(.auth-locked) .app-shell {
  background: #05060a !important;
  color: #f4f7fb !important;
}

body.dark-mode:not(.auth-locked) .sidebar {
  background: #090d16 !important;
  color: #f4f7fb !important;
  border-right: 1px solid #222b3a !important;
}

body.dark-mode:not(.auth-locked) .brand,
body.dark-mode:not(.auth-locked) .nav-list,
body.dark-mode:not(.auth-locked) .menu-order-toolbar {
  background: transparent !important;
}

body.dark-mode:not(.auth-locked) .brand strong,
body.dark-mode:not(.auth-locked) .nav-item,
body.dark-mode:not(.auth-locked) .mode-switch button,
body.dark-mode:not(.auth-locked) .common-system-shortcuts__menu a {
  color: #f4f7fb !important;
  opacity: 1 !important;
}

body.dark-mode:not(.auth-locked) .brand span {
  color: #aab4c3 !important;
}

body.dark-mode:not(.auth-locked) .nav-item {
  background: transparent !important;
}

body.dark-mode:not(.auth-locked) .nav-item:hover {
  background: #161d2d !important;
}

body.dark-mode:not(.auth-locked) .nav-item.active {
  background: #29235b !important;
  color: #ffffff !important;
}

body.dark-mode:not(.auth-locked) .common-system-shortcuts,
body.dark-mode:not(.auth-locked) .common-system-shortcuts__summary,
body.dark-mode:not(.auth-locked) .common-system-shortcuts__menu,
body.dark-mode:not(.auth-locked) .mode-switch {
  border-color: #2b3445 !important;
  background: #111827 !important;
  color: #f4f7fb !important;
}

body.dark-mode:not(.auth-locked) .common-system-shortcuts__link:hover {
  background: #1b2233 !important;
}

body.dark-mode:not(.auth-locked) .common-system-shortcuts__link.is-active,
body.dark-mode:not(.auth-locked) .mode-switch .selected {
  background: #29235b !important;
  color: #ffffff !important;
}

body.dark-mode:not(.auth-locked) .topbar {
  background: #05060a !important;
  border-color: #222b3a !important;
}

body.dark-mode:not(.auth-locked) .panel,
body.dark-mode:not(.auth-locked) .metric,
body.dark-mode:not(.auth-locked) .client-card,
body.dark-mode:not(.auth-locked) .upload-box,
body.dark-mode:not(.auth-locked) .table-scroll,
body.dark-mode:not(.auth-locked) .auth-box,
body.dark-mode:not(.auth-locked) .search,
body.dark-mode:not(.auth-locked) .portal-form,
body.dark-mode:not(.auth-locked) .settlement-summary div,
body.dark-mode:not(.auth-locked) .settlement-doc-grid article {
  border-color: #2b3445 !important;
  background: #12151f !important;
  color: #f4f7fb !important;
}

body.dark-mode:not(.auth-locked) th,
body.dark-mode:not(.auth-locked) .table-filter-head {
  border-color: #2b3445 !important;
  background: #171b28 !important;
  color: #f4f7fb !important;
}

body.dark-mode:not(.auth-locked) td {
  border-color: #252d3c !important;
  background: #12151f !important;
  color: #dce3ee !important;
}

body.dark-mode:not(.auth-locked) tr:hover td,
body.dark-mode:not(.auth-locked) .selected-row td,
body.dark-mode:not(.auth-locked) .soft-selected-row td {
  background: #1b2233 !important;
  color: #ffffff !important;
}

body.dark-mode:not(.auth-locked) input,
body.dark-mode:not(.auth-locked) select,
body.dark-mode:not(.auth-locked) textarea,
body.dark-mode:not(.auth-locked) .universal-filter-input,
body.dark-mode:not(.auth-locked) .table-filter-input {
  border-color: #374151 !important;
  background: #0b1020 !important;
  color: #f4f7fb !important;
}

body.dark-mode:not(.auth-locked) input::placeholder,
body.dark-mode:not(.auth-locked) textarea::placeholder,
body.dark-mode:not(.auth-locked) .metric span,
body.dark-mode:not(.auth-locked) .metric small,
body.dark-mode:not(.auth-locked) .panel-head span,
body.dark-mode:not(.auth-locked) .settlement-doc-grid p {
  color: #9aa7ba !important;
}

body.dark-mode:not(.auth-locked) .ghost-button {
  border-color: #3c4659 !important;
  background: #111827 !important;
  color: #f4f7fb !important;
}

body.dark-mode:not(.auth-locked) .primary-button,
body.dark-mode:not(.auth-locked) .brand-mark {
  background: #7c6df2 !important;
  color: #ffffff !important;
}

@media (max-width: 980px) {
  body.dark-mode.mobile-nav-collapsed:not(.auth-locked) .sidebar {
    background: #090d16 !important;
    border-bottom: 1px solid #222b3a !important;
  }
}

/* Final EOF visual guard: fixes remaining dark-mode/light-mode leaks and mobile text overlap. */
body:not(.auth-locked) {
  overflow-x: hidden !important;
}

body:not(.auth-locked) h1,
body:not(.auth-locked) h2,
body:not(.auth-locked) h3,
body:not(.auth-locked) h4,
body:not(.auth-locked) p,
body:not(.auth-locked) label,
body:not(.auth-locked) span,
body:not(.auth-locked) small,
body:not(.auth-locked) strong,
body:not(.auth-locked) button,
body:not(.auth-locked) a,
body:not(.auth-locked) td,
body:not(.auth-locked) th {
  text-shadow: none !important;
}

body:not(.auth-locked) .app-shell,
body:not(.auth-locked) .main,
body:not(.auth-locked) .view,
body:not(.auth-locked) .panel,
body:not(.auth-locked) .sidebar,
body:not(.auth-locked) .topbar {
  max-width: 100% !important;
  box-sizing: border-box !important;
}

body.dark-mode:not(.auth-locked) .sidebar,
body.dark-mode:not(.auth-locked) .brand,
body.dark-mode:not(.auth-locked) .nav-list,
body.dark-mode:not(.auth-locked) .menu-order-toolbar,
body.dark-mode:not(.auth-locked) .common-system-shortcuts,
body.dark-mode:not(.auth-locked) .common-system-shortcuts__summary,
body.dark-mode:not(.auth-locked) .common-system-shortcuts__menu,
body.dark-mode:not(.auth-locked) .mode-switch {
  background: #0b1020 !important;
  border-color: #2b3445 !important;
  color: #f4f7fb !important;
}

body.dark-mode:not(.auth-locked) .view,
body.dark-mode:not(.auth-locked) .panel,
body.dark-mode:not(.auth-locked) .modal,
body.dark-mode:not(.auth-locked) .modal-card,
body.dark-mode:not(.auth-locked) .drawer,
body.dark-mode:not(.auth-locked) .sheet,
body.dark-mode:not(.auth-locked) .form-grid,
body.dark-mode:not(.auth-locked) .filter-row,
body.dark-mode:not(.auth-locked) .toolbar,
body.dark-mode:not(.auth-locked) .inline-toolbar,
body.dark-mode:not(.auth-locked) .kpi-card,
body.dark-mode:not(.auth-locked) .status-card,
body.dark-mode:not(.auth-locked) .quote-preview,
body.dark-mode:not(.auth-locked) .quote-editor,
body.dark-mode:not(.auth-locked) .work-card,
body.dark-mode:not(.auth-locked) .instruction-card,
body.dark-mode:not(.auth-locked) .guide-card,
body.dark-mode:not(.auth-locked) .detail-card,
body.dark-mode:not(.auth-locked) .data-card,
body.dark-mode:not(.auth-locked) .summary-card,
body.dark-mode:not(.auth-locked) .flow-card,
body.dark-mode:not(.auth-locked) .table-card,
body.dark-mode:not(.auth-locked) .empty-state {
  background: #12151f !important;
  border-color: #2b3445 !important;
  color: #f4f7fb !important;
}

body.dark-mode:not(.auth-locked) .nav-item,
body.dark-mode:not(.auth-locked) .common-system-shortcuts__link,
body.dark-mode:not(.auth-locked) .common-system-shortcuts__menu a,
body.dark-mode:not(.auth-locked) .mode-switch button {
  background: transparent !important;
  color: #f4f7fb !important;
  opacity: 1 !important;
}

body.dark-mode:not(.auth-locked) .nav-item:hover,
body.dark-mode:not(.auth-locked) .common-system-shortcuts__link:hover,
body.dark-mode:not(.auth-locked) .mode-switch button:hover {
  background: #1b2233 !important;
}

body.dark-mode:not(.auth-locked) .nav-item.active,
body.dark-mode:not(.auth-locked) .common-system-shortcuts__link.is-active,
body.dark-mode:not(.auth-locked) .mode-switch button.selected {
  background: #29235b !important;
  color: #ffffff !important;
}

body.dark-mode:not(.auth-locked) h1,
body.dark-mode:not(.auth-locked) h2,
body.dark-mode:not(.auth-locked) h3,
body.dark-mode:not(.auth-locked) h4,
body.dark-mode:not(.auth-locked) strong,
body.dark-mode:not(.auth-locked) label {
  color: #f8fafc !important;
}

body.dark-mode:not(.auth-locked) p,
body.dark-mode:not(.auth-locked) small,
body.dark-mode:not(.auth-locked) .muted,
body.dark-mode:not(.auth-locked) .subtle,
body.dark-mode:not(.auth-locked) .help-text,
body.dark-mode:not(.auth-locked) .desc,
body.dark-mode:not(.auth-locked) .view > header p {
  color: #aab4c3 !important;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.inline-actions .tiny {
  min-height: 28px !important;
  padding: 4px 7px !important;
  font-size: 11px !important;
  white-space: nowrap;
}

@media (max-width: 980px) {
  body:not(.auth-locked) .sidebar {
    width: 100% !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
  }

  body:not(.auth-locked) .brand strong,
  body:not(.auth-locked) .brand span,
  body:not(.auth-locked) .nav-item,
  body:not(.auth-locked) .common-system-shortcuts__link,
  body:not(.auth-locked) .mode-switch button {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    line-height: 1.22 !important;
  }

  body:not(.auth-locked) .nav-list {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 5px !important;
    max-height: 156px !important;
    overflow: auto !important;
  }

  body:not(.auth-locked) .nav-item {
    min-width: 0 !important;
    min-height: 34px !important;
    padding: 7px 6px !important;
    text-align: center !important;
  }

  body.mobile-nav-collapsed:not(.auth-locked) .sidebar {
    max-height: 78px !important;
    overflow: hidden !important;
  }
}

@media (max-width: 430px) {
  body:not(.auth-locked) .main {
    padding: 10px !important;
  }

  body:not(.auth-locked) .nav-list,
  body:not(.auth-locked) .common-system-shortcuts__menu {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body:not(.auth-locked) .panel,
  body:not(.auth-locked) .metric,
  body:not(.auth-locked) .client-card,
  body:not(.auth-locked) .upload-box {
    padding: 10px !important;
  }
}

/* Global visual hardening: keep dark mode and mobile text stable across all WMS panels. */
body:not(.auth-locked) {
  overflow-x: hidden !important;
}

body:not(.auth-locked) .app-shell,
body:not(.auth-locked) .main,
body:not(.auth-locked) .view,
body:not(.auth-locked) .panel,
body:not(.auth-locked) .panel *,
body:not(.auth-locked) .sidebar,
body:not(.auth-locked) .sidebar *,
body:not(.auth-locked) .topbar,
body:not(.auth-locked) .topbar * {
  max-width: 100%;
  box-sizing: border-box;
}

body:not(.auth-locked) h1,
body:not(.auth-locked) h2,
body:not(.auth-locked) h3,
body:not(.auth-locked) h4,
body:not(.auth-locked) p,
body:not(.auth-locked) label,
body:not(.auth-locked) span,
body:not(.auth-locked) small,
body:not(.auth-locked) strong,
body:not(.auth-locked) button,
body:not(.auth-locked) a,
body:not(.auth-locked) td,
body:not(.auth-locked) th {
  text-shadow: none !important;
}

body.dark-mode:not(.auth-locked) .view,
body.dark-mode:not(.auth-locked) .modal,
body.dark-mode:not(.auth-locked) .modal-card,
body.dark-mode:not(.auth-locked) .drawer,
body.dark-mode:not(.auth-locked) .sheet,
body.dark-mode:not(.auth-locked) .form-grid,
body.dark-mode:not(.auth-locked) .filter-row,
body.dark-mode:not(.auth-locked) .toolbar,
body.dark-mode:not(.auth-locked) .inline-toolbar,
body.dark-mode:not(.auth-locked) .kpi-card,
body.dark-mode:not(.auth-locked) .status-card,
body.dark-mode:not(.auth-locked) .quote-preview,
body.dark-mode:not(.auth-locked) .quote-editor,
body.dark-mode:not(.auth-locked) .work-card,
body.dark-mode:not(.auth-locked) .instruction-card,
body.dark-mode:not(.auth-locked) .guide-card,
body.dark-mode:not(.auth-locked) .detail-card,
body.dark-mode:not(.auth-locked) .data-card,
body.dark-mode:not(.auth-locked) .summary-card,
body.dark-mode:not(.auth-locked) .flow-card,
body.dark-mode:not(.auth-locked) .table-card,
body.dark-mode:not(.auth-locked) .empty-state {
  border-color: #2b3445 !important;
  background: #12151f !important;
  color: #f4f7fb !important;
}

body.dark-mode:not(.auth-locked) h1,
body.dark-mode:not(.auth-locked) h2,
body.dark-mode:not(.auth-locked) h3,
body.dark-mode:not(.auth-locked) h4,
body.dark-mode:not(.auth-locked) strong,
body.dark-mode:not(.auth-locked) label,
body.dark-mode:not(.auth-locked) .section-title {
  color: #f8fafc !important;
}

body.dark-mode:not(.auth-locked) p,
body.dark-mode:not(.auth-locked) small,
body.dark-mode:not(.auth-locked) .muted,
body.dark-mode:not(.auth-locked) .subtle,
body.dark-mode:not(.auth-locked) .help-text,
body.dark-mode:not(.auth-locked) .desc,
body.dark-mode:not(.auth-locked) .view > header p {
  color: #aab4c3 !important;
}

body.dark-mode:not(.auth-locked) .common-system-shortcuts,
body.dark-mode:not(.auth-locked) .common-system-shortcuts__summary,
body.dark-mode:not(.auth-locked) .common-system-shortcuts__menu,
body.dark-mode:not(.auth-locked) .menu-order-toolbar,
body.dark-mode:not(.auth-locked) .nav-list,
body.dark-mode:not(.auth-locked) .mode-switch {
  background: #0f172a !important;
  border-color: #2b3445 !important;
  color: #f4f7fb !important;
}

body.dark-mode:not(.auth-locked) .common-system-shortcuts__summary::after {
  color: #aab4c3 !important;
}

body.dark-mode:not(.auth-locked) .nav-item,
body.dark-mode:not(.auth-locked) .common-system-shortcuts__link,
body.dark-mode:not(.auth-locked) .common-system-shortcuts__menu a,
body.dark-mode:not(.auth-locked) .mode-switch button {
  color: #f4f7fb !important;
  background: transparent !important;
}

body.dark-mode:not(.auth-locked) .nav-item:hover,
body.dark-mode:not(.auth-locked) .common-system-shortcuts__link:hover,
body.dark-mode:not(.auth-locked) .mode-switch button:hover {
  background: #1b2233 !important;
}

body.dark-mode:not(.auth-locked) .nav-item.active,
body.dark-mode:not(.auth-locked) .common-system-shortcuts__link.is-active,
body.dark-mode:not(.auth-locked) .mode-switch button.selected {
  background: #29235b !important;
  color: #ffffff !important;
}

body.dark-mode:not(.auth-locked) .status-pill,
body.dark-mode:not(.auth-locked) .badge,
body.dark-mode:not(.auth-locked) .chip {
  border-color: #3c4659 !important;
}

@media (max-width: 980px) {
  body:not(.auth-locked) .sidebar {
    width: 100% !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
  }

  body:not(.auth-locked) .brand {
    gap: 8px !important;
  }

  body:not(.auth-locked) .brand strong,
  body:not(.auth-locked) .brand span,
  body:not(.auth-locked) .nav-item,
  body:not(.auth-locked) .common-system-shortcuts__link,
  body:not(.auth-locked) .mode-switch button {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    line-height: 1.22 !important;
  }

  body:not(.auth-locked) .nav-list {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 5px !important;
    max-height: 156px !important;
    overflow: auto !important;
  }

  body:not(.auth-locked) .nav-item {
    min-width: 0 !important;
    min-height: 34px !important;
    padding: 7px 6px !important;
    text-align: center !important;
  }

  body.mobile-nav-collapsed:not(.auth-locked) .sidebar {
    max-height: 78px !important;
    overflow: hidden !important;
  }
}

@media (max-width: 430px) {
  body:not(.auth-locked) .main {
    padding: 10px !important;
  }

  body:not(.auth-locked) .topbar {
    gap: 8px !important;
  }

  body:not(.auth-locked) .nav-list,
  body:not(.auth-locked) .common-system-shortcuts__menu {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body:not(.auth-locked) .panel,
  body:not(.auth-locked) .metric,
  body:not(.auth-locked) .client-card,
  body:not(.auth-locked) .upload-box {
    padding: 10px !important;
  }
}

/* Dark mode final override: compact PM-style sidebar rules appear later, so keep this last. */
body.dark-mode:not(.auth-locked) .app-shell {
  background: #05060a !important;
}

body.dark-mode:not(.auth-locked) .sidebar {
  background: #090d16 !important;
  color: #f4f7fb !important;
  border-right: 1px solid #222b3a !important;
}

body.dark-mode:not(.auth-locked) .brand strong,
body.dark-mode:not(.auth-locked) .nav-item,
body.dark-mode:not(.auth-locked) .mode-switch button,
body.dark-mode:not(.auth-locked) .common-system-shortcuts__menu a {
  color: #f4f7fb !important;
}

body.dark-mode:not(.auth-locked) .brand span {
  color: #aab4c3 !important;
}

body.dark-mode:not(.auth-locked) .nav-list,
body.dark-mode:not(.auth-locked) .menu-order-toolbar {
  background: transparent !important;
}

body.dark-mode:not(.auth-locked) .nav-item {
  background: transparent !important;
}

body.dark-mode:not(.auth-locked) .nav-item:hover {
  background: #161d2d !important;
}

body.dark-mode:not(.auth-locked) .nav-item.active {
  background: #29235b !important;
  color: #ffffff !important;
}

body.dark-mode:not(.auth-locked) .common-system-shortcuts,
body.dark-mode:not(.auth-locked) .common-system-shortcuts__summary,
body.dark-mode:not(.auth-locked) .common-system-shortcuts__menu {
  border-color: #2b3445 !important;
  background: #111827 !important;
  color: #f4f7fb !important;
}

body.dark-mode:not(.auth-locked) .common-system-shortcuts__link:hover {
  background: #1b2233 !important;
}

body.dark-mode:not(.auth-locked) .mode-switch {
  border-color: #2b3445 !important;
  background: #111827 !important;
}

body.dark-mode:not(.auth-locked) .mode-switch .selected {
  background: #29235b !important;
  color: #ffffff !important;
}

.settlement-doc-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

.settlement-doc-grid article {
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 12px;
}

.settlement-doc-grid span {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.settlement-doc-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 14px;
}

.settlement-doc-grid p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

body.dark-mode {
  --bg: #05060a;
  --surface: #12151f;
  --surface-soft: #171b28;
  --ink: #f4f7fb;
  --muted: #aab4c3;
  --line: #2b3445;
  --accent: #9b8cff;
  --accent-2: #7c6df2;
  --nav: #090d16;
  --nav-2: #111827;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.36);
  --shadow-soft: 0 8px 22px rgba(0, 0, 0, 0.28);
  background: #05060a !important;
  color: var(--ink);
}

body.dark-mode.auth-locked,
body.dark-mode .login-gate {
  background:
    radial-gradient(circle at 18% 18%, rgba(155, 140, 255, 0.16), transparent 28%),
    linear-gradient(145deg, #05060a 0%, #0b1020 52%, #05060a 100%) !important;
}

body.dark-mode:not(.auth-locked),
body.dark-mode:not(.auth-locked) .main {
  background: #05060a !important;
  color: var(--ink);
}

body.dark-mode .login-card,
body.dark-mode .panel,
body.dark-mode .metric,
body.dark-mode .portal-form,
body.dark-mode .upload-box,
body.dark-mode .settlement-summary div,
body.dark-mode .settlement-doc-grid article,
body.dark-mode .table-scroll,
body.dark-mode .guide-panel,
body.dark-mode .auth-box,
body.dark-mode .search,
body.dark-mode .common-system-shortcuts,
body.dark-mode .common-system-shortcuts__menu {
  border-color: var(--line) !important;
  background: var(--surface) !important;
  color: var(--ink) !important;
  box-shadow: var(--shadow-soft);
}

body.dark-mode .sidebar {
  background: #090d16 !important;
}

body.dark-mode .topbar {
  border-color: var(--line) !important;
  background: #05060a !important;
  color: var(--ink) !important;
}

body.dark-mode .common-system-shortcuts__summary,
body.dark-mode .nav-item,
body.dark-mode .mode-switch,
body.dark-mode .settlement-flow span,
body.dark-mode th {
  border-color: var(--line) !important;
  background: var(--surface-soft) !important;
  color: var(--ink) !important;
}

body.dark-mode .nav-item.active,
body.dark-mode .mode-switch button.selected,
body.dark-mode .common-system-shortcuts__link.is-active {
  background: #29235b !important;
  color: #ffffff !important;
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
  border-color: var(--line) !important;
  background: #0b1020 !important;
  color: var(--ink) !important;
}

body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder {
  color: #7f8b9d !important;
}

body.dark-mode td,
body.dark-mode .metric small,
body.dark-mode .metric span,
body.dark-mode .brand span,
body.dark-mode .panel-head span,
body.dark-mode .settlement-doc-grid p,
body.dark-mode .login-title span,
body.dark-mode .login-help {
  color: var(--muted) !important;
}

body.dark-mode table,
body.dark-mode th,
body.dark-mode td {
  border-color: var(--line) !important;
}

body.dark-mode tr:hover td,
body.dark-mode .selected-row td {
  background: #1b2233 !important;
}

body.dark-mode .ghost-button {
  border-color: #3c4659 !important;
  background: #111827 !important;
  color: var(--ink) !important;
}

body.dark-mode .primary-button,
body.dark-mode .brand-mark {
  background: var(--accent-2) !important;
  color: #ffffff !important;
}

@media (max-width: 780px) {
  .settlement-doc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .manual-sku-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .linehaul-upload-grid {
    grid-template-columns: 1fr;
  }

  .linehaul-direct-form {
    grid-template-columns: 1fr;
  }

  .linehaul-group-summary,
  .guide-tab-panel.is-active,
  .linehaul-detail-body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 10px 10px 8px;
    gap: 8px;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
    transition: padding 180ms ease, max-height 180ms ease;
  }

  .brand {
    min-height: auto;
    gap: 8px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand span {
    display: none;
  }

  .brand strong {
    font-size: 15px;
  }

  .common-system-shortcuts summary {
    min-height: 28px;
    padding: 5px 9px;
    font-size: 12px;
  }

  .common-system-shortcuts__menu {
    max-height: 150px;
    padding: 7px;
  }

  .common-system-shortcuts__menu a {
    padding: 6px 4px;
    font-size: 12px;
  }

  .nav-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    overflow: visible;
    max-width: 100%;
    padding-bottom: 2px;
  }

  .nav-item {
    text-align: center;
    min-width: 0;
    padding: 8px 10px;
    font-size: 13px;
    white-space: normal;
  }

  .mode-switch {
    margin-top: 0;
    min-height: 34px;
  }

  .mode-switch button {
    padding: 7px 3px;
    font-size: 12px;
  }

  body.mobile-nav-collapsed .sidebar {
    padding: 6px 10px;
    max-height: 92px;
    overflow: hidden;
    box-shadow: 0 8px 18px rgba(16, 24, 40, 0.2);
  }

  body.mobile-nav-collapsed .brand {
    min-height: 38px;
  }

  body.mobile-nav-collapsed .nav-list,
  body.mobile-nav-collapsed .mode-switch {
    display: none;
  }

  body.mobile-nav-collapsed .common-system-shortcuts {
    display: block;
  }

  body.mobile-nav-collapsed .common-system-shortcuts:not([open]) {
    margin-top: 4px;
  }

  body.mobile-nav-collapsed .topbar {
    display: none;
  }

  .field-step-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar,
  .top-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar {
    position: static;
    background: transparent;
    height: auto !important;
  }

  .frame-resize-handle {
    display: none;
  }

  .split-layout-resizable {
    grid-template-columns: 1fr !important;
  }

  .split-layout-handle {
    display: none;
  }

  .auth-box,
  .search,
  .filter-row,
  .field-filter-row,
  .panel-head {
    flex-wrap: wrap;
  }

  .auth-box select,
  .auth-box input {
    width: auto;
    flex: 1 1 132px;
  }

  .guide-panel {
    max-height: 92vh;
  }

  .guide-body {
    grid-template-columns: 1fr;
  }

  .search input {
    width: 100%;
  }

  .metric-grid,
  .dashboard-layout,
  .section-grid,
  .quote-layout,
  .map-layout,
  .outbound-layout,
  .quick-inbound-grid,
  .portal-layout,
  .settlement-summary {
    grid-template-columns: 1fr;
  }

  .quick-inbound-search,
  .quick-inbound-entry {
    grid-template-columns: 1fr;
  }

  .settlement-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .warehouse-map {
    grid-template-columns: repeat(4, minmax(60px, 1fr));
  }

  .location-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-visual {
    min-height: 170px;
  }
}

@media (max-width: 620px) {
  .login-gate {
    padding: 16px;
    overflow: hidden;
    place-items: center start;
  }

  .login-card {
    width: min(calc(100vw - 32px), 360px);
    max-width: calc(100vw - 32px);
    padding: 24px;
    justify-self: start;
    min-width: 0;
  }

  .login-card select,
  .login-card input,
  .login-card button {
    min-width: 0;
  }

  .manual-sku-grid {
    grid-template-columns: 1fr;
  }

  body {
    font-size: 16px;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 18px;
  }

  .main {
    padding: 10px;
  }

  .sidebar {
    padding: 8px;
    gap: 7px;
  }

  .brand strong {
    font-size: 14px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .common-system-shortcuts summary {
    min-height: 26px;
    font-size: 11px;
  }

  .common-system-shortcuts__menu {
    max-height: 132px;
  }

  .common-system-shortcuts__menu a {
    font-size: 11px;
  }

  .mode-switch button,
  .nav-item,
  .small,
  .tiny {
    font-size: 12px;
  }

  .nav-item {
    min-width: 0;
    padding: 7px 6px;
  }

  .mode-switch {
    min-height: 32px;
  }

  .dashboard-visual {
    min-height: 210px;
  }

  .dashboard-visual img {
    opacity: 0.62;
  }

  .dashboard-visual::after {
    background: rgba(16, 24, 35, 0.7);
  }

  .dashboard-visual-copy {
    padding: 22px;
    max-width: none;
  }

  .dashboard-visual-copy strong {
    font-size: 25px;
  }

  .dashboard-visual-copy small {
    font-size: 15px;
  }

  .metric-grid,
  .detail-grid,
  .quote-doc-total,
  .map-slot-row {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    gap: 10px;
  }

  .metric {
    padding: 16px;
  }

  .metric span,
  .settlement-summary span,
  .upload-box span,
  .upload-status,
  .client-card span,
  label,
  .portal-ai-item small,
  .work-item small {
    font-size: 14px;
  }

  input,
  select,
  button {
    min-height: 44px;
  }

  .primary-button,
  .ghost-button {
    padding: 10px 12px;
  }

  .panel-head {
    align-items: stretch;
  }

  .panel-head > .filter-row,
  .panel-head > button,
  .panel-head > select {
    width: 100%;
  }

  th,
  td {
    padding: 11px 9px;
    font-size: 14px;
  }

  .panel {
    padding: 14px;
  }

  .guide-modal {
    padding: 10px;
  }

  .guide-head {
    align-items: flex-start;
    padding: 14px;
  }

  .guide-body {
    padding: 12px;
  }

  .guide-body p,
  .guide-body li {
    font-size: 15px;
  }

  .warehouse-map {
    grid-template-columns: repeat(3, minmax(70px, 1fr));
    grid-auto-rows: 76px;
  }

  .warehouse-plan {
    min-height: 520px;
  }

  .product-preview-card {
    grid-template-columns: 1fr;
  }

  .product-image-box {
    min-height: 150px;
  }

  .product-meta-grid {
    grid-template-columns: 1fr;
  }

  .shipper-admin-grid,
  .shipper-account-form {
    grid-template-columns: 1fr;
  }

  .product-preview-title {
    display: block;
  }

  .product-preview-title span {
    margin-top: 4px;
  }

  .plan-grid span {
    width: 34px;
    height: 34px;
    font-size: 12px;
  }

  .plan-location {
    padding: 7px;
  }

  .plan-location strong {
    font-size: 18px;
  }

  .work-item {
    grid-template-columns: 1fr;
  }

  .user-resizable-panel {
    width: 100% !important;
    height: auto !important;
    resize: none;
  }

  .panel-resize-tools {
    display: none;
  }

  .panel-resize-tools button {
    min-height: 30px;
    padding: 7px 8px;
  }

  .table-scroll table {
    min-width: 760px;
  }
}

@media (max-width: 760px) {
  body.mobile-inbound-focus .main {
    padding: 8px;
  }

  body.mobile-inbound-focus #inbound .operation-panel {
    border-radius: 8px;
    padding: 12px;
  }

  body.mobile-inbound-focus #inbound .quick-inbound-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  body.mobile-inbound-focus #inbound .quick-inbound-simple {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  body.mobile-inbound-focus #inbound .quick-inbound-simple input,
  body.mobile-inbound-focus #inbound .quick-inbound-simple select {
    min-height: 58px;
    border-radius: 8px;
    font-size: 20px;
    font-weight: 900;
  }

  body.mobile-inbound-focus #inbound .quick-inbound-simple button,
  body.mobile-inbound-focus #inbound .inbound-field-panel button {
    min-height: 58px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 900;
  }

  body.mobile-inbound-focus #inbound .inbound-field-panel {
    padding: 12px;
  }

  body.mobile-inbound-focus #inbound .upload-status {
    font-size: 15px;
    font-weight: 800;
  }

  body.mobile-outbound-focus .main {
    padding: 8px;
  }

  body.mobile-outbound-focus #outboundInspect .outbound-layout {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  body.mobile-outbound-focus #outboundInspect .field-mobile-primary {
    order: -2;
  }

  body.mobile-outbound-focus #outboundInspect .field-mobile-work {
    order: -1;
  }

  body.mobile-outbound-focus #outboundInspect .panel,
  body.mobile-outbound-focus #outboundInspect .operation-panel {
    border-radius: 8px;
    padding: 12px;
  }

  body.mobile-outbound-focus #outboundInspect .panel-head {
    gap: 8px;
    margin-bottom: 10px;
  }

  body.mobile-outbound-focus #outboundInspect .panel-head h2 {
    font-size: 22px;
  }

  body.mobile-outbound-focus #outboundInspect .scan-box {
    display: grid;
    gap: 9px;
  }

  body.mobile-outbound-focus #outboundInspect .scan-box label {
    font-size: 15px;
    font-weight: 800;
    color: #1f2937;
  }

  body.mobile-outbound-focus #outboundInspect input,
  body.mobile-outbound-focus #outboundInspect select {
    width: 100%;
    min-height: 54px;
    border-radius: 8px;
    font-size: 19px;
    font-weight: 800;
  }

  body.mobile-outbound-focus #outboundInspect #scannerInput {
    min-height: 64px;
    border-width: 2px;
    border-color: #1f6feb;
    background: #f8fbff;
    font-size: 21px;
  }

  body.mobile-outbound-focus #outboundInspect button {
    min-height: 52px;
    border-radius: 8px;
    font-size: 17px;
    font-weight: 900;
  }

  body.mobile-outbound-focus #outboundInspect #verifyOutbound,
  body.mobile-outbound-focus #outboundInspect #processScanInput,
  body.mobile-outbound-focus #outboundInspect #completeFieldScan {
    min-height: 64px;
    font-size: 20px;
  }

  body.mobile-outbound-focus #outboundInspect .field-mobile-work .filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  body.mobile-outbound-focus #outboundInspect .field-mobile-work .filter-row select,
  body.mobile-outbound-focus #outboundInspect .field-mobile-work .filter-row button {
    width: 100%;
  }

  body.mobile-outbound-focus #outboundInspect #fieldWorkHandlingFilter {
    grid-column: 1 / -1;
    min-height: 58px;
    border: 2px solid var(--accent);
    background: #e9fbf6;
    color: var(--accent);
    font-size: 18px;
    font-weight: 900;
  }

  body.mobile-outbound-focus #outboundInspect .field-handling-tabs {
    grid-template-columns: 1fr;
  }

  body.mobile-outbound-focus #outboundInspect .field-handling-tabs button {
    min-height: 62px;
    font-size: 20px;
  }

  body.mobile-outbound-focus #outboundInspect .field-work-summary,
  body.mobile-outbound-focus #outboundInspect .field-step-grid,
  body.mobile-outbound-focus #outboundInspect .outbound-summary,
  body.mobile-outbound-focus #outboundInspect .rework-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  body.mobile-outbound-focus #outboundInspect .field-work-summary div {
    min-height: 76px;
  }

  body.mobile-outbound-focus #outboundInspect .field-work-summary span {
    font-size: 13px;
  }

  body.mobile-outbound-focus #outboundInspect .field-work-summary strong {
    font-size: 28px;
  }

  body.mobile-outbound-focus #outboundInspect .upload-status {
    padding: 12px;
    font-size: 15px;
    font-weight: 800;
  }

  body.mobile-outbound-focus #outboundInspect .table-scroll table {
    min-width: 0;
  }

  body.role-field {
    background: #f5f7fb;
    font-size: 18px;
  }

  body.role-field .app-shell {
    display: block;
  }

  body.role-field .sidebar {
    display: none;
  }

  body.role-field .main {
    padding: 8px;
  }

  body.role-field .topbar {
    position: relative;
    z-index: 20;
    padding: 10px 8px;
    border-radius: 0 0 10px 10px;
  }

  body.role-field .topbar .search,
  body.role-field .topbar .top-actions .ghost-button:not(#screenSizeResetButton),
  body.role-field .guide-button {
    display: none;
  }

  body.role-field .topbar h1 {
    font-size: 22px;
    line-height: 1.2;
  }

  body.role-field .topbar small {
    display: none;
  }

  body.role-field #outboundInspect > .panel,
  body.role-field #outboundInspect > .operation-panel {
    display: none;
  }

  body.role-field #outboundInspect .outbound-layout,
  body.role-field #outboundInspect .field-mobile-work {
    display: block;
  }

  body.role-field #outboundInspect .outbound-layout {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  body.role-field #outboundInspect .field-mobile-primary,
  body.role-field #outboundInspect .field-mobile-check,
  body.role-field #outboundInspect .field-mobile-work {
    display: block;
    padding: 12px;
    border-radius: 8px;
    box-shadow: none;
  }

  body.role-field #outboundInspect .field-mobile-check {
    display: none;
  }

  body.role-field #outboundInspect .panel-head {
    gap: 8px;
    margin-bottom: 10px;
  }

  body.role-field #outboundInspect .panel-head h2 {
    font-size: 23px;
  }

  body.role-field #outboundInspect .status-pill {
    min-height: 34px;
    padding: 8px 12px;
    font-size: 15px;
  }

  body.role-field #outboundInspect .scan-box {
    display: grid;
    gap: 10px;
  }

  body.role-field #outboundInspect .scan-box label {
    gap: 6px;
    font-size: 16px;
    font-weight: 800;
    color: #1f2937;
  }

  body.role-field #outboundInspect input,
  body.role-field #outboundInspect select {
    width: 100%;
    min-height: 58px;
    border-radius: 8px;
    font-size: 21px;
    font-weight: 800;
    letter-spacing: 0;
  }

  body.role-field #outboundInspect #scannerInput {
    min-height: 66px;
    font-size: 22px;
    border-width: 2px;
    border-color: #1f6feb;
    background: #f8fbff;
  }

  body.role-field #outboundInspect button {
    min-height: 58px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 900;
  }

  body.role-field #outboundInspect .primary-button {
    background: #0f766e;
  }

  body.role-field #outboundInspect #verifyOutbound,
  body.role-field #outboundInspect #completeFieldScan {
    min-height: 68px;
    font-size: 21px;
  }

  body.role-field #outboundInspect .field-mobile-work .filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  body.role-field #outboundInspect .field-mobile-work .filter-row select,
  body.role-field #outboundInspect .field-mobile-work .filter-row button {
    width: 100%;
  }

  body.role-field #outboundInspect #fieldWorkHandlingFilter {
    grid-column: 1 / -1;
    min-height: 64px;
    border: 2px solid var(--accent);
    background: #e9fbf6;
    color: var(--accent);
    font-size: 22px;
    font-weight: 900;
  }

  body.role-field #outboundInspect .field-handling-tabs {
    grid-template-columns: 1fr;
  }

  body.role-field #outboundInspect .field-handling-tabs button {
    min-height: 68px;
    font-size: 22px;
  }

  body.role-field #outboundInspect .field-mobile-work .filter-row button:nth-of-type(n + 4) {
    display: none;
  }

  body.role-field #outboundInspect .field-work-summary,
  body.role-field #outboundInspect .field-step-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  body.role-field #outboundInspect .field-work-summary div,
  body.role-field #outboundInspect .field-step {
    padding: 12px;
    border-radius: 8px;
  }

  body.role-field #outboundInspect .field-work-summary span,
  body.role-field #outboundInspect .field-step span {
    font-size: 14px;
  }

  body.role-field #outboundInspect .field-work-summary strong,
  body.role-field #outboundInspect .field-step strong {
    font-size: 28px;
  }

  body.role-field #outboundInspect .field-filter-row,
  body.role-field #outboundInspect .field-worker-summary,
  body.role-field #outboundInspect .compact-table,
  body.role-field #outboundInspect #workerCoachingFilter,
  body.role-field #outboundInspect #workerCoachingRows,
  body.role-field #outboundInspect #workerCoachingHistoryRows {
    display: none;
  }

  body.role-field #outboundInspect #fieldStatus {
    display: block;
    padding: 14px;
    border-width: 2px;
    font-size: 17px;
    font-weight: 800;
  }

  body.role-field #fieldRows {
    display: block;
  }

  body.role-field #fieldRows tr {
    display: grid;
    gap: 6px;
    margin-bottom: 10px;
    padding: 12px;
    border: 2px solid #d9e2ef;
    border-radius: 8px;
    background: #fff;
  }

  body.role-field #fieldRows td {
    display: block;
    padding: 2px 0;
    border: 0;
    font-size: 17px;
    font-weight: 800;
    white-space: normal;
  }

  body.role-field #fieldRows td:nth-child(1),
  body.role-field #fieldRows td:nth-child(2),
  body.role-field #fieldRows td:nth-child(3),
  body.role-field #fieldRows td:nth-child(6),
  body.role-field #fieldRows td:nth-child(8),
  body.role-field #fieldRows td:nth-child(9),
  body.role-field #fieldRows td:nth-child(10),
  body.role-field #fieldRows td:nth-child(11),
  body.role-field #fieldRows td:nth-child(12),
  body.role-field #fieldRows td:nth-child(13) {
    display: block;
  }

  body.role-field #fieldRows td:nth-child(4),
  body.role-field #fieldRows td:nth-child(5),
  body.role-field #fieldRows td:nth-child(7) {
    display: none;
  }

  body.role-field #fieldRows .field-card-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 8px;
  }

  body.role-field #fieldRows .field-card-actions button {
    min-height: 58px;
    font-size: 18px;
  }

  body.role-field #outboundInspect .table-scroll {
    overflow: visible;
  }

  body.role-field #outboundInspect .table-scroll table {
    min-width: 0;
    width: 100%;
  }

  body.role-field #inbound .inbound-field-panel,
  body.role-field #inbound .quick-inbound-card {
    border-radius: 8px;
    padding: 14px;
  }

  body.role-field #inbound input,
  body.role-field #inbound select,
  body.role-field #inbound button {
    min-height: 50px;
    font-size: 16px;
  }

  body.role-field #inbound .inbound-field-panel .compact-table table,
  body.role-field #inbound .inbound-field-panel .compact-table tbody,
  body.role-field #inbound .inbound-field-panel .compact-table tr,
  body.role-field #inbound .inbound-field-panel .compact-table td {
    display: block;
    width: 100%;
  }

  body.role-field #inbound .inbound-field-panel .compact-table thead {
    display: none;
  }

  body.role-field #inbound .inbound-field-panel .compact-table tr {
    border: 2px solid #d9e2ef;
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 12px;
    background: #ffffff;
  }

  body.role-field #outboundInspect .table-scroll thead {
    display: none;
  }
}

@media (max-width: 390px) {
  .main {
    padding: 10px;
  }

  .metric strong {
    font-size: 22px;
  }

  .dashboard-visual-copy strong {
    font-size: 22px;
  }

  .field-log-summary,
  .field-work-summary,
  .ai-stock-summary,
  .outbound-summary,
  .rework-summary,
  .settlement-summary {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .sidebar,
  .topbar,
  .view:not(#quote),
  #quote > .quote-layout,
  #quote > .upload-preview-panel,
  #quoteDocumentPanel > .panel-head {
    display: none !important;
  }

  .app-shell,
  .main {
    display: block;
    padding: 0;
  }

  #quote,
  #quoteDocumentPanel {
    display: block !important;
  }

  .quote-document-panel,
  .quote-document {
    border: 0;
    box-shadow: none;
    padding: 0;
  }
}

.inline-input {
  width: 100%;
  min-width: 92px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 9px;
  font: inherit;
  background: #fff;
}

.inline-input.number {
  text-align: right;
}

.inline-input:disabled {
  background: #f1f4f7;
  color: var(--muted);
}

.correction-cell {
  display: grid;
  gap: 6px;
  min-width: 180px;
}

.correction-button {
  justify-self: start;
}

.hidden-capture {
  display: none;
}

.settlement-approval-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 12px 0 14px;
  flex-wrap: wrap;
}

[data-settlement-category] {
  cursor: pointer;
}

[data-settlement-category]:hover {
  background: #eef6f3;
}

.inbound-flow-status {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.flow-step {
  display: grid;
  grid-template-columns: 34px 1fr;
  grid-template-areas:
    "num title"
    "num copy";
  gap: 3px 10px;
  align-items: center;
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.flow-step span {
  grid-area: num;
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: #edf2f7;
  color: var(--muted);
  font-weight: 800;
}

.flow-step strong {
  grid-area: title;
  font-size: 14px;
}

.flow-step small {
  grid-area: copy;
  color: var(--muted);
  line-height: 1.35;
}

.flow-step.done {
  border-color: #bde4dc;
  background: #f2fbf8;
}

.flow-step.done span {
  background: var(--accent);
  color: #ffffff;
}

.flow-step.fail {
  border-color: #f2b8b5;
  background: #fff6f5;
}

.flow-step.fail span {
  background: var(--danger);
  color: #ffffff;
}

.inbound-next-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 14px;
}

.core-request-panel {
  margin: 12px 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
  padding: 12px;
}

.mini-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.mini-panel-head span {
  color: var(--muted);
  font-size: 13px;
}

.segmented-control {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f9fc;
}

.segmented-control button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
}

.segmented-control button.selected {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.compact-segment button {
  padding: 7px 10px;
  font-size: 13px;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 800;
  cursor: pointer;
  padding: 0;
}

.link-button:hover {
  text-decoration: underline;
}

@media (max-width: 860px) {
  .inbound-flow-status {
    grid-template-columns: 1fr;
  }

  .batch-filter-bar {
    grid-template-columns: 1fr;
  }

  .manual-move-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .manual-move-wide {
    grid-column: span 2;
  }

  .mini-panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .mini-panel-actions {
    justify-content: flex-start;
  }

  .map-slot-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 360px;
  }
}

/* Product-master final shell for post-login WMS screens */
body:not(.auth-locked) .app-shell {
  grid-template-columns: var(--sidebar-width, 204px) minmax(0, 1fr) !important;
}

body:not(.auth-locked) .sidebar {
  background: #ffffff !important;
  color: #171528 !important;
  border-right: 1px solid #e5e1f4;
  box-shadow: 8px 0 26px rgba(39, 31, 86, 0.05);
}

body:not(.auth-locked) .brand {
  padding: 4px 2px 8px;
  border-bottom: 1px solid #eeeaf9;
}

body:not(.auth-locked) .brand-mark {
  color: #ffffff;
}

body:not(.auth-locked) .brand strong,
body:not(.auth-locked) .nav-item,
body:not(.auth-locked) .common-system-shortcuts__menu a,
body:not(.auth-locked) .mode-switch button {
  color: #171528 !important;
  opacity: 1 !important;
}

body:not(.auth-locked) .brand span {
  color: #6f6a85 !important;
}

body:not(.auth-locked) .common-system-shortcuts summary {
  border-color: #ddd8f3 !important;
  color: #33236f !important;
  background: #f7f5ff !important;
}

body:not(.auth-locked) .common-system-shortcuts summary::after {
  color: #6750e8;
}

body:not(.auth-locked) .common-system-shortcuts__menu {
  border-color: #e1dcf4 !important;
  background: #ffffff !important;
  box-shadow: 0 10px 28px rgba(39, 31, 86, 0.08);
}

body:not(.auth-locked) .common-system-shortcuts__menu a {
  color: #2b2545 !important;
}

body:not(.auth-locked) .common-system-shortcuts__menu a:hover {
  background: #f5f2ff !important;
}

body:not(.auth-locked) .common-system-shortcuts__menu a.is-active,
body:not(.auth-locked) .common-system-shortcuts__menu a.active,
body:not(.auth-locked) .common-system-shortcuts__menu a[aria-current="page"] {
  background: #ece7ff !important;
  color: #4f35c8 !important;
  box-shadow: inset 3px 0 0 #6750e8 !important;
}

body:not(.auth-locked) .nav-item {
  background: transparent !important;
}

body:not(.auth-locked) .nav-item:hover {
  background: #f5f2ff !important;
  color: #4f35c8 !important;
}

body:not(.auth-locked) .nav-item.active {
  background: #ece7ff !important;
  color: #3f2dae !important;
}

body:not(.auth-locked) .mode-switch {
  border-color: #ddd8f3 !important;
  background: #f9f7ff;
}

body:not(.auth-locked) .mode-switch .selected {
  background: #6750e8 !important;
  color: #ffffff !important;
}

body:not(.auth-locked) .topbar {
  background: transparent !important;
  border-bottom: 1px solid #e5e1f4;
}

body:not(.auth-locked) .dashboard-visual {
  display: none !important;
}

body:not(.auth-locked) .main {
  padding-top: 14px;
}

body:not(.auth-locked) .panel,
body:not(.auth-locked) .metric,
body:not(.auth-locked) .client-card,
body:not(.auth-locked) .upload-box {
  border-radius: 10px;
}

body:not(.auth-locked) .panel {
  padding: 14px 16px;
}

body:not(.auth-locked) .metric {
  padding: 12px 14px;
}

body:not(.auth-locked) th,
body:not(.auth-locked) td {
  padding-top: 8px;
  padding-bottom: 8px;
}

@media (max-width: 980px) {
  body:not(.auth-locked) .app-shell {
    grid-template-columns: 1fr !important;
  }

  body:not(.auth-locked) .sidebar {
    max-height: none;
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid #e5e1f4;
  }

  body.mobile-nav-collapsed:not(.auth-locked) .sidebar {
    max-height: 86px;
  }

  body:not(.auth-locked) .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: visible;
  }

  body:not(.auth-locked) .nav-item {
    min-height: 34px;
    padding: 7px 4px;
    font-size: 12px;
  }

  body:not(.auth-locked) .mode-switch button {
    min-height: 30px;
  }

  body:not(.auth-locked) .topbar {
    padding-bottom: 8px;
    margin-bottom: 10px;
  }
}

@media (max-width: 620px) {
  body:not(.auth-locked) {
    font-size: 14px;
  }

  body:not(.auth-locked) .sidebar {
    padding: 7px;
    gap: 6px;
  }

  body:not(.auth-locked) .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
  }

  body:not(.auth-locked) .nav-item {
    min-height: 32px;
    padding: 6px 2px;
    font-size: 11px;
    line-height: 1.15;
  }

  body:not(.auth-locked) .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  body:not(.auth-locked) .metric {
    min-height: 78px;
    padding: 10px 11px;
  }

  body:not(.auth-locked) .metric span,
  body:not(.auth-locked) .metric small {
    font-size: 11px;
  }

  body:not(.auth-locked) .metric strong {
    font-size: 20px;
  }

  body:not(.auth-locked) .panel {
    padding: 11px;
  }

  body:not(.auth-locked) .panel-head {
    margin-bottom: 8px;
  }

  body:not(.auth-locked) .primary-button,
  body:not(.auth-locked) .ghost-button,
  body:not(.auth-locked) input,
  body:not(.auth-locked) select,
  body:not(.auth-locked) button {
    min-height: 38px;
  }

  body:not(.auth-locked) th,
  body:not(.auth-locked) td {
    padding: 8px;
    font-size: 12px;
  }
}


/* EOF dark-mode override. This must remain after all compact/mobile rules. */
body.dark-mode:not(.auth-locked),
body.dark-mode:not(.auth-locked) .main,
body.dark-mode:not(.auth-locked) .app-shell {
  background: #05060a !important;
  color: #f4f7fb !important;
}

body.dark-mode:not(.auth-locked) .sidebar {
  background: #090d16 !important;
  color: #f4f7fb !important;
  border-right: 1px solid #222b3a !important;
}

body.dark-mode:not(.auth-locked) .brand,
body.dark-mode:not(.auth-locked) .nav-list,
body.dark-mode:not(.auth-locked) .menu-order-toolbar {
  background: transparent !important;
}

body.dark-mode:not(.auth-locked) .brand strong,
body.dark-mode:not(.auth-locked) .nav-item,
body.dark-mode:not(.auth-locked) .mode-switch button,
body.dark-mode:not(.auth-locked) .common-system-shortcuts__menu a {
  color: #f4f7fb !important;
  opacity: 1 !important;
}

body.dark-mode:not(.auth-locked) .brand span {
  color: #aab4c3 !important;
}

body.dark-mode:not(.auth-locked) .nav-item {
  background: transparent !important;
}

body.dark-mode:not(.auth-locked) .nav-item:hover {
  background: #161d2d !important;
}

body.dark-mode:not(.auth-locked) .nav-item.active {
  background: #29235b !important;
  color: #ffffff !important;
}

body.dark-mode:not(.auth-locked) .common-system-shortcuts,
body.dark-mode:not(.auth-locked) .common-system-shortcuts__summary,
body.dark-mode:not(.auth-locked) .common-system-shortcuts__menu,
body.dark-mode:not(.auth-locked) .mode-switch {
  border-color: #2b3445 !important;
  background: #111827 !important;
  color: #f4f7fb !important;
}

body.dark-mode:not(.auth-locked) .common-system-shortcuts__link:hover {
  background: #1b2233 !important;
}

body.dark-mode:not(.auth-locked) .common-system-shortcuts__link.is-active,
body.dark-mode:not(.auth-locked) .mode-switch .selected {
  background: #29235b !important;
  color: #ffffff !important;
}

body.dark-mode:not(.auth-locked) .topbar {
  background: #05060a !important;
  border-color: #222b3a !important;
}

body.dark-mode:not(.auth-locked) .panel,
body.dark-mode:not(.auth-locked) .metric,
body.dark-mode:not(.auth-locked) .client-card,
body.dark-mode:not(.auth-locked) .upload-box,
body.dark-mode:not(.auth-locked) .table-scroll,
body.dark-mode:not(.auth-locked) .auth-box,
body.dark-mode:not(.auth-locked) .search,
body.dark-mode:not(.auth-locked) .portal-form,
body.dark-mode:not(.auth-locked) .settlement-summary div,
body.dark-mode:not(.auth-locked) .settlement-doc-grid article {
  border-color: #2b3445 !important;
  background: #12151f !important;
  color: #f4f7fb !important;
}

body.dark-mode:not(.auth-locked) th,
body.dark-mode:not(.auth-locked) .table-filter-head {
  border-color: #2b3445 !important;
  background: #171b28 !important;
  color: #f4f7fb !important;
}

body.dark-mode:not(.auth-locked) td {
  border-color: #252d3c !important;
  background: #12151f !important;
  color: #dce3ee !important;
}

body.dark-mode:not(.auth-locked) tr:hover td,
body.dark-mode:not(.auth-locked) .selected-row td,
body.dark-mode:not(.auth-locked) .soft-selected-row td {
  background: #1b2233 !important;
  color: #ffffff !important;
}

body.dark-mode:not(.auth-locked) input,
body.dark-mode:not(.auth-locked) select,
body.dark-mode:not(.auth-locked) textarea,
body.dark-mode:not(.auth-locked) .universal-filter-input,
body.dark-mode:not(.auth-locked) .table-filter-input {
  border-color: #374151 !important;
  background: #0b1020 !important;
  color: #f4f7fb !important;
}

body.dark-mode:not(.auth-locked) input::placeholder,
body.dark-mode:not(.auth-locked) textarea::placeholder,
body.dark-mode:not(.auth-locked) .metric span,
body.dark-mode:not(.auth-locked) .metric small,
body.dark-mode:not(.auth-locked) .panel-head span,
body.dark-mode:not(.auth-locked) .settlement-doc-grid p {
  color: #9aa7ba !important;
}

body.dark-mode:not(.auth-locked) .ghost-button {
  border-color: #3c4659 !important;
  background: #111827 !important;
  color: #f4f7fb !important;
}

body.dark-mode:not(.auth-locked) .primary-button,
body.dark-mode:not(.auth-locked) .brand-mark {
  background: #7c6df2 !important;
  color: #ffffff !important;
}

@media (max-width: 980px) {
  body.dark-mode.mobile-nav-collapsed:not(.auth-locked) .sidebar {
    background: #090d16 !important;
    border-bottom: 1px solid #222b3a !important;
  }
}
/* ABSOLUTE EOF guard 20260628: must stay after duplicated compact/dark rules. */
body:not(.auth-locked) {
  overflow-x: hidden !important;
}

body:not(.auth-locked) h1,
body:not(.auth-locked) h2,
body:not(.auth-locked) h3,
body:not(.auth-locked) h4,
body:not(.auth-locked) p,
body:not(.auth-locked) label,
body:not(.auth-locked) span,
body:not(.auth-locked) small,
body:not(.auth-locked) strong,
body:not(.auth-locked) button,
body:not(.auth-locked) a,
body:not(.auth-locked) td,
body:not(.auth-locked) th {
  text-shadow: none !important;
}

body.dark-mode:not(.auth-locked) .sidebar,
body.dark-mode:not(.auth-locked) .brand,
body.dark-mode:not(.auth-locked) .nav-list,
body.dark-mode:not(.auth-locked) .menu-order-toolbar,
body.dark-mode:not(.auth-locked) .common-system-shortcuts,
body.dark-mode:not(.auth-locked) .common-system-shortcuts__summary,
body.dark-mode:not(.auth-locked) .common-system-shortcuts__menu,
body.dark-mode:not(.auth-locked) .mode-switch {
  background: #0b1020 !important;
  border-color: #2b3445 !important;
  color: #f4f7fb !important;
}

body.dark-mode:not(.auth-locked) .view,
body.dark-mode:not(.auth-locked) .panel,
body.dark-mode:not(.auth-locked) .modal,
body.dark-mode:not(.auth-locked) .modal-card,
body.dark-mode:not(.auth-locked) .drawer,
body.dark-mode:not(.auth-locked) .sheet,
body.dark-mode:not(.auth-locked) .form-grid,
body.dark-mode:not(.auth-locked) .filter-row,
body.dark-mode:not(.auth-locked) .toolbar,
body.dark-mode:not(.auth-locked) .inline-toolbar,
body.dark-mode:not(.auth-locked) .kpi-card,
body.dark-mode:not(.auth-locked) .status-card,
body.dark-mode:not(.auth-locked) .quote-preview,
body.dark-mode:not(.auth-locked) .quote-editor,
body.dark-mode:not(.auth-locked) .work-card,
body.dark-mode:not(.auth-locked) .instruction-card,
body.dark-mode:not(.auth-locked) .guide-card,
body.dark-mode:not(.auth-locked) .detail-card,
body.dark-mode:not(.auth-locked) .data-card,
body.dark-mode:not(.auth-locked) .summary-card,
body.dark-mode:not(.auth-locked) .flow-card,
body.dark-mode:not(.auth-locked) .table-card,
body.dark-mode:not(.auth-locked) .empty-state {
  background: #12151f !important;
  border-color: #2b3445 !important;
  color: #f4f7fb !important;
}

body.dark-mode:not(.auth-locked) .nav-item,
body.dark-mode:not(.auth-locked) .common-system-shortcuts__link,
body.dark-mode:not(.auth-locked) .common-system-shortcuts__menu a,
body.dark-mode:not(.auth-locked) .mode-switch button {
  background: transparent !important;
  color: #f4f7fb !important;
  opacity: 1 !important;
}

body.dark-mode:not(.auth-locked) .nav-item:hover,
body.dark-mode:not(.auth-locked) .common-system-shortcuts__link:hover,
body.dark-mode:not(.auth-locked) .mode-switch button:hover {
  background: #1b2233 !important;
}

body.dark-mode:not(.auth-locked) .nav-item.active,
body.dark-mode:not(.auth-locked) .common-system-shortcuts__link.is-active,
body.dark-mode:not(.auth-locked) .mode-switch button.selected {
  background: #29235b !important;
  color: #ffffff !important;
}

body.dark-mode:not(.auth-locked) h1,
body.dark-mode:not(.auth-locked) h2,
body.dark-mode:not(.auth-locked) h3,
body.dark-mode:not(.auth-locked) h4,
body.dark-mode:not(.auth-locked) strong,
body.dark-mode:not(.auth-locked) label {
  color: #f8fafc !important;
}

body.dark-mode:not(.auth-locked) p,
body.dark-mode:not(.auth-locked) small,
body.dark-mode:not(.auth-locked) .muted,
body.dark-mode:not(.auth-locked) .subtle,
body.dark-mode:not(.auth-locked) .help-text,
body.dark-mode:not(.auth-locked) .desc,
body.dark-mode:not(.auth-locked) .view > header p {
  color: #aab4c3 !important;
}

.operation-table tr.danger-row td,
table tr.danger-row td {
  background: #fff1f2;
  color: #991b1b;
}

.operation-table tr.warning-row td,
table tr.warning-row td {
  background: #fffbeb;
  color: #92400e;
}

body.dark-mode:not(.auth-locked) .operation-table tr.danger-row td,
body.dark-mode:not(.auth-locked) table tr.danger-row td {
  background: rgba(127, 29, 29, 0.32) !important;
  color: #fecaca !important;
}

body.dark-mode:not(.auth-locked) .operation-table tr.warning-row td,
body.dark-mode:not(.auth-locked) table tr.warning-row td {
  background: rgba(120, 53, 15, 0.32) !important;
  color: #fde68a !important;
}

.profit-trend-chart {
  display: grid;
  gap: 8px;
}

.profit-trend-bar {
  display: grid;
  grid-template-columns: 96px minmax(120px, 1fr) 120px 64px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.profit-trend-label,
.profit-trend-bar strong,
.profit-trend-bar em {
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.profit-trend-track {
  height: 10px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.profit-trend-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #6d5dfc;
}

.profit-trend-bar.is-loss .profit-trend-track i {
  background: #ef4444;
}

body.dark-mode:not(.auth-locked) .profit-trend-track {
  background: #263145;
}

@media (max-width: 980px) {
  body:not(.auth-locked) .sidebar {
    width: 100% !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
  }

  body:not(.auth-locked) .brand strong,
  body:not(.auth-locked) .brand span,
  body:not(.auth-locked) .nav-item,
  body:not(.auth-locked) .common-system-shortcuts__link,
  body:not(.auth-locked) .mode-switch button {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    line-height: 1.22 !important;
  }

  body:not(.auth-locked) .nav-list {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 5px !important;
    max-height: 156px !important;
    overflow: auto !important;
  }

  body:not(.auth-locked) .nav-item {
    min-width: 0 !important;
    min-height: 34px !important;
    padding: 7px 6px !important;
    text-align: center !important;
  }

  body.mobile-nav-collapsed:not(.auth-locked) .sidebar {
    max-height: 78px !important;
    overflow: hidden !important;
  }
}

@media (max-width: 430px) {
  body:not(.auth-locked) .main {
    padding: 10px !important;
  }

  body:not(.auth-locked) .nav-list,
  body:not(.auth-locked) .common-system-shortcuts__menu {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body:not(.auth-locked) .panel,
  body:not(.auth-locked) .metric,
  body:not(.auth-locked) .client-card,
  body:not(.auth-locked) .upload-box {
    padding: 10px !important;
  }
}
