/* Talk To My Data — Phase 12 breathing interface.
 * Compiled, local, Tailwind-compatible semantic component layer.
 * No network asset, runtime compiler, or JavaScript framework is required.
 */
:root {
  color-scheme: dark;
  --ttmd-bg: #0d1014;
  --ttmd-bg-soft: #11161c;
  --ttmd-surface: #151a20;
  --ttmd-surface-raised: #1b2128;
  --ttmd-text: #e7ebf0;
  --ttmd-muted: #9aa4ae;
  --ttmd-subtle: #84909c;
  --ttmd-line: #2d353e;
  --ttmd-accent: #d8b35f;
  --ttmd-accent-ink: #0d1014;
  --ttmd-danger: #efb1a9;
  --ttmd-focus: #f0d58d;
  --ttmd-shadow: 0 2px 8px rgba(0, 0, 0, .25);
  --ttmd-shadow-soft: 0 2px 8px rgba(0, 0, 0, .25);
  --ttmd-radius: .625rem;
  --ttmd-radius-small: .625rem;
  --ttmd-page: 78rem;
  --ttmd-reading: 46rem;
  --ttmd-space-1: .5rem;
  --ttmd-space-2: 1rem;
  --ttmd-space-3: 1.5rem;
  --ttmd-space-4: 2rem;
  --ttmd-space-5: 3rem;
  --ttmd-space-6: 4.5rem;
  font-family: -apple-system, "SF Pro Text", system-ui, sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --ttmd-bg: #f4f1e9;
  --ttmd-bg-soft: #ebe7dc;
  --ttmd-surface: #fffdf8;
  --ttmd-surface-raised: #ffffff;
  --ttmd-text: #242725;
  --ttmd-muted: #5d6662;
  --ttmd-subtle: #6c7571;
  --ttmd-line: #cbc7bb;
  --ttmd-accent: #71581a;
  --ttmd-accent-ink: #ffffff;
  --ttmd-danger: #842d27;
  --ttmd-focus: #5d4510;
  --ttmd-shadow: 0 1.25rem 3.5rem rgba(48, 42, 28, .10);
  --ttmd-shadow-soft: 0 .5rem 1.75rem rgba(48, 42, 28, .08);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --ttmd-bg: #f4f1e9;
    --ttmd-bg-soft: #ebe7dc;
    --ttmd-surface: #fffdf8;
    --ttmd-surface-raised: #ffffff;
    --ttmd-text: #242725;
    --ttmd-muted: #5d6662;
    --ttmd-subtle: #6c7571;
    --ttmd-line: #cbc7bb;
    --ttmd-accent: #71581a;
    --ttmd-accent-ink: #ffffff;
    --ttmd-danger: #842d27;
    --ttmd-focus: #5d4510;
    --ttmd-shadow: 0 1.25rem 3.5rem rgba(48, 42, 28, .10);
    --ttmd-shadow-soft: 0 .5rem 1.75rem rgba(48, 42, 28, .08);
  }
}

/* Authentication is one continuous MyBooks entry journey. Keep its email,
 * workspace-choice, step-up, and administrator-verification surfaces on the
 * established purple system without recoloring unrelated evidence workspaces. */
:where(
  .theme-shell--purple,
  body:has(.auth-screen),
  body:has(.membership-screen),
  body:has([data-admin-enrollment]),
  body:has([data-admin-verification])
) {
  color-scheme: dark;
  --ttmd-bg: #0d0914;
  --ttmd-bg-soft: #130e1c;
  --ttmd-surface: #191321;
  --ttmd-surface-raised: #21182d;
  --ttmd-text: #f5f1fb;
  --ttmd-muted: #b9afc8;
  --ttmd-subtle: #9387a4;
  --ttmd-line: #3a2d49;
  --ttmd-accent: #8b5cf6;
  --ttmd-accent-ink: #ffffff;
  --ttmd-focus: #c4b5fd;
  --ttmd-shadow: 0 1.5rem 4rem rgba(7, 3, 12, .34);
  --ttmd-shadow-soft: 0 .5rem 1.75rem rgba(7, 3, 12, .28);
}

/* Explicit product surfaces must stay purple even on WebKit versions that cannot parse :has(). */
.theme-shell--purple {
  color-scheme: dark;
  --ttmd-bg: #0d0914;
  --ttmd-bg-soft: #130e1c;
  --ttmd-surface: #191321;
  --ttmd-surface-raised: #21182d;
  --ttmd-text: #f5f1fb;
  --ttmd-muted: #b9afc8;
  --ttmd-subtle: #9387a4;
  --ttmd-line: #3a2d49;
  --ttmd-accent: #8b5cf6;
  --ttmd-accent-ink: #ffffff;
  --ttmd-focus: #c4b5fd;
  --ttmd-shadow: 0 1.5rem 4rem rgba(7, 3, 12, .34);
  --ttmd-shadow-soft: 0 .5rem 1.75rem rgba(7, 3, 12, .28);
}

:root[data-theme="light"] :where(
  .theme-shell--purple,
  body:has(.auth-screen),
  body:has(.membership-screen),
  body:has([data-admin-enrollment]),
  body:has([data-admin-verification])
) {
  color-scheme: light;
  --ttmd-bg: #f7f3fb;
  --ttmd-bg-soft: #eee8f5;
  --ttmd-surface: #fffaff;
  --ttmd-surface-raised: #ffffff;
  --ttmd-text: #21182d;
  --ttmd-muted: #675b75;
  --ttmd-subtle: #766985;
  --ttmd-line: #d7cbe3;
  --ttmd-accent: #6d3fd1;
  --ttmd-accent-ink: #ffffff;
  --ttmd-focus: #6536cc;
  --ttmd-shadow: 0 1.5rem 4rem rgba(65, 38, 91, .12);
  --ttmd-shadow-soft: 0 .5rem 1.75rem rgba(65, 38, 91, .09);
}

