/* Tagmails: one stylesheet for the landing page, the signed-in app and run pages. */
:root {
  --bg: #fbfbf8;
  --fg: #141614;
  --secondary: #3b403c;
  --muted: #6a706b;
  --faint: #a4aaa5;
  --line: #e9ebe5;
  --surface: #f2f4ee;
  --raised: #ffffff;
  --accent: #141614;
  --accent-ink: #fbfbf8;
  --link: #1b6b45;
  --mark: #d0f06c;
  --ok: #1f7a4c;
  --warn: #8a5a12;
  --danger: #a3321f;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  /* Plain-text email heritage: headings and the wordmark are set in the system monospace. Change --display to restyle them. */
  --display: var(--mono);
  --radius: 10px;
  color-scheme: light;
}
/* Light only, by design: the brand is green on paper and black. */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--link); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; background: var(--bg); padding: 8px; z-index: 2; }
[hidden] { display: none !important; }
.icon { width: 18px; height: 18px; flex: none; }
.icon.lg { width: 22px; height: 22px; }

/* Header: wordmark and tagline left, actions pinned right. */
.top { position: sticky; top: 0; z-index: 1; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px); }
.top-inner { max-width: 760px; margin: 0 auto; padding: 14px 16px; display: flex; align-items: center; gap: 18px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--fg); font: 700 17px/1 var(--display); letter-spacing: -0.03em; text-decoration: none; }
.brand .mark { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; background: #141614; color: var(--mark); font-size: 13px; }
.brand .dot { color: #4f8a2a; }
.tagline { color: var(--muted); font-size: 15px; }
.spacer { flex: 1; }
.nav { display: flex; gap: 18px; font-size: 14px; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--fg); }
.tabs { display: flex; gap: 4px; }
.tabs a { color: var(--muted); text-decoration: none; font-size: 15px; padding: 6px 10px; border-radius: 8px; }
.tabs a:hover { color: var(--fg); background: var(--surface); }
.tabs a[aria-current="page"] { color: var(--fg); background: var(--surface); font-weight: 550; }
@media (max-width: 640px) { .tagline { display: none; } .top-inner { gap: 12px; } .nav { gap: 12px; } }

button, .button {
  font: inherit; font-size: 14px; line-height: 20px; cursor: pointer; text-decoration: none; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; background: var(--surface); color: var(--fg); border-radius: 8px; padding: 8px 13px;
}
button:hover, .button:hover { background: color-mix(in srgb, var(--surface) 70%, var(--faint)); }
button.primary, .button.primary { background: var(--accent); color: var(--accent-ink); }
button.primary:hover, .button.primary:hover { background: var(--accent); opacity: 0.88; }
button.ghost { background: none; color: var(--muted); }
button.ghost:hover { color: var(--fg); background: var(--surface); }
button:disabled { opacity: 0.5; cursor: default; }
.google { gap: 10px; padding: 8px 14px; }
.google .icon { width: 16px; height: 16px; }

.page { max-width: 760px; margin: 0 auto; padding: 40px 16px 80px; }
h1 { font: 650 32px/1.2 var(--display); letter-spacing: -0.04em; margin: 0 0 12px; }
h2 { font: 600 17px/1.35 var(--display); margin: 0 0 8px; letter-spacing: -0.02em; }
h3 { font-size: 15px; margin: 0 0 4px; font-weight: 600; }
p { margin: 0 0 12px; }
.lead { font-size: 18px; color: var(--secondary); max-width: 34em; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.warn { color: var(--warn); }
.error { color: var(--danger); }
.status { color: var(--muted); min-height: 1.6em; }
.status:empty { min-height: 0; margin: 0; }
section + section { margin-top: 48px; }

/* Landing */
.hero { padding: 40px 0 8px; }
.hero h1 { font-size: 40px; }
@media (max-width: 640px) { .hero h1 { font-size: 32px; } }
.thread { margin: 32px 0 8px; }
.mail { display: grid; grid-template-columns: 32px 1fr; gap: 12px; padding: 12px 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 13px; background: var(--surface); color: var(--secondary); }
.avatar.agent { background: #141614; color: var(--mark); }
.mail-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 14px; }
.mail-head strong { font-weight: 600; }
.mail-head span { color: var(--muted); }
.mail p { margin: 4px 0 0; }
.mail .foot { margin-top: 10px; font-size: 12px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; }
.points { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 32px; }
.points div { display: grid; gap: 6px; align-content: start; }
.points .icon { color: var(--secondary); }
@media (max-width: 640px) { .points { grid-template-columns: 1fr; } }
.price { display: grid; gap: 4px; }
.price .amount { font: 650 26px/1.2 var(--display); letter-spacing: -0.04em; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; margin-top: 8px; }
.table td { padding: 8px 0; vertical-align: top; }
.table td:last-child { text-align: right; color: var(--secondary); white-space: nowrap; padding-left: 16px; }
.cta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 20px; }
.foot-links { margin-top: 72px; color: var(--muted); font-size: 14px; display: flex; gap: 18px; flex-wrap: wrap; }
.foot-links a { color: var(--muted); }

/* App */
.panel { padding: 0; }
.panel + .panel { margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 0; }
.address { font: 600 18px/1.4 var(--mono); letter-spacing: -0.02em; overflow-wrap: anywhere; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 2px 10px; border-radius: 999px; background: var(--surface); color: var(--secondary); }
.pill.ok::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.pill.off::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.list li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.list a { color: var(--fg); text-decoration: none; }
.list a:hover { text-decoration: underline; }

.step { display: grid; grid-template-columns: 28px 1fr; gap: 12px; }
.step + .step { margin-top: 28px; }
.step .num { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-size: 13px; color: var(--muted); }
.step.done .num { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* Card choices (harness, permissions, models) */
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-top: 10px; }
.choices.two { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 520px) { .choices.two { grid-template-columns: 1fr; } }
.choice { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: start; padding: 12px 14px; border-radius: var(--radius); cursor: pointer; background: var(--surface); }
.choice:hover { background: color-mix(in srgb, var(--surface) 70%, var(--faint)); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice .icon { margin-top: 2px; }
.choice strong { font-weight: 600; font-size: 15px; }
.choice span { grid-column: 2; color: var(--muted); font-size: 13px; line-height: 1.45; }
.choice:has(input:checked) { box-shadow: 0 0 0 1.5px var(--fg); }
.choice:has(input:focus-visible) { outline: 2px solid var(--link); outline-offset: 2px; }

label.field { display: block; font-size: 14px; color: var(--muted); margin: 12px 0 6px; }
input[type="text"], select {
  font: inherit; font-size: 15px; color: var(--fg); background: var(--raised);
  border: 0; background: var(--surface); border-radius: 8px; padding: 9px 11px; max-width: 100%;
}
input[type="text"] { width: 100%; }
input.mono { font-family: var(--mono); font-size: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--secondary); margin-top: 10px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--fg); }
.inline-input { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-input input { flex: 1 1 160px; max-width: 260px; font-family: var(--mono); font-size: 14px; }

code, pre { font-family: var(--mono); font-size: 0.875em; }
:not(pre) > code { background: var(--surface); border-radius: 4px; padding: 1px 5px; }
pre { background: var(--surface); border-radius: 8px; padding: 12px 14px; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.copyable { position: relative; }
.copyable pre { padding-right: 84px; }
.copyable .copy { position: absolute; top: 8px; right: 8px; padding: 4px 10px; }
details > summary { cursor: pointer; color: var(--muted); font-size: 14px; margin-top: 10px; }

/* Account menu */
.menu { position: relative; }
.menu-button { width: 32px; height: 32px; padding: 0; border-radius: 50%; font-weight: 600; }
.menu-list { position: absolute; right: 0; top: 40px; min-width: 220px; background: var(--raised); border-radius: var(--radius); padding: 6px; box-shadow: 0 8px 28px rgb(0 0 0 / 0.12); }
.menu-list p { padding: 6px 10px; margin: 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.menu-list button { width: 100%; justify-content: flex-start; border: 0; }

/* Rendered agent answers (run page) */
.meta { color: var(--muted); font-size: 14px; display: flex; flex-wrap: wrap; margin: 0 0 20px; }
.meta > span + span::before { content: "·"; color: var(--faint); padding: 0 8px; }
.answer { overflow-wrap: anywhere; }
.answer ul, .answer ol { padding-left: 22px; }
.answer table { border-collapse: collapse; margin: 0 0 12px; font-size: 14px; display: block; overflow-x: auto; }
.answer th, .answer td { border: 1px solid var(--line); padding: 5px 9px; text-align: left; vertical-align: top; }
.answer blockquote { margin: 0 0 12px; padding-left: 12px; border-left: 3px solid var(--line); color: var(--secondary); }
.answer pre { margin: 0 0 12px; }
.prose h2 { margin-top: 28px; }
.prose ul { padding-left: 22px; }
.status-bar { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.status-bar .status:not(:empty) { margin: 16px 0 0; padding: 10px 14px; border-radius: 8px; background: var(--surface); color: var(--secondary); }
button.link { border: 0; background: none; padding: 0; margin-left: 4px; color: var(--link); font: inherit; cursor: pointer; }
button.link:hover { text-decoration: underline; }

/* Signed-in page */
.app .panel { scroll-margin-top: 72px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0 4px; }
.field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
@media (max-width: 560px) { .fields { grid-template-columns: 1fr; } }
.label { font-size: 13px; font-weight: 500; color: var(--muted); }
.label .value { color: var(--fg); font-weight: 600; margin-left: 6px; }
.actions { margin-top: 16px; }

.dropdown { position: relative; }
.dropdown-trigger { width: 100%; display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; justify-content: flex-start; text-align: left; }
.dropdown-trigger .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.chevron { width: 8px; height: 8px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg) translateY(-2px); flex: none; transition: transform 150ms cubic-bezier(0.25, 1, 0.5, 1); }
[aria-expanded="true"] > .chevron { transform: rotate(225deg) translateY(-2px); }
.dropdown-list { position: absolute; z-index: 3; left: 0; right: 0; top: calc(100% + 4px); list-style: none; margin: 0; padding: 4px; background: var(--raised); border-radius: var(--radius); box-shadow: 0 8px 28px rgb(0 0 0 / 0.12); max-height: 320px; overflow: auto; }
.dropdown-list li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; cursor: pointer; outline: none; }
.dropdown-list li .grow { display: grid; gap: 2px; }
.dropdown-list li strong { font-weight: 550; font-size: 15px; }
.dropdown-list li:hover, .dropdown-list li:focus-visible { background: var(--surface); }
.dropdown-list li[aria-selected="true"] strong::after { content: " ✓"; color: var(--muted); font-weight: 400; }
.dropdown-list .icon { margin-top: 2px; }

/* Fixed thumb size so each tick label can be centred exactly on its stop:
   stop centre = thumb/2 + p * (width - thumb), where p is 0..1. */
:root { --thumb: 18px; }
input[type="range"] { --p: 0; --stop: calc(var(--thumb) / 2 + var(--p) * (100% - var(--thumb)));
  -webkit-appearance: none; appearance: none; width: 100%; height: var(--thumb); margin: 4px 0 0;
  background: transparent; cursor: pointer; }
input[type="range"]:focus-visible { outline: 2px solid var(--link); outline-offset: 4px; border-radius: 999px; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 999px;
  background: linear-gradient(to right, var(--fg) var(--stop), var(--line) var(--stop)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: var(--thumb);
  height: var(--thumb); margin-top: calc((6px - var(--thumb)) / 2); border: 0; border-radius: 50%;
  background: var(--fg); box-shadow: 0 0 0 2px var(--raised); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 999px; background: var(--line); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--fg); }
input[type="range"]::-moz-range-thumb { width: var(--thumb); height: var(--thumb); border: 0; border-radius: 50%;
  background: var(--fg); box-shadow: 0 0 0 2px var(--raised); }
.ticks { position: relative; height: 1.5em; font-size: 12px; color: var(--muted); }
.ticks span { position: absolute; top: 0; left: calc(var(--thumb) / 2 + var(--p) * (100% - var(--thumb)));
  transform: translateX(-50%); white-space: nowrap; }

.segmented { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface); border-radius: 10px; width: fit-content; max-width: 100%; }
.segment { background: none; padding: 6px 12px; border-radius: 7px; gap: 8px; color: var(--secondary); }
.segment:hover:not(:disabled) { color: var(--fg); }
.segment[aria-checked="true"] { background: var(--raised); color: var(--fg); font-weight: 550; box-shadow: 0 1px 2px rgb(0 0 0 / 0.08); }
#permissionHint { margin: 6px 0 0; }

.setup { margin-top: 12px; padding-top: 16px; display: grid; gap: 12px; }
.setup > * { margin: 0; }
.setup #pair { justify-self: start; }
.list li > .icon { color: var(--muted); }

.threads { list-style: none; margin: 8px 0 0; padding: 0; }
.email-row { border-top: 1px solid var(--line); }
.email-row:first-child { border-top: 0; }
.thread-toggle { width: 100%; border: 0; background: none; padding: 12px 0; border-radius: 0; gap: 12px; justify-content: flex-start; text-align: left; font-weight: 500; }
.thread-toggle .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.thread-toggle:hover .grow { text-decoration: underline; }
.thread-body { padding: 0 0 16px; }
.runs { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.run { border-left: 2px solid var(--line); padding-left: 14px; display: grid; gap: 6px; }
.run > p { margin: 0; }
.run .request { color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; padding-bottom: 6px; border-bottom: 1px dashed var(--line); }
.run .meta { margin: 0; }
.files { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.files li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.earlier { margin-bottom: 8px; }
.pager { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }

/* A stored session paints the signed-in page right away. */
.signed-in #landing, .signed-in #signIn { display: none !important; }
.signed-in #app[hidden], .signed-in #menu[hidden] { display: block; }
#computers > #promptBlock, #computers > #connection { margin-top: 12px; }
#pair span { min-width: 9.5em; text-align: left; }

/* Landing: the setup prompt and a plain price list. */
.setup-block { margin-top: 36px; }
.setup-block h2 { margin-bottom: 10px; }
.setup-block .copyable pre { font-size: 15px; padding-top: 14px; padding-bottom: 14px; }
.facts { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; color: var(--secondary); }
.facts li::before { content: "– "; color: var(--faint); }
.example { margin-top: 36px; }
.example .mail p { margin: 2px 0 0; }
.example .foot { color: var(--muted); font-size: 13px; margin-top: 6px; }

/* Guides and policy pages. */
.prose { line-height: 1.7; }
.prose h2 { margin-top: 36px; }
.prose h3 { margin-top: 24px; font-family: var(--display); letter-spacing: -0.02em; }
.prose p, .prose li { max-width: 40em; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li + li { margin-top: 4px; }
.prose pre { margin: 12px 0 16px; }
.prose .table { margin: 12px 0 20px; font-size: 15px; }
.prose .table th { text-align: left; font-weight: 600; padding: 8px 12px 8px 0; color: var(--secondary); }
.prose .table td { padding: 8px 12px 8px 0; border-top: 1px solid var(--line); }
.prose .table td:last-child { text-align: left; white-space: normal; padding-left: 0; }
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 20px; }
.crumbs a { color: var(--muted); }
.guide-list { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 22px; }
.guide-list a { color: var(--fg); font: 600 17px/1.4 var(--display); letter-spacing: -0.02em; text-decoration: none; }
.guide-list a:hover { text-decoration: underline; }
.guide-list p { margin: 2px 0 0; color: var(--muted); font-size: 15px; }
.next { margin-top: 48px; color: var(--muted); font-size: 15px; }
