:root {
  color-scheme: light;
  --ink: #172022;
  --muted: #637072;
  --paper: #f5f1e8;
  --panel: #ffffff;
  --line: #d8dfdc;
  --deep: #123d46;
  --teal: #3e7f86;
  --moss: #6f8051;
  --coral: #c36d5a;
  --gold: #d9a33f;
  --shadow: 0 18px 48px rgba(22, 32, 34, .14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(118deg, rgba(62, 127, 134, .18), transparent 38%),
    linear-gradient(180deg, #fbfaf6 0%, #eef4f2 100%);
}

button,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

.sidebar {
  padding: 28px;
  background: #f1efe6;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.mark {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: var(--deep);
  color: #fff8e8;
  display: grid;
  place-items: center;
  font-weight: 900;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.35rem;
  line-height: 1.1;
}

.brand p,
.muted,
.panel p,
.eyebrow {
  color: var(--muted);
}

.scene {
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(23, 32, 34, .12);
  box-shadow: var(--shadow);
}

.scene img {
  display: block;
  width: 100%;
  aspect-ratio: 12 / 7;
  object-fit: cover;
}

.panel {
  background: rgba(255, 255, 255, .75);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.panel.compact p {
  font-size: .92rem;
  line-height: 1.45;
}

.panel-title {
  font-size: .76rem;
  color: var(--deep);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 10px;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #304044;
  line-height: 1.35;
}

.status-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border-radius: 999px;
  background: var(--teal);
  box-shadow: 0 0 0 5px rgba(62, 127, 134, .17);
}

.chat-card {
  min-width: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  background: rgba(255, 255, 255, .6);
}

.topbar {
  padding: 28px 34px 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 8px;
}

h2 {
  font-size: clamp(1.55rem, 2vw, 2.2rem);
  line-height: 1.08;
  letter-spacing: 0;
  max-width: 680px;
}

.auth-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.primary,
.secondary,
.send {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 850;
}

.primary,
.send {
  background: var(--deep);
  color: #fff8e8;
}

.secondary {
  background: #e5ecea;
  color: var(--deep);
}

.send:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.notice {
  margin: 16px 34px 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: #fff3d8;
  border: 1px solid #e4c174;
  color: #674817;
  line-height: 1.35;
}

.notice.error {
  background: #fff0ed;
  border-color: #e2a092;
  color: #7c2c20;
}

.messages {
  padding: 24px 34px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  display: grid;
  grid-template-columns: 42px minmax(0, 680px);
  gap: 12px;
  align-items: start;
}

.message.user {
  grid-template-columns: minmax(0, 680px) 42px;
  justify-content: end;
}

.message.user .avatar {
  grid-column: 2;
  grid-row: 1;
  background: var(--coral);
}

.message.user .bubble {
  grid-column: 1;
  background: #f6e1dc;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--teal);
  color: white;
  display: grid;
  place-items: center;
  font-size: .76rem;
  font-weight: 900;
}

.bubble {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: 0 10px 24px rgba(22, 32, 34, .08);
}

.bubble p {
  line-height: 1.5;
}

.bubble p + p {
  margin-top: 10px;
}

.typing {
  display: flex;
  gap: 6px;
  align-items: center;
  min-height: 48px;
}

.typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
  animation: bounce 1s infinite ease-in-out;
}

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

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

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .35; }
  40% { transform: translateY(-5px); opacity: 1; }
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 34px 16px;
}

.quick-actions button {
  min-height: 38px;
  padding: 0 13px;
  border-radius: 999px;
  background: #e7eeee;
  color: #213f45;
  font-weight: 750;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 18px 34px 28px;
  border-top: 1px solid var(--line);
  background: rgba(245, 241, 232, .76);
}

textarea {
  width: 100%;
  resize: none;
  border: 1px solid #cfd9d8;
  border-radius: 8px;
  padding: 13px 14px;
  color: var(--ink);
  background: white;
  outline: none;
  line-height: 1.45;
}

textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(62, 127, 134, .16);
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding: 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .scene,
  .panel.compact {
    display: none;
  }

  .chat-card {
    height: auto;
    min-height: calc(100vh - 184px);
  }

  .topbar {
    padding: 20px 18px 16px;
    flex-direction: column;
  }

  .notice {
    margin: 12px 18px 0;
  }

  .messages {
    padding: 18px;
    min-height: 42vh;
  }

  .message,
  .message.user {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .message.user .avatar {
    grid-column: 1;
  }

  .message.user .bubble {
    grid-column: 2;
  }

  .avatar {
    width: 34px;
    height: 34px;
    font-size: .68rem;
  }

  .quick-actions {
    padding: 0 18px 14px;
  }

  .composer {
    grid-template-columns: 1fr;
    padding: 14px 18px 18px;
  }

  .send {
    width: 100%;
  }
}