:root[data-theme="light"] .theme-shell--purple {
  color-scheme: light;
  --ttmd-bg: #f7f3fb;
  --ttmd-bg-soft: #eee8f5;
  --ttmd-surface: #fffaff;
  --ttmd-surface-raised: #ffffff;
  --ttmd-text: #21182d;
  --ttmd-muted: #675b75;
  --ttmd-subtle: #766985;
  --ttmd-line: #d7cbe3;
  --ttmd-accent: #6d3fd1;
  --ttmd-accent-ink: #ffffff;
  --ttmd-focus: #6536cc;
  --ttmd-shadow: 0 1.5rem 4rem rgba(65, 38, 91, .12);
  --ttmd-shadow-soft: 0 .5rem 1.75rem rgba(65, 38, 91, .09);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) :where(
    .theme-shell--purple,
    body:has(.auth-screen),
    body:has(.membership-screen),
    body:has([data-admin-enrollment]),
    body:has([data-admin-verification])
  ) {
    color-scheme: light;
    --ttmd-bg: #f7f3fb;
    --ttmd-bg-soft: #eee8f5;
    --ttmd-surface: #fffaff;
    --ttmd-surface-raised: #ffffff;
    --ttmd-text: #21182d;
    --ttmd-muted: #675b75;
    --ttmd-subtle: #766985;
    --ttmd-line: #d7cbe3;
    --ttmd-accent: #6d3fd1;
    --ttmd-accent-ink: #ffffff;
    --ttmd-focus: #6536cc;
    --ttmd-shadow: 0 1.5rem 4rem rgba(65, 38, 91, .12);
    --ttmd-shadow-soft: 0 .5rem 1.75rem rgba(65, 38, 91, .09);
  }

  :root:not([data-theme]) .theme-shell--purple {
    color-scheme: light;
    --ttmd-bg: #f7f3fb;
    --ttmd-bg-soft: #eee8f5;
    --ttmd-surface: #fffaff;
    --ttmd-surface-raised: #ffffff;
    --ttmd-text: #21182d;
    --ttmd-muted: #675b75;
    --ttmd-subtle: #766985;
    --ttmd-line: #d7cbe3;
    --ttmd-accent: #6d3fd1;
    --ttmd-accent-ink: #ffffff;
    --ttmd-focus: #6536cc;
    --ttmd-shadow: 0 1.5rem 4rem rgba(65, 38, 91, .12);
    --ttmd-shadow-soft: 0 .5rem 1.75rem rgba(65, 38, 91, .09);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { min-height: 100%; background: var(--ttmd-bg); scroll-behavior: smooth; }
body {
  min-width: 17.5rem;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 84% -10%, color-mix(in srgb, var(--ttmd-accent) 8%, transparent), transparent 31rem),
    linear-gradient(180deg, color-mix(in srgb, var(--ttmd-bg-soft) 72%, var(--ttmd-bg)) 0, var(--ttmd-bg) 22rem);
  color: var(--ttmd-text);
  font-size: 1rem;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; }
button, input, select, textarea, summary { color: inherit; }
a { color: inherit; text-decoration-thickness: .08em; text-underline-offset: .22em; }
a:hover { text-decoration-color: var(--ttmd-accent); }
img, svg { max-width: 100%; }
h1, h2, h3, h4 { color: var(--ttmd-text); font-weight: 430; line-height: 1.12; letter-spacing: -.028em; text-wrap: balance; }
h1 { max-width: 19ch; margin: 0 0 var(--ttmd-space-3); font-size: clamp(2.45rem, 6vw, 4.8rem); }
h2 { margin: 0 0 var(--ttmd-space-2); font-size: clamp(1.8rem, 3.4vw, 2.75rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.55rem); }
h4 { font-size: 1rem; letter-spacing: -.01em; }
p { max-width: 68ch; }
small { color: var(--ttmd-muted); }
::selection { background: var(--ttmd-accent); color: var(--ttmd-accent-ink); }

