/* GlassLeaf — the two-panel shell, built to be judged at foldable size in Chrome.
   Colour and type are the APP's, not a web approximation of it. Every value below is lifted
   from GLeaf itself:
     · lib/shared/theme/ngt_palette.dart — kBg · kFg · kPanel · kMuted · kDivider · kActive
       · kBrandRed · kAppBarShadow
     · lib/shared/theme/app_theme.dart   — the neutral untinted surfaces and w700 headings
     · lib/shared/shell/marquee.dart     — the marquee, the presence bubble, the side panel,
       kAttention, and every size in them
   The laws that follow from it: amber is attention · surfaces are untinted, pure black at night
   and pure white in day · Inter, bundled, never a CDN · headings and titles are w700, and
   nothing is shouted in uppercase with letterspacing — the app does not speak that way.
   ⭐ ONE DELIBERATE DEPARTURE (Ankit, 2026-11-18): the app's green/red split — green for state,
   red for action — is GONE here. Red is both. See the --active note below for why.
   Theme: [data-theme="dark"|"light"] on <html>, else the OS.
   Preview size: [data-frame="..."] on <html>; "fit" lets the shell fill the window. */

/* Inter, the same file the app bundles (assets/fonts/Inter-Variable.ttf, OFL) rather than a
   Google Fonts link — so the page renders in the app's own type, and does so offline. */
@font-face {
  font-family: "Inter";
  src: url("fonts/Inter-Variable.ttf") format("truetype-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* NIGHT IS THE DEFAULT, as it is in the app (leaf_app.dart: ThemeMode.dark, "Netflix-style
   default"). The page does not follow the OS, because the app does not — day is a choice the
   person makes in the side panel, and it is remembered. */
:root {
  color-scheme: dark;
  --bg: #000000;            /* kBg — pure black, untinted */
  --fg: #f2f2f2;            /* kFg */
  --panel: #161616;         /* kPanel — the lifted surface */
  --card: #1c1c1c;          /* surfaceContainerHighest — one step up from the page */
  --muted: #8a8a8a;         /* kMuted */
  --divider: #262626;       /* kDivider */
  --marquee-glow: rgba(255,255,255,.13);   /* kAppBarShadow — BACKLIT at night, not a shadow */

  /* ── the colour grammar, identical in both modes ──
     ⭐ ANKIT'S RULING, 2026-11-18: "Replace green colors with Red (which are visible in day and
     night both modes)." So the on/active state is now brand red, not kActive green. This is a
     DEPARTURE from the app, where green is state and red is action — on the light card the
     fluorescent green read pale, and he chose one colour that carries in both modes over two
     that do not. --active keeps its name because the ROLE is unchanged; only its value moved. */
  --red: #e50914;           /* kBrandRed */
  --red-ink: #ffffff;
  --active: var(--red);     /* on / current / selected — red by his ruling */
  --attention: #e0b341;     /* kAttention — needs you (amber stays; he replaced green only) */

  /* ── the preview frame (not app colour: this is the monitor around the device) ── */
  --surround: #0b0b0b;
  --bezel: rgba(255,255,255,.10);
  --frame-w: 984px;
  --frame-h: 1092px;
  --hinge: 14px;
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;            /* kBg — pure white, untinted */
  --fg: #111111;
  --panel: #f2f2f2;
  --card: #ededed;
  --muted: #6a6a6a;
  --divider: #dcdcdc;
  --marquee-glow: rgba(0,0,0,.22);   /* a drop shadow in day, per kAppBarShadow */
  --surround: #e6e6e6;
  --bezel: rgba(0,0,0,.18);
}

/* The browser's own rule is `[hidden] { display: none }` at specificity (0,1,0), so any
   ID rule that sets `display` outranks it and `el.hidden = true` silently does nothing.
   Stated once, for every element here that relies on the attribute. */
[hidden] { display: none !important; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  /* 14px is the app's own body size (appFont 13–14 throughout). Line height is `normal` — the
     font's own metrics — because that is what Flutter does unless a style sets `height`; the
     app sets it only on multi-line muted paragraphs, which carry 1.4/1.45 below, as it does. */
  font: 14px/normal "Inter", -apple-system, "Segoe UI", system-ui, sans-serif;
  color: var(--fg);
  background: var(--surround);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;   /* the device's unscaled box can be taller than the window; its scaled self is not */
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; border: 0; border-radius: 12px; padding: 9px 14px; font-weight: 600; color: var(--fg); }
/* Buttons are red. Red is ONLY ever a button. */
button.action { background: var(--red); color: var(--red-ink); font-weight: 700; }
button.quiet { background: transparent; border: 1px solid var(--divider); }
/* Inputs: kDivider at rest, brand red on focus — as every field in the app does it. */
input, select, textarea {
  font: inherit; font-size: 14px; padding: 10px 12px;
  border: 1px solid var(--divider); border-radius: 12px;
  background: transparent; color: var(--fg);
}
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--red); }
input::placeholder, textarea::placeholder { color: var(--muted); font-size: 13.5px; }
.muted { color: var(--muted); }
.empty { color: var(--muted); font-size: 12.5px; line-height: 1.45; padding: 8px 2px; }

