:root {
  color-scheme: light;
  --brand: #253fbd;
  --brand-dark: #172878;
  --brand-soft: #eef2ff;
  --ink: #10182f;
  --muted: #68718a;
  --line: #dce2f0;
  --surface: #ffffff;
  --canvas: #f5f7fc;
  --success: #12a36e;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 4%, #e8edff 0, transparent 30rem),
    linear-gradient(145deg, #f9faff 0%, #eef2fa 100%);
}

button,
textarea,
input {
  font: inherit;
}

button,
a,
label {
  -webkit-tap-highlight-color: transparent;
}

.page-shell {
  min-height: 100vh;
  width: min(1180px, 100%);
  margin: auto;
  padding: 32px;
  display: grid;
  grid-template-columns: minmax(0, 720px) minmax(280px, 1fr);
  gap: 28px;
  align-items: center;
}

.appeal-card,
.confidence-panel {
  border: 1px solid rgba(201, 209, 228, 0.85);
  box-shadow: 0 24px 70px rgba(41, 55, 105, 0.13);
}

.appeal-card {
  height: min(820px, calc(100vh - 64px));
  min-height: 620px;
  background: var(--surface);
  border-radius: 28px;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
}

.brand-header {
  color: white;
  background: linear-gradient(130deg, var(--brand) 0%, var(--brand-dark) 100%);
  padding: 24px 26px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 17px;
  background: white;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, 0.25);
}

.brand-mark span {
  width: 6px;
  height: 11px;
  border-radius: 99px;
  background: var(--brand);
}

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

.eyebrow {
  margin: 0 0 4px;
  font-weight: 750;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
}

.brand-copy h1 {
  margin: 0 0 5px;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  letter-spacing: -0.025em;
}

.brand-copy > p:last-child {
  margin: 0;
  color: #dfe5ff;
  font-size: 0.85rem;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: #50e3a4;
  box-shadow: 0 0 0 4px rgba(80, 227, 164, 0.16);
}

.reset-button {
  border: 1px solid rgba(255, 255, 255, 0.38);
  color: white;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
}

.reset-button:hover,
.reset-button:focus-visible {
  background: rgba(255, 255, 255, 0.2);
}

.messages {
  min-height: 0;
  padding: 24px;
  overflow-y: auto;
  scroll-behavior: smooth;
  background:
    linear-gradient(rgba(255, 255, 255, 0.91), rgba(255, 255, 255, 0.91)),
    radial-gradient(circle, #dfe5f4 1.4px, transparent 1.4px);
  background-size: auto, 22px 22px;
}

.message {
  display: flex;
  margin: 0 0 15px;
  animation: message-in 180ms ease-out both;
}

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

.bubble {
  max-width: min(86%, 560px);
  padding: 13px 16px;
  border-radius: 18px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.assistant .bubble {
  background: white;
  border: 1px solid var(--line);
  border-bottom-left-radius: 5px;
  box-shadow: 0 7px 25px rgba(55, 67, 106, 0.08);
}

.user .bubble {
  color: white;
  background: var(--brand);
  border-bottom-right-radius: 5px;
}

.bubble a {
  color: var(--brand);
  font-weight: 700;
}

.user .bubble a {
  color: white;
}

.message-file {
  display: flex;
  align-items: center;
  gap: 9px;
}

.message-file::before {
  content: "↥";
  width: 27px;
  height: 27px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.18);
}

.typing {
  width: fit-content;
  margin: 0 24px 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 16px 16px 16px 5px;
  background: white;
}

.typing span:not(.sr-only) {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 0 2px;
  border-radius: 50%;
  background: #8790a8;
  animation: bounce 900ms infinite alternate;
}

.typing span:nth-child(2) {
  animation-delay: 150ms;
}

.typing span:nth-child(3) {
  animation-delay: 300ms;
}

.quick-options {
  padding: 0 24px 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.option-button,
.payment-button {
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid #c9d2ff;
  padding: 11px 13px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  font-weight: 720;
  text-align: left;
  cursor: pointer;
}

.option-button:hover,
.option-button:focus-visible {
  border-color: var(--brand);
  background: #e2e8ff;
}

.payment-button {
  grid-column: 1 / -1;
  color: white;
  background: var(--success);
  border-color: var(--success);
  text-align: center;
  text-decoration: none;
}

.composer {
  margin: 0 18px 12px;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 18px;
  display: flex;
  align-items: flex-end;
  gap: 9px;
  padding: 8px;
  box-shadow: 0 5px 20px rgba(50, 62, 99, 0.08);
}

.composer:focus-within {
  border-color: #9cacff;
  box-shadow: 0 0 0 4px rgba(37, 63, 189, 0.1);
}

.composer textarea {
  flex: 1;
  min-height: 40px;
  max-height: 110px;
  padding: 9px 2px;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.upload-button,
.send-button {
  min-width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.upload-button {
  color: var(--brand);
  background: var(--brand-soft);
  font-size: 1.5rem;
}

.send-button {
  border: 0;
  padding: 0 16px;
  color: white;
  background: var(--brand);
  font-weight: 750;
}

.send-button:disabled,
.upload-button.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.privacy-copy {
  margin: 0 18px 14px;
  color: var(--muted);
  text-align: center;
  font-size: 0.72rem;
}

.confidence-panel {
  padding: 34px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(15px);
}

.confidence-panel h2 {
  margin: 0;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  font-size: 1.3rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.confidence-panel ol {
  list-style: none;
  margin: 0 0 34px;
  padding: 0;
}

.confidence-panel li {
  display: flex;
  gap: 13px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.confidence-panel li > span {
  flex: 0 0 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: white;
  background: var(--brand);
  font-weight: 800;
}

.confidence-panel strong {
  display: block;
  margin: 1px 0 4px;
}

.confidence-panel li p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.confidence-panel > a {
  color: var(--brand);
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.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 message-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes bounce {
  to { transform: translateY(-4px); opacity: 0.55; }
}

@media (max-width: 860px) {
  .page-shell {
    display: block;
    padding: 0;
  }

  .appeal-card {
    height: 100dvh;
    min-height: 560px;
    border: 0;
    border-radius: 0;
  }

  .confidence-panel {
    display: none;
  }
}

@media (max-width: 520px) {
  .brand-header {
    padding: 17px;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }

  .reset-button {
    font-size: 0.78rem;
    padding: 8px 10px;
  }

  .messages {
    padding: 18px 14px;
  }

  .quick-options {
    grid-template-columns: 1fr;
    padding: 0 14px 12px;
  }

  .payment-button {
    grid-column: auto;
  }

  .composer {
    margin-inline: 10px;
  }
}

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