/* 客户确认基线：仅视觉与响应式精修，不承载业务规则。 */
:where(.admin-ui, .manager-ui, .driver-ui) {
  --ui-navy: #102f48;
  --ui-navy-hover: #174f73;
  --ui-blue: #1476a6;
  --ui-blue-soft: #eaf5fa;
  --ui-canvas: #f3f6f8;
  --ui-surface: #fff;
  --ui-surface-soft: #f8fafb;
  --ui-ink: #17324d;
  --ui-muted: #60788b;
  --ui-line: #d7e2e8;
  --ui-line-strong: #bfd0da;
  --ui-focus: 0 0 0 3px rgba(20, 118, 166, 0.22);
  accent-color: var(--ui-blue);
  font-variant-numeric: tabular-nums;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

:where(.admin-ui, .manager-ui, .driver-ui) ::selection {
  color: var(--ui-navy);
  background: #cde7f2;
}

:where(.admin-ui, .manager-ui, .driver-ui) :where(button, a, input, select, textarea) {
  -webkit-tap-highlight-color: transparent;
}

:where(.admin-ui, .manager-ui, .driver-ui)
  :where(button, a, input, select, textarea):focus-visible {
  outline: 0;
  box-shadow: var(--ui-focus);
}

:where(.admin-ui, .manager-ui, .driver-ui) :where(button, input, select, textarea):disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

:where(.admin-ui, .manager-ui, .driver-ui) :where(a, .link, .panel-link) {
  text-underline-offset: 3px;
}

:where(.admin-ui, .manager-ui, .driver-ui) * {
  scrollbar-color: #a8bdc9 transparent;
  scrollbar-width: thin;
}

:where(.admin-ui, .manager-ui, .driver-ui) *::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

:where(.admin-ui, .manager-ui, .driver-ui) *::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: #a8bdc9;
  background-clip: padding-box;
}

:where(.admin-ui, .manager-ui, .driver-ui) *::-webkit-scrollbar-thumb:hover {
  background: #7f9cab;
  background-clip: padding-box;
}

/* PC 调度端 */
.admin-ui {
  min-width: 320px;
  background: var(--ui-canvas);
}

.admin-ui .side {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--ui-navy);
}

.admin-ui .brand {
  position: relative;
  padding: 5px 12px 17px 48px;
}

.admin-ui .brand::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 3px;
  width: 25px;
  height: 25px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 7px;
  background:
    linear-gradient(#fff, #fff) 6px 7px / 12px 2px no-repeat,
    linear-gradient(#fff, #fff) 6px 12px / 8px 2px no-repeat,
    rgba(255, 255, 255, 0.08);
}

.admin-ui .brand b {
  display: block;
  line-height: 1.3;
  letter-spacing: 0.01em;
}

.admin-ui .nav {
  gap: 4px;
  overflow-y: auto;
  padding-right: 2px;
}

.admin-ui .nav button {
  min-height: 40px;
  padding: 9px 12px;
  transition:
    color 0.16s ease,
    background 0.16s ease;
}

.admin-ui .nav button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.admin-ui .nav button.active {
  background: #205b7d;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.admin-ui .side-foot {
  line-height: 1.55;
}

.admin-ui .top {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 68px;
  border-color: var(--ui-line);
  box-shadow: 0 2px 10px rgba(16, 47, 72, 0.04);
}

.admin-ui .top h1 {
  color: var(--ui-ink);
  font-size: 18px;
  letter-spacing: -0.01em;
}

.admin-ui .crumb {
  margin-top: 2px;
}

.admin-ui .content {
  padding-top: 22px;
}

.admin-ui .head,
.admin-ui .cockpit-head {
  margin-bottom: 15px;
}

.admin-ui .head h2,
.admin-ui .cockpit-head h2 {
  color: var(--ui-ink);
  letter-spacing: -0.025em;
}

.admin-ui :where(.metric, .panel, .card, .cockpit-panel, .resource-card) {
  border-color: var(--ui-line);
  box-shadow: 0 1px 1px rgba(16, 47, 72, 0.025);
}

.admin-ui :where(.metric, .resource-card) b {
  letter-spacing: -0.025em;
}

.admin-ui :where(.btn, .filter, .link, .panel-link, .cockpit-status, .load-row, .alert-row) {
  transition:
    color 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease;
}

.admin-ui .btn:hover:not(:disabled) {
  border-color: #92b7c9;
  background: #f7fbfc;
}

.admin-ui .btn.primary:hover:not(:disabled) {
  border-color: var(--ui-navy-hover);
  background: var(--ui-navy-hover);
}

.admin-ui :where(input, select, textarea) {
  color: var(--ui-ink);
  border-color: var(--ui-line-strong);
}

.admin-ui :where(input, textarea)::placeholder {
  color: #718898;
}

.admin-ui .filterbar {
  border-color: var(--ui-line);
  box-shadow: 0 1px 1px rgba(16, 47, 72, 0.025);
}

.admin-ui .table-wrap {
  overscroll-behavior-x: contain;
}

.admin-ui .table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #536b7c;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.admin-ui .table td {
  color: #213d55;
}

