/* ─────────────────────────────────────────────────────────────
   re/agent · editorial buyer's-agent design system
   ───────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght,SOFT,WONK@0,9..144,300..900,0..100,0..1;1,9..144,300..900,0..100,0..1&family=Instrument+Sans:ital,wght@0,400..700;1,400..700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Paper & ink */
  --paper:       #f3efe6;
  --paper-2:     #eeeadf;
  --card:        #faf7f0;
  --card-warm:   #f6f1e4;
  --ink:         #17140f;
  --ink-2:       #3a342c;
  --muted:       #7a7264;
  --faint:       #a49a89;
  --hair:        #d8d1c1;
  --hair-2:      #c6bda9;
  --hair-strong: #a79c85;

  /* Accents */
  --viridian:    #0f4430;
  --viridian-2:  #17604a;
  --viridian-ink:#f4f0e3;
  --terra:       #c4511c;
  --gold:        #b8892f;
  --sage:        #3d6e4b;
  --rust:        #9b2f21;
  --ink-warm:    #231d15;

  /* Type */
  --font-display: "Fraunces", "Times New Roman", serif;
  --font-sans:    "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Scale */
  --shell-max: 1120px;
  --step-1: clamp(.72rem, .68rem + .18vw, .82rem);
  --step-2: 1rem;
  --step-3: 1.18rem;
  --step-4: 1.44rem;
  --step-h3: clamp(1.35rem, 1.1rem + 1vw, 1.7rem);
  --step-h2: clamp(1.9rem,  1.4rem + 1.8vw, 2.4rem);
  --step-h1: clamp(2.5rem,  1.6rem + 3.6vw, 3.6rem);

  /* Motion */
  --ease: cubic-bezier(.2,.7,.2,1);
  --ease-in: cubic-bezier(.7,.0,.84,.0);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

html { color-scheme: light; }
body {
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--ink);
  font-size: 15.5px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* paper grain */
  background-image:
    radial-gradient(circle at 0% 0%,  rgba(196,81,28,.035), transparent 55%),
    radial-gradient(circle at 100% 10%, rgba(15,68,48,.05), transparent 50%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .12 0 0 0 0 .10 0 0 0 0 .08 0 0 0 .05 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-attachment: fixed, fixed, fixed;
}

::selection { background: var(--viridian); color: var(--viridian-ink); }

/* ─────────── Typography ─────────── */
h1,h2,h3,h4 { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: var(--step-h1); font-variation-settings: "opsz" 144, "SOFT" 30, "WONK" 0; line-height: 1.02; }
h2 { font-size: var(--step-h2); font-variation-settings: "opsz" 96,  "SOFT" 40, "WONK" 0; line-height: 1.08; }
h3 { font-size: var(--step-h3); font-variation-settings: "opsz" 48,  "SOFT" 50; line-height: 1.15; }
h4 { font-size: var(--step-4);  font-variation-settings: "opsz" 24,  "SOFT" 50; line-height: 1.2;  }

p  { margin: 0 0 1em; }

a  { color: var(--viridian); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color .2s var(--ease), color .2s var(--ease); }
a:hover { border-bottom-color: var(--viridian); }

code, pre, .mono, time { font-family: var(--font-mono); font-feature-settings: "ss01","zero"; }
code { background: var(--card-warm); padding: .08em .35em; border-radius: 3px; font-size: .9em; border: 1px solid var(--hair); }

/* Micro label: tiny uppercase tracked */
.eyebrow,
.label,
legend {
  font-family: var(--font-sans);
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .24em;
  color: var(--muted);
}
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--terra);
  margin-right: .62em;
  vertical-align: .12em;
}

/* ─────────── Shell / header ─────────── */
.app-header {
  background: var(--paper);
  border-bottom: 1px solid var(--hair);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(1.1);
}
.app-header-inner {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 18px 32px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 40px;
}
.brand {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.28rem;
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 48, "SOFT" 60, "WONK" 1;
  color: var(--ink);
  border: 0 !important;
  display: inline-flex; align-items: baseline; gap: .06em;
}
.brand .sep { color: var(--terra); font-style: italic; padding: 0 .04em; }
.brand .mark { color: var(--ink); }

