:root {
  --bg: #edf3fb;
  --bg-accent: #d7e3f4;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --surface-tint: rgba(244, 248, 254, 0.96);
  --text: #173354;
  --muted: #5d6f88;
  --line: rgba(42, 78, 130, 0.12);
  --line-strong: rgba(42, 78, 130, 0.2);
  --primary: #4065b2;
  --primary-soft: #dbe5f7;
  --secondary: #96a843;
  --shadow: 0 24px 60px rgba(33, 72, 123, 0.14);
  --shadow-soft: 0 12px 30px rgba(33, 72, 123, 0.08);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(64, 101, 178, 0.2), transparent 26%),
    radial-gradient(circle at right 18%, rgba(150, 168, 67, 0.18), transparent 24%),
    linear-gradient(180deg, var(--bg) 0%, #e4edf9 100%);
}

.shell {
  width: min(1320px, calc(100% - 32px));
  margin: 24px auto 48px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(280px, 0.95fr);
  gap: 22px;
  margin-bottom: 24px;
}

.hero-copy,
.hero-panel,
.card,
.chat-log,
.chat-form {
  background: var(--surface);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-copy,
.hero-panel,
.card {
  padding: 26px;
}

.eyebrow,
.panel-label,
.card-label {
  margin: 0 0 10px;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 700;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.3rem, 4vw, 4.3rem);
  line-height: 0.96;
  color: var(--primary);
}

.lead {
  margin: 18px 0 0;
  max-width: 62ch;
  font-size: 1.08rem;
  line-height: 1.7;
  color: var(--muted);
}

.panel-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.sidebar {
  display: grid;
  gap: 18px;
  align-content: start;
  position: sticky;
  top: 20px;
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.suggestion,
.chat-form button {
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.suggestion:hover,
.chat-form button:hover {
  transform: translateY(-1px);
}

.helper {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.chat-area {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 74vh;
  gap: 14px;
  background: linear-gradient(180deg, rgba(247, 250, 255, 0.82), rgba(234, 241, 251, 0.7));
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: 14px;
  box-shadow: var(--shadow);
}

.chat-log {
  padding: 22px;
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(242, 247, 254, 0.94));
  border-radius: 22px;
  border: 1px solid rgba(42, 78, 130, 0.08);
  min-height: 0;
}

.message {
  max-width: min(92%, 920px);
  margin-bottom: 18px;
  padding: 18px 20px;
  border-radius: 20px;
  line-height: 1.7;
  animation: slide-up 220ms ease;
  box-shadow: var(--shadow-soft);
}

.message.user {
  margin-left: auto;
  background: linear-gradient(135deg, #4065b2, #345498);
  color: #f7fbff;
  border-bottom-right-radius: 6px;
}

.message.bot {
  background: var(--surface-tint);
  border: 1px solid rgba(42, 78, 130, 0.1);
  border-bottom-left-radius: 6px;
}

.message p {
  margin: 0;
}

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

.answer-section + .answer-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(42, 78, 130, 0.08);
}

.answer-section h3 {
  margin: 0 0 10px;
  font-size: 1rem;
  letter-spacing: 0.01em;
}

.answer-section ul {
  margin: 10px 0 0 18px;
  padding: 0;
}

.answer-section li + li {
  margin-top: 10px;
}

.inline-question {
  border: 1px solid var(--line);
  background: rgba(64, 101, 178, 0.08);
  color: var(--text);
  border-radius: 14px;
  padding: 10px 12px;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
  line-height: 1.5;
  transition: background 160ms ease, transform 160ms ease, border-color 160ms ease;
}

.inline-question:hover {
  background: rgba(64, 101, 178, 0.14);
  border-color: rgba(64, 101, 178, 0.28);
  transform: translateY(-1px);
}

.inline-question code {
  color: var(--primary);
}

.message ol {
  margin: 14px 0 0 20px;
  padding: 0;
}

.message li + li {
  margin-top: 14px;
}

.inline-steps {
  margin: 10px 0 0 18px;
  padding: 0;
}

.inline-steps li + li {
  margin-top: 8px;
}

.procedure-group + .procedure-group {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(42, 78, 130, 0.08);
}

.procedure-title {
  margin: 0 0 8px;
}

.procedure-list {
  margin-top: 8px;
}

.procedure-source {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.message a {
  color: var(--primary);
  font-weight: 700;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.message-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.feedback-controls {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(42, 78, 130, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.feedback-label,
.feedback-status {
  color: var(--muted);
  font-size: 0.9rem;
}

.feedback-buttons {
  display: flex;
  gap: 8px;
}

.feedback-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  border-radius: 999px;
  min-width: 42px;
  min-height: 36px;
  padding: 0 12px;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.feedback-button:hover {
  transform: translateY(-1px);
  border-color: rgba(64, 101, 178, 0.28);
  background: rgba(64, 101, 178, 0.08);
}

.feedback-button.selected {
  background: linear-gradient(135deg, var(--primary), #33539a);
  color: white;
  border-color: transparent;
  box-shadow: 0 10px 22px rgba(64, 101, 178, 0.2);
}

.copy-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

.copy-button:hover {
  background: white;
}

.step-detail {
  display: inline-block;
  margin-top: 6px;
}

.step-source {
  display: inline-block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.94rem;
}

.sources {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.94rem;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 14px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 246, 253, 0.92));
  border-radius: 20px;
  border: 1px solid rgba(42, 78, 130, 0.08);
  box-shadow: var(--shadow-soft);
}

.chat-form input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 15px 18px;
  background: #ffffff;
  color: var(--text);
  font-size: 1rem;
  box-shadow: inset 0 1px 2px rgba(42, 78, 130, 0.05);
}

.chat-form input:focus {
  outline: 2px solid rgba(64, 101, 178, 0.18);
  border-color: var(--primary);
}

.chat-form button,
.suggestion {
  background: linear-gradient(135deg, var(--primary), #33539a);
  color: white;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(64, 101, 178, 0.24);
}

.suggestion:nth-child(3n) {
  background: linear-gradient(135deg, var(--secondary), #7f9433);
  box-shadow: 0 10px 22px rgba(150, 168, 67, 0.24);
}

.chat-form button {
  min-width: 90px;
  padding: 0 22px;
}

.suggestion {
  padding: 11px 15px;
  line-height: 1.4;
}

.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 slide-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 920px) {
  .hero,
  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .chat-area {
    min-height: 60vh;
  }

  .chat-form {
    grid-template-columns: 1fr;
  }

  .chat-form button {
    min-height: 46px;
  }

  .feedback-controls {
    align-items: flex-start;
  }
}
