:root {
  color-scheme: light;
  --blue-950: #08152c;
  --blue-900: #102448;
  --blue-800: #1a5faf;
  --blue-700: #2472d0;
  --blue-50: #eef6ff;
  --green-600: #198754;
  --orange-600: #d97706;
  --red-600: #c73636;
  --ink: #101828;
  --muted: #64748b;
  --line: #dbe4f0;
  --soft: #f7f7f7;
  --white: #ffffff;
  --shadow: 0 18px 55px rgba(36, 114, 208, 0.12);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(36, 114, 208, 0.1), transparent 28rem),
    linear-gradient(180deg, #f6fbff 0%, #ffffff 58%);
  font-size: 16px;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  color: var(--blue-950);
  letter-spacing: 0;
  line-height: 1.08;
}

.app {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(219, 228, 240, 0.95);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 28px rgba(36, 114, 208, 0.08);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.brand-logo-full {
  display: block;
  width: min(254px, 42vw);
  max-height: 44px;
  object-fit: contain;
}

.top-actions,
.result-actions,
.export-actions,
.question-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 68px;
}

.tool-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 16px;
}

.title-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.tool-mark {
  display: grid;
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  place-items: center;
  border-radius: var(--radius);
  color: var(--white);
  background: linear-gradient(135deg, #0957ff, var(--blue-700));
  box-shadow: 0 15px 30px rgba(36, 114, 208, 0.24);
  font-size: 28px;
  font-weight: 900;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--blue-700);
  font-size: 13px;
  font-weight: 800;
}

.eyebrow::before {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green-600);
  content: "";
}

h1 {
  margin-top: 2px;
  font-size: clamp(32px, 5vw, 50px);
}

.lead {
  max-width: 760px;
  margin-top: 6px;
  color: #5f6b82;
  font-size: 17px;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-width: min(100%, 360px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 28px rgba(8, 21, 44, 0.06);
}

.status-strip span {
  display: grid;
  gap: 1px;
  padding: 12px 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-strip span + span {
  border-left: 1px solid var(--line);
}

.status-strip strong {
  color: var(--blue-950);
  font-size: 18px;
  line-height: 1.1;
}

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

.panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 34px rgba(8, 21, 44, 0.06);
}

.input-panel,
.result-panel {
  padding: 20px;
}

.input-panel {
  position: static;
  display: grid;
  gap: 14px;
}

#tool [hidden] { display: none !important; }
#tool > [data-aw-usage-banner] { margin: 0 0 16px; padding: 0; border: 0; }
.questionnaire-input { min-width: 0; }
#questionnaire-form { max-height: none; overflow: visible; }
.form-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.form-steps button {
  display: grid;
  gap: 2px;
  min-width: 0;
  min-height: 52px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: #516171;
  text-align: left;
  font-size: 14px;
  line-height: 1.3;
}
.form-steps button span { font-size: 12px; }
.form-steps button[aria-current="step"] { border-color: #155eef; background: #edf3ff; color: #155eef; }
.form-step { display: grid; align-content: start; gap: 12px; min-width: 0; margin: 0; padding: 0; border: 0; }
.form-step .field { gap: 6px; }
.step-legend { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.step-actions { display: flex; gap: 10px; align-items: stretch; }
.step-actions .primary-button { flex: 1; min-width: 0; }
.step-error { margin: 0; color: #b42318; font-size: 14px; }

@media (min-width: 1101px) {
  .form-step { min-height: 340px; }
}

.panel-heading,
.result-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

h2 {
  margin-top: 2px;
  font-size: 21px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field,
.check-field {
  min-width: 0;
}

.field {
  display: grid;
  gap: 7px;
}

.field span,
.check-field span {
  color: #172033;
  font-size: 14px;
  font-weight: 700;
}

.field strong {
  color: var(--red-600);
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  color: var(--blue-950);
  background: var(--white);
  box-shadow: inset 0 1px 0 rgba(8, 21, 44, 0.02), 0 2px 8px rgba(8, 21, 44, 0.03);
}

input,
select {
  min-height: 48px;
  padding: 0 14px;
}

textarea {
  min-height: 86px;
  resize: vertical;
  padding: 13px 14px;
}

input::placeholder,
textarea::placeholder {
  color: #7a8494;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(36, 114, 208, 0.78);
  box-shadow: 0 0 0 4px rgba(36, 114, 208, 0.12);
}

.check-field {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 13px;
  background: var(--soft);
}

.check-field input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  accent-color: var(--blue-700);
  box-shadow: none;
}

.method-note {
  border: 1px solid rgba(217, 119, 6, 0.2);
  border-radius: 12px;
  padding: 10px 12px;
  color: #8a4f05;
  background: rgba(217, 119, 6, 0.08);
  font-size: 14px;
}

.primary-button,
.secondary-button,
.ghost-button,
.small-button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--radius);
  font-weight: 800;
  letter-spacing: 0;
}

.primary-button {
  width: 100%;
  min-height: 46px;
  padding: 12px 18px;
  color: var(--white);
  background: #0957ff;
  box-shadow: 0 14px 22px rgba(9, 87, 255, 0.18);
}

.primary-button:hover {
  background: var(--blue-700);
}

.secondary-button,
.ghost-button,
.small-button {
  color: var(--blue-700);
  background: var(--blue-50);
}

.secondary-button:hover,
.ghost-button:hover,
.small-button:hover {
  background: #e4f1ff;
}

.ghost-button,
.small-button,
.text-button {
  min-height: 38px;
  padding: 9px 11px;
  font-size: 13px;
}

.text-button {
  color: #5f6b82;
  background: transparent;
}

.text-button:hover {
  color: var(--blue-700);
  background: var(--blue-50);
}

.empty-state {
  border: 1px dashed rgba(100, 116, 139, 0.32);
  border-radius: 14px;
  padding: 22px;
  color: var(--muted);
  background: rgba(247, 247, 247, 0.56);
}

.empty-state strong {
  display: block;
  margin-bottom: 5px;
  color: var(--blue-950);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.summary-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: var(--white);
}

.summary-item strong {
  display: block;
  color: var(--blue-950);
  font-size: 20px;
  line-height: 1.1;
}

.summary-item span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.quality-panel,
.export-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  border: 1px solid rgba(25, 135, 84, 0.2);
  border-radius: 14px;
  padding: 13px 14px;
  color: #175a3a;
  background: rgba(25, 135, 84, 0.07);
}

.quality-title,
.export-title {
  margin-bottom: 3px;
  color: var(--blue-950);
  font-weight: 800;
}

.export-panel {
  align-items: flex-start;
  margin-top: 16px;
  margin-bottom: 0;
  border-color: rgba(36, 114, 208, 0.2);
  color: #4f5d73;
  background: var(--blue-50);
}

.export-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.secondary-button {
  min-height: 38px;
  padding: 9px 11px;
  font-size: 13px;
}

.questionnaire {
  display: grid;
  gap: 18px;
}

.block {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--white);
}

