:root {
  --brown: #4e342e;
  --paper: #faf7f0;
  --beige: #f5ebdd;
  --green: #40854f;
  --button-fill: #3a7547;
  --button-fill-disabled: #557e53;
  --link: #30653c;
  --error: #8b2020;
  --line: #d7c6b8;
  --card: #fffdf8;
  --ok-bg: #e7f1e6;
  --ok-line: #c3d9c1;
  --err-bg: #f7e4e2;
  --err-line: #dba9a4;
  --warn: #8a5a00;
  --warn-bg: #fbf0d9;
  --muted: rgb(78 52 46 / .74);
  /* Soft borders: the same values as the landing buttons (src/expert-landing/landing.css) */
  --edge: rgb(78 52 46 / .28);
  --edge-green: rgb(48 101 60 / .4);
  --edge-warn: rgb(138 90 0 / .45);
  --serif: Georgia, 'Times New Roman', serif;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--brown);
  background: var(--paper);
  font-size: 16px;
  line-height: 1.6;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--paper); }
h1, h2, p { overflow-wrap: break-word; }
h1 { font-size: clamp(32px, 6vw, 44px); font-weight: 650; line-height: 1.12; letter-spacing: -.035em; margin: 48px 0 16px; }
h2 { font-family: var(--serif); font-size: 26px; font-weight: 400; margin: 0 0 12px; }
p { margin: 0 0 20px; max-width: 65ch; }
a { color: var(--link); text-underline-offset: 4px; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 4px; }
button, input { font: inherit; }
a, button, input { touch-action: manipulation; }
.container { width: min(1200px, calc(100% - 32px)); margin-inline: auto; }
.narrow { max-width: 480px; margin-inline: auto; padding-bottom: 64px; }
/* Header and footer: the landing pattern (monogram, wordmark, language picker; lockup, tagline, links) */
.site-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 24px; padding-block: 12px; border-bottom: 1px solid var(--line); }
.brand { min-height: 44px; display: inline-flex; align-items: center; gap: 10px; }
.brand img { display: block; height: 30px; width: auto; }
.brand .brand-monogram { height: 27px; width: 27px; flex: none; }
.header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; margin-left: auto; }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; }
.site-nav a, .header-actions .sign-out { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-bottom: 2px solid transparent; font-size: 15px; text-decoration: none; }
.site-nav a { color: var(--brown); }
.site-nav a:hover { border-bottom-color: var(--line); }
.site-nav a[aria-current] { font-weight: 650; border-bottom-color: var(--link); }
.site-nav .nav-expert { color: var(--link); font-weight: 650; }
.header-actions .sign-out { min-width: 0; padding-block: 0; font-size: 15px; text-decoration: none; border-radius: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.language-picker { display: flex; align-items: center; gap: 8px; }
.language-picker select { width: 64px; min-height: 44px; margin: 0; padding: 8px; border: 0; background: transparent; color: var(--brown); font-size: 14px; cursor: pointer; }
.language-picker button { min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--link); font-size: 12px; line-height: 1.2; max-width: 72px; cursor: pointer; }
.landing-footer { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 24px 40px; padding-block: 32px; margin-top: 16px; border-top: 1px solid var(--line); }
.landing-footer .landing-footer-brand { max-width: 34ch; }
.landing-footer-brand p { margin: 0; }
.brand-lockup img { height: 96px; }
.landing-footer nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
.landing-footer nav a { display: inline-flex; align-items: center; min-height: 44px; overflow-wrap: anywhere; font-size: 14px; }
.intro { font: 20px/1.45 var(--serif); letter-spacing: -.01em; margin-bottom: 32px; }
.button { display: flex; justify-content: center; align-items: center; width: 100%; min-height: 48px; padding: 13px 20px; border: 1px solid var(--edge); border-radius: 6px; background: var(--button-fill); color: #fff; text-decoration: none; font-size: 15px; font-weight: 650; cursor: pointer; }
.button:hover { background: var(--link); }
.button:disabled { background: var(--button-fill-disabled); cursor: wait; }
.button.secondary { background: transparent; color: var(--link); border-color: var(--edge-green); }
.button.secondary:hover { background: var(--beige); }
.button.secondary:disabled, .button.danger:disabled { opacity: .7; }
.scopes { margin: 0 0 20px; padding-left: 20px; }
.divider { display: flex; align-items: center; gap: 16px; margin: 24px 0; font-size: 13px; text-transform: uppercase; letter-spacing: .1em; }
.divider::before, .divider::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
label { display: block; font-size: 14px; font-weight: 650; margin-bottom: 6px; }
input { display: block; width: 100%; min-height: 48px; padding: 10px 12px; margin-bottom: 16px; border: 1px solid var(--edge); border-radius: 6px; background: #fff; color: var(--brown); }
.field-error { color: var(--error); font-size: 14px; margin: 0 0 16px; }
.link-button { background: none; border: 0; padding: 8px 0; min-width: 44px; min-height: 44px; color: var(--link); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.actions { display: flex; flex-direction: column; gap: 8px; }
#sent { padding: 20px; border: 1px solid var(--edge); border-radius: 6px; background: var(--beige); }
.micro { font-size: 13px; margin-top: 32px; }
.skip { position: absolute; left: 16px; top: 0; transform: translateY(-120%); padding: 10px 14px; background: #fff; border: 1px solid var(--edge); border-radius: 0 0 6px 6px; z-index: 2; }
.skip:focus { transform: translateY(0); }
[hidden] { display: none !important; }

/* Signed-in portal (/app) */
.wide { padding-bottom: 64px; }
#app-root { max-width: 880px; }
.wide h1 { margin-top: 32px; }
#app-root:has(.connect-page) { max-width: none; }
.connect-hero { padding: clamp(48px, 7vw, 104px) 0 clamp(28px, 4vw, 48px); text-align: center; }
.connect-page .connect-hero h1 {
  margin: 0 0 16px;
  font: 400 clamp(38px, 5vw, 64px)/1.04 var(--serif);
  letter-spacing: -.04em;
  text-wrap: balance;
}
.connect-hero p { max-width: 46ch; margin: 0 auto; font-size: clamp(16px, 1.3vw, 19px); text-wrap: pretty; }
.connect-clients { border-bottom: 1px solid var(--line); }
.connect-clients ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; margin: 0; padding: 0; list-style: none; }
.connect-clients a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 12px;
  border-bottom: 2px solid transparent;
  color: var(--link);
  font-size: 15px;
  text-decoration: none;
}
.connect-clients a:hover { border-bottom-color: var(--line); }
.connect-clients a[aria-current] { border-bottom-color: var(--link); color: var(--brown); font-weight: 650; }
.connect-guide { width: min(625px, 100%); margin-inline: auto; padding-top: clamp(32px, 5vw, 64px); }
.connect-guide h2 { margin: 0 0 20px; font-size: clamp(23px, 2.5vw, 32px); line-height: 1.2; }
.connect-steps { margin: 0 0 20px; padding-inline-start: 1.4em; }
.connect-steps li { padding-inline-start: .4em; }
.connect-steps li + li { margin-top: 16px; }
.connect-steps li::marker { color: var(--link); font-weight: 650; }
.connect-steps p { margin: 0; }
.connect-steps .code { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px; margin: 8px 0 0; padding: 4px; }
.connect-steps .code pre { flex: 1 1 max-content; min-width: 0; }
.connect-steps .code .button { min-width: 84px; margin: 0 0 0 auto; padding-inline: 10px; }
.connect-note { margin-bottom: 8px; font-size: 14px; }
.connect-action { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-bottom: 8px; font-weight: 650; }
.connect-primary { display: inline-flex; width: auto; gap: 8px; margin-bottom: 24px; }
.connect-help summary { min-height: 44px; align-content: center; color: var(--link); cursor: pointer; }
.connect-help > p { margin-bottom: 8px; }
@media (max-width: 599px) {
  .connect-clients ul { gap: 0 4px; }
  .connect-clients a { padding-inline: 8px; }
  .connect-guide { width: calc(100% - 16px); }
}
.code { margin: 0 0 20px; border: 1px solid var(--edge); border-radius: 6px; background: var(--beige); }
.code pre { margin: 0; padding: 12px 14px; white-space: pre-wrap; overflow-wrap: anywhere; font: 14px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.code .button { width: auto; min-height: 44px; margin: 0 8px 8px 14px; padding-block: 8px; }
.rows { list-style: none; margin: 0 0 24px; padding: 0; border-top: 1px solid var(--line); }
.row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 260px; overflow-wrap: anywhere; }
.row .button { width: auto; flex: 0 0 auto; }
.meta { font-size: 14px; }
.hint { font-size: 13px; margin: -8px 0 16px; }
code { font: 14px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.secret { margin: 0 0 24px; padding: 16px; border: 1px solid var(--edge-green); border-radius: 6px; background: var(--beige); }
.secret h2 { font-size: 22px; }
.status { min-height: 1.6em; margin: 0 0 12px; font-size: 14px; }
.button.danger { background: transparent; border-color: var(--error); color: var(--error); }
.button.danger:hover { background: #f6e4e0; }
.pager { display: flex; align-items: center; gap: 16px; margin: 0 0 24px; }
.pager a { display: inline-flex; align-items: center; min-height: 44px; }
.objective { font-weight: 550; }
#key-form, #deactivate-form { max-width: 480px; }
.actions-row a { display: inline-flex; align-items: center; min-height: 44px; }
.link-button { font-size: 16px; }

/* Specialist portal (/expert) */
#expert-root { max-width: 880px; }
#expert-root:has(.profile-layout) { max-width: none; }
.banner { margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--edge-green); border-left-width: 6px; border-radius: 6px; background: var(--beige); }
.banner.warn { border-color: var(--error); }
.callout { margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--edge); border-radius: 6px; background: var(--beige); }
.callout.warn { border-color: var(--error); }
.row-label { font-weight: 550; }
.row-value { margin-left: auto; text-align: right; }
.badge { display: inline-flex; align-items: center; min-height: 28px; padding: 2px 12px; border: 1px solid var(--edge); border-radius: 999px; font-size: 13px; }
.badge.done { border-color: var(--edge-green); background: var(--ok-bg); font-weight: 650; }
.button.small { min-height: 44px; padding: 8px 16px; font-size: 14px; }
blockquote { margin: 0 0 16px; padding: 4px 14px; border-left: 3px solid var(--line); max-width: 65ch; font-size: 15px; }
.notice summary { display: flex; align-items: center; justify-content: space-between; min-height: 44px; font-weight: 650; cursor: pointer; list-style: none; }
.notice summary::-webkit-details-marker { display: none; }
.notice summary::after { content: ''; width: 8px; height: 8px; margin-left: 10px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .15s; }
.notice[open] summary::after { transform: rotate(-135deg); }
.notice blockquote { font-size: 13px; line-height: 1.5; }
textarea { display: block; width: 100%; min-height: 96px; padding: 10px 12px; margin-bottom: 16px; border: 1px solid var(--edge); border-radius: 6px; background: #fff; color: var(--brown); font: inherit; resize: vertical; }
input[aria-invalid="true"] { border-color: var(--error); border-width: 2px; }

/* Identity and availability */
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 2px 14px; border: 1px solid var(--edge-green); border-radius: 999px; background: var(--ok-bg); font-size: 14px; font-weight: 650; }
.chip.warn { border-color: var(--edge-warn); background: var(--warn-bg); color: #5c3b00; }
.chip.neutral { border-color: var(--edge); background: transparent; color: var(--muted); font-weight: 400; }
.identity { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; padding: 32px 0 24px; }
.avatar { width: 72px; height: 72px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--button-fill); color: #fff; font: 400 28px/1 var(--serif); letter-spacing: .02em; }
.identity-text { flex: 1 1 280px; min-width: 0; }
.identity-text h1 { margin: 0; font: 400 clamp(30px, 4.4vw, 42px)/1.1 var(--serif); letter-spacing: -.03em; }
.identity-text p { margin: 4px 0 0; color: var(--muted); }
.identity-status { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.identity-status .micro, .setup-head .micro { margin: 0; color: var(--muted); }

/* Activation: on the page only while a step is missing */
.setup { margin: 0 0 32px; padding: 24px; border: 1px solid var(--edge-green); border-radius: 10px; background: var(--card); }
.setup h2 { margin: 0; }
.setup-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.progress { appearance: none; display: block; flex: 0 0 100%; height: 6px; margin: 12px 0 8px; border: 0; border-radius: 3px; background: var(--ok-bg); overflow: hidden; }
.progress::-webkit-progress-bar { background: var(--ok-bg); }
.progress::-webkit-progress-value { background: var(--button-fill); }
.progress::-moz-progress-bar { background: var(--button-fill); }
.steps { list-style: none; margin: 16px 0 0; padding: 0; }
.step { display: grid; grid-template-columns: 32px 1fr; gap: 0 14px; align-items: start; padding: 14px 0; border-top: 1px solid var(--line); }
.step:first-child { border-top: 0; }
.mark { width: 32px; height: 32px; display: grid; place-items: center; border: 2px solid var(--line); border-radius: 50%; font-size: 14px; font-weight: 650; }
.step.done .mark { border-color: var(--button-fill); background: var(--button-fill); color: #fff; }
.step.current .mark { border-color: var(--button-fill); }
.step h3 { margin: 0; padding-top: 4px; font-size: 16px; font-weight: 650; }
.step.done h3, .step:not(.current) h3 { color: var(--muted); }
.step.done h3 { font-weight: 400; }
.step-body { grid-column: 2; margin-top: 8px; }
.step.solo { display: block; }
.step.solo .step-body { margin-top: 0; }
.step-body p, .step-body details { margin-bottom: 16px; font-size: 15px; }
.step-body .button { width: auto; display: inline-flex; }
.sees { margin: 0 0 16px; padding: 12px 16px; border-radius: 6px; background: var(--beige); }
.sees p { margin: 0; }

/* About you */
.profile-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: start; }
.profile-layout > form { grid-column: 1; grid-row: 1; }
.profile-layout > .aside { grid-column: 2; grid-row: 1; }
.panel { margin-bottom: 24px; padding: 24px; border: 1px solid var(--edge); border-radius: 10px; background: var(--card); }
.panel > header { margin-bottom: 20px; }
.panel > header h2 { margin: 0 0 4px; font-size: 24px; }
.panel > header p { margin: 0; font-size: 14px; color: var(--muted); }
.group { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; margin: 8px 0 4px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.group .micro { margin: 0; text-transform: none; letter-spacing: 0; font-weight: 400; }
header + .group-block > .group { margin-top: 0; padding-top: 0; border-top: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.field { min-width: 0; margin-bottom: 12px; }
.field-head { min-height: 44px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 16px; }
.field-head label { margin: 0; }
.field input, .field textarea { margin-bottom: 4px; }
.field .field-error { margin: 0 0 8px; }
.field .hint { margin: 2px 0 8px; color: var(--muted); }
.tag { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; font-size: 13px; color: var(--muted); }
.tag svg { flex: none; }
.group-block > .field-error { margin: 0 0 8px; }

/* The card: how the agent sees you */
.aside { position: sticky; top: 16px; }
.sees-card { padding: 14px 16px; border: 1px solid var(--edge-green); border-radius: 10px; background: var(--card); }
.eyebrow { margin: 0 0 8px; font: 650 13px/1.3 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.agent-view p { margin: 0; font-size: 14px; line-height: 1.45; }
.agent-view .nm { font: 400 19px/1.25 var(--serif); overflow-wrap: anywhere; }
.agent-view .contact { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.agent-view .never { margin-top: 8px; font-size: 12px; color: var(--muted); }
.agent-details > summary { min-height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border: 1px solid var(--edge-green); border-radius: 8px; background: var(--card); font-weight: 650; cursor: pointer; list-style: none; }
.agent-details > summary::-webkit-details-marker { display: none; }
.agent-details > summary::after { content: ''; width: 8px; height: 8px; margin-left: 10px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .15s; }
.agent-details[open] > summary::after { transform: rotate(-135deg); }
.agent-details[open] > summary { margin-bottom: 12px; }
@media (min-width: 901px) { .agent-details > summary { display: none; } }

/* The save bar: on the page only while something changed */
.savebar { position: sticky; bottom: 0; z-index: 3; margin-top: 8px; padding: 12px 0; background: linear-gradient(to bottom, transparent, var(--paper) 30%); }
.savebar-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 12px 16px; border: 1px solid var(--edge); border-radius: 10px; background: var(--card); box-shadow: 0 6px 24px rgb(78 52 46 / .12); }
.savebar p { margin: 0; font-size: 14px; }
.savebar .field-error { margin-top: 4px; }
.savebar .button { width: auto; }

@media (max-width: 900px) {
  .profile-layout { grid-template-columns: 1fr; gap: 0; }
  .profile-layout > form, .profile-layout > .aside { grid-column: auto; grid-row: auto; }
  .aside { position: static; margin-bottom: 24px; }
  .aside .sees-card { padding: 0; border: 0; background: none; }
  .eyebrow { display: none; }
}
@media (max-width: 599px) {
  .grid-2 { grid-template-columns: 1fr; }
  .panel, .setup { padding: 18px; }
  .savebar-inner .button { flex: 1; }
}

/* Settings (/expert/settings): ordinary sections and compact rows */
#expert-root:has(.settings-section) { max-width: 720px; }
.settings-section { padding-block: 16px 8px; border-top: 1px solid var(--line); }
.settings-section > h2 { font-size: 20px; margin-bottom: 2px; }
.setting { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 24px; padding: 8px 0; border-top: 1px solid var(--line); line-height: 1.4; }
.settings-section > h2 + .setting { border-top: 0; }
.setting-main { flex: 1 1 320px; min-width: 0; }
.setting-main p { margin: 0; font-size: 13px; }
.setting-main strong, .setting-main label { display: block; margin: 0; font-size: 15px; font-weight: 650; }
.setting-main .setting-reason { margin-top: 4px; }
.setting-control { flex: 0 0 auto; }
.setting select { min-width: 220px; min-height: 44px; margin: 0; padding-block: 6px; }
.switch { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; margin: 0; font-size: 14px; font-weight: 400; cursor: pointer; }
.switch input { appearance: none; width: 44px; height: 26px; min-height: 0; margin: 0; padding: 0; flex: none; border: 0; border-radius: 999px; background: #8a7a6e; position: relative; cursor: pointer; transition: background .15s; }
.switch input::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--button-fill); }
.switch input:checked::after { transform: translateX(18px); }
.switch input:disabled { opacity: .55; cursor: not-allowed; }
.switch input:focus-visible { outline: 3px solid var(--link); outline-offset: 3px; }
#settings-view, .settings-section #deactivate-form { margin-top: 8px; }

/* Admin portal (/admin) */
#admin-root { max-width: 960px; }
select { display: block; width: 100%; min-height: 48px; padding: 10px 12px; margin-bottom: 16px; border: 1px solid var(--edge); border-radius: 6px; background: #fff; color: var(--brown); font: inherit; }
.filters { max-width: 520px; margin-bottom: 24px; }
.filters .button, .decision .button { width: auto; display: inline-flex; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.note { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }
.decision-box { margin: 0 0 20px; padding: 12px 14px; border: 1px solid var(--edge); border-radius: 6px; }
.decision-box h3 { margin: 0 0 8px; font-size: 18px; }
.decision { max-width: 560px; }
.decision-box .hint { margin: 0 0 12px; }
.inline-action { flex: 1 1 100%; }
.inline-action summary { display: inline-flex; align-items: center; min-height: 44px; color: var(--link); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.inline-action .hint { margin: 0 0 12px; }
.row-value { overflow-wrap: anywhere; }
#status:focus { outline: none; }
textarea[aria-invalid="true"] { border-color: var(--error); border-width: 2px; }

/* History (/expert/history and /expert/history/<session>, PRD-26 M26.5). Class names are the history's own; nothing above is changed. */
#expert-root:has(.hist-head), #expert-root:has(.hist-session) { max-width: none; }
.hist-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.hist-head h1, .hist-detail-head h1 { margin: 0; font-family: var(--serif); font-weight: 400; letter-spacing: -.03em; }
.hist-head h1 { font-size: clamp(30px, 4.4vw, 42px); line-height: 1.1; }
.hist-head p { margin: 4px 0 0; color: var(--muted); }
.hist-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: start; }
.hist-aside { position: sticky; top: 16px; }

/* Filters: a GET form and links */
.hist-tools { display: grid; grid-template-columns: minmax(0, 1fr) 190px 190px auto; gap: 8px; margin-bottom: 8px; }
.hist-tools label { position: relative; margin: 0; font-weight: 400; }
.hist-tools input[type="search"], .hist-tools select { min-height: 44px; margin: 0; padding: 6px 12px; }
.hist-tools input[type="search"] { padding-left: 38px; }
.hist-search::before, .hist-search::after { content: ''; position: absolute; pointer-events: none; }
.hist-search::before { left: 13px; top: 14px; width: 11px; height: 11px; border: 2px solid var(--brown); border-radius: 50%; }
.hist-search::after { left: 23px; top: 26px; width: 6px; height: 2px; background: var(--brown); transform: rotate(45deg); }
.hist-apply { width: auto; }
.hist-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.hist-filter { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 14px; border: 1px solid var(--edge); border-radius: 999px; color: var(--brown); font-size: 14px; text-decoration: none; }
.hist-filter:hover { border-color: var(--brown); }
.hist-filter small { margin-left: 6px; font-size: 12px; }
.hist-filter[aria-current] { border-color: var(--button-fill); background: var(--button-fill); color: #fff; font-weight: 650; }
.hist-meta-line { margin: 4px 0 0; padding-bottom: 6px; max-width: none; }
.hist-empty { max-width: 640px; }
.hist-empty h2 { margin-bottom: 8px; }
.hist-empty p:last-of-type { margin-bottom: 16px; }
.hist-empty .button { display: inline-flex; width: auto; }

/* The dense list: one row a session, the whole row is the link. Every column has a fixed width that fits the longest chip. */
.hist-month { position: sticky; top: 0; z-index: 1; margin: 0; padding: 8px 8px 6px; border-bottom: 1px solid var(--line); background: var(--paper); font: 650 12px/1.6 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.hist-rows { list-style: none; margin: 0 0 12px; padding: 0; }
.hist-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) 84px 152px 14px; align-items: center; gap: 0 12px; min-height: 44px; padding: 6px 8px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.hist-row:hover { background: var(--beige); }
.hist-row:focus-visible { outline-offset: -3px; }
.hist-row::after { content: ''; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-top: 2px solid var(--muted); transform: rotate(45deg); justify-self: end; }
.hist-date { font-size: 13px; color: var(--muted); white-space: nowrap; }
.hist-title { display: block; min-width: 0; overflow: hidden; font-size: 14.5px; font-weight: 600; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.hist-answers { font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap; }
.hist-status { display: flex; justify-content: flex-end; }
.hist-row .chip, .hist-meta .chip { min-height: 24px; padding-inline: 10px; font-size: 12px; white-space: nowrap; }
.hist-meta .chip { min-height: 26px; }

/* Pagination: twenty a page, with numbers */
.hist-pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; padding: 12px 0 4px; }
.hist-nums { display: flex; align-items: center; gap: 4px; }
.hist-step, .hist-num { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 12px; border: 1px solid var(--edge); border-radius: 6px; color: var(--brown); font-size: 14px; text-decoration: none; }
.hist-step { gap: 6px; }
a.hist-step:hover, a.hist-num:hover { border-color: var(--brown); }
.hist-num[aria-current] { border-color: var(--button-fill); background: var(--button-fill); color: #fff; font-weight: 650; }
.hist-step[aria-disabled] { opacity: .45; }
.hist-gap { padding: 0 2px; color: var(--muted); }
.hist-pgstatus { display: none; font-size: 13px; color: var(--muted); }

/* The ratings summary */
.hist-card { padding: 16px 18px; border: 1px solid var(--edge-green); border-radius: 10px; background: var(--card); }
.hist-card h2 { margin: 0 0 8px; font: 650 13px/1.3 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.hist-sum > summary { display: none; }
.hist-headline { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin: 0 0 2px; max-width: none; }
.hist-headline strong { font: 400 36px/1.1 var(--serif); letter-spacing: -.02em; white-space: nowrap; }
.hist-headline span { font-size: 14px; color: var(--muted); }
.hist-scope { margin: 0 0 4px; font-size: 12px; color: var(--muted); }
.hist-basis { margin: 0; font-size: 13px; line-height: 1.5; color: var(--muted); max-width: none; }
.hist-sub { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.hist-criterion { padding-top: 10px; }
.hist-criterion-head { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.hist-criterion-head .micro { margin: 0; color: var(--muted); }
.hist-bar { display: block; width: 100%; height: 10px; margin-top: 5px; border-radius: 5px; overflow: hidden; }
.hist-bar .bar-bg { fill: var(--beige); }
.hist-bar .met { fill: var(--button-fill); }
.hist-bar .not_met { fill: var(--error); }
.hist-bar .hatch-a { fill: var(--warn); }
.hist-bar .hatch-b { fill: #b98a3a; }
.hist-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 12px 0 0; padding: 0; list-style: none; font-size: 12px; color: var(--muted); }
.hist-legend li { display: inline-flex; align-items: center; gap: 6px; }
.hist-legend i { display: inline-block; width: 14px; height: 8px; border-radius: 2px; }
.hist-legend .met { background: var(--button-fill); }
.hist-legend .partially_met { background: repeating-linear-gradient(135deg, var(--warn) 0 3px, #b98a3a 3px 6px); }
.hist-legend .not_met { background: var(--error); }
.hist-trend-cols { display: flex; align-items: flex-end; gap: 4px; height: 96px; margin-top: 8px; }
.hist-trend-col { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: flex-end; min-width: 0; height: 100%; }
.hist-val { font-size: 10.5px; line-height: 1.2; color: var(--muted); }
.hist-col { display: block; width: 100%; max-width: 26px; border-radius: 3px 3px 0 0; overflow: hidden; }
.hist-col rect { fill: var(--button-fill); }
.hist-m { margin-top: 3px; font-size: 11px; color: var(--muted); text-transform: capitalize; }
.hist-how { margin-top: 8px; }
.hist-how summary { display: flex; align-items: center; min-height: 44px; color: var(--link); cursor: pointer; font-size: 14px; list-style: none; }
.hist-how summary::-webkit-details-marker { display: none; }
.hist-how summary::after { content: ''; width: 7px; height: 7px; margin-left: 10px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .15s; }
.hist-how[open] summary::after { transform: rotate(-135deg); }
.hist-how p { margin-bottom: 8px; font-size: 13px; line-height: 1.5; }

/* One session: a conversation that fills the useful height of the window, and only the conversation scrolls */
/* --hist-top is set by expert.js to where the session starts (the header wraps on a phone); 72px is the header of a wide screen */
.hist-session { display: flex; flex-direction: column; height: max(480px, calc(100dvh - var(--hist-top, 72px) - 20px)); }
.hist-crumbrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 16px; }
.hist-back { display: inline-flex; align-items: center; min-height: 44px; }
.hist-crumb, .hist-pager a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-size: 14px; }
.hist-pager { display: flex; gap: 0 20px; }
.hist-detail-head h1 { font-size: clamp(22px, 2.6vw, 28px); line-height: 1.15; letter-spacing: -.02em; }
.hist-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin: 6px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.hist-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 12px; margin-top: 8px; padding: 0 0 4px; border-bottom: 1px solid var(--line); background: var(--paper); }
.hist-toolbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; }
.hist-toolbar p { margin: 0; font-size: 13px; color: var(--muted); max-width: none; }
.hist-chipbtn { min-height: 44px; padding: 4px 12px; border: 1px solid var(--edge); border-radius: 999px; background: transparent; color: var(--brown); font-size: 13px; cursor: pointer; }
.hist-chipbtn:hover { border-color: var(--brown); }
.hist-chipbtn[aria-pressed="true"] { border-color: var(--button-fill); background: var(--button-fill); color: #fff; font-weight: 650; }
.hist-chat { position: relative; display: flex; flex-direction: column; flex: 0 1 auto; gap: 4px; min-height: 0; margin-top: 8px; padding: 14px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--edge); border-radius: 14px; background: var(--card); }
.hist-turn { display: flex; flex-direction: column; gap: 4px; }
.hist-turn + .hist-turn { margin-top: 10px; }
.hist-none { margin: 0; padding: 8px; font-size: 13px; color: var(--muted); }
.hist-msg { max-width: min(84%, 720px); margin: 0; padding: 7px 12px 6px; border-radius: 14px; font-size: 14px; line-height: 1.45; }
.hist-msg p { margin: 0; max-width: none; white-space: pre-line; overflow-wrap: anywhere; }
.hist-msg.q { align-self: flex-start; border-bottom-left-radius: 4px; background: var(--beige); }
.hist-msg.a { align-self: flex-end; border: 1px solid var(--ok-line); border-bottom-right-radius: 4px; background: var(--ok-bg); }
.hist-by { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); }
.hist-msg.a .hist-by { text-align: right; }
.hist-unavailable { color: var(--muted); font-style: italic; }
/* A long text is folded to a few lines by the script (it adds .hist-fold); without it the text is whole */
.hist-fold:not(.open) { display: -webkit-box; -webkit-line-clamp: 6; line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; }
.hist-fold[data-clamp="3"]:not(.open) { -webkit-line-clamp: 3; line-clamp: 3; }
.hist-fold.over:not(.open) { -webkit-mask-image: linear-gradient(#000 calc(100% - 1.6em), transparent); mask-image: linear-gradient(#000 calc(100% - 1.6em), transparent); }
.hist-more { display: block; min-height: 44px; margin: -10px 0 -12px; padding: 0; border: 0; background: none; color: var(--link); font-size: 12.5px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.hist-msg.a .hist-more { margin-left: auto; }
.hist-fbk { align-self: flex-end; max-width: min(84%, 720px); margin: 0 0 2px; padding: 6px 10px 8px; border: 1px solid var(--edge); border-radius: 10px; background: #fff; font-size: 13px; line-height: 1.45; }
.hist-fbk-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 12px; margin-bottom: 4px; font-size: 11px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.hist-fbk-head span:last-child { font-weight: 400; letter-spacing: 0; text-transform: none; }
.hist-pills { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; }
.hist-pill { display: inline-flex; align-items: center; gap: 5px; min-height: 24px; padding: 1px 9px 1px 4px; border: 1px solid var(--ok-line); border-radius: 999px; background: var(--ok-bg); font-size: 12px; white-space: nowrap; }
.hist-pill.partially_met { border-color: var(--edge-warn); background: var(--warn-bg); }
.hist-pill.not_met { border-color: var(--err-line); background: var(--err-bg); }
.hist-pill.not_assessed { border-color: var(--edge); background: transparent; color: var(--muted); }
.hist-level { opacity: .85; }
.hist-mark { display: inline-grid; flex: none; place-items: center; width: 16px; height: 16px; border-radius: 50%; color: #fff; font-size: 10px; font-weight: 700; line-height: 1; }
.hist-mark.met { background: var(--button-fill); }
.hist-mark.partially_met { background: var(--warn); }
.hist-mark.not_met { background: var(--error); }
.hist-mark.not_assessed { border: 1.5px solid var(--muted); background: transparent; color: var(--muted); }
.hist-note { margin: 6px 0 0; padding-left: 8px; border-left: 3px solid var(--line); font-size: 13px; line-height: 1.45; }
.hist-note p { margin: 0; max-width: none; white-space: pre-line; overflow-wrap: anywhere; }
.hist-note.withheld p { color: var(--muted); font-style: italic; white-space: normal; }
.hist-wait { align-self: flex-end; max-width: min(84%, 720px); margin: 0 0 2px; padding: 5px 10px; border: 1px dashed var(--edge); border-radius: 10px; font-size: 12.5px; color: var(--muted); }
.hist-wait.warn { border-color: var(--edge-warn); background: var(--warn-bg); color: #5c3b00; }

@media (max-width: 900px) {
  .hist-layout { grid-template-columns: 1fr; gap: 0; }
  .hist-aside { position: static; order: -1; margin-bottom: 16px; }
  .hist-sum > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 6px 16px; border: 1px solid var(--edge-green); border-radius: 10px; background: var(--card); cursor: pointer; list-style: none; }
  .hist-sum > summary::-webkit-details-marker { display: none; }
  .hist-sum > summary::after { content: ''; flex: none; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .15s; }
  .hist-sum[open] > summary::after { transform: rotate(-135deg); }
  .hist-sum[open] > summary { margin-bottom: 10px; }
  .hist-sum-title { font-weight: 650; }
  .hist-sum-sub { display: block; font-size: 13px; color: var(--muted); }
  .hist-card h2 { display: none; }
}
@media (max-width: 599px) {
  .hist-tools { grid-template-columns: 1fr 1fr; }
  .hist-search, .hist-apply { grid-column: 1 / -1; }
  .hist-row { grid-template-columns: auto minmax(0, 1fr) auto 14px; grid-template-areas: "date count status chev" "title title title chev"; gap: 2px 8px; padding-block: 8px; }
  .hist-date { grid-area: date; font-size: 12px; }
  .hist-answers { grid-area: count; text-align: left; }
  .hist-title { grid-area: title; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: normal; }
  .hist-status { grid-area: status; }
  .hist-row::after { grid-area: chev; }
  .hist-nums { display: none; }
  .hist-pgstatus { display: inline; }
  .hist-chat { padding: 10px; }
  .hist-msg, .hist-fbk, .hist-wait { max-width: 94%; }
}