/* ── THE DEVICE ─────────────────────────────────────────────────────────────
   A foldable-sized window on a desktop monitor; the whole screen on a phone. */
#device {
  position: relative;
  /* The panels stack when THE DEVICE is narrow, not when the browser window is — otherwise the
     folded preview would sit on a wide monitor and never stack. A container query asks the
     device its own width, so the preview frame and real hardware answer the same way. */
  container-type: inline-size;
  container-name: device;
  width: var(--frame-w);
  height: var(--frame-h);
  max-width: 100vw;
  max-height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 26px;
  border: 1px solid var(--bezel);
  box-shadow: 0 24px 70px rgba(0,0,0,.45);
  /* A foldable is taller than most laptop screens. Rather than drop the frame and lie about
     the format, the whole device is scaled down to fit — set by app.js, 1 when it already
     fits. Stacking still decides on the device's own 984/412, not the scaled pixels. */
  transform: scale(var(--device-scale, 1));
  transform-origin: center center;
}
html[data-frame="fit"] #device {
  width: 100vw; height: 100dvh; border-radius: 0; border: 0; box-shadow: none; transform: none;
}
html[data-frame="fold7"]   { --frame-w: 984px;  --frame-h: 1092px; }
html[data-frame="cover"]   { --frame-w: 412px;  --frame-h: 960px; }
/* A real handset IS the device — no frame, no scaling.
   Keyed on the POINTER, not on width: an unfolded foldable is 884–984px wide, so a width
   test would hand the actual target the desktop preview, bezel and all. A touch screen is
   the device whatever its width; a mouse means someone is previewing it. */
@media (pointer: coarse), (hover: none), (max-width: 760px) {
  #device { width: 100vw; height: 100dvh; border-radius: 0; border: 0; box-shadow: none; transform: none; }
}

/* ── MARQUEE (fixed, top) ───────────────────────────────────────────────────
   kToolbarHeight is 56. Page colour, no tint, with kAppBarShadow beneath it so the brand
   reads as a floating backlit panel at night and a raised one in day. */
#marquee {
  flex: 0 0 auto;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px 0 16px;
  background: var(--bg);
  box-shadow: 0 8px 18px -10px var(--marquee-glow);
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }

/* THE MARK, at the app's logo size (Brand.logo(size: 22)). Two facets, two colours, and the
   same two the wordmark wears — so mark and word say the same thing twice. The pairing is the
   order he wrote it in ("Glass and Leaf … red and white / black"):
     Glass = brand red, the broad facet, carrying the weight
     Leaf  = the page's own ink, white at night and near-black in day
   Flat and crisp: no gradient, no glow. The old mark needed a glow because it was nearly white
   on both grounds; these two colours read on black and on white by themselves. */
.mark { width: 22px; height: 22px; flex: 0 0 auto; }
.mark-glass { fill: var(--red); }
.mark-leaf  { fill: var(--fg); }

