:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;

  --navy-950: #0a0f1a;
  --navy-900: #111827;
  --navy-800: #1a2744;
  --navy-700: #243b5c;
  --navy-600: #2f4d73;

  --gold-500: #b8954a;
  --gold-400: #d4b872;
  --gold-soft: rgba(184, 149, 74, 0.14);

  --text: #152033;
  --text-muted: #5a6b82;
  --primary: #1a3354;
  --primary-hover: #254770;
  --primary-soft: rgba(26, 51, 84, 0.1);
  --accent: #b8954a;
  --accent-hover: #9a7d3d;
  --required: #c0392b;
  --border: #d8dee8;
  --input-bg: #f8fafc;
  --focus-ring: rgba(26, 51, 84, 0.22);
  --shadow: 0 8px 32px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 4px 20px rgba(15, 23, 42, 0.1);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.14);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --app-bg: #eef1f6;
  --app-surface: #ffffff;
  --app-surface-muted: #f4f6fa;
  --app-surface-alt: #e8ecf3;
  --app-border: #dde3ed;
  --app-border-strong: #c5cedc;
  --app-text: #152033;
  --app-text-muted: #5a6b82;
  --app-table-head: #eef2f8;
  --app-table-row-alt: #f7f9fc;
  --app-table-foot: #e4eaf3;
  --app-modal-bg: rgba(10, 15, 26, 0.55);
  --app-sidebar-bg: #323d4f;
  --app-sidebar-text: #e8ecf1;
  --app-sidebar-muted: #a8b2c0;
  --app-sidebar-hover: rgba(255, 255, 255, 0.08);
  --app-sidebar-active-bg: rgba(255, 255, 255, 0.12);
  --app-sidebar-accent: #8fa8c4;
  --app-sidebar-border: rgba(0, 0, 0, 0.22);
  --analysis-accent: #1a5f7a;
  --analysis-accent-bright: #2a8fad;
  --analysis-accent-soft: rgba(26, 95, 122, 0.12);
  --analysis-card-bg: rgba(255, 255, 255, 0.92);
  --analysis-card-border: rgba(26, 95, 122, 0.18);
  --analysis-grid-line: rgba(26, 95, 122, 0.06);
  --analysis-text-dim: #5a6b82;

  --toast-success: #0d7a5c;
  --toast-success-bg: #ecfdf5;
  --toast-success-border: #a7f3d0;
  --toast-error: #b42318;
  --toast-error-bg: #fef3f2;
  --toast-error-border: #fecdca;
  --toast-info: #1a3354;
  --toast-info-bg: #f0f4fa;
  --toast-info-border: #c5d4e8;
  --toast-warning: #92610a;
  --toast-warning-bg: #fffbeb;
  --toast-warning-border: #fde68a;
}

html[data-theme="dark"] {
  --text: #e8edf5;
  --text-muted: #94a3b8;
  --primary: #5b8fd4;
  --primary-hover: #7aa8e0;
  --primary-soft: rgba(91, 143, 212, 0.16);
  --accent: #d4b872;
  --accent-hover: #e8cc8a;
  --required: #f87171;
  --border: #2d3a4f;
  --input-bg: #1a2332;
  --focus-ring: rgba(91, 143, 212, 0.28);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.38);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
  --app-bg: #0a0f1a;
  --app-surface: #141c2b;
  --app-surface-muted: #1a2332;
  --app-surface-alt: #243044;
  --app-border: #2d3a4f;
  --app-border-strong: #3d4f68;
  --app-text: #e8edf5;
  --app-text-muted: #94a3b8;
  --app-table-head: #1a2332;
  --app-table-row-alt: #141c2b;
  --app-table-foot: #243044;
  --app-modal-bg: rgba(0, 0, 0, 0.72);
  --app-sidebar-bg: #1e2430;
  --app-sidebar-text: #e8edf5;
  --app-sidebar-muted: #a0aec0;
  --app-sidebar-hover: rgba(255, 255, 255, 0.06);
  --app-sidebar-active-bg: #2a3344;
  --app-sidebar-accent: #7a9bb8;
  --app-sidebar-border: rgba(255, 255, 255, 0.08);
  --analysis-accent: #5eead4;
  --analysis-accent-bright: #99f6e4;
  --analysis-accent-soft: rgba(94, 234, 212, 0.1);
  --analysis-card-bg: rgba(20, 28, 43, 0.95);
  --analysis-card-border: rgba(94, 234, 212, 0.2);
  --analysis-grid-line: rgba(94, 234, 212, 0.05);
  --analysis-text-dim: #94a3b8;

  --toast-success: #34d399;
  --toast-success-bg: rgba(6, 78, 59, 0.35);
  --toast-success-border: rgba(52, 211, 153, 0.35);
  --toast-error: #fca5a5;
  --toast-error-bg: rgba(127, 29, 29, 0.35);
  --toast-error-border: rgba(252, 165, 165, 0.35);
  --toast-info: #93c5fd;
  --toast-info-bg: rgba(30, 58, 95, 0.45);
  --toast-info-border: rgba(147, 197, 253, 0.3);
  --toast-warning: #fcd34d;
  --toast-warning-bg: rgba(120, 83, 9, 0.35);
  --toast-warning-border: rgba(252, 211, 77, 0.35);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100vh;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--app-bg);
  color: var(--text);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow: auto;
  -webkit-font-smoothing: antialiased;
}

/* —— 登录页：全屏背景图 + 左侧登录区 —— */
body:not(.app-mode) {
  padding: 0;
  min-height: 100vh;
  justify-content: flex-start;
  align-items: stretch;
  background-color: #ffffff;
  background-image: var(
    --wms-login-bg-image,
    url("ala-warehouse-bg-display.jpg")
  );
  background-position: left center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.page-stage {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 100vh;
  max-width: none;
  line-height: normal;
  flex-shrink: 0;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
}

.page-bg {
  display: none !important;
}

.form-panel {
  position: relative;
  width: 50%;
  max-width: 50vw;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7% 9% 7% 11%;
  box-sizing: border-box;
}

.login-card {
  width: 100%;
  max-width: 100%;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

html[data-theme="dark"] .login-card {
  background: transparent;
  border: none;
}

.login-brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.form-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: -16px 0 24px;
  line-height: 1.5;
}

.login-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.login-brand-mark {
  display: none;
}

.login-brand-text {
  flex: 1;
  min-width: 0;
}

.system-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--navy-800);
  margin-bottom: 4px;
  letter-spacing: 0.01em;
  line-height: 1.4;
}

html[data-theme="dark"] .system-name {
  color: var(--app-sidebar-text);
}

.form-title {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.form-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 28px;
  line-height: 1.5;
}

.form-group {
  margin-bottom: 20px;
}

.field-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 8px;
}

.field-label .required {
  color: var(--required);
  margin-left: 2px;
}

.input-wrap {
  position: relative;
}

.input-wrap input {
  width: 100%;
  padding: 12px 44px 12px 14px;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrap input::placeholder {
  color: #9ca3af;
}

.input-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.input-wrap input.error {
  border-color: var(--required);
}

.region-section {
  margin-bottom: 20px;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.region-section .field-label {
  margin-bottom: 10px;
}

.select-wrap {
  position: relative;
}

.select-wrap select {
  width: 100%;
  padding: 12px 40px 12px 14px;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.select-wrap select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.select-wrap select.error {
  border-color: var(--required);
}

.select-wrap select:invalid {
  color: #9ca3af;
}

.select-wrap select option {
  color: var(--text);
}

.select-arrow {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: #9ca3af;
  pointer-events: none;
}

.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.toggle-password:hover {
  color: #6b7280;
}

.toggle-password svg {
  width: 20px;
  height: 20px;
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  font-size: 0.875rem;
}

.remember {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.remember input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
  border-radius: 4px;
}

.forgot-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

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

.btn-login {
  width: 100%;
  padding: 14px 20px;
  margin-top: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(135deg, var(--navy-800) 0%, var(--navy-700) 100%);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
  box-shadow: 0 4px 14px rgba(26, 51, 84, 0.35);
}

.btn-login:hover:not(:disabled) {
  filter: brightness(1.06);
  box-shadow: 0 6px 20px rgba(26, 51, 84, 0.42);
  transform: translateY(-1px);
}

.btn-login:active:not(:disabled) {
  transform: translateY(0);
}

.btn-login:disabled {
  opacity: 0.75;
  cursor: not-allowed;
}

.field-error {
  font-size: 0.8rem;
  color: var(--required);
  margin-top: 6px;
  display: none;
}

.field-error.show {
  display: block;
}

.toast-root {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(400px, calc(100vw - 40px));
  pointer-events: none;
}

.toast-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.45;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateX(24px);
  transition: opacity 0.28s ease, transform 0.28s ease;
  pointer-events: auto;
  position: relative;
  overflow: hidden;
}

.toast-item.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-item.hiding {
  opacity: 0;
  transform: translateX(24px);
}

.toast-item::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 100%;
  background: currentColor;
  opacity: 0.35;
  transform-origin: left;
  animation: toast-progress 4s linear forwards;
}

@keyframes toast-progress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

.toast-item-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
}

.toast-item-body {
  flex: 1;
  min-width: 0;
}

.toast-item.success {
  color: var(--toast-success);
  background: var(--toast-success-bg);
  border-color: var(--toast-success-border);
}

.toast-item.error {
  color: var(--toast-error);
  background: var(--toast-error-bg);
  border-color: var(--toast-error-border);
}

.toast-item.info {
  color: var(--toast-info);
  background: var(--toast-info-bg);
  border-color: var(--toast-info-border);
}

.toast-item.warning {
  color: var(--toast-warning);
  background: var(--toast-warning-bg);
  border-color: var(--toast-warning-border);
}

/* legacy single toast (fallback) */
.toast {
  display: none;
}

.hidden {
  display: none !important;
}

body.app-mode {
  background: var(--app-bg);
  align-items: stretch;
  justify-content: center;
  padding: 12px;
  display: flex;
  overflow: auto;
  min-height: 100vh;
  box-sizing: border-box;
}

.app-shell {
  display: none;
  width: 100%;
  max-width: 100%;
  min-height: calc(100vh - 24px);
  max-height: calc(100vh - 24px);
  border: 1px solid var(--app-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--app-surface);
  box-shadow: var(--shadow-lg);
}

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--app-sidebar-bg);
  color: var(--app-sidebar-text);
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  border-right: 1px solid var(--app-sidebar-border);
}

.sidebar-brand {
  padding: 18px 16px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--app-sidebar-text);
  border-bottom: 1px solid var(--app-sidebar-border);
}

.sidebar-brand::before {
  display: none;
}

.nav-item.active {
  background: var(--app-sidebar-active-bg);
  color: var(--app-sidebar-text);
  box-shadow: inset 3px 0 0 var(--app-sidebar-accent);
  font-weight: 600;
}

.btn-action {
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(180deg, var(--navy-700) 0%, var(--navy-800) 100%);
  color: #fff;
  transition: filter 0.15s, transform 0.12s, box-shadow 0.15s;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
  letter-spacing: 0.01em;
}

.btn-action:hover {
  filter: brightness(1.08);
}

.btn-action.secondary {
  background: var(--app-surface);
  color: var(--app-text);
  border: 1px solid var(--app-border-strong);
  box-shadow: none;
}

.btn-action.secondary:hover {
  background: var(--app-surface-muted);
  border-color: var(--navy-600);
}

.btn-action.danger-outline {
  background: var(--app-surface);
  color: #b42318;
  border: 1px solid #fecdca;
}

.btn-action.danger-outline:hover {
  background: #fef3f2;
  box-shadow: none;
}

.main-header {
  padding: 16px 24px;
  background: var(--app-surface);
  border-bottom: 1px solid var(--app-border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.main-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--app-text);
}

.content-panel {
  border-radius: var(--radius-md);
  border: 1px solid var(--app-border);
  box-shadow: var(--shadow);
}

/* —— 语言下拉 —— */
.lang-dropdown {
  position: relative;
  display: inline-flex;
}

