/* AMOMO portal stylesheet — shared by every server-rendered page:
   serving's own templates and infrastructure's _base.html shell both link
   /ui/styles.css, so the class vocabulary here (.shell, .panel, nav, .sub,
   .msg, .row, form controls, tables, code.token) is a rendering contract.
   Keep those selectors stable; page-specific classes (.hero, .cards, .auth)
   are additive. Self-contained: system fonts only, no external assets. */

/* The portal is light unless the reader chose dark (/ui/theme.js puts
   data-theme="dark" on <html> before anything is drawn). Both are the AMOMO
   brand palette — AMindOfMyOwn_Color_Guide v1.0: its light, print set (Off-
   White ground, white cards, Ink and Slate text, the print cyan-to-pink pair)
   and its approved dark, screen set (Navy ground, the screen pair) — the same
   values the amomo terminal draws with. Names stay role-based (--bg, --panel,
   --accent) so a page never encodes which brand colour fills a role; the
   guide's names appear only here, where the mapping is made once. The -rgb
   tokens are the same colours as bare channels, for tints: rgba(var(--x-rgb), a).
   The cyan-to-pink gradient is reserved for the wordmark and progress fills
   and is deliberately not offered as a variable. */
:root {
  /* Declared, so Chrome's Auto Dark Mode knows the page chose its scheme. */
  color-scheme: light;
  /* The width of the sign-in box, and of everything that has to line up with
     it: the step heading above it, and the cards below. One definition,
     because the moment these were two numbers they drifted — the box narrowed
     and the heading did not, so "Log in" started to the left of the box it
     names. */
  --box: 380px;
  --bg: #F8F9FC;              /* off-white — the page ground */
  --panel: #FFFFFF;           /* card — raised surfaces */
  --card-soft: #F3F5F9;       /* a card inside a card */
  --field: #FFFFFF;           /* inset controls */
  --border: #E3E6EC;
  --border-strong: #D9D9D9;   /* guide border */
  --text: #1A2233;            /* ink */
  --strong: #1A2233;          /* headline text that is white on the dark ground */
  --muted: #4E5A73;           /* slate */
  --placeholder: rgba(78, 90, 115, 0.55);
  --accent: #0077B6;          /* print cyan, deepened to read as text on white */
  --accent-rgb: 0, 180, 230;  /* print cyan, for tints and glows */
  --accent-2: #E0156F;        /* print pink — a discrete accent, never blended */
  --accent-2-rgb: 240, 32, 131;
  --accent-hover: #0090D0;
  --link: #0077B6;            /* links: the accent, readable on white */
  --on-accent: #FFFFFF;       /* text on an accent or status fill */
  --tint-rgb: 26, 34, 51;     /* neutral hover and selection tints: ink */
  --ok: #138A4E;
  --ok-rgb: 19, 138, 78;
  --bad: #D0214F;
  --bad-rgb: 208, 33, 79;
  --warn: #B26A00;
  --warn-rgb: 178, 106, 0;
  --shadow-rgb: 26, 34, 51;
  --shadow-k: 0.35;           /* shadows are lighter on a light ground */
  --glow-k: 0.5;
  --radius: 0;
  --radius-sm: 0;
  --gap: 18px;
  font-size: 16px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14203A;              /* navy */
  --panel: rgba(31, 46, 80, 0.72);  /* track, over navy */
  --card-soft: rgba(31, 46, 80, 0.35);
  --field: #0F1930;           /* deep — below the ground */
  --border: rgba(47, 65, 107, 0.55);
  --border-strong: #2F416B;
  --text: #EDF1F8;            /* soft */
  --strong: #FFFFFF;
  --muted: #AFBAD2;
  --placeholder: rgba(154, 163, 181, 0.55);
  --accent: #00C8FF;          /* screen cyan */
  --accent-rgb: 0, 200, 255;
  --accent-2: #FF2E92;        /* screen pink */
  --accent-2-rgb: 255, 46, 146;
  --accent-hover: #5FDCFF;
  --link: #7FDBFF;            /* highlight cyan — the guide's links on navy */
  --on-accent: #0F1930;
  --tint-rgb: 175, 186, 210;
  --ok: #4ade80;
  --ok-rgb: 74, 222, 128;
  --bad: #f87171;
  --bad-rgb: 248, 113, 113;
  --warn: #fbbf24;
  --warn-rgb: 251, 191, 36;
  --shadow-rgb: 0, 0, 0;
  --shadow-k: 1;
  --glow-k: 1;
}

