:root {
  --purple-900: #1e0a3c;
  --purple-800: #2d1157;
  --purple-700: #4a1a8a;
  --purple-600: #6b21a8;
  --purple-500: #7c3aed;
  --purple-400: #a78bfa;
  --purple-300: #c4b5fd;
  --purple-100: #ede9fe;
  --purple-50:  #f5f3ff;
  --gray-900:   #111827;
  --gray-700:   #374151;
  --gray-500:   #6b7280;
  --gray-300:   #d1d5db;
  --gray-100:   #f3f4f6;
  --green-600:  #059669;
  --green-100:  #d1fae5;
  --red-600:    #dc2626;
  --red-100:    #fee2e2;
  --yellow-600: #d97706;
  --yellow-100: #fef3c7;
  --blue-600:   #2563eb;
  --blue-100:   #dbeafe;
  --radius:     8px;
  --shadow:     0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg:  0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-100);
  color: var(--gray-900);
  min-height: 100vh;
}
a { color: var(--purple-600); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Nav ─────────────────────────────────────────────────────── */
.navbar {
  background: linear-gradient(135deg, var(--purple-900), var(--purple-700));
  color: #fff;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-lg);
}
.navbar .brand {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: .5rem;
  letter-spacing: -.02em;
}
.navbar .brand span { color: var(--purple-300); }
.navbar nav { display: flex; gap: 1rem; align-items: center; }
.navbar nav a, .navbar nav button {
  color: rgba(255,255,255,.85);
  background: none;
  border: none;
  cursor: pointer;
  font-size: .875rem;
  padding: .4rem .75rem;
  border-radius: var(--radius);
  transition: background .15s;
}
.navbar nav a:hover, .navbar nav button:hover {
  background: rgba(255,255,255,.15);
  text-decoration: none;
  color: #fff;
}
.nav-role {
  font-size: .7rem;
  background: rgba(255,255,255,.18);
  padding: .15rem .5rem;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ── Pages ───────────────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

/* ── Hero / public tracking ──────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--purple-800) 0%, var(--purple-600) 100%);
  color: #fff;
  text-align: center;
  padding: 5rem 2rem 4rem;
}
.hero h1 { font-size: 2.5rem; font-weight: 800; margin-bottom: .5rem; }
.hero p { font-size: 1.1rem; opacity: .85; margin-bottom: 2rem; }
.track-form {
  max-width: 500px;
  margin: 0 auto;
  display: flex;
  gap: .5rem;
}
.track-form input {
  flex: 1;
  padding: .75rem 1rem;
  border: 2px solid transparent;
  border-radius: var(--radius);
  font-size: 1rem;
  outline: none;
}
.track-form input:focus { border-color: var(--purple-400); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  padding: .6rem 1.25rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}
.btn-primary { background: var(--purple-600); color: #fff; }
.btn-primary:hover { background: var(--purple-700); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-secondary:hover { background: var(--gray-300); }
.btn-danger { background: var(--red-600); color: #fff; }
.btn-danger:hover { opacity: .9; }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }

/* ── Cards / containers ──────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 2rem; }
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.card h2 { font-size: 1.1rem; margin-bottom: 1rem; }
.card h3 { font-size: .95rem; color: var(--gray-700); margin-bottom: .75rem; }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: .3rem;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: .55rem .75rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: .875rem;
  outline: none;
  transition: border .15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--purple-500);
  box-shadow: 0 0 0 3px var(--purple-100);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ── Login ───────────────────────────────────────────────────── */
.login-wrapper {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--purple-50) 0%, var(--gray-100) 100%);
}
.login-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
}
.login-card h2 {
  text-align: center;
  margin-bottom: .25rem;
  font-size: 1.5rem;
}
.login-card .subtitle {
  text-align: center;
  color: var(--gray-500);
  font-size: .85rem;
  margin-bottom: 1.5rem;
}
.login-card .btn { width: 100%; justify-content: center; padding: .75rem; }
.login-error {
  background: var(--red-100);
  color: var(--red-600);
  padding: .5rem .75rem;
  border-radius: var(--radius);
  font-size: .8rem;
  margin-bottom: 1rem;
  display: none;
}

/* ── Status badges ───────────────────────────────────────────── */
.badge {
  font-size: .7rem;
  font-weight: 700;
  padding: .2rem .5rem;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: .03em;
  white-space: nowrap;
}
.badge-green  { background: var(--green-100); color: var(--green-600); }
.badge-yellow { background: var(--yellow-100); color: var(--yellow-600); }
.badge-red    { background: var(--red-100); color: var(--red-600); }
.badge-blue   { background: var(--blue-100); color: var(--blue-600); }
.badge-purple { background: var(--purple-100); color: var(--purple-600); }

/* ── Table ───────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
thead { background: var(--gray-100); }
th { font-weight: 600; text-align: left; padding: .6rem .75rem; color: var(--gray-700); }
td { padding: .6rem .75rem; border-bottom: 1px solid var(--gray-100); }
tbody tr:hover { background: var(--purple-50); cursor: pointer; }

/* ── Tabs ────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--gray-300); margin-bottom: 1.5rem; }
.tab-btn {
  padding: .5rem 1rem;
  font-size: .85rem;
  font-weight: 600;
  border: none;
  background: none;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s;
}
.tab-btn.active { color: var(--purple-600); border-bottom-color: var(--purple-600); }

/* ── Timeline ────────────────────────────────────────────────── */
.timeline { padding-left: 1.5rem; border-left: 2px solid var(--purple-300); }
.timeline-item { position: relative; padding: .5rem 0 1rem 1rem; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.65rem;
  top: .65rem;
  width: 10px;
  height: 10px;
  background: var(--purple-500);
  border-radius: 50%;
  border: 2px solid #fff;
}
.timeline-status { font-weight: 600; font-size: .9rem; }
.timeline-time { font-size: .75rem; color: var(--gray-500); }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  width: 100%;
  max-width: 550px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal h2 { margin-bottom: 1rem; }

/* ── Dashboard stats ─────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  text-align: center;
}
.stat-card .stat-num { font-size: 2rem; font-weight: 800; color: var(--purple-600); }
.stat-card .stat-label { font-size: .75rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: .05em; }

/* ── Misc ────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); font-size: .85rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mb-2 { margin-bottom: 1rem; }
.flex-between { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--gray-500); }
.empty-state svg { width: 64px; height: 64px; margin-bottom: 1rem; opacity: .4; }

/* ── Footer ──────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 2rem;
  color: var(--gray-500);
  font-size: .75rem;
  border-top: 1px solid var(--gray-300);
  margin-top: 3rem;
}
