:root {
  color-scheme: light;
  --blue: #0655d9;
  --blue-2: #0047bd;
  --blue-3: #0a6cff;
  --ink: #10202b;
  --muted: #6e7b86;
  --line: #dce4ee;
  --panel: #f3f6fb;
  --surface: #ffffff;
  --shadow: 0 28px 70px rgba(7, 31, 78, 0.22);
  --soft-shadow: 0 14px 36px rgba(20, 47, 93, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(6, 85, 217, 0.15), rgba(255, 255, 255, 0) 34%),
    radial-gradient(circle at 82% 16%, rgba(10, 108, 255, 0.22), transparent 28%),
    linear-gradient(180deg, #f8fbff 0%, #edf2f8 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  pointer-events: none;
}

body::before {
  width: 62vw;
  height: 62vw;
  left: -28vw;
  bottom: -38vw;
  background: rgba(6, 85, 217, 0.08);
  transform: rotate(18deg);
}

body::after {
  width: 36vw;
  height: 36vw;
  right: -18vw;
  top: -18vw;
  background: rgba(6, 85, 217, 0.1);
  transform: rotate(-12deg);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.stage {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 28px;
}

.assistant-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(980px, 100%);
  height: min(820px, calc(100vh - 56px));
  overflow: hidden;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.assistant-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 112px;
  padding: 20px 26px;
  background: linear-gradient(135deg, var(--blue-2), var(--blue));
  color: #ffffff;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.robot-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(0, 27, 86, 0.25);
}

.robot-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 33% 24%;
  transform: scale(1.55) translateY(7px);
}

.eyebrow {
  margin: 0 0 2px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
  letter-spacing: 0;
}

.icon-button {
  position: relative;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.18);
}

.icon-button span,
.icon-button span::after {
  position: absolute;
  top: 22px;
  left: 12px;
  width: 24px;
  height: 3px;
  border-radius: 999px;
  background: #ffffff;
  content: "";
}

.icon-button span {
  transform: rotate(45deg);
}

.icon-button span::after {
  top: 0;
  left: 0;
  transform: rotate(90deg);
}

.assistant-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  min-height: 0;
  background: var(--panel);
}

.messages {
  min-height: 0;
  overflow-y: auto;
  padding: 24px 28px 18px;
}

.message {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 18px;
}

.message.user {
  justify-content: flex-end;
}

.message.user .avatar {
  order: 2;
}

.avatar {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  overflow: hidden;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: #ffffff;
  color: var(--blue);
  box-shadow: var(--soft-shadow);
  font-size: 13px;
  font-weight: 900;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 33% 24%;
}

.bot-avatar img {
  transform: scale(1.62) translateY(8px);
}

.user .avatar {
  width: 48px;
  height: 48px;
  flex-basis: 48px;
  border: 0;
  color: #ffffff;
  background: #526078;
}

.bubble {
  max-width: min(620px, 78%);
  padding: 17px 21px;
  border-radius: 8px 26px 26px 26px;
  background: var(--blue);
  color: #ffffff;
  box-shadow: var(--soft-shadow);
  white-space: pre-line;
  text-align: left;
  line-height: 1.42;
  font-size: 17px;
}

.user .bubble {
  border-radius: 26px 8px 26px 26px;
  background: #ffffff;
  color: #4c5664;
}

.message.is-loading .bubble {
  display: flex;
  align-items: center;
  gap: 6px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.6;
  animation: blink 1s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.16s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes blink {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.products {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.product-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(6, 85, 217, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  color: var(--ink);
}

.product-card h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
}

.product-meta {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

.product-card a {
  justify-self: start;
  min-height: 34px;
  padding: 7px 11px;
  border-radius: 10px;
  background: #eef5ff;
  color: var(--blue-2);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.side-panel {
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
  border-left: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.status-card,
.quick-card,
.debug-panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(20, 47, 93, 0.08);
}

.status-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  padding: 14px;
}

.status-dot {
  width: 11px;
  height: 11px;
  margin-top: 5px;
  border-radius: 50%;
  background: #21b66f;
  box-shadow: 0 0 0 5px rgba(33, 182, 111, 0.14);
}

.status-card strong {
  display: block;
  font-size: 14px;
}

.status-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.status-card.bad .status-dot {
  background: #d9534f;
  box-shadow: 0 0 0 5px rgba(217, 83, 79, 0.14);
}

.quick-card {
  margin-top: 14px;
  padding: 14px;
}

.quick-card h2 {
  margin: 0 0 10px;
  font-size: 15px;
}

.quick-grid {
  display: grid;
  gap: 8px;
}

.quick,
.secondary {
  min-height: 38px;
  border-radius: 12px;
  padding: 9px 11px;
  background: #edf4ff;
  color: var(--blue-2);
  font-size: 13px;
  font-weight: 800;
  text-align: left;
}

.quick:hover,
.secondary:hover {
  background: #dceaff;
}

.tool-row {
  margin-top: 14px;
}

.secondary {
  width: 100%;
  background: var(--blue);
  color: #ffffff;
  text-align: center;
}

.secondary:hover {
  background: var(--blue-2);
}

.debug-panel {
  margin-top: 14px;
  padding: 0;
}

.debug-panel summary {
  min-height: 42px;
  padding: 12px 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

pre {
  max-height: 210px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: #0f1d2c;
  color: #dceaff;
  font-size: 11px;
  line-height: 1.45;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 62px;
  gap: 12px;
  padding: 18px 20px;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.composer input {
  width: 100%;
  min-width: 0;
  height: 56px;
  border: 0;
  border-radius: 18px;
  padding: 0 18px;
  outline: 2px solid transparent;
  background: #f2f5f9;
  color: var(--ink);
  font-size: 18px;
}

.composer input::placeholder {
  color: #8a929d;
}

.composer input:focus {
  outline-color: rgba(6, 85, 217, 0.35);
  background: #ffffff;
}

.send-button {
  position: relative;
  width: 62px;
  height: 56px;
  border-radius: 18px;
  background: var(--blue);
}

.send-button:hover {
  background: var(--blue-2);
}

.send-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.send-button span {
  position: absolute;
  top: 50%;
  left: 51%;
  width: 0;
  height: 0;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  border-left: 22px solid #ffffff;
  transform: translate(-45%, -50%);
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .stage {
    padding: 0;
    place-items: stretch;
  }

  .assistant-shell {
    width: 100%;
    min-height: 100vh;
    height: auto;
    border-radius: 0;
  }

  .assistant-body {
    grid-template-columns: 1fr;
  }

  .side-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .assistant-header {
    min-height: 92px;
    padding: 16px;
  }

  .robot-mark {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
    border-radius: 15px;
  }

  h1 {
    font-size: 28px;
  }

  .messages {
    padding: 18px 14px;
  }

  .bubble {
    max-width: 82%;
    padding: 14px 16px;
    font-size: 15px;
  }

  .avatar {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
    border-radius: 50%;
  }

  .user .avatar {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  .quick-grid {
    grid-template-columns: 1fr;
  }

  .composer {
    grid-template-columns: minmax(0, 1fr) 56px;
    padding: 12px;
  }

  .composer input,
  .send-button {
    height: 52px;
  }
}