.nav-primary { display: flex; gap: 32px; justify-content: center; }
.nav-primary a {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .22em;
  color: var(--muted);
  font-weight: 600;
  border: 0;
  padding: 10px 0;
  position: relative;
}
.nav-primary a:hover { color: var(--ink); }
.nav-primary a.active { color: var(--ink); }
.nav-primary a.active::after {
  content:"";
  position: absolute; left: 0; right: 0; bottom: 2px;
  height: 2px; background: var(--terra);
}

.nav-secondary { display: flex; gap: 20px; align-items: center; }
.nav-secondary a, .nav-secondary .link {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .22em;
  color: var(--muted);
  font-weight: 600;
  border: 0;
}
.nav-secondary a:hover, .nav-secondary .link:hover { color: var(--ink); }

.app-main {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 56px 32px 120px;
}

/* staggered page-load reveal for top-level sections */
.app-main > * {
  opacity: 0;
  transform: translateY(8px);
  animation: rise .6s var(--ease) forwards;
}
.app-main > *:nth-child(1) { animation-delay: .02s; }
.app-main > *:nth-child(2) { animation-delay: .10s; }
.app-main > *:nth-child(3) { animation-delay: .18s; }
.app-main > *:nth-child(4) { animation-delay: .26s; }
.app-main > *:nth-child(5) { animation-delay: .34s; }

@keyframes rise {
  to { opacity: 1; transform: none; }
}

/* ─────────── Panels (editorial cards) ─────────── */
.panel {
  background: var(--card);
  border: 1px solid var(--hair);
  border-radius: 4px;
  padding: 36px 40px;
  margin-bottom: 28px;
  box-shadow:
    0 1px 0 rgba(23,20,15,.02),
    0 24px 60px -40px rgba(23,20,15,.15);
  position: relative;
}
.panel + .panel { margin-top: 28px; }
.panel > *:last-child { margin-bottom: 0; }

.panel-hd {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--hair);
}
.panel-hd h2, .panel-hd h3 { margin: 0; }
.panel-hd .eyebrow { display: block; margin-bottom: 10px; }

.panel-split {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 40px;
  align-items: start;
}
@media (max-width: 760px) { .panel-split { grid-template-columns: 1fr; } }

/* ─────────── Hero block ─────────── */
.hero {
  padding: 48px 0 20px;
  border-bottom: 1px solid var(--hair);
  margin-bottom: 40px;
}
.hero .eyebrow { display: block; margin-bottom: 14px; }
.hero h1 {
  font-variation-settings: "opsz" 144, "SOFT" 30, "WONK" 1;
  max-width: 18ch;
  margin: 0;
}
.hero h1 em {
  font-style: italic;
  color: var(--terra);
  font-variation-settings: "opsz" 144, "SOFT" 80, "WONK" 1;
}
.hero .lede {
  font-size: 1.15rem;
  color: var(--ink-2);
  max-width: 52ch;
  margin-top: 18px;
}

/* ─────────── Buttons ─────────── */
button, .button {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-sans);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  padding: 12px 20px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  border-radius: 2px;
  cursor: pointer;
  line-height: 1;
  transition: background .2s var(--ease), color .2s var(--ease), transform .15s var(--ease), border-color .2s var(--ease);
}
button:hover, .button:hover { background: var(--ink); color: var(--paper); border-bottom: 1px solid var(--ink); }
button:active, .button:active { transform: translateY(1px); }

button.primary, .button.primary {
  background: var(--viridian);
  color: var(--viridian-ink);
  border-color: var(--viridian);
}
button.primary:hover, .button.primary:hover {
  background: var(--viridian-2); border-color: var(--viridian-2);
}

