/* ==========================================================================
   Segue — "Protocol 2" design language
   Paper, ink and cobalt, with softer rules, clearer status, and a visible
   difference between the people (circles) and the assistants (squares)
   working on a project.

   One stylesheet for every surface: the React app shell links it, and the
   server-rendered pages (auth, consent, marketing, share, admin) link it too,
   so a token changes in one place. Fonts come from fonts.css (self-hosted).
   ========================================================================== */

:root {
  --paper: #fcfcfa;
  --rail: #f5f5f1;
  --sunk: #efefea;
  --card: #ffffff;
  --ink: #15171b;
  --ink-2: #3d424c;
  --dim: #5c6270;
  --muted: #6b707c;
  --line: rgba(21, 23, 27, 0.12);
  --line-soft: rgba(21, 23, 27, 0.07);
  --line-strong: rgba(21, 23, 27, 0.22);

  --cobalt: #2743e3;
  --cobalt-700: #1d33bb;
  --cobalt-300: #7d93ff;
  --cobalt-100: #dde3fb;
  --cobalt-50: #eef1fd;
  --emerald: #0e9f6e;
  --emerald-ink: #0a7a55;
  --emerald-soft: rgba(14, 159, 110, 0.1);
  --amber: #d08a20;
  --amber-ink: #8a5a10;
  --amber-soft: rgba(208, 138, 32, 0.15);
  --amber-wash: #fffaf1;
  --danger: #c93b3b;
  --danger-ink: #a83232;
  --danger-soft: rgba(201, 59, 59, 0.08);

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(21, 23, 27, 0.06);
  --shadow-lg: 0 24px 48px rgba(21, 23, 27, 0.14);
  --focus: 0 0 0 4px rgba(39, 67, 227, 0.12);

  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Archivo", system-ui, sans-serif;
  --font-mono: "Space Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a {
  color: var(--cobalt);
  text-decoration: none;
}
a:hover {
  color: var(--cobalt-700);
}
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--cobalt);
  outline-offset: 2px;
  border-radius: 4px;
}
img,
svg {
  vertical-align: middle;
}
[hidden] {
  display: none !important;
}

/* ---------- type ---------- */
h1,
h2,
h3,
h4,
.display {
  font-family: var(--font-display);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0;
}
p {
  margin: 0;
}
.mono {
  font-family: var(--font-mono);
}
.kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cobalt);
  margin: 0;
}
.kicker::before {
  content: "// ";
}
.caption {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}
.muted {
  color: var(--muted);
}
.dim {
  color: var(--dim);
}
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--cobalt);
  color: #fff;
  font: 600 14px/1.2 var(--font-body);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}
.btn:hover {
  background: var(--cobalt-700);
  color: #fff;
}
.btn.secondary {
  background: var(--card);
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn.secondary:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.btn.quiet {
  background: transparent;
  color: var(--ink-2);
}
.btn.quiet:hover {
  background: var(--sunk);
  color: var(--ink);
}
.btn.danger {
  background: var(--card);
  color: var(--danger-ink);
  border-color: rgba(201, 59, 59, 0.45);
}
.btn.danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn.small {
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
}
.btn.large {
  min-height: 46px;
  font-size: 15px;
}
.btn.block {
  width: 100%;
}
.btn.icon {
  width: 36px;
  min-height: 36px;
  padding: 0;
}
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- status pills ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--sunk);
  color: #4a4f5a;
}
.pill.current {
  background: var(--emerald-soft);
  color: var(--emerald-ink);
}
.pill.stale,
.pill.check {
  background: var(--amber-soft);
  color: var(--amber-ink);
}
.pill.missing {
  background: var(--danger-soft);
  color: var(--danger-ink);
}
.pill.review {
  background: var(--cobalt-50);
  color: var(--cobalt-700);
}

