:root {
  --bg: #faf8f5;
  --panel: #ffffff;
  --ink: #1a1a1a;
  --ink-2: #555;
  --ink-3: #8a8a8a;
  --line: #e5e0d8;
  --line-2: #d4cdc0;
  --accent: #c59a2a;
  --primary: #2a5a8a;
  --primary-soft: #e6eef8;
  --rachel: #b04a3b;
  --tarun: #3b6fb0;
  --mono: "SF Mono", "Menlo", "Consolas", monospace;
  --serif: "Iowan Old Style", "Palatino", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* screens */
.screen {
  min-height: 100vh;
  padding: max(env(safe-area-inset-top), 20px) 20px 40px;
  display: flex;
  flex-direction: column;
}
.screen.center {
  justify-content: center;
  align-items: center;
}
.hidden { display: none !important; }

.stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 520px;
  width: 100%;
  text-align: center;
}

/* brand */
.brand {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--ink-2);
  letter-spacing: -0.005em;
}
.brand.small { font-size: 17px; color: var(--ink-3); }

/* beta badge */
.beta-badge {
  display: inline-block;
  padding: 5px 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: #fbf3d9;
  color: #6d5e1d;
  border: 1px solid #e6d9a6;
  border-radius: 12px;
  margin: 0 auto;
}

/* typography */
h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(30px, 5.5vw, 42px);
  line-height: 1.15;
  margin: 8px 0;
  letter-spacing: -0.01em;
}
h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  margin: 28px 0 14px;
  letter-spacing: -0.005em;
}
h3 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin: 0 0 10px;
}
p { margin: 0 0 10px; }
p.lede { color: var(--ink-2); font-size: 17px; }
.small { font-size: 13px; }
.muted { color: var(--ink-3); }

/* cards */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  text-align: left;
}

/* buttons */
.btn {
  font-family: inherit;
  font-size: 15px;
  padding: 11px 18px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 500;
  transition: background 80ms, transform 80ms;
}
.btn:hover { background: #f4efe7; }
.btn:active { transform: scale(0.98); }
.btn.primary {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.btn.primary:hover { background: #333; }
.btn.primary:disabled {
  background: #ccc;
  border-color: #ccc;
  cursor: not-allowed;
}
.btn.link {
  background: transparent;
  border: none;
  color: var(--ink-3);
  text-decoration: underline;
  padding: 8px 12px;
}
.btn.icon {
  background: transparent;
  border: none;
  padding: 6px 12px;
  font-size: 22px;
  color: var(--ink-2);
}
.btn.back { font-size: 20px; }

/* input */
.input {
  font-family: inherit;
  font-size: 15.5px;
  padding: 10px 14px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: #fff;
  width: 100%;
  color: var(--ink);
}
.input:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.input.file { padding: 8px; }
textarea.input { resize: vertical; min-height: 80px; }

.field {
  display: block;
  margin-bottom: 14px;
}
.field > span:first-child {
  display: block;
  font-size: 13px;
  color: var(--ink-3);
  margin-bottom: 6px;
  font-weight: 500;
}

/* inline */
.inline {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.inline.centered { justify-content: center; }

/* error */
.error {
  color: var(--rachel);
  font-size: 13px;
  margin-top: 6px;
}

/* actions */
.actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 10px;
}

/* fine print */
.fine-print {
  margin-top: 20px;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13.5px;
}
.fine-print summary {
  cursor: pointer;
  color: var(--ink-2);
  padding: 4px 0;
}
.fine-print p { color: var(--ink-2); margin: 8px 0; }

/* invite code */
.invite-code {
  font-family: var(--mono);
  font-size: 30px;
  padding: 20px;
  background: var(--bg);
  border-radius: 8px;
  letter-spacing: 0.15em;
  font-weight: 600;
  user-select: all;
  text-align: center;
  margin-bottom: 14px;
}

/* loader */
.loader {
  width: 32px;
  height: 32px;
  border: 3px solid var(--line);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* dashboard */
.app-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}
.app-header .brand.small { flex: 1; }
.main {
  padding: 20px 0;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}
.greeting { margin-bottom: 20px; }
.greeting h1 { font-size: 26px; }

/* people pills */
.people { display: flex; gap: 6px; align-items: center; }
.person-pill {
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 10px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.person-pill.other { background: #f8e8e5; color: var(--rachel); }

/* menu drawer */
.drawer {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  margin: 6px 4px 0 auto;
  max-width: 260px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.drawer-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  text-align: left;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  border-radius: 4px;
}
.drawer-item:hover { background: var(--bg); }

/* action cards */
.actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.action-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 18px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color 80ms, transform 80ms;
}
.action-card:hover { border-color: var(--line-2); }
.action-card:active { transform: scale(0.98); }
.action-icon { font-size: 26px; margin-bottom: 8px; }
.action-title { font-family: var(--serif); font-size: 17px; margin-bottom: 3px; font-weight: 500; }
.action-sub { font-size: 12.5px; color: var(--ink-3); }

/* section */
.section { margin-top: 24px; }
.empty {
  padding: 20px;
  background: var(--panel);
  border: 1px dashed var(--line-2);
  border-radius: 8px;
  color: var(--ink-3);
  text-align: center;
  font-size: 14px;
}

/* conversation list */
.conv-list { display: flex; flex-direction: column; gap: 8px; }
.conv-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.conv-item:hover { border-color: var(--line-2); }
.conv-item .info { flex: 1; }
.conv-item .t { font-family: var(--serif); font-size: 15.5px; margin-bottom: 2px; }
.conv-item .meta { font-size: 12px; color: var(--ink-3); }
.conv-item .status {
  font-size: 11px; padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink-3);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.conv-item .status.ready { background: #e5f1ea; color: #3f8a5c; }
.conv-item .status.processing { background: var(--primary-soft); color: var(--primary); }

/* progress */
.progress-block { margin-top: 12px; }
.progress-bar {
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.progress-fill {
  height: 100%;
  background: var(--ink);
  width: 0%;
  transition: width 200ms;
}

/* audio preview */
.audio-preview { margin-top: 10px; }
audio { width: 100%; margin-top: 8px; }

/* checkbox */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
}
.checkbox-row input { width: 18px; height: 18px; cursor: pointer; }

/* question list */
.q-list { display: flex; flex-direction: column; gap: 8px; }
.q-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
.q-item .q { font-family: var(--serif); font-size: 14.5px; margin-bottom: 4px; }
.q-item .a { font-size: 13.5px; color: var(--ink-2); }
.q-item .meta { font-size: 11px; color: var(--ink-3); margin-top: 4px; }

/* tabs */
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--line);
  overflow-x: auto;
}
.tab-btn {
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink-3);
  cursor: pointer;
  white-space: nowrap;
  margin-bottom: -2px;
}
.tab-btn.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
  font-weight: 500;
}
.tab-pane { display: block; }
.tab-pane.hidden { display: none; }

/* bullet lists */
.bullet-list {
  margin: 0;
  padding-left: 20px;
  line-height: 1.65;
}
.bullet-list li { margin-bottom: 8px; font-size: 14.5px; }
.bullet-list.negative li { color: #6d2a2a; }
.bullet-list.muted li { color: var(--ink-3); }

/* orientation picker */
.orientation-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.orient-choice {
  display: flex;
  align-items: start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--line);
  font-size: 14px;
}
.orient-choice input { margin-top: 3px; }
.orient-choice:has(input:checked) {
  background: var(--primary-soft);
  border-color: var(--primary);
}

/* goal list */
.goal-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.goal-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
}
.goal-item .goal-text { flex: 1; }
.goal-item .goal-meta { font-size: 11px; color: var(--ink-3); font-family: var(--mono); }
.goal-item button { background: transparent; border: none; cursor: pointer; font-size: 14px; }

