* { box-sizing: border-box; }
html, body { height: 100%; }

/* Keep ordinary links and server-rendered pages, but let supporting browsers
   blend one document into the next. Browsers without cross-document view
   transitions ignore this block and retain normal navigation. */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: page-leave 110ms ease-in both; }
::view-transition-new(root) { animation: page-enter 180ms ease-out both; }
@keyframes page-leave { to { opacity: 0; transform: translateY(-2px); } }
@keyframes page-enter { from { opacity: 0; transform: translateY(3px); } }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

/* Light is Blueprint's body cut; labels and headings ask for Regular. */
body {
  margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans);
  font-weight: var(--fw-light); display: flex; flex-direction: column;
}

/* --header-bg rather than --bg: three themes point it straight back at the
   page ground, and Studio uses it to put a warmer band behind the chrome than
   behind the columns below it. */
header {
  position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-s4);
  min-height: 59px; padding: 0 var(--space-m1); border-bottom: 1px solid var(--line); background: var(--header-bg);
}
.brand { display: flex; align-items: center; gap: var(--space-s2); }
.brand h1 { font-family: var(--display); font-size: var(--fs-name); line-height: var(--lh-name); margin: 0;
            color: var(--header-name); font-weight: var(--display-weight);
            letter-spacing: var(--display-track); }
.brand h1 a { color: inherit; text-decoration: none; }
.brand h1 a:hover { text-decoration: underline; }
.brand h1 a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* The row is as tall as the bar, so a text item's underline sits on the bar's hairline. */
.head-right { margin-left: auto; align-self: stretch; display: flex; align-items: center; gap: var(--space-s2); }
/* The page links and the actions beside them: items in the row on a wide screen,
   the panel the "…" button opens on a phone (below). */
.head-menu, .head-menu .nav:not([hidden]) { display: contents; }
.head-more { display: none; }
/* The one action in the header, New chat: Tertiary Small (theme.css). */
.head-button {
  border-radius: var(--radius); font: var(--font-label-lg); white-space: nowrap; text-decoration: none;
  cursor: pointer;
}
/* The admin's dev line: #6f787e, 4.5:1 on white where #999ea4 was 2.7:1. */
header .engine { font: var(--font-code); color: var(--header-muted); }

.hint { font: var(--font-hint); color: var(--muted); margin-top: 6px; }
.checks { display: flex; flex-wrap: wrap; gap: var(--space-s2) var(--space-s4); }
.checks label { display: inline-flex; align-items: center; gap: var(--space-s2); font: var(--font-label-lg); color: var(--fg); cursor: pointer; }
.checks input { accent-color: var(--accent); }

.valbar { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-s3) var(--space-s4); background: var(--surface); font: var(--font-hint); }
.valbar.ok { border-color: var(--ok-line); background: var(--ok-soft); color: var(--ok); font-weight: var(--fw-regular); }
.valbar.bad { border-color: var(--err-line); background: var(--err-soft); }

.result { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-s4); background: var(--surface); box-shadow: var(--shadow); }
.result.ok { border-color: var(--ok-line); background: var(--ok-soft); }
.result.bad { border-color: var(--err-line); background: var(--err-soft); }
.result .badge { font: var(--font-hint); }
.result.ok .badge { color: var(--ok); }
.result.bad .badge { color: var(--err); }
.result strong { font-weight: var(--fw-regular); }

.issue { font: var(--font-code); padding: var(--space-s1) 0; }
.issue .sev { font-weight: var(--fw-regular); }
.issue.warning .sev { color: var(--warn); }
.issue.error .sev { color: var(--err); }

/* A note, not an error: the link may simply be waiting on the browser's prompt. */
.vscode-miss { grid-column: 1 / -1; margin-top: var(--space-s2); padding: var(--space-s2) var(--space-s3); font: var(--font-hint);
               color: var(--muted); background: var(--surface2); border: 1px dashed var(--line);
               border-radius: var(--radius-notice); }
.vscode-miss a { color: var(--accent-strong); }
/* Where Open in VS Code's link stands once it is old: renewing, renewed or expired. */
.vscode-fresh { grid-column: 1 / -1; margin-top: 8px; font-size: 12px; line-height: 1.45; color: var(--muted); }

/* A tag in rendered text (md-inline.mjs, ⟦word⟧): the chat's mark for a value
   it proposed, in the draft and the Review dialog. A pill like the project
   cards' own tag, outlined so it holds on a bubble, in every theme and in
   forced colours. Blueprint's medium badge: Label/Regular/XS. */
.md-tag {
  display: inline-block; padding: 0 7px; border: 1px solid var(--line); border-radius: var(--radius-pill);
  background: var(--surface2); color: var(--fg); font: var(--font-hint);
  white-space: nowrap; vertical-align: 1px;
}
.empty { color: var(--faint); font: var(--font-hint); }
pre.spec {
  background: var(--code-bg); border: 1px solid var(--code-line); border-radius: var(--radius); padding: 14px;
  font: var(--font-code); overflow: auto; color: var(--code-fg);
}

.scroll-thin::-webkit-scrollbar, pre::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll-thin::-webkit-scrollbar-thumb, pre::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb); border-radius: 8px; border: 3px solid var(--bg);
}