button.ghost, .button.ghost {
  border: 1px solid var(--hair-2); color: var(--muted);
}
button.ghost:hover, .button.ghost:hover { background: var(--card-warm); color: var(--ink); border-color: var(--ink); }

.button { text-decoration: none; }
.link {
  background: none; border: 0; padding: 0;
  color: var(--muted); font-size: .72rem; letter-spacing: .22em;
  text-transform: uppercase; font-weight: 600; cursor: pointer;
  font-family: var(--font-sans);
}
.link:hover { color: var(--ink); }

.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }

/* ─────────── Forms ─────────── */
form.stacked { display: grid; gap: 22px; max-width: 560px; }
form.stacked.wide { max-width: none; }

form.stacked label {
  display: grid;
  gap: 8px;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}
form.stacked label .muted {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--faint);
  font-size: .78rem;
}

form.stacked input[type="text"],
form.stacked input[type="email"],
form.stacked input[type="password"],
form.stacked input:not([type]),
form.stacked textarea,
form.stacked select {
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--ink);
  background: var(--card-warm);
  border: 1px solid var(--hair);
  border-bottom: 2px solid var(--hair-2);
  border-radius: 2px;
  padding: 12px 14px;
  text-transform: none;
  letter-spacing: 0;
  transition: border-color .2s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease);
  font-variant-numeric: tabular-nums;
}
form.stacked textarea {
  font-family: var(--font-mono);
  font-size: .88rem;
  line-height: 1.6;
  min-height: 160px;
  resize: vertical;
}
form.stacked input:focus,
form.stacked textarea:focus,
form.stacked select:focus {
  outline: none;
  background: var(--card);
  border-color: var(--ink);
  border-bottom-color: var(--viridian);
  box-shadow: 0 0 0 4px rgba(15,68,48,.08);
}
form.stacked input::placeholder, form.stacked textarea::placeholder {
  color: var(--faint);
}

form.stacked fieldset {
  border: 1px solid var(--hair);
  border-radius: 3px;
  padding: 22px 24px 24px;
  margin: 0;
  display: grid;
  gap: 18px;
  background: var(--card-warm);
}
form.stacked fieldset legend {
  padding: 0 10px;
  margin-left: -4px;
}
form.stacked fieldset legend .tag {
  color: var(--sage);
  margin-left: .5em;
  letter-spacing: .22em;
}

form.stacked hr {
  border: 0;
  border-top: 1px solid var(--hair);
  margin: 2px 0;
}

/* Flash/error/success banners */
.error, .flash {
  border: 1px solid;
  border-radius: 3px;
  padding: 14px 18px;
  font-size: .9rem;
  margin-bottom: 22px;
  display: flex; align-items: center; gap: 10px;
}
.error {
  border-color: var(--rust);
  background: #f7e7e3;
  color: var(--rust);
}
.error::before { content: "!"; font-family: var(--font-display); font-style: italic; font-size: 1.3rem; line-height: 1; color: var(--rust); }
.flash {
  border-color: var(--sage);
  background: #e7f0e9;
  color: #25513a;
}
.flash::before { content: "✓"; font-weight: 700; color: var(--sage); }

