* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1f2937;
  background: #f5f7fb;
}

a {
  color: inherit;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
}

.sidebar {
  padding: 24px 18px;
  background: #172033;
  color: #f9fafb;
}

.brand {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 22px;
}

.role {
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: #d1d5db;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 18px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav a,
.logout button {
  width: 100%;
  display: block;
  padding: 11px 12px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #f9fafb;
  text-align: left;
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}

.logout {
  margin-top: 20px;
}

.main {
  padding: 28px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
}

h1 {
  margin: 0;
  font-size: 24px;
}

h2 {
  margin: 0 0 14px;
  font-size: 18px;
}

.muted {
  color: #6b7280;
  font-size: 13px;
}

.notice {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a8a;
  font-weight: 650;
}

.notice.compact {
  margin: 10px 0 16px;
}

.notice.warning {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

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

.panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 18px;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

label {
  font-size: 13px;
  font-weight: 650;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 7px;
  padding: 10px 11px;
  font: inherit;
  background: #fff;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

.button {
  border: 0;
  border-radius: 7px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.button.primary {
  background: #2563eb;
  color: #fff;
}

.button.secondary {
  background: #eef2ff;
  color: #1e3a8a;
}

.button.danger {
  background: #fee2e2;
  color: #991b1b;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #edf2f7;
}

.login-wrap {
  width: min(420px, calc(100% - 32px));
}

.login-card {
  padding: 26px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.08);
}

.login-brand {
  margin-bottom: 18px;
  font-size: 20px;
  font-weight: 800;
}

.login-button {
  width: 100%;
  justify-content: center;
}

.login-meta {
  margin: 12px 0 0;
  color: #64748b;
  font-size: 13px;
  text-align: center;
}

.form-error {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 7px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 13px;
  font-weight: 700;
}

.form-error.block {
  margin-bottom: 16px;
}

.narrow-panel {
  max-width: 520px;
}

.split {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.order-list {
  display: grid;
  gap: 16px;
}

.queue-group {
  display: grid;
  gap: 8px;
}

.queue-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  padding: 0 2px;
  color: #111827;
  font-size: 13px;
  font-weight: 800;
}

.queue-heading small {
  color: #6b7280;
  font-size: 12px;
  font-weight: 650;
}

.queue-empty {
  padding: 10px 12px;
  border: 1px dashed #d1d5db;
  border-radius: 8px;
  background: #f9fafb;
  color: #6b7280;
  font-size: 13px;
}

.order-card {
  display: block;
  text-decoration: none;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  transition: background 0.12s, border-color 0.12s;
}

.order-card:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.order-card.pending {
  border-color: #bfdbfe;
}

.order-card.assigned {
  background: #f8fbff;
  border-color: #dbeafe;
}

.order-card.closed {
  background: #f9fafb;
  color: #4b5563;
}

.order-card.selected {
  background: #eff5ff;
  border-color: #2563eb;
  box-shadow: inset 3px 0 0 #2563eb;
}

.order-card strong {
  display: block;
  margin-bottom: 6px;
}

.order-card-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 6px;
  color: #6b7280;
  font-size: 13px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.status-pill.pending {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-pill.assigned {
  background: #dcfce7;
  color: #166534;
}

.status-pill.closed {
  background: #e5e7eb;
  color: #4b5563;
}

.selected-order-banner {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 14px 0 4px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
}

.selected-order-banner strong {
  white-space: nowrap;
}

.selected-order-banner.pending {
  background: #eff6ff;
  color: #1d4ed8;
}

.selected-order-banner.assigned {
  background: #f0fdf4;
  color: #166534;
}

.selected-order-banner.closed {
  background: #f3f4f6;
  color: #4b5563;
}

.dispatch-section {
  padding: 16px 0 20px;
  margin-bottom: 18px;
  border-bottom: 1px solid #e5e7eb;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}

.section-heading.compact {
  margin-bottom: 14px;
}

.section-heading h3,
form h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.section-kicker {
  margin-bottom: 4px;
  color: #166534;
  font-size: 12px;
  font-weight: 800;
}

.form-note {
  margin: -2px 0 14px;
}

.assignment-summary {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(320px, 1.4fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
}

.followup-section {
  padding: 16px 0 18px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 16px;
}

.finance-section {
  padding: 16px 0 18px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 16px;
}

.photo-section {
  padding: 16px 0 18px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 16px;
}

.photo-groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.photo-group-title {
  font-size: 13px;
  color: #475569;
  margin-bottom: 6px;
}

.photo-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.photo-thumb {
  display: block;
  width: 96px;
  height: 96px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.service-item-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.service-item-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f8fafc;
}

.finance-guide {
  margin: 4px 0 12px;
}

.finance-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
}

.finance-step span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  font-weight: 800;
}

.finance-step strong,
.finance-step small {
  display: block;
}

.finance-step small {
  margin-top: 2px;
  color: #6b7280;
}

.finance-main-inputs {
  margin-bottom: 10px;
}

.finance-options {
  margin: 8px 0 14px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.finance-options summary,
.finance-breakdown summary {
  cursor: pointer;
  font-weight: 750;
  color: #374151;
}

.finance-options .grid {
  margin-top: 12px;
}

.checkbox-line {
  display: inline-flex;
  width: auto;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-weight: 650;
}

.checkbox-line input {
  width: auto;
}

.settlement-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
}

.settlement-summary div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.settlement-summary span {
  color: #6b7280;
}

.settlement-summary strong {
  white-space: nowrap;
}

.finance-result {
  margin: 16px 0 12px;
  padding: 14px;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  background: #f8fbff;
}

.finance-result-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}

.finance-result-header span,
.finance-result-header small,
.money-card small {
  color: #6b7280;
}

.finance-result-header strong {
  display: block;
  margin-top: 2px;
  font-size: 1.05rem;
}

.money-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.money-card {
  min-height: 104px;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.money-card span,
.money-card strong,
.money-card small {
  display: block;
}

.money-card span {
  color: #4b5563;
  font-weight: 700;
}

.money-card strong {
  margin: 8px 0 4px;
  font-size: 1.24rem;
}

.money-card.pay {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.money-card.keep {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.money-card.hold {
  border-color: #fde68a;
  background: #fffbeb;
}

.finance-breakdown {
  margin-top: 12px;
}

.inline-finance-action,
.manual-payout-form {
  margin-top: 12px;
}

.legacy-dispatch {
  padding: 12px 0 0;
}

.legacy-dispatch summary {
  cursor: pointer;
  color: #374151;
  font-weight: 750;
}

.reassign-panel {
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed #bfdbfe;
  border-radius: 8px;
  background: #f8fbff;
}

.reassign-panel summary {
  cursor: pointer;
  color: #1d4ed8;
  font-weight: 800;
}

.reassign-panel summary small {
  display: block;
  margin-top: 4px;
  color: #6b7280;
  font-weight: 650;
}

.reassign-panel form {
  margin-top: 12px;
}

.legacy-dispatch form {
  margin-top: 14px;
  padding: 14px;
  border: 1px dashed #d1d5db;
  border-radius: 8px;
  background: #fafafa;
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.sr-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.reminder-form {
  display: grid;
  grid-template-columns: 110px minmax(160px, 1fr) minmax(140px, 0.8fr) auto;
  gap: 8px;
  align-items: center;
}

.candidate-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 4px;
}

.candidate-row {
  display: grid;
  grid-template-columns: 22px minmax(180px, 1.3fr) minmax(140px, 0.8fr) max-content max-content;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.candidate-row input {
  width: auto;
}

.candidate-row strong,
.candidate-row .muted {
  display: block;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.success {
  background: #dcfce7;
  color: #166534;
}

.badge.warning {
  background: #fef3c7;
  color: #92400e;
}

.badge.neutral {
  background: #f3f4f6;
  color: #4b5563;
}

/* 待上交台账：待上交>0 醒目、超时>0 标红 */
.amount-due {
  color: #b45309;
  font-weight: 700;
}

.overdue-flag {
  color: #b91c1c;
  font-weight: 700;
}

.empty-state {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px dashed #d1d5db;
  border-radius: 8px;
  background: #fafafa;
}

.bind-result {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.temp-password-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  border-color: #fde68a;
  background: #fffbeb;
}

.copy-field {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.engineer-list {
  display: grid;
  gap: 10px;
}

.engineer-admin-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

.engineer-add-panel > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  cursor: pointer;
  list-style: none;
}

.engineer-add-panel > summary::-webkit-details-marker {
  display: none;
}

.engineer-add-panel > summary::before {
  content: "＋";
  font-weight: 700;
  color: #2563eb;
}

.engineer-add-panel[open] > summary::before {
  content: "−";
}

.engineer-add-summary-title {
  font-size: 16px;
  font-weight: 700;
}

.engineer-add-panel > form {
  margin-top: 14px;
}

.section-heading-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}

.engineer-filters {
  flex-wrap: wrap;
  align-items: end;
  margin-bottom: 14px;
}

.engineer-filters .field {
  min-width: 150px;
  flex: 1 1 150px;
  margin-bottom: 0;
}

.engineer-filters .field:first-child {
  flex-basis: 220px;
}

.filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.engineer-table-wrap {
  overflow-x: auto;
}

.engineer-table th,
.engineer-table td {
  white-space: normal;
  vertical-align: top;
}

.engineer-unbound {
  color: #b91c1c;
  font-weight: 700;
}

.button.compact {
  padding: 8px 10px;
  min-height: 36px;
}

.button.ghost {
  background: transparent;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  text-decoration: none;
}

.staff-user-list {
  display: grid;
  gap: 10px;
}

.engineer-card,
.staff-user-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
}

.engineer-card strong,
.staff-user-card strong {
  display: block;
  margin-bottom: 4px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}

th {
  background: #f9fafb;
  font-weight: 700;
}

.filters {
  display: flex;
  gap: 10px;
  align-items: end;
}

.denied {
  max-width: 520px;
  margin: 80px auto;
}

@media (max-width: 980px) {
  .shell,
  .split {
    grid-template-columns: 1fr;
  }

  .assignment-summary,
  .reminder-form,
  .candidate-row,
  .settlement-summary,
  .money-flow {
    grid-template-columns: 1fr;
  }

  .candidate-row input {
    justify-self: start;
  }
}

@media (max-width: 820px) {
  .shell,
  .split,
  .grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .engineer-card {
    align-items: stretch;
    flex-direction: column;
  }
}

.guide-page {
  background: #f4f7fb;
}

.guide-container {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 36px;
}

.guide-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  align-items: end;
  padding: 28px;
  border-radius: 8px;
  background: #172033;
  color: #fff;
}

.guide-hero h1 {
  margin: 6px 0 10px;
  font-size: 30px;
}

.guide-hero p {
  max-width: 760px;
  margin: 0;
  color: #d1d5db;
  line-height: 1.7;
}

.guide-kicker {
  color: #6ee7b7;
  font-size: 13px;
  font-weight: 800;
}

.guide-status {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.guide-status a {
  color: #bfdbfe;
  overflow-wrap: anywhere;
}

.guide-alert {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  margin: 16px 0;
  padding: 14px 16px;
  border: 1px solid #fde68a;
  border-radius: 8px;
  background: #fffbeb;
  color: #92400e;
}

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

.guide-card,
.guide-section {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 18px;
}

.guide-card h2,
.guide-section h2 {
  margin: 0 0 10px;
}

.guide-card p,
.guide-step p {
  color: #4b5563;
  line-height: 1.7;
}

.guide-card ul,
.guide-checklist ul {
  margin: 12px 0 0;
  padding-left: 18px;
  color: #4b5563;
  line-height: 1.8;
}

.guide-section {
  margin-top: 16px;
}

.guide-flow {
  display: grid;
  grid-template-columns: repeat(11, auto);
  gap: 10px;
  align-items: center;
  justify-content: start;
  overflow-x: auto;
}

.guide-flow span {
  min-width: 88px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #ecfdf5;
  color: #065f46;
  font-weight: 800;
  text-align: center;
}

.guide-flow b {
  color: #94a3b8;
}

.guide-steps {
  display: grid;
  gap: 14px;
}

.guide-step {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid #e5e7eb;
}

.guide-step:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.step-shot {
  display: grid;
  gap: 8px;
  min-height: 130px;
  padding: 16px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: linear-gradient(180deg, #f8fbff, #eef6ff);
}

.step-shot strong {
  font-size: 18px;
}

.step-shot span {
  color: #64748b;
  line-height: 1.6;
}

.guide-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  color: #6b7280;
  font-size: 13px;
}

@media (max-width: 980px) {
  .guide-hero,
  .guide-grid,
  .guide-step {
    grid-template-columns: 1fr;
  }

  .guide-flow {
    grid-template-columns: 1fr;
  }

  .guide-flow b {
    display: none;
  }
}

/* 台账汇总（今日台账顶部统计） */
.ledger-summary .summary-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}
.ledger-summary .stat {
  min-width: 110px;
}
.ledger-summary .stat-label {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}
.ledger-summary .stat-value {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
}
.ledger-summary .status-dist {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ledger-summary .summary-note {
  margin-top: 10px;
  font-size: 12px;
}

/* 派单防呆：手工派单折叠区的红字警告 */
.legacy-dispatch-warning {
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid #fecaca;
  border-radius: 6px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 13px;
  font-weight: 700;
}

/* #3 订单流转标签页（待派单 / 已派出 / 已完成） */
.dispatch-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}
.dispatch-tabs .dtab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  font-size: 14px;
  font-weight: 700;
  color: #6b7280;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.dispatch-tabs .dtab:hover { color: #1f2937; }
.dispatch-tabs .dtab.active { color: #2563eb; border-bottom-color: #2563eb; }
.dispatch-tabs .dtab-count {
  background: #eef2ff;
  color: #1e3a8a;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  padding: 0 7px;
  min-width: 18px;
  text-align: center;
}
.dispatch-tabs .dtab.active .dtab-count { background: #dbeafe; color: #1d4ed8; }

/* 按天查看：订单流转/台账 日期选择器 + 快捷翻 */
.toolbar-actions { display: flex; align-items: center; gap: 10px; }
.date-nav { margin: 0; display: inline-flex; align-items: center; gap: 6px; }
.date-nav input[type="date"],
.filters input[type="date"] {
  padding: 7px 9px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  font: inherit;
  color: #1f2937;
  background: #fff;
}
.date-step {
  padding: 6px 11px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
  color: #1f2937;
  font: inherit;
  line-height: 1;
  cursor: pointer;
}
.date-step:hover { background: #f3f4f6; }
.date-today {
  padding: 6px 10px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  color: #2563eb;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.date-today:hover { background: #eff6ff; }

/* #3 高空作业标记（风险 / 作业标记，非扣费条件） */
.badge-height {
  display: inline-block;
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fdba74;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 1px 7px;
  white-space: nowrap;
}
/* #3 售后单标记（挂原单） */
.badge-aftersales {
  display: inline-block;
  background: #faf5ff;
  color: #6b21a8;
  border: 1px solid #e9d5ff;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 1px 7px;
  white-space: nowrap;
}
/* #3 录入售后区 */
.aftersales-section {
  padding: 16px 0 18px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 16px;
}

/* #2 同客户加单标记（来源订单 provenance；与售后语义隔离） */
.badge-source {
  display: inline-block;
  background: #ecfeff;
  color: #155e75;
  border: 1px solid #a5f3fc;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 1px 7px;
  white-space: nowrap;
}
.same-customer-section {
  padding: 16px 0 18px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 16px;
}

/* ──────────────────────────────────────────────────────────────
   派单候选排序 v1a：本单横幅 + 今天路线候选卡 + 录单订单优先级
   ────────────────────────────────────────────────────────────── */
.order-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  margin-bottom: 12px;
  font-size: 14px;
}
.pri {
  font-size: 12px;
  font-weight: 800;
  border-radius: 6px;
  padding: 2px 9px;
}
.pri.high { color: #166534; background: #dcfce7; }
.pri.normal { color: #374151; background: #eef0f2; }
.pri.caution { color: #92400e; background: #fef3c7; }

.candidate-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 13px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  margin-bottom: 8px;
  cursor: pointer;
}
.candidate-card.recommended { border-color: #16a34a; box-shadow: 0 0 0 1px #16a34a33; }
.candidate-card.out-of-area { opacity: 0.62; }
.candidate-card input[type="radio"] { width: auto; flex: 0 0 auto; margin-top: 4px; }
.cc-body { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.cc-head { display: flex; align-items: center; gap: 8px; }
.cc-head strong { font-size: 15px; }
.cc-rank {
  font-size: 12px;
  font-weight: 800;
  color: #166534;
  background: #dcfce7;
  border-radius: 6px;
  padding: 1px 8px;
}
.cc-line { font-size: 13.5px; color: #374151; }
.cc-route { font-size: 13px; color: #374151; }
.cc-route .anchor { font-weight: 700; }
.cc-route .order { color: #2563eb; }
.chip-warn {
  font-size: 11px;
  color: #92400e;
  background: #fef3c7;
  border-radius: 5px;
  padding: 1px 6px;
}
.cc-why { font-size: 12.5px; margin-top: 1px; }
.cc-why.good { color: #166534; }
.cc-why.ok { color: #374151; }
.cc-why.back { color: #9ca3af; }
.cc-why.todo { color: #b45309; }

.pri-box {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 4px 0 14px;
  background: #fcfcfd;
}
.pri-box legend { font-size: 13px; font-weight: 800; padding: 0 6px; }
.pri-group { display: flex; gap: 8px; }
.pri-opt { flex: 1; }
.pri-opt input { position: absolute; opacity: 0; }
.pri-opt span {
  display: block;
  text-align: center;
  padding: 9px 0;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  color: #6b7280;
  background: #fff;
}
.pri-opt input:checked + span.good { border-color: #16a34a; color: #166534; background: #f0fdf4; }
.pri-opt input:checked + span.normal { border-color: #6b7280; color: #374151; background: #f9fafb; }
.pri-opt input:checked + span.caution { border-color: #d97706; color: #92400e; background: #fffbeb; }
.pri-help { margin-top: 10px; }
.pri-help summary { font-size: 12px; color: #2563eb; cursor: pointer; }
.pri-help ul { margin: 8px 0 0; padding-left: 18px; font-size: 12.5px; color: #4b5563; line-height: 1.7; }

/* 录单防错提示 + 提交前确认 */
.intake-warn {
  border: 1px solid #fca5a5;
  background: #fef2f2;
  color: #991b1b;
  font-size: 13.5px;
  line-height: 1.7;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.intake-success {
  border: 1px solid #86efac;
  background: #f0fdf4;
  color: #166534;
  font-weight: 700;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
}
.field-hint { margin-top: 4px; font-size: 12px; color: #6b7280; }
.confirm-line {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 4px 0 14px;
  padding: 10px 12px;
  border: 1.5px solid #fcd34d;
  background: #fffbeb;
  border-radius: 8px;
  font-size: 13.5px;
}
.confirm-line input { width: auto; flex: 0 0 auto; margin-top: 3px; }

/* 派单页：本单电话/地址醒目核对（功能#5）*/
.order-keyinfo {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  padding: 10px 14px;
  margin: 8px 0 12px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  border-radius: 10px;
  font-size: 15px;
}
.order-keyinfo .k { color: #6b7280; font-size: 12px; margin-right: 4px; }
.order-keyinfo .v { font-weight: 700; color: #111827; }

/* 录单页提交前话术提醒（促成师傅上门）*/
.readback-script {
  margin: 0 0 12px;
  padding: 9px 12px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e40af;
  border-radius: 8px;
  font-size: 13.5px;
  line-height: 1.6;
}

/* 预约时间：日期 + 上午/下午/夜间（点选高亮）+ 完整预约时间汇总 */
#appointment_date { max-width: 220px; }
.slot-picker { margin-top: 8px; }
.slot-group { margin-bottom: 8px; }
.slot-group-label { font-size: 12px; color: #6b7280; font-weight: 700; margin-bottom: 5px; }
.slot-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.period-chips { gap: 10px; }
.slot-chip {
  padding: 7px 13px;
  border: 1px solid #d1d5db;
  border-radius: 18px;
  background: #fff;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
}
.slot-chip:hover { border-color: #2563eb; }
.slot-chip.selected { background: #2563eb; border-color: #2563eb; color: #fff; font-weight: 700; }
.slot-chip:disabled { opacity: 0.4; cursor: not-allowed; text-decoration: line-through; }
.period-chip {
  min-width: 92px;
  padding: 10px 18px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 800;
}
.appt-summary {
  margin-top: 10px;
  padding: 9px 13px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #166534;
}
.appt-summary.empty { background: #f9fafb; border-color: #e5e7eb; color: #9ca3af; font-weight: 400; }
.appt-summary.error { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }

/* 录单页接电话话术（照着说）*/
.call-script {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
}
.call-script > summary { font-weight: 800; color: #1e40af; cursor: pointer; font-size: 14px; }
.call-steps { margin: 10px 0 6px; padding-left: 22px; font-size: 13.5px; line-height: 1.9; color: #1f2937; }
.call-faq { font-size: 13px; line-height: 1.8; color: #374151; border-top: 1px dashed #bfdbfe; padding-top: 8px; margin-top: 6px; }

/* ──────────────────────────────────────────────────────────────
   录单页 V2：双栏 + 侧边流程 stepper + 模块/话术/服务范围
   ────────────────────────────────────────────────────────────── */
.intake-layout { display: flex; gap: 20px; align-items: flex-start; }
.intake-main { flex: 1; min-width: 0; }
.order-tip { font-size: 13px; color: #374151; background: #fff; border: 1px dashed #cbd5e1; border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; }
.intake-faq { margin-bottom: 14px; font-size: 13px; }
.intake-faq > summary { color: #2563eb; cursor: pointer; }
.intake-faq .faq-body { padding: 8px 4px; line-height: 1.8; color: #374151; }
.module { border: 1px solid #e5e7eb; border-radius: 10px; padding: 13px 14px; margin-bottom: 14px; background: #fcfcfd; scroll-margin-top: 16px; }
.module > .mlabel { font-size: 13px; font-weight: 800; color: #111827; margin-bottom: 8px; }
.say { font-size: 12.5px; color: #1d4ed8; background: #eff6ff; border: 1px solid #dbeafe; border-radius: 6px; padding: 5px 9px; margin-bottom: 9px; }
.say::before { content: "💬 对客户说："; font-weight: 700; }
.unsupported-warn { display: none; margin-top: 8px; padding: 8px 11px; border: 1px solid #fde68a; background: #fffbeb; color: #92400e; border-radius: 8px; font-size: 13px; }
.cbline { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; color: #374151; margin-bottom: 7px; }
.cbline input { margin-top: 3px; width: auto; }

.flow-nav { width: 230px; flex: 0 0 230px; position: sticky; top: 20px; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 14px 12px; }
.flow-title { font-weight: 800; font-size: 14px; margin-bottom: 10px; padding-left: 6px; }
.flow-node { position: relative; display: flex; align-items: center; gap: 9px; padding: 9px 8px; border-radius: 8px; cursor: pointer; border: none; background: none; width: 100%; text-align: left; }
.flow-node:hover { background: #f9fafb; }
.flow-node:not(:last-child)::after { content: ''; position: absolute; left: 13px; top: 28px; height: 14px; border-left: 2px dashed #cbd5e1; }
.flow-node .dot { width: 11px; height: 11px; border-radius: 50%; background: #d1d5db; flex: 0 0 auto; }
.flow-node .fn-label { flex: 1; font-size: 13.5px; color: #374151; }
.flow-node .fn-status { font-size: 11.5px; color: #9ca3af; }
.flow-node.done .dot { background: #2563eb; } .flow-node.done .fn-status { color: #2563eb; }
.flow-node.warn .dot { background: #f59e0b; } .flow-node.warn .fn-status { color: #b45309; }
.flow-node.error .dot { background: #ef4444; } .flow-node.error .fn-status { color: #dc2626; }
@media (max-width: 900px) { .flow-nav { display: none; } .intake-layout { display: block; } }

/* ── 订单推进队列工作台 V1（运营，2026-06-10）───────────────────────────── */
.ops-msg { background: #ecfdf5; border: 1px solid #a7f3d0; color: #047857; border-radius: 8px; padding: 8px 12px; margin: 10px 0; font-size: 13px; }
.ops-overview { display: flex; gap: 7px; flex-wrap: wrap; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 9px; margin: 12px 0 14px; }
.ops-overview .ov { padding: 5px 11px; border-radius: 8px; font-size: 13px; color: #374151; border: 1px solid transparent; text-decoration: none; }
.ops-overview .ov b { font-size: 15px; margin-left: 2px; }
.ops-overview .ov:hover { background: #f3f4f6; }
.ops-overview .ov.active { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; font-weight: 700; }
.ops-overview .ov.danger b { color: #dc2626; }
.ops-main { display: flex; gap: 14px; align-items: flex-start; }
.ops-listwrap { flex: 1; min-width: 0; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; overflow: hidden; }
.ops-lh { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid #f0f0f0; }
.ops-lh b { font-size: 14px; }
.ops-batch { font-size: 12px; color: #6b7280; }
.ops-batch .bbtn { font-size: 12px; padding: 3px 10px; border: 1px solid #2563eb; color: #2563eb; border-radius: 6px; background: #fff; cursor: pointer; margin: 0 4px; }
.ops-batch .muted { margin-left: 4px; }
.ops-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ops-table th { text-align: left; font-size: 11.5px; color: #9ca3af; font-weight: 600; padding: 7px 12px; border-bottom: 1px solid #f0f0f0; background: #fafafa; }
.ops-table td { padding: 8px 12px; border-bottom: 1px solid #f5f5f5; color: #374151; vertical-align: middle; }
.ops-table tr:last-child td { border-bottom: none; }
.ops-table .cbcol { width: 26px; }
.ops-row.sel { background: #eff6ff; }
.ops-row:hover { background: #f9fafb; }
.ops-table .ok { color: #16a34a; }
.ops-table .warn { color: #b45309; font-weight: 700; }
.ops-table .err { color: #dc2626; font-weight: 700; }
.ops-table .muted { color: #9ca3af; }
.ops-table .sugg { color: #166534; font-size: 12px; }
.ops-empty { text-align: center; color: #9ca3af; padding: 20px; }
.ops-table td.acts { white-space: nowrap; }
.ops-table td.acts form { display: inline; }
.abtn { display: inline-block; font-size: 12px; padding: 3px 9px; border-radius: 6px; border: 1px solid #2563eb; background: #2563eb; color: #fff; cursor: pointer; text-decoration: none; margin-right: 3px; }
.abtn:hover { background: #1d4ed8; }
.abtn.ghost { background: #fff; color: #374151; border-color: #d1d5db; }
.abtn.ghost:hover { background: #f3f4f6; }
.abtn.warn { background: #fff; color: #b45309; border-color: #f59e0b; }
.pill { font-size: 11px; border-radius: 5px; padding: 1px 6px; }
.pill.flydan { color: #92400e; background: #fef3c7; }
/* 详情抽屉 */
.ops-drawer { flex: 0 0 320px; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 14px; }
.ops-drawer h3 { font-size: 14px; margin: 0 0 4px; }
.ops-drawer .dk { font-size: 12px; color: #9ca3af; margin-top: 10px; }
.ops-drawer .dv { font-size: 13px; color: #374151; }
.ops-drawer .dv.followup { white-space: pre-line; background: #fafafa; border-radius: 6px; padding: 6px 8px; margin-top: 4px; line-height: 1.6; }
.ops-drawer .dv.hint { font-size: 12px; color: #9ca3af; margin-top: 5px; }
.ops-drawer .dsection { border-top: 1px dashed #eee; margin-top: 10px; padding-top: 8px; }
.ops-drawer .drawer-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.ops-drawer .drawer-form input[type=text], .ops-drawer .drawer-form input[type=number], .ops-drawer .drawer-form select { font-size: 13px; padding: 4px 8px; border: 1px solid #d1d5db; border-radius: 6px; flex: 1; min-width: 120px; }
.ops-drawer .cbline { font-size: 12px; color: #6b7280; display: flex; align-items: center; gap: 4px; width: 100%; }
@media (max-width: 900px) { .ops-main { display: block; } .ops-drawer { margin-top: 14px; flex-basis: auto; } }

/* ── 半屏窄屏：侧栏塌顶 + 录单页窄版（总控 2026-06-10，纯 CSS；放最后 cascade 胜出）── */
@media (max-width: 1024px) {
  body { overflow-x: hidden; }
  /* 全局：220px 暗色侧栏 → 顶部细横条，主内容拿回 ~250px */
  .shell { grid-template-columns: 1fr; }
  .sidebar { padding: 7px 10px; display: flex; align-items: center; gap: 8px; overflow-x: auto; min-width: 0; max-width: 100vw; }
  .sidebar .brand { font-size: 13px; margin: 0; white-space: nowrap; }
  .sidebar .role { display: none; }                 /* 角色卡片窄屏隐藏，省竖向空间 */
  .nav { display: flex; gap: 5px; min-width: 0; flex: 1 1 auto; overflow-x: auto; } /* 竖排链接 → 横排 */
  .nav a, .logout button { width: auto; flex: 0 0 auto; padding: 6px 10px; font-size: 13px; white-space: nowrap; }
  .logout { margin-top: 0; flex: 0 0 auto; }
  .main { padding: 14px; min-width: 0; overflow-x: hidden; } /* 内容内边距收紧 */

  /* 录单页窄版：右侧竖栏 stepper → 顶部横条 + 模块压紧（不改 intake.html，靠 flex order） */
  .intake-layout { display: flex; flex-direction: column; gap: 10px; }
  .flow-nav { order: -1; width: auto; flex: none; position: static;
              display: flex; flex-wrap: wrap; gap: 5px; padding: 6px 8px; }
  .flow-title { display: none; }
  .flow-node { width: auto; padding: 4px 8px; }
  .flow-node:not(:last-child)::after { display: none; }   /* 横排不要竖虚线 */
  .flow-node .fn-label { flex: none; }
  .flow-node .fn-status { display: none; }                /* 状态靠圆点颜色，省横向空间 */
  .module { padding: 9px 11px; margin-bottom: 9px; }
  .module > .mlabel { margin-bottom: 5px; }
  .panel { padding: 13px; }
  .order-tip { padding: 6px 10px; margin-bottom: 9px; }
  .say { padding: 3px 8px; margin-bottom: 7px; }
}

/* ── 呼入工作台 A1：坐席条（录单页，flag 开才渲染）────────────────────────── */
.agent-bar { display: flex; align-items: center; gap: 10px; background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: 9px 14px; margin: 10px 0; font-size: 13px; }
.agent-bar .ab-idle { color: #94a3b8; }
.agent-bar .ab-call { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.agent-bar .ab-call b { color: #4ade80; }
.agent-bar #abCaller { font-size: 14.5px; font-weight: 700; letter-spacing: 0.5px; }
.agent-bar .ab-take { font-size: 12px; padding: 4px 12px; border-radius: 6px; border: 1px solid #22c55e; background: #22c55e; color: #04210f; font-weight: 700; cursor: pointer; }
.agent-bar .ab-take:hover { background: #16a34a; }
.agent-bar .ab-take:disabled { cursor: default; opacity: 0.75; background: #64748b; border-color: #64748b; color: #f8fafc; }
.agent-bar .ab-hist { font-size: 12px; color: #fbbf24; }
.agent-bar .ab-script { font-size: 12px; color: #7dd3fc; }
