:root {
  --navy: #1b2559;
  --navy-dark: #10143a;
  --blue: #1878c6;
  --blue-light: #2f9bdb;
  --gold: #c9a24b;
  --bg: #f2f4f9;
  --card: #ffffff;
  --text: #1b1f2e;
  --muted: #6b7280;
  --border: #e6e9f2;
  --success: #189b56;
  --success-bg: #e6f7ee;
  --danger: #d64545;
  --danger-bg: #fdecec;
  --warn: #a9791a;
  --warn-bg: #fdf3de;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 20, 58, 0.05), 0 1px 1px rgba(16, 20, 58, 0.03);
  --shadow-md: 0 8px 24px rgba(16, 20, 58, 0.08);
  --shadow-lg: 0 24px 60px rgba(16, 20, 58, 0.28);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', 'Segoe UI', Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: linear-gradient(120deg, var(--navy-dark) 0%, var(--navy) 60%, #1c2a66 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.75rem;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand { display: flex; align-items: center; gap: 0.65rem; }
.topbar .brand img { height: 36px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-title { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.brand-role { font-size: 0.72rem; color: var(--gold); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.topbar nav { display: flex; align-items: center; }
.topbar nav a {
  color: #cfd9f0; margin-left: 1.15rem; font-size: 0.88rem; font-weight: 500;
  padding: 0.35rem 0; border-bottom: 2px solid transparent; transition: color 0.15s, border-color 0.15s;
}
.topbar nav a:hover { color: #fff; text-decoration: none; border-bottom-color: var(--gold); }
.topbar .user-chip { color: #fff; font-size: 0.85rem; margin-left: 1.3rem; font-weight: 600; background: rgba(255,255,255,0.08); padding: 0.35rem 0.8rem; border-radius: 999px; }
.topbar form { display: inline; }
.topbar button.link-btn {
  background: none; border: none; color: #cfd9f0; cursor: pointer; font-size: 0.86rem; margin-left: 1rem; padding: 0; font-family: inherit;
}
.topbar button.link-btn:hover { color: #fff; text-decoration: underline; }

.container { max-width: 1150px; margin: 0 auto; padding: 1.8rem 1.6rem; }
.container.narrow { max-width: 560px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s;
}
.card.table-card { padding: 0; overflow: hidden; }
.card.table-card table { margin: 0; }
.card.table-card h2 { padding: 1.2rem 1.5rem 0; margin-bottom: 0.4rem; }

.grid { display: grid; gap: 1.1rem; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 700px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
}

.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem;
  box-shadow: var(--shadow-sm);
}
.stat .num { font-size: 1.9rem; font-weight: 800; color: var(--navy); letter-spacing: -0.02em; }
.stat .label { color: var(--muted); font-size: 0.83rem; margin-top: 0.25rem; font-weight: 500; }

h1, h2, h3 { color: var(--navy); font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.1rem; margin: 0 0 0.9rem; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.7rem 1rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; background: #f8f9fd; }
tbody tr { transition: background 0.1s; }
tbody tr:hover td { background: #f7f9fd; }
tbody tr:last-child td { border-bottom: none; }
.row-link { color: var(--navy); font-weight: 600; }
.row-link:hover { color: var(--blue); text-decoration: none; }

.badge {
  display: inline-block; padding: 0.25rem 0.65rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700;
  background: var(--blue); color: #fff; letter-spacing: 0.01em;
}
.badge.muted { background: #eef1f7; color: var(--navy); }
.badge.success { background: var(--success-bg); color: var(--success); }

label { display: block; font-size: 0.85rem; font-weight: 600; margin: 0.9rem 0 0.35rem; color: var(--navy); }
input[type=text], input[type=tel], input[type=password], input[type=date], input[type=email], input[type=number], input[type=month], select, textarea {
  width: 100%; padding: 0.6rem 0.75rem; border: 1.5px solid var(--border); border-radius: 8px; font-size: 0.94rem; font-family: inherit;
  background: #fff; transition: border-color 0.15s, box-shadow 0.15s; color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(24, 120, 198, 0.12);
}
textarea { min-height: 80px; resize: vertical; }
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.8rem; }
.checkbox-row input { width: auto; }

.checkbox-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.5rem 0.8rem;
  background: #f8f9fd; border: 1px solid var(--border); border-radius: 8px; padding: 0.9rem;
}
.checkbox-item { display: flex; align-items: center; gap: 0.4rem; font-size: 0.87rem; font-weight: 500; color: var(--text); margin: 0; cursor: pointer; }
.checkbox-item input { width: auto; margin: 0; accent-color: var(--blue); }

.btn {
  display: inline-block; padding: 0.6rem 1.2rem; border-radius: 8px; border: none; cursor: pointer;
  background: var(--blue); color: #fff; font-size: 0.92rem; font-weight: 700; font-family: inherit;
  box-shadow: 0 2px 6px rgba(24, 120, 198, 0.25); transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}
.btn:hover { background: var(--blue-light); text-decoration: none; box-shadow: 0 4px 12px rgba(24, 120, 198, 0.32); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: #eef1f7; color: var(--navy); box-shadow: none; }
.btn.secondary:hover { background: #e2e7f2; box-shadow: none; }
.btn.danger { background: var(--danger); box-shadow: 0 2px 6px rgba(214, 69, 69, 0.25); }
.btn.small { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

.alert { padding: 0.75rem 1.1rem; border-radius: 8px; margin-bottom: 1.1rem; font-size: 0.9rem; font-weight: 500; }
.alert.error { background: var(--danger-bg); color: var(--danger); }
.alert.success { background: var(--success-bg); color: var(--success); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at top left, #1c2a66, var(--navy-dark) 60%); padding: 1.5rem; }
.login-card { background: #fff; border-radius: 18px; padding: 2.5rem 2.2rem; width: 100%; max-width: 380px; box-shadow: var(--shadow-lg); text-align: center; }
.login-card img { height: 72px; margin-bottom: 1rem; }
.login-card h1 { margin-bottom: 1.5rem; font-size: 1.3rem; }
.login-card .btn { width: 100%; margin-top: 1.1rem; padding: 0.75rem; }

.timeline { list-style: none; padding: 0; margin: 1rem 0; }
.timeline li { position: relative; padding: 0 0 1.4rem 1.7rem; border-left: 2px solid var(--border); }
.timeline li:last-child { border-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ''; position: absolute; left: -6.5px; top: 2px; width: 11px; height: 11px; border-radius: 50%; background: var(--blue); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--blue); }
.timeline li.current::before { background: var(--success); box-shadow: 0 0 0 4px var(--success-bg), 0 0 0 2px var(--success); }
.timeline .stage-name { font-weight: 700; color: var(--navy); font-size: 0.98rem; }
.timeline .stage-date { color: var(--muted); font-size: 0.78rem; margin-top: 0.1rem; }
.timeline .stage-note { color: var(--text); font-size: 0.88rem; margin-top: 0.3rem; background: #f8f9fd; padding: 0.4rem 0.6rem; border-radius: 6px; display: inline-block; }

.track-hero { background: linear-gradient(135deg, var(--navy-dark), var(--navy) 70%); color: #fff; padding: 2.6rem 1.5rem; text-align: center; }
.track-hero img { height: 62px; margin-bottom: 0.7rem; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.3)); }
.track-hero .status-pill { display: inline-block; margin-top: 0.8rem; background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.2); padding: 0.45rem 1.1rem; border-radius: 999px; font-weight: 600; font-size: 0.9rem; }

.progress-track { max-width: 340px; margin: 1.1rem auto 0; height: 8px; background: rgba(255,255,255,0.15); border-radius: 999px; overflow: hidden; }
.progress-track-fill { height: 100%; background: linear-gradient(90deg, var(--gold), #e6c877); border-radius: 999px; transition: width 0.4s ease; }

.search-card { max-width: 420px; margin: -3.5rem auto 0; position: relative; box-shadow: var(--shadow-lg); }

.stepper { list-style: none; margin: 0; padding: 0; }
.stepper-item { display: flex; gap: 1rem; position: relative; padding-bottom: 1.6rem; }
.stepper-item:last-child { padding-bottom: 0; }
.stepper-item::before {
  content: ''; position: absolute; left: 15px; top: 34px; bottom: 0; width: 2px; background: var(--border);
}
.stepper-item:last-child::before { display: none; }
.stepper-item.completed::before { background: var(--success); }
.stepper-marker {
  flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem; font-weight: 700; background: #eef1f7; color: var(--muted); border: 2px solid var(--border); z-index: 1;
}
.stepper-item.completed .stepper-marker { background: var(--success); color: #fff; border-color: var(--success); }
.stepper-item.current .stepper-marker { background: var(--blue); color: #fff; border-color: var(--blue); box-shadow: 0 0 0 5px var(--success-bg); animation: pulse-current 2s infinite; }
@keyframes pulse-current {
  0% { box-shadow: 0 0 0 0 rgba(24, 120, 198, 0.35); }
  70% { box-shadow: 0 0 0 8px rgba(24, 120, 198, 0); }
  100% { box-shadow: 0 0 0 0 rgba(24, 120, 198, 0); }
}
.stepper-content { padding-top: 0.35rem; }
.stepper-name { font-weight: 700; color: var(--navy); font-size: 0.98rem; }
.stepper-item.upcoming .stepper-name { color: var(--muted); font-weight: 600; }
.stepper-date { color: var(--muted); font-size: 0.78rem; margin-top: 0.15rem; }
.stepper-note { color: var(--text); font-size: 0.86rem; margin-top: 0.35rem; background: #f8f9fd; padding: 0.4rem 0.65rem; border-radius: 6px; display: inline-block; }

.filters { display: flex; gap: 0.8rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1.1rem; }
.filters > div { min-width: 170px; }
.filters label { margin-top: 0; }

.field-hint { color: var(--muted); font-size: 0.8rem; margin-top: 0.3rem; line-height: 1.5; }
.top-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.2rem; flex-wrap: wrap; gap: 0.6rem; }