/* appFont(color: kFg, fontWeight: w700, fontSize: 17) — one word, two colours */
.wordmark { font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-glass { color: var(--red); }
.w-leaf  { color: var(--fg); }

/* The presence bubble — 34×34, kPanel fill, a 2px ring whose colour IS the state:
   green = all good · amber = something needs you. Never red; red does things. */
#presence { position: relative; }
.bubble {
  width: 34px; height: 34px; flex: 0 0 auto; padding: 0;
  border-radius: 50%;
  background: var(--panel);
  border: 2px solid var(--divider);
  display: grid; place-items: center;
}
.bubble .initial { font-size: 13px; font-weight: 700; color: var(--fg); line-height: 1; }
.bubble.ok { border-color: var(--active); }
.bubble.attention { border-color: var(--attention); }
#presence-btn[aria-expanded="true"] { box-shadow: 0 0 0 3px color-mix(in srgb, var(--active) 20%, transparent); }


/* ── STAGE: the two panels, hinge between ──────────────────────────────────
   The app's container: kPanel at 45% over the page with a kDivider hairline, so a surface sits
   IN the page rather than on top of it. No drop shadow — only the marquee glows. */
#app {
  flex: 1; min-height: 0;
  display: flex; flex-direction: row;
  padding: 10px 14px 14px;
}
.panel {
  flex: 1 1 0; min-width: 0; min-height: 0;
  background: color-mix(in srgb, var(--panel) 45%, transparent);
  border: 1px solid var(--divider);
  border-radius: 15px;
  display: flex; flex-direction: column; overflow: hidden;
}
.panel-head { flex: 0 0 auto; padding: 14px 16px 8px; }
/* a heading is a heading: kFg, w700, sentence case */
.panel-title {
  font-size: 15.5px; font-weight: 700; color: var(--fg);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.panel-sub { font-size: 12.5px; color: var(--muted); line-height: 1.4; margin-top: 2px; }
.panel-sub:empty { display: none; }
.panel-body {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 4px 16px 16px;
  /* a thin scrollbar in our own greys — the default one is a bright bar down a black panel */
  scrollbar-width: thin;
  scrollbar-color: var(--divider) transparent;
}
.panel-body::-webkit-scrollbar { width: 8px; }
.panel-body::-webkit-scrollbar-track { background: transparent; }
.panel-body::-webkit-scrollbar-thumb { background: var(--divider); border-radius: 999px; }
.panel-body::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* The hinge. On a real foldable this sits over the physical fold; in the preview frame it
   stands in for it, so the gap between the panels is where the crease will be. */
#hinge {
  flex: 0 0 var(--hinge);
  align-self: stretch;
  background: linear-gradient(to right, transparent 0, var(--divider) 46%, var(--divider) 54%, transparent 100%);
}

/* ── FOLDED (the cover screen) and any narrow device: one column, stacked ──── */
@container device (max-width: 760px) {
  #app { flex-direction: column; }
  #hinge { background: linear-gradient(to bottom, transparent 0, var(--divider) 46%, var(--divider) 54%, transparent 100%); }
}

/* ── REAL FOLDABLE HARDWARE (progressive enhancement) ───────────────────────
   Viewport Segments: Chrome 125+ behind --enable-experimental-web-platform-features.
   When the browser reports two side-by-side segments, each panel is sized to its own
   segment and the hinge takes exactly the gap between them, so the split lands on the
   crease instead of near it. Everything above already looks right without this. */
