:root {
  --charcoal: #1f211f;
  --charcoal-2: #2a2c29;
  --cream: #f4efe4;
  --paper: #fbf8f1;
  --gold: #b89243;
  --gold-light: #d7bd79;
  --muted: #636359;
  --line: rgba(31, 33, 31, 0.16);
  --serif: Georgia, "Times New Roman", serif;
  --sans: system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #886726; outline-offset: 4px; }
a { color: inherit; }
.skip-link { position: fixed; top: -100px; left: 16px; background: var(--paper); padding: 12px; z-index: 10; }
.skip-link:focus { top: 8px; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--cream); color: var(--charcoal); font-family: var(--sans); line-height: 1.55; }
button, textarea, input, select { font: inherit; }
select { padding: 12px; width: 100%; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--charcoal); }
.crisis-resources { max-width: 900px; margin: -60px auto 60px; }
.site-header { min-height: 86px; display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; max-width: 1180px; margin: auto; padding: 20px 28px; }
.brand { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; }
.brand-mark { display: grid; flex-shrink: 0; place-items: center; width: 42px; height: 42px; background: var(--charcoal); color: var(--gold-light); border-radius: 50%; font: 700 21px var(--serif); }
.site-header > .button { flex-shrink: 0; white-space: nowrap; }
.brand strong { display: block; font: 700 14px var(--serif); letter-spacing: .03em; }
.brand small { display: block; color: var(--muted); font-size: 11px; }
.hero { min-height: 610px; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 80px 24px 100px; text-align: center; background: radial-gradient(circle at 50% 10%, rgba(184,146,67,.13), transparent 32%), var(--charcoal); color: var(--cream); border-radius: 0 0 48px 48px; }
.eyebrow { color: #806225; text-transform: uppercase; letter-spacing: .17em; font-size: 12px; font-weight: 600; }
.hero .eyebrow { color: var(--gold-light); }
h1, h2, h3 { font-family: var(--serif); }
h1 { max-width: 920px; margin: 22px auto 24px; font-size: clamp(42px, 7vw, 78px); line-height: 1.08; letter-spacing: -.04em; font-weight: 400; }
h1 em { color: var(--gold-light); }
.hero-copy { max-width: 690px; margin: 0 auto 30px; color: rgba(244,239,228,.78); font-size: 18px; }
.button { border: 1px solid transparent; border-radius: 999px; padding: 12px 20px; cursor: pointer; font-weight: 600; transition: transform .15s, background .15s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.button-primary { background: var(--gold); color: #171813; text-decoration: none; }
.button-primary:hover { background: var(--gold-light); }
.button-ghost { border-color: var(--line); background: transparent; color: inherit; }
.microcopy { color: #c6c2b7; font-size: 13px; margin-top: 15px; }
.principles { max-width: 1120px; margin: -35px auto 110px; padding: 0 24px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; position: relative; }
.principles article { padding: 34px; background: var(--paper); border: 1px solid var(--line); }
.principles article:first-child { border-radius: 16px 0 0 16px; }
.principles article:last-child { border-radius: 0 16px 16px 0; }
.principles span { color: #806225; font-size: 12px; letter-spacing: .13em; }
.principles h2 { font-size: 20px; margin: 14px 0 8px; }
.principles p { color: var(--muted); margin: 0; font-size: 14px; }
.assistant-shell { max-width: 900px; margin: 0 auto 110px; background: var(--paper); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 24px 60px rgba(31,33,31,.08); overflow: hidden; }
.assistant-header { background: var(--charcoal-2); color: var(--cream); padding: 18px 24px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; font-size: 13px; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #76aa7a; margin-right: 8px; }
.usage { color: var(--gold-light); }
.onboarding { padding: 58px 44px; text-align: center; }
.onboarding h2 { max-width: 580px; font-size: 32px; line-height: 1.3; margin: 12px auto; }
.onboarding p:not(.eyebrow) { max-width: 610px; color: var(--muted); margin: 0 auto 25px; }
.messages { min-height: 350px; max-height: 560px; overflow: auto; padding: 30px; display: flex; flex-direction: column; gap: 16px; }
.message { max-width: 82%; padding: 15px 17px; border-radius: 16px; white-space: pre-wrap; }
.assistant-message { background: #ece6d8; align-self: flex-start; }
.user-message { background: var(--charcoal); color: var(--cream); align-self: flex-end; }
.ask-form { border-top: 1px solid var(--line); padding: 18px; }
.ask-form textarea { width: 100%; border: 1px solid var(--line); padding: 12px; border-radius: 8px; resize: vertical; min-height: 105px; background: transparent; color: inherit; }
.ask-footer { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.trust-grid { max-width: 1120px; margin: 0 auto 90px; padding: 55px 24px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 42px; }
.trust-grid h2 { margin: 0; font-size: 30px; }
.trust-grid h3 { margin: 0 0 8px; font-size: 16px; }
.trust-grid p { color: var(--muted); margin: 0; font-size: 14px; }
footer { border-top: 1px solid var(--line); max-width: 1120px; margin: auto; padding: 28px 24px 44px; display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }
.text-button { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; }
.danger { color: #9f352f; margin-top: 22px; }
dialog { width: min(470px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); padding: 34px; color: var(--charcoal); box-shadow: 0 30px 100px rgba(0,0,0,.28); }
dialog::backdrop { background: rgba(20,21,19,.72); backdrop-filter: blur(3px); }
.dialog-close { position: absolute; top: 12px; right: 15px; border: 0; background: none; font-size: 25px; cursor: pointer; }
.dialog-tabs { display: flex; gap: 5px; margin-bottom: 28px; border-bottom: 1px solid var(--line); }
.tab { padding: 11px 8px; border: 0; background: none; color: var(--muted); cursor: pointer; }
.tab.active { color: var(--charcoal); border-bottom: 2px solid var(--gold); }
dialog h2 { margin-top: 0; }
dialog label { display: grid; gap: 6px; margin: 16px 0; font-size: 13px; font-weight: 600; }
dialog input { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.form-note { font-size: 12px; color: var(--muted); margin-top: -9px; }
.error { color: #9f352f; font-size: 13px; min-height: 20px; }
.full { width: 100%; }
.chat-note { margin: 0; padding: 16px 24px; font-size: 13px; border-bottom: 1px solid var(--line); }
.check-label { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; }
.check-label input { margin-top: 4px; width: 18px; height: 18px; flex-shrink: 0; }
.account-link { display: block; text-align: center; text-decoration: none; margin: 12px 0; }
.recovery-code { display: block; padding: 15px; background: #ece6d8; overflow-wrap: anywhere; margin: 20px 0; user-select: all; }
.verification { margin-top: 12px; min-height: 70px; }
.legal { max-width: 800px; margin: 50px auto; padding: 0 24px; }
.legal h1 { font-size: 42px; }
.legal h2 { font-size: 22px; margin-top: 30px; }
.legal table { width: 100%; border-collapse: collapse; font-size: 14px; }
.legal td, .legal th { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.message { overflow-wrap: anywhere; }
.answer-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 0 24px 16px; }
.answer-actions .form-note { margin: 0; }
.header-actions { display: flex; flex-wrap: wrap; gap: 6px; }
#history-dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; }
.history-entry { padding: 20px 0; border-top: 1px solid var(--line); }
.history-entry p { white-space: pre-wrap; overflow-wrap: anywhere; }
.consent-panel { padding: 24px; border-bottom: 1px solid var(--line); }
.consent-panel h2 { margin-top: 0; font-size: 26px; }
.consent-panel p { font-size: 14px; }
.consent-panel .check-label { margin: 24px 0 18px; }
.consent-panel .form-note { margin: 18px 0 8px; }
.consent-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.consent-actions a { text-decoration: none; text-align: center; }
.account-consent { padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.account-consent .form-note { margin-top: 0; }
.resource-nav { display: flex; flex-wrap: wrap; gap: 12px 20px; }
.resource-guide { padding: 8px 0 24px; border-bottom: 1px solid var(--line); scroll-margin-top: 20px; }
.resource-template { padding: 18px; background: var(--paper); border-left: 3px solid var(--gold); overflow-wrap: anywhere; }
.resource-guide li + li { margin-top: 10px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 760px) {
  .site-header { gap: 12px; padding: 18px; }
  dialog { padding: 28px 20px; max-height: calc(100dvh - 24px); overflow-y: auto; }
  .brand small { display: none; }
  .hero { min-height: 560px; border-radius: 0 0 28px 28px; }
  .principles { grid-template-columns: 1fr; margin-bottom: 75px; }
  .principles article:first-child { border-radius: 14px 14px 0 0; }
  .principles article:last-child { border-radius: 0 0 14px 14px; }
  .assistant-shell { margin: 0 16px 75px; }
  .onboarding { padding: 44px 22px; }
  .messages { padding: 20px; }
  .message { max-width: 94%; }
  .trust-grid { grid-template-columns: 1fr; gap: 28px; }
}