/* ─────────── Status pills (postal stamps) ─────────── */
.status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid currentColor;
  border-radius: 2px;
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  background: transparent;
  white-space: nowrap;
}
.status::before {
  content: "";
  width: 6px; height: 6px; border-radius: 999px;
  background: currentColor;
}
.status-active    { color: var(--sage); background: #eaf2ea; }
.status-completed { color: var(--sage); background: #eaf2ea; }
.status-draft     { color: var(--muted); background: transparent; }
.status-pending,
.status-acked     { color: var(--gold); background: #f7efd8; }
.status-running   { color: var(--terra); background: #fbe7d6; }
.status-paused,
.status-cancelled { color: var(--muted); background: var(--card-warm); }
.status-failed    { color: var(--rust); background: #f7e3df; }

/* running status: blinking dot */
.status-running::before,
.status-pending::before,
.status-acked::before {
  animation: pulse 1.6s var(--ease) infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .35; transform: scale(.82); }
}

/* ─────────── Tables ─────────── */
table.tasks {
  width: 100%;
  border-collapse: collapse;
  font-size: .95rem;
}
table.tasks thead th {
  text-align: left;
  padding: 10px 14px 10px 0;
  border-bottom: 1px solid var(--hair);
  font-size: .66rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .22em;
}
table.tasks tbody td {
  padding: 16px 14px 16px 0;
  border-bottom: 1px solid var(--hair);
  vertical-align: top;
}
table.tasks tbody tr:last-child td { border-bottom: 0; }
table.tasks tbody tr { transition: background .15s var(--ease); }
table.tasks tbody tr:hover { background: var(--card-warm); }
table.tasks tbody td:first-child {
  font-family: var(--font-mono);
  font-size: .82rem;
  color: var(--muted);
  white-space: nowrap;
  padding-left: 16px;
}
table.tasks tbody tr td:first-child { border-left: 2px solid transparent; padding-left: 14px; }
table.tasks tbody tr:hover td:first-child { border-left-color: var(--terra); }

table.tasks a {
  color: var(--ink);
  font-weight: 500;
  border-bottom: 1px solid transparent;
}
table.tasks a:hover { border-bottom-color: var(--ink); }
.flash-update tr { animation: row-flash .6s var(--ease); }
@keyframes row-flash { from { background: var(--card-warm); } to { background: transparent; } }
#live-dot { color: var(--sage); font-size: .85rem; animation: pulse-dot 2s ease infinite; }
@keyframes pulse-dot { 0%,100% { opacity: .5; } 50% { opacity: 1; } }

/* ─────────── Agent list (dashboard) ─────────── */
.agent-list {
  list-style: none;
  padding: 0; margin: 0;
  display: grid; gap: 2px;
}
.agent-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--hair);
  gap: 20px;
}
.agent-list li:last-child { border-bottom: 0; }
.agent-list a {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-variation-settings: "opsz" 72, "SOFT" 50, "WONK" 1;
  color: var(--ink);
  letter-spacing: -.01em;
  border: 0;
}
.agent-list a:hover { color: var(--terra); }

/* ─────────── Agent shell (persistent across tabs) ─────────── */
.agent-shell-head {
  padding: 28px 0 8px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 24px;
}
.agent-shell-head .eyebrow { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.agent-shell-head .agent-name {
  font-size: clamp(2.2rem, 1.4rem + 2.6vw, 3rem);
  font-variation-settings: "opsz" 144, "SOFT" 30, "WONK" 1;
  line-height: 1;
  margin: 0;
}
.agent-shell-head .quick {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .22em;
  color: var(--muted);
  font-weight: 600;
}
.agent-shell-head .quick a { color: var(--muted); border: 0; }
.agent-shell-head .quick a:hover { color: var(--ink); }

#agent-content {
  transition: opacity .18s var(--ease), transform .25s var(--ease);
}
#agent-content.swapping {
  opacity: 0;
  transform: translateY(4px);
  transition-duration: .12s;
}
#agent-content > *:first-child { margin-top: 0; }

.tab-intro {
  margin: 0 0 22px;
  max-width: 60ch;
}
.tab-intro .eyebrow {
  display: inline-block;
  margin-bottom: 8px;
}
.tab-intro h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-style: italic;
  font-variation-settings: "opsz" 96, "SOFT" 50, "WONK" 1;
  font-size: clamp(1.6rem, 1.1rem + 1.4vw, 2.1rem);
  line-height: 1.05;
  margin: 0 0 10px;
  color: var(--ink);
  letter-spacing: -.005em;
}
.tab-intro p.lede {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.55;
  color: var(--ink-2);
}

