/* ==========================================================================
   Apple Design System (macOS Sequoia & iOS 18 HIG)
   for Caiji Web Scheduler (清梦兑换调度中心)
   Supports Light & Dark Appearance, Liquid Glass, Inset Grouped,
   Dynamic Island Feedback, and Universal Responsive Layout
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design Tokens (Apple System Color Palette - Light Mode)
   -------------------------------------------------------------------------- */
:root {
  color-scheme: light;

  /* Apple System Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Apple System Colors */
  --apple-blue: #0071e3;
  --apple-blue-hover: #0077ed;
  --apple-blue-rgb: 0, 113, 227;
  --apple-indigo: #5856d6;
  --apple-purple: #af52de;
  --apple-pink: #ff2d55;
  --apple-red: #ff3b30;
  --apple-red-rgb: 255, 59, 48;
  --apple-orange: #ff9500;
  --apple-yellow: #ffcc00;
  --apple-green: #34c759;
  --apple-green-rgb: 52, 199, 89;
  --apple-teal: #30b0c7;
  --apple-cyan: #32ade6;

  /* Light Theme Hierarchy */
  --app-bg: #f5f5f7;
  --card-bg: #ffffff;
  --card-bg-subtle: #fbfbfd;
  --card-border: rgba(0, 0, 0, 0.08);
  --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
  --card-shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.03);

  /* Translucent Glass Surfaces */
  --glass-bg: rgba(255, 255, 255, 0.82);
  --glass-border: rgba(255, 255, 255, 0.65);
  --glass-blur: 24px;

  /* Text & Labels */
  --label-primary: #1d1d1f;
  --label-secondary: #6e6e73;
  --label-tertiary: #86868b;
  --label-quaternary: #aeaeb2;

  /* Inputs & Form Controls */
  --input-bg: rgba(0, 0, 0, 0.03);
  --input-bg-focus: #ffffff;
  --input-border: rgba(0, 0, 0, 0.12);
  --input-border-focus: var(--apple-blue);

  /* Separators */
  --separator: rgba(60, 60, 67, 0.12);
  --separator-subtle: rgba(60, 60, 67, 0.06);

  /* 补充：此前被大量引用但从未定义，导致卡片底色/描边/阴影静默失效 */
  --border-color: rgba(0, 0, 0, 0.1);
  --fill-secondary: rgba(120, 120, 128, 0.12);
  --fill-tertiary: rgba(120, 120, 128, 0.08);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
  --apple-orange-rgb: 255, 149, 0;

  /* Table */
  --table-header-bg: rgba(0, 0, 0, 0.02);
  --table-row-hover: rgba(0, 0, 0, 0.025);
  --table-row-alt: rgba(0, 0, 0, 0.012);

  /* Radii */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  /* Layout */
  --topbar-height: 56px;
  --bottom-bar-height: 56px;
  --content-max-width: 1280px;
}

/* --------------------------------------------------------------------------
   2. Dark Theme (Apple Dark Mode Standards)
   -------------------------------------------------------------------------- */
[data-theme="dark"] {
  color-scheme: dark;

  /* Apple Dark Colors */
  --apple-blue: #0a84ff;
  --apple-blue-hover: #409cff;
  --apple-blue-rgb: 10, 132, 255;
  --apple-indigo: #5e5ce6;
  --apple-purple: #bf5af2;
  --apple-pink: #ff375f;
  --apple-red: #ff453a;
  --apple-red-rgb: 255, 69, 58;
  --apple-orange: #ff9f0a;
  --apple-yellow: #ffd60a;
  --apple-green: #30d158;
  --apple-green-rgb: 48, 209, 88;
  --apple-teal: #40c8e0;
  --apple-cyan: #64d2ff;

  /* Dark Theme Hierarchy */
  --app-bg: #000000;
  --card-bg: #1c1c1e;
  --card-bg-subtle: #2c2c2e;
  --card-border: rgba(255, 255, 255, 0.12);
  --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.4), 0 1px 4px rgba(0, 0, 0, 0.2);
  --card-shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);

  /* Translucent Glass Surfaces */
  --glass-bg: rgba(28, 28, 30, 0.82);
  --glass-border: rgba(255, 255, 255, 0.12);

  /* Text & Labels */
  --label-primary: #f5f5f7;
  --label-secondary: #a1a1a6;
  --label-tertiary: #86868b;
  --label-quaternary: #636366;

  /* Inputs & Form Controls */
  --input-bg: rgba(255, 255, 255, 0.08);
  --input-bg-focus: #2c2c2e;
  --input-border: rgba(255, 255, 255, 0.15);
  --input-border-focus: var(--apple-blue);

  /* Separators */
  --separator: rgba(255, 255, 255, 0.14);
  --separator-subtle: rgba(255, 255, 255, 0.08);

  --border-color: rgba(255, 255, 255, 0.14);
  --fill-secondary: rgba(120, 120, 128, 0.24);
  --fill-tertiary: rgba(120, 120, 128, 0.16);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.55), 0 1px 3px rgba(0, 0, 0, 0.35);
  --apple-orange-rgb: 255, 159, 10;

  /* Table */
  --table-header-bg: rgba(255, 255, 255, 0.03);
  --table-row-hover: rgba(255, 255, 255, 0.05);
  --table-row-alt: rgba(255, 255, 255, 0.02);
}

/* --------------------------------------------------------------------------
   3. Global Reset & Base
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

html {
  /* 禁止 iOS 横屏 / 缩放时自动放大文字 */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-family: var(--font-sans);
  background-color: var(--app-bg);
  color: var(--label-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  /* iOS 地址栏与软键盘会改变可视视口高度，dvh 让布局跟随可视视口 */
  min-height: 100dvh;
  position: relative;
  background-color: var(--app-bg);
  color: var(--label-primary);
  overflow-x: hidden;
}

/* 全局极光浮动微渐变底纹（参考 WorkBuddy2API 控制台质感） */
body:not(.login-body)::before {
  content: "";
  position: fixed;
  inset: -30%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(38% 38% at 16% 18%, rgba(56, 189, 248, 0.22), transparent 64%),
    radial-gradient(36% 36% at 84% 15%, rgba(139, 92, 246, 0.20), transparent 64%),
    radial-gradient(42% 42% at 76% 82%, rgba(244, 63, 94, 0.14), transparent 64%),
    radial-gradient(38% 38% at 20% 80%, rgba(16, 185, 129, 0.16), transparent 64%);
  filter: blur(56px) saturate(1.3);
  animation: auroraFloat 24s ease-in-out infinite alternate;
}

[data-theme="dark"] body:not(.login-body)::before {
  background:
    radial-gradient(38% 38% at 16% 18%, rgba(14, 165, 233, 0.18), transparent 64%),
    radial-gradient(36% 36% at 84% 15%, rgba(124, 58, 237, 0.20), transparent 64%),
    radial-gradient(42% 42% at 76% 82%, rgba(225, 29, 72, 0.12), transparent 64%),
    radial-gradient(38% 38% at 20% 80%, rgba(5, 150, 105, 0.15), transparent 64%);
  filter: blur(64px) saturate(1.1);
  opacity: 0.75;
}

/* --------------------------------------------------------------------------
   4. Top Navigation Bar (macOS / iOS Navigation Header)
   -------------------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 900;
  height: var(--topbar-height);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--glass-bg);
  backdrop-filter: saturate(180%) blur(var(--glass-blur));
  -webkit-backdrop-filter: saturate(180%) blur(var(--glass-blur));
  border-bottom: 1px solid var(--card-border);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* Brand */
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.topbar-logo svg {
  width: 34px;
  height: 34px;
  display: block;
  border-radius: 9px;
  box-shadow: 0 2px 8px rgba(79, 110, 247, 0.35);
}

.topbar-title-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.topbar-heading-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-heading-row h1 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--label-primary);
  line-height: 1.2;
}

.topbar-subline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--label-tertiary);
  margin-top: 2px;
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-subline p {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-pulsing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--apple-green);
  box-shadow: 0 0 0 2px rgba(52, 199, 89, 0.25);
  flex-shrink: 0;
  animation: pulse-ring 2.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.35); }
  100% { transform: scale(0.9); opacity: 0.8; }
}

/* Center Segmented Control (Desktop) */
.ios-segmented-control {
  display: inline-flex;
  align-items: center;
  background: var(--input-bg);
  padding: 3px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--separator-subtle);
  flex-shrink: 0;
}

.segmented-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--label-secondary);
  border: none;
  background: transparent;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  user-select: none;
}

.segmented-btn .tab-icon {
  width: 14px;
  height: 14px;
  opacity: 0.75;
}

.segmented-btn:hover {
  color: var(--label-primary);
}

.segmented-btn.active {
  background: var(--card-bg);
  color: var(--label-primary);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.segmented-btn.active .tab-icon {
  color: var(--apple-blue);
  opacity: 1;
}

/* Topbar Right Actions */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--input-bg);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  color: var(--label-secondary);
  border: 1px solid var(--separator-subtle);
}

.user-avatar-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--apple-blue);
}

/* --------------------------------------------------------------------------
   5. Apple Buttons & Form Controls
   -------------------------------------------------------------------------- */
button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

.btn-ios-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  background: var(--apple-blue);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.16s ease;
  user-select: none;
  white-space: nowrap;
}

.btn-ios-primary:hover {
  background: var(--apple-blue-hover);
  box-shadow: 0 2px 8px rgba(var(--apple-blue-rgb), 0.3);
}

.btn-ios-primary:active {
  transform: scale(0.98);
}

.btn-ios-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-ios-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--label-primary);
  background: var(--input-bg);
  border: 1px solid var(--separator);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.16s ease;
  user-select: none;
  white-space: nowrap;
}

.btn-ios-secondary:hover {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.18);
}

[data-theme="dark"] .btn-ios-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-ios-secondary:active {
  transform: scale(0.98);
}

.btn-ios-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-ios-destructive {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  background: var(--apple-red);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.16s ease;
  user-select: none;
}

.btn-ios-destructive:hover {
  background: #e03228;
  box-shadow: 0 2px 8px rgba(var(--apple-red-rgb), 0.3);
}

.btn-ios-destructive:active {
  transform: scale(0.98);
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: var(--radius-xs);
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.btn-icon-text {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-icon-text svg {
  width: 14px;
  height: 14px;
}

/* Operation Buttons in Tables & Cards */
.operation-buttons {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.operation-buttons button {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  user-select: none;
  white-space: nowrap;
}

/* Run Button */
.operation-buttons button:not(.secondary):not(.danger) {
  background: rgba(var(--apple-blue-rgb), 0.1);
  color: var(--apple-blue);
  border-color: rgba(var(--apple-blue-rgb), 0.2);
}

.operation-buttons button:not(.secondary):not(.danger):hover {
  background: var(--apple-blue);
  color: #ffffff;
}

/* Secondary Button (Edit, Stop) */
.operation-buttons button.secondary {
  background: var(--input-bg);
  color: var(--label-primary);
  border-color: var(--separator);
}

.operation-buttons button.secondary:hover {
  background: rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .operation-buttons button.secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Danger Button (Delete) */
.operation-buttons button.danger {
  background: rgba(var(--apple-red-rgb), 0.1);
  color: var(--apple-red);
  border-color: rgba(var(--apple-red-rgb), 0.2);
}

.operation-buttons button.danger:hover {
  background: var(--apple-red);
  color: #ffffff;
}

.operation-buttons button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Form Item */
.ios-form-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ios-form-item .field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--label-secondary);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="hidden"]),
select,
textarea {
  height: 38px;
  padding: 0 12px;
  font-size: 13.5px;
  color: var(--label-primary);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: all 0.16s ease;
  width: 100%;
  box-sizing: border-box;
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

input:focus, select:focus, textarea:focus {
  background: var(--input-bg-focus);
  border-color: var(--apple-blue);
  box-shadow: 0 0 0 3px rgba(var(--apple-blue-rgb), 0.2);
}

/* iOS Switch Control */
.ios-switch-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.ios-switch-control input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
}

.ios-switch-slider {
  position: relative;
  width: 44px;
  height: 26px;
  background-color: var(--separator);
  border-radius: var(--radius-pill);
  transition: background-color 0.25s ease;
  flex-shrink: 0;
}

.ios-switch-slider::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 2px;
  top: 2px;
  background-color: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ios-switch-control input:checked + .ios-switch-slider {
  background-color: var(--apple-green);
}

.ios-switch-control input:checked + .ios-switch-slider::before {
  transform: translateX(18px);
}

.switch-label {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--label-primary);
}

/* --------------------------------------------------------------------------
   6. Badges & Pills
   -------------------------------------------------------------------------- */
.badge-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  background: rgba(var(--apple-blue-rgb), 0.12);
  color: var(--apple-blue);
}

.ios-pill-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  background: var(--input-bg);
  color: var(--label-secondary);
  border: 1px solid var(--separator-subtle);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 500;
}

.badge-ready {
  background: rgba(var(--apple-green-rgb), 0.12);
  color: var(--apple-green);
}

