:root {
  color-scheme: light;
  --ink: #101828;
  --muted: #6a7282;
  --line: #e5e8ff;
  --surface: #ffffff;
  --surface-soft: #f1f4ff;
  --brand: #000091;
  --brand-dark: #00006d;
  --brand-medium: #2118ff;
  --brand-soft: #e5e8ff;
  --sky: #afe1fa;
  --coral: #ff735f;
  --danger: #c10007;
  --shadow: 0 18px 55px rgba(0, 0, 145, 0.09);
  font-family: Arial, "Liberation Sans", ui-sans-serif, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 3% 0%, rgba(175, 225, 250, 0.9), transparent 23rem),
    linear-gradient(135deg, #f8f9ff 0%, #eef2ff 100%);
}

button,
textarea,
input {
  font: inherit;
}

button {
  color: inherit;
}

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

.topbar {
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 4vw, 64px);
  border-bottom: 3px solid var(--brand);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  color: inherit;
  text-decoration: none;
}

.improba-logo {
  width: 142px;
  height: 48px;
  object-fit: contain;
}

.brand-divider {
  width: 1px;
  height: 38px;
  background: var(--line);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--brand);
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.privacy-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid #ced5ff;
  border-radius: 999px;
  color: var(--brand-dark);
  background: #f1f4ff;
  font-size: 12px;
  font-weight: 650;
}

.privacy-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #009966;
  box-shadow: 0 0 0 4px rgba(0, 153, 102, 0.12);
}

.workspace {
  width: min(1360px, calc(100% - 48px));
  min-height: calc(100vh - 136px);
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  margin: 24px auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.context-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 34px 30px;
  border-right: 1px solid var(--line);
  background: var(--surface-soft);
  box-shadow: inset 5px 0 0 var(--brand);
  overflow-y: auto;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--brand);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.035em;
}

h1 {
  font-size: 25px;
}

h2 {
  font-size: 21px;
}

.panel-copy {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.format-hint {
  display: grid;
  gap: 10px;
  padding: 13px 14px;
  border-left: 3px solid var(--sky);
  border-radius: 0 10px 10px 0;
  background: rgba(255, 255, 255, 0.72);
}

.format-hint strong,
.format-hint span {
  display: block;
}

.format-hint strong {
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 12px;
}

.format-hint span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.format-hint code {
  color: var(--brand);
  font-family: "Liberation Mono", ui-monospace, monospace;
  font-weight: 700;
}

.format-hint a {
  color: var(--brand);
  font-size: 11px;
  font-weight: 700;
  text-underline-offset: 3px;
}

.drop-zone {
  min-height: 210px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 22px;
  border: 1.5px dashed #b1b1f9;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  border-color: var(--brand);
  background: var(--brand-soft);
  transform: translateY(-2px);
}

.drop-zone.has-files {
  min-height: 108px;
  padding: 14px;
}

.drop-zone.has-files .upload-icon {
  width: 34px;
  height: 34px;
  margin-bottom: 8px;
}

.drop-zone.has-files > span:not(.upload-icon) {
  display: none;
}

.drop-zone.has-files small {
  margin-top: 5px;
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 14px;
  color: var(--brand);
  background: var(--brand-soft);
  box-shadow: inset 0 -3px 0 var(--sky);
}

.upload-icon svg,
.privacy-note svg,
.icon-button svg,
.send-button svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.upload-icon svg {
  width: 25px;
}

.drop-zone strong {
  font-size: 14px;
}

.drop-zone > span:not(.upload-icon) {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.drop-zone small {
  margin-top: 12px;
  color: #819095;
  font-size: 11px;
}

.file-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid #ced5ff;
  border-radius: 13px;
  background: white;
}

.file-list {
  display: grid;
  gap: 8px;
}

.file-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 10px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.file-meta {
  min-width: 0;
  flex: 1;
}

.file-meta strong,
.file-meta small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta strong {
  font-size: 13px;
}

.file-meta small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.icon-button:hover {
  color: var(--danger);
  background: #faeeee;
}

.icon-button svg {
  width: 17px;
}

.privacy-note {
  display: flex;
  gap: 11px;
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.privacy-note svg {
  width: 20px;
  flex: 0 0 auto;
  color: var(--brand);
}

.privacy-note p {
  margin: 0;
  font-size: 11px;
  line-height: 1.55;
}

.privacy-note strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 12px;
}

.chat-panel {
  min-width: 0;
  min-height: 600px;
  display: grid;
  grid-template-rows: auto minmax(300px, 1fr) auto auto auto;
  background: white;
}

.chat-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 29px 36px 23px;
  border-bottom: 1px solid var(--line);
}

.reasoning-mode {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.reasoning-mode > span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-medium);
}

.text-button {
  padding: 8px 11px;
  border: 0;
  border-radius: 8px;
  color: var(--brand);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.text-button:hover {
  background: var(--brand-soft);
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 26px;
  overflow-y: auto;
  padding: 34px clamp(24px, 5vw, 70px);
  scroll-behavior: smooth;
}

.message {
  display: flex;
  gap: 13px;
  max-width: 790px;
  animation: message-in 220ms ease-out both;
}

@keyframes message-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50% 50% 50% 12px;
  color: white;
  background: linear-gradient(145deg, var(--brand-medium), var(--brand));
  box-shadow: 8px 7px 0 -5px var(--sky);
  font-size: 10px;
  font-weight: 800;
}