/* Report a problem stays beside the header cog on every user-facing page. */
.report-problem {
  border-radius: var(--radius); cursor: pointer; font: var(--font-label-lg); white-space: nowrap;
}
.report-problem svg { flex-shrink: 0; }
.head-right[data-tools="on"] .report-problem-label {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* The modal shell is Blueprint's (Figma node 40002640:27283): 597px wide,
   Modal-horizontal 40 and Modal-vertical 48 of padding, a 40px gap above the
   buttons, which share the width at a 24px gap; the close icon sits in the
   corner. A phone has 32 and 40 (node 40002641:30079). The Review, survey and
   help sheets are full-screen on a phone, by decision (conversation.css). */
dialog.report-dialog {
  width: min(597px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  overflow: auto; margin: auto; padding: var(--space-m4) var(--space-m2);
  background: var(--surface); color: var(--fg); font-family: var(--sans);
  border: 1px solid var(--line); border-radius: var(--radius-modal);
  box-shadow: var(--shadow-modal);
}
dialog.report-dialog::backdrop {
  background: var(--overlay);
}
.report-title {
  margin: 0 0 var(--space-s3); font: var(--font-h3); color: var(--fg);
}
.report-sub, .report-done {
  margin: 0 0 var(--space-s3); font: var(--font-body-lg);
}
.report-label { display: block; margin: var(--space-s3) 0 6px; font: var(--font-label-lg); }
.report-text {
  display: block; width: 100%; min-height: 104px; resize: vertical;
  padding: var(--space-s4); font: var(--font-body-lg);
  color: var(--fg); background: var(--surface);
  border: 1px solid var(--field-line); border-radius: var(--radius-sm);
}
.report-text:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-field); }
.report-check {
  display: flex; align-items: center; gap: var(--space-s2); margin: var(--space-s3) 0 0;
  font: var(--font-body-lg); cursor: pointer;
}
.report-check input { margin: 0; accent-color: var(--accent); }
.report-check input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.report-hint {
  margin: 6px 0 0; font: var(--font-help); color: var(--muted);
}
.report-note { margin: var(--space-s2) 0 0; font: var(--font-hint); color: var(--muted); }
.report-note:empty { display: none; }
.report-note.err { color: var(--err); font-weight: var(--fw-regular); }
.report-actions {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); align-items: center;
  gap: var(--space-s6); margin-top: var(--space-m2);
}
/* The close icon in the corner of a dialog: in a form of its own where the dialog is built from markup,
   or the button itself where it is built from the DOM (the Review dialog). */
.dialog-x-form, .review-head > .dialog-x { position: absolute; top: var(--space-s2); right: var(--space-s2); margin: 0; z-index: 1; }
/* Their look is theme.css's: Send is Primary, Cancel Secondary, both Medium. */
.report-send, .report-cancel {
  border-radius: var(--radius); cursor: pointer; font: var(--font-btn);
}

@media (max-width: 640px) {
  dialog.report-dialog { padding: var(--space-m2) var(--space-m1); }
}

/* The subtitle goes first when the row runs short. */
@media (max-width: 1199px) {
  .brand .sub { display: none; }
}

/* Where the row would not hold the product name, New chat and the three text
   items, the items fold into a menu, as Blueprint's navigation does on a phone
   (nodes 40002525:9388 closed, :9733 open): the "…" button opens a stack of
   rows 54px high, 16px of margin either side, a hairline between them. The
   header stays one row of 59px with a 16px page margin (node 8231:40956) and
   controls of at least 32px; it wraps only when something wide, like the
   offline notice, joins it. The Easy Auth name and Sign out are in the stack. */
@media (max-width: 899px) {
  header { flex-wrap: wrap; gap: var(--space-s2); padding-left: var(--space-s4); padding-right: var(--space-s4); }
  .head-right {
    flex: 1 1 auto; min-width: 0; margin-left: auto; justify-content: flex-end; gap: var(--space-s1); flex-wrap: wrap;
  }
  .head-right .head-more { display: inline-flex; }
  .head-right .head-more[hidden] { display: none; }
  .head-menu {
    display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 20;
    flex-direction: column; align-items: stretch; padding: 0 var(--space-s4);
    background: var(--header-bg); box-shadow: var(--shadow-sticky);
  }
  .head-right[data-menu="open"] .head-menu { display: flex; }
  .head-menu > *, .head-menu .nav > a {
    min-height: 54px; padding-top: var(--space-s4); padding-bottom: var(--space-s4);
    border-bottom: 1px solid var(--line);
  }
  :root .head-menu .head-nav, :root .head-menu .head-about, :root .head-menu .report-problem,
  :root .head-menu .sign-out {
    align-self: auto; justify-content: flex-start; width: 100%; padding-left: 0; padding-right: 0;
    border-width: 0 0 1px; border-style: solid; border-color: var(--line); border-radius: 0;
    background: none; box-shadow: none; color: var(--header-muted); font: var(--font-nav);
  }
  :root .head-menu .head-nav[aria-current="page"] {
    padding-left: var(--space-s3); color: var(--header-fg); box-shadow: inset 3px 0 0 var(--accent);
  }
  .head-menu .whoami { display: flex; align-items: center; font: var(--font-nav); }
  /* The text items are never icon-only in the menu, whatever the cog says. */
  .head-right[data-tools] .head-menu .head-about-label,
  .head-right[data-tools] .head-menu .report-problem-label {
    position: static; width: auto; height: auto; overflow: visible; clip-path: none;
  }
}
@media (max-width: 639px) {
  .brand h1 { --fs-name: 1.375rem; --lh-name: 1.8125rem; }
}

@media (forced-colors: active) {
  .report-problem, dialog.report-dialog, .report-text, .report-send, .report-cancel {
    border-color: ButtonText;
  }
  .report-send:disabled { color: GrayText; opacity: 1; }
  dialog.report-dialog::backdrop { background: Canvas; opacity: .7; }
  .md-tag { border-color: CanvasText; color: CanvasText; background: Canvas; }
}