* { box-sizing: border-box; }
a { color: var(--link); }
a:hover { color: var(--accent-hover); }
html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
/* Fixed ambient glows behind everything — cheap depth without images. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(600px 400px at 15% -5%, rgba(var(--accent-rgb), calc(0.16 * var(--glow-k))), transparent 60%),
    radial-gradient(700px 500px at 90% 10%, rgba(var(--accent-2-rgb), calc(0.12 * var(--glow-k))), transparent 60%),
    radial-gradient(500px 400px at 50% 110%, rgba(45, 212, 191, calc(0.07 * var(--glow-k))), transparent 60%);
}

.shell {
  max-width: 780px;
  margin: 0 auto;
  padding: 56px 24px 48px;
}
/* Two widths, one column. The shell is wide so the wordmark and the motto
   can be full size; the box inside it stays the narrow shape people
   recognise as "this is where you go in". Making the shell do both jobs is
   what forced the choice between a big mark and a narrow box — the mark was
   capped by whatever width the form wanted.
   Every child that is not the header is held to the box width, so the page
   reads as one centred column rather than a wide header over a narrow form. */
.shell.auth { max-width: 780px; padding-top: 9vh; }
.shell.auth .panel,
.shell.auth .cards {
  /* Narrower than the 460 it was. At that width the sign-in box was a wide,
     shallow strip — two fields and a button in a box half again as wide as it
     was tall. Closer to square reads as a form to fill in rather than a bar
     across the page. The cost lands on register, which has one more field and
     so grows taller; that is the right place for the cost, since the page
     someone uses once can afford to be longer than the one they use daily. */
  max-width: var(--box);
  margin-left: auto;
  margin-right: auto;
}

.shell h1 {
  /* The step, not the identity. It sits under the wordmark and must read
     as smaller than it: a page whose heading out-shouts the brand tells
     the reader the step matters more than whose product this is. */
  font-size: clamp(1.15rem, 0.95rem + 0.8vw, 1.45rem);
  font-weight: 650;
  letter-spacing: -0.025em;
  margin: 0 0 8px;
}
.shell p.sub { color: var(--muted); margin: 0 0 calc(var(--gap) + 6px); max-width: 56ch; }

/* Brand wordmark — small link-home lockup used above page titles. */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
  text-decoration: none;
  color: var(--text);
  font-weight: 650;
  letter-spacing: 0.02em;
}

.panel {
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 26px;
  margin-bottom: var(--gap);
  box-shadow: 0 18px 48px rgba(var(--shadow-rgb), calc(0.42 * var(--shadow-k)));
}

/* Nav renders as a pill tab-bar; _base.html places it at the top of .panel. */
nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: -6px 0 var(--gap);
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 550;
  padding: 6px 12px;
  border-radius: 0;
  transition: color 0.12s ease, background 0.12s ease;
}
nav a:hover { color: var(--text); background: rgba(var(--tint-rgb), 0.10); }
nav a.active { color: var(--text); background: rgba(var(--accent-rgb), 0.18); }
/* The light/dark switch at the end of the nav (/ui/theme.js labels it with
   what it switches to). A nav item, not a button: no fill, no lift. */
nav .theme-toggle {
  margin-left: auto;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  box-shadow: none;
  padding: 4px 10px;
  font-size: 14px;
  line-height: 1.4;
  border-radius: 0;
}
nav .theme-toggle:hover { color: var(--text); background: rgba(var(--tint-rgb), 0.10); filter: none; transform: none; box-shadow: none; }

label { display: block; font-size: 13.5px; font-weight: 550; margin: 14px 0 6px; color: var(--muted); }
input, select, textarea {
  width: 100%;
  background: var(--field);
  border: 1px solid var(--border-strong);
  border-radius: 0;
  color: var(--text);
  padding: 11px 13px;
  font-family: inherit;
  font-size: 15px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
input::placeholder, textarea::placeholder { color: var(--placeholder); }

/* A password field and the control that reveals it. The button sits inside the
   field's box rather than beside it, so the input keeps its full width and the
   layout does not shift when the control appears. */
.reveal { position: relative; }
.reveal input { padding-right: 44px; }
.reveal button {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  background: none;
  border: none;
  box-shadow: none;
  color: var(--muted);
  cursor: pointer;
}
.reveal button:hover { color: var(--text); background: none; }
/* Focus stays visible: the control is reachable by keyboard, and a reveal
   toggle that cannot be seen when tabbed to is a control only a mouse has. */
.reveal button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.reveal svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.22);
}

button, a.button {
  display: inline-block;
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  border-radius: 0;
  padding: 11px 20px;
  font-weight: 650;
  font-size: 15px;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(var(--accent-rgb), 0.28);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
button:hover, a.button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(var(--accent-rgb), 0.36);
}
button:active, a.button:active { transform: translateY(0); }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
button.secondary, a.button.secondary {
  background: rgba(var(--tint-rgb), 0.08);
  color: var(--text);
  border: none;
  box-shadow: none;
}
button.secondary:hover, a.button.secondary:hover {
  background: rgba(var(--tint-rgb), 0.14);
  filter: none;
}
button.danger { background: var(--bad); color: var(--on-accent); box-shadow: 0 6px 20px rgba(var(--bad-rgb), 0.25); }

.row      { display: flex; gap: 12px; align-items: center; }
.row > *  { flex: 1; }
.row button { flex: 0 0 auto; }