.admin-ui .table tbody tr {
  transition: background 0.12s ease;
}

.admin-ui .table tbody tr:hover {
  background: #f5fafc;
}

.admin-ui dialog {
  border: 1px solid rgba(196, 212, 221, 0.72);
  box-shadow: 0 24px 72px rgba(16, 47, 72, 0.25);
}

.admin-ui dialog::backdrop {
  background: rgba(16, 47, 72, 0.52);
}

.admin-ui .toast {
  max-width: 360px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 30px rgba(16, 47, 72, 0.24);
  pointer-events: none;
}

/* 移动管理端 */
.manager-ui {
  min-width: 320px;
  background: #e8eef2;
  overscroll-behavior-y: none;
}

.manager-ui .phone {
  position: relative;
  overflow-x: hidden;
  background: var(--ui-canvas);
  box-shadow: 0 18px 54px rgba(16, 47, 72, 0.16);
}

.manager-ui .top {
  position: sticky;
  top: 0;
  z-index: 4;
  padding: 17px 18px 15px;
  background: var(--ui-navy);
  border-bottom: 3px solid var(--ui-blue);
}

.manager-ui .top h1 {
  font-size: 20px;
  letter-spacing: -0.02em;
}

.manager-ui .top select {
  min-width: 82px;
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.1);
}

.manager-ui .content {
  padding: 14px 14px calc(84px + env(safe-area-inset-bottom));
}

.manager-ui .metrics {
  gap: 10px;
}

.manager-ui .metric {
  min-height: 96px;
  border-color: var(--ui-line);
  border-radius: 10px;
  box-shadow: 0 1px 1px rgba(16, 47, 72, 0.03);
}

.manager-ui .metric b {
  color: var(--ui-ink);
  letter-spacing: -0.03em;
}

.manager-ui .metric.alert b {
  color: var(--bad);
}

.manager-ui .section {
  margin-top: 22px;
}

.manager-ui .section h2 {
  color: var(--ui-ink);
  font-size: 16px;
  letter-spacing: -0.015em;
}

.manager-ui .card {
  border-color: var(--ui-line);
  border-radius: 10px;
  box-shadow: 0 1px 1px rgba(16, 47, 72, 0.03);
}

.manager-ui .card-head > b {
  min-width: 0;
  overflow-wrap: anywhere;
}

.manager-ui .route {
  position: relative;
  overflow: hidden;
  border: 1px solid #e3ecef;
  background: #f2f7f9;
}

.manager-ui .route i {
  font-weight: 800;
}

.manager-ui .btn {
  min-height: 40px;
  border-color: var(--ui-line-strong);
  border-radius: 7px;
}

.manager-ui .btn:hover:not(:disabled) {
  border-color: #8fb4c6;
  background: #f7fbfc;
}

.manager-ui .btn.primary:hover:not(:disabled) {
  border-color: var(--ui-navy-hover);
  background: var(--ui-navy-hover);
}

.manager-ui .nav {
  height: calc(62px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  border-color: var(--ui-line);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 -5px 18px rgba(16, 47, 72, 0.055);
}

.manager-ui .nav button {
  position: relative;
  min-height: 44px;
}

.manager-ui .nav button.active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 24px;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: var(--ui-blue);
  transform: translateX(-50%);
}

.manager-ui dialog {
  border: 1px solid rgba(196, 212, 221, 0.72);
  border-radius: 12px;
}

.manager-ui .toast {
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 28px rgba(16, 47, 72, 0.22);
  pointer-events: none;
}

