:root {
  --navy-950: #0b1f33;
  --navy-900: #102a43;
  --navy-800: #163a5f;

  --blue-700: #1f5f99;
  --blue-600: #2a6fa8;
  --blue-100: #eaf3fb;
  --blue-050: #f5f9fd;

  --red-600: #c43d3d;
  --red-700: #a93232;

  --green-600: #1f7a5a;

  --white: #ffffff;
  --surface: #f7f9fc;
  --surface-soft: #f2f5f8;

  --text-900: #17212b;
  --text-700: #3b4a59;
  --text-500: #667788;

  --border: #d8e0e8;
  --border-soft: #e7edf3;

  --assistant-bg: #f1f6fb;
  --assistant-border: #d9e8f5;

  --error-bg: #fdf1f1;
  --error-border: #efcaca;
  --error-text: #8d2929;

  --warning-bg: #fff8e8;
  --warning-border: #efd79a;
  --warning-text: #72541e;

  --shadow-sm: 0 6px 18px rgba(19, 42, 66, 0.07);
  --shadow-md: 0 14px 34px rgba(15, 31, 48, 0.10);
  --shadow-lg: 0 28px 70px rgba(10, 25, 41, 0.18);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 22px;
}


/* =========================================================
   BASE
   ========================================================= */

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  background:
    radial-gradient(circle at top left, rgba(42, 111, 168, 0.08), transparent 32%),
    linear-gradient(180deg, #eef3f8 0%, #f8fafc 100%);

  color: var(--text-900);
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}


/* =========================================================
   APP SHELL
   ========================================================= */

.app-shell {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 28px;
}

.chat-card {
  width: 100%;
  max-width: 1120px;
  height: 92vh;
  min-height: 680px;

  background: var(--white);
  border: 1px solid rgba(216, 224, 232, 0.9);
  border-radius: var(--radius-xl);
  overflow: hidden;

  box-shadow: var(--shadow-lg);

  display: flex;
  flex-direction: column;
}


/* =========================================================
   HEADER
   ========================================================= */