.lang-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--app-border-strong);
  border-radius: var(--radius-sm);
  background: var(--app-surface);
  color: var(--app-text);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.lang-dropdown-trigger:hover,
.lang-dropdown.open .lang-dropdown-trigger {
  border-color: var(--navy-600);
  background: var(--app-surface-muted);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.lang-dropdown-trigger svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.75;
}

.lang-dropdown-chevron {
  transition: transform 0.2s;
}

.lang-dropdown.open .lang-dropdown-chevron {
  transform: rotate(180deg);
}

.lang-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 148px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 200;
}

.lang-dropdown-menu.hidden {
  display: none;
}

.lang-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--app-text);
  font-size: 0.84rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}

.lang-dropdown-item:hover {
  background: var(--app-surface-muted);
}

.lang-dropdown-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.lang-dropdown-item .lang-check {
  width: 16px;
  opacity: 0;
  color: var(--accent);
}

.lang-dropdown-item.active .lang-check {
  opacity: 1;
}

.login-lang-dropdown .lang-dropdown-trigger {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.5);
}

html[data-theme="dark"] .login-lang-dropdown .lang-dropdown-trigger {
  background: rgba(26, 35, 50, 0.9);
  border-color: rgba(255, 255, 255, 0.1);
}

.btn-theme-toggle {
  flex-shrink: 0;
  padding: 8px 14px;
  border: 1px solid var(--app-border-strong);
  border-radius: var(--radius-sm);
  background: var(--app-surface);
  color: var(--app-text);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-theme-toggle:hover {
  background: var(--app-surface-muted);
  border-color: var(--navy-600);
}

body.app-mode .app-shell {
  display: flex;
  flex-direction: row;
}

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--app-sidebar-bg);
  color: var(--app-sidebar-text);
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  border-right: 1px solid var(--app-sidebar-border);
}

.main-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.main-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-lang-toggle,
.lang-btn {
  border: 1px solid var(--border-subtle, #d6d3d1);
  background: var(--surface-elevated, #fff);
  color: var(--text-primary, #1c1917);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.82rem;
  cursor: pointer;
  line-height: 1.2;
}

.btn-lang-toggle:hover,
.lang-btn:hover {
  border-color: var(--accent, #0d9488);
  color: var(--accent, #0d9488);
}

.lang-btn.active {
  background: var(--accent, #0d9488);
  border-color: var(--accent, #0d9488);
  color: #fff;
}

.login-lang-switch {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 12px;
}

.sidebar-user {
  padding: 10px 16px;
  font-size: 0.78rem;
  color: var(--app-sidebar-muted);
  border-bottom: 1px solid var(--app-sidebar-border);
}

.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--app-sidebar-muted);
  font-size: 0.88rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: var(--app-sidebar-hover);
  color: var(--app-sidebar-text);
}

.nav-item.active {
  background: var(--app-sidebar-active-bg);
  color: var(--app-sidebar-text);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--app-sidebar-accent);
}

.nav-icon {
  width: 18px;
  text-align: center;
  font-size: 0.9rem;
}

.sidebar-footer {
  padding: 12px 8px 14px;
  border-top: 1px solid var(--app-sidebar-border);
}

.btn-logout {
  width: 100%;
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--app-sidebar-muted);
  font-size: 0.86rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--app-sidebar-text);
  border-color: rgba(255, 255, 255, 0.24);
}

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  background: var(--app-bg);
  border-left: 1px solid var(--border);
}

.main-header {
  padding: 20px 28px;
  background: var(--app-surface);
  border-bottom: 1px solid var(--app-border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.main-header-text {
  min-width: 0;
}

.btn-theme-toggle {
  flex-shrink: 0;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--app-surface-muted);
  color: var(--app-text);
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn-theme-toggle:hover {
  background: var(--app-surface-alt);
  border-color: var(--app-border-strong);
}

body.app-mode .main-header {
  padding: 12px 18px;
}

body.app-mode .main-header h2 {
  font-size: 1.1rem;
}

.main-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.main-header .breadcrumb {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.main-content {
  flex: 1;
  padding: 20px 24px 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.app-mode .main-content {
  padding: 10px 14px 14px;
}

.content-panel {
  display: none;
  background: var(--app-surface);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--app-border);
  color: var(--app-text);
}

.content-panel.active {
  display: block;
}

#panel-inbound.content-panel.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 8px 12px 10px;
}

#panel-inbound.content-panel.active > .panel-title-row {
  margin: 0 0 2px;
}

#panel-inbound.content-panel.active > .panel-title-row h3 {
  font-size: 1.05rem;
}

#panel-inbound.content-panel.active > .inbound-intro {
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.3;
  margin: 0 0 4px;
  flex-shrink: 0;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.panel-title-row h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.btn-refresh-view {
  flex-shrink: 0;
}

.content-panel h3 {
  font-size: 1.1rem;
  margin-bottom: 10px;
}

.content-panel p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

#panel-inbound .panel-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 0 0 4px;
  flex-shrink: 0;
}

#panel-inbound .panel-toolbar .btn-action {
  padding: 7px 14px;
  font-size: 0.84rem;
}

#panel-inbound .toolbar-maker-label {
  font-size: 0.84rem;
}

#panel-inbound .toolbar-maker {
  gap: 6px;
}

#panel-inbound .toolbar-maker .filter-region-select {
  min-width: 140px;
  padding: 5px 8px;
  font-size: 0.82rem;
}

#panel-inbound .import-maker-hint {
  font-size: 0.72rem;
  margin: 0 0 2px;
  line-height: 1.3;
}

#panel-inbound .import-meta {
  margin: 0 0 4px;
  font-size: 0.72rem;
  line-height: 1.3;
}

.panel-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 16px 0 12px;
}

.toolbar-maker {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-maker-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: #374151;
  white-space: nowrap;
}

.toolbar-maker .filter-region-select {
  min-width: 160px;
}

.toolbar-maker .required {
  color: #ef4444;
  margin-left: 2px;
}

.toolbar-maker .filter-region-select.import-maker-missing {
  border-color: #ef4444;
  background: #fef2f2;
}

.import-maker-hint {
  font-size: 0.8rem;
  color: #dc2626;
  margin: 0 0 4px;
  flex-shrink: 0;
}

.import-maker-hint.hidden {
  display: none;
}

.btn-action:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.toolbar-spacer {
  flex: 1;
}

.btn-action {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  transition: background 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 2px rgba(28, 36, 48, 0.08);
}

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

.btn-action.secondary {
  background: var(--app-surface);
  color: var(--app-text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn-action.secondary:hover {
  background: var(--app-surface-muted);
}

.btn-action.danger-outline {
  background: var(--app-surface);
  color: #c0392b;
  border: 1px solid #e8b4b0;
}

.btn-action.danger-outline:hover {
  background: #fdf2f2;
  box-shadow: none;
}

.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 12px 0 8px;
  padding: 14px 16px;
  background: var(--app-surface-muted);
  border-radius: var(--radius-sm);
  border: 1px solid var(--app-border);
}

.filter-bar.hidden {
  display: none;
}

.filter-bar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
}

.filter-inline-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--app-text);
  white-space: nowrap;
}

.filter-sep {
  font-size: 0.9rem;
  color: var(--app-text-muted);
  white-space: nowrap;
}

.filter-date,
.filter-time,
.filter-region-select {
  padding: 7px 10px;
  font-size: 0.88rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--app-text);
  outline: none;
}

.filter-datetime-row {
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.filter-datetime-row .filter-bar-spacer {
  flex: 1;
  min-width: 12px;
}

.filter-datetime-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

.btn-filter-reset-green {
  color: var(--app-text) !important;
  border-color: var(--app-border-strong) !important;
  background: var(--app-surface) !important;
  box-shadow: none !important;
  font-weight: 600;
}

.btn-filter-reset-green:hover {
  color: var(--app-text) !important;
  border-color: var(--navy-600) !important;
  background: var(--app-surface-muted) !important;
  box-shadow: none !important;
}

.filter-date {
  min-width: 142px;
}

.filter-time {
  min-width: 108px;
}

.filter-date:focus,
.filter-time:focus,
.filter-region-select:focus,
.filter-field input:focus {
  border-color: #9ca3af;
  box-shadow: none;
}

.filter-region-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: #374151;
  margin-right: 4px;
}

.filter-region-select {
  padding-right: 28px;
  min-width: 120px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
}

.filter-region-hint {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0;
}

.filter-region-hint.hidden,
.filter-region-row.hidden {
  display: none;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 140px;
  flex: 1;
}

.filter-field label {
  font-size: 0.8rem;
  font-weight: 500;
  color: #374151;
}

.filter-field input {
  padding: 8px 12px;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  background: #fff;
}

.filter-highlight-ticket,
.filter-highlight-code {
  background: transparent;
  border-radius: 0;
  padding: 0;
}

.filter-bar label[for="filter-ticket"],
.filter-bar label[for="filter-code"],
.filter-bar label[for="out-filter-ticket"],
.filter-bar label[for="out-filter-code"],
.filter-bar label[for="qry-filter-ticket"],
.filter-bar label[for="qry-filter-code"],
.filter-bar label[for="veh-view-filter-ticket"],
.filter-bar label[for="veh-view-filter-code"],
.filter-highlight-ticket label,
.filter-highlight-code label {
  color: var(--app-text);
  font-weight: 500;
}

.filter-bar input[id="filter-ticket"],
.filter-bar input[id="filter-code"],
.filter-bar input[id="out-filter-ticket"],
.filter-bar input[id="out-filter-code"],
.filter-bar input[id="qry-filter-ticket"],
.filter-bar input[id="qry-filter-code"],
.filter-bar input[id="veh-view-filter-ticket"],
.filter-bar input[id="veh-view-filter-code"],
.filter-highlight-ticket input,
.filter-highlight-code input {
  border-color: var(--border);
  background: var(--input-bg);
}

.filter-bar input[id$="filter-ticket"]:focus,
.filter-bar input[id$="filter-code"]:focus,
.filter-highlight-ticket input:focus,
.filter-highlight-code input:focus {
  border-color: #9ca3af;
  box-shadow: none;
  background: var(--input-bg);
}

.inbound-file-input {
  position: absolute;
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}

.import-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 6px;
  line-height: 1.35;
  flex-shrink: 0;
}

.import-meta.hidden {
  display: none;
}

#panel-inbound .filter-bar {
  flex-shrink: 0;
  margin: 0 0 6px;
  padding: 6px 8px;
  gap: 6px;
}

#panel-inbound #inbound-cargo-stats {
  flex-shrink: 0;
  margin: 0 0 8px;
}

#panel-inbound .filter-bar-row {
  gap: 6px 10px;
}

#panel-inbound .filter-field {
  min-width: 118px;
  gap: 3px;
}

#panel-inbound .filter-field label {
  font-size: 0.72rem;
}

#panel-inbound .filter-field input,
#panel-inbound .filter-date,
#panel-inbound .filter-time,
#panel-inbound .filter-region-select {
  padding: 5px 8px;
  font-size: 0.82rem;
}

#panel-inbound .filter-inline-label,
#panel-inbound .filter-sep,
#panel-inbound .filter-region-label {
  font-size: 0.82rem;
}

#panel-inbound .filter-bar .btn-action.secondary {
  padding: 6px 12px;
  font-size: 0.82rem;
}

#panel-outbound.content-panel.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 12px 14px 14px;
}

#panel-outbound.content-panel.active > .panel-title-row {
  margin: 0 0 4px;
}

#panel-outbound.content-panel.active > .panel-title-row h3 {
  font-size: 1rem;
}

#panel-outbound.content-panel.active > .outbound-intro {
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.35;
  margin: 0 0 6px;
  flex-shrink: 0;
}

#panel-outbound .panel-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 6px;
  flex-shrink: 0;
}

#panel-outbound .filter-bar {
  flex-shrink: 0;
  margin: 0 0 8px;
  padding: 8px 10px;
  gap: 8px;
}

#panel-outbound #outbound-cargo-stats {
  flex-shrink: 0;
  margin: 0 0 8px;
}

#panel-outbound .table-viewport-wrap {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 120px;
  max-height: none;
  margin-top: 0;
  min-width: 0;
  border: 1px solid var(--app-border);
  border-radius: 6px;
  background: transparent;
}

