:root {
  color-scheme: light;
  --paper: #f5f3ed;
  --paper-bright: #fcfbf8;
  --ink: #202a28;
  --muted: #69726e;
  --line: #d9d8cf;
  --green: #153f37;
  --green-soft: #e5ece8;
  --copper: #a9674c;
  --warning: #8a5a27;
  --shadow: 0 22px 70px rgba(24, 43, 37, .09);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-size: 15px; line-height: 1.55; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.eyebrow { margin: 0 0 10px; color: var(--green); font-size: 10px; font-weight: 700; letter-spacing: .17em; line-height: 1.4; }
.muted { color: var(--muted); }
em { font-family: "Source Serif 4", Georgia, serif; font-weight: 400; }

/* Logotype and folio motif */
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--green); }
.brand-word { font-size: 12px; letter-spacing: .13em; font-weight: 500; }
.brand-word strong { font-weight: 800; }
.brand-mark { width: 25px; height: 27px; display: flex; flex-direction: column; justify-content: center; gap: 3px; padding: 4px; border: 1px solid currentColor; position: relative; }
.brand-mark i { height: 2px; display: block; background: currentColor; }
.brand-mark i:nth-child(2) { width: 75%; }
.brand-mark i:nth-child(3) { width: 48%; }
.folio-rule { width: 34px; height: 1px; display: inline-block; background: var(--copper); }

