:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --ink: #18201b;
  --muted: #667064;
  --line: #dfe4dc;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --warn: #b45309;
  --good: #15803d;
  --bad: #b91c1c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: 0;
}

p {
  margin: 6px 0 0;
  color: var(--muted);
}

main {
  width: min(1180px, calc(100vw - 32px));
  margin: 24px auto 48px;
}

.entry-panel,
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.entry-panel {
  padding: 18px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

textarea,
input {
  width: 100%;
  border: 1px solid #cdd5c9;
  border-radius: 6px;
  padding: 12px 14px;
  background: #fff;
  color: var(--ink);
}

textarea:focus,
input:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--accent);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin-top: 12px;
}

.primary,
.tab {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.primary {
  background: var(--accent);
  color: #fff;
  padding: 12px 16px;
  font-weight: 800;
}

.primary:hover {
  background: var(--accent-dark);
}

.primary:disabled,
.secondary:disabled {
  cursor: wait;
  opacity: 0.65;
}

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

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 18px 0;
}

.summary-grid div {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.summary-grid span {
  font-size: 32px;
  font-weight: 900;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin: 8px 0 12px;
}

.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tab {
  background: #e9eee6;
  color: #263026;
  padding: 9px 12px;
  font-weight: 700;
}

.tab.active {
  background: #1f2937;
  color: #fff;
}

#statusMessage {
  min-height: 24px;
  text-align: right;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: #4b5549;
  font-size: 13px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.tracking {
  font-weight: 850;
  letter-spacing: 0;
}

.note {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.inline-note {
  display: inline;
}

.eta {
  font-weight: 800;
  color: var(--ink);
}

.action-note {
  margin: 0 0 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 800;
  font-size: 13px;
}

.arrived {
  background: #dcfce7;
  color: var(--good);
}

.in_transit,
.pending {
  background: #e0f2fe;
  color: #0369a1;
}

.out_for_delivery {
  background: #fef3c7;
  color: #92400e;
}

.check_failed {
  background: #fee2e2;
  color: var(--bad);
}

.picked_up {
  background: #ede9fe;
  color: #6d28d9;
}

.secondary {
  border: 1px solid #cdd5c9;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  padding: 9px 12px;
  font-weight: 800;
}

.danger {
  border: 1px solid #fecaca;
  border-radius: 6px;
  background: #fff;
  color: var(--bad);
  cursor: pointer;
  padding: 9px 12px;
  font-weight: 800;
}

.compact {
  padding: 7px 9px;
  font-size: 13px;
}

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

.row-actions {
  margin-top: 8px;
}

.edit-row {
  margin-top: 8px;
}

.description-input {
  min-width: 220px;
  max-width: 360px;
  padding: 8px 10px;
}

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

@media (max-width: 760px) {
  .topbar,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .form-row,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  #statusMessage {
    text-align: left;
  }
}