.badge-pending {
  background: rgba(255, 149, 0, 0.12);
  color: var(--apple-orange);
}

.badge-offline, .badge-default {
  background: var(--input-bg);
  color: var(--label-tertiary);
}

/* --------------------------------------------------------------------------
   7. Main Container & Inset Cards
   -------------------------------------------------------------------------- */
.ios-container {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 24px 20px 80px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* --------------------------------------------------------------------------
   5.1 KPI Metric Ribbon (macOS Dashboard Overview)
   -------------------------------------------------------------------------- */
.kpi-ribbon {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  width: 100%;
}

.kpi-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.18s ease, border-color 0.18s ease;
  user-select: none;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-lg);
  border-color: rgba(var(--apple-blue-rgb), 0.3);
}

.kpi-card:active {
  transform: scale(0.98);
}

.kpi-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex-shrink: 0;
}

.kpi-icon-wrap svg {
  width: 22px;
  height: 22px;
}

.kpi-icon-wrap.icon-blue {
  background: rgba(0, 113, 227, 0.12);
  color: var(--apple-blue);
}

.kpi-icon-wrap.icon-green {
  background: rgba(52, 199, 89, 0.12);
  color: var(--apple-green);
}

.kpi-icon-wrap.icon-purple {
  background: rgba(175, 82, 222, 0.12);
  color: var(--apple-purple);
}

.kpi-icon-wrap.icon-orange {
  background: rgba(255, 149, 0, 0.12);
  color: var(--apple-orange);
}

.kpi-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.kpi-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--label-secondary);
  letter-spacing: -0.01em;
}

.kpi-val-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.kpi-val {
  font-size: 24px;
  font-weight: 700;
  color: var(--label-primary);
  font-family: var(--font-sans);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.kpi-unit {
  font-size: 12px;
  color: var(--label-tertiary);
}

@media (max-width: 768px) {
  .kpi-ribbon {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .kpi-card {
    padding: 12px 14px;
    gap: 10px;
  }
  .kpi-icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }
  .kpi-icon-wrap svg {
    width: 18px;
    height: 18px;
  }
  .kpi-val {
    font-size: 20px;
  }
}

.band {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.ios-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  padding: 20px 24px;
  transition: all 0.2s ease;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--separator-subtle);
}

.heading-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-badge-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--apple-blue-rgb), 0.08);
  color: var(--apple-blue);
  flex-shrink: 0;
}

.section-badge-icon svg {
  width: 20px;
  height: 20px;
}

.heading-title-group h2 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--label-primary);
  line-height: 1.2;
}

.heading-desc {
  font-size: 12px;
  color: var(--label-tertiary);
  margin-top: 2px;
  display: block;
}

/* --------------------------------------------------------------------------
   8. Sub-Segmented Switchers (Jobs & Workbench)
   -------------------------------------------------------------------------- */
.jobs-sub-nav-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 4px;
}

.ios-sub-segmented {
  display: inline-flex;
  align-items: center;
  background: var(--input-bg);
  padding: 3px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--separator-subtle);
}

.sub-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--label-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  white-space: nowrap;
}

.sub-tab-btn:hover {
  color: var(--label-primary);
}

.sub-tab-btn.active {
  background: var(--card-bg);
  color: var(--apple-blue);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* --------------------------------------------------------------------------
   9. Clean Apple Tables
   -------------------------------------------------------------------------- */
.ios-table-container {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--separator-subtle);
  background: var(--card-bg);
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

thead th {
  background: var(--table-header-bg);
  color: var(--label-secondary);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--separator);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--separator-subtle);
  transition: background-color 0.12s ease;
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background-color: var(--table-row-hover);
}

tbody td {
  padding: 11px 14px;
  color: var(--label-primary);
  vertical-align: middle;
}

.code-cell {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--label-secondary);
}

.table-empty-hint {
  text-align: center;
  padding: 32px 16px !important;
  color: var(--label-tertiary);
}

/* --------------------------------------------------------------------------
   10. Accounts & Query Hub (Split Layout)
   -------------------------------------------------------------------------- */
.account-query-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  align-items: start;
}

/* Left Sidebar: 可用清梦账号 */
.accounts-panel {
  display: flex;
  flex-direction: column;
}

.accounts-panel .section-heading {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.accounts-panel .heading-title-group h2 {
  white-space: nowrap;
}

.accounts-header-actions {
  display: flex;
  gap: 6px;
  width: 100%;
}

.accounts-header-actions button {
  flex: 1;
  text-align: center;
  padding: 0 4px;
}

.accounts-filter-bar {
  margin-bottom: 12px;
}

.accounts-filter-bar input {
  height: 34px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}

.ios-inset-list {
  max-height: 520px;
  overflow-y: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--separator-subtle);
  background: var(--card-bg-subtle);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.account-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  border: 1px solid var(--separator-subtle);
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
}

.account-row:hover {
  background: var(--table-row-hover);
  border-color: rgba(var(--apple-blue-rgb), 0.3);
}

/* 已勾选行高亮，便于在长列表中确认当前选择 */
.account-row.is-selected {
  background: rgba(var(--apple-blue-rgb), 0.07);
  border-color: rgba(var(--apple-blue-rgb), 0.45);
}

.account-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--apple-blue);
  cursor: pointer;
  flex-shrink: 0;
}

.account-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.account-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--label-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-meta {
  font-size: 11.5px;
  color: var(--label-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* Right Workbench Card */
.query-workbench-card {
  min-height: 480px;
}

.workbench-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--separator-subtle);
}

.query-action-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

/* 余额 / 快递两个工具栏共用同一套布局，避免出现两种观感。 */
.query-action-toolbar .query-fields-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
}

.balance-toolbar .balance-project-item {
  width: 220px;
  min-width: 0;
}

.express-project-item {
  width: 180px;
  min-width: 0;
}

.express-days-item {
  width: 100px;
  min-width: 0;
}

/* 一键查询按钮：高度与输入控件一致，保持两栏同轴 */
.btn-query-action {
  height: 38px;
  padding: 0 20px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.section-hint {
  font-size: 12px;
  color: var(--label-tertiary);
  margin-bottom: 14px;
}

.express-results-container {
  min-height: 120px;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--separator-subtle);
  background: var(--card-bg-subtle);
  font-size: 13px;
  color: var(--label-secondary);
}

/* Balance ok / error cells */
.balance-ok {
  color: var(--apple-green);
  font-weight: 600;
  font-family: var(--font-mono);
}

.balance-error {
  color: var(--apple-red);
  font-size: 12px;
}

/* --------------------------------------------------------------------------
   11. Job Create/Edit Form (Apple iOS 18 Inset Grouped Architecture)
   -------------------------------------------------------------------------- */
.job-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.job-form-modern {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.job-form-header {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--separator-subtle);
}

.field-required {
  color: var(--apple-red);
  font-weight: 700;
  margin-left: 2px;
}

/* Inset Group Cards */
.ios-form-group {
  background: var(--card-bg-subtle);
  border: 1px solid var(--separator-subtle);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all 0.15s ease;
}

.ios-form-group:hover {
  border-color: rgba(var(--apple-blue-rgb), 0.25);
}

.ios-form-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--separator-subtle);
  flex-wrap: wrap;
}

.group-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.group-header-icon {
  font-size: 15px;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(var(--apple-blue-rgb), 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.group-header-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--label-primary);
  letter-spacing: -0.2px;
}

.group-header-desc {
  font-size: 11.5px;
  color: var(--label-tertiary);
}

.ios-form-group-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.col-span-2 {
  grid-column: span 2;
}

/* Product Search Input inside Picker */
.product-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product-search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.product-search-input-wrap .search-field-icon {
  position: absolute;
  left: 12px;
  width: 14px;
  height: 14px;
  color: var(--label-tertiary);
  pointer-events: none;
  z-index: 2;
}

.product-search-input-wrap input {
  padding-left: 34px !important;
  height: 38px;
}

/* 时间与商品选择器均为自绘控件，见第 21 节 */

/* Switch Row inside Schedule Panel */
.ios-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--card-bg);
  border: 1px solid var(--separator-subtle);
  border-radius: 12px;
  margin-top: 4px;
  flex-wrap: wrap;
  gap: 8px;
}

.switch-sub-hint {
  font-size: 11.5px;
  color: var(--label-tertiary);
}

.schedule-panel {
  background: var(--card-bg-subtle);
  border: 1px solid var(--separator-subtle);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.time-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  flex-wrap: wrap;
  gap: 6px;
}

.time-presets {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.preset-tag-hint {
  font-size: 11px;
  color: var(--label-tertiary);
}

.btn-preset-time,
.btn-preset-once {
  height: 24px;
  padding: 0 8px;
  font-size: 11px;
  font-family: var(--font-mono);
  background: var(--input-bg);
  border: 1px solid var(--separator);
  border-radius: var(--radius-sm);
  color: var(--label-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  user-select: none;
}

.btn-preset-time:hover,
.btn-preset-once:hover {
  background: var(--apple-blue);
  color: #ffffff;
  border-color: var(--apple-blue);
}

.btn-preset-time.active-preset,
.btn-preset-once.active-preset {
  background: rgba(var(--apple-blue-rgb), 0.14);
  color: var(--apple-blue);
  border-color: rgba(var(--apple-blue-rgb), 0.4);
  font-weight: 600;
}

/* Account Selection Inset Group */
.account-select-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.account-select-hint {
  font-size: 11.5px;
  color: var(--label-tertiary);
  margin-left: 4px;
}

.account-picker {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 2px;
}

/* Account Card Item (iOS Selectable Cell) */
.account-card-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--card-bg);
  border: 1px solid var(--separator-subtle);
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  position: relative;
}

.account-card-item:hover {
  border-color: rgba(var(--apple-blue-rgb), 0.35);
  background: var(--table-row-hover);
}

.account-card-item.is-selected {
  background: rgba(var(--apple-blue-rgb), 0.06);
  border-color: var(--apple-blue);
  box-shadow: 0 0 0 1px rgba(var(--apple-blue-rgb), 0.2);
}

.account-card-item input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.account-card-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0071e3, #5e5ce6);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 113, 227, 0.2);
}

.account-card-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.account-card-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.account-card-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--label-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-card-tag {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(var(--apple-blue-rgb), 0.08);
  color: var(--apple-blue);
  font-weight: 500;
  white-space: nowrap;
}

.account-card-sub {
  font-size: 11px;
  color: var(--label-tertiary);
  font-family: var(--font-mono);
}