#panel-query.content-panel.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 12px 14px 14px;
}

#panel-query.content-panel.active > h3 {
  font-size: 1rem;
  margin: 0 0 4px;
  flex-shrink: 0;
}

#panel-query.content-panel.active > .query-intro {
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.35;
  margin: 0 0 6px;
  flex-shrink: 0;
}

.query-scope-toggle {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 8px;
  flex-shrink: 0;
}

.query-scope-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.query-scope-btn.active {
  background: var(--accent, #0d9488);
  border-color: var(--accent, #0d9488);
  color: #fff;
}

#query-data-table.query-readonly-table td,
#query-data-table.query-readonly-table th {
  cursor: default;
}

#query-data-table.query-readonly-table td.cell-selectable:hover {
  background: inherit;
}

#panel-query .filter-bar {
  flex-shrink: 0;
  margin: 0 0 8px;
  padding: 8px 10px;
  gap: 8px;
}

#panel-query #query-cargo-stats {
  flex-shrink: 0;
  margin: 0 0 8px;
}

#panel-query .table-viewport-wrap {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 120px;
  max-height: none;
  margin-top: 0;
  min-width: 0;
  border: 1px solid var(--app-border);
  border-radius: 6px;
  background: transparent;
}

#panel-edit.content-panel.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 8px 12px 10px;
}

#panel-edit.content-panel.active > .panel-title-row {
  margin: 0 0 4px;
}

#panel-edit.content-panel.active > .panel-title-row h3 {
  font-size: 0.95rem;
}

.edit-mode-tabs {
  display: flex;
  gap: 6px;
  margin: 0 0 4px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.edit-mode-tab {
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid #d6d3d1;
  border-radius: 6px;
  background: #fafaf9;
  color: #44403c;
  cursor: pointer;
}

.edit-mode-tab:hover {
  background: #f5f5f4;
  border-color: #a8a29e;
}

.edit-mode-tab.active {
  background: #1c1917;
  color: #fff;
  border-color: #1c1917;
}

.edit-mode-panels {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.edit-mode-panel {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}

.edit-mode-panel.active {
  display: flex;
}

.edit-mode-panel > .edit-panel-intro {
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.3;
  margin: 0 0 4px;
  flex-shrink: 0;
}

.edit-mode-panel .panel-toolbar {
  flex-shrink: 0;
  margin: 0 0 4px;
  gap: 6px;
}

.edit-mode-panel .panel-toolbar .btn-action {
  padding: 7px 14px;
  font-size: 0.84rem;
}

.edit-mode-panel .toolbar-maker-label {
  font-size: 0.84rem;
}

.edit-mode-panel .import-meta {
  margin: 0 0 4px;
  font-size: 0.72rem;
  line-height: 1.3;
}

.edit-mode-panel .filter-bar {
  flex-shrink: 0;
  margin: 0 0 6px;
  padding: 6px 8px;
  gap: 6px;
}

.edit-mode-panel .filter-bar-row {
  gap: 6px 10px;
}

.edit-mode-panel .filter-field {
  min-width: 118px;
  gap: 3px;
}

.edit-mode-panel .filter-field label {
  font-size: 0.72rem;
}

.edit-mode-panel .filter-field input,
.edit-mode-panel .filter-date,
.edit-mode-panel .filter-time,
.edit-mode-panel .filter-region-select {
  padding: 5px 8px;
  font-size: 0.82rem;
}

.edit-mode-panel .filter-inline-label,
.edit-mode-panel .filter-sep,
.edit-mode-panel .filter-region-label {
  font-size: 0.82rem;
}

.edit-mode-panel .filter-bar .btn-action.secondary {
  padding: 6px 12px;
  font-size: 0.82rem;
}

.edit-mode-panel .table-viewport-wrap {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 160px;
  max-height: none;
  min-width: 0;
  border: 1px solid var(--app-border);
  border-radius: 6px;
  background: transparent;
}

.edit-mode-panel .data-table .edit-select-col {
  width: 20px;
  min-width: 20px;
  max-width: 20px;
  text-align: center;
  vertical-align: middle;
  padding: 2px;
  background: transparent;
}

.edit-mode-panel .data-table thead .edit-select-col {
  background: #f1f5f9;
}

.edit-mode-panel .data-table .edit-select-col input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  vertical-align: middle;
}

.edit-mode-panel .data-table tr.edit-row-selected td {
  background: #eff6ff;
}

.edit-mode-panel .data-table tr.edit-row-selected .edit-select-col {
  background: #dbeafe;
}

.edit-modify-banner {
  font-size: 0.78rem;
  color: #1e40af;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 6px 10px;
  margin: 0 0 4px;
  line-height: 1.35;
  flex-shrink: 0;
}

.edit-modify-banner.hidden {
  display: none;
}

.edit-mode-panel .data-table td.cell-editable {
  cursor: text;
}

.edit-mode-panel .data-table td.cell-editing,
.edit-mode-panel .data-table td.cell-selected.cell-editable {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
  background: #fff;
}

.edit-mode-panel .data-table td.cell-modified {
  background: #fef9c3;
}

.edit-mode-panel .data-table tr.edit-row-selected td.cell-modified {
  background: #fde68a;
}

.edit-supplement-picker {
  flex-shrink: 0;
  margin: 0 0 6px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

.edit-supplement-picker-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.edit-supplement-batch-label {
  font-size: 0.84rem;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
}

.edit-supplement-picker #eds-supplement-vehicle-id {
  min-width: 280px;
  flex: 1;
  max-width: 480px;
}

.edit-supplement-banner {
  font-size: 0.78rem;
  color: #166534;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 6px 10px;
  margin: 0 0 6px;
  line-height: 1.35;
  flex-shrink: 0;
}

.edit-supplement-banner.hidden,
.edit-supplement-picker.hidden,
.edit-supplement-form-wrap.hidden,
.edit-supplement-table-host.hidden {
  display: none !important;
}

.edit-supplement-form-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.edit-supplement-form-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px 14px;
  padding: 10px 12px;
  border: 1px solid #d6d3d1;
  border-radius: 6px;
  background: #fff;
  align-content: start;
}

.edit-supplement-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.edit-supplement-field label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #374151;
  line-height: 1.25;
}

.edit-supplement-input {
  width: 100%;
  padding: 6px 8px;
  font-size: 0.84rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  box-sizing: border-box;
}

.edit-supplement-input:focus {
  border-color: #2563eb;
  outline: none;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.edit-supplement-form-actions {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.edit-supplement-form-empty {
  grid-column: 1 / -1;
  color: #94a3b8;
  font-size: 0.85rem;
  text-align: center;
  padding: 24px;
}

.edit-supplement-unit-price {
  display: flex;
  gap: 8px;
  width: 100%;
}

.edit-supplement-unit-price select {
  flex: 0 0 108px;
  min-width: 0;
}

.edit-supplement-unit-price input {
  flex: 1;
  min-width: 0;
}

.edit-supplement-readonly {
  background: #f8fafc !important;
  color: #64748b !important;
  cursor: default;
}

.inbound-supplement-pick-bar {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 8px;
  padding: 10px 12px;
  background: #fef9c3;
  border: 1px solid #fde047;
  border-radius: 8px;
}

.inbound-supplement-pick-bar.hidden {
  display: none;
}

.inbound-supplement-pick-hint {
  margin: 0;
  font-size: 0.82rem;
  color: #854d0e;
  line-height: 1.45;
  flex: 1;
  min-width: 200px;
}

.inbound-supplement-pick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#inbound-data-table tr.inbound-supplement-pick-selected td {
  background: #eff6ff;
}

#edit-panel-supplement.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.outbound-draft-banner {
  font-size: 0.82rem;
  color: #1e40af;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 8px 12px;
  margin: 0 0 8px;
  flex-shrink: 0;
  line-height: 1.45;
}

.outbound-draft-banner.hidden {
  display: none;
}

.receipt-queue-wrap {
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid #f59e0b;
  border-radius: 10px;
  background: linear-gradient(180deg, #fffbeb 0%, #fff7ed 100%);
}
.receipt-queue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 14px;
  color: #92400e;
}
.receipt-queue-count {
  font-size: 12px;
  font-weight: 600;
  color: #b45309;
}
.receipt-queue-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.receipt-queue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #fde68a;
}
.receipt-queue-info {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 16px;
  font-size: 13px;
  color: #78350f;
  flex: 1;
}
.receipt-label {
  color: #a16207;
  margin-right: 6px;
}
.btn-receipt-confirm {
  flex-shrink: 0;
  white-space: nowrap;
}

#panel-inbound .table-viewport-wrap {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 160px;
  max-height: none;
  margin-top: 0;
  min-width: 0;
  border: 1px solid var(--app-border);
  border-radius: 6px;
  background: transparent;
}

.table-viewport-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 280px;
  max-height: calc(100vh - 320px);
  margin-top: 12px;
  min-width: 0;
  border: 1px solid var(--app-border);
  border-radius: var(--radius-sm);
  background: transparent;
}

.table-viewport-wrap.hidden-hscroll .table-hscroll {
  display: none;
}

.table-viewport {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: scroll;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #9ca3af #f3f4f6;
  -webkit-overflow-scrolling: touch;
}

.table-hscroll {
  flex-shrink: 0;
  height: 16px;
  overflow-x: scroll;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: #9ca3af #f3f4f6;
}

.table-hscroll-spacer {
  height: 1px;
}

.table-viewport::-webkit-scrollbar,
.table-hscroll::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}

.table-viewport::-webkit-scrollbar-track,
.table-hscroll::-webkit-scrollbar-track {
  background: #f3f4f6;
}

.table-viewport::-webkit-scrollbar-thumb,
.table-hscroll::-webkit-scrollbar-thumb {
  background: #9ca3af;
  border-radius: 7px;
  border: 3px solid #f3f4f6;
}

.table-viewport::-webkit-scrollbar-thumb:hover,
.table-hscroll::-webkit-scrollbar-thumb:hover {
  background: #6b7280;
}

.data-table {
  width: max-content;
  border-collapse: collapse;
  font-size: 0.8rem;
  table-layout: fixed;
}

.datagrid-table th,
.datagrid-table td {
  padding: 6px 10px;
  text-align: left;
  border: 1px solid #e5e7eb;
  vertical-align: middle;
  white-space: nowrap;
  min-width: 64px;
  width: 110px;
  max-width: 520px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.datagrid-table th.col-resizable-th {
  position: relative;
  padding-right: 14px;
}

.datagrid-table .col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  z-index: 2;
}

.datagrid-table .col-resizer:hover {
  background: rgba(37, 99, 235, 0.15);
}

body.col-resize-active {
  cursor: col-resize !important;
  user-select: none !important;
}

body.col-resize-active * {
  cursor: col-resize !important;
}

.batch-divider-row td {
  background: #f5f5f4;
  font-weight: 500;
  font-size: 0.78rem;
  color: #374151;
  border-top: 1px solid #d6d3d1;
  border-bottom: 1px solid #e5e7eb;
  padding: 6px 10px;
  line-height: 1.25;
  height: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.batch-divider-row.batch-divider-first td {
  border-top: none;
}

.datagrid-table tr.batch-divider-row + tr td {
  border-top: none;
}

.batch-empty-row {
  display: none;
}

.invoice-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  background: #eef2f7;
  box-sizing: border-box;
}

.invoice-modal.hidden {
  display: none !important;
}

.invoice-modal-backdrop {
  display: none;
}

.invoice-floating-bar {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid #e2e8f0;
  backdrop-filter: blur(8px);
}

.invoice-floating-hint {
  font-size: 0.8rem;
  color: #64748b;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.invoice-floating-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn-invoice-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
}

.delete-edit-search-bar,
.vehicle-edit-search-bar {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
  padding: 10px 16px;
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
  border-bottom: 2px solid #3b82f6;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.14);
}

.delete-edit-search-bar::before,
.vehicle-edit-search-bar::before {
  content: "搜索定位";
  font-size: 0.84rem;
  font-weight: 700;
  color: #1d4ed8;
  letter-spacing: 0.02em;
  white-space: nowrap;
  margin-right: 2px;
}