@media (horizontal-viewport-segments: 2) {
  #device { width: 100vw; height: 100dvh; border-radius: 0; border: 0; box-shadow: none; transform: none; }
  #app { flex-direction: row; padding: 10px 0 14px; }
  #panel-left  { flex: 0 0 calc(env(viewport-segment-right 0 0) - 14px); margin-left: 14px; }
  #panel-right { flex: 1 1 0; margin-right: 14px; }
  #hinge { flex: 0 0 calc(env(viewport-segment-left 1 0) - env(viewport-segment-right 0 0)); }
}
@media (vertical-viewport-segments: 2) {
  #device { width: 100vw; height: 100dvh; border-radius: 0; border: 0; box-shadow: none; transform: none; }
  #app { flex-direction: column; }
  /* The segment edges are measured from the top of the VIEWPORT, the stage from under the
     marquee — so the marquee's real height (measured by app.js) plus the stage's own top
     padding comes off, or the split sits below the crease by exactly that much. */
  #panel-left  { flex: 0 0 calc(env(viewport-segment-bottom 0 0) - var(--marquee-h, 56px) - 10px); }
  #panel-right { flex: 1 1 0; }
  #hinge {
    flex: 0 0 calc(env(viewport-segment-top 0 1) - env(viewport-segment-bottom 0 0));
    background: linear-gradient(to bottom, transparent 0, var(--divider) 46%, var(--divider) 54%, transparent 100%);
  }
}

/* ── toasts: a passing remark, over the device ─────────────────────────────── */
#toasts {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--card); border: 1px solid var(--divider); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,.38); padding: 10px 16px;
  font-size: 13.5px; font-weight: 600; color: var(--fg);
  max-width: min(520px, 86vw); opacity: 1; transition: opacity .3s ease, transform .3s ease;
}
.toast.going { opacity: 0; transform: translateY(6px); }
.toast.attention { border-color: var(--attention); }

/* ── the chat panel ────────────────────────────────────────────────────────
   Same grammar as the rest: red is the button, the page's own ink is the text, muted greys do
   the quiet work. Nothing here is a new colour. */
.connect { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
.connect-form { display: flex; flex-direction: column; gap: 10px; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  font-size: 12.5px; font-weight: 600; padding: 7px 13px; border-radius: 20px;
  background: transparent; border: 1px solid var(--divider); color: var(--fg);
}
.chip:hover { border-color: var(--muted); }
/* on / current / selected — red, by his ruling */
.chip.on { border-color: var(--red); color: var(--red); font-weight: 700;
           background: color-mix(in srgb, var(--red) 10%, transparent); }
.note { font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.err { font-size: 12.5px; color: var(--red); font-weight: 600; line-height: 1.45; }
.err:empty { display: none; }

.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.msgs { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 9px;
        padding-right: 2px; scrollbar-width: thin; scrollbar-color: var(--divider) transparent; }
.msgs::-webkit-scrollbar { width: 8px; }
.msgs::-webkit-scrollbar-thumb { background: var(--divider); border-radius: 999px; }
.msg { border: 1px solid var(--divider); border-radius: 12px; padding: 9px 12px;
       background: color-mix(in srgb, var(--panel) 55%, transparent); }
.msg .who { font-size: 11.5px; font-weight: 700; color: var(--muted); margin-bottom: 3px; }
.msg.user { border-color: color-mix(in srgb, var(--red) 45%, var(--divider)); }
.msg.user .who { color: var(--red); }
/* the reply itself: pre-wrap, because it is TEXT and stays text — never parsed as markup */
.msg .body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.msg.thinking .body { color: var(--muted); }
.msg.failed { border-color: var(--red); }
.msg.failed .body { color: var(--red); }

/* a fix offered inside a failed answer: buy credits, connect a provider. It is a link in a
   sentence, not a second button competing with the composer. */
.msg-link {
  display: block; width: fit-content; margin-top: 9px;
  background: transparent; border: 0; padding: 0;
  font: inherit; font-size: 12.5px; font-weight: 700;
  color: var(--red); text-decoration: underline; cursor: pointer;
}
.msg-link:hover { filter: brightness(1.15); }
.msg-link:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 4px; }

.composer { display: flex; gap: 8px; align-items: center; padding-top: 10px; }
.composer input { flex: 1; min-width: 0; }
.chat-bar { display: flex; gap: 8px; align-items: center; padding-top: 8px; }
.chat-bar select { flex: 1; min-width: 0; font-size: 12.5px; padding: 6px 9px; }
button.small { font-size: 12px; padding: 6px 11px; }

/* the door */
.door-title { font-size: 15.5px; font-weight: 700; color: var(--fg); margin-bottom: 2px; }


/* ── the dialog ────────────────────────────────────────────────────────────
   One window for anything that needs the screen. Same surfaces as the side panel, so it reads
   as part of the app rather than a browser artefact. */
#dlg {
  border: 1px solid var(--divider);
  border-radius: 14px;
  background: var(--card);
  color: var(--fg);
  padding: 0;
  width: min(420px, calc(100vw - 48px));
  max-height: calc(100dvh - 96px);
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
  overflow: hidden;
}
#dlg::backdrop { background: rgba(0,0,0,.55); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
            padding: 14px 16px 10px; border-bottom: 1px solid var(--divider); }