.account-card-checkbox-custom {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1.5px solid var(--separator);
  background: var(--input-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.18s ease;
}

.account-card-checkbox-custom .check-icon {
  width: 13px;
  height: 13px;
  color: #ffffff;
  opacity: 0;
  transform: scale(0.6);
  transition: all 0.18s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.account-card-item.is-selected .account-card-checkbox-custom {
  background: var(--apple-blue);
  border-color: var(--apple-blue);
}

.account-card-item.is-selected .account-card-checkbox-custom .check-icon {
  opacity: 1;
  transform: scale(1);
}

/* Modern Job Form Footer Buttons */
.btn-direct-exchange-cta {
  height: 44px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(135deg, rgba(255, 149, 0, 0.14), rgba(255, 180, 70, 0.14));
  color: #ff9500;
  border: 1px solid rgba(255, 149, 0, 0.35);
  width: 100%;
}

.btn-direct-exchange-cta:hover {
  background: linear-gradient(135deg, rgba(255, 149, 0, 0.22), rgba(255, 180, 70, 0.22));
  border-color: rgba(255, 149, 0, 0.5);
}

.btn-direct-exchange-cta:active {
  transform: scale(0.98);
}

.btn-reset-cta {
  height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-save-cta {
  height: 44px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(135deg, #0071e3, #0077ed);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 14px rgba(0, 113, 227, 0.3);
}

.btn-save-cta:hover {
  box-shadow: 0 6px 18px rgba(0, 113, 227, 0.42);
}

.btn-save-cta:active {
  transform: scale(0.98);
}

/* --------------------------------------------------------------------------
   12. Product Management Hub (Apple HIG Modern Design)
   -------------------------------------------------------------------------- */
.product-management-hub {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

/* 桌面端：按钮与「抓取账号」下拉框本身对齐。
   该字段是「标签 + 下拉」的纵向组合（约 50px），若按容器居中，
   按钮会比下拉框高出约 7px；改为底对齐即可与下拉框同高同轴。 */
@media (min-width: 821px) {
  .product-header-actions {
    align-items: flex-end;
  }
}

/* 抓取账号选择器：与右侧按钮同排，宽度适中不挤压按钮 */
.capture-account-field {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  margin: 0;
  min-width: 190px;
}

.capture-account-field .field-label {
  font-size: 11px;
  color: var(--label-tertiary);
  line-height: 1;
}

.capture-account-field select {
  height: 36px;
  font-size: 12.5px;
  padding: 0 28px 0 10px;
  max-width: 260px;
  text-overflow: ellipsis;
}

/* Status Banner & Metrics Strip */
.ios-status-banner {
  background: rgba(var(--apple-blue-rgb), 0.05);
  border: 1px solid rgba(var(--apple-blue-rgb), 0.14);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 13px;
  color: var(--apple-blue);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.prod-status-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.prod-kpi-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  background: var(--fill-tertiary);
  color: var(--label-primary);
  border: 1px solid var(--border-color);
}

.prod-kpi-chip strong {
  font-weight: 700;
  color: var(--label-primary);
}

.prod-kpi-chip.kpi-stock strong {
  color: #34c759;
}

.prod-kpi-chip.kpi-ready strong {
  color: var(--apple-blue);
}

.prod-kpi-chip.kpi-pending strong {
  color: #ff9500;
}

.prod-sync-meta {
  font-size: 12px;
  color: var(--label-tertiary);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Apple Segmented Channel Navigation */
.product-channel-nav-wrap {
  width: 100%;
  overflow: hidden;
}

.product-channel-segmented {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--fill-tertiary);
  border-radius: var(--radius-md);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.product-channel-segmented::-webkit-scrollbar {
  display: none;
}

.prod-seg-btn {
  border: none;
  background: transparent;
  color: var(--label-secondary);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.prod-seg-btn:hover {
  color: var(--label-primary);
  background: rgba(255, 255, 255, 0.4);
}

[data-theme="dark"] .prod-seg-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.prod-seg-btn.active {
  background: var(--card-bg);
  color: var(--label-primary);
  font-weight: 600;
  box-shadow: 0 1.5px 5px rgba(0, 0, 0, 0.08), 0 0.5px 1.5px rgba(0, 0, 0, 0.04);
}

.seg-badge {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.06);
  color: var(--label-tertiary);
  font-weight: 600;
  transition: all 0.2s ease;
}

[data-theme="dark"] .seg-badge {
  background: rgba(255, 255, 255, 0.1);
}

.prod-seg-btn.active .seg-badge {
  background: rgba(var(--apple-blue-rgb), 0.14);
  color: var(--apple-blue);
}

/* Modern Product Toolbar (Search & Status Filter Chips) */
.product-toolbar-modern {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.product-search-box {
  position: relative;
  flex: 1;
  min-width: 260px;
  max-width: 380px;
}

.product-search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--label-tertiary);
  pointer-events: none;
}

.product-search-box input {
  padding-left: 36px !important;
  padding-right: 32px !important;
  height: 38px;
  border-radius: 10px;
  font-size: 13.5px;
  width: 100%;
  box-sizing: border-box;
}

.product-search-box .search-clear-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: var(--fill-tertiary);
  color: var(--label-secondary);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.product-search-box .search-clear-btn:hover {
  background: var(--fill-secondary);
  color: var(--label-primary);
}

.product-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.chip-item {
  border: 1px solid var(--border-color);
  background: var(--fill-tertiary);
  color: var(--label-secondary);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.chip-item:hover {
  border-color: var(--apple-blue);
  color: var(--label-primary);
}

.chip-item.active {
  background: var(--apple-blue);
  border-color: var(--apple-blue);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(var(--apple-blue-rgb), 0.28);
}

/* Apple Product Desktop Table */
.apple-product-table {
  width: 100%;
  border-collapse: collapse;
}

.apple-product-table th {
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--label-tertiary);
  border-bottom: 1px solid var(--border-color);
  background: var(--table-header-bg);
  white-space: nowrap;
}

.apple-product-table td {
  padding: 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.apple-product-table tr:last-child td {
  border-bottom: none;
}

.apple-product-table tr:hover td {
  background: var(--table-row-hover);
}

/* Channel Badge Pill */
.prod-channel-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  margin-right: 6px;
}

.channel-bgxq { background: rgba(0, 122, 255, 0.12); color: #007aff; }
.channel-dtxb { background: rgba(88, 86, 214, 0.12); color: #5856d6; }
.channel-ttlhb { background: rgba(255, 45, 85, 0.12); color: #ff2d55; }
.channel-gy { background: rgba(52, 199, 89, 0.12); color: #34c759; }
.channel-gj { background: rgba(255, 149, 0, 0.12); color: #ff9500; }

.prod-title-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.prod-title-text {
  font-weight: 600;
  color: var(--label-primary);
  font-size: 13.5px;
  line-height: 1.4;
}

.prod-spec-text {
  font-size: 11.5px;
  color: var(--label-tertiary);
}

.prod-price-badge {
  font-weight: 700;
  color: var(--apple-blue);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Param Copyable Chips */
.param-group {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.param-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--fill-tertiary);
  border: 1px solid var(--border-color);
  color: var(--label-primary);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  position: relative;
}

.param-pill:hover {
  background: rgba(var(--apple-blue-rgb), 0.12);
  border-color: var(--apple-blue);
  color: var(--apple-blue);
  transform: translateY(-1px);
}

.param-label {
  color: var(--label-tertiary);
  font-size: 10px;
  font-weight: 600;
}

.param-val {
  font-weight: 500;
}

.param-copy-icon {
  width: 11px;
  height: 11px;
  opacity: 0.5;
  transition: opacity 0.15s ease;
}

.param-pill:hover .param-copy-icon {
  opacity: 1;
}

/* Stock & Ready Status Indicators */
.stock-pill-in {
  color: #34c759;
  font-weight: 600;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.stock-pill-out {
  color: var(--label-tertiary);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ready-pill-full {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--apple-blue);
}

.ready-pill-pending {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11.5px;
  font-weight: 500;
  color: #ff9500;
}

/* Action Buttons in Rows */
.prod-actions-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
}

.btn-quick-job {
  background: rgba(var(--apple-blue-rgb), 0.1);
  color: var(--apple-blue);
  border: 1px solid rgba(var(--apple-blue-rgb), 0.2);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-quick-job:hover {
  background: var(--apple-blue);
  color: #fff;
  border-color: var(--apple-blue);
  box-shadow: 0 2px 6px rgba(var(--apple-blue-rgb), 0.28);
  transform: translateY(-1px);
}

.btn-icon-ghost {
  border: 1px solid transparent;
  background: transparent;
  color: var(--label-secondary);
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-icon-ghost:hover {
  background: var(--fill-tertiary);
  color: var(--label-primary);
  border-color: var(--border-color);
}

.btn-icon-delete:hover {
  background: rgba(255, 59, 48, 0.1);
  color: #ff3b30;
  border-color: rgba(255, 59, 48, 0.2);
}

/* Mobile Product Cards View */
.products-cards-mobile {
  display: none;
}

.product-card-item {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}

.product-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.product-card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.product-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--label-primary);
  margin: 0;
  line-height: 1.35;
}

.product-card-spec {
  font-size: 12px;
  color: var(--label-tertiary);
  margin-top: 2px;
}

.product-card-params {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 0;
}

.product-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

.product-card-footer .left-status {
  flex: 1;
  min-width: 0;
}

.product-card-footer .right-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Apple Modal Sheet Overlay */
.apple-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modalBackdropFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.apple-modal-sheet {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22), 0 8px 24px rgba(0, 0, 0, 0.12);
  animation: modalSheetSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-sizing: border-box;
}

@keyframes modalBackdropFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalSheetSlideUp {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.apple-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.apple-modal-title-group h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--label-primary);
  margin: 0;
}

.apple-modal-subtitle {
  font-size: 12.5px;
  color: var(--label-tertiary);
  margin-top: 3px;
  display: block;
}

.apple-modal-close {
  border: none;
  background: var(--fill-tertiary);
  color: var(--label-secondary);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.apple-modal-close:hover {
  background: var(--fill-secondary);
  color: var(--label-primary);
  transform: scale(1.08);
}

.apple-modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.apple-modal-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.apple-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

/* --------------------------------------------------------------------------
   13. System Settings & Apple Inset Grouped Configuration
   -------------------------------------------------------------------------- */
.config-section-band {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-form-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-main-header {
  padding: 16px 20px;
}

.badge-icon-settings {
  background: rgba(var(--apple-blue-rgb), 0.12);
  color: var(--apple-blue);
}

.btn-save-config {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-weight: 600;
  white-space: nowrap;
}

.btn-save-config svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* Settings Group Cards (Apple Inset Style) */
.settings-group-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--separator-subtle);
}

.settings-group-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.settings-group-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  user-select: none;
}

.badge-ql { background: rgba(88, 86, 214, 0.12); color: #5856d6; }
.badge-api { background: rgba(0, 122, 255, 0.12); color: #007aff; }
.badge-strategy { background: rgba(255, 149, 0, 0.12); color: #ff9500; }
.badge-push { background: rgba(52, 199, 89, 0.12); color: #34c759; }
.badge-capture { background: rgba(175, 82, 222, 0.12); color: #af52de; }
.badge-users { background: rgba(0, 122, 255, 0.12); color: #007aff; }
.badge-grant { background: rgba(255, 45, 85, 0.12); color: #ff2d55; }
.badge-update { background: rgba(52, 199, 89, 0.14); color: #34c759; }

/* 顶部版本号徽标 */
.app-version-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  color: var(--label-tertiary);
  background: rgba(var(--apple-blue-rgb), 0.08);
  border: 1px solid var(--card-border);
  cursor: default;
}

/* 在线更新卡片 */
.update-hint {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--label-tertiary);
}

.update-hint p { margin: 0; }

.update-hint code {
  font-size: 11px;
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  background: var(--card-bg-subtle);
  border: 1px solid var(--card-border);
}

.update-drop {
  position: relative;
  border: 1.5px dashed var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px;
  background: var(--card-bg-subtle);
  transition: border-color 0.16s ease, background 0.16s ease;
}

.update-drop.is-dragging {
  border-color: var(--apple-blue);
  background: rgba(var(--apple-blue-rgb), 0.06);
}

.update-drop input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.update-drop-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: center;
  pointer-events: none;
}

.update-drop-text strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--label-primary);
}

.update-drop-text span {
  font-size: 11.5px;
  color: var(--label-tertiary);
}

.update-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.update-status-text {
  font-size: 11.5px;
  color: var(--label-tertiary);
}

.btn-ios-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.settings-group-title-wrap h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--label-primary);
  margin: 0;
  line-height: 1.3;
}

.settings-group-subtitle {
  font-size: 12px;
  color: var(--label-tertiary);
  margin-top: 2px;
  display: block;
}

.settings-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 4px;
}

/* 抓取时间行的开关卡片：与左侧单元格整列等高，
   使左右两列的顶部（标签行）与底部（提示行）完全齐平。 */
.settings-grid-2 > .settings-switch-row {
  align-self: stretch;
}

.settings-field-hint {
  font-size: 11.5px;
  color: var(--label-tertiary);
  margin-top: 3px;
  line-height: 1.4;
}

/* Inset Switch Row */
.settings-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  background: var(--card-bg-subtle);
  border: 1px solid var(--separator-subtle);
  border-radius: var(--radius-sm);
}

.switch-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.switch-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--label-primary);
}

.switch-sub {
  font-size: 12px;
  color: var(--label-tertiary);
}

/* Bottom Action Bar */
.settings-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 20px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}

/* 桌面端：保存条吸底，滚动到任何分组都能直接保存，
   解决“按钮在页首/页尾、中间改动无处提交”的问题。 */
@media (min-width: 821px) {
  .settings-bottom-bar {
    position: sticky;
    bottom: 16px;
    z-index: 30;
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow-lg);
    margin-top: 4px;
  }
}

/* 有未保存改动时，保存按钮与提示条高亮提醒 */
#config-form .btn-save-config.is-dirty {
  box-shadow: 0 0 0 3px rgba(var(--apple-orange-rgb), 0.25);
  animation: dirty-pulse 1.8s ease-in-out infinite;
}

@keyframes dirty-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(var(--apple-orange-rgb), 0.18); }
  50% { box-shadow: 0 0 0 6px rgba(var(--apple-orange-rgb), 0.30); }
}

@media (prefers-reduced-motion: reduce) {
  #config-form .btn-save-config.is-dirty {
    animation: none;
  }
}

/* 分组范围说明的两种形态：纯保存 / 含即时操作 */
.settings-scope-hint.scope-hint-mixed {
  background: rgba(var(--apple-orange-rgb), 0.10);
  color: var(--apple-orange);
}

.settings-scope-hint b {
  font-weight: 700;
}

.bottom-bar-hint {
  font-size: 12.5px;
  color: var(--label-secondary);
}

/* Qinglong Multi-Instance Cluster */
.ql-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
}

.ql-instance-card {
  background: var(--card-bg-subtle);
  border: 1px solid var(--separator-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.15s ease;
}

.ql-instance-card:hover {
  border-color: rgba(var(--apple-blue-rgb), 0.3);
  box-shadow: var(--shadow-sm);
}

.ql-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--separator-subtle);
}

.ql-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--label-primary);
}

.ql-badge-icon {
  font-size: 16px;
}