/* Tab nav */
.agent-nav {
  display: flex; flex-wrap: wrap; gap: 0; align-items: center;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
  margin: 22px 0 32px;
}
.agent-nav a, .agent-nav .crumb {
  padding: 14px 18px;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .22em;
  font-weight: 600;
  color: var(--muted);
  border: 0;
  border-right: 1px solid var(--hair);
}
.agent-nav a:first-child, .agent-nav .crumb:first-child { padding-left: 0; }
.agent-nav a:last-child, .agent-nav .crumb:last-child { border-right: 0; }
.agent-nav a:hover { color: var(--ink); background: var(--card-warm); }
.agent-nav a.active { color: var(--ink); position: relative; }
.agent-nav a.active::after {
  content:""; position: absolute; left: 18px; right: 18px; bottom: -1px;
  height: 2px; background: var(--terra);
}

/* ─────────── Skills table ─────────── */
.skills-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
}
.skills-table thead th {
  text-align: left;
  padding: 12px 10px;
  font-size: .66rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--hair);
  font-weight: 700;
}
.skills-table tbody td {
  padding: 16px 10px;
  border-bottom: 1px solid var(--hair);
  vertical-align: top;
}
.skills-table tbody tr:last-child td { border-bottom: 0; }
.skills-table strong { font-weight: 600; }
.skills-table code {
  font-size: .75rem;
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--muted);
}
.skills-table input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--viridian);
  margin: 2px 0 0 0;
}

/* ─────────── Task detail: hero metadata ─────────── */
.task-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: end;
  padding: 40px 0 28px;
  border-bottom: 1px solid var(--hair);
  margin-bottom: 36px;
}
.task-head h1 {
  font-size: clamp(2rem, 1.2rem + 2.4vw, 2.8rem);
  font-variation-settings: "opsz" 144, "SOFT" 30, "WONK" 1;
  line-height: 1.05;
  max-width: 22ch;
}
.task-meta {
  display: flex; flex-wrap: wrap; gap: 18px 24px;
  font-size: .76rem; color: var(--muted);
  margin-top: 18px;
}
.task-meta > span { display: inline-flex; align-items: center; gap: 8px; }
.task-meta .k {
  font-size: .64rem;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
}
.task-meta .v {
  font-family: var(--font-mono);
  font-size: .82rem;
  color: var(--ink-2);
}
.prompt-quote {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-style: italic;
  font-variation-settings: "opsz" 48, "SOFT" 80, "WONK" 1;
  color: var(--ink-2);
  line-height: 1.35;
  padding: 4px 0 0 24px;
  border-left: 2px solid var(--terra);
  margin: 0;
}

/* ─────────── Live progress timeline (the hero moment) ─────────── */
.progress-wrap {
  position: relative;
  padding: 4px 4px 4px 0;
  max-height: 560px;
  overflow-y: auto;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}
.progress-wrap::-webkit-scrollbar { width: 10px; }
.progress-wrap::-webkit-scrollbar-track { background: transparent; }
.progress-wrap::-webkit-scrollbar-thumb {
  background: var(--hair-2); border-radius: 999px; border: 3px solid var(--card);
}

ul.progress {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}
ul.progress::before {
  content: "";
  position: absolute;
  left: 88px;
  top: 6px; bottom: 6px;
  width: 1px;
  background: linear-gradient(var(--hair) 0, var(--hair) 80%, transparent 100%);
}
ul.progress li {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 28px;
  padding: 14px 0;
  position: relative;
  animation: slidein .45s var(--ease) both;
}
@keyframes slidein {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: none; }
}
ul.progress li .t {
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--muted);
  padding-top: 2px;
  text-align: right;
}
ul.progress li .body { position: relative; padding-left: 22px; }
ul.progress li .body::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 8px;
  width: 10px; height: 10px;
  border-radius: 999px;
  background: var(--card);
  border: 2px solid var(--hair-strong);
}
ul.progress li .stage {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink);
  margin-right: 8px;
}
ul.progress li .msg { color: var(--ink-2); font-size: .95rem; }