/* 司机作业端 */
.driver-ui {
  min-width: 320px;
  overscroll-behavior-y: none;
}

.driver-ui .phone {
  overflow: hidden;
  background: var(--ui-canvas);
  box-shadow: 0 18px 54px rgba(16, 47, 72, 0.18);
}

.driver-ui .top {
  position: sticky;
  top: 0;
  z-index: 5;
  border-color: var(--ui-line);
  box-shadow: 0 2px 10px rgba(16, 47, 72, 0.04);
}

.driver-ui .top b,
.driver-ui .banner h1,
.driver-ui .month h2 {
  letter-spacing: -0.015em;
}

.driver-ui .role-banner {
  border-color: #cfe0e8 !important;
  background: #edf6fa !important;
  color: #315f78 !important;
}

.driver-ui .banner,
.driver-ui .month {
  background: var(--ui-navy);
}

.driver-ui .content {
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
}

.driver-ui .notice {
  line-height: 1.55;
}

.driver-ui .card {
  border-color: var(--ui-line);
  box-shadow: 0 1px 1px rgba(16, 47, 72, 0.03);
}

.driver-ui .task-top > div {
  min-width: 0;
}

.driver-ui .task-top .muted,
.driver-ui .info-row b,
.driver-ui .steps small {
  overflow-wrap: anywhere;
}

.driver-ui .route {
  border-color: #e2eaee;
}

.driver-ui .btn {
  min-height: 40px;
}

.driver-ui .actions .btn {
  min-width: 0;
}

.driver-ui .photo {
  min-height: 82px;
}

.driver-ui .nav {
  height: calc(62px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -5px 18px rgba(16, 47, 72, 0.055);
}

.driver-ui .nav button {
  min-height: 44px;
}

.driver-ui .sticky {
  bottom: calc(62px + env(safe-area-inset-bottom));
  padding-bottom: 10px;
}

.driver-ui dialog {
  border: 1px solid rgba(196, 212, 221, 0.72);
}

.driver-ui textarea,
.driver-ui select,
.driver-ui input {
  color: var(--ui-ink);
}

.driver-ui textarea::placeholder,
.driver-ui input::placeholder {
  color: #718898;
}

.driver-ui .toast {
  bottom: calc(74px + env(safe-area-inset-bottom));
  border: 1px solid rgba(255, 255, 255, 0.12);
  pointer-events: none;
}

/* Keep transient feedback above the fixed workflow action instead of hiding its label. */
.driver-ui:has(.sticky) .toast {
  bottom: calc(136px + env(safe-area-inset-bottom));
}

/* 客户演示模式：保留角色模拟能力，仅隐藏开发入口文案。 */
.driver-ui .role-banner,
.driver-ui #back-admin {
  display: none !important;
}

/* 任务详情的固定操作区不得覆盖最后一段正文。 */
.driver-ui .main:has(.sticky) {
  padding-bottom: calc(156px + env(safe-area-inset-bottom));
}

.driver-ui .main:has(.sticky) > .content {
  padding-bottom: 92px;
}

/* 额外绩效申请：只统一表单视觉，不改变字段或提交流程。 */
.driver-ui .extra-performance-form .modal-body {
  display: grid;
  gap: 16px;
}

.driver-ui .extra-performance-form .form-hint {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #cfe0e8;
  border-radius: 8px;
  background: #edf6fa;
  color: #315f78;
  font-size: 12px;
  line-height: 1.55;
}

.driver-ui .extra-performance-form label {
  display: grid;
  gap: 7px;
  color: #38566d;
  font-size: 12px;
  font-weight: 700;
}

.driver-ui .extra-performance-form label > span {
  line-height: 1.3;
}

.driver-ui .extra-performance-form :is(select, input, textarea) {
  width: 100%;
  min-height: 44px;
  margin: 0;
  border: 1px solid #bfcfd8;
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  font: inherit;
  line-height: 1.45;
}

.driver-ui .extra-performance-form textarea {
  min-height: 112px;
  resize: vertical;
}

.driver-ui .extra-performance-form :is(select, input, textarea):focus-visible {
  outline: 0;
  border-color: var(--ui-blue);
  box-shadow: 0 0 0 3px rgba(20, 118, 166, 0.14);
}