.ql-url-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--input-bg);
  color: var(--apple-blue);
  border: 1px solid var(--border-color);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ql-card-header .ql-remove {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--apple-red);
  background: rgba(255, 59, 48, 0.08);
  border: 1px solid rgba(255, 59, 48, 0.18);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s ease;
}

.ql-card-header .ql-remove:hover:not(:disabled) {
  background: var(--apple-red);
  color: #fff;
  border-color: var(--apple-red);
}

.ql-card-header .ql-remove:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-remove-text {
  font-size: 12px;
}

.ql-fields-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

/* User Management Form & Table */
.user-form-apple {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: flex-end;
  margin-top: 10px;
  margin-bottom: 16px;
}

.btn-create-user {
  height: 38px;
  white-space: nowrap;
  padding: 0 16px;
}

.user-table-wrap {
  margin-top: 6px;
}

/* --------------------------------------------------------------------------
   Express Logistics Cards & Compact SVG Constrains
   -------------------------------------------------------------------------- */
.express-results-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 12px;
}

.express-block {
  background: var(--card-bg-subtle);
  border: 1px solid var(--separator-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.express-account-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--separator-subtle);
}

.express-account-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--label-primary);
  flex-wrap: wrap;
}

.account-avatar-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--apple-green);
  flex-shrink: 0;
}

.express-remark-pill {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  color: var(--label-secondary);
}

.express-project-tag {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(var(--apple-blue-rgb), 0.1);
  color: var(--apple-blue);
  font-weight: 600;
}

.express-account-header .ios-pill-count {
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--fill-tertiary);
  color: var(--label-secondary);
  font-weight: 500;
  align-self: flex-start;
}

.express-order-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.express-order-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

.express-order-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--separator-subtle);
}

.express-item-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.express-pkg-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.express-item-name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--label-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.express-status-wrap {
  flex-shrink: 0;
}

.express-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px 14px;
}

.express-grid-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.express-grid-cell.full-width {
  grid-column: 1 / -1;
}

.express-grid-cell .cell-label {
  font-size: 11.5px;
  color: var(--label-tertiary);
  font-weight: 500;
}

.express-grid-cell .cell-value {
  font-size: 13px;
  color: var(--label-primary);
  word-break: break-all;
}

.express-grid-cell .cell-code {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-family: var(--font-mono);
}

/* Copy tracking button strictly constrained */
.btn-copy-mailno {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 6px;
  background: rgba(var(--apple-blue-rgb), 0.1);
  color: var(--apple-blue);
  border: 1px solid rgba(var(--apple-blue-rgb), 0.2);
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.2;
  margin-left: 4px;
  flex-shrink: 0;
  height: 22px;
}

.btn-copy-mailno:hover {
  background: var(--apple-blue);
  color: #ffffff;
  border-color: var(--apple-blue);
}

.btn-copy-mailno svg,
.copy-icon-svg {
  width: 13px !important;
  height: 13px !important;
  min-width: 13px !important;
  min-height: 13px !important;
  max-width: 13px !important;
  max-height: 13px !important;
  flex-shrink: 0 !important;
  display: inline-block !important;
}

/* Latest Timeline Milestone */
.express-latest-timeline {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(var(--apple-green-rgb), 0.06);
  border: 1px solid rgba(var(--apple-green-rgb), 0.2);
  border-radius: var(--radius-sm);
}

.timeline-dot-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 4px;
  flex-shrink: 0;
}

.timeline-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--apple-green);
  box-shadow: 0 0 0 3px rgba(var(--apple-green-rgb), 0.25);
  animation: pulse-ring 2s infinite;
}

.timeline-event-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.timeline-time {
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--label-tertiary);
}

.timeline-text {
  font-size: 13px;
  color: var(--label-primary);
  line-height: 1.45;
}

.timeline-text.highlight {
  font-weight: 500;
  color: var(--label-primary);
}

.express-no-events {
  font-size: 12.5px;
  padding: 8px 12px;
  background: var(--fill-tertiary);
  border-radius: var(--radius-xs);
}

/* History Events Collapsible Details */
.express-history-collapse {
  margin-top: 4px;
}

.express-history-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--card-bg-subtle);
  border: 1px solid var(--separator-subtle);
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--apple-blue);
  user-select: none;
  list-style: none;
  transition: background 0.15s ease;
}

.express-history-summary::-webkit-details-marker {
  display: none;
}

.express-history-summary:hover {
  background: var(--fill-tertiary);
}

.chevron-mini {
  width: 14px !important;
  height: 14px !important;
  min-width: 14px !important;
  min-height: 14px !important;
  max-width: 14px !important;
  max-height: 14px !important;
  flex-shrink: 0 !important;
  display: inline-block !important;
  color: var(--label-tertiary);
  transition: transform 0.2s ease;
}

details[open] .chevron-mini {
  transform: rotate(180deg);
}

.express-history-list {
  display: flex;
  flex-direction: column;
  position: relative;
  margin-top: 10px;
  padding-left: 18px;
}

.express-history-list::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border-color);
  border-radius: 1px;
}

.express-history-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  padding-bottom: 12px;
}

.express-history-item:last-child {
  padding-bottom: 0;
}

.history-dot {
  position: absolute;
  left: -16px;
  top: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--label-tertiary);
  border: 2px solid var(--card-bg);
  box-sizing: content-box;
}

.history-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.history-time {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--label-tertiary);
}

.history-msg {
  font-size: 12.5px;
  color: var(--label-secondary);
  line-height: 1.4;
}

.express-notice-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(var(--apple-red-rgb), 0.08);
  border: 1px solid rgba(var(--apple-red-rgb), 0.2);
  border-radius: var(--radius-md);
}

.notice-icon {
  font-size: 18px;
}

.notice-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--label-primary);
}

.notice-desc {
  font-size: 12px;
  color: var(--apple-red);
  margin-top: 2px;
}

.express-empty-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  color: var(--label-tertiary);
  font-size: 13px;
  background: var(--fill-tertiary);
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   Express Status Filters, Apple Pill Switcher & KPI Strip
   -------------------------------------------------------------------------- */
.express-filter-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-top: 14px;
  margin-bottom: 6px;
  box-shadow: var(--shadow-sm);
}

/* KPI Summary Cards Grid */
.express-kpi-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

.express-kpi-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--card-bg-subtle);
  border: 1px solid var(--separator-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.express-kpi-card:hover {
  transform: translateY(-1px);
  background: var(--fill-tertiary);
  border-color: var(--border-color);
}

.express-kpi-card.active {
  background: rgba(var(--apple-blue-rgb), 0.08);
  border-color: var(--apple-blue);
  box-shadow: 0 0 0 1px var(--apple-blue);
}

.express-kpi-card .kpi-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.express-kpi-card .kpi-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.express-kpi-card .kpi-title {
  font-size: 11px;
  color: var(--label-secondary);
  white-space: nowrap;
  font-weight: 500;
}

.express-kpi-card .kpi-value {
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--label-primary);
  line-height: 1.2;
}

.express-kpi-card.kpi-exception.is-alert {
  background: rgba(var(--apple-red-rgb), 0.08);
  border-color: rgba(var(--apple-red-rgb), 0.35);
}

.express-kpi-card.kpi-exception.is-alert .kpi-value,
.express-kpi-card.kpi-exception.is-alert .kpi-title {
  color: var(--apple-red);
}

.express-kpi-card.kpi-exception.active {
  background: rgba(var(--apple-red-rgb), 0.12);
  border-color: var(--apple-red);
  box-shadow: 0 0 0 1px var(--apple-red);
}

.express-kpi-card.kpi-pickup.is-alert {
  background: rgba(var(--apple-orange-rgb), 0.08);
  border-color: rgba(var(--apple-orange-rgb), 0.35);
}

.express-kpi-card.kpi-pickup.is-alert .kpi-value,
.express-kpi-card.kpi-pickup.is-alert .kpi-title {
  color: var(--apple-orange);
}

.express-kpi-card.kpi-pickup.active {
  background: rgba(var(--apple-orange-rgb), 0.12);
  border-color: var(--apple-orange);
  box-shadow: 0 0 0 1px var(--apple-orange);
}

/* Status Filter Pill Bar */
.express-filter-row {
  display: flex;
  align-items: center;
  width: 100%;
  overflow: hidden;
}

.express-status-pills {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  background: var(--fill-tertiary);
  border-radius: 999px;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.express-status-pills::-webkit-scrollbar {
  display: none;
}

.express-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--label-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  user-select: none;
}

.express-filter-pill:hover {
  color: var(--label-primary);
  background: rgba(255, 255, 255, 0.4);
}

[data-theme="dark"] .express-filter-pill:hover {
  background: rgba(255, 255, 255, 0.08);
}

.express-filter-pill.active {
  background: var(--card-bg);
  color: var(--apple-blue);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  font-weight: 600;
}

.express-filter-pill .pill-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.06);
  color: var(--label-secondary);
}

[data-theme="dark"] .express-filter-pill .pill-count {
  background: rgba(255, 255, 255, 0.1);
}

.express-filter-pill.active .pill-count {
  background: rgba(var(--apple-blue-rgb), 0.15);
  color: var(--apple-blue);
}

.express-filter-pill.pill-exception.active {
  color: var(--apple-red);
}

.express-filter-pill.pill-exception.active .pill-count {
  background: rgba(var(--apple-red-rgb), 0.15);
  color: var(--apple-red);
}

.express-filter-pill.pill-pickup.active {
  color: var(--apple-orange);
}

.express-filter-pill.pill-pickup.active .pill-count {
  background: rgba(var(--apple-orange-rgb), 0.15);
  color: var(--apple-orange);
}

/* Express Keyword Search Row */
.express-search-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.express-search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 220px;
}

.express-search-input-wrap .search-icon-mini {
  position: absolute;
  left: 12px;
  width: 14px;
  height: 14px;
  color: var(--label-tertiary);
  pointer-events: none;
}

.express-search-input-wrap input {
  width: 100%;
  padding: 7px 32px 7px 34px;
  font-size: 13px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--input-bg);
  color: var(--label-primary);
  outline: none;
  transition: all 0.15s ease;
}

.express-search-input-wrap input:focus {
  border-color: var(--apple-blue);
  box-shadow: 0 0 0 3px rgba(var(--apple-blue-rgb), 0.15);
}

.btn-clear-search {
  position: absolute;
  right: 10px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: var(--label-tertiary);
  color: var(--card-bg);
  font-size: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.15s;
}

.btn-clear-search:hover {
  opacity: 0.8;
}

.express-filter-status-info {
  font-size: 12.5px;
  color: var(--label-secondary);
  white-space: nowrap;
}

.express-filter-status-info strong {
  color: var(--apple-blue);
}

/* Badges for Parcel Categories */
.badge-exception {
  background: rgba(var(--apple-red-rgb), 0.12);
  color: var(--apple-red);
  border: 1px solid rgba(var(--apple-red-rgb), 0.28);
}

.badge-pickup {
  background: rgba(var(--apple-orange-rgb), 0.12);
  color: var(--apple-orange);
  border: 1px solid rgba(var(--apple-orange-rgb), 0.28);
}

.badge-unshipped {
  background: rgba(142, 68, 173, 0.12);
  color: #8e44ad;
  border: 1px solid rgba(142, 68, 173, 0.28);
}

[data-theme="dark"] .badge-unshipped {
  background: rgba(175, 82, 222, 0.18);
  color: #c084fc;
  border: 1px solid rgba(175, 82, 222, 0.35);
}

.badge-transit {
  background: rgba(var(--apple-blue-rgb), 0.12);
  color: var(--apple-blue);
  border: 1px solid rgba(var(--apple-blue-rgb), 0.28);
}

.badge-signed {
  background: rgba(var(--apple-green-rgb), 0.12);
  color: var(--apple-green);
  border: 1px solid rgba(var(--apple-green-rgb), 0.28);
}

/* Card Callout Strips */
.express-alert-strip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(var(--apple-red-rgb), 0.08);
  border: 1px solid rgba(var(--apple-red-rgb), 0.25);
  border-radius: var(--radius-sm);
  color: var(--label-primary);
}

.express-alert-strip .alert-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.express-alert-strip .alert-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--apple-red);
}

.express-alert-strip .alert-desc {
  font-size: 12.5px;
  color: var(--label-primary);
  margin-top: 2px;
  line-height: 1.4;
}

.express-pickup-strip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(var(--apple-orange-rgb), 0.08);
  border: 1px solid rgba(var(--apple-orange-rgb), 0.25);
  border-radius: var(--radius-sm);
  color: var(--label-primary);
}

.express-pickup-strip .pickup-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.express-pickup-strip .pickup-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--apple-orange);
}

.express-pickup-strip .pickup-desc {
  font-size: 12.5px;
  color: var(--label-primary);
  margin-top: 2px;
  line-height: 1.4;
}

/* Card Highlight Borders */
.is-exception-card {
  border-left: 4px solid var(--apple-red) !important;
  background: linear-gradient(to right, rgba(var(--apple-red-rgb), 0.03), var(--card-bg) 18%) !important;
}