/* soft banner */
.banner-soft {
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 13.5px;
  color: #1f3f66;
  margin-bottom: 16px;
  line-height: 1.5;
}

/* chat */
.chat-main { display: flex; flex-direction: column; height: calc(100vh - 100px); }
.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 0;
}
.chat-msg { display: flex; }
.chat-msg.user { justify-content: flex-end; }
.chat-msg.ai { justify-content: flex-start; }
.chat-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  max-width: 75%;
  font-size: 14.5px;
  line-height: 1.5;
}
.chat-msg.user .chat-bubble {
  background: var(--ink);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg.ai .chat-bubble {
  background: var(--panel);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.chat-msg.typing .chat-bubble { opacity: 0.6; }
.dots { letter-spacing: 3px; }

.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.chat-input-row textarea { flex: 1; }

/* calendar scope explainer */
.scope-explainer { display: flex; flex-direction: column; gap: 10px; background: #fff8ec; border-color: #f2e3bf; }
.scope-row { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.scope-pill { flex: 0 0 auto; font-family: var(--mono); font-size: 11px; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.scope-pill.read { background: #e5efe4; color: #366c41; }
.scope-pill.write { background: #e7e4f2; color: #50449b; }

/* kind picker */
.kind-picker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 14px; }
.kind-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 14px 8px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: #fff; transition: border-color 120ms, background 120ms; gap: 4px; text-align: center; }
.kind-tile input { position: absolute; opacity: 0; pointer-events: none; }
.kind-tile:has(input:checked) { border-color: #9a8dc8; background: #f3eff9; }
.kind-ico { font-size: 22px; line-height: 1; }
.kind-label { font-size: 13px; color: var(--ink-2); }
@media (min-width: 640px) {
  .kind-picker { grid-template-columns: repeat(4, 1fr); }
}

/* datetime presets */
.preset-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.preset-btn { font-size: 12px; padding: 6px 10px; background: #fff; color: var(--ink-2); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; transition: background 120ms, border-color 120ms; }
.preset-btn:hover { background: #f4efe7; border-color: var(--ink-3); }
.preset-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* schedule confirmation */
.sched-invitee { margin: 8px 0 10px; padding: 8px 12px; background: #f7f4ee; border-radius: 8px; }
.sched-result { margin-top: 12px; padding: 12px 14px; background: #eaf5ec; border: 1px solid #c6e2ca; border-radius: 10px; font-size: 14px; color: #1f4a2a; }
.sched-result a { color: #1f4a2a; font-weight: 600; }

/* calendar event cards */
.cal-list { display: flex; flex-direction: column; gap: 12px; }
.cal-day-header { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin: 12px 0 2px; }
.cal-day-header:first-child { margin-top: 0; }
.cal-event {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 14px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.cal-event.our-event { border-color: #c9bde8; background: linear-gradient(to right, #f5f1fb 0%, #fff 50%); }
.cal-date-badge { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 48px; background: #f3eff9; border-radius: 10px; color: var(--ink); line-height: 1; padding: 6px 0; }
.cal-date-badge .day { font-size: 20px; font-weight: 700; font-family: var(--serif); }
.cal-date-badge .mon { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin-top: 2px; }
.cal-event-main { min-width: 0; }
.cal-event-main .cal-title { font-family: var(--serif); font-size: 15px; margin: 0 0 2px; line-height: 1.3; overflow-wrap: anywhere; }
.cal-event-main .cal-time { font-size: 12px; color: var(--ink-3); font-family: var(--mono); }
.cal-event-main .cal-loc { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.cal-type-icon { font-size: 22px; line-height: 1; }

@media (min-width: 640px) {
  .screen { padding: 40px; }
  .stack { gap: 24px; }
}