.skip-link {
  position: fixed;
  z-index: 100;
  top: var(--ttmd-space-2);
  left: var(--ttmd-space-2);
  padding: .75rem 1rem;
  transform: translateY(-180%);
  border-radius: var(--ttmd-radius-small);
  background: var(--ttmd-accent);
  color: var(--ttmd-accent-ink);
}
.skip-link:focus { transform: translateY(0); }
.shell-width { width: min(var(--ttmd-page), calc(100% - 6rem)); margin-inline: auto; }
.site-header { padding-block: 0; border-bottom: 1px solid var(--ttmd-line); }
.site-header .site-header__inner { width: 100%; max-width: none; display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: 1rem clamp(1rem, 3vw, 3rem); }
.wordmark { color: var(--ttmd-text); font-size: .9rem; letter-spacing: .06em; text-decoration: none; }
.wordmark span { color: inherit; }
.site-nav { display: flex; align-items: center; gap: 1.5rem; margin-inline-start: auto; }
.site-nav a { color: var(--ttmd-muted); font-size: .92rem; text-decoration: none; }
.site-nav a:hover { color: var(--ttmd-text); }
.site-nav a[aria-current="page"] { color: var(--ttmd-text); }
.account-menu { position: relative; margin-left: 0; color: var(--ttmd-muted); font-size: .82rem; }
.profile-menu > summary { min-height: 2.75rem; display: inline-flex; align-items: center; gap: .65rem; padding: .3rem .35rem; cursor: pointer; color: var(--ttmd-text); list-style: none; border-radius: var(--ttmd-radius-small); }
.profile-menu > summary::-webkit-details-marker { display: none; }
.profile-menu > summary::marker { content: ""; }
.profile-menu > summary:hover { background: color-mix(in srgb, var(--ttmd-text) 6%, transparent); }
.profile-menu__avatar { width: 2.15rem; height: 2.15rem; flex: 0 0 2.15rem; display: grid; place-items: center; border: 1px solid color-mix(in srgb, var(--ttmd-accent) 58%, var(--ttmd-line)); border-radius: 999px; background: color-mix(in srgb, var(--ttmd-accent) 18%, var(--ttmd-surface-raised)); color: var(--ttmd-text); font: 750 .72rem/1 -apple-system, "SF Pro Text", system-ui, sans-serif; letter-spacing: .04em; }
.profile-menu__avatar--large { width: 2.8rem; height: 2.8rem; flex-basis: 2.8rem; font-size: .82rem; }
.profile-menu__trigger-copy { display: grid; min-width: 0; line-height: 1.15; }
.profile-menu__trigger-copy strong { overflow: hidden; max-width: 10rem; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.profile-menu__trigger-copy small { color: var(--ttmd-muted); font-size: .7rem; }
.profile-menu__chevron { transition: transform 160ms ease; }
.profile-menu[open] .profile-menu__chevron { transform: rotate(180deg); }
.account-menu > .profile-menu__panel { position: absolute; z-index: 40; inset-inline-end: 0; top: calc(100% + .65rem); width: min(22rem, calc(100vw - 2rem)); max-height: min(42rem, calc(100dvh - 6rem)); overflow-y: auto; display: grid; align-items: stretch; gap: .45rem; padding: .8rem; border: 1px solid var(--ttmd-line); border-radius: 1rem; background: var(--ttmd-surface-raised); box-shadow: 0 1.25rem 4rem rgb(0 0 0 / .28); }
.profile-menu__identity { display: flex; align-items: center; gap: .8rem; padding: .65rem .65rem .85rem; border-bottom: 1px solid var(--ttmd-line); color: var(--ttmd-text); }
.profile-menu__identity > span:last-child { display: grid; min-width: 0; }
.profile-menu__identity strong { font-size: 1rem; }
.profile-menu__identity small { color: var(--ttmd-muted); font-size: .75rem; }
.profile-menu__section-label { margin: .35rem .65rem 0; color: var(--ttmd-muted); font: 750 .67rem/1.3 -apple-system, "SF Pro Text", system-ui, sans-serif; letter-spacing: .12em; text-transform: uppercase; }
.profile-menu__group { display: grid; gap: .15rem; }
.site-nav .profile-menu__item { min-height: 3.35rem; display: grid; grid-template-columns: 2.1rem minmax(0, 1fr); align-items: center; gap: .75rem; width: 100%; padding: .55rem .65rem; border: 0; border-radius: .7rem; background: transparent; color: var(--ttmd-text); font: inherit; text-align: start; text-decoration: none; cursor: pointer; }
.site-nav .profile-menu__item:hover { background: color-mix(in srgb, var(--ttmd-accent) 10%, transparent); color: var(--ttmd-text); }
.profile-menu__item > span:last-child { display: grid; min-width: 0; }
.profile-menu__item strong { font-size: .88rem; }
.profile-menu__item small { color: var(--ttmd-muted); font-size: .72rem; line-height: 1.35; }
.profile-menu__icon { width: 2.1rem; height: 2.1rem; display: grid; place-items: center; border-radius: .6rem; background: color-mix(in srgb, var(--ttmd-accent) 12%, var(--ttmd-surface)); color: var(--ttmd-text); font-size: 1rem; }
.account-menu form { margin: 0; }
.site-nav .profile-menu__sign-out { color: var(--ttmd-danger); }
.profile-menu__sign-out .profile-menu__icon { background: color-mix(in srgb, var(--ttmd-danger) 12%, transparent); color: var(--ttmd-danger); }
.destination-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(14rem,1fr)); gap: 1rem; margin-top: 1.5rem; }
.destination-card { display: grid; gap: .45rem; min-height: 9rem; padding: 1.25rem; border: 1px solid var(--ttmd-line); border-radius: var(--ttmd-radius-small); background: var(--ttmd-surface-raised); color: var(--ttmd-text); text-decoration: none; }
.destination-card span { color: var(--ttmd-muted); }
.focus-card.focus-card--platform-home { width: min(100%, var(--ttmd-page)); padding: clamp(2rem, 5vw, 4.75rem); }
.platform-home__lede { max-width: 54rem; margin: 0; color: var(--ttmd-muted); font-size: clamp(1.05rem, 1.7vw, 1.25rem); line-height: 1.65; }
.platform-entry-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(.85rem, 1.8vw, 1.35rem); margin-top: clamp(2rem, 4vw, 3.25rem); }
.platform-entry-card { position: relative; min-height: 22rem; display: flex; flex-direction: column; align-items: flex-start; gap: .8rem; overflow: hidden; padding: clamp(1.35rem, 2.4vw, 2rem); border: 1px solid var(--ttmd-line); border-radius: var(--ttmd-radius); background: linear-gradient(155deg, color-mix(in srgb, var(--ttmd-accent) 7%, var(--ttmd-surface-raised)), var(--ttmd-surface-raised) 46%); color: var(--ttmd-text); text-decoration: none; isolation: isolate; }
.platform-entry-card::after { position: absolute; z-index: -1; right: -3.25rem; bottom: -4rem; width: 10rem; height: 10rem; border: 1px solid color-mix(in srgb, var(--ttmd-accent) 24%, transparent); border-radius: 50%; content: ""; }
.platform-entry-card__number { align-self: flex-end; color: var(--ttmd-subtle); font-size: .72rem; font-weight: 700; letter-spacing: .12em; }
.platform-entry-card__eyebrow { color: var(--ttmd-accent); font-size: .72rem; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; }
.platform-entry-card > strong { max-width: 12ch; margin-top: .15rem; font-size: clamp(1.5rem, 2.1vw, 2rem); font-weight: 520; line-height: 1.12; letter-spacing: -.025em; }
.platform-entry-card__copy { color: var(--ttmd-muted); line-height: 1.58; }
.platform-entry-card__action { min-height: 2.75rem; display: inline-flex; align-items: center; gap: .5rem; margin-top: auto; color: var(--ttmd-text); font-weight: 700; }
.platform-home__note { max-width: 58rem; margin: 1.25rem 0 0; color: var(--ttmd-muted); font-size: .9rem; }
.platform-home__evidence { margin: 2rem 0 0; padding-top: 1.5rem; border-top: 1px solid var(--ttmd-line); color: var(--ttmd-muted); }
.platform-home__evidence a { color: var(--ttmd-text); font-weight: 700; }
.eyebrow {
  margin: 0 0 var(--ttmd-space-2);
  color: var(--ttmd-muted);
  font-size: .78rem;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.muted { color: var(--ttmd-muted); }

.theme-toggle, .button, .file-picker {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .72rem 1.05rem;
  border: 0;
  border-radius: var(--ttmd-radius-small);
  cursor: pointer;
  text-decoration: none;
}
.theme-toggle { min-width: 44px; min-height: 44px; padding: .55rem .9rem; border: 1px solid var(--ttmd-line); border-radius: 999px; background: var(--ttmd-surface-raised); color: var(--ttmd-text); box-shadow: none; font-size: .82rem; font-weight: 700; line-height: 1; }
.theme-toggle:hover { border-color: var(--ttmd-accent); color: var(--ttmd-text); }
.button-primary { background: var(--ttmd-accent); color: var(--ttmd-accent-ink); box-shadow: none; }
.button-primary:hover { transform: translateY(-2px); box-shadow: none; }
.button-secondary, .button:not(.button-primary) { background: var(--ttmd-surface-raised); color: var(--ttmd-text); box-shadow: var(--ttmd-shadow-soft); }
.button[disabled], button[disabled] { cursor: not-allowed; opacity: .58; transform: none; }

:where(a[href], button, input, select, textarea, summary, [role="button"], [tabindex]:not([tabindex="-1"])):focus-visible,
.starting-points label:has(input:focus-visible),
.consent-field:has(input:focus-visible) {
  outline: 2px solid var(--ttmd-focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--ttmd-bg);
}

.layout, .shell { width: min(var(--ttmd-page), calc(100% - 6rem)); margin-inline: auto; padding: var(--ttmd-space-5) 0 var(--ttmd-space-6); }
.layout-focus, .shell-focus { display: grid; min-height: calc(100vh - 7rem); place-items: center; }
.focus-card, .onboarding-card, .library-empty {
  width: min(100%, 49rem);
  padding: clamp(2.25rem, 7vw, 5.5rem);
  border-radius: var(--ttmd-radius);
  background: var(--ttmd-surface);
  box-shadow: var(--ttmd-shadow);
}
.focus-card > :last-child, .onboarding-card > :last-child, .library-empty > :last-child { margin-bottom: 0; }
.onboarding-card { padding: clamp(2rem, 5vw, 3.5rem); }
.focus-content { margin-top: var(--ttmd-space-4); }
.focus-content > section > form, .focus-content > section > form + form { margin-top: var(--ttmd-space-4); }

.stepper { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--ttmd-space-3); margin: 0 0 var(--ttmd-space-5); padding: 0; }
.stepper li { list-style: none; color: var(--ttmd-subtle); font-size: .86rem; }
.stepper li[aria-current="step"] { color: var(--ttmd-text); }
.stepper b { display: block; margin-bottom: .2rem; color: inherit; font-size: .7rem; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; }
.stepper li[aria-current="step"] b { color: var(--ttmd-accent); }