/* ---------- surfaces ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 14px;
}
.notice.info {
  background: var(--cobalt-50);
  border-color: rgba(39, 67, 227, 0.2);
  color: var(--cobalt-700);
}
.notice.warn {
  background: var(--amber-wash);
  border-color: rgba(208, 138, 32, 0.45);
}
.notice.error {
  background: #fff7f7;
  border-color: rgba(201, 59, 59, 0.4);
  color: var(--danger-ink);
}
.notice.success {
  background: #f3fbf7;
  border-color: rgba(14, 159, 110, 0.35);
  color: var(--emerald-ink);
}

/* ---------- handles and identities ---------- */
.handle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid rgba(39, 67, 227, 0.35);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--cobalt-700);
  font: 400 12.5px/1 var(--font-mono);
  white-space: nowrap;
}
button.handle {
  cursor: pointer;
}
.avatar,
.assistant {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  font-size: 10.5px;
  font-weight: 600;
}
.avatar {
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
}
.assistant {
  border-radius: 7px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 10px;
  background: var(--sunk);
  color: #33363d;
}
.assistant.warm {
  background: #f3ebe3;
  color: #7a4b26;
}
.assistant.cobalt {
  background: #e7ebfc;
  color: var(--cobalt-700);
}
.assistant.green {
  background: #e3f3ec;
  color: #0a6a4a;
}

/* ---------- forms ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field > label,
.label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.input,
.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  font: 14px/1.5 var(--font-body);
}
.field textarea,
textarea.input {
  padding: 10px 12px;
  resize: vertical;
}
.input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--cobalt);
  box-shadow: var(--focus);
}
.hint {
  font-size: 12.5px;
  color: var(--muted);
}
.error-text {
  font-size: 12.5px;
  color: var(--danger-ink);
}

/* ---------- segmented control ---------- */
.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--sunk);
  border-radius: 9px;
}
.segmented button,
.segmented a {
  min-height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  font: 500 13px/30px var(--font-body);
  cursor: pointer;
  white-space: nowrap;
}
.segmented [aria-pressed="true"],
.segmented [aria-current="page"],
.segmented [aria-selected="true"] {
  background: var(--card);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ---------- tabs ---------- */
.tabs {
  display: flex;
  gap: 26px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs a,
.tabs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 0 11px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--dim);
  font: 500 14.5px var(--font-body);
  white-space: nowrap;
  cursor: pointer;
}
.tabs a:hover,
.tabs button:hover {
  color: var(--ink);
}
.tabs [aria-current="page"],
.tabs [aria-selected="true"] {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--cobalt);
}
.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--sunk);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 700;
}
.count.strong {
  background: var(--cobalt);
  color: #fff;
}

/* ---------- freshness bar ---------- */
.freshness {
  display: flex;
  gap: 3px;
}
.freshness > span {
  flex: 1;
  height: 8px;
  border-radius: 2px;
  background: #d3d4ce;
}
.freshness .is-current {
  background: var(--emerald);
}
.freshness .is-stale {
  background: var(--amber);
}
.freshness .is-check {
  background: repeating-linear-gradient(135deg, var(--amber) 0 3px, #f6e3c4 3px 6px);
}
.freshness .is-missing {
  background: var(--card);
  border: 1.5px dashed var(--danger);
}
.freshness .is-log {
  background: #d3d4ce;
}

/* ---------- page header (server pages) ---------- */
.page-title {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  justify-content: space-between;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--ink);
}
.page-title h1 {
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.05;
}
.page-title .lede {
  margin-top: 8px;
  color: var(--dim);
  font-size: 15.5px;
  max-width: 680px;
}

/* ---------- prose (rendered Markdown) ---------- */
.prose {
  font-size: 15px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.prose > * + * {
  margin-top: 0.8em;
}
.prose h1,
.prose h2,
.prose h3 {
  margin-top: 1.4em;
}
.prose code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--sunk);
  padding: 1px 5px;
  border-radius: 4px;
}
.prose pre {
  overflow-x: auto;
  padding: 14px 16px;
  background: #f6f6f2;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}
.prose pre code {
  background: none;
  padding: 0;
}
.prose table {
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
}
.prose th,
.prose td {
  border: 1px solid var(--line);
  padding: 6px 10px;
  text-align: left;
}
.prose blockquote {
  margin-left: 0;
  padding-left: 14px;
  border-left: 3px solid var(--line-strong);
  color: var(--dim);
}
.plain-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
