:root {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: #202c36;
  background: #f6f7f9;
  font-synthesis: none;
  --ink: #202c36;
  --muted: #7b8793;
  --line: #e5e9ee;
  --green: #16795b;
  --green-bg: #ebf7f0;
  --amber: #936214;
  --amber-bg: #fff5df;
  --accent: #254edb;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-size: 14px;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  outline-offset: 3px;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
a {
  color: inherit;
  text-decoration: none;
}
.topbar {
  height: 76px;
  background: white;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 40px;
  gap: 48px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.5px;
}
.brand-icon {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 9px;
  background: var(--ink);
  color: white;
  font-size: 24px;
  line-height: 1;
  padding-bottom: 5px;
}
nav {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 100%;
}
nav a {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #76818d;
  border-bottom: 2px solid transparent;
  padding-top: 2px;
  font-weight: 500;
}
nav a:hover {
  color: var(--ink);
}
nav a.active {
  border-color: var(--ink);
  color: var(--ink);
}
.nav-count {
  font-size: 11px;
  background: #eef1f5;
  border-radius: 5px;
  min-width: 20px;
  text-align: center;
  padding: 2px 5px;
}
.nav-count:empty {
  display: none;
}
.upload-actions {
  margin-left: auto;
  display: flex;
  gap: 10px;
}
.button {
  border: 1px solid #dce2e8;
  background: #fff;
  border-radius: 7px;
  color: var(--ink);
  padding: 10px 15px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: background 0.15s;
}
.button:hover {
  background: #f3f5f8;
}
.button.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: white;
}
.button.primary:hover {
  background: #364755;
}
.button.danger {
  background: #b74242;
  border-color: #b74242;
  color: white;
}
.button.small {
  padding: 8px 12px;
  font-size: 13px;
}
.button.link {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 6px 2px;
}
.button:disabled {
  cursor: default;
  opacity: 0.45;
}
main {
  max-width: 1640px;
  margin: auto;
  padding: 34px 40px 64px;
}
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.page-head h1 {
  font-size: 27px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.7px;
  margin: 0;
}
.muted {
  color: var(--muted);
}
.subline {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
}
.head-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 24px;
}
.stat {
  padding: 21px 25px;
  border-right: 1px solid var(--line);
}
.stat:last-child {
  border: 0;
}
.stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 9px;
}
.stat-value {
  font-size: 27px;
  font-weight: 550;
  letter-spacing: -0.6px;
  font-variant-numeric: tabular-nums;
}
.stat-value.green {
  color: var(--green);
}
.stat-value span {
  font-size: 14px;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search {
  min-width: 220px;
  max-width: 380px;
  flex: 1;
}
.input,
input[type="search"],
input[type="date"],
input[type="text"],
input[type="number"],
select,
textarea {
  border: 1px solid #dfe4ea;
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  padding: 9px 11px;
  min-height: 37px;
}
.input:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #c2cffa;
  border-color: #8d9dc9;
}
input[type="checkbox"] {
  accent-color: var(--green);
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.segmented {
  display: flex;
  align-items: center;
  gap: 3px;
  background: #eaeef2;
  padding: 3px;
  border-radius: 7px;
}
.segmented button {
  border: 0;
  background: transparent;
  color: #73808b;
  border-radius: 5px;
  padding: 7px 12px;
  font-size: 12px;
  white-space: nowrap;
}
.segmented button.active {
  background: white;
  color: var(--ink);
  box-shadow: 0 1px 3px #0000000d;
}
.right {
  margin-left: auto;
}
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.table-scroll {
  overflow: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
th {
  text-align: left;
  background: #fafbfc;
  color: #7a8591;
  font-weight: 500;
  padding: 12px 17px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
td {
  padding: 14px 17px;
  border-bottom: 1px solid #edf0f3;
  vertical-align: middle;
  max-width: 430px;
}
tr:last-child td {
  border-bottom: none;
}
tr.clickable {
  cursor: pointer;
}
tr.clickable:hover td {
  background: #f7f9fc;
}
.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.strong {
  font-weight: 600;
}
.nowrap {
  white-space: nowrap;
}
.small-text {
  font-size: 12px;
}
.clip {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 300px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  background: #eff2f5;
  color: #76818d;
}
.badge.green {
  background: var(--green-bg);
  color: var(--green);
}
.badge.amber {
  background: var(--amber-bg);
  color: var(--amber);
}
.badge.blue {
  background: #edf2fe;
  color: #4761af;
}
.dot {
  width: 6px;
  height: 6px;
  display: inline-block;
  border-radius: 50%;
  background: currentColor;
}
.coverage {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 120px;
}
.track {
  height: 4px;
  width: 68px;
  overflow: hidden;
  background: #e9edf1;
  border-radius: 4px;
}
.track i {
  display: block;
  height: 100%;
  background: #9bb0a6;
}
.complete .track i {
  background: var(--green);
}
tr.complete td:first-child {
  box-shadow: inset 3px 0 var(--green);
}
tr.linked td:first-child {
  box-shadow: inset 3px 0 var(--green);
}
.linked-mark {
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  background: var(--green-bg);
  color: var(--green);
  border-radius: 50%;
  font-size: 11px;
}
.empty {
  text-align: center;
  color: var(--muted);
  padding: 65px 20px;
}
.empty strong {
  color: #505f6d;
  display: block;
  margin-bottom: 10px;
  font-weight: 500;
}
.empty .button {
  margin-top: 16px;
}
.back {
  color: var(--muted);
  font-size: 13px;
  display: inline-block;
  margin-bottom: 18px;
}
.back:hover {
  color: var(--ink);
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 28px 0 13px;
}
.section-title h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}
.goods-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.goods-card {
  padding: 17px 18px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 8px;
}
.goods-card h3 {
  font-size: 13px;
  font-weight: 500;
  margin: 0 0 10px;
}
.goods-card strong {
  font-size: 20px;
  font-weight: 550;
  display: block;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
}
.goods-card .small-text {
  margin-top: 8px;
}
.detail-table td {
  padding: 12px 13px;
}
.detail-table th {
  padding: 12px 13px;
}
.detail-table .address {
  min-width: 220px;
  max-width: 300px;
  font-size: 12px;
}
.detail-table .organization {
  min-width: 150px;
  max-width: 210px;
  font-size: 12px;
}
.detail-table .driver {
  min-width: 170px;
  max-width: 220px;
}
.cell-stack {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.calc {
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
  line-height: 1.6;
}
.pill-group {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.doc-grid {
  display: grid;
  grid-template-columns: minmax(330px, 450px) 1fr;
  min-height: 660px;
  gap: 18px;
}
.doc-list {
  background: white;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: auto;
  max-height: calc(100vh - 240px);
}
.doc-item {
  width: 100%;
  text-align: left;
  display: block;
  border: none;
  border-bottom: 1px solid var(--line);
  background: white;
  padding: 19px 20px;
  color: var(--ink);
  cursor: pointer;
}
.doc-item.active {
  background: #eff3fb;
  box-shadow: inset 3px 0 #6f86bc;
}
.doc-item:hover {
  background: #f6f8fb;
}
.doc-item-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}
.doc-preview {
  background: #e5e8ed;
  border: 1px solid #dce2e8;
  border-radius: 9px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.preview-head {
  background: #fff;
  padding: 12px 17px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.doc-preview iframe {
  width: 100%;
  height: calc(100vh - 285px);
  min-height: 510px;
  border: 0;
}
.dictionary-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 22px;
}
.dictionary-tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dictionary-tabs button {
  background: none;
  border: none;
  text-align: left;
  padding: 12px 14px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 500;
}
.dictionary-tabs button.active {
  background: #e8edf3;
  color: var(--ink);
}
.dictionary-table td:nth-child(2) {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.dictionary-table td:first-child {
  width: 34%;
}
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 17px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.pagination .button {
  padding: 5px 9px;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  width: min(580px, calc(100vw - 40px));
  max-height: 90vh;
  box-shadow: 0 22px 90px #1e293b33;
  color: var(--ink);
}
dialog.wide {
  width: min(1200px, calc(100vw - 40px));
}
dialog::backdrop {
  background: #17253266;
  backdrop-filter: blur(2px);
}
.modal-head {
  padding: 23px 25px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}
.close {
  border: none;
  background: none;
  font-size: 24px;
  font-weight: 300;
  color: var(--muted);
  padding: 0 4px;
  line-height: 1;
}
.modal-body {
  padding: 22px 25px;
  max-height: calc(90vh - 155px);
  overflow: auto;
}
.modal-foot {
  padding: 16px 25px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
  background: #fafbfc;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 16px;
}
.field:last-child {
  margin-bottom: 0;
}
.field label {
  font-size: 12px;
  color: #677684;
}
.field textarea {
  resize: vertical;
  min-height: 110px;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.note {
  background: #f3f5f8;
  color: #64717e;
  border-radius: 7px;
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.6;
  margin-bottom: 16px;
}
.note.warning {
  background: var(--amber-bg);
  color: var(--amber);
}
.error {
  color: #b74242;
  font-size: 13px;
  padding: 8px 0;
}
.error:empty {
  display: none;
}
.conflict-list {
  max-height: 180px;
  overflow: auto;
  margin: 10px 0;
  font-size: 12px;
  color: #6d7680;
  line-height: 1.7;
}
.link-summary {
  display: flex;
  gap: 24px;
  align-items: center;
  margin-bottom: 18px;
}
.link-summary strong {
  margin-left: auto;
  font-size: 20px;
  white-space: nowrap;
}
.selection-table {
  max-height: 310px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.selection-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.selection-table td {
  padding: 10px 12px;
  font-size: 12px;
}
.selection-table td .input {
  width: 110px;
  text-align: right;
}
.form-footer-total {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  margin-top: 15px;
  font-size: 13px;
}
.service-detail {
  display: flex;
  gap: 15px;
  align-items: center;
}
.status-message {
  font-size: 12px;
  color: var(--muted);
  margin: 12px 0;
}
.alert-strip {
  background: var(--amber-bg);
  color: var(--amber);
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 14px;
  font-size: 12px;
}
#toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%) translateY(15px);
  border-radius: 8px;
  background: #243540;
  color: white;
  padding: 13px 20px;
  box-shadow: 0 5px 25px #0002;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
  max-width: 90vw;
  font-size: 13px;
}
#toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
#busy {
  position: fixed;
  inset: 0;
  background: #f6f7f9d9;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: #586a76;
  font-size: 14px;
}
#busy[hidden] {
  display: none;
}
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #dbe2e9;
  border-top-color: #526576;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.file-tag {
  font-size: 11px;
  letter-spacing: 0.4px;
  font-weight: 600;
  color: #728298;
  border: 1px solid #dce3ed;
  padding: 3px 5px;
  border-radius: 4px;
}
.inline-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}
.count-note {
  font-size: 12px;
  color: var(--muted);
}
.service-route {
  min-width: 230px;
  max-width: 440px;
  line-height: 1.6;
}
.calculation-line {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.7;
}
.calculation-line:last-child {
  border: 0;
}
.manual-box {
  width: 105px !important;
  min-height: 31px !important;
  padding: 6px 8px !important;
}
.total-number {
  font-variant-numeric: tabular-nums;
}
.pdf-service-link {
  border: 0;
  background: none;
  color: var(--accent);
  padding: 0;
  font-size: 12px;
  cursor: pointer;
}
.check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
}
.hidden {
  display: none !important;
}
@media (max-width: 1100px) {
  .topbar {
    padding: 0 22px;
    gap: 25px;
  }
  nav {
    gap: 18px;
  }
  main {
    padding: 26px 22px;
  }
  .stats .stat {
    padding: 19px;
  }
  .stat-value {
    font-size: 23px;
  }
  .doc-grid {
    grid-template-columns: 330px 1fr;
  }
  .upload-actions {
    gap: 5px;
  }
}
@media (max-width: 780px) {
  .topbar {
    height: auto;
    flex-wrap: wrap;
    padding: 15px 16px 0;
    gap: 12px;
  }
  .brand {
    font-size: 18px;
  }
  .upload-actions {
    order: 2;
  }
  nav {
    order: 3;
    width: 100%;
    justify-content: space-between;
    height: 43px;
    gap: 12px;
  }
  main {
    padding: 24px 16px;
  }
  .page-head {
    align-items: flex-start;
  }
  .page-head h1 {
    font-size: 24px;
  }
  .stats {
    grid-template-columns: 1fr 1fr;
  }
  .stat:nth-child(2) {
    border-right: none;
  }
  .stat:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }
  .stat-value {
    font-size: 23px;
  }
  .toolbar {
    gap: 9px;
  }
  .search {
    max-width: none;
  }
  .segmented {
    overflow: auto;
    max-width: 100%;
  }
  .doc-grid {
    grid-template-columns: 1fr;
  }
  .doc-list {
    max-height: 300px;
  }
  .dictionary-layout {
    grid-template-columns: 1fr;
  }
  .dictionary-tabs {
    flex-direction: row;
  }
  .field-row {
    grid-template-columns: 1fr;
  }
  .link-summary {
    flex-wrap: wrap;
  }
  .link-summary strong {
    margin-left: 0;
  }
  .head-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .stats .stat {
    padding: 15px;
  }
  .modal-body {
    padding: 18px;
  }
  .modal-head,
  .modal-foot {
    padding: 18px;
  }
  .goods-summary {
    grid-template-columns: 1fr 1fr;
  }
}