.workbench-grid { display: grid; grid-template-columns: minmax(14rem, 18rem) minmax(0, 1fr); gap: clamp(2.5rem, 6vw, 6rem); align-items: start; }
.workbench-sidebar { position: sticky; top: 2rem; padding-top: var(--ttmd-space-2); }
/* The rail's scope count is the focal datum of the rail (28px), never of the page: on the
   answer screen the answer sentence must out-size it. A viewport-scaled clamp let it reach
   43px and out-shout the answer it exists to support. */
.workbench-scope-count, .workbench-scope-empty { margin: 0 0 var(--ttmd-space-2); color: var(--ttmd-text); font-size: .9375rem; font-weight: 500; line-height: 1.35; letter-spacing: 0; }
.workbench-scope-sources { display: grid; gap: .4rem; margin: 0; padding: 0; color: var(--ttmd-muted); font-size: .875rem; list-style: none; }
.workbench-sidebar .button { margin-top: var(--ttmd-space-2); }
.workbench-main, .detail-primary { min-width: 0; }
.workbench-flow { display: grid; gap: var(--ttmd-space-5); }
.workbench-flow > :only-child { min-width: 0; }
.panel {
  padding: clamp(1.6rem, 4vw, 2.75rem);
  border-radius: var(--ttmd-radius);
  background: var(--ttmd-surface);
  box-shadow: var(--ttmd-shadow-soft);
}
.panel + .panel { margin-top: var(--ttmd-space-4); }

.status, .item-status { display: inline-flex; align-items: center; gap: .55rem; color: var(--ttmd-text); }
.status::before, .item-status > span:first-child { width: .5rem; height: .5rem; flex: none; border-radius: 50%; background: currentColor; content: ""; opacity: .52; }
.status-error, .error, [role="alert"] { color: var(--ttmd-danger); }
.error, [role="alert"] { padding: 1rem 1.15rem; border-radius: var(--ttmd-radius-small); background: color-mix(in srgb, var(--ttmd-danger) 9%, var(--ttmd-surface)); }

/* The application error state. It is a page of the product, not a stack trace: the sentence
 * that tells the reader what happened is the largest thing on it, and the way back out is the
 * only button. */
.error-state__status { color: var(--ttmd-danger); }
.error-state h1 { font-size: clamp(1.9rem, 3.6vw, 2.9rem); }
.error-state__actions { margin-top: var(--ttmd-space-4); }
.error-state__reference { margin-top: var(--ttmd-space-3); color: var(--ttmd-muted); font-size: .86rem; }
.error-state__reference code { padding: .1rem .35rem; border-radius: .25rem; background: var(--ttmd-surface-raised); color: var(--ttmd-text); font-size: .95em; }