.chat-header {
  flex: 0 0 auto;

  background: linear-gradient(
    135deg,
    var(--navy-950),
    var(--navy-900)
  );

  color: var(--white);

  padding: 22px 28px;

  display: flex;
  justify-content: space-between;
  align-items: center;

  gap: 20px;

  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

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

.brand-icon {
  width: 46px;
  height: 46px;

  flex: 0 0 46px;

  display: grid;
  place-items: center;

  border-radius: 12px;

  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.18);

  color: var(--white);

  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.brand-copy {
  min-width: 0;
}

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

.chat-header h1 {
  margin: 0;

  font-size: 24px;
  line-height: 1.2;

  font-weight: 700;
  letter-spacing: -0.02em;
}

.chat-header p {
  margin: 5px 0 0;

  color: rgba(255, 255, 255, 0.76);

  font-size: 14px;
  line-height: 1.4;
}

.beta-badge {
  display: inline-flex;
  align-items: center;

  min-height: 22px;

  padding: 3px 8px;

  border-radius: 999px;

  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.20);

  color: var(--white);

  font-size: 10px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-badge {
  display: inline-flex;
  align-items: center;

  white-space: nowrap;

  color: #d8f6e9;

  font-size: 13px;
  font-weight: 600;
}

.danger-btn {
  min-height: 40px;

  padding: 9px 14px;

  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 9px;

  background: rgba(255, 255, 255, 0.10);
  color: var(--white);

  font-size: 13px;
  font-weight: 650;

  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    transform 0.1s ease;
}

.danger-btn:hover {
  background: rgba(255, 255, 255, 0.17);
  border-color: rgba(255, 255, 255, 0.28);
}

.danger-btn:active {
  transform: translateY(1px);
}


/* =========================================================
   CHAT WINDOW
   ========================================================= */

.chat-window {
  flex: 1 1 auto;

  min-height: 0;

  overflow-y: auto;
  overflow-x: hidden;

  padding: 30px 32px;

  background:
    linear-gradient(
      180deg,
      var(--white) 0%,
      #fbfcfe 100%
    );
}

.message-row {
  display: flex;
  gap: 12px;

  margin-bottom: 22px;

  align-items: flex-start;
}

.message-row.user {
  justify-content: flex-end;
}

.message-row.user .avatar {
  display: none;
}

.avatar {
  width: 38px;
  height: 38px;

  flex: 0 0 38px;

  display: grid;
  place-items: center;

  border-radius: 10px;

  background: var(--navy-900);
  color: var(--white);

  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;

  box-shadow: var(--shadow-sm);
}

.message-bubble {
  max-width: 72%;

  padding: 15px 17px;

  border-radius: 14px;

  line-height: 1.58;

  overflow-wrap: anywhere;
}

.message-bubble strong {
  display: block;

  margin-bottom: 6px;

  font-size: 14px;
  font-weight: 700;
}

.message-bubble p {
  margin: 0;

  font-size: 15px;
  color: inherit;
}

.assistant .message-bubble {
  background: var(--assistant-bg);

  border: 1px solid var(--assistant-border);

  color: var(--text-900);
}

.user .message-bubble {
  background: var(--navy-900);

  color: var(--white);

  box-shadow: var(--shadow-sm);
}

.user .message-bubble strong {
  color: var(--white);
}


/* =========================================================
   CUSTOMER PROFILE FORM
   ========================================================= */

.customer-form-container {
  width: 100%;

  margin-top: 8px;
}

.customer-form {
  width: 100%;

  padding: 26px;

  border: 1px solid var(--border);
  border-radius: 18px;

  background: var(--surface);

  box-shadow: 0 8px 24px rgba(20, 40, 60, 0.04);
}

.customer-form-header {
  margin-bottom: 24px;
}

.section-eyebrow {
  display: block;

  margin-bottom: 7px;

  color: var(--blue-700);

  font-size: 11px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.09em;
}

.customer-form-header h2 {
  margin: 0 0 8px;

  font-size: 26px;
  line-height: 1.2;

  font-weight: 700;
  letter-spacing: -0.02em;
}

.customer-form-header p {
  margin: 0;

  max-width: 720px;

  color: var(--text-500);

  line-height: 1.55;
  font-size: 14px;
}

.customer-form-error {
  margin-bottom: 18px;

  padding: 13px 15px;

  border: 1px solid var(--error-border);
  border-radius: 10px;

  background: var(--error-bg);

  color: var(--error-text);

  line-height: 1.45;
  font-weight: 600;
}


/* =========================================================
   FORM SECTIONS
   ========================================================= */

.form-section {
  margin-top: 20px;

  padding: 21px;

  border: 1px solid var(--border-soft);
  border-radius: 15px;

  background: var(--white);

  box-shadow: var(--shadow-sm);
}

.form-section:first-of-type {
  margin-top: 0;
}

.form-section-header {
  display: flex;
  align-items: flex-start;

  gap: 12px;

  margin-bottom: 18px;

  padding-bottom: 15px;

  border-bottom: 1px solid var(--border-soft);
}

.form-step-number {
  width: 32px;
  height: 32px;

  flex: 0 0 32px;

  display: grid;
  place-items: center;

  border-radius: 8px;

  background: var(--navy-900);

  color: var(--white);

  font-size: 13px;
  font-weight: 750;
}

.form-section-header h3 {
  margin: 0 0 4px;

  font-size: 18px;
  line-height: 1.3;

  font-weight: 700;
}

.form-section-header p {
  margin: 0;

  color: var(--text-500);

  font-size: 13px;
  line-height: 1.45;
}

.form-helper-text {
  margin: 14px 0 0;

  padding: 12px 13px;

  border-left: 3px solid var(--blue-600);
  border-radius: 7px;

  background: var(--blue-050);

  color: var(--text-700);

  font-size: 13px;
  line-height: 1.5;
}


/* =========================================================
   FORM GRID
   ========================================================= */

.form-grid {
  display: grid;

  grid-template-columns: repeat(2, minmax(0, 1fr));

  gap: 16px;
}

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

.form-field {
  min-width: 0;

  display: flex;
  flex-direction: column;

  gap: 7px;
}

.form-field-wide {
  grid-column: 1 / -1;
}

.form-field > span,
.form-field > label {
  color: var(--text-700);

  font-size: 13px;
  font-weight: 650;
}


/* =========================================================
   INPUTS
   ========================================================= */

.form-field input,
.form-field select {
  width: 100%;
  min-width: 0;

  min-height: 44px;

  padding: 10px 12px;

  border: 1px solid var(--border);
  border-radius: 9px;

  background: var(--white);

  color: var(--text-900);

  font-size: 15px;

  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease;
}

.form-field input::placeholder {
  color: #9aa7b3;
}

.form-field input:hover,
.form-field select:hover {
  border-color: #aebdca;
}

.form-field input:focus,
.form-field select:focus {
  outline: none;

  border-color: var(--blue-600);

  box-shadow:
    0 0 0 3px rgba(42, 111, 168, 0.12);
}

.form-field input:disabled,
.form-field select:disabled {
  cursor: not-allowed;

  opacity: 0.7;

  background: var(--surface-soft);
}


/* =========================================================
   CURRENCY INPUT
   ========================================================= */

.currency-input {
  width: 100%;
  min-height: 44px;

  display: flex;
  align-items: center;

  overflow: hidden;

  border: 1px solid var(--border);
  border-radius: 9px;

  background: var(--white);

  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.currency-input:focus-within {
  border-color: var(--blue-600);

  box-shadow:
    0 0 0 3px rgba(42, 111, 168, 0.12);
}

.currency-input > span {
  min-height: 42px;

  display: flex;
  align-items: center;

  padding: 0 12px;

  border-right: 1px solid var(--border-soft);

  background: var(--surface-soft);

  color: var(--text-500);

  font-weight: 650;
}

.currency-input input {
  min-height: 42px;

  border: none;
  border-radius: 0;

  box-shadow: none;
}

.currency-input input:hover,
.currency-input input:focus {
  border: none;
  box-shadow: none;
}


/* =========================================================
   COVERAGE TOTAL
   ========================================================= */

.total-coverage-display {
  min-height: 104px;

  justify-content: center;

  padding: 17px;

  border: 1px solid #cdddec;
  border-radius: 11px;

  background: var(--blue-050);
}

.total-coverage-display > span {
  color: var(--text-700);
}

.total-coverage-display strong {
  display: block;

  color: var(--navy-900);

  font-size: 28px;
  line-height: 1.2;

  letter-spacing: -0.02em;
}

.total-coverage-display small {
  color: var(--text-500);

  line-height: 1.4;
}


/* =========================================================
   MODEL NOTE
   ========================================================= */

.model-note {
  margin-top: 16px;

  padding: 13px 15px;

  border: 1px solid var(--warning-border);
  border-radius: 10px;

  background: var(--warning-bg);

  color: var(--warning-text);
}

.model-note strong {
  display: block;

  margin-bottom: 4px;

  font-size: 13px;
}

.model-note p {
  margin: 0;

  font-size: 13px;
  line-height: 1.5;
}


/* =========================================================
   FORM ACTIONS
   ========================================================= */

.customer-form-actions {
  margin-top: 24px;
}

.primary-btn {
  width: 100%;

  min-height: 48px;

  padding: 13px 18px;

  border: none;
  border-radius: 10px;

  background: var(--navy-900);

  color: var(--white);

  font-size: 15px;
  font-weight: 700;

  cursor: pointer;

  transition:
    background-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.1s ease;
}

.primary-btn:hover {
  background: var(--navy-800);

  box-shadow:
    0 8px 18px rgba(16, 42, 67, 0.16);
}

.primary-btn:active {
  transform: translateY(1px);
}

.primary-btn:disabled {
  background: #a6b0ba;

  cursor: not-allowed;

  box-shadow: none;
}

.customer-form-security {
  margin: 14px 0 0;

  color: var(--text-500);

  font-size: 12px;
  line-height: 1.45;

  text-align: center;
}


/* =========================================================
   CHAT INPUT
   ========================================================= */

.chat-form {
  flex: 0 0 auto;

  display: flex;
  gap: 10px;

  padding: 14px 22px;

  background: var(--white);

  border-top: 1px solid var(--border-soft);
}

.chat-form input {
  flex: 1;

  min-width: 0;
  min-height: 48px;

  padding: 12px 14px;

  border: 1px solid var(--border);
  border-radius: 10px;

  background: var(--white);

  color: var(--text-900);

  font-size: 15px;

  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.chat-form input:focus {
  outline: none;

  border-color: var(--blue-600);

  box-shadow:
    0 0 0 3px rgba(42, 111, 168, 0.12);
}

.chat-form button {
  min-width: 92px;
  min-height: 48px;

  padding: 0 20px;

  border: none;
  border-radius: 10px;

  background: var(--navy-900);

  color: var(--white);

  font-size: 14px;
  font-weight: 700;

  cursor: pointer;

  transition:
    background-color 0.2s ease,
    transform 0.1s ease;
}

.chat-form button:hover {
  background: var(--navy-800);
}

.chat-form button:active {
  transform: translateY(1px);
}

.chat-form button:disabled {
  background: #a6b0ba;

  cursor: not-allowed;
}

.hint {
  flex: 0 0 auto;

  margin: -4px 0 10px;

  text-align: center;

  color: var(--text-500);

  font-size: 12px;
}


/* =========================================================
   FOOTER
   ========================================================= */

.footer {
  flex: 0 0 auto;

  padding: 12px 22px;

  background: var(--navy-950);

  color: var(--white);

  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.footer-main {
  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 16px;

  flex-wrap: wrap;
}

.footer-product {
  display: flex;
  align-items: center;

  gap: 9px;

  color: rgba(255, 255, 255, 0.82);

  font-size: 12px;
  font-weight: 550;
}

.footer-beta {
  display: inline-flex;
  align-items: center;

  padding: 3px 7px;

  border-radius: 999px;

  background: rgba(255, 255, 255, 0.10);

  border: 1px solid rgba(255, 255, 255, 0.18);

  font-size: 9px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.limitations-details {
  position: relative;

  margin-left: auto;
}

.limitations-details summary {
  list-style: none;

  cursor: pointer;

  color: rgba(255, 255, 255, 0.84);

  font-size: 12px;
  font-weight: 600;

  transition: color 0.18s ease;
}

.limitations-details summary::-webkit-details-marker {
  display: none;
}

.limitations-details summary:hover {
  color: var(--white);
}

.limitations-panel {
  position: absolute;

  right: 0;
  bottom: calc(100% + 12px);

  width: min(460px, 86vw);

  max-height: 420px;

  overflow-y: auto;

  padding: 20px;

  border: 1px solid var(--border);
  border-radius: 14px;

  background: var(--white);

  color: var(--text-900);

  text-align: left;

  box-shadow: var(--shadow-md);

  z-index: 30;
}

.limitations-panel h3 {
  margin: 0 0 10px;

  font-size: 18px;
}

.limitations-panel > p {
  margin: 0 0 12px;

  color: var(--text-700);

  font-size: 13px;
  line-height: 1.55;
}

.limitations-panel ul {
  margin: 0;

  padding-left: 20px;
}

.limitations-panel li {
  margin-bottom: 10px;

  color: var(--text-700);

  font-size: 13px;
  line-height: 1.5;
}

.limitations-panel li strong {
  color: var(--text-900);
}

.limitations-panel .limitations-footnote {
  margin-top: 14px;

  padding-top: 12px;

  border-top: 1px solid var(--border-soft);

  color: var(--text-500);
}


/* =========================================================
   SCROLLBAR
   ========================================================= */

.chat-window::-webkit-scrollbar,
.limitations-panel::-webkit-scrollbar {
  width: 9px;
}

.chat-window::-webkit-scrollbar-track,
.limitations-panel::-webkit-scrollbar-track {
  background: transparent;
}

.chat-window::-webkit-scrollbar-thumb,
.limitations-panel::-webkit-scrollbar-thumb {
  background: #c6d0da;

  border-radius: 999px;

  border: 2px solid transparent;

  background-clip: content-box;
}

.chat-window::-webkit-scrollbar-thumb:hover,
.limitations-panel::-webkit-scrollbar-thumb:hover {
  background: #aebbc7;

  background-clip: content-box;
}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 900px) {
  .app-shell {
    padding: 14px;
  }

  .chat-card {
    height: calc(100vh - 28px);

    min-height: 0;

    border-radius: 18px;
  }

  .chat-header {
    padding: 18px 20px;
  }

  .chat-window {
    padding: 22px;
  }

  .message-bubble {
    max-width: 82%;
  }

  .customer-form {
    padding: 20px;
  }

  .form-section {
    padding: 18px;
  }
}


/* =========================================================
   SMALL TABLET
   ========================================================= */

@media (max-width: 760px) {
  .form-grid,
  .indicator-grid {
    grid-template-columns: 1fr;
  }

  .form-field-wide {
    grid-column: auto;
  }

  .chat-header {
    flex-direction: column;

    align-items: stretch;
  }

  .header-actions {
    justify-content: space-between;
  }

  .footer-main {
    align-items: flex-start;
  }

  .limitations-details {
    margin-left: 0;
  }

  .limitations-panel {
    right: auto;
    left: 0;
  }
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 700px) {
  body {
    background: var(--white);
  }

  .app-shell {
    min-height: 100dvh;

    padding: 0;

    align-items: stretch;
  }

  .chat-card {
    width: 100%;
    height: 100dvh;

    min-height: 100dvh;
    max-width: none;

    border: none;
    border-radius: 0;

    box-shadow: none;
  }

  .chat-header {
    padding:
      max(16px, env(safe-area-inset-top))
      16px
      16px;

    flex-direction: column;

    align-items: stretch;

    gap: 14px;
  }

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

  .brand-icon {
    width: 40px;
    height: 40px;

    flex-basis: 40px;

    border-radius: 10px;
  }

  .chat-header h1 {
    font-size: 20px;
  }

  .chat-header p {
    font-size: 13px;
  }

  .header-actions {
    width: 100%;

    justify-content: space-between;

    gap: 10px;
  }

  .status-badge {
    font-size: 13px;
  }

  .danger-btn {
    min-height: 38px;

    padding: 8px 12px;
  }

  .chat-window {
    padding: 16px;
  }

  .message-row {
    gap: 9px;

    margin-bottom: 16px;
  }

  .avatar {
    width: 34px;
    height: 34px;

    flex-basis: 34px;

    border-radius: 9px;
  }

  .message-bubble {
    max-width: calc(100% - 44px);

    padding: 12px 14px;

    border-radius: 12px;

    font-size: 14px;
  }

  .message-row.user .message-bubble {
    max-width: 88%;
  }

  .customer-form-container {
    margin-top: 4px;
  }

  .customer-form {
    padding: 14px;

    border-radius: 14px;
  }

  .customer-form-header {
    margin-bottom: 16px;
  }

  .customer-form-header h2 {
    font-size: 21px;
  }

  .customer-form-header p {
    font-size: 13px;
  }

  .form-section {
    margin-top: 16px;

    padding: 15px;

    border-radius: 13px;
  }

  .form-section-header {
    margin-bottom: 15px;

    padding-bottom: 12px;
  }

  .form-step-number {
    width: 30px;
    height: 30px;

    flex-basis: 30px;

    border-radius: 7px;

    font-size: 13px;
  }

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

  .form-section-header p {
    font-size: 12px;
  }

  .form-grid,
  .indicator-grid {
    grid-template-columns: 1fr;

    gap: 14px;
  }

  .form-field-wide {
    grid-column: auto;
  }

  .form-field input,
  .form-field select {
    min-height: 46px;

    font-size: 16px;
  }

  .currency-input {
    min-height: 46px;
  }

  .currency-input > span,
  .currency-input input {
    min-height: 44px;
  }

  .total-coverage-display {
    min-height: 96px;
  }

  .total-coverage-display strong {
    font-size: 24px;
  }

  .customer-form-actions {
    margin-top: 20px;
  }

  .primary-btn {
    min-height: 48px;
  }

  .customer-form-security {
    font-size: 11px;
  }

  .chat-form {
    flex-direction: column;

    gap: 9px;

    padding:
      12px
      14px
      max(12px, env(safe-area-inset-bottom));
  }

  .chat-form input {
    width: 100%;

    min-height: 48px;
  }

  .chat-form button {
    width: 100%;

    min-height: 46px;

    padding: 11px 16px;
  }

  .hint {
    display: none;
  }

  .footer {
    padding:
      12px
      14px
      max(12px, env(safe-area-inset-bottom));
  }

  .footer-main {
    flex-direction: column;

    gap: 8px;
  }

  .footer-product {
    font-size: 11px;
  }

  .limitations-panel {
    position: fixed;

    left: 14px;
    right: 14px;
    bottom: 70px;

    width: auto;

    max-height: 55vh;
  }
}


/* =========================================================
   SMALL PHONES
   ========================================================= */

@media (max-width: 420px) {
  .chat-header {
    padding-left: 14px;
    padding-right: 14px;
  }

  .chat-header h1 {
    font-size: 18px;
  }

  .header-actions {
    align-items: center;
  }

  .status-badge {
    font-size: 12px;
  }

  .danger-btn {
    font-size: 12px;
  }

  .chat-window {
    padding: 12px;
  }

  .customer-form {
    padding: 12px;
  }

  .customer-form-header h2 {
    font-size: 19px;
  }

  .form-section {
    padding: 13px;
  }

  .form-section-header {
    gap: 10px;
  }

  .form-section-header h3 {
    font-size: 15px;
  }

  .total-coverage-display strong {
    font-size: 22px;
  }
}