@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&family=Playfair+Display:wght@600;700&display=swap");

:root {
  --quintus-navy: #0f2a3f;
  --deep-navy: #081c2b;
  --classic-gold: #d4af37;
  --soft-gold: #e6c768;
  --off-white: #f5f5f2;
  --slate-grey: #6b7280;
  --ink: #17212b;
  --line: #d8d4c9;
  --surface: #ffffff;
  --shadow: 0 18px 45px rgba(8, 28, 43, 0.1);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--off-white);
  color: var(--ink);
  font-family: "Montserrat", Arial, sans-serif;
  letter-spacing: 0;
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

.app-root {
  min-height: 100vh;
}

.topbar {
  background: #fff;
  color: var(--quintus-navy);
  border-bottom: 1px solid rgba(15, 42, 63, 0.1);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 16px 24px;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 174px;
  min-width: 174px;
  height: 78px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-home {
  cursor: pointer;
}

.brand-home:focus-visible {
  outline: 2px solid var(--classic-gold);
  outline-offset: 4px;
}

.brand h1 {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(26px, 3vw, 42px);
  line-height: 1.05;
  font-weight: 700;
}

.brand p {
  margin: 5px 0 0;
  color: var(--slate-grey);
  font-size: 14px;
}

.internal-banner {
  background: var(--deep-navy);
  color: rgba(255, 255, 255, 0.86);
  border-bottom: 3px solid var(--classic-gold);
}

.internal-banner div {
  max-width: 1240px;
  margin: 0 auto;
  padding: 9px 24px;
  font-size: 13px;
  font-weight: 600;
}

.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 42px;
}

.workbench {
  min-width: 0;
}

.panel {
  background: var(--surface);
  border: 1px solid rgba(15, 42, 63, 0.11);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-panel {
  padding: clamp(26px, 4vw, 44px);
}

.gold-rule {
  width: 78px;
  height: 3px;
  margin-bottom: 22px;
  background: var(--classic-gold);
}

.screen-title {
  margin: 0;
  color: var(--quintus-navy);
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.02;
  font-weight: 700;
}

.screen-subtitle {
  margin: 12px 0 0;
  color: var(--slate-grey);
  font-size: 17px;
  line-height: 1.6;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin: 32px 0 16px;
}

.section-heading h2 {
  margin: 0;
  color: var(--quintus-navy);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 28px;
  line-height: 1.15;
}

.section-heading p {
  max-width: 520px;
  margin: 0;
  color: var(--slate-grey);
  line-height: 1.55;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  max-width: 560px;
}

.tool-card {
  min-height: 190px;
}

.document-compare-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(380px, 0.98fr);
  gap: 18px;
  margin-top: 18px;
}

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

