:root {
  color-scheme: light;
  --page: #eef8fa;
  --sidebar: #ffffff;
  --panel: #ffffff;
  --soft: #f4f9fb;
  --text: #102033;
  --muted: #6e7f91;
  --line: #dce9ee;
  --primary: #10ad9f;
  --primary-dark: #078b81;
  --primary-soft: #dff7f3;
  --blue: #2d75d6;
  --blue-soft: #e7f0ff;
  --green: #19a85c;
  --green-soft: #e5f8ea;
  --amber: #e88a00;
  --amber-soft: #fff0d8;
  --danger-soft: #fdeaea;
  --danger: #8d2424;
  --shadow: 0 22px 50px rgba(31, 72, 86, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--page);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: 42px;
  line-height: 1.12;
  font-weight: 900;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: 24px;
  line-height: 1.25;
  font-weight: 900;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 34px 22px 24px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
}

.side-brand {
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

.side-brand strong {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
  font-size: 26px;
  font-weight: 900;
}

.side-brand strong span {
  font-size: 30px;
  letter-spacing: 0;
}

.side-brand span {
  color: var(--muted);
}

.side-nav {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.side-nav a {
  min-height: 54px;
  display: flex;
  align-items: center;
  border-radius: 18px;
  padding: 0 20px;
  color: #273f55;
  font-size: 18px;
  font-weight: 800;
}

.side-nav a:hover,
.side-nav a.active,
.side-nav a.active-soft {
  background: #e4f7f5;
  color: var(--primary-dark);
}

.identity-card {
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  background: #fbfefe;
}

.identity-card span {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
}

.identity-card strong {
  display: block;
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.main-area {
  min-width: 0;
  background:
    radial-gradient(circle at 15% 12%, rgba(16, 173, 159, 0.12), transparent 30%),
    linear-gradient(180deg, #f2fbfc 0%, #edf8fb 100%);
}

.main-topbar {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 46px 0;
}

.main-topbar strong {
  display: block;
  font-size: 16px;
}

.topbar-label {
  color: var(--muted);
  font-size: 13px;
}

.logout-button,
.ghost-button,
button,
.primary-button,
.small-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0 22px;
  background: #ffffff;
  color: #3c5268;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.logout-button:hover,
.ghost-button:hover,
button:hover,
.small-button:hover {
  color: var(--primary-dark);
  transform: translateY(-1px);
}

button:disabled,
.primary-button:disabled,
.small-button:disabled {
  cursor: wait;
  opacity: 0.7;
  transform: none;
}

.primary-button {
  border-color: transparent;
  background: var(--primary);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--primary-dark);
  color: #ffffff;
}

.small-button {
  min-height: 34px;
  border-radius: 12px;
  padding: 0 14px;
}

.danger-button {
  border-color: #f3c4c4;
  color: var(--danger);
}

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

.page {
  width: min(1320px, calc(100vw - 380px));
  margin: 28px auto 64px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.page-head p,
.muted,
.operation-card p,
.panel-title-row p,
.helper-text {
  color: var(--muted);
}

.success-banner,
.notice,
.flash {
  border-radius: 24px;
  padding: 16px 22px;
  margin-bottom: 18px;
}

.success-banner {
  background: #e8fae9;
  border: 0;
  color: #159343;
  font-weight: 800;
}

.notice {
  background: #fff7da;
  border: 1px solid #f3d47d;
  color: #725400;
}

.flash.success {
  background: var(--green-soft);
  color: var(--green);
}

.flash.error {
  background: var(--danger-soft);
  color: var(--danger);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 20px;
}

.home-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.home-metrics .metric-card {
  min-height: 150px;
}

.home-actions {
  min-height: 92px;
}

.home-actions .primary-button,
.home-actions .ghost-button {
  min-width: 138px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.metric-card {
  min-height: 138px;
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 22px;
  align-items: center;
  border-radius: 28px;
  padding: 26px 30px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  font-size: 20px;
  font-weight: 900;
}

.metric-icon.teal {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.metric-icon.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.metric-icon.green {
  background: var(--green-soft);
  color: var(--green);
}

.metric-icon.amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.metric-card span {
  color: var(--muted);
  font-size: 17px;
}

.metric-card strong {
  display: block;
  margin: 2px 0 8px;
  font-size: 44px;
  line-height: 1;
  font-weight: 900;
}

.metric-card small {
  color: var(--muted);
}

.scope-bar {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  border-radius: 28px;
  padding: 20px 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.scope-bar > div:first-child {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.scope-bar span {
  border-radius: 999px;
  padding: 8px 14px;
  background: #edf5fb;
  color: #526a80;
  font-weight: 800;
}

.scope-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  white-space: nowrap;
}

.operation-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  gap: 18px;
  margin-bottom: 20px;
}

.single-operation {
  grid-template-columns: 1fr;
}

.operation-card,
.data-panel,
.settings-section,
.customer-panel {
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.operation-card {
  min-height: 168px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 28px;
}

.inline-actions {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
}

.filter-grid {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 150px auto;
  gap: 12px;
}

.list-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  padding: 18px 20px;
  border-radius: 22px;
  background: var(--soft);
}

.list-filter-form {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 160px 96px 96px;
  gap: 12px;
  align-items: center;
}

.list-toolbar input,
.list-toolbar select,
.list-toolbar button,
.list-toolbar .ghost-button,
.list-toolbar .primary-button {
  min-height: 48px;
  border-radius: 18px;
}

.list-toolbar .ghost-button,
.list-toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  white-space: nowrap;
}

.list-toolbar > .primary-button {
  min-width: 188px;
  justify-content: center;
}

.bulk-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.toolbar-button {
  min-height: 48px;
  border-radius: 18px;
  padding: 0 18px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  color: var(--text);
  background: #ffffff;
  font: inherit;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(16, 173, 159, 0.12);
}

input[type="file"] {
  padding: 9px;
}

input[type="file"]::file-selector-button {
  height: 28px;
  margin-right: 10px;
  border: 0;
  border-radius: 10px;
  background: #edf5fb;
  color: #354c62;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.data-panel {
  padding: 26px;
}

.panel-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.panel-title-row span {
  color: var(--muted);
  white-space: nowrap;
}

.table-wrap {
  overflow: auto;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 18px;
}

.page-size-form,
.pager {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-size-form span {
  color: var(--muted);
  font-weight: 800;
}

.page-size-form select {
  width: 116px;
  min-height: 40px;
}

.pager a,
.pager span,
.pager strong {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border-radius: 14px;
  padding: 0 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  font-weight: 900;
}

.pager a:hover {
  color: var(--primary-dark);
}

.pager .disabled {
  color: #a2b0bd;
  background: #f4f9fb;
}

table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
}

th,
td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: #587085;
  font-weight: 900;
}

tbody tr:hover {
  background: #f8fcfd;
}

.checkbox-cell {
  width: 52px;
}

.checkbox-cell input {
  width: 16px;
  min-height: 16px;
  height: 16px;
}

.waybill-no {
  font-family: Consolas, "Courier New", monospace;
  font-size: 16px;
  font-weight: 900;
}

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

.row-actions form {
  margin: 0;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 12px;
  background: #edf5fb;
  color: #526a80;
  font-size: 13px;
  font-weight: 900;
}

.status.pending {
  background: var(--amber-soft);
  color: var(--amber);
}

.status.ordered {
  background: var(--green-soft);
  color: var(--green);
}

.empty {
  padding: 48px;
  text-align: center;
  color: var(--muted);
}

.empty-title {
  margin-bottom: 6px;
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
}

.auth-page,
.customer-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: linear-gradient(180deg, #f2fbfc 0%, #edf8fb 100%);
}

.auth-shell {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  overflow: hidden;
  border-radius: 32px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.auth-copy {
  min-height: 470px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 46px;
  background: linear-gradient(145deg, #0f766d, #102033);
  color: #ffffff;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
}

.brand-mark {
  width: 12px;
  height: 28px;
  border-radius: 4px;
  background: #ffffff;
  box-shadow: 8px 0 0 #99d23d;
}

.auth-copy h1 {
  max-width: 430px;
  margin: 28px 0 12px;
  color: #ffffff;
  font-size: 34px;
}

.auth-copy p {
  max-width: 430px;
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
}

.auth-panel {
  align-self: center;
  padding: 44px;
  background: #ffffff;
}

.panel-kicker {
  margin-bottom: 6px;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 900;
}

.form-stack {
  display: grid;
  gap: 16px;
}

label span {
  display: block;
  margin-bottom: 7px;
  color: #40576d;
  font-weight: 900;
}

.helper-text {
  margin: 14px 0 0;
}

.wide {
  width: 100%;
}

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

.settings-section {
  display: grid;
  gap: 14px;
  padding: 26px;
}

.settings-section.full,
.settings-actions {
  grid-column: 1 / -1;
}

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

.settings-actions {
  display: flex;
  justify-content: flex-end;
}

.customer-panel {
  width: min(680px, 100%);
  padding: 30px;
}

.mobile-card {
  border-radius: 26px;
}

.mobile-heading {
  margin-bottom: 18px;
}

.mobile-heading span {
  display: inline-flex;
  margin-bottom: 8px;
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 900;
}

.mobile-heading h1 {
  margin-bottom: 6px;
  font-size: 28px;
}

.mobile-heading p {
  margin-bottom: 0;
  color: var(--muted);
}

.mobile-form input,
.mobile-form select,
.mobile-form textarea {
  min-height: 48px;
  border-radius: 16px;
}

.form-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 2px;
}

.form-section-title strong {
  font-size: 17px;
}

.form-section-title span {
  margin: 0;
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.readonly-sender {
  margin-bottom: 22px;
  border-radius: 20px;
  padding: 16px;
  background: #f4f7f8;
  border: 1px solid var(--line);
}

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

.readonly-grid .wide-field {
  grid-column: 1 / -1;
}

.readonly-sender input[readonly] {
  color: #617080;
  background: #e9eef1;
  cursor: not-allowed;
}

.waybill-line {
  color: var(--muted);
  margin-bottom: 22px;
  border-radius: 16px;
  padding: 12px 14px;
  background: var(--soft);
}

.waybill-line strong {
  color: var(--text);
  font-family: Consolas, "Courier New", monospace;
}

.result-panel {
  text-align: center;
}

.success-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  font-size: 30px;
  font-weight: 900;
}

.track-result {
  max-height: 420px;
  overflow: auto;
  border-radius: 16px;
  padding: 16px;
  background: #f4f9fb;
  color: #102033;
  text-align: left;
  white-space: pre-wrap;
}

.empty-track {
  border-radius: 18px;
  padding: 22px;
  background: var(--soft);
  color: var(--muted);
  text-align: center;
  font-weight: 900;
}

.track-card {
  width: min(680px, 100%);
}

.track-summary {
  margin-bottom: 18px;
  border-radius: 18px;
  padding: 16px;
  background: var(--primary-soft);
}

.track-summary strong,
.track-summary span {
  display: block;
}

.track-summary span {
  margin-top: 4px;
  color: var(--muted);
}

.track-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.track-timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  padding-bottom: 18px;
}

.track-timeline li::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 18px;
  bottom: 0;
  width: 2px;
  background: var(--line);
}

.track-timeline li:last-child::before {
  display: none;
}

.track-dot {
  width: 16px;
  height: 16px;
  margin-top: 4px;
  border-radius: 50%;
  background: #b7c7d4;
  border: 4px solid #edf8fb;
}

.track-timeline li.latest .track-dot {
  background: var(--primary);
}

.track-content {
  border-radius: 18px;
  padding: 14px;
  background: #f8fcfd;
}

.track-timeline li.latest .track-content {
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(31, 72, 86, 0.08);
}

.track-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.track-row span,
.track-content small {
  color: var(--muted);
}

.track-content p {
  margin-bottom: 8px;
}

.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(10, 24, 38, 0.46);
}

.modal-backdrop[hidden] {
  display: none;
}

.detail-modal {
  width: min(980px, 100%);
  max-height: min(860px, calc(100vh - 56px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border-radius: 26px;
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(10, 24, 38, 0.26);
}

.detail-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 26px;
  border-bottom: 1px solid var(--line);
}

.detail-modal-head span {
  color: var(--muted);
  font-weight: 900;
}

.detail-modal-head h2 {
  margin: 3px 0 0;
  font-family: Consolas, "Courier New", monospace;
}

.modal-close {
  width: 42px;
  min-height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  padding: 0;
  font-size: 28px;
  line-height: 1;
}

.detail-modal-body {
  min-height: 0;
  overflow: auto;
  padding: 24px 26px 28px;
  background: #f6fbfc;
}

.detail-loading {
  border-radius: 18px;
  padding: 26px;
  background: #ffffff;
  color: var(--muted);
  text-align: center;
  font-weight: 900;
}

.detail-content {
  display: grid;
  gap: 18px;
}

.detail-section {
  border-radius: 22px;
  padding: 20px;
  background: #ffffff;
  box-shadow: 0 12px 32px rgba(31, 72, 86, 0.08);
}

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

.detail-section-title h3 {
  margin: 0;
  font-size: 18px;
}

.detail-section-title span {
  color: var(--muted);
  font-weight: 800;
}

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

.address-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: #fbfefe;
}

.address-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 900;
}

.address-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 18px;
}