.driver-ui .extra-performance-form .modal-foot {
  gap: 9px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}

.driver-ui .extra-performance-form .modal-foot .btn {
  min-width: 92px;
  min-height: 44px;
}

/* 后台演示入口与详情队列折叠均为展示层处理。 */
.admin-ui .demo-tools {
  position: relative;
}

.admin-ui .demo-tools > summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}

.admin-ui .demo-tools > summary::-webkit-details-marker {
  display: none;
}

.admin-ui .demo-tools > summary::after {
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  content: "";
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.16s ease;
}

.admin-ui .demo-tools[open] > summary::after {
  transform: translateY(2px) rotate(225deg);
}

.admin-ui .demo-tools-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  display: grid;
  width: 250px;
  gap: 8px;
  padding: 11px;
  border: 1px solid var(--ui-line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(16, 47, 72, 0.16);
}

.admin-ui .demo-tools-menu :is(.btn, a) {
  display: flex;
  width: 100%;
  justify-content: center;
  text-decoration: none;
}

.admin-ui .demo-tools-menu .role-switch {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
}

.admin-ui .demo-tools-menu .role-switch select {
  width: 100%;
  max-width: none;
}

.admin-ui .queue-more {
  margin-top: 7px;
}

.admin-ui .queue-more > summary {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #b8ccd7;
  border-radius: 6px;
  background: #f5fafc;
  color: var(--ui-blue);
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
  list-style: none;
}

.admin-ui .queue-more > summary::-webkit-details-marker {
  display: none;
}

.admin-ui .queue-more-list {
  display: grid;
  gap: 7px;
  margin-top: 7px;
}

.admin-ui .queue-more-list > div {
  padding: 9px 10px;
  border: 1px solid var(--ui-line);
  border-radius: 6px;
  background: #f8fbfc;
}

.admin-ui .queue-more-list :is(b, span) {
  display: block;
}

.admin-ui .queue-more-list span {
  margin-top: 2px;
  color: var(--ui-muted);
  font-size: 11px;
}

@media (max-width: 1024px) {
  .admin-ui .content {
    padding: 18px 20px 30px;
  }
}

@media (max-width: 760px) {
  .admin-ui .shell {
    display: block;
  }

  .admin-ui .side {
    position: sticky;
    z-index: 30;
    height: auto;
    padding: 9px 10px 8px;
  }

  .admin-ui .brand {
    min-height: 34px;
    padding: 2px 8px 8px 42px;
    border: 0;
  }

  .admin-ui .brand::before {
    left: 8px;
    top: 0;
  }

  .admin-ui .brand small {
    display: none;
  }

  .admin-ui .nav {
    display: flex;
    gap: 4px;
    margin-top: 3px;
    overflow-x: auto;
    padding: 0 0 2px;
    scroll-snap-type: x proximity;
  }

  .admin-ui .nav button {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 8px 12px;
    scroll-snap-align: start;
    white-space: nowrap;
  }

  .admin-ui .top {
    top: 91px;
    height: 58px;
  }

  .admin-ui .content {
    padding: 14px 12px 28px;
  }

  .admin-ui .metrics,
  .admin-ui .cards,
  .admin-ui .cockpit-status-grid,
  .admin-ui .resource-grid {
    grid-template-columns: 1fr 1fr;
  }

  .admin-ui .cockpit-status {
    min-height: 104px;
  }

  .admin-ui .form label {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .admin-ui .status-help {
    margin-left: 0;
  }
}

@media (max-width: 430px) {
  .manager-ui,
  .driver-ui {
    background: var(--ui-canvas);
  }

  .manager-ui .phone,
  .driver-ui .phone {
    border-radius: 0;
    box-shadow: none;
  }
}

@media (max-width: 360px) {
  .manager-ui .metrics {
    grid-template-columns: 1fr;
  }

  .manager-ui .metric {
    min-height: 84px;
  }

  .driver-ui .summary {
    grid-template-columns: 1fr;
  }

  .driver-ui .summary > div {
    padding: 6px 0;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  }
}

@media (prefers-reduced-motion: reduce) {
  :where(.admin-ui, .manager-ui, .driver-ui) *,
  :where(.admin-ui, .manager-ui, .driver-ui) *::before,
  :where(.admin-ui, .manager-ui, .driver-ui) *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
