:root {
  color-scheme: dark;
  --bg: #121212;
  --bg-elev: #1a1a1a;
  --paper: #222222;
  --ink: #f4f1ea;
  --muted: #9aa3a0;
  --line: #2d2d2d;
  --blue: #54b4ff;
  --link: #54b4ff;
  --alert: #f0cfcf;
  --alert-bg: #2c1616;
  --alert-line: #8a4545;
  --chip: #2a2a2a;
  --chip-line: #3d3d3d;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --kb: 0px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

.shell {
  height: 100%;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 0.7rem 0.85rem calc(0.45rem + env(safe-area-inset-bottom));
  padding-bottom: calc(0.45rem + env(safe-area-inset-bottom) + var(--kb));
}

.header {
  flex-shrink: 0;
  padding: 0.1rem 0 0.55rem;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.brand {
  display: block;
  min-width: 0;
}

.logo {
  display: block;
  height: 3.4rem;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
  background: transparent;
}

.header-cta {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 650;
  font-size: 0.9rem;
  white-space: nowrap;
}

.cta.call {
  background: var(--blue);
  color: #003f70;
}

.cta.book {
  background: transparent;
  color: var(--ink);
  border: 2px solid var(--blue);
}

.subtitle {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.subtitle strong {
  color: var(--blue);
  font-weight: 650;
}

.main {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.log {
  flex: 1 1 auto;
  min-height: 0;
  height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 0.2rem 0 0.6rem;
}

.msg {
  max-width: 92%;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--paper);
  border: 1px solid var(--line);
}

.msg.user {
  align-self: flex-end;
  background: #2a2a2a;
  color: var(--ink);
  border-color: #3a3a3a;
}

.msg.assistant {
  align-self: flex-start;
}

.msg.alert {
  background: var(--alert-bg);
  border-color: var(--alert-line);
  color: var(--alert);
}

.msg .who {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--blue);
}

.msg .body p,
.msg .body ul {
  margin: 0.35rem 0;
}

.msg .body ul {
  padding-left: 1.2rem;
}

.msg .body a {
  color: var(--link);
}

.thinking {
  color: var(--muted);
  font-style: italic;
}

.thinking::after {
  content: "";
  animation: dots 1.2s steps(4, end) infinite;
}

@keyframes dots {
  0% {
    content: "";
  }
  25% {
    content: ".";
  }
  50% {
    content: "..";
  }
  75% {
    content: "...";
  }
}

.sources {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.sources summary,
details.meta summary {
  cursor: pointer;
}

.sources .chips {
  margin-top: 0.45rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chips a,
.suggest button {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: var(--chip);
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--chip-line);
  font-size: 0.9rem;
}

.chips a:hover,
.suggest button:hover {
  border-color: var(--link);
  color: var(--link);
}

details.meta {
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.snippets {
  margin: 0.4rem 0 0;
  padding-left: 1.15rem;
}

.dock {
  flex-shrink: 0;
  background: var(--bg);
  padding-top: 0.35rem;
  border-top: 1px solid var(--line);
}

.suggest {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  margin: 0 0 0.55rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.suggest::-webkit-scrollbar {
  display: none;
}

.suggest button {
  cursor: pointer;
  background: var(--bg-elev);
  flex-shrink: 0;
}

.composer {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

textarea {
  flex: 1;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  font: inherit;
  background: var(--bg-elev);
  color: var(--ink);
}

textarea::placeholder {
  color: #7d8684;
}

button#send {
  background: var(--blue);
  color: #003f70;
  border: 0;
  border-radius: 12px;
  padding: 0.7rem 1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
}

button#send:disabled {
  opacity: 0.6;
  cursor: wait;
}

.hint {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.empty-error {
  color: var(--alert);
}

.empty-state {
  margin: auto;
  max-width: 26rem;
  padding: 0.5rem 0.75rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.log:has(.msg) .empty-state,
.empty-state[hidden] {
  display: none;
}

@media (max-width: 520px) {
  .logo {
    height: 2.7rem;
  }
  .cta.call .num {
    display: none;
  }
  .msg {
    max-width: 100%;
  }
  .subtitle {
    font-size: 0.8rem;
  }
}

@media (min-width: 640px) {
  .logo {
    height: 4.2rem;
  }
  .suggest {
    flex-wrap: wrap;
    overflow: visible;
  }
}

@media (min-width: 768px) {
  body {
    display: flex;
    justify-content: center;
    align-items: stretch;
    padding: 1.5rem;
  }

  .shell {
    width: min(760px, 100%);
    height: min(100%, calc(100dvh - 3rem));
    max-height: calc(100dvh - 3rem);
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    padding: 1rem 1.15rem 0.75rem;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom) + var(--kb));
  }

  .header {
    padding: 0.1rem 0 0.7rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 0.35rem;
  }

  .dock {
    background: transparent;
    padding-top: 0.55rem;
  }

  .suggest button {
    background: var(--chip);
  }
}