/* stage-colored dots */
ul.progress li.s-worker .body::before,
ul.progress li.s-tool_call .body::before { border-color: var(--terra); background: var(--terra); }
ul.progress li.s-started .body::before { border-color: var(--gold); }
ul.progress li.s-finished .body::before,
ul.progress li.s-returned .body::before { border-color: var(--sage); background: var(--sage); }
ul.progress li.s-error .body::before { border-color: var(--rust); background: var(--rust); }

/* last item pulses while running */
.task-running ul.progress li:last-child .body::before {
  animation: pulsedot 1.4s infinite;
}
@keyframes pulsedot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(196,81,28,.35); }
  50%      { box-shadow: 0 0 0 8px rgba(196,81,28,0); }
}

/* Progress empty / thinking state */
.progress-thinking {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--muted);
  font-family: var(--font-display); font-style: italic;
  font-size: 1.05rem;
  padding: 20px 0;
}
.progress-thinking .dot {
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--terra);
  animation: blip 1.1s infinite;
}
@keyframes blip {
  0%, 80%, 100% { opacity: 0.2; transform: scale(.8); }
  40%           { opacity: 1; transform: scale(1.2); }
}

/* ─────────── Result block ─────────── */
pre.result {
  font-family: var(--font-mono);
  font-size: .82rem;
  line-height: 1.65;
  background: var(--ink-warm);
  color: #ece6d3;
  padding: 26px 28px;
  border-radius: 3px;
  overflow-x: auto;
  border: 1px solid var(--ink-warm);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
  position: relative;
  white-space: pre-wrap;
  word-break: break-word;
}
pre.result::before {
  content: "output.json";
  position: absolute;
  top: -10px; left: 20px;
  font-family: var(--font-sans);
  font-size: .6rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  padding: 2px 10px;
  background: var(--ink-warm);
  color: var(--faint);
  border-radius: 2px;
  border: 1px solid var(--ink-warm);
}

/* ─────────── Empty state ─────────── */
.empty {
  text-align: center;
  padding: 64px 20px;
  color: var(--muted);
}
.empty h3 {
  color: var(--ink);
  font-style: italic;
  font-variation-settings: "opsz" 144, "SOFT" 100;
  margin-bottom: 14px;
}
.empty .lede {
  max-width: 42ch;
  margin: 0 auto 22px;
  color: var(--muted);
}

/* ─────────── Auth layout (split editorial) ─────────── */
body.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--paper);
}
@media (max-width: 820px) { body.auth { grid-template-columns: 1fr; } }

.auth-stage {
  background: var(--viridian);
  color: var(--viridian-ink);
  padding: 56px 56px 48px;
  position: relative;
  overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 100vh;
}
.auth-stage::after {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 80% 10%, rgba(196,81,28,.22), transparent 45%),
    radial-gradient(circle at 10% 90%, rgba(200,154,76,.18), transparent 50%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 .96 0 0 0 0 .88 0 0 0 .05 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  pointer-events: none;
}
.auth-stage > * { position: relative; z-index: 1; }
.auth-stage .brand-large {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.6rem;
  font-variation-settings: "opsz" 48, "SOFT" 50, "WONK" 1;
  letter-spacing: -.01em;
  color: var(--viridian-ink);
  margin: 0;
  display: inline-flex; align-items: baseline;
}
.auth-stage .brand-large .sep { color: var(--gold); font-style: italic; }

.auth-stage .pitch {
  font-family: var(--font-display);
  font-size: clamp(2rem, 1.2rem + 2.8vw, 3.2rem);
  line-height: 1.04;
  font-variation-settings: "opsz" 144, "SOFT" 50, "WONK" 1;
  font-weight: 400;
  max-width: 14ch;
  margin: 64px 0 32px;
  color: var(--viridian-ink);
}
.auth-stage .pitch em {
  font-style: italic;
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
  color: var(--gold);
}
.auth-stage .pitch-sub {
  max-width: 36ch;
  color: rgba(244,240,227,.72);
  font-size: 1.02rem;
  line-height: 1.55;
}
.auth-stage .sig {
  font-family: var(--font-display);
  font-style: italic;
  font-size: .9rem;
  color: rgba(244,240,227,.6);
  letter-spacing: .02em;
}
.auth-stage .sig::before {
  content: "—";
  display: inline-block;
  margin-right: .5em;
  color: var(--gold);
}