.detail-back, .back-link { display: inline-flex; margin-bottom: var(--ttmd-space-4); color: var(--ttmd-muted); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(15rem, 20rem); gap: clamp(2.5rem, 6vw, 6rem); align-items: start; }
.detail-meta {
  position: sticky;
  top: 2rem;
  padding: 2rem;
  border-radius: var(--ttmd-radius);
  background: var(--ttmd-surface);
  box-shadow: var(--ttmd-shadow-soft);
}
.detail-meta dl, .media-detail__metadata { margin: 0; }
.detail-meta dt, .media-detail__metadata dt { margin-top: 1.35rem; color: var(--ttmd-muted); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
.detail-meta dd, .media-detail__metadata dd { margin: .2rem 0 0; }

form { max-width: 48rem; }
fieldset { margin: 0; padding: 0; border: 0; }
fieldset + fieldset { margin-top: var(--ttmd-space-4); }
legend { margin-bottom: var(--ttmd-space-2); font-size: 1.15rem; }
label { display: block; margin-bottom: .45rem; color: var(--ttmd-muted); }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%;
  min-height: 3rem;
  margin-top: .35rem;
  padding: .72rem .85rem;
  border: 1px solid transparent;
  border-radius: var(--ttmd-radius-small);
  background: var(--ttmd-surface-raised);
  color: var(--ttmd-text);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ttmd-line) 62%, transparent);
}
textarea { min-height: 8rem; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--ttmd-subtle); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--ttmd-accent); }
input[type="file"] { margin-bottom: 1.5rem; padding: 1rem; }
input[type="file"]::file-selector-button { margin-right: 1rem; padding: .65rem .9rem; border: 0; border-radius: .6rem; background: var(--ttmd-accent); color: var(--ttmd-accent-ink); cursor: pointer; }

/* Trust-sensitive auth actions need deliberate separation and a quiet resend path. */
.auth-screen .auth-primary-action { margin-top: 2rem; }
.auth-screen form + form { margin-top: 1.5rem; }
.focus-card:has(.auth-screen) > h1 { margin-bottom: var(--ttmd-space-2); color: var(--ttmd-muted); font-size: 1.125rem; letter-spacing: 0; }
.auth-screen h2 { font-size: clamp(2.15rem, 4vw, 3.25rem); }
.auth-resend { min-height: 2.75rem; padding: .55rem .2rem; border: 0; background: transparent; color: var(--ttmd-muted); cursor: pointer; text-decoration: underline; text-decoration-thickness: .08em; text-underline-offset: .22em; }
.auth-resend:hover { color: var(--ttmd-text); text-decoration-color: var(--ttmd-accent); }
.auth-disclosure { margin-block: var(--ttmd-space-3); color: var(--ttmd-muted); }
.auth-disclosure summary { cursor: pointer; }

/* Dark, reachable native controls on product work surfaces. */
:where(.library-screen, .collections-screen, .collection-workbench, .scope-builder, .ingest-screen) :is(select, input[type="date"]) {
  appearance: none;
  border: 1px solid var(--ttmd-line);
  border-radius: 10px;
  background-color: var(--ttmd-surface);
  color: var(--ttmd-text);
  color-scheme: dark;
}
:where(.library-screen, .collections-screen, .collection-workbench, .scope-builder, .ingest-screen) select {
  padding-right: 2.5rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--ttmd-muted) 50%), linear-gradient(135deg, var(--ttmd-muted) 50%, transparent 50%);
  background-position: calc(100% - 1rem) 52%, calc(100% - .68rem) 52%;
  background-size: .35rem .35rem, .35rem .35rem;
  background-repeat: no-repeat;
}
:where(.library-screen, .collections-screen, .collection-workbench, .scope-builder, .ingest-screen) :is(input[type="checkbox"], input[type="radio"]) {
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 1.15rem;
  appearance: none;
  border: 1px solid var(--ttmd-muted);
  background: var(--ttmd-surface);
  color: var(--ttmd-accent);
  cursor: pointer;
}
:where(.library-screen, .collections-screen, .collection-workbench, .scope-builder, .ingest-screen) input[type="checkbox"] { border-radius: .28rem; }
:where(.library-screen, .collections-screen, .collection-workbench, .scope-builder, .ingest-screen) input[type="radio"] { border-radius: 50%; }
:where(.library-screen, .collections-screen, .collection-workbench, .scope-builder, .ingest-screen) :is(input[type="checkbox"], input[type="radio"]):checked { border-color: var(--ttmd-accent); background: var(--ttmd-accent); box-shadow: inset 0 0 0 .23rem var(--ttmd-surface); }

/* The custody checkbox is a required legal attestation, not quiet helper copy. */
.ingest-form > label { margin-top: 1.25rem; margin-bottom: .45rem; }
.ingest-form > label:first-of-type { margin-top: 0; }
.ingest-form > .option-field, .ingest-form > .consent-field { margin-block: 1.25rem 0; }
.ingest-form > .button { margin-top: 2rem; }
.ingest-form .option-field, .consent-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .25rem .8rem;
  align-items: start;
  padding: 1rem 1.15rem;
  border-radius: var(--ttmd-radius-small);
  background: var(--ttmd-surface-raised);
  color: var(--ttmd-text);
}
.ingest-form .option-field input, .consent-field input { margin-top: .35rem; }
.consent-field { font-size: 1.05rem; box-shadow: inset .2rem 0 0 var(--ttmd-accent); }
.consent-field input[type="checkbox"] { width: 1.35rem; height: 1.35rem; flex-basis: 1.35rem; }
.required-marker { margin-left: .3rem; color: var(--ttmd-danger); }
.consent-help, .consent-error { grid-column: 2; margin: .2rem 0 0; font-size: .9rem; }
.consent-help { color: var(--ttmd-muted); }
.consent-error { display: none; color: var(--ttmd-danger); }
.consent-field:has(input:user-invalid) { box-shadow: inset .2rem 0 0 var(--ttmd-danger); }
.consent-field:has(input:user-invalid) .consent-error { display: block; }