.document-input-card {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.document-input-card h3 {
  margin: 0;
  color: var(--quintus-navy);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 22px;
  line-height: 1.15;
}

.document-drop-zone {
  display: grid;
  gap: 7px;
  min-height: 128px;
  padding: 18px;
  color: var(--slate-grey);
  background: #fff;
  border: 1px dashed rgba(15, 42, 63, 0.28);
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.document-drop-zone.drag-over,
.document-drop-zone:hover {
  background: rgba(212, 175, 55, 0.08);
  border-color: var(--classic-gold);
  box-shadow: 0 10px 22px rgba(8, 28, 43, 0.08);
}

.document-drop-zone span {
  color: var(--quintus-navy);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.document-drop-zone strong {
  color: var(--quintus-navy);
  font-size: 15px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.document-drop-zone small {
  color: var(--slate-grey);
  font-size: 12px;
  line-height: 1.4;
}

.document-textarea {
  min-height: 190px;
  resize: vertical;
}

.comparison-result-panel {
  align-self: start;
}

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

.comparison-summary div {
  padding: 12px;
  background: var(--off-white);
  border: 1px solid rgba(15, 42, 63, 0.1);
  border-radius: var(--radius);
}

.comparison-summary span {
  display: block;
  margin-bottom: 4px;
  color: var(--slate-grey);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.comparison-summary strong {
  color: var(--quintus-navy);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 26px;
  line-height: 1;
}

.comparison-document {
  display: grid;
  gap: 8px;
  max-height: 620px;
  padding: 16px;
  overflow: auto;
  background: #fff;
  border: 1px solid rgba(15, 42, 63, 0.12);
  border-radius: var(--radius);
}

.diff-line {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 9px 10px;
  border-radius: calc(var(--radius) - 2px);
  line-height: 1.5;
}

.diff-marker {
  min-height: 22px;
  padding-top: 1px;
  color: var(--slate-grey);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.diff-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.diff-removed {
  color: #7b251d;
  background: #fff5f2;
  border: 1px solid #f2c4ba;
}

.diff-removed .diff-text {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.diff-added {
  color: #175f32;
  background: #effaf2;
  border: 1px solid #b8e3c5;
}

.diff-added .diff-text {
  font-weight: 700;
}

.diff-unchanged {
  color: var(--quintus-navy);
  background: rgba(245, 245, 242, 0.65);
}

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

.choice-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 220px;
  padding: 22px;
  background: #fff;
  border: 1px solid rgba(15, 42, 63, 0.13);
  border-radius: var(--radius);
  box-shadow: 0 10px 24px rgba(8, 28, 43, 0.06);
}

.choice-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--classic-gold);
  border-radius: var(--radius) 0 0 var(--radius);
  opacity: 0.9;
}

.choice-card.coming-soon {
  opacity: 0.7;
}

.choice-card h3 {
  margin: 0;
  color: var(--quintus-navy);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 24px;
  line-height: 1.15;
}

.choice-card p {
  margin: 0;
  color: var(--slate-grey);
  font-size: 14px;
  line-height: 1.58;
}

.choice-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}

.choice-card footer.footer-no-tag {
  justify-content: flex-end;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  color: var(--quintus-navy);
  background: rgba(212, 175, 55, 0.13);
  border: 1px solid rgba(212, 175, 55, 0.28);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.btn:not(:disabled):hover {
  transform: translateY(-1px);
}

.btn-primary {
  color: var(--deep-navy);
  background: var(--classic-gold);
  box-shadow: 0 10px 18px rgba(212, 175, 55, 0.22);
}

.btn-primary:not(:disabled):hover {
  background: var(--soft-gold);
}

.btn-secondary {
  color: #fff;
  background: var(--quintus-navy);
}

.btn-secondary:not(:disabled):hover {
  background: var(--deep-navy);
}

.btn-ghost {
  color: var(--quintus-navy);
  background: #fff;
  border-color: rgba(15, 42, 63, 0.2);
}

.btn-ghost:not(:disabled):hover {
  border-color: var(--classic-gold);
}

.btn[disabled] {
  opacity: 0.52;
}

.indication-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: 18px;
  margin-top: 18px;
}

.indication-section {
  padding-top: 18px;
  margin-top: 18px;
  border-top: 1px solid rgba(15, 42, 63, 0.1);
}

.indication-section h3,
.breakdown-group h3 {
  margin: 0 0 14px;
  color: var(--quintus-navy);
  font-size: 15px;
  line-height: 1.3;
}

.indication-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.indication-grid-compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.indication-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.indication-field span {
  color: var(--quintus-navy);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.indication-field input,
.indication-field select {
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(15, 42, 63, 0.18);
  border-radius: var(--radius);
  outline: none;
}

.indication-field input:focus,
.indication-field select:focus {
  border-color: var(--classic-gold);
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.15);
}

.indication-field input[readonly] {
  color: var(--slate-grey);
  background: var(--off-white);
}

.indication-field small {
  min-height: 32px;
  color: var(--slate-grey);
  font-size: 11px;
  line-height: 1.45;
}

.disclaimer-box {
  margin: 16px 0;
  padding: 13px 14px;
  color: var(--deep-navy);
  background: rgba(212, 175, 55, 0.13);
  border: 1px solid rgba(212, 175, 55, 0.34);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.55;
}

.referral-box {
  padding: 16px;
  color: #7b251d;
  background: #fff5f2;
  border: 1px solid #f2c4ba;
  border-radius: var(--radius);
  line-height: 1.55;
}

.referral-box p {
  margin: 8px 0 0;
}

.premium-lines {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.premium-lines div,
.breakdown-group li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(15, 42, 63, 0.1);
}

.premium-lines dt,
.premium-lines dd {
  margin: 0;
}

.premium-lines dt,
.breakdown-group span {
  color: var(--slate-grey);
  font-size: 13px;
  line-height: 1.45;
}

.premium-lines dd,
.breakdown-group strong {
  color: var(--quintus-navy);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.premium-lines .premium-total {
  margin-top: 4px;
  padding: 14px;
  background: var(--deep-navy);
  border-bottom: 0;
  border-radius: var(--radius);
}

.premium-total dt,
.premium-total dd {
  color: #fff;
}

.breakdown-group {
  margin-top: 18px;
}

.breakdown-group ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.query-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(320px, 0.94fr);
  gap: 18px;
}

.form-panel,
.response-panel {
  padding: 24px;
}

.form-panel h2,
.response-panel h2 {
  margin: 0;
  color: var(--quintus-navy);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 30px;
}

.instruction {
  margin: 10px 0 20px;
  color: var(--slate-grey);
  line-height: 1.55;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--quintus-navy);
  font-size: 13px;
  font-weight: 700;
}

.textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  padding: 16px;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(15, 42, 63, 0.18);
  border-radius: var(--radius);
  outline: none;
  line-height: 1.55;
}

.textarea:focus {
  border-color: var(--classic-gold);
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.15);
}

.upload-area {
  margin-top: 16px;
  padding: 16px;
  background: rgba(15, 42, 63, 0.03);
  border: 1px dashed rgba(15, 42, 63, 0.24);
  border-radius: var(--radius);
}

.upload-area input {
  width: 100%;
}