.is-pickup-card {
  border-left: 4px solid var(--apple-orange) !important;
  background: linear-gradient(to right, rgba(var(--apple-orange-rgb), 0.03), var(--card-bg) 18%) !important;
}

.timeline-pulse-dot.is-exception-dot {
  background: var(--apple-red);
  box-shadow: 0 0 0 3px rgba(var(--apple-red-rgb), 0.25);
}

/* Empty Filter Result */
.express-filter-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  background: var(--card-bg-subtle);
  border: 1px dashed var(--separator-subtle);
  border-radius: var(--radius-md);
  gap: 8px;
}

.express-filter-empty .empty-icon {
  font-size: 36px;
  line-height: 1;
  margin-bottom: 4px;
}

.express-filter-empty .empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--label-primary);
}

.express-filter-empty .empty-desc {
  font-size: 13px;
  color: var(--label-tertiary);
  max-width: 360px;
  margin-bottom: 6px;
}

/* Express View Mode Switcher (按账号 / 按收货地址汇总 / 按商品分类汇总) */
.express-view-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  margin-bottom: 2px;
  flex-wrap: wrap;
  gap: 8px;
}

.express-view-mode-tabs {
  display: inline-flex;
  align-items: center;
  background: var(--fill-tertiary);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 4px;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.express-view-extra-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-smart-merge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--label-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.16s ease;
  user-select: none;
}

.btn-smart-merge:hover {
  background: var(--fill-tertiary);
  color: var(--label-primary);
  border-color: rgba(var(--apple-blue-rgb), 0.3);
}

.btn-smart-merge.active {
  background: rgba(var(--apple-blue-rgb), 0.08);
  color: var(--apple-blue);
  border-color: rgba(var(--apple-blue-rgb), 0.35);
  font-weight: 600;
}

.btn-smart-merge .merge-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--label-tertiary);
  transition: background 0.16s ease;
}

.btn-smart-merge.active .merge-status-dot {
  background: #34c759;
  box-shadow: 0 0 5px rgba(52, 199, 89, 0.6);
}

.btn-toggle-variants {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(var(--apple-blue-rgb), 0.28);
  background: rgba(var(--apple-blue-rgb), 0.08);
  color: var(--apple-blue);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-toggle-variants:hover {
  background: rgba(var(--apple-blue-rgb), 0.18);
}

.btn-toggle-variants.active {
  background: var(--apple-blue);
  color: #fff;
}

.address-variants-drawer {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 8px;
  padding: 9px 12px;
  background: var(--card-bg-subtle);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 12px;
  width: 100%;
}

.variants-drawer-title {
  color: var(--label-secondary);
  font-weight: 600;
  font-size: 11.5px;
  margin-bottom: 2px;
}

.variant-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--label-secondary);
  padding: 3px 0;
  border-bottom: 1px dotted var(--separator-subtle);
  flex-wrap: wrap;
}

.variant-item:last-child {
  border-bottom: none;
}

.variant-raw-addr {
  flex: 1;
  word-break: break-all;
  color: var(--label-primary);
  font-size: 12px;
}

.variant-rec {
  color: var(--label-secondary);
  font-size: 11.5px;
  white-space: nowrap;
}

.variant-count {
  font-weight: 600;
  color: var(--apple-blue);
  white-space: nowrap;
  font-size: 11.5px;
}


.express-view-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--label-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.16s ease;
  user-select: none;
}

.express-view-mode-btn:hover {
  color: var(--label-primary);
  background: rgba(255, 255, 255, 0.4);
}

[data-theme="dark"] .express-view-mode-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.express-view-mode-btn.active {
  background: var(--card-bg);
  color: var(--apple-blue);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  font-weight: 600;
}

.view-mode-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.06);
  color: var(--label-secondary);
}

[data-theme="dark"] .view-mode-count-badge {
  background: rgba(255, 255, 255, 0.12);
}

.express-view-mode-btn.active .view-mode-count-badge {
  background: rgba(var(--apple-blue-rgb), 0.15);
  color: var(--apple-blue);
}

/* Express Group Cards (Address Aggregation & Product Aggregation) */
.express-group-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.express-group-card:hover {
  border-color: rgba(var(--apple-blue-rgb), 0.35);
  box-shadow: var(--shadow-md);
}

.express-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--card-bg-subtle);
  border-bottom: 1px solid var(--separator-subtle);
  flex-wrap: wrap;
  gap: 12px;
}

.express-group-title-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 240px;
}

.express-group-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--label-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  word-break: break-word;
  line-height: 1.4;
}

.express-group-title .group-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.express-group-subtitle {
  font-size: 12.5px;
  color: var(--label-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.recipient-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.04);
  color: var(--label-primary);
  font-size: 12px;
  border: 1px solid var(--border-color);
}

[data-theme="dark"] .recipient-pill {
  background: rgba(255, 255, 255, 0.06);
}

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

.btn-group-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--label-primary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-group-action:hover {
  background: var(--fill-tertiary);
  border-color: var(--apple-blue);
  color: var(--apple-blue);
}

.express-group-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.express-group-kpis {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.group-kpi-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.express-matrix-section {
  background: var(--card-bg-subtle);
  border: 1px solid var(--separator-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.express-matrix-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--label-secondary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.express-matrix-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.express-matrix-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  gap: 12px;
  flex-wrap: wrap;
  transition: border-color 0.15s ease;
}

.express-matrix-item:hover {
  border-color: rgba(var(--apple-blue-rgb), 0.35);
}

.matrix-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--label-primary);
  min-width: 220px;
  flex: 1;
}

.matrix-pkg-icon {
  font-size: 15px;
  flex-shrink: 0;
}

.matrix-addr-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.matrix-addr-recipients {
  font-size: 11.5px;
  font-weight: normal;
  color: var(--label-secondary);
}

.matrix-item-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.matrix-count-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 6px;
  background: rgba(var(--apple-blue-rgb), 0.1);
  color: var(--apple-blue);
  font-weight: 700;
  font-size: 13px;
  font-family: var(--font-mono);
}

.matrix-status-sub {
  font-size: 11.5px;
  color: var(--label-secondary);
  font-weight: normal;
}

.express-group-details-toggle {
  display: flex;
  justify-content: center;
  margin-top: 4px;
}

.btn-toggle-details {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px dashed var(--border-color);
  background: transparent;
  color: var(--label-secondary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.16s ease;
}

.btn-toggle-details:hover {
  border-color: var(--apple-blue);
  color: var(--apple-blue);
  background: rgba(var(--apple-blue-rgb), 0.05);
}

.express-group-orders-drawer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px dashed var(--separator-subtle);
}

/* Responsive constraints for Mobile (< 820px) */
@media (max-width: 820px) {
  .express-kpi-strip {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .express-kpi-card {
    padding: 8px 10px;
    gap: 6px;
  }
  .express-kpi-card .kpi-icon {
    font-size: 16px;
  }
  .express-kpi-card .kpi-value {
    font-size: 15px;
  }
  .express-status-pills {
    width: 100%;
  }
  .express-filter-pill {
    padding: 5px 10px;
    font-size: 12px;
  }
  .express-view-mode-tabs {
    width: 100%;
  }
  .express-view-mode-btn {
    flex: 1;
    justify-content: center;
    padding: 6px 8px;
    font-size: 12px;
  }
  .express-group-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .express-group-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .express-matrix-item {
    flex-direction: column;
    align-items: flex-start;
  }
  .matrix-item-right {
    width: 100%;
    justify-content: space-between;
  }
  .express-search-row {
    flex-direction: column;
    align-items: stretch;
  }
  .express-search-input-wrap {
    min-width: 100%;
  }
}

@media (max-width: 480px) {
  .express-kpi-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --------------------------------------------------------------------------
   14. Stats & Metric Cards
   -------------------------------------------------------------------------- */
.stats-summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 16px;
}

.stats-total {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--apple-blue);
  font-family: var(--font-mono);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stats-grid-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--label-secondary);
  margin-bottom: 8px;
}

.stats-buckets {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stats-bucket {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card-bg-subtle);
  border: 1px solid var(--separator-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12.5px;
}

.stats-bucket strong {
  font-family: var(--font-mono);
  color: var(--apple-blue);
}

.log-result.success {
  color: var(--apple-green);
}

.log-result.failure {
  color: var(--apple-red);
}

/* --------------------------------------------------------------------------
   15. Mobile Card Views (Responsive Substitutes for Wide Tables)
   -------------------------------------------------------------------------- */
/* Desktop table view is default, mobile cards hidden on desktop */
.jobs-cards-mobile,
.balance-cards-mobile {
  display: none;
}

/* Job Card (Mobile & Responsive) */
.job-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.job-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.07);
}

.job-card.is-running {
  border-color: rgba(var(--apple-blue-rgb), 0.45);
  box-shadow: 0 4px 22px rgba(var(--apple-blue-rgb), 0.18), 0 0 0 1px rgba(var(--apple-blue-rgb), 0.3);
}

.job-card.is-disabled {
  opacity: 0.8;
}

.job-card-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--separator-subtle);
}

.job-card-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Project Brand Pills */
.project-brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.brand-pill-icon {
  font-size: 13px;
  line-height: 1;
}

.project-brand-bgxq {
  background: rgba(79, 70, 229, 0.1);
  color: #4f46e5;
  border: 1px solid rgba(79, 70, 229, 0.22);
}

.project-brand-dtxb {
  background: rgba(5, 150, 105, 0.1);
  color: #059669;
  border: 1px solid rgba(5, 150, 105, 0.22);
}

.project-brand-ttlhb {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.22);
}

.project-brand-gy {
  background: rgba(22, 163, 74, 0.1);
  color: #16a34a;
  border: 1px solid rgba(22, 163, 74, 0.22);
}

.project-brand-gj {
  background: rgba(234, 88, 12, 0.1);
  color: #ea580c;
  border: 1px solid rgba(234, 88, 12, 0.22);
}

/* Job Status Badge */
.job-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.job-status-badge.ready {
  background: rgba(var(--apple-green-rgb), 0.12);
  color: var(--apple-green);
  border: 1px solid rgba(var(--apple-green-rgb), 0.25);
}

.job-status-badge.running {
  background: rgba(var(--apple-blue-rgb), 0.15);
  color: var(--apple-blue);
  border: 1px solid rgba(var(--apple-blue-rgb), 0.35);
}

.job-status-badge.disabled {
  background: var(--input-bg);
  color: var(--label-tertiary);
  border: 1px solid var(--separator);
}

.status-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--apple-blue);
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(var(--apple-blue-rgb), 0.7);
  animation: radar-pulse 1.8s infinite cubic-bezier(0.66, 0, 0, 1);
}

@keyframes radar-pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(var(--apple-blue-rgb), 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(var(--apple-blue-rgb), 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(var(--apple-blue-rgb), 0); }
}

.job-card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.job-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--label-primary);
  letter-spacing: -0.2px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.job-card-owner-chip {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--card-bg-subtle);
  color: var(--label-tertiary);
  border: 1px solid var(--separator-subtle);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Job Card Body */
.job-card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Product Banner inside Job Card */
.job-product-banner {
  background: linear-gradient(135deg, rgba(var(--apple-blue-rgb), 0.06), rgba(var(--apple-blue-rgb), 0.02));
  border: 1px solid rgba(var(--apple-blue-rgb), 0.14);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

[data-theme="dark"] .job-product-banner {
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.12), rgba(10, 132, 255, 0.04));
  border-color: rgba(10, 132, 255, 0.22);
}

.product-banner-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(var(--apple-blue-rgb), 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.product-banner-content {
  flex: 1;
  min-width: 0;
}

.product-banner-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--apple-blue);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.product-banner-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--label-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Specs 2x2 Grid */
.job-spec-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.job-spec-cell {
  background: var(--card-bg-subtle);
  border: 1px solid var(--separator-subtle);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.spec-cell-label {
  font-size: 11px;
  color: var(--label-tertiary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.spec-icon {
  font-size: 12px;
  line-height: 1;
}

.spec-cell-value {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--label-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spec-cell-value.highlight-next-time {
  color: var(--apple-blue);
  font-weight: 700;
}

/* Job Card Action Buttons */
.job-card-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding-top: 10px;
  margin-top: 2px;
  border-top: 1px solid var(--separator-subtle);
}

.btn-job-action {
  height: 36px;
  padding: 0 4px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  border: none;
  box-sizing: border-box;
}

.btn-job-action:active {
  transform: scale(0.95);
}

.btn-job-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-job-run {
  background: rgba(0, 113, 227, 0.12);
  color: #0071e3;
  border: 1px solid rgba(0, 113, 227, 0.24);
}

.btn-job-run:hover:not(:disabled) {
  background: rgba(0, 113, 227, 0.18);
  border-color: rgba(0, 113, 227, 0.35);
}

.btn-job-edit {
  background: var(--input-bg);
  color: var(--label-primary);
  border: 1px solid var(--separator);
}

.btn-job-edit:hover:not(:disabled) {
  background: var(--card-bg-subtle);
  border-color: var(--label-tertiary);
}

.btn-job-stop {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.24);
}

.btn-job-stop:hover:not(:disabled) {
  background: rgba(245, 158, 11, 0.2);
}

.btn-job-delete {
  background: rgba(255, 59, 48, 0.1);
  color: #ff3b30;
  border: 1px solid rgba(255, 59, 48, 0.22);
}

.btn-job-delete:hover:not(:disabled) {
  background: rgba(255, 59, 48, 0.18);
}

/* Empty State Card */
.empty-state-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  gap: 12px;
  border-radius: 16px;
  background: var(--card-bg);
  border: 1px dashed var(--separator);
}

.empty-icon-wrap {
  font-size: 38px;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--card-bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
}

.empty-state-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--label-primary);
}

