/* ── Design Tokens ──────────────────────────────────────────────────────────── */
:root {
  /* Brand */
  --primary:        #1a56db;
  --primary-dark:   #1341a8;
  --primary-light:  #e8f0fd;
  --accent:         #0ea5e9;

  /* Neutrals */
  --bg:             #f1f5f9;
  --surface:        #ffffff;
  --surface-2:      #f8fafc;
  --border:         #e2e8f0;
  --text:           #1e293b;
  --text-muted:     #64748b;
  --text-light:     #94a3b8;

  /* Safety badges */
  --badge-sat:      #16a34a;
  --badge-sat-bg:   #dcfce7;
  --badge-cond:     #ca8a04;
  --badge-cond-bg:  #fef9c3;
  --badge-unsat:    #dc2626;
  --badge-unsat-bg: #fee2e2;
  --badge-nr:       #64748b;
  --badge-nr-bg:    #f1f5f9;

  /* Status */
  --green:   #16a34a;
  --red:     #dc2626;
  --amber:   #d97706;

  /* Spacing */
  --sp-1:  4px;  --sp-2:  8px;  --sp-3: 12px;  --sp-4: 16px;
  --sp-5: 20px;  --sp-6: 24px;  --sp-8: 32px;  --sp-10: 40px;
  --sp-12: 48px; --sp-16: 64px;

  /* Radii */
  --r-sm: 6px;  --r-md: 10px;  --r-lg: 16px;  --r-xl: 24px;  --r-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.12);

  /* Nav height */
  --nav-h: 64px;
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
ul { list-style: none; }

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--sp-4);
}
.page-body {
  min-height: calc(100vh - var(--nav-h));
  padding: var(--sp-8) 0 var(--sp-16);
}

/* ── Typography ─────────────────────────────────────────────────────────────── */
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 800; line-height: 1.2; }
h2 { font-size: 1.5rem;   font-weight: 700; }
h3 { font-size: 1.125rem; font-weight: 600; }
h4 { font-size: 0.9rem;   font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
p  { color: var(--text-muted); }

/* ── Utility ─────────────────────────────────────────────────────────────────── */
.hidden   { display: none !important; }
.flex     { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }
.mt-4  { margin-top: var(--sp-4); }
.mt-6  { margin-top: var(--sp-6); }
.mt-8  { margin-top: var(--sp-8); }
.text-sm   { font-size: 0.875rem; }
.text-xs   { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }

/* ── Toast notification ──────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  background: var(--text);
  color: #fff;
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-md);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .25s, transform .25s;
  z-index: 9999;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translateY(0); }
#toast.toast-error   { background: var(--red); }
#toast.toast-success { background: var(--green); }

/* ── Loading spinner ─────────────────────────────────────────────────────────── */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: var(--sp-10) auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-wrap {
  display: flex; justify-content: center; align-items: center;
  padding: var(--sp-12) 0;
}

/* ── Empty state ─────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--sp-12) var(--sp-6);
}
.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: var(--sp-4);
}
.empty-state h3 { color: var(--text); margin-bottom: var(--sp-2); }