.file-control {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

.file-control span {
  min-width: 0;
  color: var(--slate-grey);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.file-picker {
  flex: 0 0 auto;
}

.upload-note {
  margin: 8px 0 0;
  color: var(--slate-grey);
  font-size: 12px;
  line-height: 1.5;
}

.file-summary {
  margin-top: 12px;
  padding: 12px;
  color: var(--quintus-navy);
  background: #fff;
  border: 1px solid rgba(15, 42, 63, 0.1);
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.5;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}

.response-box {
  min-height: 324px;
  margin-top: 18px;
  padding: 18px;
  background: var(--off-white);
  border: 1px solid rgba(15, 42, 63, 0.11);
  border-radius: var(--radius);
  color: var(--ink);
  line-height: 1.65;
  white-space: pre-wrap;
}

.response-empty {
  color: var(--slate-grey);
}

.error-box {
  margin-top: 16px;
  padding: 12px 14px;
  color: #7b251d;
  background: #fff5f2;
  border: 1px solid #f2c4ba;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.5;
}

.chatkit-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  justify-content: flex-end;
}

.chatkit-scrim {
  position: absolute;
  inset: 0;
  background: rgba(8, 28, 43, 0.46);
}

.chatkit-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(720px, calc(100vw - 36px));
  height: calc(100vh - 28px);
  margin: 14px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(230, 199, 104, 0.45);
  border-radius: var(--radius);
  box-shadow: 0 24px 70px rgba(8, 28, 43, 0.28);
}

.chatkit-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px;
  color: #fff;
  background: var(--deep-navy);
  border-bottom: 3px solid var(--classic-gold);
}

.chatkit-panel-header span {
  display: block;
  margin-bottom: 5px;
  color: var(--soft-gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.chatkit-panel-header h2 {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 25px;
  line-height: 1.15;
}

.chatkit-close {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 12px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
}

.chatkit-close:hover {
  background: rgba(255, 255, 255, 0.14);
}

.chatkit-context {
  padding: 14px 22px;
  background: var(--off-white);
  border-bottom: 1px solid rgba(15, 42, 63, 0.1);
}

.chatkit-context strong {
  display: block;
  color: var(--quintus-navy);
  font-size: 13px;
}

.chatkit-context p {
  margin: 6px 0 0;
  color: var(--slate-grey);
  font-size: 12px;
  line-height: 1.45;
}

.chatkit-state {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin: auto;
  max-width: 420px;
  padding: 24px;
  text-align: center;
  color: var(--slate-grey);
}

.chatkit-state strong {
  color: var(--quintus-navy);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 25px;
  line-height: 1.15;
}

.chatkit-state p {
  margin: 0;
  line-height: 1.55;
}

.chatkit-state-error {
  border: 1px solid #f2c4ba;
  border-radius: var(--radius);
  background: #fff5f2;
}

.chatkit-mount {
  flex: 1;
  min-height: 0;
  background: #fff;
}

.chatkit-widget {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 520px;
}

.loading {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--slate-grey);
  font-size: 13px;
  font-weight: 600;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(15, 42, 63, 0.18);
  border-top-color: var(--classic-gold);
  border-radius: 999px;
  animation: spin 900ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

@media (max-width: 980px) {
  .document-compare-layout,
  .indication-layout,
  .query-layout {
    grid-template-columns: 1fr;
  }

  .document-upload-grid,
  .card-grid,
  .tool-grid,
  .pathway-grid {
    grid-template-columns: 1fr;
  }
}

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

  .brand {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand-mark {
    width: 146px;
    min-width: 146px;
    height: 66px;
  }

  .internal-banner div,
  .layout {
    padding-left: 16px;
    padding-right: 16px;
  }

  .hero-panel,
  .form-panel,
  .response-panel {
    padding: 20px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .choice-card {
    min-height: 0;
  }

  .comparison-summary {
    grid-template-columns: 1fr;
  }

  .diff-line {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .indication-grid,
  .indication-grid-compact {
    grid-template-columns: 1fr;
  }

  .premium-lines div,
  .breakdown-group li {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .premium-lines dd,
  .breakdown-group strong {
    text-align: left;
    white-space: normal;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .form-actions .button-row,
  .form-actions .btn {
    width: 100%;
  }

  .chatkit-overlay {
    align-items: stretch;
    justify-content: center;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  .chatkit-panel {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .chatkit-panel-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 12px;
    padding: 12px 14px;
  }

  .chatkit-panel-header span {
    margin-bottom: 3px;
    font-size: 10px;
    letter-spacing: 0.04em;
  }

  .chatkit-panel-header h2 {
    display: -webkit-box;
    overflow: hidden;
    font-size: 18px;
    line-height: 1.12;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .chatkit-close {
    width: auto;
    min-height: 34px;
    padding: 7px 10px;
  }

  .chatkit-context {
    flex: 0 0 auto;
    padding: 8px 14px;
  }

  .chatkit-context strong {
    font-size: 12px;
  }

  .chatkit-context p {
    display: none;
  }

  .chatkit-mount {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  .chatkit-widget {
    height: 100%;
    min-height: 0;
  }
}

@media (max-width: 700px) and (max-height: 640px) {
  .chatkit-context {
    display: none;
  }
}