html[lang="ru"] .delete-edit-search-bar::before,
html[lang="ru"] .vehicle-edit-search-bar::before {
  content: "Поиск";
}

.delete-edit-search-label,
.vehicle-edit-search-label {
  font-size: 0.84rem;
  font-weight: 600;
  color: #1e3a8a;
  white-space: nowrap;
}

.delete-edit-search-input,
.vehicle-edit-search-input {
  width: 148px;
  max-width: 36vw;
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.88rem;
  font-weight: 500;
  color: #0f172a;
  border: 2px solid #60a5fa;
  border-radius: 6px;
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
}

.delete-edit-search-input::placeholder,
.vehicle-edit-search-input::placeholder {
  color: #64748b;
  font-weight: 400;
}

.delete-edit-search-input:focus,
.vehicle-edit-search-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow:
    0 0 0 3px rgba(37, 99, 235, 0.22),
    inset 0 1px 2px rgba(15, 23, 42, 0.06);
}

.vehicle-edit-search-bar .btn-invoice-sm,
.delete-edit-search-bar .btn-invoice-sm {
  min-height: 34px;
  font-weight: 600;
}

.invoice-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.invoice-nav.hidden {
  display: none;
}

.btn-invoice-nav {
  width: 30px;
  height: 30px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #334155;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.btn-invoice-nav:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.btn-invoice-nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.invoice-fields-empty {
  margin: 0 0 10px;
  font-size: 0.75rem;
  color: #94a3b8;
  text-align: center;
}

#invoice-nav-indicator {
  font-size: 0.8rem;
  color: #475569;
  min-width: 3.5em;
  text-align: center;
}

.invoice-modal-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px 16px;
  overflow: hidden;
}

.invoice-modal-body {
  width: 100%;
  max-width: 1280px;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

.invoice-sheet {
  width: 100%;
  max-width: 1220px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.14);
  padding: 32px 42px 28px;
  box-sizing: border-box;
  color: #0f172a;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 1.02rem;
}

.invoice-sheet-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 3px double #1e3a5f;
}

.invoice-brand-block {
  flex: 1;
  min-width: 0;
}

.invoice-brand-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e3a5f;
  letter-spacing: 0.06em;
}

.invoice-brand-sub {
  margin: 4px 0 0;
  font-size: 0.72rem;
  color: #64748b;
}

.invoice-doc-ids {
  text-align: right;
  font-size: 0.78rem;
  line-height: 1.55;
  flex-shrink: 0;
}

.invoice-doc-ids .doc-line {
  display: block;
}

.invoice-doc-ids .doc-line strong {
  color: #1e3a5f;
  font-weight: 700;
  font-size: 0.92rem;
}

.invoice-head {
  text-align: center;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 2px solid #1e3a5f;
}

.invoice-title {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: 0.42em;
  padding-left: 0.42em;
  color: #0f172a;
}

.invoice-title-en {
  margin: 4px 0 0;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  color: #94a3b8;
  text-transform: uppercase;
}

.invoice-unit-price-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  margin: 0 0 14px;
  padding: 12px 16px;
  border: 2px solid #fecaca;
  border-radius: 10px;
  background: linear-gradient(180deg, #fff5f5 0%, #ffffff 100%);
}

.invoice-cargo-banner.invoice-unit-price-banner {
  border-color: #e2e8f0;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

.invoice-unit-price-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.invoice-unit-price-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: #991b1b;
}

.invoice-cargo-banner .invoice-unit-price-label {
  color: #64748b;
  font-weight: 600;
  font-size: 0.68rem;
  letter-spacing: 0.02em;
}

.invoice-unit-price-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: #dc2626;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.invoice-cargo-banner .invoice-unit-price-value,
.invoice-cargo-banner .invoice-sender-value {
  color: #0f172a;
  font-size: 1.08rem;
  font-weight: 700;
}

.invoice-unit-price-combined {
  flex: 1;
  min-width: min(100%, 320px);
}

.invoice-unit-price-pair {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
}

.invoice-unit-price-part {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}

.invoice-unit-price-part em {
  font-style: normal;
  font-size: 0.88rem;
  font-weight: 700;
  color: #991b1b;
}

.invoice-unit-price-sep {
  color: #f87171;
  font-weight: 700;
  font-size: 1.1rem;
  user-select: none;
}

.modify-edit-input,
.invoice-edit-input {
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 4px 8px;
  font: inherit;
  color: #0f172a;
  background: #fff;
  min-width: 72px;
}

.invoice-unit-price-input,
.modify-edit-unit-prices .modify-edit-input {
  font-size: 1.25rem;
  font-weight: 800;
  color: #dc2626;
  width: 96px;
  text-align: center;
}

.modify-edit-field .modify-edit-input,
.modify-edit-metrics .modify-edit-input {
  width: 100%;
  margin-top: 4px;
}

.modify-edit-fee-hint {
  flex-basis: 100%;
  margin: 10px 0 0;
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.45;
}

body.modify-edit-open .invoice-floating-bar,
body.supplement-edit-open .invoice-floating-bar,
body.delete-edit-open .invoice-floating-bar,
body.invoice-open .invoice-floating-bar {
  z-index: 12002;
}

.invoice-brief {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px 14px;
  margin-bottom: 18px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.82rem;
}

.invoice-brief-item .k {
  display: block;
  color: #64748b;
  margin-bottom: 2px;
  font-size: 0.7rem;
}

.invoice-brief-item .v {
  display: block;
  color: #0f172a;
  font-weight: 600;
  word-break: break-all;
}

.invoice-brief-pair {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  min-width: 0;
}

.invoice-brief-pair .invoice-brief-item {
  flex: 1;
  min-width: 0;
}

.invoice-brief-pair .invoice-brief-item .v {
  font-size: 1.08rem;
  font-weight: 700;
}

.invoice-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 16px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
}

.invoice-metrics.invoice-metrics-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.invoice-metrics.invoice-metrics-cols-5 {
  grid-template-columns: repeat(5, 1fr);
}

.invoice-metric-price .metric-label {
  color: #991b1b;
}

.invoice-sender-value {
  max-width: 280px;
  word-break: break-all;
}

#supplement-edit-modal .invoice-modal-stage,
#supplement-edit-modal .invoice-modal-body,
#delete-edit-modal .invoice-modal-stage,
#delete-edit-modal .invoice-modal-body {
  background: #eef2f7;
}

#supplement-edit-modal .invoice-sheet,
#delete-edit-modal .invoice-sheet {
  margin: 0 auto;
}

#invoice-modal .invoice-unit-price-value,
#modify-edit-modal .invoice-unit-price-value,
#supplement-edit-modal .invoice-unit-price-value,
#delete-edit-modal .invoice-unit-price-value {
  font-size: 1.42rem;
}

#invoice-modal .invoice-cargo-banner .invoice-unit-price-value,
#invoice-modal .invoice-cargo-banner .invoice-sender-value,
#modify-edit-modal .invoice-cargo-banner .invoice-unit-price-value,
#modify-edit-modal .invoice-cargo-banner .invoice-sender-value,
#supplement-edit-modal .invoice-cargo-banner .invoice-unit-price-value,
#supplement-edit-modal .invoice-cargo-banner .invoice-sender-value,
#delete-edit-modal .invoice-cargo-banner .invoice-unit-price-value,
#delete-edit-modal .invoice-cargo-banner .invoice-sender-value {
  font-size: 1.12rem;
  font-weight: 700;
}

#invoice-modal .invoice-cargo-banner .invoice-unit-price-label,
#modify-edit-modal .invoice-cargo-banner .invoice-unit-price-label,
#supplement-edit-modal .invoice-cargo-banner .invoice-unit-price-label,
#delete-edit-modal .invoice-cargo-banner .invoice-unit-price-label {
  font-size: 0.66rem;
}

#invoice-modal .invoice-metric-price-value,
#modify-edit-modal .invoice-metric-price-value,
#supplement-edit-modal .invoice-metric-price-value,
#delete-edit-modal .invoice-metric-price-value {
  font-size: 1.12rem;
}

#invoice-modal .metric-value,
#modify-edit-modal .metric-value,
#supplement-edit-modal .metric-value,
#delete-edit-modal .metric-value {
  font-size: 1.08rem;
}

#invoice-modal .invoice-title,
#modify-edit-modal .invoice-title,
#supplement-edit-modal .invoice-title,
#delete-edit-modal .invoice-title {
  font-size: 1.65rem;
}

.invoice-metric-price-value {
  color: #dc2626;
  font-weight: 800;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.invoice-cargo-verify-row,
.invoice-unit-price-pair-row {
  flex-wrap: nowrap;
  gap: 24px 32px;
}

.invoice-cargo-verify-row .invoice-unit-price-item,
.invoice-unit-price-pair-row .invoice-unit-price-item {
  flex: 0 1 auto;
}

.invoice-unit-price-pair-row .invoice-unit-price-cbm {
  margin-left: 0;
}

.invoice-cargo-banner .modify-edit-input {
  font-size: 1.08rem;
  font-weight: 700;
  color: #0f172a;
  width: auto;
  min-width: 120px;
  text-align: left;
  border-color: #cbd5e1;
  background: #fff;
}

.invoice-metric-price .modify-edit-input {
  font-size: 1.05rem;
  font-weight: 800;
  color: #dc2626;
  text-align: center;
  width: 100%;
  border-color: #fecaca;
  background: #fff;
}

.modify-edit-metrics .invoice-metric-card .modify-edit-input {
  width: 100%;
  text-align: center;
  margin-top: 2px;
}

.modify-edit-brief-pair .modify-edit-input,
.invoice-brief-pair .modify-edit-input {
  width: 100%;
  margin-top: 2px;
  font-size: 1.08rem;
  font-weight: 700;
}

.modify-edit-cargo-banner .modify-edit-input {
  font-size: 1.08rem;
  font-weight: 700;
  color: #0f172a;
  width: auto;
  min-width: 120px;
  text-align: left;
  border-color: #cbd5e1;
  background: #fff;
}

#invoice-modal .invoice-cargo-banner .modify-edit-input,
#modify-edit-modal .invoice-cargo-banner .modify-edit-input,
#supplement-edit-modal .invoice-cargo-banner .modify-edit-input,
#delete-edit-modal .invoice-cargo-banner .modify-edit-input {
  font-size: 1.12rem;
}

.modify-edit-cargo-banner .invoice-sender-value .modify-edit-input {
  max-width: 280px;
}

.modify-edit-readonly {
  display: inline-block;
  color: #475569;
  font-weight: 600;
  background: #f1f5f9;
  border: 1px dashed #cbd5e1;
  border-radius: 4px;
  padding: 3px 8px;
  cursor: not-allowed;
}

.modify-edit-field-readonly .k::after {
  content: "（系统计算）";
  margin-left: 4px;
  font-size: 0.62rem;
  color: #94a3b8;
  font-weight: 500;
}

html[lang="ru"] .modify-edit-field-readonly .k::after {
  content: " (расчёт системы)";
}

.modify-edit-fee-editable .modify-edit-input {
  width: 100%;
  text-align: center;
  font-weight: 700;
  margin-top: 4px;
}

.modify-edit-fee-calculated .modify-edit-fee-readonly {
  display: block;
  margin-top: 2px;
  text-align: center;
}

.invoice-fee-card.modify-edit-fee-calculated:not(.invoice-fee-total) .modify-edit-fee-readonly {
  color: #0f172a;
  background: transparent;
  border: none;
  padding: 0;
  font-size: 1.28rem;
  font-weight: 800;
  cursor: default;
}

td.cell-readonly-calc {
  background: #f8fafc;
  color: #475569;
  cursor: not-allowed;
}

#supplement-edit-modal .invoice-modal-stage,
#supplement-edit-modal .invoice-modal-body,
#delete-edit-modal .invoice-modal-stage,
#delete-edit-modal .invoice-modal-body {
  background: #eef2f7;
}

#supplement-edit-modal .invoice-sheet,
#delete-edit-modal .invoice-sheet {
  margin: 0 auto;
}

