:root {
  --bg: #e7eef0;
  --paper: #ffffff;
  --ink: #14202b;
  --muted: #5c6b76;
  --line: #d5dee3;
  --teal: #0e4d5c;
  --teal-2: #14697c;
  --rust: #d86a2a;
  --danger: #9f1239;
  --ok: #166534;
  --shadow: 0 16px 40px rgba(20, 40, 48, 0.08);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); font-variant-numeric: tabular-nums; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

#login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background:
    radial-gradient(circle at top left, rgba(216, 106, 42, 0.16), transparent 28%),
    linear-gradient(160deg, #0e4d5c 0%, #16343d 48%, #e7eef0 48%);
}
.login-card {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  background: var(--paper);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.login-intro { padding: 42px 40px; background: #10343d; color: #f4f7f6; }
.brand { margin: 0 0 12px; letter-spacing: 0.18em; color: #f0b48a; font-size: 13px; }
.login-intro h1 { margin: 0 0 22px; font-size: 32px; line-height: 1.35; font-weight: 700; }
.login-intro ol { margin: 0; padding-left: 18px; color: #d5e4e6; }
.login-intro li { margin: 10px 0; line-height: 1.55; }
.intro-note { margin: 22px 0 0; color: #f0b48a; }
#login-form { padding: 42px 36px; display: flex; flex-direction: column; }
#login-form h2 { margin: 8px 0 18px; font-size: 22px; }
#login-form label { margin: 10px 0 6px; color: var(--muted); font-size: 13px; }
#login-form input {
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  background: #f7fafb;
}
#login-form button {
  margin-top: 22px;
  height: 48px;
  border: 0;
  border-radius: 10px;
  background: var(--teal);
  color: white;
}
.accounts { margin-top: 18px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.accounts p { margin: 0; }

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 22px;
  background: #0e3d4c;
  color: white;
}
.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 180px; }
.brand-lockup p { margin: 2px 0 0; color: #c9dde2; font-size: 13px; }
.mark {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: var(--rust); border-radius: 10px; font-weight: 700;
}
.flow { display: flex; gap: 8px; list-style: none; margin: 0; padding: 0; flex: 1; }
.flow li {
  padding: 6px 10px; border-radius: 999px; background: rgba(255,255,255,0.08);
  color: #d5e4e6; font-size: 13px;
}
.flow li.me { background: var(--rust); color: white; }
.ghost, .accent, .filters button, .tab, .pager button, .text-btn {
  border-radius: 10px; border: 1px solid transparent;
}
.ghost { background: transparent; color: white; border-color: rgba(255,255,255,0.35); height: 38px; padding: 0 14px; }
main { width: min(1280px, calc(100% - 28px)); margin: 18px auto 40px; }
.summary { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.summary button {
  text-align: left; background: var(--paper); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 14px 12px; box-shadow: 0 1px 0 rgba(20,32,43,0.03);
}
.summary button:hover { border-color: #9db8c0; }
.summary span { display: block; color: var(--muted); font-size: 12px; }
.summary strong { display: block; margin-top: 6px; font-size: 26px; }
.rule { color: var(--muted); font-size: 13px; margin: 14px 0; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab { background: transparent; color: var(--muted); padding: 8px 12px; }
.tab.active { background: var(--teal); color: white; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.filters input, .filters select {
  height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; background: white;
}
.filters input[type="search"] { min-width: 260px; flex: 1; }
.filters button, #export { height: 40px; padding: 0 14px; background: var(--teal); color: white; }
#export { background: var(--rust); }
.table-wrap { overflow: auto; background: white; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; min-width: 980px; }
th, td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; vertical-align: top; }
th { color: var(--muted); font-weight: 600; background: #f6fafb; position: sticky; top: 0; }
th:last-child, td:last-child { position: sticky; right: 0; background: #fff; z-index: 1; }
th:last-child { background: #f6fafb; z-index: 2; }
tr.st-pending_dispatch td:first-child { box-shadow: inset 3px 0 0 #d86a2a; }
tr.st-pending_stats td:first-child { box-shadow: inset 3px 0 0 #14697c; }
tr.st-rejected td:first-child { box-shadow: inset 3px 0 0 #9f1239; }
tr.st-completed td:first-child { box-shadow: inset 3px 0 0 #166534; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.chip-pending_dispatch { background: #ffedd5; color: #9a3412; }
.chip-pending_stats { background: #d7eef2; color: #0f4c5c; }
.chip-rejected { background: #ffe4e6; color: #9f1239; }
.chip-completed { background: #dcfce7; color: #166534; }
.sub { display: block; color: var(--muted); font-size: 12px; }
.warn { color: #9a3412; font-size: 12px; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; color: var(--muted); }
.pager button { background: white; border-color: var(--line); height: 34px; padding: 0 12px; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.text-btn { background: var(--teal); color: white; border: 0; height: 32px; padding: 0 10px; }
.text-btn.light { background: white; color: var(--teal); border: 1px solid var(--line); }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }

.modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 24px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(16, 28, 34, 0.48); }
.modal-card {
  position: relative; width: min(980px, 100%); max-height: calc(100vh - 48px); overflow: auto;
  background: white; border-radius: 18px; padding: 22px; box-shadow: var(--shadow);
}
.modal-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.modal-head h3 { margin: 0; font-size: 22px; }
.icon-x { border: 0; background: #f3f6f7; width: 36px; height: 36px; border-radius: 10px; }
.detail-grid { display: grid; grid-template-columns: 300px 1fr; gap: 18px; margin-top: 16px; }
.slip { width: 100%; max-height: 520px; object-fit: contain; background: #f4efe6; border-radius: 12px; border: 1px solid var(--line); }
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 6px 8px; margin: 0 0 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.choice { display: flex; gap: 16px; margin: 8px 0 12px; }
.field { margin: 10px 0; }
.field span, .check { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.field input, .field textarea, .field select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #f7fafb;
}
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.actions button { height: 40px; padding: 0 14px; border-radius: 10px; border: 0; }
.btn-ok { background: var(--teal); color: white; }
.btn-back { background: white; color: var(--danger); border: 1px solid #f1c3cc !important; }
.price-line { font-size: 18px; font-weight: 700; }
.logs { list-style: none; margin: 8px 0 0; padding: 0; }
.logs li { padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.logs time { display: block; color: var(--muted); }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #14202b; color: white; padding: 12px 16px; border-radius: 12px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s; z-index: 50; max-width: min(520px, calc(100% - 24px));
}
.toast.show { opacity: 1; }
.toast.error { background: var(--danger); }

@media (max-width: 900px) {
  .login-card, .detail-grid, .summary { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; }
  .login-intro h1 { font-size: 26px; }
}