.dlg-title { font-size: 15.5px; font-weight: 700; color: var(--fg); }
.dlg-x { background: transparent; border: 0; color: var(--muted); font-size: 13px;
         padding: 4px 8px; border-radius: 8px; line-height: 1; }
.dlg-x:hover { color: var(--fg); background: color-mix(in srgb, var(--panel) 60%, transparent); }
.dlg-body { padding: 14px 16px 16px; overflow-y: auto;
            scrollbar-width: thin; scrollbar-color: var(--divider) transparent; }
.dlg-body > .connect { gap: 12px; }

/* ── the sign-in window ────────────────────────────────────────────────────
   Centred, unhurried, and the first thing most people will ever see of GlassLeaf. The mark sits
   at the top so the window introduces itself; the two choices are equals, stacked rather than
   side by side so neither reads as an afterthought. */
#dlg.bare .dlg-head { border-bottom: 0; padding: 10px 10px 0; }
#dlg.bare .dlg-body { padding: 4px 28px 28px; }
#dlg.bare { width: min(380px, calc(100vw - 48px)); }

.signin { display: flex; flex-direction: column; align-items: center; text-align: center; }
.signin-mark { width: 44px; height: 44px; margin-bottom: 14px; }
.signin-mark svg { width: 100%; height: 100%; display: block; }
.signin-title { font-size: 21px; font-weight: 700; color: var(--fg); margin: 0 0 6px; letter-spacing: -.01em; }
.signin-sub { font-size: 13px; color: var(--muted); margin: 0 0 22px; line-height: 1.5; }

.signin-choices { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.provider {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 13px 16px; border-radius: 12px; border: 0;
  background: var(--red); color: var(--red-ink);
  font-size: 14.5px; font-weight: 700; text-align: left;
  transition: filter .12s ease;
}
.provider:hover:not(:disabled) { filter: brightness(1.08); }
.provider .pmark { width: 18px; height: 18px; flex: 0 0 auto; fill: currentColor; }
.provider .plabel { flex: 1; }
/* not wired up yet: it looks like what it is rather than like a button that works */
.provider.soon {
  background: transparent; color: var(--muted);
  border: 1px solid var(--divider); cursor: default; font-weight: 600;
}
.provider .ptag {
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  background: var(--divider); color: var(--muted);
  border-radius: 7px; padding: 3px 7px;
}

/* ── Your APIs ─────────────────────────────────────────────────────────────
   Same row grammar as the sign-in window, one step quieter. The sign-in window offers ONE real
   choice, so its row is red; this is a list of equals, and seven red bars would shout at a
   person who has not chosen yet. So: outlined rows, and red arrives only on the one that is
   connected — red stays the colour of what is true, not of what is available. */
.api-list {
  display: flex; flex-direction: column; gap: 8px; width: 100%;
  /* the catalogue is served and will grow; the window must not grow with it */
  max-height: min(52vh, 420px); overflow-y: auto; padding-right: 2px;
  scrollbar-width: thin; scrollbar-color: var(--divider) transparent;
}
.api-list::-webkit-scrollbar { width: 8px; }
.api-list::-webkit-scrollbar-thumb { background: var(--divider); border-radius: 999px; }

.api-row {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--divider); background: transparent;
  color: var(--fg); font-size: 14.5px; font-weight: 600; text-align: left;
  transition: border-color .12s ease, background .12s ease;
}
.api-row .api-mark { width: 18px; height: 18px; flex: 0 0 auto; fill: currentColor; }
.api-row .api-name { flex: 1; }

