:root {
  color-scheme: light;
  --ink: #172126;
  --muted: #607079;
  --paper: #f6f8f4;
  --surface: #ffffff;
  --line: #d8e1de;
  --teal: #176f69;
  --deep: #12313d;
  --coral: #d95f4a;
  --gold: #e0a940;
  --sky: #d7eef5;
  --mint: #dcefe6;
  --shadow: 0 20px 45px rgba(18, 49, 61, .14);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(140deg, rgba(215, 238, 245, .85), rgba(246, 248, 244, .58) 34%, rgba(220, 239, 230, .7)),
    #f6f8f4;
}

button,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

h1,
h2,
p {
  margin: 0;
}

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

.side {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: rgba(255, 255, 255, .66);
  border-right: 1px solid var(--line);
}

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

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

h1 {
  font-size: 1.38rem;
  line-height: 1.05;
}

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

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

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

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

.panel.warning {
  border-color: rgba(217, 95, 74, .34);
  background: rgba(255, 250, 246, .9);
}

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

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

.label {
  margin-bottom: 10px;
  color: var(--deep);
  font-size: .75rem;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #304148;
  line-height: 1.38;
}

.status-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border-radius: 999px;
  background: var(--teal);
  box-shadow: 0 0 0 5px rgba(23, 111, 105, .15);
}

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

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

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

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

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

.button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 850;
}

.primary,
.send {
  background: var(--teal);
  color: #ffffff;
}

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

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

.notice {
  margin: 16px 34px 0;
  padding: 12px 14px;
  border: 1px solid rgba(224, 169, 64, .5);
  border-radius: 8px;
  background: #fff8e5;
  color: #705214;
  line-height: 1.35;
}

.notice.error {
  border-color: rgba(217, 95, 74, .45);
  background: #fff0ec;
  color: #823121;
}

.messages {
  min-height: 0;
  overflow-y: auto;
  padding: 24px 34px;
}

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

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

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--deep);
  color: #ffffff;
  font-size: .78rem;
  font-weight: 850;
}

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

.bubble {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px 15px;
  box-shadow: 0 8px 18px rgba(18, 49, 61, .07);
  line-height: 1.52;
}

.message.user .bubble {
  grid-column: 1;
  grid-row: 1;
  background: #fff6f2;
  border-color: rgba(217, 95, 74, .28);
}

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

.typing {
  width: 82px;
  display: flex;
  gap: 6px;
  align-items: center;
}

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

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

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

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

.quick-actions button {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 13px;
  background: #edf6f8;
  color: var(--deep);
  border: 1px solid #cce1e7;
  font-weight: 760;
}

.quick-actions button:hover {
  background: #e3f0f3;
}

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

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

textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(23, 111, 105, .13);
}

.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 bob {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: .45;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

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

  .side {
    min-height: auto;
    padding: 20px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .scene {
    display: none;
  }

  .chat-area {
    height: auto;
    min-height: 72vh;
  }

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

  .auth-actions {
    width: 100%;
    justify-content: stretch;
  }

  .button {
    flex: 1 1 auto;
  }

  .notice {
    margin: 14px 20px 0;
  }

  .messages {
    padding: 20px;
  }

  .message,
  .message.user {
    grid-template-columns: 36px minmax(0, 1fr);
    justify-content: start;
  }

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

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

  .avatar {
    width: 36px;
    height: 36px;
  }

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

  .quick-actions button {
    flex: 1 1 calc(50% - 10px);
  }

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

@media (max-width: 430px) {
  h2 {
    font-size: 1.42rem;
  }

  .quick-actions button {
    flex-basis: 100%;
  }
}