#modify-edit-modal .invoice-modal-stage,
#modify-edit-modal .invoice-modal-body {
  background: #eef2f7;
}

#modify-edit-modal .invoice-sheet {
  margin: 0 auto;
}

.invoice-metric-card {
  text-align: center;
  padding: 8px 6px;
}

.invoice-metric-card .metric-label {
  display: block;
  font-size: 0.75rem;
  color: #78716c;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: 0.08em;
}

.invoice-metric-card .metric-value {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  color: #dc2626;
  font-variant-numeric: tabular-nums;
}

.invoice-fees {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.invoice-fee-card {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 12px 10px;
  text-align: center;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}

.invoice-fee-card.invoice-fee-extra .fee-value,
.invoice-fee-card.modify-edit-fee-editable .fee-value {
  color: #dc2626;
}

.invoice-fee-card.modify-edit-fee-editable .modify-edit-input {
  color: #dc2626;
  border-color: #fecaca;
  font-weight: 800;
  text-align: center;
  width: 100%;
}

.invoice-fee-card.invoice-fee-total .modify-edit-readonly,
.invoice-fee-card.invoice-fee-total .modify-edit-fee-readonly {
  color: #dc2626;
}

.invoice-fee-card .fee-label {
  display: block;
  font-size: 0.68rem;
  color: #64748b;
  margin-bottom: 6px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.invoice-fee-card .fee-value {
  display: block;
  font-size: 1.28rem;
  font-weight: 800;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  word-break: break-all;
}

.invoice-fee-card.invoice-fee-total {
  border-color: #fecaca;
  background: #fff;
  box-shadow: none;
}

.invoice-fee-card.invoice-fee-total .fee-label {
  color: #64748b;
}

.invoice-fee-card.invoice-fee-total .fee-value {
  color: #dc2626;
  font-size: 1.35rem;
  font-weight: 800;
}

.manifest-col-seq,
.manifest-seq-cell {
  width: 60px;
  min-width: 60px;
  max-width: 60px;
  padding: 2px 4px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: #64748b;
  background: transparent;
  font-weight: 600;
  font-size: 0.78rem;
}

#query-data-table .manifest-col-seq,
#query-data-table .manifest-seq-cell {
  min-width: 40px;
}

#query-data-table .manifest-col-status,
#query-data-table .manifest-status-cell {
  min-width: 7.5em;
}

#inbound-data-table .edit-select-col,
.data-table .edit-select-col {
  width: 20px;
  min-width: 20px;
  max-width: 20px;
  text-align: center;
  vertical-align: middle;
  padding: 2px;
  background: transparent;
}

#inbound-data-table thead .edit-select-col,
#outbound-data-table thead .outbound-select-col {
  background: transparent;
}

th.manifest-col-seq,
th.manifest-col-status {
  white-space: nowrap;
  z-index: 2;
}

.manifest-col-status,
.manifest-status-cell {
  min-width: 7.5em;
  white-space: nowrap;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 600;
}

.manifest-status-cell.is-stock {
  color: #16a34a;
  background: transparent;
}

.manifest-status-cell.is-outbound {
  color: #b45309;
  background: transparent;
}

.manifest-status-cell.is-dispatched {
  color: #047857;
  background: transparent;
}

.manifest-status-cell.is-received-transit {
  color: #dc2626;
  background: transparent;
}

.manifest-status-cell.is-received {
  color: #6d28d9;
  background: transparent;
}

.manifest-status-cell.is-delivered {
  color: #9ca3af;
  background: transparent;
  font-weight: 600;
}

.invoice-fields-title {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #475569;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.invoice-fields-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px 12px;
  margin-bottom: 12px;
  font-size: 0.74rem;
}

.invoice-field {
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 7px 10px;
  background: #fafbfc;
  min-height: 2.8em;
}

.invoice-field.invoice-field-highlight {
  border-color: #fecaca;
  background: #fff5f5;
}

.invoice-field.invoice-field-highlight .k {
  color: #dc2626;
  font-weight: 700;
}

.invoice-field .k {
  display: block;
  color: #64748b;
  font-size: 0.66rem;
  margin-bottom: 2px;
  line-height: 1.2;
}

.vehicle-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(241, 245, 249, 0.88);
}

.vehicle-modal.hidden {
  display: none;
}

.vehicle-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(241, 245, 249, 0.88);
}

.vehicle-modal-card {
  position: relative;
  z-index: 1;
  width: min(960px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 20px 22px 18px;
  color: var(--app-text);
}

.vehicle-modal-card h4 {
  margin: 0 0 14px;
  font-size: 1.05rem;
}

.vehicle-form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px 12px;
}

.vehicle-form-field label {
  display: block;
  font-size: 0.78rem;
  color: #475569;
  margin-bottom: 4px;
  font-weight: 500;
}

.vehicle-form-field input,
.vehicle-form-field select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.85rem;
}

.vehicle-form-field input:focus,
.vehicle-form-field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* 车辆弹窗与历史车牌：固定浅色，避免深色主题下系统 datalist 发黑 */
#vehicle-modal {
  color-scheme: light;
}

#vehicle-modal .vehicle-modal-card {
  background: #ffffff;
  color: #111827;
  border-color: #e5e7eb;
}

#vehicle-modal .vehicle-form-field label {
  color: #475569;
}

#vehicle-modal .vehicle-form-field input,
#vehicle-modal .vehicle-form-field select {
  background: #ffffff;
  color: #111827;
  border-color: #d1d5db;
}

.vehicle-plate-field-wrap {
  position: relative;
}

.vehicle-plate-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  max-height: 220px;
  overflow: auto;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  padding: 4px;
}

.vehicle-plate-suggest.hidden {
  display: none;
}

.vehicle-plate-suggest-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  border: none;
  background: transparent;
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
  color: #111827;
}

.vehicle-plate-suggest-item:hover,
.vehicle-plate-suggest-item:focus {
  background: #eff6ff;
  outline: none;
}

.vehicle-plate-suggest-plate {
  font-weight: 600;
  font-size: 0.88rem;
  color: #1e40af;
}

.vehicle-plate-suggest-meta {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 2px;
}

html[data-theme="dark"] #vehicle-modal .vehicle-modal-card,
html[data-theme="dark"] #vehicle-modal .vehicle-form-field input,
html[data-theme="dark"] #vehicle-modal .vehicle-form-field select,
html[data-theme="dark"] .vehicle-plate-suggest {
  background: #ffffff;
  color: #111827;
  border-color: #d1d5db;
}

.vehicle-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

@media (max-width: 900px) {
  .vehicle-form-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

#outbound-data-table .outbound-select-col {
  width: 20px;
  min-width: 20px;
  max-width: 20px;
  text-align: center;
  vertical-align: middle;
  padding: 2px;
  background: transparent;
}

#outbound-data-table thead .outbound-select-col {
  background: transparent;
}

#outbound-data-table .outbound-select-col input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  vertical-align: middle;
}

#outbound-data-table tr.outbound-row-selected td {
  background: #eff6ff;
}

#outbound-data-table tr.outbound-row-shipped td {
  color: #94a3b8;
  background: #f8fafc;
}

#outbound-data-table tr.outbound-row-shipped .outbound-select-col input[type="checkbox"] {
  cursor: not-allowed;
}

#outbound-data-table tr.outbound-row-selected .outbound-select-col {
  background: #dbeafe;
}

#panel-vehicles-origin.content-panel.active,
#panel-vehicles-transit.content-panel.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 12px 14px 14px;
}

#panel-vehicles-origin.content-panel.active .panel-title-row h3,
#panel-vehicles-transit.content-panel.active .panel-title-row h3 {
  font-size: 1rem;
  margin: 0;
  flex-shrink: 0;
}

.vehicle-panel-intro {
  margin: 0 0 10px;
  color: #64748b;
  font-size: 0.88rem;
  line-height: 1.5;
  flex-shrink: 0;
}

.vehicle-list-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.vehicle-list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.vehicle-list-table thead th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.vehicle-list-table tbody td {
  padding: 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  vertical-align: middle;
}

.vehicle-list-table tbody tr:hover td {
  background: #fafafa;
}

.vehicle-list-table .col-no {
  width: 48px;
  color: #64748b;
}

#panel-users .users-intro {
  margin: 0 0 16px;
  color: #64748b;
  font-size: 0.9rem;
  line-height: 1.55;
  flex-shrink: 0;
}

#panel-users.content-panel.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#panel-users #users-admin-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#panel-users .users-list-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: flex-end;
  margin: 0 0 14px;
  padding: 12px 14px;
  background: var(--app-surface-muted);
  border: 1px solid var(--app-border);
  border-radius: 10px;
  flex-shrink: 0;
}

#panel-users .users-list-filter-bar .users-form-field {
  min-width: 160px;
  flex: 1 1 160px;
  max-width: 240px;
}

#panel-users .users-create-card {
  background: var(--app-surface-muted);
  border: 1px solid var(--app-border);
  border-radius: var(--radius-md);
  padding: 16px 18px 18px;
  margin-bottom: 20px;
  flex-shrink: 0;
}

#panel-users .users-create-card h4 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: var(--app-text);
}

#panel-users .users-create-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px 16px;
  align-items: end;
}

#panel-users .users-form-field label {
  display: block;
  font-size: 0.82rem;
  color: var(--app-text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

#panel-users .users-form-field input,
#panel-users .users-form-field select {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--app-border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  background: var(--input-bg);
  color: var(--app-text);
}

#panel-users .users-create-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

#panel-users .users-account-table-wrap {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 160px;
  min-width: 0;
  margin-top: 0;
  border: 1px solid var(--app-border);
  border-radius: var(--radius-md);
  background: var(--app-surface);
}

#panel-users .users-account-table-wrap .table-viewport {
  flex: 1;
  min-height: 0;
}

#panel-users .users-account-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

#panel-users .users-account-table thead th {
  background: var(--app-table-head);
  color: var(--app-text-muted);
  font-weight: 600;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--app-border);
  white-space: nowrap;
}

#panel-users .users-account-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--app-border);
  color: var(--app-text);
  vertical-align: middle;
}

#panel-users .users-account-table tbody tr:hover td {
  background: var(--app-table-row-alt);
}

#panel-users .users-empty,
#panel-users .users-muted {
  color: var(--app-text-muted);
  font-size: 0.88rem;
}

#panel-users .users-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.users-edit-modal {
  position: fixed;
  inset: 0;
  z-index: 1250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(241, 245, 249, 0.88);
}

.users-edit-modal.hidden {
  display: none;
}

.users-edit-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(241, 245, 249, 0.88);
}

.users-edit-modal-card {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 20px 22px 18px;
  color: var(--app-text);
}

.users-edit-modal-card h4 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.users-edit-account-label {
  font-size: 0.85rem;
  color: var(--app-text-muted);
  margin-bottom: 14px;
}

.users-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
}

.users-edit-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.users-edit-field label {
  font-size: 0.82rem;
  color: var(--app-text-muted);
  font-weight: 500;
}

.users-edit-field input,
.users-edit-field select,
.users-edit-readonly {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--app-border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  background: var(--input-bg);
  color: var(--app-text);
}

.users-edit-readonly {
  background: var(--app-surface-muted);
}

.users-edit-field.full-width {
  grid-column: 1 / -1;
}

.users-edit-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--app-border);
}

#panel-users .users-denied {
  padding: 24px;
  text-align: center;
  color: var(--app-text-muted);
  background: var(--app-surface-muted);
  border-radius: var(--radius-md);
  border: 1px dashed var(--app-border);
}

#panel-analysis.content-panel.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 12px 14px 14px;
  background: transparent;
  border: none;
  box-shadow: none;
}

#panel-analysis .panel-title-row {
  margin-bottom: 8px;
  flex-shrink: 0;
}

.analysis-dashboard {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 2px 2px 8px;
  background-image:
    linear-gradient(var(--analysis-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--analysis-grid-line) 1px, transparent 1px);
  background-size: 28px 28px;
}