.bottom-sheet { margin-top: var(--ttmd-space-3); color: var(--ttmd-muted); }
.bottom-sheet summary { cursor: pointer; }
.bottom-sheet__body { padding-top: var(--ttmd-space-2); }
.ttmd-dialog, .ttmd-drawer {
  width: min(38rem, calc(100% - 2rem));
  padding: clamp(2rem, 6vw, 3.5rem);
  border: 0;
  border-radius: var(--ttmd-radius);
  background: var(--ttmd-surface-raised);
  color: var(--ttmd-text);
  box-shadow: 0 2rem 6rem rgba(0, 0, 0, .42);
}
.ttmd-dialog::backdrop, .ttmd-drawer::backdrop { background: rgba(4, 7, 9, .74); backdrop-filter: blur(.25rem); }
.ttmd-drawer { width: min(44rem, 100%); max-width: none; height: 100%; max-height: none; margin: 0 0 0 auto; border-radius: var(--ttmd-radius) 0 0 var(--ttmd-radius); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 1rem; margin-top: var(--ttmd-space-4); }

/* Shared product screens. Visual grouping comes from scale and space; cards float softly. */
.library-header, .collections-header, .collection-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 2rem; margin-bottom: var(--ttmd-space-5); }
.library-filters, .collection-search { margin-bottom: var(--ttmd-space-4); padding: clamp(1.35rem, 3vw, 2rem); border-radius: var(--ttmd-radius); background: var(--ttmd-surface); box-shadow: var(--ttmd-shadow-soft); }
.library-filters { display: grid; grid-template-columns: minmax(14rem, 2fr) repeat(2, minmax(8rem, 1fr)) auto; gap: 1rem; align-items: end; max-width: none; }
.collection-search > div, .collection-actions, .library-selection-actions { display: flex; align-items: center; gap: 1rem; }
.collection-actions, .library-selection-actions { flex-wrap: wrap; margin-top: var(--ttmd-space-3); }
.empty-state { max-width: 46rem; padding-block: var(--ttmd-space-4); }
.empty-state ul { display: grid; gap: 1rem; padding: 0; }
.empty-state li { padding: 1rem 1.25rem; list-style: none; border-radius: var(--ttmd-radius-small); background: var(--ttmd-surface-raised); }
.demo-corpus {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--ttmd-space-3);
  align-items: center;
  margin-bottom: var(--ttmd-space-4);
  padding: clamp(1.5rem, 4vw, 2.25rem);
  border-radius: var(--ttmd-radius);
  background: color-mix(in srgb, var(--ttmd-accent) 9%, var(--ttmd-surface));
  box-shadow: var(--ttmd-shadow-soft);
}
.demo-corpus h2 { margin-bottom: .55rem; font-size: clamp(1.45rem, 2.7vw, 2rem); }
.demo-corpus p { margin-block: 0; }
.demo-corpus form { margin: 0; }

