/* OUTREACH TABLE — mobile-first, big targets, the CSM Kalender palette */
:root {
  --paper: #f7f4ee; --card: #fffdf9; --ink: #1f2430; --ink-soft: #5f6472; --ink-faint: #9a9ca6;
  --line: #e4ded2; --accent: #8a2e3b; --accent-soft: #f5e8e6; --accent-ink: #fff8f4; --ok: #2f6b45;
  --radius: 14px;
  --font-display: "Newsreader", Georgia, serif;
  --font-ui: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16181d; --card: #1f2229; --ink: #ecebe7; --ink-soft: #a9abb3; --ink-faint: #6f727c;
    --line: #2e323b; --accent: #d9737f; --accent-soft: #3a2327; --accent-ink: #1a0f11; --ok: #7cc79a;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font-ui); font-size: 17px; line-height: 1.4;
  color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }
input, textarea {
  font: inherit; font-size: 17px; /* >=16px: no iOS zoom on focus */
  width: 100%; padding: 13px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--ink); outline: none;
}
input:focus, textarea:focus { border-color: var(--accent); }
label { display: block; font-size: 14px; font-weight: 600; color: var(--ink-soft); margin-bottom: 14px; }
label input, label textarea { margin-top: 6px; }
.primary {
  width: 100%; min-height: 54px; border: 0; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 18px;
}
.primary:disabled { opacity: .55; }
.ghost { min-height: 54px; padding: 0 18px; border: 1.5px solid var(--line); border-radius: 12px; background: transparent; color: var(--ink-soft); font-weight: 600; }
.err { color: var(--accent); font-weight: 600; margin: 0 0 12px; }
.hint { font-size: 13.5px; color: var(--ink-faint); margin: 8px 2px 0; }

/* setup */
.screen { max-width: 460px; margin: 0 auto; padding: calc(40px + env(safe-area-inset-top)) 16px 32px; }
.screen h1 { font-family: var(--font-display); font-weight: 500; font-size: 34px; margin: 0 0 6px; }
.lede { color: var(--ink-soft); margin: 0 0 28px; }

/* app shell */
#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--paper); border-bottom: 1px solid var(--line);
}
.tabs { display: flex; flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.tabs button { flex: 1; min-height: 42px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-soft); font-weight: 600; }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.me {
  max-width: 38%; min-height: 50px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--ink); font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tab { flex: 1; display: flex; flex-direction: column; padding: 16px; }

/* chat */
#tab-chat { padding-bottom: 0; }
#msgs { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; padding: 11px 14px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--ink); color: var(--paper); border-bottom-right-radius: 5px; }
.msg.bot { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.msg.saved { border-color: var(--ok); color: var(--ok); font-weight: 600; }
.msg.typing { color: var(--ink-faint); letter-spacing: .2em; animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .4; } }

#draft { margin-top: 12px; padding: 12px; border: 1.5px solid var(--accent); border-radius: var(--radius); background: var(--accent-soft); }
.person { background: var(--card); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.person .who { font-weight: 700; font-size: 18px; }
.person dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 6px 0 0; font-size: 14.5px; }
.person dt { color: var(--ink-faint); }
.person dd { margin: 0; overflow-wrap: anywhere; }
.draft-actions { display: flex; gap: 8px; margin-top: 4px; }

#chat-form {
  position: sticky; bottom: 0; display: flex; gap: 8px; align-items: flex-end;
  margin: 12px -16px 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--paper); border-top: 1px solid var(--line);
}
#chat-input { resize: none; max-height: 40dvh; min-height: 52px; }
#chat-form button {
  flex: none; width: 52px; height: 52px; border: 0; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink); display: grid; place-items: center;
}
#chat-form button svg { width: 22px; height: 22px; }

#toast {
  position: fixed; left: 16px; right: 16px; top: calc(80px + env(safe-area-inset-top)); z-index: 5;
  max-width: 420px; margin: 0 auto; padding: 14px 16px; border-radius: 12px;
  background: var(--ink); color: var(--paper); font-weight: 600; text-align: center;
}
#toast.bad { background: var(--accent); color: var(--accent-ink); }