/* the lettered stand-in for a provider we have no mark for — same size, same weight, so a row
   with one does not look broken next to a row with a glyph */
.api-letter {
  width: 18px; height: 18px; flex: 0 0 auto; border-radius: 50%;
  border: 1px solid currentColor; display: grid; place-items: center;
  font-size: 10px; font-weight: 700; line-height: 1;
}

.api-row.pick { cursor: pointer; }
.api-row.pick:hover { border-color: var(--muted); background: color-mix(in srgb, var(--panel) 55%, transparent); }
.api-row.pick:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* connected: the only red in the list */
.api-row.linked {
  border-color: color-mix(in srgb, var(--red) 55%, var(--divider));
  background: color-mix(in srgb, var(--red) 8%, transparent);
}

/* frozen: still legible, plainly not available. Not `opacity` on the row — that would fade the
   border into the background and leave the list looking damaged. */
.api-row.frozen { color: var(--muted); border-color: var(--divider); cursor: default; }

.api-tag {
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  color: var(--muted); border: 1px solid var(--divider);
  border-radius: 7px; padding: 3px 7px;
}
.api-tag.on { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, transparent); }

.api-cut { white-space: nowrap;
  background: transparent; border: 0; padding: 3px 2px;
  font-size: 12.5px; font-weight: 700; color: var(--red); cursor: pointer;
}
.api-cut:hover { text-decoration: underline; }
.api-cut:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 4px; }

/* the connect window: one field, one button, and the two links that fix "I have no key" */
.keybox { display: flex; flex-direction: column; gap: 12px; padding-top: 2px; }
.keyhead { display: flex; align-items: center; gap: 10px; }
.keyhead .api-mark { width: 20px; height: 20px; fill: var(--fg); }
.keyhead .api-letter { width: 20px; height: 20px; }
.keyhead-name { font-size: 15px; font-weight: 700; color: var(--fg); }
.keybox input { width: 100%; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }
.keyhelp { display: flex; gap: 16px; padding-top: 2px; }
.keyhelp a { font-size: 12.5px; font-weight: 600; color: var(--muted); text-decoration: none; }
.keyhelp a:hover { color: var(--fg); text-decoration: underline; }
.keyhelp a:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 4px; }

/* which key is in place — enough to tell two apart, useless to anyone who reads it */
.api-tail {
  margin-left: 8px; font-size: 11.5px; font-weight: 600; color: var(--muted);
  font-variant-numeric: tabular-nums; letter-spacing: .02em;
}
/* the credits link on a connected row: present, but not competing with Disconnect */
a.api-cut { text-decoration: none; }
.api-cut.quiet { color: var(--muted); font-weight: 600; }
.api-cut.quiet:hover { color: var(--fg); }

/* ── no furniture ──────────────────────────────────────────────────────────
   A panel with nothing to say says nothing. No title bar, no "nothing here yet". */
.panel-title:empty { display: none; }
.panel-head:has(.panel-title:empty):has(.panel-sub:empty) { padding: 0; }

/* the composer, which is the whole of the chat panel until there is a conversation */

   would disappear into a red button. */
.composer .send {
  width: 38px; height: 38px; flex: 0 0 auto; padding: 0;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--divider);
  display: grid; place-items: center;
  transition: border-color .12s ease, transform .12s ease;
}
.composer .send:hover { border-color: var(--red); transform: translateY(-1px); }
.composer .send:active { transform: none; }
.composer .send svg { width: 17px; height: 17px; display: block; }

/* signed out, the composer is the door - but quietly: a muted invitation, not a shout */
.composer.as-door input { cursor: pointer; }
.composer.as-door input::placeholder { color: var(--muted); opacity: 1; font-weight: 400; }

