/* ============================================================
   app.css — shell rules shared by the three Razor surfaces that still render
   server-side: the docs shell (_DocsLayout), the focused/consent shell
   (_FocusLayout) and the landing page (_LandingLayout).

   NOT part of the design handoff. tokens/*.css is vendored and must stay
   byte-identical to the kit; everything here is ours to edit.

   This file used to be the whole portal shell — nav rail, dashboard, item
   viewer, mock editor, API keys, the lot — carried over from the prototype's
   `.proto-*` rules (renamed `.proto-x` -> `.app-x`; nothing in production
   should read "proto"). The React portal (ClientApp/src) replaced all of
   that with its own co-located CSS modules and the `.ds-*` classes in
   tokens/components.css, so every portal-only rule was deleted here. What
   remains is genuinely shared by the surviving Razor pages: the topbar, logo
   and spacer used by the docs and focus shells, the focus shell itself, and
   the MCP consent screen it hosts.
   ============================================================ */

/* ---------- icons ---------- */
.ds-sprite { display: none; }
.ds-ic { display: block; flex: 0 0 auto; }

/* ---------- app frame ---------- */
/* Pins the document to the viewport height. landing.css depends on this too — its .lp rule
   overrides height back to a normal scrolling document; see the comment there. */
html, body { margin: 0; height: 100%; }

.app-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 var(--ds-space-4);
  height: var(--ds-topbar-h);
  border-bottom: 1px solid var(--ds-border);
  background: var(--ds-surface);
  flex: 0 0 auto;
  z-index: var(--ds-z-nav);
}

.app-topbar__divider { width: 1px; height: 18px; background: var(--ds-border); }
.app-spacer { flex: 1; }

/* ---------- logo ---------- */
/* color feeds the lockup's wordmark through fill="currentColor"; the mark keeps its own. */
.app-logo { display: inline-flex; align-items: center; background: none; border: none; padding: 0; cursor: pointer; color: var(--ds-text); }
.app-logo__lockup { display: block; }

/* ---------- responsive utility ---------- */
/* Hides an element at the docs/focus shells' shared small-screen breakpoint. */
@media (max-width: 760px) {
  .app-hide-sm { display: none !important; }
}

/* ---------- focused shell (_FocusLayout) ---------- */
/* Deliberately not pinned to the viewport with the overflow hidden, the way the old portal
   shell was: this is one long decision that must scroll as a whole document, not a shell with
   independently-scrolling panes. */
.app-focus {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--ds-bg);
}

.app-topbar--focus { height: 56px; padding: 0 22px; }
.app-focus__who { font-size: 13.5px; color: var(--ds-text-muted); }
.app-focus__who .ds-cell-mono { font-size: 13px; color: var(--ds-text); }

.app-focus__main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 36px 24px;
}

/* ---------- MCP consent (D-45) ---------- */
/* Everything here is a size, and every size is deliberate: this page asks for an irreversible
   grant, so the question, the scope and the two buttons all outrank ordinary app body copy. */
.app-consent { width: 660px; max-width: 100%; display: flex; flex-direction: column; gap: 18px; }

.app-consent__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  font-family: var(--ds-font-mono);
  font-size: 11.5px;
  font-weight: var(--ds-weight-bold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ds-agent);
}

