:root {
  --canvas: #edf2f3;
  --surface: #ffffff;
  --surface-soft: #f6f9f8;
  --surface-warm: #fff8ed;
  --ink: #14252d;
  --muted: #6b7b81;
  --line: #d6e0e1;
  --line-strong: #bccbcd;
  --teal: #13746c;
  --teal-deep: #0d5a55;
  --teal-soft: #dff0ed;
  --coral: #c45d49;
  --coral-soft: #fae8e2;
  --amber: #e7a63c;
  --focus: #b87518;
  --shadow: rgba(20, 37, 45, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: "Aptos", "Segoe UI", "Microsoft YaHei UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
textarea:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(231, 166, 60, 0.36);
}

.workspace {
  width: 100%;
  min-height: 100vh;
  margin: 0 auto;
  padding: 0;
  animation: dossier-in 420ms ease-out both;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 96px;
  padding: 22px 26px;
  color: var(--surface);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 0;
  box-shadow: none;
  gap: 24px;
}

.identity {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 14px;
}

.agent-mark {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  place-items: center;
  color: var(--ink);
  background: var(--amber);
  border: 4px solid rgba(255, 255, 255, 0.16);
  border-radius: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.eyebrow,
.section-label,
.message-meta {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar .eyebrow {
  color: #a9c5c5;
}

h1,
h2,
p {
  overflow-wrap: break-word;
}

h1 {
  margin: 0;
  color: var(--surface);
  font-size: 24px;
  font-weight: 750;
  line-height: 1.2;
}

h1 span {
  color: #a9bdc0;
  font-size: 15px;
  font-weight: 500;
}

h2 {
  margin: 5px 0 0;
  font-size: 24px;
  line-height: 1.2;
}

.new-chat {
  min-height: 42px;
  padding: 0 16px;
  color: var(--surface);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 8px;
  font-weight: 650;
  white-space: nowrap;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.new-chat:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: var(--surface);
  transform: translateY(-1px);
}

.console {
  display: grid;
  height: calc(100vh - 96px);
  min-height: 0;
  grid-template-columns: minmax(280px, 0.68fr) minmax(0, 1.6fr);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0;
  box-shadow: none;
}

.briefing {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 38px 30px 28px;
  background: var(--surface-soft);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.briefing::before {
  position: absolute;
  top: 38px;
  bottom: 28px;
  left: 0;
  width: 4px;
  background: var(--teal);
  content: "";
}

.briefing .section-label,
.conversation .section-label {
  color: var(--teal);
}

.briefing h2 {
  max-width: 280px;
  margin-top: 8px;
  font-size: 34px;
  font-weight: 760;
  line-height: 1.08;
}

.briefing-copy {
  max-width: 300px;
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.topic-group {
  display: grid;
  margin-top: 38px;
  gap: 9px;
}

.topic-group .section-label {
  margin-bottom: 3px;
}

.prompt-button {
  position: relative;
  width: 100%;
  min-height: 48px;
  padding: 9px 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(20, 37, 45, 0.04);
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.prompt-button:hover {
  background: var(--teal-soft);
  border-color: var(--teal);
  box-shadow: 0 5px 12px rgba(20, 37, 45, 0.08);
  transform: translateX(2px);
}

.hr-prompts .prompt-button {
  border-left-color: var(--coral);
}

.hr-prompts .prompt-button:hover {
  background: var(--coral-soft);
  border-color: var(--coral);
}

.privacy-note {
  max-width: 290px;
  margin: auto 0 0;
  padding-top: 28px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.conversation {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto minmax(280px, 1fr) auto auto;
  padding: 32px 32px 26px;
  background: var(--surface);
}

.conversation-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  gap: 20px;
}

.conversation-heading h2 {
  font-size: 27px;
  font-weight: 760;
}

.service-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  color: var(--teal-deep);
  background: var(--teal-soft);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.service-status span {
  width: 8px;
  height: 8px;
  background: var(--teal);
  border-radius: 50%;
}

.messages {
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: 0 -10px;
  padding: 28px 10px 24px;
  gap: 16px;
  background: var(--surface-soft);
  overflow-y: auto;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.message {
  max-width: min(88%, 780px);
  margin: 0;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(20, 37, 45, 0.07);
}

.message p:last-child {
  margin: 6px 0 0;
  white-space: pre-wrap;
}

.assistant-message {
  align-self: flex-start;
  background: var(--surface);
  border-left: 4px solid var(--teal);
}

.streaming-message {
  min-width: min(250px, 88%);
}

.stream-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 32px;
  margin-top: 8px;
  padding: 6px 10px;
  color: var(--teal-deep);
  background: var(--teal-soft);
  border: 1px solid #c6e3de;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.stream-status[hidden] {
  display: none;
}

.stream-status-indicator {
  display: inline-flex;
  align-items: center;
  min-width: 22px;
  gap: 3px;
}

.stream-status-dot {
  width: 4px;
  height: 4px;
  background: var(--teal);
  border-radius: 50%;
  animation: status-dot-pulse 1.2s ease-in-out infinite;
}

.stream-status-dot:nth-child(2) {
  animation-delay: 150ms;
}

.stream-status-dot:nth-child(3) {
  animation-delay: 300ms;
}

.message-answer[hidden] {
  display: none;
}

.user-message {
  align-self: flex-end;
  color: var(--ink);
  background: var(--surface-warm);
  border-right: 4px solid var(--coral);
}

.error-message {
  color: #8d3829;
  background: var(--coral-soft);
  border-color: #f0c9be;
  border-left-color: var(--coral);
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.composer textarea {
  display: block;
  width: 100%;
  min-height: 54px;
  max-height: 160px;
  padding: 13px 14px;
  resize: vertical;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.composer textarea::placeholder {
  color: #819095;
}

.composer textarea:focus {
  background: var(--surface);
  border-color: var(--teal);
}

.composer button {
  min-width: 80px;
  min-height: 54px;
  padding: 0 18px;
  color: var(--surface);
  background: var(--teal);
  border: 1px solid var(--teal);
  border-radius: 9px;
  font-weight: 750;
  transition: background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.composer button:hover:not(:disabled) {
  background: var(--teal-deep);
  box-shadow: 0 5px 12px rgba(19, 116, 108, 0.24);
  transform: translateY(-1px);
}

.composer button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.composer-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.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 dossier-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes status-dot-pulse {
  0%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }

  50% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@media (max-width: 860px) {
  .workspace {
    width: min(100%, calc(100% - 28px));
    padding: 14px 0;
  }

  .topbar {
    min-height: 84px;
    padding: 18px 20px;
  }

  .console {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
  }

  .briefing {
    padding: 30px 24px 24px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .briefing::before {
    top: 0;
    right: 0;
    bottom: auto;
    width: auto;
    height: 4px;
  }

  .briefing h2 {
    max-width: 560px;
    font-size: 30px;
  }

  .briefing-copy {
    max-width: 560px;
  }

  .topic-group {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 26px;
  }

  .topic-group .section-label {
    grid-column: 1 / -1;
  }

  .privacy-note {
    max-width: 560px;
    margin-top: 22px;
    padding-top: 0;
  }

  .conversation {
    min-height: 660px;
    padding: 28px 24px 22px;
  }
}

@media (max-width: 600px) {
  .workspace {
    width: 100%;
    padding: 0;
  }

  .topbar {
    align-items: flex-start;
    min-height: 80px;
    padding: 17px 16px;
    border-radius: 0;
  }

  .agent-mark {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  .eyebrow {
    font-size: 10px;
  }

  h1 {
    font-size: 20px;
  }

  h1 span {
    display: block;
    margin-top: 1px;
    font-size: 13px;
  }

  .new-chat {
    min-height: 38px;
    padding: 0 11px;
  }

  .console {
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .briefing {
    padding: 28px 16px 22px;
  }

  .briefing h2 {
    font-size: 28px;
  }

  .topic-group {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .conversation {
    min-height: 680px;
    padding: 24px 16px 20px;
  }

  .conversation-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .messages {
    margin: 0 -4px;
    padding: 22px 4px;
  }

  .message {
    max-width: 94%;
  }

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

  .composer button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