.message-content {
  min-width: 0;
}

.message-author {
  display: block;
  margin: 1px 0 7px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
}

.message p,
.formatted-response {
  margin: 0;
  color: #364153;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.formatted-response {
  white-space: normal;
}

.formatted-response p {
  margin: 0 0 10px;
}

.formatted-response p:last-child,
.formatted-response ul:last-child,
.formatted-response ol:last-child {
  margin-bottom: 0;
}

.formatted-response ul,
.formatted-response ol {
  margin: 4px 0 12px;
  padding-left: 20px;
}

.formatted-response li {
  margin: 3px 0;
  padding-left: 2px;
}

.formatted-response .response-heading {
  margin: 14px 0 4px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
}

.formatted-response .response-heading:first-child {
  margin-top: 0;
}

.formatted-response code {
  padding: 2px 5px;
  border-radius: 4px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  font-family: "Liberation Mono", ui-monospace, monospace;
  font-size: 0.9em;
}

.formatted-response hr {
  height: 1px;
  margin: 14px 0;
  border: 0;
  background: var(--line);
}

.export-guide {
  margin-top: 14px;
  padding: 14px 16px;
  border-left: 3px solid var(--brand-medium);
  border-radius: 0 12px 12px 0;
  background: var(--surface-soft);
}

.export-guide > strong,
.example-questions > strong {
  display: block;
  color: var(--ink);
  font-size: 12px;
}

.export-guide ol {
  margin: 8px 0 0;
}

.export-guide .guide-warning {
  margin: 9px 0 0;
  padding-top: 9px;
  border-top: 1px solid #ced5ff;
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.5;
}

.example-questions {
  margin-top: 14px;
}

.example-questions ul {
  margin-bottom: 0;
}

.user-message {
  align-self: flex-end;
  max-width: min(680px, 86%);
}

.user-message .message-content {
  padding: 11px 15px;
  border-radius: 15px 15px 3px 15px;
  background: var(--brand);
}

.user-message p {
  color: white;
}

.message.is-error .avatar {
  background: var(--danger);
}

.message.is-error p {
  color: var(--danger);
}

.typing {
  display: inline-flex;
  gap: 4px;
  padding-top: 7px;
}

.reasoning-label {
  display: inline-block;
  margin-left: 9px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 600;
}

.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8aa09e;
  animation: blink 1s infinite ease-in-out;
}

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

@keyframes blink {
  0%, 70%, 100% { opacity: 0.35; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-3px); }
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 clamp(24px, 5vw, 70px) 14px;
}

.suggestions button {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #4a5565;
  background: white;
  font-size: 11px;
  cursor: pointer;
}

.suggestions button:hover {
  border-color: #b1b1f9;
  color: var(--brand-dark);
  background: var(--brand-soft);
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin: 0 clamp(24px, 5vw, 70px);
  padding: 10px 10px 10px 16px;
  border: 1px solid #ced5ff;
  border-radius: 15px;
  background: white;
  box-shadow: 0 7px 24px rgba(0, 0, 145, 0.07);
}

.composer:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(33, 24, 255, 0.11);
}

.composer textarea {
  min-height: 28px;
  max-height: 140px;
  flex: 1;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 14px;
  line-height: 1.55;
}

.composer textarea::placeholder {
  color: #8a999c;
}

.send-button {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 0;
  border-radius: 11px;
  color: white;
  background: var(--brand);
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease;
}

.send-button:hover:not(:disabled) {
  background: var(--brand-dark);
  transform: translateY(-1px);
}

.send-button:disabled {
  opacity: 0.45;
  cursor: wait;
}

.send-button svg {
  width: 20px;
}

.composer-note {
  margin: 9px 0 17px;
  color: #829195;
  font-size: 10px;
  text-align: center;
}

.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;
}

@media (max-width: 860px) {
  .workspace {
    width: min(100% - 24px, 720px);
    grid-template-columns: 1fr;
  }

  .context-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .drop-zone {
    min-height: 150px;
  }

  .privacy-note {
    margin-top: 0;
  }

  .chat-panel {
    min-height: 680px;
  }
}

@media (max-width: 560px) {
  .topbar {
    height: 72px;
    padding: 0 16px;
  }

  .product-name small,
  .privacy-pill {
    display: none;
  }

  .improba-logo {
    width: 102px;
    height: 43px;
  }

  .brand-divider {
    height: 30px;
  }

  .workspace {
    width: 100%;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .context-panel,
  .chat-heading {
    padding-left: 20px;
    padding-right: 20px;
  }

  .messages {
    padding-left: 20px;
    padding-right: 20px;
  }

  .composer,
  .suggestions {
    margin-left: 0;
    margin-right: 0;
  }

  .composer {
    margin-left: 20px;
    margin-right: 20px;
  }

  .suggestions {
    padding-left: 20px;
    padding-right: 20px;
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .suggestions button {
    flex: 0 0 auto;
  }
}

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