/* List Views overrides the component's compact baseline without changing behavior. */
body .list-view { --list-gap: 1rem; }
body .list-view__toolbar { justify-content: flex-end !important; margin-bottom: var(--ttmd-space-4); }
body .list-view__switcher { gap: .2rem; padding: .3rem; border: 0; border-radius: 10px; background: var(--ttmd-surface); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ttmd-line) 42%, transparent); }
body .list-view__mode { color: var(--ttmd-muted); }
body .list-view__mode[aria-pressed="true"] { border-color: transparent; background: #1f2530; color: var(--ttmd-text); box-shadow: none; }
body .list-item { padding: 1.2rem 1.35rem; border: 0; border-radius: var(--ttmd-radius); background: var(--ttmd-surface); box-shadow: var(--ttmd-shadow-soft); }
body .list-item:hover { background: var(--ttmd-surface-raised); transform: translateY(-1px); }
body .list-item__heading h3 a { text-decoration-color: transparent; }
body .list-item__heading h3 a:hover { text-decoration-color: var(--ttmd-accent); }
body .list-item__details dt { color: var(--ttmd-subtle); font-weight: 500; }
body .list-item[data-status="permission-limited"], body .list-item[data-status="failed"] { box-shadow: inset .2rem 0 0 color-mix(in srgb, var(--ttmd-danger) 74%, transparent), var(--ttmd-shadow-soft); }
body [data-view-mode="small-cards"] .list-view__items, body [data-view-mode="full-cards"] .list-view__items { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important; gap: 24px; }
body [data-view-mode="small-cards"] .list-item, body [data-view-mode="full-cards"] .list-item { min-height: 11rem; padding: 1.65rem; }
body [data-view-mode="full-cards"] .list-item { min-height: 15rem; }

/* Scope builder and its live, authorization-first preview. */
.scope-builder { display: grid; gap: var(--ttmd-space-4); }
.scope-builder > header { max-width: var(--ttmd-reading); }
.scope-form { max-width: none; }
.starting-points { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.starting-points label { padding: 1.15rem; border: 1px solid var(--ttmd-line); border-radius: var(--ttmd-radius-small); background: var(--ttmd-surface); box-shadow: var(--ttmd-shadow-soft); color: var(--ttmd-text); cursor: pointer; }
.starting-points label:has(input:checked) { border-color: transparent; background: #1f2530; }
.scope-identifiers, .scope-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; margin-top: var(--ttmd-space-4); }
.scope-identifiers label:last-child { grid-column: 1 / -1; }
.scope-preview { margin-top: var(--ttmd-space-5); padding: clamp(1.6rem, 4vw, 2.75rem); border-radius: var(--ttmd-radius); background: var(--ttmd-surface); box-shadow: var(--ttmd-shadow); }
.scope-preview > header { margin-bottom: var(--ttmd-space-4); }
.scope-chips { display: flex; flex-wrap: wrap; gap: .65rem; margin-bottom: var(--ttmd-space-3); }
.scope-chip { display: inline-flex; align-items: center; gap: .45rem; min-height: 2.5rem; padding: .5rem .8rem; border: 0; border-radius: 999px; background: #1f2530; color: var(--ttmd-text); }
.preview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ttmd-space-4); }
.preview-grid section { min-width: 0; }
.preview-grid ul { padding-left: 1.2rem; }
.preview-grid li { margin-block: .65rem; }
.preview-grid small { display: block; }
.preview-grid dl div { display: flex; justify-content: space-between; gap: 1rem; padding-block: .55rem; }
.preview-grid dd { margin: 0; }
.scope-guided-outcome { padding: 1.5rem; border-radius: var(--ttmd-radius); background: var(--ttmd-surface); box-shadow: var(--ttmd-shadow-soft); }

/* Honest ingest and job states. */
.shell-focus { width: min(50rem, calc(100% - 3rem)); align-content: center; }
.shell-focus > section, .shell-detail > section { margin-top: var(--ttmd-space-5); padding: clamp(1.5rem, 4vw, 2.5rem); border-radius: var(--ttmd-radius); background: var(--ttmd-surface); box-shadow: var(--ttmd-shadow-soft); }
.shell-focus form + section { margin-top: var(--ttmd-space-5); }
.shell-detail ol { margin-block: var(--ttmd-space-4); padding-left: 1.25rem; }
.shell-detail ol li { padding: .55rem 0 .55rem .5rem; color: var(--ttmd-muted); }
.shell-detail ol time { color: var(--ttmd-text); font-variant-numeric: tabular-nums; }

/* Cited answer: scope, outcome, claim, and evidence remain simultaneously legible. */
.chat-answer { max-width: 58rem; }
.answering-about { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; margin-bottom: var(--ttmd-space-5); padding: .65rem .9rem; border-radius: 999px; background: var(--ttmd-surface-raised); color: var(--ttmd-muted); }
.answering-about strong { color: var(--ttmd-text); font-weight: 500; }
.answer-header { margin-bottom: var(--ttmd-space-5); }
.asked-question { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; margin: 0; color: var(--ttmd-muted); font-size: 1rem; }
.asked-question > span:first-child { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; }
.trust-badge { display: inline-flex; align-items: center; min-height: 1.75rem; padding: .15rem .55rem; border: 1px solid var(--ttmd-line); border-radius: 999px; color: var(--ttmd-text); font-size: .75rem; letter-spacing: .03em; }
.trust-badge::before { width: .42rem; height: .42rem; margin-right: .4rem; border-radius: 50%; background: var(--ttmd-accent); content: ""; }
.trust-label { margin: 0 0 1rem; color: var(--ttmd-muted); font-size: 1rem; font-weight: 400; letter-spacing: .04em; }
.trust-summary { color: var(--ttmd-muted); font-size: 1.08rem; }
.answer-blocks { display: grid; gap: var(--ttmd-space-3); }
.claim { padding: clamp(1.5rem, 4vw, 2.35rem); border-radius: var(--ttmd-radius); background: var(--ttmd-surface); box-shadow: var(--ttmd-shadow-soft); }
.claim > :last-child { margin-bottom: 0; }
/* The payoff of the whole product. This must be the largest text on the answer screen. */
.answer-prose > p { max-width: 68ch; margin-block: 0; color: #e7ebf0; font-size: clamp(1.875rem, 2.6vw, 2rem); line-height: 1.35; }
.inline-citation { margin-left: .3rem; color: var(--ttmd-accent); font-size: .72em; font-weight: 600; text-decoration-color: currentColor; }
.claim nav { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: var(--ttmd-space-3); }
.claim-evidence { margin-top: var(--ttmd-space-3); }
.claim-evidence__heading { margin: 0 0 .75rem; color: var(--ttmd-muted); font-size: .78rem; letter-spacing: .09em; text-transform: uppercase; }
.claim-evidence ul { display: grid; gap: .75rem; margin: 0; padding: 0; }
.claim-evidence li { list-style: none; }
.citation-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .2rem 1rem;
  align-items: center;
  min-height: 4.6rem;
  padding: 1rem 1.15rem;
  border-radius: var(--ttmd-radius-small);
  background: var(--ttmd-surface-raised);
  box-shadow: inset .18rem 0 0 var(--ttmd-accent);
  text-decoration: none;
}
.citation-card__source { color: var(--ttmd-muted); }
.citation-card__locator { grid-column: 1; color: var(--ttmd-muted); font-size: .9rem; }
.citation-card__passage { grid-column: 1; max-width: 66ch; color: #c9d1d9; font-size: .96rem; line-height: 1.55; }
.citation-link { display: inline-flex; min-height: 2.75rem; align-items: center; padding: .62rem .85rem; border-radius: var(--ttmd-radius-small); background: var(--ttmd-accent); color: var(--ttmd-accent-ink); text-decoration: none; }
.citation-link::before { content: "↗"; margin-right: .45rem; }
.route-provenance { margin-top: var(--ttmd-space-5); color: var(--ttmd-muted); }
.route-provenance summary { cursor: pointer; color: var(--ttmd-text); }
.route-provenance[open] { padding: 1.25rem 1.4rem; border-radius: var(--ttmd-radius-small); background: var(--ttmd-surface); box-shadow: var(--ttmd-shadow-soft); }
.trust-actions { display: flex; flex-wrap: wrap; gap: .85rem; margin-top: var(--ttmd-space-4); }
.trust-actions a { display: inline-flex; min-height: 2.75rem; align-items: center; padding: .62rem .9rem; border-radius: var(--ttmd-radius-small); background: var(--ttmd-surface-raised); box-shadow: var(--ttmd-shadow-soft); text-decoration: none; }
.trust-actions a[data-primary-action="true"] { background: var(--ttmd-accent); color: var(--ttmd-accent-ink); }
.question-panel { margin-top: var(--ttmd-space-5); padding: clamp(1.5rem, 4vw, 2.35rem); border-radius: var(--ttmd-radius); background: var(--ttmd-surface); box-shadow: var(--ttmd-shadow-soft); }
.question-panel h2 { margin-bottom: var(--ttmd-space-3); font-size: clamp(1.55rem, 3vw, 2.2rem); }
/* Once an answer is on screen, the follow-up ask box is a secondary panel and must not out-size
   the answer above it. With no claim rendered (the empty ask state) the question box IS the hero
   and keeps its display size. */
.answer-blocks:has(.claim--primary) ~ .question-panel h2 { font-size: 1.125rem; }
.question-form { max-width: none; }
.question-form .button { margin-top: var(--ttmd-space-3); }
.question-form .button-primary { background: #1f2630; color: #e7ebf0; }
.question-form .error { margin-top: var(--ttmd-space-2); }
[data-trust-state="no-evidence-in-scope"] .claim,
[data-trust-state="conflicting-evidence"] .claim,
[data-trust-state="partial-citation"] .claim-inference,
[data-trust-state="low-confidence"] .claim,
[data-trust-state="too-broad-scope"] .claim { box-shadow: inset .2rem 0 0 color-mix(in srgb, var(--ttmd-muted) 58%, transparent), var(--ttmd-shadow-soft); }

/* Evidence inspector uses gold only for the selected passage. */
.citation-inspector { width: min(var(--ttmd-reading), calc(100% - 3rem)); margin-inline: auto; padding-block: var(--ttmd-space-6); }
.citation-inspector header { margin-bottom: var(--ttmd-space-5); }
.evidence-passage { margin: 0 0 var(--ttmd-space-4); padding: clamp(1.6rem, 5vw, 3rem); border: 0; border-radius: var(--ttmd-radius); background: color-mix(in srgb, var(--ttmd-accent) 13%, var(--ttmd-surface)); box-shadow: var(--ttmd-shadow); font-size: clamp(1.08rem, 2.3vw, 1.3rem); line-height: 1.8; }
.citation-inspector[data-variant="access-revoked"], .citation-inspector[data-variant="deleted-purged"] { color: var(--ttmd-muted); }

.live-region { position: fixed; z-index: 110; right: 1rem; bottom: 1rem; max-width: 28rem; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

@media (hover: hover) {
  .button, .theme-toggle, .list-item, .citation-link, .citation-card, .trust-actions a, .platform-entry-card { transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease, color 180ms ease, border-color 180ms ease; }
  .citation-link:hover { transform: translateY(-2px); box-shadow: none; }
  .citation-card:hover { background: color-mix(in srgb, var(--ttmd-accent) 8%, var(--ttmd-surface-raised)); transform: translateY(-1px); }
  .platform-entry-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--ttmd-accent) 56%, var(--ttmd-line)); box-shadow: var(--ttmd-shadow-soft); }
}

@media (max-width: 58rem) {
  .shell-width, .layout, .shell { width: min(100% - 2rem, var(--ttmd-page)); }
  .workbench-grid, .detail-grid { grid-template-columns: 1fr; gap: var(--ttmd-space-5); }
  .workbench-sidebar, .detail-meta { position: static; }
  .workbench-sidebar { max-width: 42rem; }
  .library-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .library-filters > :first-child { grid-column: 1 / -1; }
  .platform-entry-grid { grid-template-columns: 1fr; }
  .platform-entry-card { min-height: 15rem; }
}

@media (max-width: 46rem) {
  .site-header .site-header__inner { align-items: center; flex-direction: row; flex-wrap: wrap; gap: .75rem 1rem; padding-inline: 1rem; }
  .site-nav { width: 100%; flex-wrap: wrap; gap: .75rem 1.1rem; }
  .account-menu { margin-left: 0; }
  .site-nav .theme-toggle { margin-left: auto; }
  .account-menu > .profile-menu__panel { position: fixed; inset-inline: .75rem; top: 4.75rem; width: auto; max-height: calc(100dvh - 5.5rem); }
  .profile-menu__trigger-copy small { display: none; }
  .layout, .shell { padding-top: var(--ttmd-space-4); }
  .stepper { grid-template-columns: 1fr; margin-bottom: var(--ttmd-space-4); }
  .stepper li { display: none; }
  .stepper li[aria-current="step"] { display: block; }
  .library-header, .collections-header, .collection-heading { flex-direction: column; margin-bottom: var(--ttmd-space-4); }
  .library-filters, .scope-identifiers, .scope-filters, .preview-grid { grid-template-columns: 1fr; }
  .library-filters > :first-child, .scope-identifiers label:last-child { grid-column: auto; }
  .starting-points { grid-template-columns: 1fr; }
  .demo-corpus { grid-template-columns: 1fr; }
  .citation-card { grid-template-columns: 1fr; }
  .citation-card__action { grid-column: 1; grid-row: auto; margin-top: .45rem; }
  .bottom-sheet { position: sticky; z-index: 10; bottom: .75rem; padding: .85rem 1rem; border-radius: var(--ttmd-radius-small); background: var(--ttmd-surface); box-shadow: var(--ttmd-shadow); }
  .citation-inspector { width: min(100% - 2rem, var(--ttmd-reading)); padding-top: var(--ttmd-space-4); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media (forced-colors: active) {
  .status::before, .item-status > span:first-child { border: 2px solid currentColor; }
  .button, .theme-toggle, .citation-link, .trust-actions a, input, select, textarea { border: 1px solid ButtonText; }
  .claim, .panel, .focus-card, .list-item, .scope-preview, .platform-entry-card { border: 1px solid CanvasText; }
  .platform-entry-card::after { display: none; }
}
