﻿:root {
  --bg: #f3efe7;
  --bg-accent: #e7dcc7;
  --surface: rgba(255, 252, 245, 0.84);
  --surface-strong: #fff8ee;
  --surface-soft: rgba(255, 255, 255, 0.56);
  --ink: #1b1a17;
  --muted: #625a4b;
  --line: rgba(55, 40, 16, 0.12);
  --warm: #bb5a2a;
  --cool: #0b6e69;
  --busy: #9f3d27;
  --free: #2d7f5e;
  --upcoming: #98692f;
  --past: #5a6174;
  --shadow: 0 18px 40px rgba(43, 27, 7, 0.08);
  --shadow-soft: 0 8px 24px rgba(43, 27, 7, 0.08);
}

body[data-theme="dark"] {
  --bg: #10151a;
  --bg-accent: #16202a;
  --surface: rgba(20, 27, 35, 0.82);
  --surface-strong: #18212b;
  --surface-soft: rgba(15, 20, 26, 0.64);
  --ink: #eef2f6;
  --muted: #aebac6;
  --line: rgba(210, 223, 236, 0.12);
  --warm: #f1a45d;
  --cool: #67d3c0;
  --busy: #ff9a7b;
  --free: #77d8a5;
  --upcoming: #ffd089;
  --past: #b6bfd8;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body[data-theme="dark"] {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI Variable", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.35), transparent 34%),
    radial-gradient(circle at bottom right, rgba(11, 110, 105, 0.12), transparent 28%),
    linear-gradient(135deg, var(--bg) 0%, var(--bg-accent) 100%);
}

button,
a,
textarea {
  font: inherit;
}

.page-shell {
  max-width: 1220px;
  margin: 0 auto;
  padding: 10px 10px 28px;
}

.topbar,
.people-grid article,
.chat-section {
  backdrop-filter: blur(16px);
}

.topbar {
  position: sticky;
  top: 8px;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "brand actions"
    "meta meta";
  gap: 8px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.topbar-brand,
.topbar-meta,
.topbar-actions {
  min-width: 0;
}

.topbar-brand {
  grid-area: brand;
}

.brand-kicker,
.meta-label,
.slot-label,
.message-meta {
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.73rem;
}

.brand-kicker {
  display: none;
}

.brand-kicker,
.meta-label,
.section-heading p,
.banner,
.slot-meta,
.event-detail,
.message-meta,
#chat-input::placeholder,
.meta-detail {
  color: var(--muted);
}

.brand-title,
h1,
h2,
.card-person {
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
}

.brand-title {
  font-size: 1rem;
  line-height: 1.05;
}

.topbar-meta {
  grid-area: meta;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.meta-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.meta-chip-wide {
  min-width: 0;
}

.meta-detail {
  font-size: 0.83rem;
}

.topbar-actions {
  grid-area: actions;
  display: flex;
  gap: 6px;
  justify-content: end;
  align-items: center;
  flex-wrap: wrap;
}

.ghost-button,
.icon-button,
#send-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 9px 12px;
  text-decoration: none;
  cursor: pointer;
  font-size: 0.92rem;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

.icon-button {
  width: 38px;
  height: 38px;
  padding: 0;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

.icon-button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#theme-icon {
  display: block;
  width: 18px;
  height: 18px;
}

.icon-button:focus-visible,
.ghost-button:focus-visible,
#send-button:focus-visible {
  outline: 2px solid rgba(11, 110, 105, 0.28);
  outline-offset: 2px;
}

#send-button {
  min-width: 128px;
  background: linear-gradient(135deg, var(--cool), #125f94);
  color: white;
  border-color: transparent;
  box-shadow: 0 12px 28px rgba(11, 110, 105, 0.18);
}

.ghost-button:hover,
.icon-button:hover,
#send-button:hover {
  transform: translateY(-1px);
}

.banner {
  margin: 14px 0 18px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(159, 61, 39, 0.12);
  border: 1px solid rgba(159, 61, 39, 0.18);
}

.hidden {
  display: none;
}

.summary-section {
  margin-top: 14px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin: 0 0 14px;
}

.compact-heading {
  margin-top: 2px;
}

.section-heading h1,
.section-heading h2 {
  margin: 0;
  font-size: 1.55rem;
}