.empty-state-desc {
  font-size: 13px;
  color: var(--label-tertiary);
  max-width: 280px;
  line-height: 1.5;
}

.btn-empty-cta {
  margin-top: 6px;
  padding: 8px 20px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

/* Balance Card (Mobile) */
.balance-item-card {
  background: var(--card-bg);
  border: 1px solid var(--separator-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.balance-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.balance-user-name {
  font-size: 14px;
  font-weight: 600;
}

.balance-remark-tag {
  font-size: 11px;
  color: var(--label-tertiary);
  margin-left: 6px;
}

.balance-project-pill {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  background: var(--input-bg);
  color: var(--label-secondary);
}

.balance-item-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--separator-subtle);
  padding-top: 8px;
}

.balance-val {
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.balance-val.is-ok {
  color: var(--apple-green);
}

.balance-val.is-error {
  color: var(--apple-red);
}

/* --------------------------------------------------------------------------
   16. Mobile Bottom Tab Bar (iOS Native Style)
   -------------------------------------------------------------------------- */
.ios-bottom-tab-bar {
  display: none; /* hidden on desktop */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 950;
  height: calc(var(--bottom-bar-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--glass-bg);
  backdrop-filter: saturate(180%) blur(var(--glass-blur));
  -webkit-backdrop-filter: saturate(180%) blur(var(--glass-blur));
  border-top: 1px solid var(--card-border);
  align-items: center;
  justify-content: space-around;
  user-select: none;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  overflow: hidden;
}

.tab-item {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: transparent;
  border: none;
  color: var(--label-tertiary);
  cursor: pointer;
  transition: color 0.15s ease;
  padding: 4px 0;
}

.tab-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tab-icon-wrap svg {
  width: 22px;
  height: 22px;
  transition: transform 0.15s ease;
}

.tab-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.tab-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--apple-red);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tab-item.active {
  color: var(--apple-blue);
}

.tab-item.active .tab-icon-wrap svg {
  transform: scale(1.08);
}

/* --------------------------------------------------------------------------
   17. Apple Dynamic Island Toast & Modals
   -------------------------------------------------------------------------- */
.ios-dynamic-island {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  min-width: 220px;
  max-width: 90vw;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.88);
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: none;
  animation: island-drop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.ios-dynamic-island.error {
  background: rgba(255, 59, 48, 0.92);
}

@keyframes island-drop {
  from { opacity: 0; transform: translate(-50%, -20px) scale(0.92); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

/* Apple Dialog Backdrop */
.apple-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.apple-modal-backdrop.visible {
  opacity: 1;
}

.apple-modal-card {
  width: 100%;
  max-width: 320px;
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--card-shadow-lg);
  padding: 22px 20px 18px;
  text-align: center;
  transform: scale(0.92);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid var(--card-border);
}

.apple-modal-backdrop.visible .apple-modal-card {
  transform: scale(1);
}

.apple-modal-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(var(--apple-blue-rgb), 0.1);
  color: var(--apple-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}

.apple-modal-icon-warn {
  background: rgba(var(--apple-red-rgb), 0.1);
  color: var(--apple-red);
}

.apple-modal-icon svg {
  width: 22px;
  height: 22px;
}

.apple-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--label-primary);
  margin-bottom: 6px;
}

.apple-modal-desc {
  font-size: 13px;
  color: var(--label-secondary);
  margin-bottom: 16px;
  line-height: 1.4;
}

.apple-modal-body {
  margin-bottom: 18px;
}

.apple-modal-footer {
  display: flex;
  gap: 8px;
}

.apple-modal-footer button {
  flex: 1;
}

/* --------------------------------------------------------------------------
   18. Responsive Breakpoints (Mobile & Tablet Optimization)
   -------------------------------------------------------------------------- */
@media (max-width: 820px) {
  /* Hide Desktop Segmented Control in Topbar */
  #main-segmented-nav {
    display: none !important;
  }

  /* Show Bottom Tab Bar on Mobile */
  .ios-bottom-tab-bar {
    display: flex;
  }

  /* Prevent page horizontal scrolling */
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }

  /* Adjust Container for Safe Area */
  .ios-container {
    padding: 12px 12px calc(var(--bottom-bar-height) + env(safe-area-inset-bottom, 0px) + 24px);
    gap: 14px;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  /* Topbar strictly within 100vw */
  .topbar {
    padding: 0 12px;
    height: 50px;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .topbar-subline,
  .user-chip {
    display: none !important;
  }

  .topbar-brand {
    min-width: 0;
    flex: 1;
    overflow: hidden;
  }

  .topbar-heading-row h1 {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .badge-pill {
    display: none !important;
  }

  /* Topbar Actions on Mobile */
  .topbar-actions {
    gap: 6px;
    flex-shrink: 0;
  }

  #reload-all {
    width: 32px;
    height: 32px;
    padding: 0 !important;
    justify-content: center;
    font-size: 0 !important;
  }

  #reload-all svg {
    width: 15px;
    height: 15px;
    margin: 0 !important;
  }

  #theme-toggle {
    width: 32px;
    height: 32px;
  }

  #logout {
    height: 32px;
    padding: 0 10px;
    font-size: 12px;
  }

  /* Jobs Sub Navigation 100% Full Width on Mobile */
  .jobs-sub-nav-wrap {
    width: 100%;
  }

  .jobs-sub-segmented {
    width: 100%;
    display: flex !important;
    box-sizing: border-box;
  }

  .jobs-sub-segmented .sub-tab-btn {
    flex: 1;
    text-align: center;
    justify-content: center;
    padding: 6px 2px;
    font-size: 12px;
  }

  /* Switch Split Layout to Stacked */
  .account-query-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .ios-card {
    padding: 14px 12px;
    border-radius: var(--radius-md);
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }

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

  .col-span-2 {
    grid-column: span 1;
  }

  .inline-fields {
    grid-template-columns: 1fr;
  }

  .settings-grid-2 {
    grid-template-columns: 1fr;
  }

  .ql-row {
    grid-template-columns: 1fr;
  }

  .ql-fields-grid {
    grid-template-columns: 1fr;
  }

  .user-form,
  .user-form-apple {
    grid-template-columns: 1fr;
  }

  .settings-bottom-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    text-align: center;
  }

  .btn-save-config {
    width: 100%;
    justify-content: center;
  }

  .btn-create-user {
    width: 100%;
  }

  .product-toolbar {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  /* Switch Desktop Tables to Mobile Card Views */
  .jobs-table-desktop,
  .balance-table-desktop,
  .products-table-desktop {
    display: none !important;
  }

  .jobs-cards-mobile,
  .balance-cards-mobile,
  .products-cards-mobile {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
  }

  .apple-modal-body {
    grid-template-columns: 1fr !important;
  }

  .product-search-box {
    max-width: 100% !important;
  }

  .apple-modal-sheet {
    padding: 16px !important;
    margin: 12px;
  }

  /* Mobile Job Card & Inset Form Fine Tuning */
  .job-card {
    width: 100%;
    box-sizing: border-box;
    padding: 14px 12px;
  }

  .job-card-actions {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 6px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .btn-job-action,
  .job-card-actions button {
    width: 100% !important;
    min-width: 0 !important;
    height: 36px !important;
    padding: 0 2px !important;
    font-size: 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    border-radius: 10px !important;
  }

  .ios-form-group {
    padding: 14px 12px !important;
    border-radius: 14px !important;
    box-sizing: border-box !important;
    width: 100% !important;
  }

  .account-card-item {
    padding: 9px 10px !important;
  }

  .job-form-footer-actions {
    margin-top: 14px;
    padding-top: 12px;
  }
}

@media (max-width: 480px) {
  .sub-tab-btn {
    padding: 5px 6px;
    font-size: 11.5px;
  }

  .section-heading {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .section-heading .form-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* --------------------------------------------------------------------------
   18.1 Dedicated Mobile Enhancements & Modular Components
   -------------------------------------------------------------------------- */
.mobile-only {
  display: none !important;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.btn-block { width: 100%; justify-content: center; }

/* Product Channel Segmented Navigation */
.product-channel-nav-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-bottom: 14px;
}
.product-channel-nav-wrap::-webkit-scrollbar {
  display: none;
}

.product-channel-segmented {
  display: inline-flex;
  background: var(--input-bg);
  padding: 4px;
  border-radius: var(--radius-md);
  gap: 4px;
  min-width: min-content;
}

.prod-seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--label-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
  user-select: none;
}

.prod-seg-btn:hover {
  color: var(--label-primary);
}

.prod-seg-btn.active {
  background: var(--card-bg);
  color: var(--label-primary);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.prod-seg-btn .seg-badge {
  display: inline-block;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.06);
  color: var(--label-secondary);
}

.prod-seg-btn.active .seg-badge {
  background: rgba(var(--apple-blue-rgb), 0.12);
  color: var(--apple-blue);
}

/* Modern Product Toolbar & Search */
.product-toolbar-modern {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
  width: 100%;
}

@media (min-width: 821px) {
  .product-toolbar-modern {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.product-search-box {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  width: 100%;
  max-width: 360px;
}

.product-search-box input {
  width: 100%;
  padding-left: 36px;
  padding-right: 32px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  font-size: 13px;
  box-sizing: border-box;
}

.product-search-box .search-icon {
  position: absolute;
  left: 10px;
  width: 16px;
  height: 16px;
  color: var(--label-tertiary);
  pointer-events: none;
}

.product-search-box .search-clear-btn {
  position: absolute;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: var(--label-quaternary);
  color: #ffffff;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-filter-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.product-filter-chips::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  border: 1px solid var(--separator);
  background: var(--input-bg);
  color: var(--label-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.filter-chip.active {
  background: var(--apple-blue);
  color: #ffffff;
  border-color: var(--apple-blue);
  font-weight: 500;
}

/* Job Form Footer Actions */
.job-form-footer-actions {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--separator);
}

.job-form-footer-split {
  display: flex;
  gap: 10px;
}

/* Mobile Safe Bottom Spacer */
.mobile-safe-bottom-spacer {
  display: none;
}

/* Mobile-Specific Adaptations (<= 820px) */
@media (max-width: 820px) {
  .mobile-only {
    display: flex !important;
  }
  .desktop-only {
    display: none !important;
  }

  .mobile-safe-bottom-spacer {
    display: block !important;
    height: calc(var(--bottom-bar-height) + env(safe-area-inset-bottom, 0px) + 24px) !important;
    width: 100% !important;
  }

  /* Compact Horizontal Swipe Ribbon for KPIs on Mobile */
  .kpi-ribbon {
    display: flex !important;
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    padding-bottom: 2px !important;
    scrollbar-width: none !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .kpi-ribbon::-webkit-scrollbar {
    display: none !important;
  }
  .kpi-card {
    flex: 0 0 auto !important;
    min-width: 125px !important;
    padding: 8px 10px !important;
    gap: 8px !important;
  }
  .kpi-icon-wrap {
    width: 28px !important;
    height: 28px !important;
  }
  .kpi-icon-wrap svg {
    width: 14px !important;
    height: 14px !important;
  }
  .kpi-label {
    font-size: 11px !important;
  }
  .kpi-val {
    font-size: 14px !important;
  }
  .kpi-unit {
    font-size: 10px !important;
  }

  /* Mobile Accounts Sub-navigation Switcher */
  .mobile-accounts-sub-nav {
    width: 100%;
    margin-bottom: 12px;
  }
  .mobile-accounts-segmented {
    width: 100%;
    display: flex !important;
    box-sizing: border-box;
  }
  .mobile-accounts-segmented .sub-tab-btn {
    flex: 1;
    text-align: center;
    justify-content: center;
    padding: 8px 4px;
    font-size: 12.5px;
    font-weight: 500;
  }

  /* Hide inner redundant switcher in workbench on mobile */
  .workbench-header .query-sub-segmented {
    display: none !important;
  }

  /* Responsive 2x2 Header Actions in Product Tab */
  .product-header-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    width: 100% !important;
  }
  .capture-account-field {
    grid-column: 1 / -1;
    min-width: 0;
    width: 100%;
  }
  .capture-account-field select {
    max-width: none;
    width: 100%;
  }
  .product-header-actions button {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Job Header Actions */
  .job-header-actions {
    display: flex !important;
    gap: 8px !important;
  }
}

/* --------------------------------------------------------------------------
   19. Apple ID / iCloud Auth View (login.html)
   -------------------------------------------------------------------------- */
.login-body {
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  overflow-x: hidden;
  background-color: #f4f6fb;
  color: var(--label-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease, color 0.3s ease;
}

[data-theme="dark"] .login-body {
  background-color: #090d16;
}

/* 动态极光渐变图层：多组高斯模糊光斑伴随轻盈缓慢的悬浮呼吸动画 */
.login-body::before {
  content: "";
  position: fixed;
  inset: -35%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(42% 42% at 18% 22%, rgba(56, 189, 248, 0.45), transparent 65%),
    radial-gradient(40% 40% at 82% 18%, rgba(139, 92, 246, 0.40), transparent 65%),
    radial-gradient(46% 46% at 75% 82%, rgba(244, 63, 94, 0.28), transparent 65%),
    radial-gradient(42% 42% at 20% 82%, rgba(16, 185, 129, 0.32), transparent 65%);
  filter: blur(62px) saturate(1.4);
  animation: auroraFloat 24s ease-in-out infinite alternate;
}

/* 深色模式下的极光深邃微调 */
[data-theme="dark"] .login-body::before {
  background:
    radial-gradient(42% 42% at 18% 22%, rgba(14, 165, 233, 0.28), transparent 65%),
    radial-gradient(40% 40% at 82% 18%, rgba(124, 58, 237, 0.32), transparent 65%),
    radial-gradient(46% 46% at 75% 82%, rgba(225, 29, 72, 0.22), transparent 65%),
    radial-gradient(42% 42% at 20% 82%, rgba(5, 150, 105, 0.25), transparent 65%);
  filter: blur(72px) saturate(1.15);
  opacity: 0.85;
}

@keyframes auroraFloat {
  0% {
    transform: translate3d(0, 0, 0) scale(1) rotate(0deg);
  }
  50% {
    transform: translate3d(2.5%, -2.5%, 0) scale(1.08) rotate(4deg);
  }
  100% {
    transform: translate3d(-2.5%, 2.5%, 0) scale(1.03) rotate(-3deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-body::before {
    animation: none;
  }
}

/* 微妙几何微点网格底纹，增强视觉层次 */
.login-body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(100, 116, 139, 0.12) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at 50% 50%, black 45%, transparent 88%);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, black 45%, transparent 88%);
  opacity: 0.6;
}

[data-theme="dark"] .login-body::after {
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  opacity: 0.4;
}

.auth-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 顶栏状态指示与模式切换 */
.auth-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 4px;
}

.auth-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: #059669;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.22);
  padding: 4.5px 12px;
  border-radius: 9999px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.08);
}

[data-theme="dark"] .auth-status-badge {
  color: #34d399;
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(52, 211, 153, 0.25);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.status-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  animation: pulseEmerald 2s infinite;
}

@keyframes pulseEmerald {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.auth-theme-toggle {
  position: static;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--label-secondary);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

[data-theme="dark"] .auth-theme-toggle {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(30, 41, 59, 0.65);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.auth-theme-toggle:hover {
  transform: translateY(-1px);
  color: var(--apple-blue);
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(59, 130, 246, 0.3);
}

[data-theme="dark"] .auth-theme-toggle:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(59, 130, 246, 0.4);
}

/* 仿 Apple Liquid Glass 动态玻璃卡片 */
.auth-card {
  position: relative;
  width: 100%;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 26px;
  box-shadow:
    0 24px 48px -12px rgba(15, 23, 42, 0.12),
    0 4px 16px -2px rgba(15, 23, 42, 0.04),
    inset 0 1px 1.5px rgba(255, 255, 255, 0.95);
  padding: 38px 34px;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] .auth-card {
  background: rgba(15, 23, 42, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.11);
  box-shadow:
    0 30px 60px -15px rgba(0, 0, 0, 0.75),
    0 8px 24px -4px rgba(0, 0, 0, 0.5),
    inset 0 1px 1px rgba(255, 255, 255, 0.14);
}

/* 品牌头部 */
.auth-card-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.brand-badge-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.brand-logo-icon svg {
  width: 50px;
  height: 50px;
  border-radius: 15px;
  box-shadow: 0 10px 24px -4px rgba(59, 130, 246, 0.45);
  transition: transform 0.3s ease;
}

.brand-logo-icon:hover svg {
  transform: scale(1.05) rotate(-2deg);
}

.auth-tag {
  font-size: 11.5px;
  font-weight: 600;
  padding: 3.5px 10px;
  border-radius: 9999px;
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.22);
}

[data-theme="dark"] .auth-tag {
  color: #60a5fa;
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(96, 165, 250, 0.25);
}

.auth-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--label-primary);
}

.auth-sub {
  font-size: 12.5px;
  color: var(--label-secondary);
  margin-top: 5px;
  font-weight: 500;
}

/* 卡片内二级标题条（类似 2api 控制台验证卡片） */
.auth-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  margin-bottom: -10px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.7);
}