/* ── THE ACCOUNT MENU ──────────────────────────────────────────────────────
   Built to what Google, Netflix and Shopify actually do, which turns out to be less about
   decoration than three unglamorous things: an account CARD rather than a line of text, an icon
   on EVERY row so the eye has a column to run down, and rows big enough to be worth pressing.
   Cramped rows separated by hairlines are what makes an interface look homemade. */
#side-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30;
  width: 304px; padding: 8px;
  background: var(--card);
  border: 1px solid var(--divider);
  border-radius: 16px;
  box-shadow: 0 16px 44px rgba(0,0,0,.42);
}

/* the account card */
.acct {
  display: flex; align-items: center; gap: 13px;
  padding: 14px; margin-bottom: 6px;
  background: color-mix(in srgb, var(--panel) 55%, transparent);
  border-radius: 13px;
}
.avatar {
  width: 40px; height: 40px; flex: 0 0 auto; border-radius: 50%;
  background: var(--panel); border: 2px solid var(--red);
  display: grid; place-items: center; overflow: hidden;
}
.avatar .initial { font-size: 15px; font-weight: 700; color: var(--fg); line-height: 1; }
.avatar svg { width: 22px; height: 22px; fill: var(--muted); }
.acct-who { min-width: 0; }
.acct-name { font-size: 14.5px; font-weight: 600; color: var(--fg);
             white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-sub { font-size: 12.5px; color: var(--muted); margin-top: 1px;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-sub:empty { display: none; }

/* signed out, the whole card is the way in */
.acct.as-button { cursor: pointer; transition: background .12s ease; }
.acct.as-button:hover { background: color-mix(in srgb, var(--panel) 85%, transparent); }
.acct.as-button:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.acct.as-button .acct-name { white-space: normal; font-size: 13.5px; line-height: 1.45; font-weight: 500; }
.sp-cta { color: var(--red); font-weight: 700; }

/* a row: one height, one rhythm, an icon column down the left */
.menu-group { display: flex; flex-direction: column; }
.menu-group:empty { display: none; }
.menu-item {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 11px 13px; border: 0; border-radius: 10px;
  background: transparent; text-align: left;
  font-size: 14px; font-weight: 500; color: var(--fg);
  transition: background .12s ease;
}
.menu-item:hover:not(:disabled) { background: color-mix(in srgb, var(--panel) 70%, transparent); }
.menu-item:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }
.menu-icon { width: 20px; height: 20px; flex: 0 0 auto; fill: var(--muted); }
.menu-label { flex: 1; min-width: 0; }
.menu-item.danger .menu-label { color: var(--red); }
.menu-item.danger .menu-icon { fill: var(--red); }
.menu-item .menu-dim { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.menu-item.on .menu-label { color: var(--red); font-weight: 600; }
.menu-item.on .menu-dim { color: var(--red); }

.menu-rule { height: 1px; background: var(--divider); margin: 6px 10px; }
.menu-head { font-size: 11.5px; color: var(--muted); padding: 8px 13px 4px; }
.menu-note { font-size: 11.5px; color: var(--muted); line-height: 1.45; padding: 6px 13px 2px; }
.menu-note:empty { display: none; }

/* the send button: a circle carrying the mark, both facets. It cannot be a red button, or the
   mark's own red body would vanish into it. */
.composer .send {
  width: 38px; height: 38px; flex: 0 0 auto; padding: 0;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--divider);
  display: grid; place-items: center;
  transition: border-color .12s ease, transform .12s ease;
}
.composer .send:hover { border-color: var(--red); transform: translateY(-1px); }
.composer .send:active { transform: none; }
.composer .send svg { width: 17px; height: 17px; display: block; }

/* signed out the composer is the door, but quietly: an invitation, not a demand */
.composer.as-door input { cursor: pointer; }
.composer.as-door input::placeholder { color: var(--muted); opacity: 1; font-weight: 400; }

/* On a wide monitor a panel can be 1200px across, and a single-line composer stretched to that
   width looks stretched rather than designed. The chat column caps and centres, the way every
   chat interface does - the panel fills the screen, the content does not have to. */
.chat { width: 100%; max-width: 760px; margin: 0 auto; }