.app-consent__title {
  margin: 0;
  font-family: var(--ds-font-display);
  font-weight: 800;
  font-size: 38px;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.app-consent__lede {
  margin: 12px 0 0;
  font-size: 16.5px;
  line-height: 1.5;
  color: var(--ds-text-muted);
  text-wrap: pretty;
}

/* who -> what. The client host is the one fact the user is meant to verify, so it is set in
   mono at 16px — larger and more distinctive than anything else in the card. */
.app-consent__parties {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 24px;
  background: var(--ds-surface-2);
  border-bottom: 1px solid var(--ds-border);
}

.app-consent__party { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.app-consent__party-text { min-width: 0; }
.app-consent__arrow { flex: 0 0 auto; display: flex; color: var(--ds-text-faint); }

.app-consent__badge {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: var(--ds-radius-md);
  background: var(--ds-surface);
  border: 1px solid var(--ds-border-strong);
}

.app-consent__badge--client {
  background: var(--ds-agent-tint);
  border-color: color-mix(in srgb, var(--ds-agent) 30%, transparent);
  color: var(--ds-agent);
}

.app-consent__mark { width: 22px; height: 22px; display: block; }

.app-consent__party-name {
  display: block;
  font-size: 16px;
  font-weight: var(--ds-weight-bold);
  color: var(--ds-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-consent__party-name--mono { font-family: var(--ds-font-mono); }
.app-consent__party-role { display: block; margin-top: 2px; font-size: 12.5px; color: var(--ds-text-faint); }

.app-consent__scope { padding: 20px 24px 22px; }

.app-consent__label {
  margin: 0;
  font-family: var(--ds-font-mono);
  font-size: 11px;
  font-weight: var(--ds-weight-bold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ds-text-faint);
}

.app-consent__grants { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.app-consent__grant { display: flex; gap: 13px; align-items: flex-start; }
.app-consent__grant-body { flex: 1; min-width: 0; }

.app-consent__grant-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: var(--ds-radius-md);
  background: var(--ds-accent-tint);
  color: var(--ds-accent);
}

.app-consent__grant-title { font-size: 15.5px; font-weight: var(--ds-weight-semibold); line-height: 1.3; }
.app-consent__grant-desc { margin-top: 3px; font-size: 13.5px; line-height: 1.5; color: var(--ds-text-muted); }

/* The bounds are the reason Allow is safe to click, so they sit in the same card as the
   grants — not in a footnote someone has to go looking for. */
.app-consent__bounds {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--ds-border);
  font-size: 13px;
  color: var(--ds-text-faint);
}

.app-consent__bounds-lead {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ds-ok);
  font-weight: var(--ds-weight-semibold);
}

.app-consent__banner { font-size: 14px; }
.app-consent__banner .ds-banner__title { font-size: 14.5px; }
.app-consent__banner-body { color: var(--ds-text-muted); line-height: 1.5; }
.app-consent__banner-body .ds-cell-mono { font-size: 13px; }

.app-consent__actions { display: flex; gap: 12px; }
.app-consent__btn { height: 52px; font-size: 16px; justify-content: center; }
.app-consent__btn--deny { flex: 0 0 200px; }
.app-consent__btn--allow { flex: 1; font-weight: var(--ds-weight-bold); }

.app-consent__details { border: 1px solid var(--ds-border); border-radius: var(--ds-radius-md); background: var(--ds-surface); }

.app-consent__details-head {
  display: flex;
  align-items: center;
  gap: var(--ds-space-2);
  padding: 10px 14px;
  cursor: pointer;
  font-family: var(--ds-font-mono);
  font-size: 11px;
  font-weight: var(--ds-weight-bold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ds-text-faint);
  list-style: none;
}

.app-consent__details-head::-webkit-details-marker { display: none; }
.app-consent__details[open] .app-consent__details-head { border-bottom: 1px solid var(--ds-border); }
.app-consent__details-head .ds-ic { transition: transform var(--ds-fast); }
.app-consent__details:not([open]) .app-consent__details-head .ds-ic { transform: rotate(-90deg); }

.app-consent__params { display: flex; flex-direction: column; gap: 7px; padding: 12px 14px 14px; }
.app-consent__param { display: flex; gap: 14px; font-family: var(--ds-font-mono); font-size: 13px; }
.app-consent__param dt { width: 150px; flex: 0 0 auto; color: var(--ds-text-faint); }
.app-consent__param dd { flex: 1; min-width: 0; margin: 0; word-break: break-all; }
.app-consent__pkce { color: var(--ds-ok); }

.app-consent__foot { margin: 0; font-size: 13px; line-height: 1.5; color: var(--ds-text-faint); }

/* A link in prose, not a control — signing out is still the real POST below. */
.app-consent__switch {
  font: inherit;
  font-weight: var(--ds-weight-semibold);
  color: var(--ds-link);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}

.app-consent__switch:hover { color: var(--ds-accent); }

@media (max-width: 760px) {
  .app-focus__main { padding: 24px var(--ds-space-4); }
  .app-consent__title { font-size: 30px; }
  .app-consent__lede { font-size: 15.5px; }
  .app-consent__parties { flex-direction: column; align-items: stretch; gap: 12px; }
  .app-consent__arrow { align-self: center; transform: rotate(90deg); }
  /* Stacked, both buttons go full width — Deny stays a real target, never a ghost. Both drop
     their flex so the column's main axis can't collapse their 52px height to the flex basis. */
  .app-consent__actions { flex-direction: column; }
  .app-consent__btn--deny,
  .app-consent__btn--allow { flex: 0 0 auto; }
  .app-consent__param { flex-direction: column; gap: 2px; }
  .app-consent__param dt { width: auto; }
}

/* Handoff §7: motion is transitions only; keep every end-state as the base. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
