:root { --bg: #ffffff; --fg: #111827; --muted: #6b7280; --primary: #38bdf8; --card: #ffffff; --accent: #22d3ee; --btn-blue: #3ba7ff; --btn-blue-hover: #2f8ef7; --control-h: 36px; --control-w: 96px; --ui-font: clamp(12px, 3.2vw, 14px); }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.app { max-width: 900px; margin: 0 auto; padding: 16px; }
.header { text-align: center; padding: 16px 0; }
.header h1 { margin: 0; font-size: 20px; }
.header .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.card { background: var(--card); border: 1px solid #1f2937; border-radius: 12px; padding: 16px; box-shadow: 0 8px 24px rgba(0,0,0,.1); }
.card { margin-bottom: 12px; }
label { display: block; font-size: var(--ui-font); color: var(--muted); margin-bottom: 8px; }
.field { display: flex; gap: 8px; flex-wrap: nowrap; }
input { flex: 1 1 auto; min-width: 0; height: var(--control-h); padding: 0 12px; border-radius: 10px; border: 1px solid #334155; background: #ffffff; color: var(--fg); outline: none; line-height: var(--control-h); font-size: var(--ui-font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
select { padding: 0 12px; border-radius: 10px; border: 1px solid #334155; background: #ffffff; color: var(--fg); height: var(--control-h); min-width: clamp(64px, 22vw, var(--control-w)); -webkit-appearance: none; -moz-appearance: none; appearance: none; text-align: center; text-align-last: center; -moz-text-align-last: center; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%236b7280' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px 16px; padding-right: 36px; font-size: var(--ui-font); white-space: nowrap; }
select option { background: #ffffff; color: var(--fg); }
.custom-select { position: relative; display: inline-block; }
.custom-select-toggle { display: inline-flex; align-items: center; justify-content: center; height: var(--control-h); min-width: var(--control-w); padding: 0 36px 0 12px; border: 1px solid #334155; border-radius: 10px; background: #ffffff; color: var(--fg); font-size: var(--ui-font); cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%236b7280' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px 16px; white-space: nowrap; }
.custom-select-menu { position: absolute; top: calc(100% + 6px); left: 0; background: #ffffff; border: 1px solid #334155; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.08); width: 100%; min-width: 100%; padding: 6px 0; display: none; z-index: 1000; max-height: 240px; overflow: auto; }
.custom-select.open .custom-select-menu { display: block; }
.custom-select-menu li { list-style: none; padding: 8px 12px; font-size: var(--ui-font); color: var(--fg); cursor: pointer; }
.custom-select-menu li:hover { background: #f8fafc; }
.custom-select select { display: none; }
button { display: inline-flex; align-items: center; justify-content: center; padding: 0 16px; border-radius: 10px; border: 1px solid transparent; background: var(--btn-blue); color: #ffffff; font-weight: 400; cursor: pointer; transition: background-color .15s ease, box-shadow .15s ease; height: var(--control-h); width: auto; min-width: 0; font-size: var(--ui-font); white-space: nowrap; }
button:hover { background: var(--btn-blue-hover); }
.tips { margin-top: 8px; color: var(--muted); font-size: 12px; }
.footer { text-align: center; color: var(--muted); font-size: var(--ui-font); padding: 16px; }
.footer .mail-btn { color: var(--btn-blue); text-decoration: none; cursor: pointer; font-size: var(--ui-font); }
.footer .mail-btn:hover { color: var(--btn-blue-hover); }
.footer .version { white-space: nowrap; }
.hidden { display: none; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: grid; grid-template-columns: 12px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px dashed #1f2937; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--primary); align-self: center; }
.item h3 { margin: 0; font-size: 14px; }
.item .meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.error { color: #fecaca; }
.center { text-align: center; }
.raw { margin-top: 12px; background: #ffffff; border: 1px solid #334155; border-radius: 12px; padding: 12px; overflow: auto; max-height: 240px; }
.history-title { font-size: var(--ui-font); color: var(--muted); margin: 0; }
.history-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; white-space: nowrap; }
.history-actions { display: flex; align-items: center; gap: 8px; }
.pager { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.pager-info { font-size: var(--ui-font); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-footer { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 12px; white-space: nowrap; }
.history-footer .pager-info { min-width: 0; text-align: center; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; justify-content: center; height: var(--control-h); }
.clear-all { font-size: var(--ui-font); color: var(--fg); background: #ffffff; border: 1px solid #334155; border-radius: 10px; padding: 0 12px; height: var(--control-h); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.refresh-all { display: inline-flex; align-items: center; justify-content: center; height: var(--control-h); font-size: var(--ui-font); color: #ffffff; background: var(--btn-blue); border: 1px solid transparent; border-radius: 10px; padding: 0 12px; cursor: pointer; transition: background-color .15s ease; }
.refresh-all:hover { background: var(--btn-blue-hover); }
.history-list { list-style: none; padding: 0; margin: 0; }
.history-item { border-top: 1px dashed #1f2937; }
/* 最近查询的运单显示淡淡的黄色背景 */
.history-item.recently-queried {
  background-color: rgba(255, 251, 191, 0.5);
  transition: background-color 0.3s ease;
}

/* 查询失败的运单显示蓝色背景 */
.history-item.query-failed {
  background-color: rgba(191, 219, 254, 0.5);
  transition: background-color 0.3s ease;
}

/* 查询失败提示词样式 */
.failed-hint {
  font-size: 12px;
  color: #3b82f6;
  margin-left: 8px;
  white-space: nowrap;
}
.history-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 12px 0; white-space: nowrap; }
.history-header .title { flex: 1; min-width: 0; }
.history-item { cursor: pointer; }
#result .card { cursor: pointer; }
.title .latest { display: block; margin-left: 0; margin-top: 4px; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.title .latest-track { display: grid; grid-template-columns: 10px 1fr; gap: 10px; align-items: start; margin-top: 6px; }
.title .latest-track .dot { width: 10px; height: 10px; margin-top: 3px; }
.title .latest-track .meta { color: var(--muted); font-size: 12px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-item.open .title .latest-track { display: none; }
/* 状态行折叠/展开位置不变；展开时隐藏「目的/包裹数」段（正文已有完整信息行） */
.history-item.open .title .latest .extra-info { display: none; }
/* 兜底：浏览器数据检测器可能把编号转成 <a>，强制继承父级颜色且不可点 */
.title a, #result .meta a, .timeline .meta a {
  color: inherit !important;
  text-decoration: none !important;
  pointer-events: none;
}
a[x-apple-data-detectors] {
  color: inherit !important;
  text-decoration: none !important;
  pointer-events: none;
}
.title .title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; white-space: nowrap; }
.title .right-tools { display: inline-flex; align-items: center; gap: 8px; }
.title .left { display: flex; align-items: flex-start; gap: 8px; white-space: nowrap; }
.title .days { font-size: 12px; color: var(--muted); }
.title .days.danger { color: #ef4444; }
.title .bill.stale { color: #ef4444; }
.title .state { font-size: 12px; color: #ef4444; display: inline-flex; align-items: center; justify-content: space-evenly; min-width: 4em; white-space: nowrap; }
.title .state .ch { display: inline-block; flex: 0 0 auto; }
.title .updating-title { font-size: 12px; color: #ef4444; opacity: 0.85; }
.history-body { position: relative; }
.loading { position: absolute; top: 8px; right: 12px; font-size: 12px; color: #ef4444; opacity: 0.85; pointer-events: none; }
.history-header .right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.history-header .updating { font-size: 12px; color: #ef4444; opacity: 0.85; }
.history-header .title { font-size: 14px; color: var(--fg); }
.history-header .btn { display: inline-flex; align-items: center; justify-content: center; height: var(--control-h); font-size: var(--ui-font); color: #ffffff; background: var(--btn-blue); border: 1px solid transparent; border-radius: 10px; padding: 0 12px; cursor: pointer; transition: background-color .15s ease; }
.history-header .btn:hover { background: var(--btn-blue-hover); }
.history-header .delete-one { font-size: var(--ui-font); color: var(--muted); cursor: pointer; background: transparent; border: none; padding: 0; }
.history-body { display: none; padding-bottom: 12px; }
.history-item.open .history-body { display: block; }
.group { border-top: 1px dashed #1f2937; }
.group-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 0; cursor: pointer; }
.group-title { font-size: 14px; color: var(--fg); }
.group-status { font-size: 12px; color: var(--muted); }
.group-body { display: none; padding-bottom: 12px; }
.group.open .group-body { display: block; }

/* 备注区域样式 */
.history-note {
  padding: 8px 0;
}

.note-input {
  width: 100%;
  height: 32px;
  padding: 0 12px;
  border: 1px solid #334155;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--fg);
  font-size: 12px;
  resize: none;
  outline: none;
  overflow: hidden;
  white-space: nowrap;
  line-height: 32px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.note-input::placeholder {
  color: #9ca3af;
}

.note-input:focus {
  border-color: var(--btn-blue);
  background: #ffffff;
}

@media (max-width: 480px) {
  .field .custom-select { flex: 0 0 100px; }
  .field input { flex: 1 1 auto; min-width: 0; }
  .field button { flex: 0 0 88px; }
  .history-footer { flex-wrap: wrap; }
  #pageSizeWrap { flex: 0 0 100px; }
  .history-footer .pager { flex: 1 1 auto; justify-content: flex-end; }
  .history-header { white-space: normal; }
  .history-header .title { min-width: 0; }
  .title .left { flex: 1 1 auto; min-width: 0; }
  .title .right-tools { flex: 0 0 auto; }
  .title .latest { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .title .latest-track .meta { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}
.field button { width: auto; min-width: 0; flex: 0 0 auto; }
.pager .btn { flex: 1 1 0; min-width: 0; }
