*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f6fa;
  --surface: #fff;
  --border: #e2e6ef;
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --radius: 6px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Top Bar */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar h1 {
  font-size: 18px;
  font-weight: 600;
}
.stats {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Main */
.main {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px;
}

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.search-box {
  display: flex;
  flex: 1;
  gap: 8px;
}
.search-box input {
  flex: 1;
  max-width: 400px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
.search-box input:focus { border-color: var(--primary); }

button {
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
  font-weight: 500;
  transition: background .15s;
}
#searchBtn {
  background: var(--primary);
  color: #fff;
}
#searchBtn:hover { background: var(--primary-hover); }
.btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-secondary:hover { background: #f3f4f6; }

/* Table */
.table-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
thead { background: #f9fafb; }
th {
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

.tracking-no {
  font-family: "SF Mono", "Fira Code", monospace;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.loc-cell {
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-secondary);
  font-size: 13px;
}

.detail-link {
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
}
.detail-link:hover { text-decoration: underline; }

.no-data {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-secondary);
  font-size: 14px;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
}
.pagination button {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
}
.pagination button:hover { background: #f3f4f6; }
.pagination button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.pagination button:disabled {
  opacity: .4;
  cursor: default;
}
.pagination .page-info {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 8px;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: 8px;
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 16px; }
.modal-close {
  width: 32px; height: 32px;
  font-size: 20px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.modal-close:hover { background: #f3f4f6; }
.modal-body { padding: 20px; }

.detail-grid {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 10px 16px;
  font-size: 14px;
}
.detail-grid dt {
  font-weight: 600;
  color: var(--text-secondary);
}
.detail-grid dd {
  word-break: break-all;
}
.photo-preview {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.photo-preview img {
  width: 100%;
  display: block;
}
.map-link {
  display: inline-block;
  margin-top: 4px;
  color: var(--primary);
  font-size: 13px;
}
