:root {
  --bg: #f5ecdf;
  --bg-deep: #ead7bf;
  --ink: #122227;
  --ink-soft: #4a5b60;
  --accent: #0f5e5a;
  --accent-2: #a95b2a;
  --cream: #fffaf3;
  --line: rgba(18, 34, 39, 0.12);
  --shadow: 0 20px 60px rgba(18, 34, 39, 0.14);
  --radius: 26px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(169, 91, 42, 0.16), transparent 28rem),
    radial-gradient(circle at bottom right, rgba(15, 94, 90, 0.18), transparent 26rem),
    linear-gradient(180deg, var(--bg) 0%, #f2e8db 100%);
  color: var(--ink);
  overflow-x: hidden;
}

.backdrop {
  position: fixed;
  inset: auto;
  border-radius: 999px;
  filter: blur(24px);
  opacity: 0.5;
  pointer-events: none;
}

.backdrop-a {
  width: 18rem;
  height: 18rem;
  top: -4rem;
  right: -5rem;
  background: rgba(169, 91, 42, 0.26);
}

.backdrop-b {
  width: 16rem;
  height: 16rem;
  left: -3rem;
  bottom: 8rem;
  background: rgba(15, 94, 90, 0.22);
}

.shell {
  position: relative;
  max-width: 1320px;
  margin: 0 auto;
  padding: 1.4rem;
}

.hero,
.status-card,
.chat-panel {
  background: rgba(255, 250, 243, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem 1.5rem;
  border-radius: calc(var(--radius) + 4px);
  margin-bottom: 1.25rem;
}

.eyebrow {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: 0.95;
  max-width: 15ch;
}

.lede {
  margin: 0.85rem 0 0;
  max-width: 58ch;
  color: var(--ink-soft);
}

.hero-actions {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.dashboard {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 1rem;
}

.status-panel {
  display: grid;
  gap: 1rem;
}

.status-card {
  border-radius: var(--radius);
  padding: 1rem;
}

.status-label,
.chat-title {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
}

.status-label {
  font-size: 0.88rem;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-value {
  margin: 0.5rem 0 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.helper-text,
.chat-subtitle,
.session-meta,
.composer-note {
  margin: 0.35rem 0 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.status-pills,
.chips,
.voice-actions,
.calendar-actions-row,
.calendar-target-row,
.composer-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.9rem;
}

.pill,
.chip,
.primary,
.secondary,
.ghost,
select {
  border-radius: 999px;
  border: 1px solid var(--line);
  font: inherit;
}

.pill {
  padding: 0.42rem 0.72rem;
  background: rgba(15, 94, 90, 0.08);
  color: var(--ink);
  font-size: 0.87rem;
}

.chip {
  padding: 0.62rem 0.85rem;
  background: var(--cream);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.chip:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 94, 90, 0.35);
  background: rgba(15, 94, 90, 0.06);
}

.chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 74vh;
  border-radius: calc(var(--radius) + 8px);
  overflow: hidden;
}

.chat-header,
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.chat-header {
  padding: 1.05rem 1.2rem;
  border-bottom: 1px solid var(--line);
}

.chat-title {
  font-size: 1.45rem;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1rem;
  overflow-y: auto;
  min-height: 0;
  flex: 1;
}

.message {
  display: grid;
  gap: 0.4rem;
}

.message.user {
  justify-items: end;
}

.message.betty {
  justify-items: start;
}

.message-meta {
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.message-bubble {
  max-width: min(42rem, 88%);
  padding: 0.95rem 1rem;
  border-radius: 1.1rem;
  line-height: 1.55;
  box-shadow: 0 12px 30px rgba(18, 34, 39, 0.08);
  white-space: pre-wrap;
}

.message.user .message-bubble {
  background: linear-gradient(135deg, #0f5e5a, #174048);
  color: #f8fffe;
  border-bottom-right-radius: 0.35rem;
}

.message.betty .message-bubble {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 243, 232, 0.98));
  color: var(--ink);
  border: 1px solid rgba(18, 34, 39, 0.08);
  border-bottom-left-radius: 0.35rem;
}

.message-sources,
.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-width: min(42rem, 88%);
}

.message-actions.hidden {
  display: none;
}

.source-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.68rem;
  background: rgba(169, 91, 42, 0.08);
  border-radius: 999px;
  border: 1px solid rgba(169, 91, 42, 0.18);
  color: var(--accent-2);
  font-size: 0.84rem;
  text-decoration: none;
}

.source-link:hover {
  background: rgba(169, 91, 42, 0.14);
}

.composer {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 250, 243, 0.55), rgba(244, 233, 219, 0.88));
}

textarea,
select {
  width: 100%;
  resize: none;
  min-height: 3.6rem;
  border-radius: 1.1rem;
  border: 1px solid rgba(18, 34, 39, 0.12);
  background: rgba(255, 255, 255, 0.82);
  padding: 0.95rem 1rem;
  font: inherit;
  color: var(--ink);
}

select {
  min-height: auto;
  padding: 0.78rem 1rem;
}

textarea:focus,
select:focus {
  outline: 2px solid rgba(15, 94, 90, 0.16);
  border-color: rgba(15, 94, 90, 0.34);
}

.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.primary,
.secondary,
.ghost {
  cursor: pointer;
  padding: 0.72rem 1rem;
  font-weight: 700;
}

.primary {
  background: linear-gradient(135deg, var(--accent-2), #cb7b42);
  color: #fffaf3;
  border-color: transparent;
}

.secondary {
  background: #ffffff;
  color: var(--ink);
}

.ghost {
  background: transparent;
  color: var(--ink-soft);
}

.voice-button.recording {
  background: linear-gradient(135deg, #8f2f22, #c55948);
}

.compact-button {
  padding-inline: 0.85rem;
}

.calendar-card {
  display: grid;
  gap: 0.85rem;
}

.calendar-events {
  display: grid;
  gap: 0.75rem;
}

.calendar-event {
  display: grid;
  gap: 0.45rem;
  padding: 0.9rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(18, 34, 39, 0.08);
}

.calendar-event-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.calendar-event-title {
  margin: 0;
  font-weight: 700;
}

.calendar-provider {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(15, 94, 90, 0.08);
  color: var(--accent);
  font-size: 0.8rem;
}

.calendar-event-time,
.calendar-event-notes,
.empty-state,
.field-label {
  margin: 0;
  color: var(--ink-soft);
}

.field-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.hidden {
  display: none !important;
}

.primary:disabled,
.secondary:disabled,
.ghost:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 980px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .status-panel {
    order: 2;
  }

  .chat-panel {
    order: 1;
    min-height: 70vh;
  }
}

@media (max-width: 640px) {
  .shell {
    padding: 0.9rem;
  }

  .hero,
  .hero-actions,
  .composer-actions,
  .chat-header,
  .calendar-header,
  .calendar-target-row {
    flex-direction: column;
    align-items: stretch;
  }

  .message-bubble,
  .message-sources,
  .message-actions {
    max-width: 100%;
  }
}