.analysis-hero {
  position: relative;
  overflow: hidden;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--analysis-card-border);
  background: linear-gradient(
    135deg,
    var(--analysis-accent-soft),
    var(--analysis-card-bg)
  );
  box-shadow: 0 0 32px var(--analysis-accent-soft);
}

.analysis-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.06),
    transparent
  );
  transform: translateX(-100%);
  animation: analysis-scan 6s linear infinite;
  pointer-events: none;
}

@keyframes analysis-scan {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.analysis-hero-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--app-text);
  margin: 0 0 6px;
}

.analysis-hero-sub {
  font-size: 0.82rem;
  color: var(--analysis-text-dim);
  margin: 0;
  line-height: 1.55;
}

.analysis-hero-meta {
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--analysis-accent);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.04em;
}

.analysis-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
}

.analysis-kpi {
  padding: 14px 14px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--analysis-card-border);
  background: var(--analysis-card-bg);
  backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
}

.analysis-kpi::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--analysis-accent), transparent);
  opacity: 0.85;
}

.analysis-kpi-label {
  font-size: 0.72rem;
  color: var(--analysis-text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.analysis-kpi-value {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--analysis-accent-bright);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  line-height: 1.1;
}

.analysis-kpi-unit {
  font-size: 0.72rem;
  color: var(--analysis-text-dim);
  margin-left: 4px;
  font-weight: 500;
}

.analysis-kpi-foot {
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--analysis-text-dim);
}

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

@media (max-width: 960px) {
  .analysis-section-grid {
    grid-template-columns: 1fr;
  }
}

.analysis-card {
  border-radius: var(--radius-md);
  border: 1px solid var(--analysis-card-border);
  background: var(--analysis-card-bg);
  backdrop-filter: blur(8px);
  padding: 14px 16px 16px;
  min-width: 0;
}

.analysis-card-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--app-text);
  letter-spacing: 0.12em;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.analysis-card-title::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 1px;
  background: var(--analysis-accent);
  box-shadow: 0 0 10px var(--analysis-accent);
}

.analysis-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 160px;
  padding-top: 8px;
}

.analysis-bar-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}

.analysis-bar {
  width: 100%;
  max-width: 36px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(
    180deg,
    var(--analysis-accent-bright),
    var(--analysis-accent)
  );
  box-shadow: 0 0 12px var(--analysis-accent-soft);
  min-height: 4px;
  transition: height 0.3s ease;
}

.analysis-bar-label {
  font-size: 0.62rem;
  color: var(--analysis-text-dim);
  writing-mode: horizontal-tb;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.analysis-donut-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.analysis-donut {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 0 24px var(--analysis-accent-soft);
}

.analysis-donut-ring {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.analysis-donut-hole {
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: var(--analysis-card-bg);
  border: 1px solid var(--analysis-card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  color: var(--analysis-text-dim);
  text-align: center;
  line-height: 1.3;
  padding: 4px;
}

.analysis-legend {
  flex: 1;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.analysis-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--app-text);
}

.analysis-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.analysis-rank-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.analysis-rank-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 0.82rem;
}

.analysis-rank-idx {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--analysis-accent);
  font-size: 0.75rem;
}

.analysis-rank-name {
  color: var(--app-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analysis-rank-bar-wrap {
  grid-column: 2 / 4;
  height: 4px;
  background: var(--app-surface-muted);
  border-radius: 2px;
  overflow: hidden;
}

.analysis-rank-bar {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--analysis-accent), var(--analysis-accent-bright));
  box-shadow: 0 0 8px var(--analysis-accent-soft);
}

.analysis-rank-val {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.75rem;
  color: var(--analysis-text-dim);
}

.analysis-metrics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.analysis-metrics-table th,
.analysis-metrics-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--app-border);
  text-align: left;
}

.analysis-metrics-table th {
  color: var(--analysis-text-dim);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

.analysis-metrics-table td {
  color: var(--app-text);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.78rem;
}

.analysis-insight-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.analysis-insight {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--analysis-card-border);
  background: var(--analysis-accent-soft);
  font-size: 0.78rem;
  color: var(--app-text);
  line-height: 1.5;
}

.analysis-insight strong {
  color: var(--analysis-accent-bright);
  font-weight: 600;
}

.analysis-empty {
  padding: 28px;
  text-align: center;
  color: var(--analysis-text-dim);
  font-size: 0.88rem;
}

.analysis-product-table-wrap {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--app-border);
  border-radius: var(--radius-sm);
}

.analysis-product-table td:first-child,
.analysis-product-table th:first-child {
  width: 36px;
  text-align: center;
}

.analysis-card-desc {
  margin: 0 0 14px;
  font-size: 0.82rem;
  color: var(--analysis-text-dim);
  line-height: 1.5;
}

.analysis-compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.analysis-compare-grid-item {
  min-width: 0;
}

.analysis-compare-chart {
  border: 1px solid var(--analysis-card-border);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.35);
}

.analysis-compare-metric-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--analysis-accent);
  margin-bottom: 8px;
  letter-spacing: 0.04em;
}

.analysis-compare-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 10px;
}

.analysis-compare-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--analysis-text-dim);
}

.analysis-compare-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.analysis-compare-cols {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-height: 140px;
  padding-top: 4px;
}

.analysis-compare-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.analysis-compare-bar {
  width: 100%;
  max-width: 48px;
  border-radius: 4px 4px 2px 2px;
  min-height: 6px;
  transition: height 0.2s ease;
}

.analysis-compare-col-label {
  font-size: 0.68rem;
  color: var(--analysis-text-dim);
  text-align: center;
  word-break: break-all;
  line-height: 1.2;
}

.analysis-compare-col-val {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--analysis-accent-bright);
  font-variant-numeric: tabular-nums;
}

.analysis-dim-compare {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.analysis-dim-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.analysis-dim-row {
  display: grid;
  grid-template-columns: minmax(72px, 120px) 1fr minmax(56px, 72px);
  gap: 10px;
  align-items: end;
}

.analysis-dim-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--app-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analysis-dim-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 72px;
  min-width: 0;
}

.analysis-dim-bar {
  flex: 1;
  min-width: 8px;
  max-width: 28px;
  border-radius: 3px 3px 1px 1px;
  align-self: flex-end;
}

.analysis-dim-total {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--analysis-text-dim);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.analysis-warehouse-summary-table {
  min-width: 960px;
}

.analysis-warehouse-summary-table th,
.analysis-warehouse-summary-table td {
  white-space: nowrap;
  font-size: 0.78rem;
}

.vehicle-waybill-link {
  color: #2563eb;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  text-align: left;
}

.vehicle-waybill-link:hover {
  text-decoration: underline;
}

.vehicle-status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
}

.vehicle-status-badge.status-transit {
  background: #dbeafe;
  color: #1d4ed8;
}

.vehicle-status-badge.status-arrived {
  background: #ffedd5;
  color: #c2410c;
}