.block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 15px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.block-header h3 {
  font-size: 16px;
}

.block-header p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.block-count {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--blue-700);
  background: var(--blue-50);
  font-size: 12px;
  font-weight: 800;
}

.question-list {
  display: grid;
}

.question-item {
  display: grid;
  gap: 12px;
  padding: 15px;
}

.question-item + .question-item {
  border-top: 1px solid var(--line);
}

.question-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.question-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 26px;
  border-radius: 999px;
  color: var(--white);
  background: var(--blue-700);
  font-size: 12px;
  font-weight: 900;
}

.question-title {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.question-title strong {
  color: var(--blue-950);
}

.question-actions {
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: var(--radius);
  color: #5f6b82;
  background: transparent;
  font-size: 16px;
  font-weight: 900;
}

.icon-button:hover {
  color: var(--blue-700);
  background: var(--blue-50);
}

.icon-button.danger:hover {
  color: var(--red-600);
  background: rgba(199, 54, 54, 0.08);
}

.question-text {
  min-height: 74px;
  line-height: 1.45;
}

.question-meta {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr);
  gap: 10px;
}

.mini-field {
  display: grid;
  gap: 5px;
}

.mini-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mini-field select {
  min-height: 40px;
  padding: 0 11px;
  border-radius: 10px;
  font-size: 14px;
}

.answer-preview,
.relevance-box,
.hypothesis-box {
  border-radius: 12px;
  padding: 10px 11px;
  color: #4f5d73;
  background: var(--soft);
  font-size: 13px;
}

.answer-preview strong,
.relevance-box strong,
.hypothesis-box strong {
  color: var(--blue-950);
}

.answer-preview ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 7px 0 0;
  padding: 0;
  list-style: none;
}

.answer-preview li {
  border-radius: 999px;
  padding: 3px 7px;
  color: #4f5d73;
  background: var(--white);
  font-size: 12px;
  font-weight: 700;
}

.relevance-box {
  border: 1px solid rgba(36, 114, 208, 0.16);
  background: rgba(36, 114, 208, 0.06);
}

.hypothesis-box {
  border: 1px solid rgba(217, 119, 6, 0.18);
  background: rgba(217, 119, 6, 0.07);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(360px, calc(100vw - 36px));
  transform: translateY(20px);
  border-radius: 10px;
  padding: 11px 14px;
  color: var(--white);
  background: var(--blue-950);
  box-shadow: 0 12px 28px rgba(8, 21, 44, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1100px) {
  .tool-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-strip {
    width: 100%;
  }

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

  .input-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .app-shell {
    width: min(100% - 24px, 1280px);
    padding-top: 24px;
  }

  .title-lockup,
  .result-top,
  .panel-heading,
  .quality-panel,
  .export-panel,
  .question-head {
    align-items: stretch;
    flex-direction: column;
  }

  .tool-mark {
    width: 54px;
    height: 54px;
  }

  .field-grid,
  .question-meta,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .result-actions,
  .export-actions,
  .question-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 460px) {
  .app-shell {
    width: min(100% - 18px, 1280px);
  }

  .input-panel,
  .result-panel {
    padding: 14px;
  }

  .brand-logo-full {
    width: min(230px, 78vw);
  }

  .status-strip {
    grid-template-columns: 1fr;
  }

  .status-strip span + span {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media print {
  body {
    background: white;
  }

  .topbar,
  .input-panel,
  .result-actions,
  .export-panel,
  .question-actions,
  .toast {
    display: none !important;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .workspace {
    display: block;
  }

  .panel,
  .block,
  .summary-item {
    border-color: #cfd8e5;
    box-shadow: none;
  }
}

@media (min-width: 980px) and (min-height: 680px) {
  .workspace {
    gap: 20px;
  }

  .input-panel {
    padding: 18px;
  }

  .field-grid {
    gap: 10px;
  }

  input,
  select {
    min-height: 42px;
    padding-inline: 12px;
  }

  textarea {
    height: 72px;
    min-height: 72px;
    padding: 10px 12px;
  }

  .check-field {
    padding: 10px 12px;
  }
}
