:root {
  color-scheme: light;
  --ink: #1f2933;
  --muted: #637083;
  --paper: #fbfaf7;
  --panel: #ffffff;
  --line: #ded8cf;
  --sage: #57746a;
  --sage-dark: #2f5148;
  --rose: #a35f62;
  --gold: #b9823a;
  --soft: #f0ece5;
  --shadow: 0 24px 70px rgba(41, 37, 31, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, #25302c, #5b5044 52%, #283b45);
}

button,
textarea,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(280px, 390px) minmax(0, 1fr);
  gap: 22px;
  min-height: 100vh;
  padding: 24px;
}

.side-panel,
.chat-panel {
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(251, 250, 247, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  border-radius: 8px;
}

.venue-mark {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mark-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 8px;
  color: #fff;
  background: var(--sage-dark);
  font-family: Georgia, serif;
  font-weight: 700;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--rose);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 0.95;
}

.client-card {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.client-photo {
  aspect-ratio: 1;
  border-radius: 8px;
  background:
    linear-gradient(rgba(47, 81, 72, 0.08), rgba(163, 95, 98, 0.1)),
    url("/assets/intake-scene.png") 68% 46% / 320% auto;
}

.client-card h2,
.chat-header h2 {
  margin: 0 0 4px;
  font-size: 1.15rem;
}

.client-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.case-notes {
  display: grid;
  gap: 14px;
  margin: 0;
}

.case-notes div {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.case-notes dt {
  margin-bottom: 4px;
  color: var(--sage-dark);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.case-notes dd {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.scene-preview {
  margin: -4px 0 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.scene-preview img {
  display: block;
  width: 100%;
  height: auto;
}

.secondary-button,
.send-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(31, 41, 51, 0.58);
  backdrop-filter: blur(10px);
}

.login-overlay.visible {
  display: grid;
}

.login-card {
  display: grid;
  gap: 13px;
  width: min(430px, 100%);
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 8px;
  background: rgba(251, 250, 247, 0.98);
  box-shadow: var(--shadow);
}

.login-card h2 {
  margin: 0 0 4px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
}

.login-card label {
  color: var(--sage-dark);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.login-card input {
  width: 100%;
  min-height: 48px;
  border: 1px solid #cfc6b8;
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.login-card input:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(87, 116, 106, 0.16);
}

.secondary-button {
  margin-top: auto;
  color: var(--sage-dark);
  background: #e7e1d7;
}

.secondary-button:hover,
.secondary-button:focus-visible {
  background: #ddd4c7;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(rgba(251, 250, 247, 0.84), rgba(251, 250, 247, 0.9)),
    url("/assets/intake-scene.png") center / cover;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.chat-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tts-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--sage-dark);
  background: #fff;
  font-size: 0.88rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.tts-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--sage-dark);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 92px;
  justify-content: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--sage-dark);
  background: #fff;
  font-size: 0.88rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #5f9f76;
}

.status-pill.busy .status-dot {
  background: var(--gold);
}

.status-pill.error .status-dot {
  background: var(--rose);
}

.transcript {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  padding: 22px;
  scroll-behavior: smooth;
  background: rgba(251, 250, 247, 0.22);
}

.message {
  max-width: min(74ch, 82%);
  padding: 14px 16px;
  border-radius: 8px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.message.client {
  align-self: flex-start;
  border: 1px solid var(--line);
  background: #fff;
}

.message.student {
  align-self: flex-end;
  color: #fff;
  background: var(--sage-dark);
}

.speaker {
  display: block;
  margin-bottom: 5px;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.8;
}

.typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.typing span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--muted);
  animation: pulse 1s infinite ease-in-out;
}

.typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes pulse {
  0%, 80%, 100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

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

textarea {
  width: 100%;
  min-height: 54px;
  max-height: 170px;
  resize: vertical;
  border: 1px solid #cfc6b8;
  border-radius: 8px;
  padding: 13px 14px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

textarea:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(87, 116, 106, 0.16);
}

.send-button {
  min-width: 112px;
  padding: 0 18px;
  color: #fff;
  background: var(--sage-dark);
}

.send-button:hover,
.send-button:focus-visible {
  background: #223f38;
}

.send-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

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

@media (max-width: 860px) {
  body {
    background-attachment: scroll;
  }

  .app-shell {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 12px;
  }

  .side-panel {
    gap: 16px;
  }

  .chat-panel {
    min-height: 72vh;
  }

  .chat-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .chat-tools {
    width: 100%;
    justify-content: space-between;
  }

  .message {
    max-width: 94%;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .send-button {
    width: 100%;
  }
}