.vehicle-list-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-vehicle-view,
.btn-vehicle-edit,
.btn-vehicle-dispatch,
.btn-vehicle-receive,
.btn-vehicle-revert,
.btn-vehicle-void,
.btn-vehicle-delete {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.btn-vehicle-view {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.btn-vehicle-view:hover {
  background: #1d4ed8;
}

.btn-vehicle-edit {
  background: #fff;
  color: #374151;
  border-color: #d1d5db;
}

.btn-vehicle-edit:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.btn-vehicle-dispatch {
  background: #ecfdf5;
  color: #047857;
  border-color: #6ee7b7;
}

.btn-vehicle-dispatch:hover {
  background: #d1fae5;
  border-color: #34d399;
}

.btn-vehicle-dispatch.is-dispatched {
  background: #f3f4f6;
  color: #6b7280;
  border-color: #d1d5db;
  cursor: not-allowed;
  opacity: 1;
}

.btn-vehicle-dispatch.is-dispatched:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.btn-vehicle-receive {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #93c5fd;
}

.btn-vehicle-receive:hover {
  background: #dbeafe;
  border-color: #60a5fa;
}

.vehicle-status-cell {
  white-space: nowrap;
  min-width: 7.5em;
}

.vehicle-status-text {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 500;
  color: #475569;
}

.vehicle-status-text.vehicle-status-dispatched {
  color: #b45309;
}

.vehicle-status-text.vehicle-status-received {
  color: #047857;
}

.vehicle-status-text.vehicle-status-saved {
  color: #2563eb;
}

.vehicle-status-text.vehicle-status-reverted {
  color: #6b7280;
}

.btn-vehicle-void {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}

.btn-vehicle-void:hover {
  background: #fde68a;
  border-color: #fbbf24;
}

.btn-vehicle-revert {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fdba74;
}

.btn-vehicle-revert:hover {
  background: #ffedd5;
  border-color: #fb923c;
}

.btn-vehicle-delete {
  background: #fff;
  color: #b91c1c;
  border-color: #fecaca;
}

.btn-vehicle-delete:hover {
  background: #fef2f2;
  border-color: #f87171;
}

.vehicle-list-empty {
  text-align: center;
  padding: 48px 16px;
  color: #94a3b8;
}

.vehicle-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 1250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(241, 245, 249, 0.88);
}

.vehicle-detail-modal.hidden {
  display: none;
}

.vehicle-detail-card {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  padding: 20px 22px;
}

.vehicle-detail-card.vehicle-detail-card-wide {
  width: min(96vw, 1400px);
  height: min(92vh, 900px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 14px 16px 12px;
}

.vehicle-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  margin-bottom: 8px;
}

.vehicle-detail-head h4 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.vehicle-detail-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.vehicle-detail-summary {
  font-size: 0.82rem;
  color: #64748b;
  margin: 4px 0 0;
  line-height: 1.45;
}

.vehicle-detail-card-wide .vehicle-view-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.vehicle-cargo-stats {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 10px;
}

.vehicle-cargo-stats.hidden {
  display: none !important;
}

.vehicle-cargo-stats-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

@media (max-width: 1100px) {
  .vehicle-cargo-stats-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .vehicle-cargo-stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.vehicle-cargo-stat-card {
  border-radius: 8px;
  padding: 10px 12px 9px;
  border: 1px solid transparent;
  min-width: 0;
}

.vehicle-cargo-stat-card .stat-label {
  display: block;
  font-size: 0.72rem;
  color: #64748b;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vehicle-cargo-stat-card .stat-value {
  display: block;
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vehicle-cargo-stat-card.tone-blue {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.vehicle-cargo-stat-card.tone-blue .stat-value {
  color: #2563eb;
}

.vehicle-cargo-stat-card.tone-teal {
  background: #f0fdfa;
  border-color: #99f6e4;
}
.vehicle-cargo-stat-card.tone-teal .stat-value {
  color: #0d9488;
}

.vehicle-cargo-stat-card.tone-green {
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.vehicle-cargo-stat-card.tone-green .stat-value {
  color: #16a34a;
}

.vehicle-cargo-stat-card.tone-purple {
  background: #faf5ff;
  border-color: #e9d5ff;
}
.vehicle-cargo-stat-card.tone-purple .stat-value {
  color: #9333ea;
}

.vehicle-cargo-stat-card.tone-orange {
  background: #fff7ed;
  border-color: #fed7aa;
}
.vehicle-cargo-stat-card.tone-orange .stat-value {
  color: #ea580c;
}

.vehicle-cargo-stat-card.tone-navy {
  background: #f8fafc;
  border-color: #e2e8f0;
}
.vehicle-cargo-stat-card.tone-navy .stat-value {
  color: #1e3a8a;
}

.vehicle-detail-card-wide #vehicle-view-filter-bar {
  flex-shrink: 0;
  margin: 0 0 8px;
  padding: 8px 10px;
  gap: 8px;
}

.vehicle-detail-card-wide .vehicle-view-table-wrap {
  flex: 1;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  border: 1px solid #d6d3d1;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

.vehicle-detail-card-wide .vehicle-view-table-wrap .table-viewport {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.vehicle-detail-card h4 {
  margin: 0 0 12px;
}

.vehicle-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 16px;
  font-size: 0.88rem;
  margin-bottom: 14px;
}

.vehicle-detail-grid .k {
  color: #64748b;
  font-size: 0.78rem;
  margin-bottom: 2px;
  display: block;
}

.vehicle-detail-grid .v {
  color: #1e293b;
  font-weight: 500;
}

.vehicle-detail-lines {
  border-top: 1px solid #e5e7eb;
  padding-top: 12px;
  font-size: 0.85rem;
  color: #475569;
  max-height: 200px;
  overflow: auto;
}

.vehicle-edit-only.hidden {
  display: none;
}

.invoice-field .v {
  display: block;
  color: #0f172a;
  font-weight: 500;
  word-break: break-word;
  line-height: 1.35;
}

.invoice-field.invoice-field-highlight .v {
  color: #dc2626;
  font-weight: 700;
}

.invoice-foot {
  margin: 0;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
  font-size: 0.68rem;
  color: #94a3b8;
  text-align: center;
  line-height: 1.5;
}

.invoice-sheet-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  font-size: 0.65rem;
  color: #64748b;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.tracking-modal {
  position: fixed;
  inset: 0;
  z-index: 10100;
  display: flex;
  flex-direction: column;
  background: #eef2f7;
  box-sizing: border-box;
}

.tracking-modal.hidden {
  display: none !important;
}

.tracking-modal-backdrop {
  display: none;
}

.tracking-floating-bar {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid #e2e8f0;
  backdrop-filter: blur(8px);
  max-width: none;
  flex-wrap: wrap;
}

.tracking-floating-hint {
  font-size: 0.8rem;
  color: #64748b;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tracking-floating-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.tracking-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-size: 0.82rem;
  color: #64748b;
}

.tracking-modal-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px 16px;
  overflow: hidden;
}

.tracking-modal-body {
  width: 100%;
  max-width: 1380px;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

.tracking-capture-sheet {
  width: 100%;
  max-width: 1320px;
}

.tracking-sheet-head {
  margin-bottom: 16px;
}

.tracking-capture-sheet .tracking-status-bar {
  margin-bottom: 16px;
}

.tracking-capture-sheet .tracking-route-panel {
  margin-top: 0;
  padding: 20px 16px 12px;
}

.tracking-capture-sheet .tracking-route-wrap {
  padding: 36px 12px 16px;
}

.tracking-capture-sheet .tracking-route-nodes {
  min-width: 0;
}

.tracking-capture-sheet .tracking-vehicle-marker {
  margin-bottom: 10px;
}

.tracking-capture-sheet .tracking-route-track {
  top: 58px;
}

.tracking-capture-sheet .tracking-node-label {
  font-size: 0.8rem;
}

.tracking-capture-sheet .tracking-node-place,
.tracking-capture-sheet .tracking-node-time,
.tracking-capture-sheet .tracking-node-maker {
  font-size: 0.66rem;
}

.tracking-node-maker {
  margin-top: 3px;
  color: #15803d;
  font-weight: 600;
  line-height: 1.25;
  word-break: break-all;
}

.tracking-route-node.lamp-off .tracking-node-maker {
  color: #94a3b8;
  font-weight: 500;
}

.tracking-route-detail-maker {
  font-size: 0.78rem;
  color: #15803d;
  font-weight: 600;
  margin-bottom: 4px;
}

.tracking-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
  background: linear-gradient(90deg, #eff6ff 0%, #f8fafc 100%);
  border: 1px solid #bfdbfe;
  border-radius: 8px;
}

.tracking-current-label {
  font-size: 0.82rem;
  color: #64748b;
  font-weight: 600;
}

.tracking-current-value {
  font-size: 1.12rem;
  font-weight: 800;
  color: #1d4ed8;
  text-align: right;
}

.tracking-sheet,
.tracking-capture-sheet {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.14);
  color: #0f172a;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  box-sizing: border-box;
}

.tracking-capture-sheet.invoice-sheet {
  border-radius: 8px;
  padding: 28px 36px 24px;
}

.tracking-head {
  text-align: center;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 2px solid #1e3a5f;
}

.tracking-head-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tracking-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.2em;
}

.tracking-subtitle {
  margin: 6px 0 0;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  color: #94a3b8;
  text-transform: uppercase;
}

.tracking-sheet-badge {
  padding: 2px 8px;
  font-size: 0.65rem;
  color: #64748b;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.tracking-brief {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 12px;
  margin-bottom: 18px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.78rem;
}

.tracking-brief-item .k {
  display: block;
  color: #64748b;
  font-size: 0.68rem;
  margin-bottom: 2px;
}

.tracking-brief-item .v {
  display: block;
  color: #0f172a;
  font-weight: 600;
  word-break: break-all;
}

.tracking-timeline-title {
  margin: 0 0 12px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
  letter-spacing: 0.12em;
}

.tracking-sheet-route-col .tracking-route-track {
  top: 48px;
}

.tracking-route-panel {
  margin-top: 4px;
  padding: 14px 10px 6px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.tracking-route-heading {
  margin: 0 0 14px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #64748b;
  text-transform: uppercase;
}

.tracking-route-wrap {
  position: relative;
  padding: 28px 8px 12px;
}

.tracking-route-track {
  position: absolute;
  left: 28px;
  right: 28px;
  top: 52px;
  height: 4px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  z-index: 0;
}

.tracking-route-progress {
  height: 100%;
  background: linear-gradient(90deg, #22c55e 0%, #4ade80 50%, #86efac 100%);
  border-radius: 999px;
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.65);
  transition: width 0.35s ease;
}

.tracking-route-nodes {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 4px;
}

.tracking-route-node {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 2px;
}

.tracking-vehicle-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 10px;
}

.tracking-vehicle {
  position: relative;
  width: 34px;
  height: 28px;
  color: #94a3b8;
}

.tracking-vehicle-icon {
  width: 100%;
  height: 100%;
  display: block;
}

.tracking-vehicle-num {
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  color: #64748b;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.tracking-route-node.lamp-on .tracking-vehicle,
.tracking-route-node.lamp-active .tracking-vehicle {
  color: #16a34a;
  filter: drop-shadow(0 0 4px rgba(34, 197, 94, 0.45));
}

.tracking-route-node.lamp-on .tracking-vehicle-num,
.tracking-route-node.lamp-active .tracking-vehicle-num {
  background: #dcfce7;
  border-color: #86efac;
  color: #15803d;
}

.tracking-route-node.lamp-active .tracking-vehicle-marker {
  animation: tracking-vehicle-pulse 1.6s ease-in-out infinite;
}

@keyframes tracking-vehicle-pulse {
  0%,
  100% {
    filter: drop-shadow(0 0 4px rgba(74, 222, 128, 0.55));
  }
  50% {
    filter: drop-shadow(0 0 12px rgba(74, 222, 128, 1));
  }
}

.tracking-node-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: #334155;
  line-height: 1.25;
  margin-bottom: 4px;
  white-space: nowrap;
}

.tracking-route-node.lamp-off .tracking-node-label {
  color: #94a3b8;
}

.tracking-route-node.lamp-active .tracking-node-label {
  color: #15803d;
}

.tracking-node-place,
.tracking-node-time {
  font-size: 0.58rem;
  color: #64748b;
  line-height: 1.3;
  word-break: break-all;
}

.tracking-route-node.lamp-off .tracking-node-place,
.tracking-route-node.lamp-off .tracking-node-time {
  opacity: 0.45;
}

.tracking-route-detail {
  margin-top: 14px;
  padding: 10px 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  text-align: center;
}

.tracking-route-detail-label {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: #64748b;
  margin-bottom: 4px;
}

.tracking-route-detail-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: #1d4ed8;
  margin-bottom: 4px;
}

.tracking-route-detail-note {
  font-size: 0.74rem;
  color: #475569;
  line-height: 1.45;
}

.tracking-invoice-panel {
  margin-top: 14px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  color: #0f172a;
}

.tracking-invoice-heading {
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
  letter-spacing: 0.1em;
}

.tracking-invoice-top {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px dashed #e2e8f0;
}

.tracking-sheet .tracking-invoice-panel .invoice-foot {
  margin-top: 10px;
}

.tracking-capture-hint {
  margin: 0 0 10px;
  text-align: center;
  font-size: 0.68rem;
  color: #64748b;
  letter-spacing: 0.06em;
}

.filter-field-status select {
  min-width: 118px;
}

body.tracking-open {
  overflow: hidden;
}

body.invoice-open {
  overflow: hidden;
}

body.supplement-edit-open {
  overflow: hidden;
}

body.delete-edit-open {
  overflow: hidden;
}

@media (max-width: 720px) {
  .invoice-fees {
    grid-template-columns: repeat(2, 1fr);
  }

  .invoice-fee-card.invoice-fee-total {
    grid-column: span 2;
  }

  .invoice-brief {
    grid-template-columns: repeat(2, 1fr);
  }

  .invoice-fields-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .tracking-brief {
    grid-template-columns: repeat(2, 1fr);
  }

  .tracking-route-nodes {
    flex-wrap: wrap;
    row-gap: 18px;
    justify-content: center;
  }

  .tracking-route-node {
    flex: 0 0 22%;
    min-width: 72px;
  }

  .tracking-route-track {
    display: none;
  }
}

@media print {
  body * {
    visibility: hidden !important;
  }

  #invoice-modal,
  #invoice-modal .invoice-sheet,
  #invoice-modal .invoice-sheet * {
    visibility: visible !important;
  }

  #tracking-modal,
  #tracking-modal .tracking-capture-sheet,
  #tracking-modal .tracking-capture-sheet * {
    visibility: visible !important;
  }

  #invoice-modal {
    position: absolute;
    inset: 0;
    display: flex !important;
    background: #fff;
  }

  #tracking-modal {
    position: absolute;
    inset: 0;
    display: flex !important;
    background: #fff;
  }

  .no-print {
    display: none !important;
  }

  .invoice-modal-stage {
    padding: 0;
    overflow: visible;
  }

  .tracking-modal-stage {
    padding: 0;
    overflow: visible;
  }

  .invoice-modal-body {
    max-height: none;
    overflow: visible;
  }

  .invoice-sheet {
    box-shadow: none;
    border: 1px solid #000;
    max-width: 100%;
    page-break-inside: avoid;
  }

  .tracking-modal-body {
    max-height: none;
    overflow: visible;
  }

  .tracking-capture-sheet {
    box-shadow: none;
    border: 1px solid #000;
    max-width: 100%;
    page-break-inside: avoid;
  }
}

.datagrid-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--app-table-head);
  font-weight: 600;
  color: var(--app-text);
}

.datagrid-table tbody tr:nth-child(even) {
  background: var(--app-table-row-alt);
}

.datagrid-table tbody td,
.datagrid-table thead th,
.datagrid-table tfoot td {
  cursor: cell;
  user-select: text;
}

.datagrid-table td.cell-selected,
.datagrid-table th.cell-selected {
  outline: 2px solid #4d6bff;
  outline-offset: -2px;
  background: #eef2ff !important;
  position: relative;
  z-index: 1;
}

.datagrid-table td.cell-merge-master {
  vertical-align: middle;
  white-space: pre-wrap;
}

.datagrid-table .empty-row td {
  text-align: center;
  color: var(--text-muted);
  padding: 24px;
  white-space: normal;
  min-width: auto;
  border: none;
}

.datagrid-table tfoot {
  position: sticky;
  bottom: 0;
  z-index: 2;
}

.datagrid-table tfoot .summary-row td {
  background: var(--app-table-foot);
  font-weight: 700;
  color: #dc2626;
  border: 1px solid var(--app-border);
  text-align: left;
  white-space: nowrap;
  min-width: 110px;
  width: 110px;
  max-width: 320px;
  padding: 6px 10px;
  vertical-align: middle;
}

html[data-theme="dark"] body.app-mode {
  background: var(--app-bg);
}

