:root {
  --paper: #f6f4ec;
  --white: #fffdf8;
  --ink: #192b26;
  --muted: #52625b;
  --line: #d9d9c9;
  --rail: #1c332b;
  --rail-text: #f3f7ee;
  --lime: #e4e8c3;
  --amber: #f3dca3;
  --focus: #956017;
  --body: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --heading: Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.55 var(--body); }
button, textarea, input, select { font: inherit; }
a { color: inherit; text-underline-offset: .18em; }
a:hover { text-decoration-thickness: .13em; }
button { cursor: pointer; }
h1, h2, h3, p, dl { margin: 0; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.skip { position: fixed; inset: -5rem auto auto .75rem; z-index: 10; background: var(--white); padding: 10px 16px; }
.skip:focus { top: .6rem; }
.layout { min-height: 100vh; display: grid; grid-template-columns: 14rem minmax(0, 1fr); }
.rail { display: flex; flex-direction: column; gap: 34px; align-content: start; padding: 30px 18px; background: var(--rail); color: var(--rail-text); }
.rail nav { display: grid; gap: 4px; }
.rail nav a { min-height: 44px; display: flex; align-items: center; padding: 7px 12px; border-radius: 5px; text-decoration: none; white-space: nowrap; }
.rail nav a:hover, .rail nav a[aria-current] { background: #344d41; }
.rail nav a[aria-current] { color: #fff; font-weight: 700; border-inline-start: 3px solid var(--amber); padding-inline-start: 9px; }
.rail :focus-visible { outline-color: var(--amber); }
.rail form { margin-top: auto; }
.brand { display: inline-flex; gap: 12px; align-items: center; width: fit-content; font-weight: 720; font-size: 1.3rem; line-height: 1.2; text-decoration: none; }
.brand small { display: block; color: inherit; opacity: .85; margin-top: 4px; font-size: .8rem; font-weight: 500; }
.mark { display: grid; place-content: center; height: 44px; width: 46px; font-size: .95rem; color: var(--rail); background: var(--amber); border-radius: 6px; }
.signout { min-height: 44px; background: transparent; color: inherit; text-decoration: underline; text-underline-offset: .18em; padding: 6px 12px; border: 0; }
.workspace { width: min(100%, 76rem); margin-inline: auto; padding: clamp(24px, 5vw, 68px) clamp(16px, 5vw, 68px) 70px; }
.heading { margin: 0 0 clamp(19px, 3vw, 32px); }
.heading > a { display: inline-block; margin: 0 0 .5rem; font-weight: 650; }
.heading h1, .signin-card h1 { font: 700 clamp(2.05rem, 5vw, 4rem)/1.03 var(--heading); overflow-wrap: anywhere; }
.heading p, .signin-card p { margin-top: 10px; color: var(--muted); }
.search-panel { background: var(--lime); padding: clamp(17px, 3vw, 27px); border: 1px solid #c6cd9e; border-radius: 9px; margin-bottom: 24px; }
.search-form { display: grid; align-items: end; gap: 12px; grid-template-columns: minmax(0, 1fr) minmax(10rem, max-content) auto; }
label { display: grid; gap: 5px; font-weight: 650; font-size: .89rem; min-width: 0; }
input, select, textarea { width: 100%; padding: 9px 11px; min-height: 44px; border-radius: 5px; border: 1px solid #abb5a7; background: var(--white); color: var(--ink); font-weight: 450; font-size: 1rem; }
textarea { resize: vertical; }
.button { display: inline-flex; justify-content: center; align-items: center; width: fit-content; min-height: 44px; border: 1px solid var(--rail); border-radius: 5px; padding: 7px 16px; background: var(--rail); color: var(--rail-text); text-decoration: none; font-weight: 650; white-space: nowrap; }
.button:hover:enabled, a.button:hover { background: #314d40; }
.secondary { background: var(--white); color: var(--ink); border-color: #aab4a6; }
a.secondary:hover, .secondary:hover:enabled { background: var(--lime); }
.compact { font-size: .875rem; }
.panel { min-width: 0; background: var(--white); border: 1px solid var(--line); border-radius: 9px; }
.panel h2 { font: 700 1.46rem/1.2 var(--heading); }
.dashboard-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 18px; }
.coverage, .ask, .form-panel { padding: clamp(16px, 3vw, 25px); }
.panel-heading { display: flex; gap: 8px 18px; align-items: baseline; flex-wrap: wrap; justify-content: space-between; }
.panel-heading > a { font-size: .875rem; font-weight: 650; }
.coverage dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; margin: 17px 0; border-block: 1px solid var(--line); }
.coverage dl div { display: flex; flex-direction: column; padding: 10px 0; }
.coverage dt { color: var(--muted); font-size: .83rem; }
.coverage dd { order: -1; font-size: clamp(1.25rem, 3vw, 1.85rem); font-weight: 720; margin: 0; font-variant-numeric: tabular-nums; }
.quiet, .path { color: var(--muted); }
.quiet, .small { font-size: .87rem; }
.ask { background: var(--ink); border-color: var(--ink); color: var(--rail-text); }
.ask p, .form-panel > p { margin: .7rem 0 1rem; }
.connections { margin-top: 20px; display: grid; grid-template-columns: 1fr 1fr; }
.connections a { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: baseline; min-width: 0; gap: 3px 12px; text-decoration: none; padding: 12px 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.connections a + a { border-inline-start: 1px solid var(--line); }
.connections a:hover strong { text-decoration: underline; }
.connections span { color: var(--muted); font-size: .87rem; }
.matches { margin-bottom: 17px; }
.matches .panel-heading, .row { padding: 14px clamp(14px, 3vw, 22px); }
.matches .panel-heading { background: #edeee2; border-radius: 9px 9px 0 0; }
.match-list, .turns { list-style: none; padding: 0; margin: 0; }
.row + .row { border-top: 1px solid var(--line); }
.row h3 { font-size: 1.03rem; line-height: 1.4; overflow-wrap: anywhere; }
.result-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 5px 12px; }
.result-heading > div { flex: 1 1 18rem; min-width: 0; }
.path { font-size: .87rem; display: block; white-space: pre-wrap; overflow-wrap: anywhere; }
.excerpt { margin-top: 9px; border-left: 2px solid var(--line); padding-left: 10px; font-size: .93rem; }
.notice { padding: 12px 15px; margin-bottom: 15px; border-radius: 5px; background: var(--amber); color: #3e2a12; }
.form-panel { margin-top: 16px; max-width: 52rem; }
.form-panel h2 { margin-bottom: 13px; }
.stack { display: grid; gap: 12px; }
.note-text, .message { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-grid { display: grid; grid-template-columns: minmax(11rem, 1fr) minmax(0, 3fr); gap: 16px; align-items: start; }
.threads, .dialogue { padding: clamp(12px, 3vw, 20px); }
.threads nav { display: grid; gap: 3px; margin-top: 12px; }
.threads nav a { padding: 8px; border-radius: 4px; overflow-wrap: anywhere; }
.threads nav [aria-current] { background: var(--lime); font-weight: 650; }
.turn { border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 16px; }
.speaker { font-weight: 700; font-size: .87rem; }
.message { margin: 5px 0 11px; }
.user-message { background: #edeee2; border-radius: 5px; padding: 10px 12px; }
.references { font-size: .9rem; }
.references li { margin: 6px 0; }
.signin { min-height: 100vh; display: grid; align-items: center; justify-items: center; padding: 18px; }
.signin-card { max-width: 41rem; width: 100%; border: 1px solid var(--line); border-top: 7px solid var(--rail); border-radius: 9px; background: var(--white); padding: clamp(20px, 7vw, 62px); }
.brand--signin { margin-bottom: 28px; }
.signin-card h1 { font-size: clamp(2.15rem, 6vw, 3.5rem); }
.signin-card p { margin-bottom: 22px; }

@media (max-width: 920px) {
  .layout { display: block; }
  .rail { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 9px 16px; }
  .rail nav { display: flex; flex-wrap: wrap; order: 3; flex: 1 0 100%; }
  .rail nav a { padding-inline: 9px; }
  .rail nav a[aria-current] { padding-inline-start: 6px; }
  .rail form { margin: 0; }
}

@media (max-width: 600px) {
  .search-form { grid-template-columns: minmax(0, 1fr) auto; }
  .search-form label:first-child { grid-column: 1 / -1; }
  .dashboard-grid, .chat-grid { grid-template-columns: minmax(0, 1fr); }
  .connections a { align-content: start; }
  .coverage dl { gap: 7px; }
}
