:root {
  --ink: #163330;
  --muted: #627674;
  --paper: #fbfaf6;
  --white: #ffffff;
  --green: #17675f;
  --green-dark: #0f4944;
  --mint: #dcebe6;
  --line: #dce4e1;
  --warm: #f1e8d8;
  --danger: #9f2f32;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 80% 0%, #e7f0eb 0, transparent 36rem), var(--paper); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.shell { width: min(100% - 32px, 760px); margin: 0 auto; padding: 36px 0 56px; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 44px; }
.brand-mark { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--green); color: white; font-family: Georgia, serif; font-size: 20px; }
.brand h1, .admin-header h1 { margin: 2px 0 0; font-family: Georgia, 'Times New Roman', serif; font-weight: 500; font-size: 24px; }
.eyebrow { margin: 0; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.secure-pill { margin-left: auto; padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--green); font-size: 12px; font-weight: 700; }
.welcome { max-width: 650px; }
.kicker { color: var(--green); font-size: 14px; font-weight: 750; }
.welcome h2 { max-width: 610px; margin: 12px 0 20px; font-family: Georgia, 'Times New Roman', serif; font-size: clamp(38px, 7vw, 64px); font-weight: 500; line-height: .99; letter-spacing: -.035em; }
.intro { max-width: 600px; color: var(--muted); font-size: 18px; line-height: 1.65; }
.notice { display: grid; gap: 5px; margin: 28px 0 22px; padding: 18px 20px; border-left: 3px solid #c19a58; border-radius: 4px 14px 14px 4px; background: var(--warm); font-size: 14px; line-height: 1.5; }
.notice span { color: #685a45; }
.consent { display: flex; align-items: flex-start; gap: 12px; margin: 24px 0; cursor: pointer; line-height: 1.45; }
.consent input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--green); flex: none; }
.primary { border: 0; border-radius: 13px; padding: 15px 19px; background: var(--green); color: white; font-weight: 750; box-shadow: 0 8px 20px rgba(23,103,95,.18); }
.primary span { margin-left: 12px; }
.primary:hover { background: var(--green-dark); }
.primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.privacy-note, .chat-footnote, .record-time { color: var(--muted); font-size: 12px; }
.chat-panel { min-height: 70vh; border: 1px solid var(--line); border-radius: 24px; overflow: hidden; background: rgba(255,255,255,.82); box-shadow: 0 22px 55px rgba(36,65,61,.08); backdrop-filter: blur(12px); }
.progress-row { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.status-dot { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: #d2a144; box-shadow: 0 0 0 4px #f7edda; }
.status-dot.complete { background: #2b8e66; box-shadow: 0 0 0 4px #ddf2e8; }
.text-button { border: 0; background: none; color: var(--green); font-weight: 700; }
.messages { display: flex; flex-direction: column; gap: 17px; min-height: 380px; max-height: 56vh; padding: 26px 22px; overflow-y: auto; }
.message { display: flex; }
.message > div { max-width: 82%; padding: 13px 16px; border-radius: 7px 18px 18px 18px; background: var(--mint); line-height: 1.52; white-space: pre-wrap; }
.message a { color: var(--green-dark); font-weight: 750; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.message.user { justify-content: flex-end; }
.message.user > div { border-radius: 18px 7px 18px 18px; background: var(--green); color: white; }
.message.user a { color: white; }
.message.system > div, .message.urgent > div { background: #f8e4e3; color: var(--danger); }
.typing { display: flex; align-items: center; gap: 5px; padding: 0 24px 14px; color: var(--muted); font-size: 12px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: pulse 1s infinite alternate; }
.typing i:nth-child(2) { animation-delay: .15s; }.typing i:nth-child(3) { animation-delay: .3s; }.typing span { margin-left: 5px; }
@keyframes pulse { to { opacity: .25; transform: translateY(-2px); } }
.composer { display: flex; align-items: flex-end; gap: 10px; margin: 0 16px; padding: 10px; border: 1px solid var(--line); border-radius: 18px; background: white; }
.composer textarea { width: 100%; min-height: 42px; max-height: 140px; padding: 10px 8px; resize: none; border: 0; outline: none; color: var(--ink); background: transparent; line-height: 1.4; }
.composer button { flex: none; width: 42px; height: 42px; border: 0; border-radius: 13px; background: var(--green); color: white; font-size: 22px; }
.composer button:disabled { opacity: .5; }
.chat-footnote { margin: 12px 22px 18px; text-align: center; }
.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; }

.admin-body { background: #f4f6f4; }
.login-card { width: min(100% - 32px, 430px); margin: 12vh auto; padding: 34px; border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: 0 20px 60px rgba(25,55,51,.1); }
.login-card h1 { font-family: Georgia, serif; font-weight: 500; font-size: 32px; }
.login-card .brand-mark { margin-bottom: 24px; }
.login-form { display: grid; gap: 10px; margin-top: 24px; }
.login-form label { font-size: 13px; font-weight: 750; }
.login-form input { width: 100%; padding: 13px; border: 1px solid var(--line); border-radius: 10px; }
.login-form button { margin-top: 8px; }
.form-error { padding: 12px; border-radius: 10px; background: #f8e4e3; color: var(--danger); }
.admin-header { display: flex; justify-content: space-between; align-items: center; padding: 24px clamp(18px,4vw,54px); border-bottom: 1px solid var(--line); background: white; }
.admin-alert { margin: 18px clamp(18px,4vw,54px) 0; padding: 12px 15px; border-radius: 10px; font-size: 14px; }
.admin-alert.success { background: #ddf2e8; color: #216849; }
.admin-alert.error { background: #f8e4e3; color: var(--danger); }
.secondary { padding: 9px 13px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ink); }
.admin-layout { display: grid; grid-template-columns: minmax(310px, .8fr) minmax(460px, 1.4fr); gap: 20px; padding: 24px clamp(18px,4vw,54px); }
.intake-list, .summary-card { border: 1px solid var(--line); border-radius: 16px; background: white; overflow: hidden; }
.intake-list { align-self: start; max-height: calc(100vh - 130px); overflow-y: auto; }
.bulk-actions { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px; padding: 13px 15px; border-bottom: 1px solid var(--line); background: #f8faf8; color: var(--muted); font-size: 12px; }
.bulk-actions label { display: flex; align-items: center; gap: 7px; font-weight: 750; color: var(--ink); cursor: pointer; }
.bulk-actions input, .record-selector input { width: 17px; height: 17px; accent-color: var(--green); }
.bulk-actions #selectedCount { margin-left: auto; }
.delete-button { padding: 7px 10px; border: 1px solid #d9aaaa; border-radius: 8px; background: white; color: var(--danger); font-size: 12px; font-weight: 750; }
.delete-button:hover:not(:disabled) { background: #f8e4e3; }
.delete-button:disabled { opacity: .45; cursor: not-allowed; }
.intake-row { display: flex; align-items: stretch; border-bottom: 1px solid #edf0ee; color: inherit; }
.intake-row:hover, .intake-row.selected { background: #f0f7f4; }
.record-selector { display: grid; place-items: center; padding: 17px 4px 17px 15px; cursor: pointer; }
.intake-link { display: grid; flex: 1; justify-items: center; align-content: center; gap: 6px; min-width: 0; padding: 17px 15px 17px 10px; color: inherit; text-align: center; text-decoration: none; }
.intake-link > div { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; }
.intake-row span, .intake-row time { color: var(--muted); font-size: 12px; }
.status { display: inline-flex; width: fit-content; padding: 4px 7px; border-radius: 999px; background: #f5ead4; color: #78591d !important; font-size: 11px !important; font-weight: 750; text-transform: capitalize; }
.status.complete { background: #ddf2e8; color: #216849 !important; }
.summary-card { min-height: 500px; padding: 28px; }
.summary-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; padding-bottom: 23px; border-bottom: 1px solid var(--line); }
.summary-heading h2 { margin: 5px 0 0; font-family: Georgia, serif; font-size: 34px; font-weight: 500; }
.summary-actions { display: flex; align-items: center; gap: 10px; }
.copy-summary-button { white-space: nowrap; }
.copy-summary-button.copy-failed { border-color: #d9aaaa; color: var(--danger); }
.clinical-summary { margin: 0; }
.clinical-summary div { display: grid; grid-template-columns: 150px 1fr; gap: 20px; padding: 18px 0; border-bottom: 1px solid #edf0ee; }
.clinical-summary dt { color: var(--muted); font-size: 13px; font-weight: 750; }
.clinical-summary dd { margin: 0; line-height: 1.5; }
.transcript { margin-top: 24px; padding: 16px; border-radius: 12px; background: #f5f7f5; }
.transcript summary { cursor: pointer; color: var(--green); font-weight: 750; }
.transcript p { line-height: 1.5; }
.empty-state { display: grid; place-items: center; gap: 8px; min-height: 240px; padding: 30px; color: var(--muted); text-align: center; }

@media (max-width: 760px) {
  .shell { width: min(100% - 22px, 760px); padding-top: 20px; }
  .brand { margin-bottom: 30px; }
  .welcome h2 { font-size: 43px; }
  .chat-panel { border-radius: 18px; }
  .messages { min-height: 52vh; padding-inline: 14px; }
  .message > div { max-width: 91%; }
  .admin-layout { grid-template-columns: 1fr; }
  .intake-list { max-height: 360px; }
  .bulk-actions { flex-wrap: wrap; }
  .bulk-actions #selectedCount { margin-left: 0; }
  .delete-button { margin-left: auto; }
  .summary-heading { align-items: stretch; flex-direction: column; }
  .summary-actions { justify-content: space-between; }
  .clinical-summary div { grid-template-columns: 1fr; gap: 7px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; } }
