:root {
  --ink: #0a0a0a;
  --muted: #6b6560;
  --bg: #f5f3ef;
  --card: #fff;
  --border: rgba(10, 10, 10, .09);
  --red: #CC0000;
  --green: #047857;
  --amber: #c17817;
  --sans: 'DM Sans', system-ui, sans-serif;
  --display: 'Inter', system-ui, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.hidden { display: none !important; }
.loading {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--bg); z-index: 50;
}
.spinner {
  width: 36px; height: 36px; border: 2px solid var(--border); border-top-color: var(--red);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.auth-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.auth-card {
  width: min(420px, 100%); background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 2rem; box-shadow: 0 16px 48px rgba(0,0,0,.06);
}
.auth-logo { height: 36px; width: auto; margin-bottom: 1.25rem; }
.auth-card h1 { font-family: var(--display); font-size: 1.5rem; letter-spacing: -.03em; margin-bottom: .35rem; }
.auth-sub, .auth-hint { color: var(--muted); font-size: .88rem; line-height: 1.5; margin-bottom: 1.25rem; }
.auth-hint { margin-top: 1rem; margin-bottom: 0; font-size: .78rem; }
.auth-err { color: #b91c1c; font-size: .82rem; margin-bottom: .75rem; }
.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .85rem; }
.field label { font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.field input, .field textarea {
  font-family: var(--sans); font-size: .95rem; padding: .7rem .9rem; border-radius: 10px;
  border: 1.5px solid var(--border); background: #fff; color: var(--ink);
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(204,0,0,.1); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font-family: var(--sans); font-weight: 700; font-size: .78rem; letter-spacing: .04em;
  padding: .7rem 1.1rem; border-radius: 999px; border: 1px solid transparent; cursor: pointer;
  text-decoration: none; transition: .2s var(--ease);
}
.btn-primary { background: var(--red); color: #fff; width: 100%; }
.btn-primary:hover { background: #a50000; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--ink); }
.btn-sm { padding: .45rem .85rem; font-size: .72rem; width: auto; }

.shell { min-height: 100vh; }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 5vw; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20; backdrop-filter: blur(16px);
}
.top-brand { display: flex; align-items: center; gap: .75rem; }
.top-brand img { height: 32px; width: auto; }
.top-title { font-family: var(--display); font-weight: 800; font-size: .95rem; }
.top-sub { font-size: .72rem; color: var(--muted); }
.top-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.main { padding: 1.5rem 5vw 3rem; max-width: 1100px; margin: 0 auto; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 1.25rem 1.35rem;
  margin-bottom: 1rem;
}
.hero-strip { display: flex; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; align-items: flex-end; }
.eyebrow { font-size: .58rem; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; color: var(--red); margin-bottom: .35rem; }
.hero-strip h2 { font-family: var(--display); font-size: clamp(1.4rem, 3vw, 1.9rem); letter-spacing: -.03em; }
.muted { color: var(--muted); font-size: .88rem; line-height: 1.5; }
.hero-stats { display: flex; gap: 1.5rem; }
.stat-n { font-family: var(--display); font-weight: 900; font-size: 1.5rem; letter-spacing: -.03em; }
.stat-l { font-size: .62rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin: 0 0 1rem; }
.tab {
  border: 1px solid var(--border); background: transparent; border-radius: 999px;
  padding: .45rem 1rem; font-size: .72rem; font-weight: 700; cursor: pointer; color: var(--muted);
}
.tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.panel[hidden] { display: none !important; }
.card-hd { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 1rem; }
.card-hd h3 { font-family: var(--display); font-size: 1.05rem; }

.task-list { display: flex; flex-direction: column; gap: .65rem; }
.task-item {
  border: 1px solid var(--border); border-radius: 12px; padding: 1rem 1.1rem;
  display: grid; grid-template-columns: 1fr auto; gap: .75rem; align-items: start;
}
.task-item h4 { font-size: .95rem; font-weight: 700; margin-bottom: .25rem; }
.task-meta { font-size: .72rem; color: var(--muted); margin-bottom: .4rem; }
.task-desc { font-size: .85rem; color: var(--muted); line-height: 1.5; }
.pill {
  display: inline-block; font-size: .62rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  padding: .25rem .55rem; border-radius: 999px;
}
.pill-open { background: rgba(37,99,235,.1); color: #2563eb; }
.pill-submitted { background: rgba(193,120,23,.12); color: var(--amber); }
.pill-needs_revision { background: rgba(193,120,23,.12); color: var(--amber); }
.pill-passed { background: rgba(4,120,87,.12); color: var(--green); }
.pill-failed { background: rgba(185,28,28,.1); color: #b91c1c; }
.pill-locked { background: rgba(107,101,96,.1); color: var(--muted); }

.brief-body { white-space: pre-wrap; font-size: .92rem; line-height: 1.7; color: var(--muted); }
.cert-card { text-align: center; padding: 2.5rem 1.5rem; }
.cert-badge { font-size: .62rem; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; color: var(--red); margin-bottom: .75rem; }
.cert-card h2 { font-family: var(--display); font-size: 1.6rem; margin-bottom: .5rem; }
.empty { text-align: center; color: var(--muted); padding: 1.5rem; font-size: .9rem; }

.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40;
  align-items: center; justify-content: center; padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  width: min(520px, 100%); background: #fff; border-radius: 16px; padding: 1.35rem;
  border: 1px solid var(--border); box-shadow: 0 24px 60px rgba(0,0,0,.18);
}
.modal-hd { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.modal-hd h3 { font-family: var(--display); font-size: 1.1rem; }
.icon-btn { border: none; background: none; font-size: 1.25rem; cursor: pointer; color: var(--muted); }
.modal-ft { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
.modal-ft .btn-primary { width: auto; }

.toast {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%) translateY(120%);
  background: var(--ink); color: #fff; padding: .75rem 1.2rem; border-radius: 999px;
  font-size: .82rem; z-index: 60; transition: transform .25s var(--ease); max-width: 90vw;
}
.toast.show { transform: translateX(-50%) translateY(0); }

@media (max-width: 640px) {
  .top { padding: .85rem 4vw; }
  .main { padding: 1rem 4vw 2.5rem; }
  .task-item { grid-template-columns: 1fr; }
  .hero-stats { width: 100%; justify-content: space-between; }
}