.msg         { padding: 12px 14px; border-radius: 0; margin: 14px 0 0; font-size: 14px; }
.msg.ok      { background: rgba(var(--ok-rgb), 0.10);  color: var(--ok);   border: 1px solid rgba(var(--ok-rgb), 0.30); }
.msg.bad     { background: rgba(var(--bad-rgb), 0.10); color: var(--bad);  border: 1px solid rgba(var(--bad-rgb), 0.30); }
.msg.warn    { background: rgba(var(--warn-rgb), 0.10);  color: var(--warn); border: 1px solid rgba(var(--warn-rgb), 0.30); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--muted); font-weight: 550; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.06em; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.1s ease; }
tbody tr:hover { background: rgba(var(--tint-rgb), 0.05); }

code.token {
  display: block;
  background: var(--field);
  border: 1px solid var(--border-strong);
  border-radius: 0;
  padding: 13px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
  word-break: break-all;
}

/* ── Landing page (templates/index.html) ─────────────────────────── */

.hero { text-align: center; padding: 4vh 0 10px; }
.hero .brand { justify-content: center; margin-bottom: 34px; }
.hero h1 {
  /* Smaller than the wordmark above it. The mark is the identity; this is a
     line about it, and a line that outgrows the mark inverts the two. */
  font-size: clamp(1.1rem, 0.9rem + 0.9vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 14px;
}
.hero h1 .grad {
  /* Plain white, not the accent and not the gradient: the cyan-to-pink
     blend belongs to the wordmark directly above, and a line wearing it
     reads as a second logo competing with the first. */
  color: var(--strong);
  font-weight: 600;
  letter-spacing: 0.01em;
}
.hero p.sub { margin: 0 auto 30px; max-width: 46ch; font-size: 1.06rem; }
.cta { display: flex; justify-content: center; gap: 12px; margin-bottom: 44px; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  /* Clear of the way-in panel above. What AMOMO offers is a separate thought
     from how you get in, and the two read as one list without this. */
  margin-top: 34px;
}
/* In the narrow sign-in column three cards would fall two-then-one, leaving an
   orphan that reads as a mistake. Stacked, they are a list. */
.shell.auth .cards { grid-template-columns: 1fr; }
.card {
  display: block;
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 18px 20px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.14s ease, transform 0.14s ease, box-shadow 0.14s ease;
}
.card:hover {
  border-color: rgba(var(--accent-rgb), 0.45);
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(var(--shadow-rgb), calc(0.35 * var(--shadow-k)));
}
.card h3 { margin: 0 0 6px; font-size: 15.5px; font-weight: 650; letter-spacing: -0.01em; }
.card p  { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.45; }

.footnote { text-align: center; color: var(--muted); font-size: 13.5px; margin-top: 34px; }
.footnote a { color: var(--accent); text-decoration: none; }
.footnote a:hover { color: var(--accent-hover); }

/* A six-digit code, wherever one is asked for: signing in, enrolling an
   authenticator, confirming an address. One rule rather than three, so the
   three cannot drift apart — they are the same act to the person typing.
   Tabular figures keep the digits from shifting width as they are entered;
   the text-indent offsets the trailing letter-space so the run sits centred
   rather than pushed right. */
input.code {
  letter-spacing: 0.55em;
  text-indent: 0.55em;
  font-size: 1.9rem;
  text-align: center;
  padding: 14px 12px;
  font-variant-numeric: tabular-nums;
}

/* The company wordmark, in place of a text heading on the landing page. It
   is the full lock-up including the ™, so it is given room and capped so it
   never outgrows the column on a wide screen. The asset has a transparent
   background and its own gradient, so it needs no plate behind it in either
   theme. */
.hero .wordmark {
  display: block;
  width: 100%;
  max-width: 680px;
  height: auto;
  margin: 0 auto 18px;
}

/* The wordmark where the "A" tile and the word AMOMO used to sit. Sized by
   height rather than width so it lines up with whatever it shares a bar
   with, and capped in width so a wide header cannot stretch it. One rule
   for every surface — auth pages, chat, widget — because a brand that
   differs per page is not a brand. */
.brandmark {
  /* Sized by width, not height. The wordmark is roughly eight times wider
     than it is tall, so a height that looks right implies a width of some
     hundreds of pixels — and a max-width smaller than that silently wins,
     which is how this ended up shrunk on the pages that set both. One
     dimension governs; the other follows. */
  display: block;
  width: 200px;
  max-width: 60%;
  height: auto;
}
.brand .brandmark {
  /* The sign-in pages carry the mark at the same weight as the landing
     page: someone arriving at /login should meet the same company, at the
     same size, as someone arriving at the front door. Percentage cap so a
     narrow window shrinks it instead of overflowing the panel. */
  width: 680px;
  max-width: 92%;
  margin-bottom: 10px;
}

/* `hidden` must actually hide. An element with a `display` rule of its own —
   nav is flex, rows are flex — ignores the attribute's default styling and
   stays on screen, which is how the sign-in nav survived into the code step
   it was supposed to leave. One rule, so no page has to remember this. */
[hidden] { display: none !important; }

/* Two columns where there is room, one where there is not. The pages that
   use this put the pair that belong together first — agents beside you,
   posture beside identity — so the reader's eye lands on both without
   scrolling, and a narrow window stacks them in the same order rather than
   reflowing into something else. */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 14px;
  align-items: start;
}