.section-heading p {
  margin: 0;
  max-width: 700px;
  line-height: 1.5;
}

.people-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.people-grid article {
  padding: 18px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.person-card {
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.person-card:hover {
  transform: translateY(-1px);
}

.person-toggle {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.person-toggle:focus-visible {
  outline: 2px solid rgba(11, 110, 105, 0.25);
  outline-offset: 6px;
  border-radius: 18px;
}

.card-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 0;
}

.card-summary {
  min-width: 0;
}

.card-now {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.card-side {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.card-person {
  font-size: 1.35rem;
}

.card-chevron {
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  color: var(--muted);
  transform: rotate(45deg);
  transition: transform 140ms ease, color 140ms ease;
}

.person-card.expanded .card-chevron {
  transform: rotate(225deg);
  color: var(--warm);
}

.person-details {
  margin-top: 14px;
}

.state-pill,
.message-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.state-pill.busy,
.message-pill.busy {
  background: rgba(159, 61, 39, 0.14);
  color: var(--busy);
}

.state-pill.free,
.message-pill.free {
  background: rgba(45, 127, 94, 0.15);
  color: var(--free);
}

.state-pill.upcoming,
.message-pill.upcoming {
  background: rgba(152, 105, 47, 0.16);
  color: var(--upcoming);
}

.state-pill.past,
.message-pill.past {
  background: rgba(90, 97, 116, 0.16);
  color: var(--past);
}

.timeline-slot {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.timeline-slot:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.slot-label {
  margin-bottom: 7px;
  color: var(--warm);
}

.slot-title {
  font-size: 0.98rem;
  font-weight: 600;
}

.slot-meta,
.event-detail {
  margin-top: 6px;
  line-height: 1.5;
}

.chat-section {
  margin-top: 18px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface), rgba(255, 255, 255, 0.05));
  box-shadow: var(--shadow);
}

.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 340px;
  max-height: 620px;
  overflow: auto;
  padding-right: 4px;
}

.message {
  max-width: min(840px, 100%);
}

.message.user {
  align-self: end;
}

.message.assistant {
  align-self: start;
}

.message-shell {
  border-radius: 24px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
}

.message.user .message-shell {
  background: linear-gradient(135deg, rgba(11, 110, 105, 0.15), rgba(18, 95, 148, 0.1));
}

.message-meta {
  margin-bottom: 10px;
}

.message-text {
  white-space: pre-wrap;
  line-height: 1.65;
}

.message-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.message-pill {
  border: 1px solid transparent;
  font-size: 0.76rem;
}

.message-cards {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.event-card {
  padding: 14px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
}

.event-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}

.event-person {
  font-weight: 700;
}

.event-title {
  font-size: 1rem;
  font-weight: 700;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

#chat-input {
  width: 100%;
  resize: vertical;
  min-height: 58px;
  border-radius: 18px;
  border: 1px solid var(--line);
  padding: 14px 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
}

#chat-input:focus {
  outline: 2px solid rgba(11, 110, 105, 0.25);
  border-color: rgba(11, 110, 105, 0.28);
}

.typing-dot::after {
  content: "...";
  display: inline-block;
  width: 1.6em;
  overflow: hidden;
  vertical-align: bottom;
  animation: dots 1.15s steps(4, end) infinite;
}

.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;
}

@keyframes dots {
  0% { width: 0; }
  100% { width: 1.6em; }
}

@media (max-width: 1080px) {
  .section-heading,
  .composer,
  .people-grid,
  .topbar-meta {
    grid-template-columns: 1fr;
    display: grid;
  }

  .topbar-actions {
    justify-content: start;
  }

  .section-heading {
    align-items: start;
  }
}

@media (min-width: 760px) {
  .page-shell {
    padding: 16px 16px 32px;
  }

  .topbar {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "brand meta actions";
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 20px;
  }

  .brand-kicker {
    display: block;
  }

  .brand-title {
    font-size: 1.2rem;
  }

  .topbar-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .people-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .chat-section,
  .people-grid article {
    border-radius: 24px;
  }

  .card-now {
    font-size: 0.95rem;
  }
}

@media (min-width: 1080px) {
  .page-shell {
    padding: 18px 20px 40px;
  }

  .brand-title {
    font-size: 1.35rem;
  }

  .people-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
