:root {
  color-scheme: dark;
  --bg: #0f1115;
  --panel: #171a21;
  --panel-alt: #1d2330;
  --border: #2a3140;
  --text: #ecf0f8;
  --muted: #9aa7bd;
  --accent: #4ecdc4;
  --warning: #ffb020;
  --danger: #ff6b6b;
  --success: #34d399;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #1b2230 0%, var(--bg) 55%);
  color: var(--text);
}

a {
  color: #8edbff;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar,
.section-head,
.panel-head,
.card-top,
.timeline-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  padding: 8px 0 32px;
}

.topbar h1,
.section-head h2,
.delivery-card h3,
.panel h3 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 12px;
}

.nav a,
.back-link,
.detail-link a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.02);
}

.nav a.is-active {
  border-color: var(--accent);
}

.section-head {
  margin-bottom: 20px;
}

.section-head p {
  margin: 8px 0 0;
  color: var(--muted);
}

.card-grid,
.detail-grid,
.dashboard-grid,
.stats-grid {
  display: grid;
  gap: 16px;
}

.card-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1fr) 340px;
  align-items: start;
}

.detail-grid {
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.delivery-card,
.panel,
.empty-state,
.stat-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.delivery-card,
.panel {
  padding: 18px;
}

.stat-card {
  padding: 18px;
  display: grid;
  gap: 6px;
}

.delivery-card.attention,
.timeline-item.attention {
  border-color: rgba(255, 176, 32, 0.45);
}

.carrier,
.timeline-count,
.reason,
.empty-copy,
.stat-label,
.stat-note,
.recent-summary {
  color: var(--muted);
}

.carrier {
  margin: 0 0 8px;
}

.stat-value {
  font-size: 32px;
  line-height: 1;
}

.section-head.compact {
  margin-top: 8px;
}

.view-switch {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.view-switch a,
.card-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.02);
}

.view-switch a.is-active {
  border-color: var(--accent);
  color: var(--text);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid var(--border);
  background: #20293a;
  text-transform: capitalize;
}

.status-ordered,
.status-shipped,
.status-in_transit,
.status-pickup_point {
  border-color: rgba(78, 205, 196, 0.35);
  color: #8cf2eb;
}

.status-out_for_delivery,
.status-delayed {
  border-color: rgba(255, 176, 32, 0.35);
  color: #ffd280;
}

.status-delivered {
  border-color: rgba(52, 211, 153, 0.35);
  color: #9af0c7;
}

.status-failed_delivery,
.status-action_required {
  border-color: rgba(255, 107, 107, 0.4);
  color: #ffb0b0;
}

.attention-flag {
  color: var(--warning);
  font-weight: 600;
}

.meta-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.meta-list.stacked,
.meta-list.compact {
  grid-template-columns: 1fr;
}

.meta-list dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.meta-list dd {
  margin: 0;
  word-break: break-word;
}

.summary {
  margin: 0 0 14px;
  line-height: 1.5;
}

.tracking-link,
.detail-link {
  margin: 0;
}

.card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.empty-state {
  padding: 28px;
}

.timeline {
  display: grid;
  gap: 14px;
}

.timeline-item {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.recent-list {
  display: grid;
  gap: 12px;
}

.recent-item {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.recent-title {
  margin: 10px 0 6px;
  font-weight: 600;
}

.recent-summary {
  margin: 0;
  line-height: 1.5;
}

@media (max-width: 800px) {
  .dashboard-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid,
  .meta-list {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-head,
  .panel-head,
  .card-top,
  .timeline-top {
    flex-direction: column;
  }
}
