:root {
  --navy: #003366;
  --navy-deep: #002244;
  --navy-mid: #0a4a86;
  --silver: #c0c0c0;
  --ground: #eef2f6;
  --card: #ffffff;
  --text: #1c2b3a;
  --muted: #5b6b7c;
  --success: #1b7a3d;
  --pending: #c47b00;
  --danger: #b42318;
  --awarded: #0b5cab;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(0, 31, 63, 0.08);
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--ground);
  font-size: 15px;
}

a { color: var(--navy-mid); }
a:hover { color: var(--navy); }

.topbar {
  background: #3d4650;
  color: #f3f5f7;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-align: center;
  padding: 7px 12px;
}

.navbar-prc {
  background: var(--navy);
  color: #fff;
  padding: 0 20px;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand {
  color: #fff;
  text-decoration: none;
  padding: 10px 16px 10px 0;
  margin-right: 12px;
  line-height: 1.1;
}
.brand strong { display: block; font-size: 18px; letter-spacing: 0.02em; }
.brand span { display: block; font-size: 10px; letter-spacing: 0.12em; color: var(--silver); }
.nav-links { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav-links a {
  color: #d7e4f2;
  text-decoration: none;
  padding: 20px 14px 16px;
  border-bottom: 3px solid transparent;
  font-size: 14px;
}
.nav-links a:hover, .nav-links a.active {
  color: #fff;
  border-bottom-color: #fff;
}
.nav-user { margin-left: auto; font-size: 13px; color: #d7e4f2; text-align: right; }
.nav-user a { color: #fff; }

.page { max-width: 1180px; margin: 24px auto; padding: 0 16px 48px; }
.page-wide { max-width: 1280px; }

.card-prc {
  background: var(--card);
  border: 1px solid #e3e8ee;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
}
.card-prc + .card-prc { margin-top: 16px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}
.stat {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  border: 1px solid #e3e8ee;
}
.stat label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.stat .n { font-size: 32px; font-weight: 700; color: var(--navy); line-height: 1; }
.stat .n.green { color: var(--success); }
.stat .n.gold { color: #b8860b; }

h1, h2, h3 { color: var(--navy); font-weight: 700; }
h1 { font-size: 26px; margin: 0 0 16px; }
h2 { font-size: 18px; margin: 0 0 12px; }

.table-prc { width: 100%; border-collapse: collapse; }
.table-prc th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 8px;
  border-bottom: 1px solid #e6ebf0;
  font-weight: 600;
}
.table-prc td { padding: 14px 8px; border-bottom: 1px solid #f0f3f6; vertical-align: middle; }
.table-prc tr:last-child td { border-bottom: none; }
.table-prc a.ref { font-weight: 700; color: var(--navy); text-decoration: none; }

.status-open { color: var(--success); font-weight: 600; }
.status-match { color: var(--pending); font-weight: 600; }
.status-awarded { color: var(--awarded); font-weight: 600; }
.status-dead { color: var(--danger); font-weight: 600; }
.status-draft { color: var(--muted); font-weight: 600; }
.status-conditional { color: #0b7a8a; font-weight: 600; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.badge-open { background: #e5f6ea; color: var(--success); }
.badge-match { background: #fff4dc; color: var(--pending); }
.badge-awarded { background: #e5f0da; color: var(--success); }
.badge-dead { background: #fde8e6; color: var(--danger); }
.badge-draft { background: #eef1f4; color: var(--muted); }

.btn-navy, .btn-navy:hover, .btn-navy:focus {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 10px 22px;
  border-radius: 8px;
}
.btn-mid, .btn-mid:hover {
  background: var(--navy-mid);
  border-color: var(--navy-mid);
  color: #fff;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 8px;
}
.btn-ghost {
  background: #4d5b6a;
  border-color: #4d5b6a;
  color: #fff;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 8px;
}
.btn-success-prc, .btn-success-prc:hover {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 8px;
}
.btn-danger-prc, .btn-danger-prc:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 8px;
}

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.filters label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.filters .field { min-width: 140px; flex: 1; }
.form-control, .form-select {
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  padding: 8px 10px;
}

.notice {
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #f6f8fb;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 14px;
}
.dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; flex: none; }
.dot-gold { background: var(--pending); }
.dot-red { background: var(--danger); }
.dot-green { background: var(--success); }

.alert-pending { background: #fff8e8; border: 1px solid #f1d48a; color: #7a4d00; border-radius: 10px; padding: 12px 14px; }
.alert-error { background: #fdecea; border: 1px solid #f3c0ba; color: #7a1f16; border-radius: 10px; padding: 12px 14px; }
.alert-ok { background: #eaf6ee; border: 1px solid #b7e0c3; color: #14532d; border-radius: 10px; padding: 12px 14px; }

.empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
}
.empty h3 { margin-bottom: 8px; }

.two-col { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 16px; }
.dl { display: grid; grid-template-columns: 180px 1fr; gap: 10px 16px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 600; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; gap: 12px; padding-bottom: 16px; }
.timeline .mark {
  width: 14px; height: 14px; border-radius: 50%; margin-top: 4px; flex: none;
  background: var(--silver);
}
.timeline .mark.done { background: var(--success); }
.timeline .mark.now { background: var(--pending); }
.timeline .mark.navy { background: var(--navy); }

.auth-body { background: var(--navy); min-height: 100%; }
.auth-wrap {
  min-height: calc(100vh - 32px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  background: #fff;
  width: 100%;
  max-width: 420px;
  border-radius: 16px;
  padding: 36px 32px 28px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.25);
  text-align: center;
}
.auth-card h1 { font-size: 28px; margin-bottom: 0; }
.auth-card .sub { color: var(--navy-mid); font-weight: 700; letter-spacing: 0.08em; font-size: 13px; margin: 6px 0 4px; }
.auth-card .hint { color: var(--muted); margin-bottom: 22px; }
.auth-card form { text-align: left; }
.auth-card .links { text-align: center; margin-top: 12px; font-size: 13px; }
.auth-foot { color: var(--muted); font-size: 12px; margin-top: 18px; text-align: center; }

.oem-banner {
  background: #c47b00;
  color: #fff;
  text-align: center;
  padding: 18px;
  border-radius: 12px 12px 0 0;
  letter-spacing: 0.08em;
  font-weight: 700;
}
.lead-pct { font-size: 42px; font-weight: 800; color: var(--navy); }

.loading-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(255,255,255,0.6);
  z-index: 40;
  align-items: center; justify-content: center;
}
.loading-overlay.show { display: flex; }
.spinner {
  width: 36px; height: 36px;
  border: 4px solid #d7e4f2;
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.nav-toggle { display: none; background: none; border: 0; color: #fff; font-size: 22px; }

.party-box { background: #eaf6ee; border: 1px solid #b7e0c3; border-radius: 10px; padding: 14px; }

@media (max-width: 900px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; }
  .nav-toggle { display: block; }
  .nav-links { display: none; width: 100%; flex-direction: column; }
  .nav-links.open { display: flex; }
  .navbar-prc { flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .nav-user { width: 100%; text-align: left; margin: 4px 0; }
  .table-wrap { overflow-x: auto; }
}

@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 24px 18px; }
}
