:root {
  --ink: #14231c;
  --muted: #667169;
  --green: #155d47;
  --deep: #0c3f30;
  --mint: #dce9dc;
  --warm: #f4f1e8;
  --surface: #fffdf7;
  --line: #d8d9d1;
  --coral: #e66e43;
  --shadow: 0 18px 50px rgba(20, 35, 28, .08);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--warm); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, textarea, select { font: inherit; }
button { border: 0; border-radius: 10px; background: var(--green); color: white; padding: .75rem 1rem; cursor: pointer; font-weight: 700; }
button:hover { background: var(--deep); }
button.secondary { color: var(--green); background: var(--mint); }
.login-link { display: block; text-align: center; border-radius: 10px; background: var(--green); color: white; padding: .75rem 1rem; text-decoration: none; font-weight: 700; }
.topbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(20,35,28,.12); padding: 0 clamp(1.25rem, 4vw, 4.5rem); }
.brand { color: var(--ink); display: flex; align-items: center; gap: .35rem; text-decoration: none; font-size: 1.2rem; letter-spacing: -.04em; }
.brand strong { color: var(--green); font-weight: 600; }
.brand-mark { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 9px; color: white; background: var(--green); margin-right: .25rem; }
.status { color: var(--muted); font-size: .85rem; display: flex; align-items: center; gap: .5rem; }
.status span { width: 8px; height: 8px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 4px rgba(230,110,67,.12); }
main { width: min(1440px, 100%); margin: 0 auto; padding: 0 clamp(1.25rem, 4vw, 4.5rem) 5rem; }
.intro { padding: clamp(3rem, 7vw, 6.5rem) 0 3.5rem; display: grid; grid-template-columns: 1.4fr .6fr; align-items: end; gap: 5rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; color: var(--green); font-size: .72rem; font-weight: 800; margin: 0 0 .8rem; }
h1 { font-size: clamp(3rem, 7vw, 6rem); line-height: .93; letter-spacing: -.075em; margin: 0; font-weight: 620; }
h1 em { font-family: Georgia, serif; font-weight: 400; color: var(--green); }
.lede { max-width: 680px; color: var(--muted); line-height: 1.65; font-size: 1.05rem; margin: 1.5rem 0 0; }
.identity { background: rgba(255,253,247,.7); border: 1px solid var(--line); padding: 1.25rem; border-radius: 18px; display: grid; gap: .8rem; }
label { color: var(--muted); font-size: .78rem; font-weight: 700; display: grid; gap: .4rem; }
input, textarea, select { width: 100%; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 9px; padding: .72rem .8rem; outline: none; }
input:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(21,93,71,.1); }
.toolbar { display: flex; justify-content: flex-end; align-items: end; gap: .7rem; margin: 0 0 1.25rem; }
.toolbar label { width: min(320px, 100%); }
.metrics { display: grid; grid-template-columns: repeat(6, 1fr); background: var(--ink); color: white; border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); }
.metrics article { padding: 1.6rem 1.8rem; border-right: 1px solid rgba(255,255,255,.12); display: grid; gap: .6rem; }
.metrics article:last-child { border: 0; }
.metrics span { color: rgba(255,255,255,.65); font-size: .78rem; }
.metrics strong { font-size: 2rem; letter-spacing: -.05em; }
.metrics .accent { background: var(--green); }
.workspace { padding-top: 4.5rem; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(2, minmax(240px, .7fr)); gap: 1rem; padding-top: 1rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 1.3rem; min-height: 250px; }
.panel-heading { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.panel h2 { font-size: 1.25rem; }
.muted { color: var(--muted); font-size: .75rem; }
.trend { display: grid; grid-template-columns: repeat(7, 1fr); gap: .65rem; height: 160px; align-items: end; padding-top: 1.25rem; }
.trend-day { min-width: 0; height: 100%; display: grid; grid-template-rows: auto 1fr auto; gap: .45rem; text-align: center; color: var(--muted); font-size: .72rem; }
.trend-bars { height: 100%; display: flex; gap: 3px; align-items: end; justify-content: center; border-bottom: 1px solid var(--line); }
.trend-bars i { width: min(18px, 42%); min-height: 3px; background: var(--mint); border-radius: 4px 4px 0 0; }
.trend-bars i.reviewed { background: var(--green); }
.trend-day small { font-size: .65rem; }
.breakdown { display: grid; gap: .9rem; margin-top: 1.7rem; }
.breakdown-row { display: grid; grid-template-columns: 92px 1fr 28px; gap: .55rem; align-items: center; color: var(--muted); font-size: .72rem; }
.breakdown-row b { color: var(--ink); text-align: right; }
.breakdown .empty { padding: 2.5rem 1rem; }
.goal-list { display: grid; gap: .8rem; }
.goal-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1.1rem 1.25rem; display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.goal-title { display: flex; align-items: center; gap: .65rem; }
.goal-card p { color: var(--muted); font-size: .78rem; margin: .45rem 0 0; }
.goal-actions { display: flex; gap: .55rem; align-items: center; }
.goal-actions button { padding: .55rem .7rem; font-size: .78rem; }
.pill.active { background: #d9eee4; }.pill.paused { background: #f8e3da; color: #8b4b32; }.pill.draft { background: #e8e8df; color: #59645c; }
.collection-runs { padding-top: 4.5rem; }
.run-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.run-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1.2rem; display: flex; justify-content: space-between; gap: 1rem; }
.run-card p { color: var(--muted); font-size: .78rem; margin: .45rem 0 0; }
.run-state { display: grid; align-content: start; text-align: right; color: var(--green); text-transform: uppercase; font-size: .75rem; }
.run-state.running, .run-state.queued { color: #a06f09; }
.run-state.failed, .run-state.blocked, .run-state.unavailable { color: #a23f2a; }
.run-state small { margin-top: .35rem; text-transform: none; font-weight: 500; }
.section-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 1.5rem; gap: 2rem; }
h2 { margin: 0; letter-spacing: -.045em; font-size: clamp(1.8rem, 3vw, 2.6rem); }
.queue-actions { display: flex; align-items: center; gap: .7rem; }
.queue-note { color: var(--muted); font-size: .78rem; }
.queue { display: grid; gap: 1rem; }
.channel-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.channel-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1.15rem; }
.channel-card dl { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; margin: 1rem 0 0; }
.channel-card dt { color: var(--muted); font-size: .68rem; text-transform: uppercase; }
.channel-card dd { margin: .2rem 0 0; font-weight: 800; }
.pill.disabled_pending_connector, .pill.disabled_pending_policy { background: #f8e3da; color: #8b4b32; }
.queue-filters { display: flex; flex-wrap: wrap; gap: .75rem; margin: 0 0 1rem; }
.queue-filters label { display: grid; gap: .25rem; font-size: .72rem; color: var(--muted); }
.queue-filters select { min-width: 110px; padding: .42rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.signal-card { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, .65fr); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: 0 8px 30px rgba(20,35,28,.04); }
.signal-main { padding: 1.5rem; }
.signal-aside { border-left: 1px solid var(--line); background: rgba(220,233,220,.24); padding: 1.5rem; display: grid; align-content: start; gap: 1rem; }
.signal-meta { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-size: .75rem; margin-bottom: 1rem; }
.pill { border-radius: 999px; background: var(--mint); color: var(--green); padding: .35rem .55rem; font-weight: 800; text-transform: uppercase; }
.pill.exploration { color: #8b4b32; background: #f8e3da; }
.signal-content { margin: 0; font-size: 1.02rem; line-height: 1.6; white-space: pre-wrap; }
.author { display: flex; gap: .8rem; align-items: center; margin-top: 1.2rem; color: var(--muted); font-size: .8rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: white; display: grid; place-items: center; font-weight: 800; }
.score-row { display: flex; justify-content: space-between; align-items: baseline; }
.score { font-size: 2.5rem; font-weight: 700; letter-spacing: -.07em; }
.band { color: var(--green); font-weight: 800; text-transform: uppercase; }
.bars { display: grid; gap: .55rem; }
.bar-label { display: grid; grid-template-columns: 110px 1fr 24px; gap: .5rem; align-items: center; font-size: .7rem; color: var(--muted); }
.track { height: 5px; background: #dfe3de; border-radius: 5px; overflow: hidden; }
.fill { height: 100%; background: var(--green); }
.reasons { display: flex; flex-wrap: wrap; gap: .4rem; }
.reason { padding: .3rem .5rem; border-radius: 6px; border: 1px solid var(--line); font-size: .66rem; color: var(--muted); }
.evidence { border-left: 2px solid var(--coral); margin: 1rem 0 0; padding-left: .8rem; font-size: .77rem; color: var(--muted); }
.review-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: .45rem; }
.review-buttons button { padding: .65rem .4rem; font-size: .75rem; }
.review-buttons .maybe { background: #d7a126; }
.review-buttons .reject { background: #f1e7e2; color: #8b4b32; }
.review-reason { width: 100%; margin: .55rem 0; padding: .5rem; border: 1px solid #d9d0ca; border-radius: .45rem; background: #fff; }
.retrieval { margin: .6rem 0 0; font-size: .76rem; color: #6d625c; }
.empty { border: 1px dashed var(--line); border-radius: 18px; text-align: center; color: var(--muted); padding: 4rem; }
dialog { border: 0; padding: 0; border-radius: 20px; width: min(760px, calc(100% - 2rem)); background: var(--surface); color: var(--ink); box-shadow: 0 30px 90px rgba(20,35,28,.25); }
.wide-dialog { width: min(980px, calc(100% - 2rem)); }
dialog::backdrop { background: rgba(12,34,24,.48); backdrop-filter: blur(3px); }
.dialog-card { padding: 1.8rem; }
.dialog-heading { display: flex; justify-content: space-between; margin-bottom: 1.5rem; }
.close { color: var(--muted); background: transparent; font-size: 1.6rem; padding: 0 .5rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.form-grid .wide { grid-column: 1 / -1; }
.form-error { min-height: 1.2rem; color: #a23f2a; font-size: .8rem; }
.variant-heading { display: flex; justify-content: space-between; align-items: end; margin: 1.5rem 0 .75rem; }
.variant-heading h3 { margin: 0; letter-spacing: -.03em; }
.variants { display: grid; gap: 1rem; }
.variant { position: relative; margin: 0; border: 1px solid var(--line); border-radius: 12px; padding: 1.2rem; }
.variant legend { padding: 0 .4rem; color: var(--green); font-size: .75rem; font-weight: 800; }
.remove-variant { position: absolute; top: .5rem; right: .5rem; padding: .15rem .45rem; color: var(--muted); background: transparent; font-size: 1.2rem; }
.check { grid-template-columns: auto 1fr; align-items: center; gap: .55rem; }.check input { width: auto; }
@media (max-width: 800px) {
  .intro { grid-template-columns: 1fr; gap: 2rem; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metrics article:nth-child(2) { border-right: 0; }
  .section-heading { align-items: start; flex-direction: column; }
  .queue-actions { flex-wrap: wrap; }
  .signal-card { grid-template-columns: 1fr; }
  .signal-aside { border-left: 0; border-top: 1px solid var(--line); }
  .overview-grid { grid-template-columns: 1fr; }
  .toolbar, .goal-card { align-items: stretch; flex-direction: column; }
  .goal-actions { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