[data-theme="dark"] .auth-panel-heading {
  border-bottom-color: rgba(148, 163, 184, 0.15);
}

.auth-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--label-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.auth-panel-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--apple-blue);
  background: rgba(var(--apple-blue-rgb), 0.08);
  padding: 2.5px 8px;
  border-radius: 6px;
}

/* 表单与输入框 */
.auth-form {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.auth-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--label-secondary);
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.auth-field-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--label-tertiary);
  pointer-events: none;
  z-index: 2;
  transition: color 0.2s ease;
}

.auth-input-wrap input,
.auth-input-wrap input:not([type="checkbox"]) {
  width: 100%;
  padding-left: 44px !important;
  padding-right: 44px !important;
  height: 46px;
  border-radius: 14px;
  font-size: 14px;
  border: 1px solid rgba(203, 213, 225, 0.8);
  background: rgba(255, 255, 255, 0.85);
  color: var(--label-primary);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

[data-theme="dark"] .auth-input-wrap input,
[data-theme="dark"] .auth-input-wrap input:not([type="checkbox"]) {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(148, 163, 184, 0.2);
}

.auth-input-wrap input:focus,
.auth-input-wrap input:not([type="checkbox"]):focus {
  background: #ffffff;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3.5px rgba(59, 130, 246, 0.2);
  outline: none;
}

[data-theme="dark"] .auth-input-wrap input:focus,
[data-theme="dark"] .auth-input-wrap input:not([type="checkbox"]):focus {
  background: rgba(15, 23, 42, 0.9);
  border-color: #60a5fa;
  box-shadow: 0 0 0 3.5px rgba(59, 130, 246, 0.3);
}

.auth-input-wrap:focus-within .auth-field-icon {
  color: var(--apple-blue);
}

/* 密码显示/隐藏按钮 */
.auth-eye-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--label-tertiary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, background-color 0.15s ease;
  z-index: 3;
}

.auth-eye-btn:hover {
  color: var(--label-primary);
  background: rgba(100, 116, 139, 0.1);
}

/* 渐变提交按钮（现代高光渐变） */
.auth-submit-btn {
  height: 48px;
  margin-top: 8px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  box-shadow:
    0 10px 24px -6px rgba(37, 99, 235, 0.45),
    inset 0 1px 1px rgba(255, 255, 255, 0.35);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.auth-submit-btn:hover {
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 50%, #2563eb 100%);
  box-shadow:
    0 14px 28px -6px rgba(37, 99, 235, 0.55),
    inset 0 1px 1px rgba(255, 255, 255, 0.45);
  transform: translateY(-1.5px);
}

.auth-submit-btn:active {
  transform: translateY(0.5px) scale(0.99);
  box-shadow: 0 4px 12px -2px rgba(37, 99, 235, 0.4);
}

.auth-arrow-icon {
  width: 18px;
  height: 18px;
  transition: transform 0.15s ease;
}

.auth-submit-btn:hover .auth-arrow-icon {
  transform: translateX(3px);
}

/* 错误提示 */
.auth-error-msg {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  text-align: center;
  border: 1px solid rgba(239, 68, 68, 0.25);
  animation: shake 0.35s ease-in-out;
}

[data-theme="dark"] .auth-error-msg {
  background: rgba(239, 68, 68, 0.16);
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.3);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

/* 页脚说明 */
.auth-hint-footer {
  text-align: center;
  font-size: 11.5px;
  color: var(--label-tertiary);
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.auth-spin {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}


/* --------------------------------------------------------------------------
   20. 触摸设备 / iOS 移动端专项修正
   -------------------------------------------------------------------------- */

/* 触摸设备上的 :hover 会“粘滞”：点过或滑过之后样式长期保留，叠加 translateY/scale
   就表现为“滑动页面时组件跟着缩放”。触摸端统一取消位移与缩放反馈。 */
@media (hover: none), (pointer: coarse) {
  .kpi-card:hover,
  .param-pill:hover,
  .btn-quick-job:hover,
  .apple-modal-close:hover,
  .express-order-card:hover,
  .express-kpi-card:hover,
  .auth-theme-toggle:hover,
  .brand-logo-icon:hover svg,
  .auth-submit-btn:hover,
  .auth-submit-btn:hover .auth-arrow-icon,
  .segmented-btn:hover,
  .prod-seg-btn:hover,
  .filter-chip:hover,
  .btn-preset-time:hover,
  .btn-preset-once:hover,
  .tab-item:hover,
  .ios-form-group:hover {
    transform: none;
  }

  /* 去掉悬停抬升过渡，减少滑动时的重绘抖动 */
  .kpi-card,
  .express-kpi-card,
  .express-order-card {
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
  }
}

@media (max-width: 820px) {
  /* iOS Safari 聚焦 font-size < 16px 的输入控件时会把整页放大，
     这是“打开输入法显示异常”的主因；移动端统一把表单控件字号提到 16px。 */
  input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="hidden"]),
  select,
  textarea {
    font-size: 16px !important;
  }

  #stats-date {
    font-size: 16px !important;
  }

  /* 软键盘弹起时隐藏底部标签栏，避免其浮在键盘上方遮挡输入框 */
  body.keyboard-open .ios-bottom-tab-bar {
    display: none !important;
  }

  body.keyboard-open .mobile-safe-bottom-spacer {
    height: 0 !important;
  }
}

/* --------------------------------------------------------------------------
   21. 自绘时间控件 & 商品下拉（跨平台一致）
   -------------------------------------------------------------------------- */

/* ---- 三段式时间控件：时 : 分 : 秒 ---- */
/* 时间控件：三段输入只占内容宽度，不再等分撑满整行。
   PC 上一篇表单里三个 2 位数输入框各占 ~357px，视觉上极其松散。 */
.time-input3 {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 340px;
}

.time-input3 .time-unit {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  min-width: 0;
  gap: 4px;
}

.time-input3 .time-unit input {
  width: 62px;
}

.time-input3 .time-unit input {
  width: 100%;
  height: 40px;
  padding: 0 6px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  /* 隐藏数字输入的微调箭头，避免在窄屏上与文字挤压 */
  -moz-appearance: textfield;
  appearance: textfield;
}

.time-input3 .time-unit input::-webkit-outer-spin-button,
.time-input3 .time-unit input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.time-input3 .time-unit span {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--label-tertiary);
}

.time-input3 .time-colon {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--label-tertiary);
  padding-bottom: 2px;
}

.datetime-input3 {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.datetime-input3 > input[type="date"] {
  width: 100%;
  height: 40px;
  font-family: var(--font-mono);
  font-size: 14px;
}

/* ---- 自绘商品下拉 ---- */
.picker-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  color: var(--label-primary);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.picker-trigger-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-trigger-label.is-placeholder {
  color: var(--label-tertiary);
  font-weight: 400;
}

.picker-trigger-arrow {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  color: var(--label-tertiary);
  transition: transform 0.18s ease;
}

.product-picker.is-open .picker-trigger-arrow {
  transform: rotate(180deg);
}

.product-picker.is-open .picker-trigger {
  border-color: var(--apple-blue);
  box-shadow: 0 0 0 3px rgba(var(--apple-blue-rgb), 0.18);
  background: var(--input-bg-focus);
}

.picker-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  padding: 10px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow-lg);
}

.picker-panel[hidden] {
  display: none;
}

.picker-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  /* 限制高度，长列表内部滚动，避免把整页撑长 */
  max-height: min(46vh, 380px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.picker-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--label-primary);
}

.picker-option-index {
  flex: 0 0 auto;
  min-width: 22px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--label-tertiary);
}

.picker-option-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
}