/* The line under the wordmark on the auth pages. It is the same promise the
   landing page makes, said in the same words, so someone who arrives straight
   at /login meets the company rather than a bare form.
   White and light: the cyan-to-pink gradient belongs to the wordmark directly
   above it, and a line wearing it reads as a second logo competing with the
   first. Sized well below the mark, because the mark is the name and this is
   the sentence about it. */
/* The motto, identical on the landing page and both sign-in pages: same size,
   same colour, same distance from the mark above and the way-in below.
   White, not the gradient — the cyan-to-pink blend belongs to the wordmark
   directly above, and a line wearing it reads as a second logo competing with
   the first.
   The gap beneath it is deliberately large. The mark and the motto are one
   thought and belong together; what follows is a different thought — the way
   in — and running them together made the page read as one dense block. */
.tagline {
  margin: 2px auto 52px;
  text-align: center;
  color: var(--strong);
  font-size: clamp(1.3rem, 1rem + 1.3vw, 1.95rem);
  font-weight: 600;
  letter-spacing: 0.01em;
}
/* The lockup is centred on every front-of-house page, whichever shell it is
   in: `.brand` is an inline-flex row, which does not centre itself. */
.shell > .brand { display: flex; justify-content: center; margin: 0 auto 10px; }
/* The step name ("Log in", "Create your account") belongs to the panel below
   it, not to the motto above it: it is centred over the form and sits close
   to it, so the large gap under the motto separates identity from way-in
   rather than stranding the heading between the two. */
/* The step name sits above the box and starts at its left edge, not centred
   under the motto: it names what the box below is for, so it belongs to the
   box. Held to the panel width so the two left edges line up — without it the
   heading would start at the edge of the wider header column instead. */
.shell.auth > h1 {
  max-width: var(--box);
  margin: 0 auto 12px;
  text-align: left;
}

/* A card that is not yet anywhere. It keeps the shape of the real ones so the
   row reads as a row, but it is not an <a>, does not lift on hover, and says
   plainly that it is unfinished — a card that looks clickable and goes nowhere
   teaches a visitor that the site is broken rather than that the section is
   coming. */
.card.soon {
  cursor: default;
  opacity: 0.72;
}
.card.soon:hover { transform: none; }
.card.soon .badge {
  display: inline-block;
  margin-top: 10px;
  padding: 2px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 0;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

/* The two ways in, side by side and equal: neither creating an account nor
   signing in is the lesser choice, and a row where one button is wider says
   otherwise. They fill the panel the way a form fills it on /login, so the
   box does not read as empty. */
.row.wayin { display: flex; gap: 10px; margin-top: 18px; }
.row.wayin .button { flex: 1; text-align: center; }


/* A checkbox that reads as one line, not as a field with a label above it:
   the box and its sentence belong together, and `label` is block-level with a
   bottom margin by default, which stacked them. */
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 0;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}
.check input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ---------------------------------------------------------------------------
   The money and estate pages.

   These rules used to be three `<style>` blocks inside three templates, two of
   them byte-identical: a table style copied into whichever page wanted it next
   is a rule with no single place to change. Colours are role tokens, never
   literals — one page hard-coded `#111` for its headings, which on this
   theme's navy is text you cannot read.
   --------------------------------------------------------------------------- */