.pdf-pages {
  height: calc(100vh - 285px);
  min-height: 510px;
  overflow: auto;
  padding: 18px;
  background: #e5e8ed;
}
.pdf-pages figure {
  margin: 0 0 20px;
}
.pdf-pages img {
  display: block;
  width: 100%;
  height: auto;
  background: white;
  box-shadow: 0 2px 8px #0002;
}
.pdf-pages figcaption {
  text-align: center;
  font-size: 11px;
  color: #73808e;
  padding: 9px;
}
.pdf-pages figure:last-child {
  margin-bottom: 0;
}
.address-picker { max-height: 240px; overflow-y: auto; margin-top: 10px; border: 1px solid #dce3eb; border-radius: 6px; }
.field .address-option { display: flex; gap: 10px; padding: 10px; align-items: flex-start; cursor: pointer; }
.address-option[hidden] { display: none; }
.address-option input { width: auto; margin-top: 3px; flex-shrink: 0; }
.user-guide { max-width: 1080px; margin: 0 auto; line-height: 1.7; }
.user-guide section { margin: 32px 0; scroll-margin-top: 110px; }
.user-guide h2 { margin: 0 0 15px; font-size: 21px; }
.user-guide h3 { margin: 22px 0 10px; font-size: 17px; }
.user-guide p { margin: 12px 0; }
.user-guide li { margin: 8px 0; }
.user-guide p a, .guide-toc a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.guide-intro { max-width: 85ch; color: #536170; }
.guide-toc { padding: 22px 26px; margin: 24px 0; }
.guide-toc ol { columns: 2; column-gap: 35px; padding-left: 20px; }
.guide-toc li { break-inside: avoid; }
.user-guide td, .user-guide th { white-space: normal; vertical-align: top; line-height: 1.6; }
.user-guide code { overflow-wrap: anywhere; }
.guide-formula { padding: 18px; border-left: 3px solid var(--accent); background: white; }
@media (max-width: 1100px) {
  .topbar { flex-wrap: wrap; height: auto; padding-top: 12px; gap: 12px; }
  .topbar nav { order: 3; width: 100%; height: 43px; overflow-x: auto; }
  .topbar nav a { flex-shrink: 0; white-space: nowrap; }
}
@media (max-width: 780px) {
  .guide-toc ol { columns: 1; }
  .user-guide section { scroll-margin-top: 180px; }
}
@media print {
  .user-guide { padding: 0; max-width: none; }
  body { background: white; }
  .topbar, .user-guide > .button { display: none; }
  .user-guide .table-scroll { overflow: visible; }
  .user-guide section { margin: 20px 0; }
  .user-guide h2, .user-guide h3 { break-after: avoid; }
  .user-guide tr { break-inside: avoid; }
}
[hidden] { display: none !important; }
.auth-card { max-width: 360px; margin: 12vh auto; display: grid; gap: 18px; padding: 28px; background: white; border: 1px solid #dce3e8; border-radius: 12px; }
.auth-card label { display: grid; gap: 8px; }
.auth-card input { width: 100%; min-width: 0; }
.auth-card h1, .auth-card h2 { margin: 0; }