.picker-option-name {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-option-meta {
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--label-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-option-check {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  color: var(--apple-blue);
}

.picker-option.is-active {
  background: rgba(var(--apple-blue-rgb), 0.12);
}

.picker-option.is-active .picker-option-name {
  color: var(--apple-blue);
  font-weight: 600;
}

.picker-empty {
  padding: 18px 10px;
  text-align: center;
  font-size: 13px;
  color: var(--label-tertiary);
}

/* 触摸设备不保留悬停态，避免选项“粘住”高亮 */
@media (hover: hover) and (pointer: fine) {
  .picker-option:hover {
    background: var(--fill-tertiary, rgba(120, 120, 128, 0.08));
  }
}

@media (max-width: 480px) {
  .time-input3 .time-unit span {
    display: none;
  }
  .time-input3 .time-unit input {
    font-size: 16px;
  }
}

/* --------------------------------------------------------------------------
   22. 查询工具栏统一 & 移动端账号勾选优化
   -------------------------------------------------------------------------- */

@media (max-width: 820px) {
  /* 移动端：字段行与查询按钮纵向堆叠，主按钮满宽，与站内其他主按钮一致 */
  .query-action-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .query-action-toolbar .query-fields-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    width: 100%;
  }

  /* 「兑换项目 + 查询天数」两个字段并排等宽，避免其中一个被压窄 */
  .express-toolbar .query-fields-row {
    grid-template-columns: 1fr 1fr;
    align-items: end;
  }

  .balance-toolbar .balance-project-item,
  .express-project-item,
  .express-days-item {
    width: 100%;
  }

  .btn-query-action {
    width: 100%;
    height: 44px;
    font-size: 15px;
    border-radius: var(--radius-md);
  }
}

@media (max-width: 820px) {
  /* 账号勾选：放大点按区域，便于单手操作 */
  .account-list .account-row {
    padding: 13px 12px;
    min-height: 52px;
    gap: 12px;
  }

  .account-list .account-row input[type="checkbox"] {
    width: 22px;
    height: 22px;
  }

  .account-list .account-name {
    font-size: 15px;
  }

  .account-list .account-meta {
    font-size: 12.5px;
  }

  /* 列表自身高度放宽，配合页面滚动，避免出现双层滚动条 */
  .accounts-panel .ios-inset-list {
    max-height: none;
  }

  /* 批量操作与筛选栏吸附在面板顶部，长列表滚动时始终可用 */
  .accounts-panel .accounts-header-actions {
    gap: 8px;
  }

  .accounts-panel .accounts-header-actions button {
    height: 34px;
    font-size: 13px;
  }
}

/* --------------------------------------------------------------------------
   23. 移动端商品卡片紧凑化
   -------------------------------------------------------------------------- */

/* 原始卡片纵向堆叠了「渠道/状态 → 标题 → ID → 参数 → 状态选择 → 按钮」，
   单张高达 ~297px（接近半屏），一屏只能看两张。这里压缩垂直占用：
   参数并排、元信息合并、按钮与状态同行。 */
@media (max-width: 820px) {
  .products-cards-mobile {
    gap: 10px;
  }

  .product-card-item {
    padding: 12px;
    gap: 7px;
    border-radius: var(--radius-md);
  }

  /* 顶部：渠道与库存/完整度徽标一行；状态徽标与底部下拉重复，隐藏以减噪 */
  .product-card-top {
    flex-wrap: wrap;
    gap: 6px;
  }

  .product-card-top .badge {
    display: none;
  }

  /* 标题与价格同行，标题最多两行 */
  .product-card-title-row {
    align-items: baseline;
    gap: 8px;
  }

  .product-card-title {
    font-size: 14.5px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
  }

  .product-card-spec {
    font-size: 11.5px;
    margin-top: 0;
  }

  /* 参数并排成一行，超长码已由 JS 缩写 */
  .product-card-params {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 0;
  }

  .product-card-params .param-pill {
    min-width: 0;
    justify-content: flex-start;
    overflow: hidden;
  }

  .product-card-params .param-val {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10.5px;
  }

  /* 底部压成单行：状态选择 + 同步提示（超出截断）+ 操作按钮 */
  .product-card-footer {
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    padding-top: 8px;
    min-height: 32px;
  }

  .product-card-footer .left-status {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
    flex-wrap: nowrap;
  }

  /* 状态选择器：iOS 聚焦时字号需 >=16px 才不会自动放大页面，
     这里保留 16px 但收紧宽度与内边距。 */
  .product-card-footer .left-status .product-status-change {
    flex: 0 1 auto;
    width: auto;
    min-width: 0;
    max-width: 104px;
    height: 32px;
    padding: 0 26px 0 8px;
    font-size: 16px;
  }

  .product-card-footer .sync-hint {
    font-size: 10.5px;
    color: var(--label-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1 1 auto;
    min-width: 0;
  }

  .product-card-footer .right-actions {
    flex: 0 0 auto;
    gap: 4px;
  }

  /* 操作按钮加大点按区，图标按钮最小 36px */
  .product-card-footer .btn-quick-job {
    height: 32px;
    padding: 0 10px;
    font-size: 12.5px;
  }

  .product-card-footer .btn-icon-ghost {
    width: 36px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
  }
}

/* --------------------------------------------------------------------------
   24. PC 端表单密度优化（新建任务 / 服务配置）
   -------------------------------------------------------------------------- */

@media (min-width: 821px) {
  /* 新建任务：收紧分组内外的垂直间距，让整表在一屏内更完整地呈现 */
  .job-form-modern {
    gap: 12px;
  }

  .job-form-modern .ios-form-group {
    padding: 14px 16px;
    gap: 10px;
    border-radius: 14px;
  }

  .job-form-modern .ios-form-group-header {
    padding-bottom: 8px;
  }

  .job-form-modern .ios-form-group-body {
    gap: 10px;
  }

  .job-form-modern .form-grid {
    gap: 10px 14px;
  }

  .job-form-modern .ios-form-item {
    gap: 5px;
  }

  /* 时间与预设按钮同行：预设放在标签右侧，不再独占一行 */
  .job-form-modern .time-label-row {
    margin-bottom: 2px;
  }

  .job-form-modern .schedule-time-slot {
    gap: 6px;
  }

  /* 账号勾选区：压缩高度，避免空白区域过大 */
  .job-form-modern .account-list {
    max-height: 220px;
  }

  .job-form-modern .account-card-item {
    padding: 8px 10px;
  }

  /* 底部操作区收紧 */
  .job-form-modern .job-form-footer-actions {
    margin-top: 12px;
    padding-top: 12px;
  }
}

/* ---- 服务配置：明确“保存”的作用范围 ---- */
@media (min-width: 821px) {
  .settings-form-wrapper {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  /* 各分组卡片紧凑一些，减少无意义留白 */
  .settings-form-wrapper .settings-group-card {
    padding: 16px 18px;
    gap: 10px;
  }

  .settings-form-wrapper .settings-group-header {
    padding-bottom: 10px;
  }
}

/* 分组标题下的“本节由保存按钮统一提交”说明，消除保存范围歧义 */
.settings-scope-hint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  padding: 2px 8px;
  font-size: 11px;
  border-radius: var(--radius-pill);
  background: rgba(var(--apple-blue-rgb), 0.08);
  color: var(--apple-blue);
  white-space: nowrap;
}

/* 顶部保存按钮旁的说明 */
.settings-save-note {
  font-size: 11.5px;
  color: var(--label-tertiary);
  text-align: right;
  line-height: 1.4;
  max-width: 260px;
}

/* 保存块：说明文字 + 保存按钮纵向排布 */
.settings-save-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

@media (max-width: 820px) {
  .settings-save-block {
    width: 100%;
    align-items: stretch;
  }
  .settings-save-note {
    text-align: left;
    max-width: none;
  }
}

/* 天天领红包抓取账号多选器。
   复用现有 Apple 设计变量，视觉与 .capture-account-field 的 select 保持一致。 */
.capture-account-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--card-bg-subtle);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  max-height: 168px;
  overflow-y: auto;
}

.capture-account-picker .capture-account-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-size: 12.5px;
  color: var(--label-secondary);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.capture-account-picker .capture-account-item:hover {
  border-color: rgba(var(--apple-blue-rgb), 0.35);
}

.capture-account-picker .capture-account-item:has(input:checked) {
  color: var(--apple-blue);
  background: rgba(var(--apple-blue-rgb), 0.08);
  border-color: rgba(var(--apple-blue-rgb), 0.4);
}

.capture-account-picker .capture-account-item input {
  margin: 0;
  accent-color: var(--apple-blue);
}

.capture-account-picker .capture-account-empty {
  font-size: 12.5px;
  color: var(--label-tertiary);
}

/* --------------------------------------------------------------------------
   25. 菜鸟账号管理（录入 / 启用停用 / 删除）
   -------------------------------------------------------------------------- */

/* 管理区折叠面板 */
.account-manage-details {
  margin-top: 14px;
  border: 1px solid var(--separator-subtle);
  border-radius: var(--radius-md);
  background: var(--card-bg-subtle);
  overflow: hidden;
}

.account-manage-details[hidden] {
  display: none;
}

.account-manage-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--label-primary);
  list-style: none;
  user-select: none;
}

.account-manage-details > summary::-webkit-details-marker {
  display: none;
}

.account-manage-details > summary::after {
  content: "▾";
  font-size: 11px;
  color: var(--label-tertiary);
  transition: transform 0.18s ease;
}

.account-manage-details[open] > summary::after {
  transform: rotate(180deg);
}

.account-manage-details .summary-hint {
  margin-left: auto;
  margin-right: 8px;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--label-tertiary);
}

.account-manage-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 12px 12px;
}

.account-manage-empty {
  padding: 14px 8px;
  text-align: center;
  font-size: 12.5px;
}

/* 单行账号：名称 + 启用开关 + 删除 */
.account-manage-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  border: 1px solid var(--separator-subtle);
}

/* 已停用的账号整行置灰，与启用账号形成明显区分 */
.account-manage-row.is-off {
  opacity: 0.62;
  background: var(--fill-tertiary);
}

.account-manage-main {
  flex: 1 1 auto;
  min-width: 0;
}

.account-manage-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--label-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-manage-meta {
  font-size: 11.5px;
  color: var(--label-tertiary);
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-manage-switch {
  flex: 0 0 auto;
}

.account-manage-row .btn-icon-delete {
  flex: 0 0 auto;
}

/* 录入账号弹窗 */
.account-modal-card {
  max-width: 420px;
  text-align: left;
}

.account-modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.account-modal-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.account-modal-field > span {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--label-secondary);
}

.account-modal-field .required {
  color: var(--apple-red);
}

.account-modal-field textarea {
  height: auto;
  min-height: 84px;
  padding: 9px 12px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
}

.account-modal-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--fill-tertiary);
  font-size: 13px;
  cursor: pointer;
}

.account-modal-switch input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--apple-blue);
  cursor: pointer;
}

.account-modal-error {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: rgba(var(--apple-red-rgb), 0.1);
  color: var(--apple-red);
  font-size: 12.5px;
  line-height: 1.45;
  word-break: break-all;
}

@media (max-width: 820px) {
  .account-manage-row {
    padding: 11px 12px;
  }

  .account-manage-name {
    font-size: 14.5px;
  }
}


/* ==========================================================================
   包裹碎片刷取（月度手动，仅管理员）
   ========================================================================== */

.badge-fragment {
  background: linear-gradient(135deg, #f6c453 0%, #e8a020 100%);
  color: #fff;
}

.fragment-run-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--hairline, rgba(0, 0, 0, 0.08));
}

.fragment-account-picker-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fragment-picker-tools {
  display: flex;
  gap: 8px;
}

.fragment-result {
  margin-top: 12px;
  overflow-x: auto;
}

.fragment-result table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.fragment-result th,
.fragment-result td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--hairline, rgba(0, 0, 0, 0.08));
}

.fragment-result th {
  font-weight: 600;
  color: var(--text-secondary, #6b6b70);
}


/* ==========================================================================
   商品列表：可排序表头与数量角标
   ========================================================================== */

/* 可排序表头：默认显示可点击提示，激活时高亮 */
.sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.sortable-th:hover {
  color: var(--accent, #3b5de7);
}

.sortable-th.sort-active {
  color: var(--accent, #3b5de7);
  font-weight: 600;
}

.sort-indicator {
  display: inline-block;
  margin-left: 2px;
  font-size: 11px;
  opacity: 0.9;
}

/* 状态筛选 chip 的数量角标 */
.chip-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.08);
  color: var(--text-secondary, #6b6b70);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  vertical-align: middle;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.chip-item.active .chip-badge {
  background: rgba(255, 255, 255, 0.28);
  color: #fff;
}

[data-theme="dark"] .chip-badge {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-secondary, #a1a1a6);
}

[data-theme="dark"] .chip-item.active .chip-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* ==========================================================================
   全局加载进度条（api() 请求时自动显示在页面顶部）
   ========================================================================== */
#global-loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, #0a84ff, #64d2ff);
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px rgba(10, 132, 255, 0.6);
}

/* 慢操作按钮的加载态：禁用 + 旋转图标 */
.btn-is-busy {
  position: relative;
  opacity: 0.65;
  pointer-events: none;
}

.btn-is-busy::after {
  content: '';
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-left: 0.45em;
  vertical-align: -0.1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-busy-spin 0.7s linear infinite;
}

@keyframes btn-busy-spin {
  to { transform: rotate(360deg); }
}