/* Data tables: the fleet, the credentials, every breakdown. */
.fleet { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: 0.9rem; }
.fleet th, .fleet td { padding: 0.5rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
.fleet th { color: var(--muted); font-weight: 500; }
.fleet td.mono, .mono { font-family: ui-monospace, SFMono-Regular, monospace; font-size: 0.8rem; }
.right { text-align: right; }

/* Agent states. `unknown` is its own colour because it is its own answer:
   nothing recorded a state, which is not the same as the agent being idle. */
.state-idle, .state-completed, .state-retired, .state-terminated { color: var(--muted); }
.state-unknown { color: var(--muted); font-style: italic; }
.state-running, .state-live { color: var(--accent); font-weight: 600; }
.state-waitingfortool, .state-expiring_soon { color: var(--warn); }
.state-error, .state-expired, .state-revoked { color: var(--bad); font-weight: 600; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }

/* Headline numbers. */
.tiles { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1rem; }
.tile { flex: 1 1 10rem; padding: 0.75rem; border: 1px solid var(--border); border-radius: 0; }
.tile .n { display: block; font-size: 1.4rem; font-family: ui-monospace, SFMono-Regular, monospace; }
.tile .k { display: block; color: var(--muted); font-size: 0.8rem; margin-top: 4px; }

/* Charts and proportions. */
.bars { color: var(--accent); display: block; width: 100%; height: 80px; }
.bars .zero { opacity: 0.35; }
.money { font-variant-numeric: tabular-nums; }
.meter { height: 6px; background: var(--border); border-radius: 0; margin-top: 4px; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 0; }
.badge-ok { color: var(--ok); }
.badge-warn { color: var(--warn); }
.badge-over { color: var(--bad); }
.badge-none { color: var(--muted); }
.badge-unknown { color: var(--muted); }

/* Fact lists and timelines. */
.facts { display: grid; grid-template-columns: 12rem 1fr; gap: 0.25rem 1rem; font-size: 0.9rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.timeline { margin-top: 1rem; }
.timeline-row { display: grid; grid-template-columns: 16rem 1fr; gap: 1rem; padding: 0.5rem 0; border-bottom: 1px dashed var(--border); font-size: 0.85rem; }
.timeline-row .ts { color: var(--muted); }
.timeline-row .kind { font-weight: 600; color: var(--text); }

/* The credentials page. */
.scopes { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 8px 0; }
.scopes label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; }
.scopes input { width: auto; margin: 0; }
.token { display: block; margin-top: 0.5rem; padding: 0.5rem; background: var(--border); border-radius: 0; word-break: break-all; }
.activity { margin: 0.5rem 0 0; padding-left: 1.2rem; color: var(--muted); font-size: 0.85rem; }
tr.detail td { border-bottom: 1px solid var(--border); }

/* ---------------------------------------------------------------------------
   The task board (the Terminal page's panel).

   One row per task, wrapping onto a second line where the window is narrow,
   so a phone never scrolls sideways: the label keeps the first line, the
   figures and controls move under it. The status mark is drawn here from the
   row's `status-*` class, the one place the words become symbols — the
   server's first frame and the script's redraws both leave it empty.
   --------------------------------------------------------------------------- */

.task-add { display: flex; flex-wrap: wrap; gap: 10px; }
.task-add input { flex: 1 1 14rem; }
.task-add select { flex: 0 1 11rem; width: auto; }
.task-note { color: var(--muted); font-size: 0.9rem; margin: 12px 0 0; }
.task-msg:empty { display: none; }

.tasks { list-style: none; margin: 1rem 0 0; padding: 0; }
.task {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
}
.task:last-child { border-bottom: none; }
.task.child { padding-left: 2rem; font-size: 0.93rem; }
.task.dragging { opacity: 0.5; }
.task.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.task.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }

/* The small controls of a row: quiet until pointed at, and not the page's
   big accent button. */
.task button {
  padding: 3px 8px;
  font-size: 14px;
  font-weight: 550;
  line-height: 1.3;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border-strong);
  box-shadow: none;
}
.task button:hover { color: var(--text); background: rgba(var(--tint-rgb), 0.10); filter: none; transform: none; box-shadow: none; }
.task button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.task .task-grip { border: none; cursor: grab; touch-action: none; letter-spacing: -0.2em; }
.task.dragging .task-grip { cursor: grabbing; }
.task .task-fold { border: none; padding: 3px 4px; }

.task-mark { flex: none; width: 1.1em; text-align: center; color: var(--muted); }
.task-mark::before { content: "○"; }
.status-active > .task-mark { color: var(--accent); }
.status-active > .task-mark::before { content: "●"; }
.status-failed > .task-mark { color: var(--bad); }
.status-done > .task-mark { color: var(--ok); }
.status-done > .task-mark::before { content: "✓"; }
.status-done > .task-label { color: var(--muted); }
.status-paused > .task-mark { color: var(--warn); }
.status-paused > .task-mark::before { content: "‖"; }
/* ‖ pauses an agent's goal, ▶ resumes it: a small outlined square. */
.task .task-hold { border: 1px solid var(--border-strong); padding: 2px 7px; font-size: 12px; line-height: 1.2; color: var(--muted); }
.task .task-hold.paused { color: var(--accent); border-color: var(--accent); }
.status-failed > .task-mark::before { content: "✗"; }
.status-active > .task-label { font-weight: 600; }

.task-label { flex: 1 1 8rem; min-width: 0; overflow-wrap: anywhere; cursor: text; }
.task-label:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 0; }
.task-folder { color: var(--muted); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 0.85em; }
.task-rename { flex: 1 1 8rem; width: auto; padding: 4px 8px; font-size: inherit; }

.task-figs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-left: auto;
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.task-bar { display: inline-block; width: 6.5rem; height: 6px; background: var(--border); border-radius: 0; overflow: hidden; }
.task-bar i { display: block; height: 100%; background: var(--accent); }
.task-pct { min-width: 2.6em; text-align: right; }
.task-eta:empty { display: none; }
.task-eta.late { color: var(--warn); }
.task-source { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }

/* A phone: the row keeps its label and its ✓ ✕ on the first line and puts
   the figures on a second one, under the label. The shell's desk-sized
   margins give way on this page only, so the row has room for both. */
@media (max-width: 560px) {
  .task.child { padding-left: 1rem; }
  .task-figs { order: 2; flex: 1 1 100%; margin-left: 0; padding-left: 2.2rem; }
  .task-bar { width: 5rem; }
}

/* ---------------------------------------------------------------------------
   The Terminal page: the person's live amomo sessions, one column each, with
   the task board and Settings in a panel on the left. The page is the whole
   window: the wordmark heads the panel's column, a line runs under it, and
   ◧ sits in the corner where that line meets the panel's divider. The
   sessions run from the top of the window to the bottom.

   Buttons go without outlines; areas keep a thin, quiet border so they stay
   apart. The light page sits on its background colour with the transcript,
   cards and inputs on the panel colour.
   --------------------------------------------------------------------------- */

.shell:has(.term) { max-width: none; padding: 0; }
.shell:has(.term) > h1, .shell:has(.term) > p.sub, .shell:has(.term) nav { display: none; }
.shell:has(.term) > .panel { margin: 0; min-height: 100vh; border: none; box-shadow: none; padding: 14px 20px 16px; background: var(--bg); }

.term {
  display: grid;
  grid-template-columns: minmax(18rem, 23rem) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  column-gap: var(--gap);
  height: calc(100vh - 30px);
}
.term[data-panel="closed"] { grid-template-columns: auto minmax(0, 1fr); }

.term-brandrow {
  grid-column: 1; grid-row: 1;
  position: relative;
  padding: 0 var(--gap) 12px 0;
  margin-right: calc(-1 * var(--gap));
  border-bottom: 1px solid var(--border);
}
.term-brand { display: block; }
.term-brand .brandmark { width: 100%; max-width: none; }
.term[data-panel="closed"] .term-brand .brandmark { width: 180px; }
/* ◧: a small square whose top-right corner is where the line under the
   wordmark meets the panel's divider; its top edge lies on that line. */
.term-edge {
  position: absolute;
  right: 0;
  bottom: -21px;
  width: 20px;
  height: 20px;
  padding: 0;
  font-size: 12px;
  line-height: 1;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  box-shadow: none;
  z-index: 2;
}
.term-edge:hover { color: var(--text); transform: none; box-shadow: none; filter: none; }

.term-tasks {
  grid-column: 1; grid-row: 2;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 14px var(--gap) 0 0;
  margin-right: calc(-1 * var(--gap));
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.term[data-panel="closed"] .term-tasks { display: none; }
.term-main {
  grid-column: 2; grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding-left: var(--gap);
}

/* The task board in the panel: the narrow row — label first, figures under
   it — lines between tasks, no folder, and the wide + after the last one. */
.term-board { display: flex; flex-direction: column; }
.term-tasks .task-figs { flex: 1 1 100%; margin-left: 0; padding-left: 2.2rem; order: 2; }
.term-tasks .task-bar { width: 5rem; }
.task-new {
  width: 100%;
  margin-top: 8px;
  padding: 8px 0;
  font-size: 22px;
  line-height: 1;
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
  border: none;
  box-shadow: none;
}
.task-new:hover { background: rgba(var(--accent-rgb), 0.14); transform: none; box-shadow: none; filter: none; }
.term-tasks .task-add { margin-top: 8px; border-bottom: 2px solid var(--accent); }
.term-tasks .task-add input { border: none; background: var(--panel); padding: 8px 6px; box-shadow: none; }

/* Settings: the groups replace the tasks; the chosen one is marked. */
.term-settings { display: flex; flex-direction: column; gap: 2px; }
.term-back { align-self: flex-start; background: transparent; color: var(--link); border: none; box-shadow: none; padding: 0 0 12px; font-size: 14px; }
.term-back:hover { background: transparent; transform: none; box-shadow: none; filter: none; text-decoration: underline; }
.term-group {
  display: block; width: 100%; text-align: left;
  background: transparent; color: var(--text);
  border: none; border-left: 3px solid transparent; box-shadow: none;
  padding: 11px 12px; font-weight: 600; font-size: 15px;
}
.term-group small { display: block; font-weight: 400; font-size: 13px; color: var(--muted); margin-top: 2px; }
.term-group:hover { background: rgba(var(--tint-rgb), 0.07); transform: none; box-shadow: none; filter: none; }
.term-group[aria-current="true"] { border-left-color: var(--accent); background: rgba(var(--accent-rgb), 0.10); }

/* The panel's foot: Download, this month's spend, Settings and Sign out. */
.term-foot { margin-top: auto; padding: 12px 0 0; }
.term-download { display: block; font-size: 13px; text-decoration: none; padding-bottom: 8px; }
.term-spend { padding: 10px 0 12px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--border); }
.term-spend-figs { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.term-spend-figs strong { color: var(--text); font-size: 15px; font-variant-numeric: tabular-nums; }
.term-spend-bar { height: 4px; background: var(--border); }
.term-spend-bar i { display: block; height: 100%; background: var(--accent); }
.term-tasks-foot { display: flex; gap: 8px; padding-bottom: 2px; }
.term-tasks-foot > * { flex: 1 1 0; padding: 10px 12px; font-size: 14px; }
#term-settings-open[aria-pressed="true"] { background: rgba(var(--accent-rgb), 0.14); color: var(--accent); }

/* Sessions: one column each, side by side. */
.term-empty { border: 1px dashed var(--border-strong); padding: 28px; color: var(--muted); text-align: center; margin-top: 4px; }
.term-empty-title { color: var(--text); font-weight: 650; font-size: 1.05rem; margin: 0 0 6px; }
.term-empty p:last-child { margin: 0 auto; max-width: 52ch; }
.term-cols { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(26rem, 1fr)); gap: var(--gap); overflow-y: auto; }
.term-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 30rem; }
.term-head { display: flex; align-items: center; gap: 4px 10px; font-size: 14px; white-space: nowrap; min-width: 0; }
.term-folder { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 650; }
.term-where, .term-state { color: var(--muted); overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.term-head:has(.state-asks) .term-state { color: var(--warn); }
.term-toggles { display: inline-flex; gap: 6px; margin-left: auto; flex: none; }
.term-tog { padding: 4px 11px; font-size: 13px; font-weight: 600; background: rgba(var(--tint-rgb), 0.08); color: var(--muted); border: none; box-shadow: none; }
.term-tog:hover { transform: none; box-shadow: none; filter: none; background: rgba(var(--tint-rgb), 0.14); }
.term-tog.on { background: rgba(var(--ok-rgb), 0.16); color: var(--ok); }
.term-tog.live { background: rgba(var(--accent-rgb), 0.14); color: var(--accent); }
.term-tog:disabled { opacity: 0.55; }

.term-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--ok); }
.term-dot.state-busy { background: var(--accent); animation: term-pulse 1.4s ease-in-out infinite; }
.term-dot.state-asks { background: var(--warn); animation: term-pulse 1s ease-in-out infinite; }
.term-dot.state-offline { background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted); }
@keyframes term-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .term-dot { animation: none !important; } }

