/* Claude-style: warm off-white background, thin borders, subtle accents */

:root {
  --bg: #faf9f6;
  --surface: #ffffff;
  --border: #e8e6df;
  --border-strong: #d4d2c8;
  --text: #1f1e1c;
  --text-muted: #6b6a64;
  --accent: #c96442;
  --accent-soft: #f5e6de;
  --ok: #3d7a4a;
  --ok-soft: #e8f1e9;
  --warn: #b77400;
  --warn-soft: #fbeed2;
  --danger: #b4371f;
  --danger-soft: #fbe3dc;
  --shadow: 0 1px 2px rgba(30, 28, 24, 0.04);
  --radius: 8px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter,
    "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px;
}

.site-header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* Stat cards */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  box-shadow: var(--shadow);
}

.stat-card:hover {
  border-color: var(--border-strong);
}

.stat-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-family: var(--font-mono);
}

/* Controls */
.controls {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

#search {
  flex: 1 1 260px;
  min-width: 200px;
}

.controls input,
.controls select,
.controls button {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.controls input:focus,
.controls select:focus {
  border-color: var(--accent);
}

.controls button {
  cursor: pointer;
  color: var(--text-muted);
}

.controls button:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

/* Table */
.table-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  color: var(--text-muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: #f7f5ef;
  letter-spacing: 0.02em;
}

tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr {
  cursor: pointer;
  transition: background 0.1s;
}

tbody tr:hover {
  background: #f9f7f1;
}

/* Exception 行：浅红底，让需要跟进的单一眼可见 */
tbody tr.row-exception td {
  background: var(--danger-soft);
}
tbody tr.row-exception:hover td {
  background: #f8d6cc;
}

/* Delivered 行：默认被过滤掉；显示时整行划线 + 灰化，弱化优先级 */
tbody tr.row-delivered td {
  color: var(--text-muted);
}
tbody tr.row-delivered td:not(:last-child) {
  text-decoration: line-through;
  text-decoration-color: var(--border-strong);
}

td.mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

/* Tracking-number links: understated until hover, so the table stays clean.
   Dashed underline hints "clickable" without shouting. */
a.tracking-link {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px dashed var(--border-strong);
  transition: color 0.15s, border-color 0.15s;
}

a.tracking-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
  text-decoration: none;
}

/* Status pills */
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
}
.pill-delivered {
  background: var(--ok-soft);
  color: var(--ok);
}
.pill-in-transit {
  background: var(--warn-soft);
  color: var(--warn);
}
.pill-exception {
  background: var(--danger-soft);
  color: var(--danger);
}

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

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 28, 24, 0.35);
}

.modal-panel {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 640px;
  width: calc(100% - 32px);
  max-height: 80vh;
  overflow: auto;
  padding: 24px 28px;
  box-shadow: 0 8px 24px rgba(30, 28, 24, 0.12);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
}

.modal-panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 600;
}

.modal-panel h3 {
  margin: 18px 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

dl {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 6px 12px;
  margin: 0;
  font-size: 13px;
}

dl dt {
  color: var(--text-muted);
}

dl dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 1px solid var(--border-strong);
}

.timeline li {
  position: relative;
  padding: 8px 0 8px 16px;
  margin-left: 6px;
  font-size: 13px;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 14px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline-time {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  display: block;
  margin-bottom: 2px;
}

/* Footer */
.site-footer {
  max-width: 1200px;
  margin: 24px auto 48px;
  padding: 0 24px;
  font-size: 12px;
  color: var(--text-muted);
}

.site-footer .dot {
  margin: 0 6px;
}

/* Responsive */
@media (max-width: 720px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .site-header h1 {
    font-size: 18px;
  }
  thead th,
  tbody td {
    padding: 10px;
  }
}