html[data-theme="dark"] .filter-bar,
html[data-theme="dark"] .panel-toolbar,
html[data-theme="dark"] .vehicle-detail-card,
html[data-theme="dark"] .tracking-floating-bar,
html[data-theme="dark"] .invoice-floating-bar,
html[data-theme="dark"] .delete-edit-search-bar,
html[data-theme="dark"] .vehicle-edit-search-bar {
  background: linear-gradient(180deg, #1e3a5f 0%, #172554 100%);
  border-color: #3b82f6;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  color: var(--app-text);
}

html[data-theme="dark"] .delete-edit-search-bar::before,
html[data-theme="dark"] .vehicle-edit-search-bar::before {
  color: #93c5fd;
}

html[data-theme="dark"] .delete-edit-search-label,
html[data-theme="dark"] .vehicle-edit-search-label {
  color: #bfdbfe;
}

html[data-theme="dark"] .delete-edit-search-input,
html[data-theme="dark"] .vehicle-edit-search-input {
  background: var(--input-bg);
  color: var(--app-text);
  border-color: #3b82f6;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

html[data-theme="dark"] .delete-edit-search-input:focus,
html[data-theme="dark"] .vehicle-edit-search-input:focus {
  border-color: #60a5fa;
  box-shadow:
    0 0 0 3px rgba(59, 130, 246, 0.35),
    inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

html[data-theme="dark"] .filter-field input,
html[data-theme="dark"] .filter-field select,
html[data-theme="dark"] .filter-date,
html[data-theme="dark"] .filter-time,
html[data-theme="dark"] .filter-region-select,
html[data-theme="dark"] .import-maker-input {
  background: var(--input-bg);
  color: var(--app-text);
  border-color: var(--border);
}

html[data-theme="dark"] .filter-highlight-ticket,
html[data-theme="dark"] .filter-highlight-code {
  background: transparent;
}

html[data-theme="dark"] .filter-highlight-ticket input,
html[data-theme="dark"] .filter-highlight-code input,
html[data-theme="dark"] .filter-bar input[id$="filter-ticket"],
html[data-theme="dark"] .filter-bar input[id$="filter-code"] {
  background: var(--input-bg);
  border-color: var(--border);
  color: var(--app-text);
}

html[data-theme="dark"] .btn-filter-reset-green {
  color: var(--app-text) !important;
  background: var(--app-surface) !important;
  border-color: var(--app-border-strong) !important;
}

html[data-theme="dark"] .btn-filter-reset-green:hover {
  color: var(--app-text) !important;
  background: var(--app-surface-muted) !important;
  border-color: var(--navy-600) !important;
}

html[data-theme="dark"] .datagrid-table td.cell-selected,
html[data-theme="dark"] .datagrid-table th.cell-selected {
  background: var(--primary-soft) !important;
  outline: 1px solid var(--primary);
}

html[data-theme="dark"] .btn-action.danger-outline {
  background: var(--app-surface-muted);
  color: #f87171;
  border-color: #7f1d1d;
}

html[data-theme="dark"] .btn-action.danger-outline:hover {
  background: #3f1515;
}

html[data-theme="dark"] .datagrid-table tbody td,
html[data-theme="dark"] .datagrid-table thead th,
html[data-theme="dark"] .datagrid-table tfoot td {
  background: var(--app-surface);
  color: var(--app-text);
  border-color: var(--app-border);
}

html[data-theme="dark"] .datagrid-table tbody tr:nth-child(even) td {
  background: var(--app-table-row-alt);
}

html[data-theme="dark"] .batch-divider-row td,
html[data-theme="dark"] .batch-header-row td {
  background: var(--app-surface-muted) !important;
  color: var(--app-text-muted);
}

html[data-theme="dark"] .btn-action.secondary {
  background: var(--app-surface-muted);
  color: var(--app-text);
  border-color: var(--border);
}

html[data-theme="dark"] .btn-action.secondary:hover {
  background: var(--app-surface-alt);
}

html[data-theme="dark"] .vehicle-detail-modal {
  background: rgba(241, 245, 249, 0.88);
}

html[data-theme="dark"] .invoice-modal,
html[data-theme="dark"] .tracking-modal {
  background: #eef2f7;
}

html[data-theme="dark"] .invoice-sheet,
html[data-theme="dark"] .tracking-capture-sheet,
html[data-theme="dark"] .tracking-route-panel,
html[data-theme="dark"] .tracking-status-bar {
  background: var(--app-surface);
  color: var(--app-text);
  border-color: var(--app-border);
}

html[data-theme="dark"] .vehicle-list-table tbody tr:hover {
  background: var(--app-surface-muted);
}

html[data-theme="dark"] .inbound-intro,
html[data-theme="dark"] .outbound-intro,
html[data-theme="dark"] .query-intro,
html[data-theme="dark"] .import-meta,
html[data-theme="dark"] .vehicle-detail-summary {
  color: var(--app-text-muted);
}

html[data-theme="dark"] .table-viewport-wrap,
html[data-theme="dark"] .vehicle-view-table-wrap {
  border-color: var(--app-border);
  background: transparent;
}

html[data-theme="dark"] .vehicle-cargo-stat-card.tone-blue {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
}
html[data-theme="dark"] .vehicle-cargo-stat-card.tone-teal {
  background: rgba(13, 148, 136, 0.12);
  border-color: rgba(45, 212, 191, 0.35);
}
html[data-theme="dark"] .vehicle-cargo-stat-card.tone-green {
  background: rgba(22, 163, 74, 0.12);
  border-color: rgba(74, 222, 128, 0.35);
}
html[data-theme="dark"] .vehicle-cargo-stat-card.tone-purple {
  background: rgba(147, 51, 234, 0.12);
  border-color: rgba(192, 132, 252, 0.35);
}
html[data-theme="dark"] .vehicle-cargo-stat-card.tone-orange {
  background: rgba(234, 88, 12, 0.12);
  border-color: rgba(251, 146, 60, 0.35);
}
html[data-theme="dark"] .vehicle-cargo-stat-card.tone-navy {
  background: rgba(30, 58, 138, 0.14);
  border-color: rgba(96, 165, 250, 0.25);
}
html[data-theme="dark"] .vehicle-cargo-stat-card .stat-label {
  color: var(--app-text-muted);
}

@media (max-width: 900px) {
  body:not(.app-mode) {
    background-attachment: scroll;
    align-items: flex-start;
  }

  .page-stage {
    width: 100%;
    max-width: 100%;
  }

  .form-panel {
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    background: rgba(255, 255, 255, 0.96);
    padding: 32px 24px 40px;
  }

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

@media (max-width: 480px) {
  .form-title {
    font-size: 1.5rem;
  }

  .system-name {
    font-size: 0.95rem;
  }
}

/* —— 新版 UI 组件精修 —— */
.filter-bar {
  background: var(--app-surface-muted);
  border: 1px solid var(--app-border);
  border-radius: var(--radius-md);
}

.query-scope-btn.active {
  background: var(--navy-700) !important;
  border-color: var(--navy-700) !important;
  color: #fff !important;
}

.edit-mode-tabs {
  background: var(--app-surface-muted);
  border: 1px solid var(--app-border);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
}

.edit-mode-tab {
  border-radius: 8px;
  font-weight: 600;
}

.edit-mode-tab.active {
  background: var(--app-surface);
  color: var(--navy-800);
  box-shadow: var(--shadow);
}

.table-viewport-wrap,
.vehicle-view-table-wrap {
  border: 1px solid var(--app-border) !important;
  border-radius: var(--radius-md) !important;
  background: transparent !important;
  box-shadow: none !important;
}

.receipt-queue-wrap {
  border: 1px solid var(--gold-soft);
  background: linear-gradient(135deg, rgba(184, 149, 74, 0.08), rgba(26, 51, 84, 0.04));
  border-radius: var(--radius-md);
}

.panel-title-row h3 {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--app-text);
}

.input-wrap input:focus,
.select-wrap select:focus,
.filter-region-select:focus,
.filter-field input:focus {
  border-color: var(--navy-600);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.invoice-modal,
.tracking-modal,
.vehicle-detail-modal {
  backdrop-filter: blur(6px);
}

.invoice-sheet,
.tracking-capture-sheet {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.analysis-hero {
  border-radius: var(--radius-lg);
}

body.app-mode .app-shell {
  display: flex;
  flex-direction: row;
}

/* —— 界面精简：仅保留按钮与有效菜单 —— */
.inbound-intro,
.outbound-intro,
.query-intro,
.vehicle-panel-intro,
.users-intro,
.import-maker-hint,
.import-meta,
.filter-region-hint,
.form-subtitle,
.main-header .breadcrumb,
.panel-title-row > h3,
.content-panel > h3:first-child,
#vehicle-modal .outbound-intro {
  display: none !important;
}

.panel-title-row {
  justify-content: flex-end;
  margin-bottom: 6px;
}

.filter-bar {
  margin-top: 0;
}

#filter-region-hint.super-admin-scope-hint {
  display: block !important;
  margin: 0 0 8px;
  font-size: 0.82rem;
  color: var(--app-text-muted);
}

.admin-act-as-wrap,
.toolbar-admin-origin {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.admin-act-as-label,
.toolbar-admin-origin .toolbar-maker-label {
  font-size: 0.82rem;
  color: var(--app-text-muted);
  white-space: nowrap;
}

.admin-act-as-select {
  min-width: 168px;
}

.wms-dialog-root {
  position: relative;
  z-index: 12000;
}

.wms-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(241, 245, 249, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 12001;
}

.wms-dialog-panel {
  width: min(440px, 100%);
  background: #ffffff;
  color: #1f2937;
  border: 1px solid #d8dee8;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
  padding: 20px 22px 18px;
}

html[data-theme="dark"] .wms-dialog-panel {
  background: #ffffff;
  color: #1f2937;
  border-color: #d8dee8;
}

.wms-dialog-title {
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
}

.wms-dialog-body {
  margin: 0 0 14px;
  font-size: 0.9rem;
  line-height: 1.55;
  white-space: pre-wrap;
  color: #374151;
}

.wms-dialog-input {
  width: 100%;
  margin: 0 0 14px;
  padding: 9px 11px;
  border: 1px solid #c5cedc;
  border-radius: 8px;
  font-size: 0.9rem;
  background: #ffffff;
  color: #111827;
}

.wms-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.wms-dialog-btn-ok.danger-outline {
  color: #b42318;
  border-color: #fecdca;
}

.nav-item {
  position: relative;
}

.nav-notify-badge {
  position: absolute;
  top: 6px;
  right: 8px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  pointer-events: none;
}

.notifications-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.notifications-empty {
  padding: 24px 16px;
  color: var(--text-muted, #64748b);
  background: var(--app-surface, #f8fafc);
  border: 1px dashed var(--app-border, #e2e8f0);
  border-radius: 8px;
}

.notification-item {
  padding: 14px 16px;
  border: 1px solid var(--app-border, #e2e8f0);
  border-radius: 10px;
  background: var(--app-surface, #fff);
}

.notification-item.is-unread {
  border-left: 3px solid var(--accent, #0d9488);
  background: rgba(13, 148, 136, 0.04);
}

.notification-item.is-resolved {
  opacity: 0.72;
}

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

.notification-title {
  font-size: 0.95rem;
}

.notification-time {
  font-size: 0.78rem;
  color: var(--text-muted, #64748b);
  white-space: nowrap;
}

.notification-body {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text-secondary, #475569);
}

.notification-actions {
  margin-top: 12px;
}

.tutorial-intro {
  margin: 0 0 14px;
  color: var(--text-secondary, #475569);
  font-size: 0.92rem;
  line-height: 1.55;
}

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

.tutorial-manual-status {
  font-size: 0.82rem;
  color: #64748b;
}

.tutorial-manual-status.is-error {
  color: #dc2626;
}

.tutorial-manual-viewer {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  overflow: hidden;
  background: #f8fafc;
  min-height: min(72vh, 820px);
}

.tutorial-manual-frame {
  display: block;
  width: 100%;
  min-height: min(72vh, 820px);
  height: min(72vh, 820px);
  border: 0;
  background: #fff;
}

.tutorial-manual-render-host {
  position: fixed;
  left: 0;
  top: 0;
  width: 794px;
  max-width: 794px;
  z-index: -1;
  opacity: 0.01;
  pointer-events: none;
  background: #fff;
  overflow: hidden;
}

.tutorial-manual-render-host.is-active {
  visibility: visible;
}

.datagrid-table th.col-resizable-leading-th {
  position: relative;
}