.term-log {
  flex: 1 1 auto;
  min-height: 8rem;
  list-style: none;
  margin: 0;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  overflow-y: auto;
  overscroll-behavior: contain;
  font-size: 14.5px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.term-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-width: 0; overflow-wrap: anywhere; }
.term-quiet { color: var(--muted); }
.term-ok { color: var(--ok); }
.term-bad { color: var(--bad); }
.term-request { margin-top: 10px; padding: 8px 12px; background: rgba(var(--accent-rgb), 0.10); }
.term-request:first-child { margin-top: 0; }
.term-who { color: var(--accent); font-weight: 650; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; }
.term-text { white-space: pre-wrap; flex: 1 1 20rem; }
.term-step { padding-left: 12px; border-left: 2px solid var(--border-strong); }
.term-step-label { font-weight: 650; min-width: 4.5rem; }
.term-step-arg { color: var(--text); background: none; padding: 0; font-size: 0.93em; }
.term-result { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }
.term-card { border: 1px solid var(--border); background: rgba(var(--tint-rgb), 0.04); padding: 10px 12px; }
.term-code { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.term-card .term-code { max-height: 18rem; overflow-y: auto; }
.term-del { color: var(--bad); display: block; }
.term-add { color: var(--ok); display: block; }
.term-plan-head { display: flex; justify-content: space-between; gap: 10px; margin: 0 0 6px; font-weight: 650; }
.term-plan-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.term-plan-items li { display: flex; gap: 8px; }
.plan-mark { width: 1.1em; text-align: center; color: var(--muted); flex: none; }
.plan-active .plan-mark { color: var(--accent); }
.plan-done .plan-mark { color: var(--ok); }
.plan-done > span:last-child { color: var(--muted); }
.plan-failed .plan-mark { color: var(--bad); }
.term-answer { padding: 4px 2px 6px; line-height: 1.6; }
.term-prose p { margin: 0 0 8px; white-space: pre-wrap; }
.term-prose pre { background: rgba(var(--tint-rgb), 0.06); border: 1px solid var(--border); padding: 10px 12px; margin: 0 0 8px; }

/* The question: the loudest thing in a column, with buttons a thumb finds. */
.term-ask { background: rgba(var(--warn-rgb), 0.08); border-left: 4px solid var(--warn); padding: 16px 18px; }
.term-ask-question { margin: 0 0 6px; font-weight: 650; color: var(--warn); }
.term-ask-step { margin: 0 0 14px; overflow-wrap: anywhere; }
.term-ask-label { font-weight: 650; }
.term-ask-buttons { display: flex; gap: 12px; }
.term-ask-buttons button { flex: 1 1 0; min-height: 48px; font-size: 16px; }
.term-allow { background: var(--ok); color: var(--on-accent); }

.term-compose { display: flex; gap: 10px; align-items: flex-end; }
.term-compose textarea { flex: 1 1 auto; resize: none; min-height: 46px; max-height: 200px; line-height: 1.45; background: var(--panel); border: 1px solid var(--border); border-bottom: 2px solid var(--accent); }
.term-compose button { flex: none; min-height: 46px; }
.term-msg:empty { display: none; }

/* A Settings page in the session area, and Appearance, drawn here. */
.term-pageview { flex: 1 1 auto; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.term-page-head { display: flex; align-items: baseline; gap: 12px; }
.term-page-head h2 { margin: 0; font-size: 1.15rem; }
.term-page { flex: 1 1 auto; width: 100%; border: 1px solid var(--border); background: var(--bg); }
.term-look { display: flex; flex-direction: column; gap: 18px; padding: 6px 0; }
.look-row h3 { margin: 0 0 8px; font-size: 0.95rem; }
.look-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.look-chip { background: var(--panel); color: var(--text); border: 1px solid var(--border); box-shadow: none; padding: 10px 16px; font-weight: 600; }
.look-chip:hover { transform: none; box-shadow: none; filter: none; border-color: var(--border-strong); }
.look-chip[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.look-background-offwhite { background: #F8F9FC; color: #1A2233; }
.look-background-mist { background: #EEF3F8; color: #1A2233; }
.look-background-sand { background: #F6F1E7; color: #1A2233; }
.look-background-white { background: #FFFFFF; color: #1A2233; }
.look-background-navy { background: #14203A; color: #EDF1F8; }
.look-background-deep { background: #0B1426; color: #EDF1F8; }
.look-font-humanist { font-family: Optima, Candara, "Noto Sans", "Segoe UI", sans-serif; }
.look-font-serif { font-family: Georgia, "Noto Serif", "Times New Roman", serif; }
.look-font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.term-scrim { display: none; }

/* A narrow screen: the sessions take the whole width, one column; the panel
   slides in over them from the left. */
@media (max-width: 900px) {
  .shell:has(.term) > .panel { padding: 10px 10px 12px; }
  .term, .term[data-panel="closed"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); height: auto; min-height: calc(100vh - 22px); }
  .term-brandrow { margin-right: 0; padding-right: 0; }
  .term-brand .brandmark, .term[data-panel="closed"] .term-brand .brandmark { width: 200px; }
  .term-main { grid-column: 1; grid-row: 2; padding-left: 0; padding-top: 14px; }
  .term .term-tasks, .term[data-panel="closed"] .term-tasks {
    display: flex;
    position: fixed; z-index: 20; inset: 0 auto 0 0;
    width: min(88vw, 22rem);
    height: auto; margin: 0; padding: 18px 16px;
    background: var(--bg);
    border-right: 1px solid var(--border-strong);
    box-shadow: 18px 0 48px rgba(var(--shadow-rgb), calc(0.5 * var(--shadow-k)));
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }
  .term[data-panel="open"] .term-tasks { transform: none; }
  .term-scrim:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 10; background: rgba(var(--shadow-rgb), calc(0.45 * var(--shadow-k))); }
  .term-cols { grid-template-columns: minmax(0, 1fr); }
  .term-col { min-height: 70vh; }
  .term-state { display: none; }
  .term-compose textarea { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) { .term .term-tasks { transition: none; } }

/* Appearance: the background and font a person chose (theme.js sets
   data-bg and data-font on <html>). */
:root[data-bg="mist"] { --bg: #EEF3F8; }
:root[data-bg="sand"] { --bg: #F6F1E7; }
:root[data-bg="white"] { --bg: #FFFFFF; --panel: #F8F9FC; --card-soft: #F3F5F9; }
:root[data-theme="dark"][data-bg="deep"] { --bg: #0B1426; --field: #08101F; }
:root[data-font="humanist"] body { font-family: Optima, Candara, "Noto Sans", "Segoe UI", sans-serif; }
:root[data-font="serif"] body { font-family: Georgia, "Noto Serif", "Times New Roman", serif; }
:root[data-font="mono"] body { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* A page shown inside the Terminal page's Settings view drops its own
   header and nav: the Terminal page already says where you are. */
:root[data-embed] .shell { max-width: none; padding: 18px 20px; }
:root[data-embed] .shell > h1, :root[data-embed] .shell > p.sub, :root[data-embed] nav { display: none; }
:root[data-embed] .panel { border: none; box-shadow: none; background: transparent; padding: 0; margin: 0; }
:root[data-embed] body::before { display: none; }


/* The wordmark in the guide's two colour sets: the print pair on the light
   ground, the screen pair on the dark one. Both are in the page; the theme
   shows one. */
img.brandmark.brandmark-dark { display: none; }
:root[data-theme="dark"] img.brandmark.brandmark-light { display: none; }
:root[data-theme="dark"] img.brandmark.brandmark-dark { display: block; }