.address-card p {
  margin-bottom: 6px;
  color: #3d5268;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.detail-meta span {
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--soft);
  color: var(--muted);
}

.detail-meta strong {
  color: var(--text);
  font-family: Consolas, "Courier New", monospace;
}

.admin-track-timeline {
  max-height: 430px;
  overflow: auto;
  padding-right: 4px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .page {
    width: calc(100vw - 280px);
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .side-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .main-topbar,
  .page-head,
  .scope-bar,
  .panel-title-row,
  .pagination-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .main-topbar {
    padding: 20px 18px 0;
  }

  .page {
    width: calc(100vw - 32px);
    margin-top: 20px;
  }

  h1 {
    font-size: 34px;
  }

  .metric-grid,
  .home-metrics,
  .settings-grid,
  .form-grid,
  .three-fields,
  .auth-shell,
  .inline-actions,
  .filter-grid,
  .list-filter-form,
  .list-toolbar {
    grid-template-columns: 1fr;
  }

  .bulk-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .modal-backdrop {
    padding: 12px;
  }

  .detail-modal {
    max-height: calc(100vh - 24px);
  }

  .detail-modal-head,
  .detail-modal-body {
    padding-left: 16px;
    padding-right: 16px;
  }

  .address-grid,
  .track-row {
    grid-template-columns: 1fr;
  }

  .track-row {
    display: grid;
  }
}
