:root {
  color-scheme: light;
  --ink: #0d2530;
  --muted: #5d7180;
  --line: #d8e8ef;
  --teal: #00324a;
  --blue: #0084c8;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ink);
  background: transparent;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

.qa-shell {
  position: relative;
  width: min(980px, 100%);
  margin: 0 auto;
}

.qa-panel {
  overflow: hidden;
  border: 1px solid rgba(0, 50, 74, 0.12);
  border-radius: 8px;
  background:
    radial-gradient(circle at top right, rgba(0, 132, 200, 0.1), transparent 32%),
    var(--white);
  box-shadow: 0 18px 44px rgba(0, 50, 74, 0.1);
}

.qa-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  color: var(--teal);
  font-size: clamp(1.35rem, 2.8vw, 2rem);
  line-height: 1.05;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid rgba(0, 132, 200, 0.2);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--teal);
  background: #edf8fd;
  font-size: 0.8rem;
  font-weight: 800;
}

.qa-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.9fr);
  gap: 12px;
  padding: 16px 20px 20px;
}

.search-field,
.select-field {
  display: grid;
  gap: 6px;
}

.search-field span,
.select-field span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(0, 50, 74, 0.16);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

select:disabled {
  color: var(--muted);
  background: #f8fbfd;
}

input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0, 132, 200, 0.13);
}

.answer-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease;
}

.answer-modal.is-visible {
  pointer-events: auto;
  opacity: 1;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: 8px;
  background: rgba(0, 24, 36, 0.56);
  cursor: pointer;
}

.answer-card {
  position: relative;
  z-index: 1;
  width: min(680px, 100%);
  max-height: min(78vh, 680px);
  overflow: auto;
  border: 1px solid rgba(0, 132, 200, 0.22);
  border-radius: 8px;
  padding: 20px;
  background:
    radial-gradient(circle at top right, rgba(0, 132, 200, 0.11), transparent 34%),
    #fff;
  box-shadow: 0 28px 74px rgba(0, 30, 46, 0.35);
  transform: translateY(10px) scale(0.98);
  transition: transform 180ms ease;
}

.answer-modal.is-visible .answer-card {
  transform: translateY(0) scale(1);
}

.answer-meta {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.close-button,
.copy-button,
.secondary-close-button {
  border: 1px solid rgba(0, 50, 74, 0.14);
  border-radius: 8px;
  cursor: pointer;
  color: var(--teal);
  background: #fff;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.close-button {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  padding: 0;
}

.close-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.1;
}

.answer-card h2 {
  margin-bottom: 10px;
  color: var(--teal);
  font-size: clamp(1.35rem, 3vw, 2.2rem);
  line-height: 1.08;
}

#answer-text {
  margin-bottom: 18px;
  color: #223f4e;
  font-size: clamp(1rem, 1.7vw, 1.12rem);
  font-weight: 520;
  line-height: 1.58;
}

.answer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 14px;
}

.copy-button,
.secondary-close-button {
  min-height: 40px;
  padding: 9px 12px;
  font-size: 0.82rem;
  font-weight: 850;
}

.copy-button {
  color: #fff;
  border-color: rgba(0, 132, 200, 0.68);
  background: linear-gradient(135deg, var(--blue), var(--teal));
}

.copy-button:hover,
.secondary-close-button:hover,
.close-button:hover {
  transform: translateY(-1px);
  border-color: var(--blue);
  box-shadow: 0 10px 24px rgba(0, 50, 74, 0.09);
}

.guidance-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.qa-shell.is-sidebar {
  max-width: 390px;
}

.qa-shell.is-sidebar .qa-header,
.qa-shell.is-sidebar .qa-controls {
  grid-template-columns: 1fr;
  padding-left: 14px;
  padding-right: 14px;
}

.qa-shell.is-sidebar .qa-header {
  align-items: flex-start;
}

.qa-shell.is-sidebar .answer-card {
  max-height: 82vh;
}

@media (max-width: 640px) {
  .qa-header,
  .qa-controls {
    grid-template-columns: 1fr;
  }

  .qa-header {
    align-items: flex-start;
  }

  .answer-modal {
    padding: 12px;
  }
}