/* Passwordless access */
.login-page { min-height: 100vh; background: var(--paper-bright); }
.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(330px, .92fr) minmax(420px, 1.08fr); }
.login-intro { position: relative; overflow: hidden; min-height: 100vh; padding: 44px clamp(32px, 6vw, 92px); color: #f4f1e8; background: var(--green); display: flex; flex-direction: column; justify-content: space-between; }
.login-intro .brand { color: #f4f1e8; position: relative; z-index: 1; }
.intro-copy { max-width: 450px; position: relative; z-index: 1; margin: 9vh 0 12vh; }
.intro-copy .eyebrow { color: #c7d5ce; }
.intro-copy h1 { margin: 18px 0 20px; font-size: clamp(42px, 5vw, 76px); line-height: .98; letter-spacing: -.045em; font-weight: 500; }
.intro-copy h1 em { color: #d4b49f; }
.intro-copy > p:last-child { max-width: 370px; margin: 0; color: #d9e2dd; font-size: 15px; }
.folio-note { display: flex; align-items: center; gap: 12px; color: #cbd7d1; font-size: 9px; letter-spacing: .15em; position: relative; z-index: 1; }
.folio-note .folio-rule { background: #d4b49f; }
.intro-watermark { position: absolute; right: -30px; bottom: 7%; color: rgba(255,255,255,.035); font-family: Georgia, serif; font-size: clamp(170px, 30vw, 410px); line-height: .8; letter-spacing: -.11em; pointer-events: none; }
.login-main { padding: 48px clamp(28px, 7vw, 100px) 25px; display: flex; flex-direction: column; justify-content: center; min-height: 100vh; }
.login-card { width: min(100%, 440px); margin: auto; }
.section-index { display: flex; align-items: center; gap: 11px; margin-bottom: 52px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .17em; }
.section-index > span:first-child { color: var(--copper); }
.index-line { width: 36px; height: 1px; background: var(--line); }
.login-card h2 { margin: 0 0 10px; font-family: "Source Serif 4", Georgia, serif; font-size: 34px; line-height: 1.15; font-weight: 500; letter-spacing: -.02em; }
.login-card > .muted { margin: 0 0 30px; max-width: 390px; font-size: 14px; }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form label { font-size: 12px; font-weight: 650; }
.auth-form input { width: 100%; min-height: 49px; padding: 12px 14px; color: var(--ink); border: 1px solid #cfd2cb; border-radius: 2px; outline: none; background: #fff; transition: border-color .16s ease, box-shadow .16s ease; }
.auth-form input:focus, textarea:focus, .filter-row input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(21, 63, 55, .09); }
#otp-code { max-width: 220px; text-align: center; font-family: "IBM Plex Sans", sans-serif; font-size: 24px; letter-spacing: .28em; }
.button { min-height: 46px; border: 1px solid transparent; border-radius: 2px; display: inline-flex; align-items: center; justify-content: center; gap: 18px; padding: 0 18px; font-size: 12px; font-weight: 700; transition: background .16s ease, transform .16s ease, border-color .16s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { margin-top: 8px; color: white; background: var(--green); }
.button-primary:hover { background: #0f322c; }
.button-secondary { color: var(--green); background: transparent; border-color: #aeb9b2; }
.button-secondary:hover { background: var(--green-soft); }
.text-button { align-self: flex-start; padding: 4px 0; border: 0; background: transparent; color: var(--green); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.form-message { min-height: 23px; margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.form-message.error { color: #9b3c31; }
.form-message.success { color: var(--green); }
.setup-alert { padding: 13px 14px; margin: 18px 0; border-left: 2px solid var(--copper); background: #f2eee7; color: #5f4a3f; font-size: 12px; line-height: 1.55; }
.privacy-note { display: flex; align-items: flex-start; gap: 11px; padding-top: 18px; margin-top: 26px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.lock-icon { color: var(--green); font-size: 18px; line-height: 1; }
.login-footer { width: min(100%, 440px); margin: 40px auto 0; display: flex; justify-content: space-between; gap: 15px; color: #8b928d; font-size: 8px; letter-spacing: .12em; }

/* Private archive interface */
.archive-page { min-height: 100vh; background: var(--paper); }
.topbar { min-height: 67px; padding: 0 34px; display: flex; justify-content: space-between; align-items: center; background: var(--paper-bright); border-bottom: 1px solid var(--line); }
.brand-compact .brand-mark { width: 23px; height: 24px; }
.topbar-right { display: flex; align-items: center; gap: 18px; color: var(--muted); font-size: 11px; }
.access-badge { display: inline-flex; align-items: center; gap: 7px; color: var(--green); font-size: 9px; letter-spacing: .12em; font-weight: 700; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--copper); }
.user-email { padding-left: 18px; border-left: 1px solid var(--line); }
.logout-button { padding: 5px 0 5px 18px; color: var(--green); border: 0; border-left: 1px solid var(--line); background: transparent; font-size: 11px; }
.archive-layout { min-height: calc(100vh - 67px); display: grid; grid-template-columns: 230px minmax(0, 1fr); }
.sidebar { padding: 33px 20px 24px 30px; background: #efeee7; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; }
.sidebar-heading .eyebrow { margin: 0; }
.folio-number { color: #8b928d; font-size: 9px; letter-spacing: .1em; }
.side-nav { display: flex; flex-direction: column; gap: 5px; margin-top: 35px; }
.side-link { display: flex; align-items: center; gap: 11px; padding: 11px 10px; color: #626c67; border-left: 2px solid transparent; text-decoration: none; font-size: 12px; }
.side-link.active { color: var(--green); background: rgba(255,255,255,.52); border-left-color: var(--copper); font-weight: 700; }
.nav-icon { width: 17px; color: var(--green); text-align: center; font-size: 18px; }
.sidebar-bottom { margin-top: auto; position: relative; min-height: 230px; padding-top: 20px; }
.side-rule { height: 1px; margin-bottom: 23px; background: var(--line); }
.sidebar-copy { max-width: 170px; margin: 0; color: var(--muted); font-family: "Source Serif 4", Georgia, serif; font-size: 15px; line-height: 1.45; }
.sidebar-seal { position: absolute; right: 8px; bottom: 2px; width: 52px; height: 52px; border: 1px solid #a7b4ac; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--green); font-family: Georgia, serif; font-size: 12px; line-height: .9; transform: rotate(-9deg); }
.sidebar-seal small { margin-top: 5px; font-family: sans-serif; font-size: 5px; letter-spacing: .15em; }
.content-area { width: min(100%, 1260px); padding: 43px clamp(26px, 5vw, 72px) 24px; margin: 0 auto; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 31px; }
.page-heading h1 { margin: 0; font-size: clamp(34px, 4vw, 53px); font-weight: 500; line-height: 1.02; letter-spacing: -.04em; }
.page-heading h1 em { color: var(--green); }
.heading-meta { display: flex; align-items: center; gap: 12px; padding-bottom: 6px; color: var(--muted); font-size: 8px; font-weight: 700; line-height: 1.7; letter-spacing: .14em; }
.search-panel { padding: 19px 22px 18px; background: var(--paper-bright); border: 1px solid var(--line); box-shadow: 0 5px 18px rgba(22,42,36,.03); }
.panel-topline { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 13px; }
.panel-label { color: var(--green); font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.panel-hint { color: #8a928d; font-size: 10px; }
#question { width: 100%; min-height: 86px; resize: vertical; padding: 14px 15px; border: 1px solid #d4d5ce; border-radius: 2px; outline: none; color: var(--ink); background: white; font-family: "Source Serif 4", Georgia, serif; font-size: 17px; line-height: 1.5; }
#question::placeholder { color: #9ca29d; }
.filter-row { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.filter-row label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 10px; }
.filter-row input { min-height: 35px; width: 150px; padding: 6px 9px; color: var(--ink); border: 1px solid #d4d5ce; border-radius: 2px; outline: none; background: white; font-size: 11px; }
.filter-row label:last-of-type input { width: 125px; }
.search-actions { display: flex; gap: 8px; margin-left: auto; }
.search-actions .button { min-height: 37px; padding: 0 13px; font-size: 10px; }
.status-strip { display: flex; align-items: center; gap: 13px; margin: 20px 0 34px; padding: 13px 15px; border: 1px solid #deded5; background: rgba(255,255,255,.46); }
.status-mark { width: 22px; height: 22px; flex: 0 0 22px; border: 1px solid #9daea4; border-radius: 50%; color: var(--green); display: grid; place-items: center; font-family: Georgia, serif; font-size: 14px; }
.status-text { display: flex; flex-direction: column; line-height: 1.45; }
.status-text strong { color: var(--ink); font-size: 11px; }
.status-text span { color: var(--muted); font-size: 10px; }
.status-counts { margin-left: auto; color: var(--green); font-size: 10px; font-weight: 700; white-space: nowrap; }
.answer-section, .results-section { margin: 30px 0; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 14px; padding-bottom: 11px; border-bottom: 1px solid var(--line); }
.section-heading .eyebrow { margin-bottom: 4px; }
.section-heading h2 { margin: 0; font-family: "Source Serif 4", Georgia, serif; font-size: 25px; font-weight: 500; }
.answer-mark { color: #a1aaa3; font-family: Georgia, serif; font-size: 16px; letter-spacing: .16em; }
.answer-text { padding: 19px 21px; border-left: 3px solid var(--green); background: var(--paper-bright); white-space: pre-wrap; font-family: "Source Serif 4", Georgia, serif; font-size: 16px; line-height: 1.7; }
.coverage-note { margin: 9px 0 0; color: var(--muted); font-size: 10px; }
.result-count { color: var(--muted); font-size: 10px; }
.source-list { display: flex; flex-direction: column; gap: 9px; }
.source-card { padding: 16px 18px; background: var(--paper-bright); border: 1px solid var(--line); border-left: 2px solid #9baea3; }
.source-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 12px; margin-bottom: 9px; color: var(--green); font-size: 10px; font-weight: 700; }
.source-tag { display: inline-block; padding: 2px 6px; color: var(--green); background: var(--green-soft); font-size: 9px; letter-spacing: .06em; }
.source-title { color: var(--ink); font-family: "Source Serif 4", Georgia, serif; font-size: 16px; }
.source-excerpt { margin: 9px 0 0; color: #454e4a; font-family: "Source Serif 4", Georgia, serif; font-size: 14px; line-height: 1.65; white-space: pre-wrap; }
.source-link { display: inline-block; margin-top: 10px; color: var(--green); font-size: 10px; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.source-state { color: var(--warning); font-size: 9px; font-weight: 600; }
.content-footer { display: flex; justify-content: space-between; gap: 18px; margin-top: 44px; padding-top: 13px; border-top: 1px solid var(--line); color: #858d88; font-size: 9px; }

@media (max-width: 900px) {
  .login-layout { grid-template-columns: minmax(280px, .8fr) minmax(380px, 1.2fr); }
  .login-intro { padding-left: 38px; padding-right: 38px; }
  .archive-layout { grid-template-columns: 185px minmax(0, 1fr); }
  .sidebar { padding-left: 18px; padding-right: 14px; }
  .user-email { display: none; }
}
@media (max-width: 680px) {
  .login-layout { display: block; }
  .login-intro { min-height: 250px; padding: 24px 25px; }
  .intro-copy { margin: 35px 0 30px; }
  .intro-copy h1 { font-size: 44px; }
  .intro-copy > p:last-child { font-size: 13px; }
  .folio-note { font-size: 8px; }
  .login-main { min-height: auto; padding: 38px 25px 22px; }
  .section-index { margin-bottom: 30px; }
  .login-footer { margin-top: 33px; font-size: 7px; }
  .topbar { min-height: 58px; padding: 0 16px; }
  .topbar-right { gap: 10px; }
  .access-badge { font-size: 7px; }
  .logout-button { padding-left: 10px; }
  .archive-layout { display: block; }
  .sidebar { display: none; }
  .content-area { padding: 30px 16px 18px; }
  .page-heading { align-items: flex-start; margin-bottom: 23px; }
  .page-heading h1 { font-size: 39px; }
  .heading-meta { display: none; }
  .search-panel { padding: 15px 13px; }
  .panel-hint { max-width: 150px; text-align: right; }
  .filter-row { align-items: stretch; }
  .filter-row label { flex: 1 1 42%; }
  .filter-row input, .filter-row label:last-of-type input { width: 100%; }
  .search-actions { width: 100%; margin-left: 0; }
  .search-actions .button { flex: 1; }
  .status-strip { align-items: flex-start; }
  .status-counts { white-space: normal; text-align: right; }
  .content-footer { flex-direction: column; gap: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
