/* ── Reset & base ────────────────────────────────────────────────── */
:root {
  font-family: system-ui, -apple-system, Segoe UI, sans-serif;
  color: #17202a;
  background: #f3f6f9;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: #0b63ce; text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin-top: 0; }
ul, ol { line-height: 1.8; }
code { background: #eef2f7; padding: 2px 5px; border-radius: 4px; }

/* ── Navbar ──────────────────────────────────────────────────────── */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  background: #0f1720;
  color: white;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.nav-brand {
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.nav-links a { color: #cdd9e5; font-weight: 500; text-decoration: none; }
.nav-links a:hover { color: white; }
.nav-user { color: #aeb8c2; font-size: .9rem; }
.btn-link {
  background: transparent;
  border: 1px solid rgba(255,255,255,.4);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: .9rem;
}
.btn-link:hover { background: rgba(255,255,255,.1); }

/* ── Layout ──────────────────────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 28px auto;
  padding: 0 20px;
}

/* ── Cards ───────────────────────────────────────────────────────── */
.hero, .card {
  background: white;
  border: 1px solid #dde5ee;
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.hero {
  background: linear-gradient(135deg, #fff, #edf5ff);
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.narrow {
  max-width: 480px;
  margin: 40px auto;
}
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.page-header h1 { margin: 0; }

/* ── Stat cards ──────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: white;
  border: 1px solid #dde5ee;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.stat-number { font-size: 2.4rem; font-weight: 800; color: #0b63ce; }
.stat-label  { color: #64748b; font-size: .9rem; margin-top: 4px; }

/* ── Forms ───────────────────────────────────────────────────────── */
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  margin-bottom: 14px;
}
input, select, textarea {
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font: inherit;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid #0b63ce;
  outline-offset: 1px;
}
input[type="file"] { background: #f8fafc; }
textarea { min-height: 80px; resize: vertical; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
.form-footer { text-align: center; margin-top: 16px; color: #64748b; }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  background: #0f5ea8;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: #0a4d8c; text-decoration: none; color: white; }
.btn-secondary { background: #334155; }
.btn-secondary:hover { background: #1e293b; }
.btn-sm { padding: 6px 12px; font-size: .88rem; }
.btn-full { width: 100%; text-align: center; }
.btn-danger { background: #b91c1c; }

/* ── Tables ──────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5edf5;
  text-align: left;
  vertical-align: middle;
}
.table th { color: #475569; font-size: .88rem; text-transform: uppercase; letter-spacing: .04em; }
.table-sm th, .table-sm td { padding: 7px 10px; font-size: .9rem; }
.row-inactive { opacity: .55; }
.nowrap { white-space: nowrap; }
.actions { white-space: nowrap; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── Pills / badges ──────────────────────────────────────────────── */
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 700;
  white-space: nowrap;
  background: #e2e8f0;
  color: #334155;
}
.pill-admin   { background: #dbeafe; color: #1e40af; }
.pill-vet     { background: #d1fae5; color: #065f46; }
.pill-musher  { background: #ede9fe; color: #4c1d95; }
.pill-ok, .pill-approved { background: #dcfce7; color: #166534; }
.pill-warning, .pill-expires-soon { background: #fef3c7; color: #92400e; }
.pill-error, .pill-expired, .pill-missing { background: #fee2e2; color: #991b1b; }

/* ── Flash messages ──────────────────────────────────────────────── */
.flash-messages { margin-bottom: 18px; }
.flash {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 8px;
  color: #7c2d12;
}

/* ── Hero actions ────────────────────────────────────────────────── */
.hero-actions { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }

/* ── Footer ──────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 28px;
  color: #94a3b8;
  font-size: .88rem;
  margin-top: 40px;
  border-top: 1px solid #e5edf5;
}

/* ── Utilities ───────────────────────────────────────────────────── */
.muted { color: #64748b; }

/* ── Status pill variants ────────────────────────────────────────── */
.pill-status-approved          { background: #dcfce7; color: #166534; }
.pill-status-approved-with-warnings { background: #fef3c7; color: #92400e; }
.pill-status-approved-with-issues   { background: #fee2e2; color: #991b1b; }
.pill-status-date-warning      { background: #fef3c7; color: #92400e; }
.pill-status-needs-review      { background: #fef9c3; color: #713f12; }
.pill-status-withdrawn         { background: #f1f5f9; color: #64748b; }
.pill-status-roster-ok         { background: #dcfce7; color: #166534; }
.pill-status-roster-short,
.pill-status-dog-issues        { background: #fee2e2; color: #991b1b; }
.pill-status-roster-not-set    { background: #f1f5f9; color: #64748b; }
.pill-vax-ok-through-race      { background: #dcfce7; color: #166534; }
.pill-vax-expires-soon         { background: #fef3c7; color: #92400e; }
.pill-vax-expired,
.pill-vax-expires-before-race,
.pill-vax-missing              { background: #fee2e2; color: #991b1b; }
.pill-vax-needs-review         { background: #fef9c3; color: #713f12; }

/* ── Musher portal ───────────────────────────────────────────────── */
.status-summary { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.stat-chip      { padding: 6px 14px; border-radius: 999px; background: #e2e8f0; font-weight: 700; font-size: .9rem; }
.chip-ok        { background: #dcfce7; color: #166534; }
.chip-error     { background: #fee2e2; color: #991b1b; }
.chip-warn      { background: #fef3c7; color: #92400e; }

.grid-3col { grid-template-columns: repeat(3, 1fr); }

.vax-group { display: flex; flex-direction: column; gap: 8px; padding: 14px; background: #f8fafc; border-radius: 10px; border: 1px solid #e2e8f0; }
.vax-group strong { font-size: .95rem; }

.dog-card { border: 1px solid #dde5ee; border-radius: 12px; padding: 16px; margin-bottom: 14px; background: #fafafa; }
.dog-card summary { cursor: pointer; font-size: 1rem; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dog-card summary::-webkit-details-marker { display: none; }
.dog-card summary::before { content: '▶'; font-size: .75rem; color: #94a3b8; transition: transform .2s; }
details[open].dog-card summary::before { transform: rotate(90deg); }
.dog-edit-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid #e5edf5; }
.doc-section { margin-top: 16px; padding-top: 16px; border-top: 1px solid #e5edf5; }
.upload-form { margin-top: 12px; }
.upload-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.upload-row label { flex: 1; min-width: 160px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 14px; flex-wrap: wrap; }

.team-card { border: 1px solid #dde5ee; border-radius: 12px; padding: 16px; margin-bottom: 14px; background: #fafafa; }
.team-card summary { cursor: pointer; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.team-card summary::-webkit-details-marker { display: none; }
.team-card summary::before { content: '▶'; font-size: .75rem; color: #94a3b8; transition: transform .2s; }
details[open].team-card summary::before { transform: rotate(90deg); }
.roster-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid #e5edf5; }
.enroll-form { margin-bottom: 24px; }
.inline-form { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { flex: 1; min-width: 200px; }

.dev-box { margin-top: 20px; padding: 16px; background: #fef9c3; border: 1px solid #fbbf24; border-radius: 10px; }
.dev-box input { width: 100%; margin: 8px 0; font-family: monospace; }

.required { color: #b91c1c; }
h3 { margin: 20px 0 10px; font-size: 1rem; }
h4 { margin: 16px 0 8px; font-size: .95rem; color: #475569; }

/* ── Vet dashboard ───────────────────────────────────────────────── */
.filter-bar { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.filter-bar label { flex: 1; min-width: 160px; }

.table-scroll { overflow-x: auto; }
.table-vet td, .table-vet th { vertical-align: top; font-size: .88rem; }
.vax-cell { min-width: 120px; }
.doc-cell { min-width: 90px; }
.small { font-size: .8rem; }

.row-alt { background: #f8fafc; }
.pill-alt { background: #ede9fe; color: #5b21b6; }

.doc-flag { display: inline-block; font-size: 1rem; margin-right: 3px; font-weight: 700; }
.doc-ok       { color: #16a34a; }
.doc-missing  { color: #dc2626; }
.doc-optional { color: #d97706; }
.doc-legend   { margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .navbar { flex-direction: column; align-items: flex-start; padding: 14px 16px; }
  .nav-links { flex-wrap: wrap; gap: 10px; }
  .container { padding: 0 12px; margin: 16px auto; }
  .hero, .card { padding: 16px; }
  .grid, .grid-4 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  input, select, textarea { font-size: 16px; } /* prevent iOS zoom */
  .table th, .table td { padding: 8px; }
  .actions { flex-direction: column; align-items: flex-start; }
}

/* Vaccine requirement badges */
.required-badge {
  display: inline-block;
  background: #dc2626;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.recommended-badge {
  display: inline-block;
  background: #d97706;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Flash message categories */
.flash-warning {
  background: #fef3c7;
  border-left: 4px solid #d97706;
  color: #92400e;
  padding: 10px 14px;
  border-radius: 4px;
  margin-bottom: 8px;
}