.auth-card {
  padding: 56px clamp(28px, 5vw, 80px);
  display: flex; flex-direction: column; justify-content: center;
  min-height: 100vh;
}
.auth-card .auth-eyebrow {
  display: block;
  margin-bottom: 28px;
}
.auth-card h2 {
  font-size: clamp(2rem, 1.2rem + 2.2vw, 2.8rem);
  font-variation-settings: "opsz" 144, "SOFT" 40, "WONK" 1;
  margin: 0 0 12px;
  max-width: 14ch;
}
.auth-card h2 em { font-style: italic; color: var(--terra); font-variation-settings: "opsz" 144, "SOFT" 80, "WONK" 1; }
.auth-card .auth-sub { color: var(--muted); margin: 0 0 36px; max-width: 40ch; }
.auth-card form.stacked { max-width: 420px; }
.auth-card .alt {
  margin-top: 28px;
  color: var(--muted);
  font-size: .92rem;
  border-top: 1px solid var(--hair);
  padding-top: 22px;
  max-width: 420px;
}

/* ─────────── Misc / helpers ─────────── */
.muted { color: var(--muted); font-size: .92rem; }
.inline { display: inline; }
.tag {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--sage);
  padding: 2px 8px;
  border: 1px solid currentColor;
  border-radius: 2px;
  margin-left: 8px;
  vertical-align: .15em;
}

hr.rule {
  border: 0; border-top: 1px solid var(--hair); margin: 40px 0;
}
.divider-ornament {
  display: flex; align-items: center; gap: 14px;
  color: var(--muted); margin: 32px 0;
  font-family: var(--font-display); font-style: italic;
}
.divider-ornament::before, .divider-ornament::after {
  content: ""; flex: 1; height: 1px; background: var(--hair);
}

@media (max-width: 600px) {
  .app-header-inner { grid-template-columns: 1fr auto; }
  .nav-primary { grid-column: 1 / -1; justify-content: start; border-top: 1px solid var(--hair); padding-top: 10px; gap: 18px; }
  .panel { padding: 24px; }
  .app-main { padding: 36px 20px 80px; }
  .task-head { grid-template-columns: 1fr; }
  ul.progress::before { left: 6px; }
  ul.progress li { grid-template-columns: 1fr; gap: 2px; }
  ul.progress li .t { text-align: left; padding-left: 22px; }
  ul.progress li .body::before { display: none; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

/* ── Clients, teams, grants ────────────────────────────────────────── */
.client-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.client-card { border: 1px solid var(--hair); border-radius: 12px; padding: 18px; background: #fff;
  display: flex; flex-direction: column; gap: 8px; }
.client-name { font-weight: 600; font-size: 1.1rem; text-decoration: none; color: #111; }
.client-name:hover { text-decoration: underline; }
.client-meta { color: var(--muted); font-size: 0.85rem; }
.creds-badges { display: flex; gap: 6px; margin-top: 6px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.03em; }
.badge.ok      { background: #def5e5; color: #1e8f4a; }
.badge.missing { background: #fde4e4; color: #a01e1e; }
.creds-status { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.creds-status li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.member-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.member-list li { display: flex; gap: 10px; align-items: baseline; }
.member-list .muted { flex: 1; }
.tag { background: #eef1f7; color: #2b4bff; padding: 2px 8px; border-radius: 999px; font-size: 0.72rem;
  font-weight: 500; text-transform: uppercase; letter-spacing: 0.03em; }
.button.small { padding: 6px 12px; font-size: 0.85rem; }
.small { font-size: 0.85rem; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
