/* human.anri.ai - "relay" look: bone paper, graphite ink, steel blue for the
   agent, amber for the moments a person is needed. Amber is never decoration. */
:root {
  --bg: #F4F2EE;
  --surface: #FFFFFF;
  --sunk: #ECE9E3;
  --ink: #17181B;
  --muted: #676A71;
  --line: #DDD9D1;
  --agent: #36597A;
  --agent-soft: #E3EAF1;
  --human: #F2A900;
  --human-soft: #FFF3D1;
  --human-ink: #3D2B00;
  --ok: #1D7447;
  --ok-soft: #E1F2E8;
  --bad: #B3261E;
  --bad-soft: #FBE7E5;
  --radius: 10px;
  --display: 'Bricolage Grotesque', 'Manrope', system-ui, sans-serif;
  --body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Red Hat Mono', ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121316; --surface: #1B1C20; --sunk: #16171A; --ink: #ECECEE; --muted: #9B9EA6; --line: #2C2E34;
    --agent: #8DB0D0; --agent-soft: #1E2833; --human: #F5B82E; --human-soft: #2E2410; --human-ink: #FFE3A3;
    --ok: #5CC28C; --ok-soft: #15261D; --bad: #F08A80; --bad-soft: #2E1715;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.55 var(--body); -webkit-font-smoothing: antialiased; }
a { color: var(--agent); }
button, input, select { font: inherit; color: inherit; }
.icon { flex: none; vertical-align: -3px; }
[hidden] { display: none !important; }

/* ---- top bar ---- */
.top { display: flex; align-items: center; gap: 16px; padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.mark { display: flex; align-items: center; gap: 8px; font: 700 20px/1 var(--display); letter-spacing: -.02em; text-decoration: none; color: var(--ink); }
.mark .dot { width: 26px; height: 26px; border-radius: 8px; background: var(--human); color: var(--human-ink); display: grid; place-items: center; }
.top .spacer { flex: 1; }
.top .who { color: var(--muted); font-size: 13px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- buttons + fields ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { opacity: .9; }
.btn.human { background: var(--human); color: #1A1400; border-color: var(--human); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--agent); outline-offset: 2px; }
label.field { display: block; margin: 0 0 12px; font-weight: 600; font-size: 13px; }
label.field input, label.field select { display: block; width: 100%; margin-top: 5px; min-height: 42px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-weight: 500; font-size: 15px; }
label.field .hint { display: block; font-weight: 500; color: var(--muted); font-size: 12px; margin-top: 4px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.error { color: var(--bad); font-weight: 600; font-size: 14px; margin: 8px 0 0; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card h2 { font: 700 18px/1.25 var(--display); margin: 0 0 4px; letter-spacing: -.01em; }
.card > p.lede { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.eyebrow { font: 600 11px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }

/* ---- landing ---- */
.landing { max-width: 1120px; margin: 0 auto; padding: 56px 24px 72px; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .9fr); gap: 48px; align-items: start; }
.landing h1 { font: 800 clamp(34px, 5vw, 54px)/1.02 var(--display); letter-spacing: -.035em; margin: 0 0 18px; }
.landing h1 em { font-style: normal; background: var(--human); color: #1A1400; padding: 0 .12em; border-radius: 6px; }
.landing .sub { font-size: 18px; color: var(--muted); max-width: 540px; margin: 0 0 32px; }
.relay { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-width: 560px; }
.relay li { display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: start; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.relay li .who { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; }
.relay li.agent .who { background: var(--agent-soft); color: var(--agent); }
.relay li.person .who { background: var(--human); color: #1A1400; }
.relay li b { display: block; font-size: 14px; }
.relay li span { color: var(--muted); font-size: 14px; }
.auth-tabs { display: flex; gap: 4px; background: var(--sunk); border-radius: 8px; padding: 4px; margin-bottom: 16px; }
.auth-tabs button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 6px; cursor: pointer; font-weight: 600; color: var(--muted); }
.auth-tabs button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ---- workspace ---- */
.work { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 20px; padding: 20px 24px 40px; max-width: 1500px; margin: 0 auto; }
.side { display: grid; gap: 16px; align-content: start; }
.practice { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 14px; }
.chip { border: 1px dashed var(--line); background: transparent; border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--muted); }
.chip:hover { border-color: var(--agent); color: var(--agent); }
.tasks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tasks li button { width: 100%; text-align: left; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 10px 12px; border-radius: 8px; border: 1px solid transparent; background: transparent; cursor: pointer; }
.tasks li button:hover { background: var(--sunk); }
.tasks li button.on { border-color: var(--line); background: var(--sunk); }
.tasks .site { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tasks .meta { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }

.pill { display: inline-flex; align-items: center; gap: 6px; font: 600 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; padding: 5px 8px; border-radius: 6px; background: var(--sunk); color: var(--muted); white-space: nowrap; }
.pill.running, .pill.queued { background: var(--agent-soft); color: var(--agent); }
.pill.waiting_human { background: var(--human); color: #1A1400; }
.pill.succeeded { background: var(--ok-soft); color: var(--ok); }
.pill.failed { background: var(--bad-soft); color: var(--bad); }
.pill .live-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .pill .live-dot { animation: none; } }

.panel { display: grid; gap: 16px; align-content: start; min-width: 0; }
.panel-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.panel-head h2 { font: 700 22px/1.2 var(--display); margin: 0; letter-spacing: -.02em; overflow-wrap: anywhere; }
.panel-head .spacer { flex: 1; }
.stats { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.stats b { color: var(--ink); font-family: var(--mono); font-weight: 600; }

.screen { position: relative; background: #16171A; border-radius: var(--radius); overflow: hidden; aspect-ratio: 1280 / 800; border: 1px solid var(--line); }
.screen iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.screen img { width: 100%; height: 100%; object-fit: contain; display: block; }
.screen .placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: #A9ABB1; font: 500 13px var(--mono); text-align: center; padding: 20px; }
.screen .tag { position: absolute; left: 10px; top: 10px; z-index: 2; }

.turn { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 16px 18px; border-radius: var(--radius); background: var(--human-soft); border: 2px solid var(--human); }
.turn .badge { width: 42px; height: 42px; border-radius: 10px; background: var(--human); color: #1A1400; display: grid; place-items: center; }
.turn b { display: block; font-size: 16px; }
.turn span { color: var(--muted); font-size: 14px; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.steps li { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.steps li:first-child { border-top: 0; }
.steps .num { font: 600 12px/22px var(--mono); color: var(--muted); }
.steps .act { font: 600 12px var(--mono); letter-spacing: .04em; padding: 2px 6px; border-radius: 5px; background: var(--agent-soft); color: var(--agent); margin-right: 6px; }
.steps .act.NEED_HUMAN, .steps .act.PERSON { background: var(--human); color: #1A1400; }
.steps .act.DONE { background: var(--ok-soft); color: var(--ok); }
.steps .act.FAILED { background: var(--bad-soft); color: var(--bad); }
.steps .why { color: var(--muted); font-size: 13px; margin-top: 2px; }
.steps details { margin-top: 6px; }
.steps summary { cursor: pointer; font-size: 12px; color: var(--agent); font-weight: 600; }
.steps pre { white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.5 var(--mono); background: var(--sunk); padding: 10px; border-radius: 8px; max-height: 280px; overflow: auto; margin: 6px 0 0; }
.empty { color: var(--muted); padding: 40px 20px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }
.notice { padding: 12px 14px; border-radius: 8px; background: var(--agent-soft); font-size: 14px; }
.notice.warn { background: var(--human-soft); }

/* ---- admin ---- */
.admin { max-width: 1100px; margin: 0 auto; padding: 24px; display: grid; gap: 18px; }
.admin h1 { font: 800 30px/1.1 var(--display); letter-spacing: -.02em; margin: 0; }
.prov { border-top: 1px solid var(--line); padding: 16px 0 6px; }
.prov:first-of-type { border-top: 0; padding-top: 4px; }
.prov-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.prov-head b { font-size: 16px; }
.models { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px; max-height: 320px; overflow: auto; }
.model { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; min-width: 0; }
.model.on { border-color: var(--agent); background: var(--agent-soft); }
.model .name { font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.model .note { color: var(--muted); font-size: 11px; white-space: nowrap; }
.model input[type=radio] { accent-color: var(--human); }
.filter { max-width: 280px; min-height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
table.list { width: 100%; border-collapse: collapse; font-size: 13px; }
table.list th { text-align: left; font: 600 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 6px 8px; }
table.list td { padding: 8px; border-top: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.test-out { display: grid; gap: 6px; margin-top: 10px; }
.test-out div { padding: 8px 10px; border-radius: 8px; font-size: 13px; background: var(--sunk); }
.test-out .pass { background: var(--ok-soft); }
.test-out .miss { background: var(--bad-soft); }

@media (max-width: 960px) {
  .landing, .work { grid-template-columns: minmax(0, 1fr); }
  .landing { padding-top: 32px; gap: 32px; }
  .work { padding: 16px; }
  .top { padding: 12px 16px; }
  .turn { grid-template-columns: auto 1fr; }
  .turn .btn { grid-column: 1 / -1; }
}
