@font-face {
  font-family: "Inter";
  src: url("../newsletter/fonts/InterVariable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "ARPIA Graph Heading";
  src: url("../fonts/ARPIA-Graph-Heading-Variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0b0b0d;
  --surface: #171717;
  --surface-raised: #202024;
  --surface-soft: #27272c;
  --border: #34343a;
  --border-strong: #4a4a52;
  --text: #f5f7fa;
  --text-muted: #a4a8b2;
  --cyan: #00f0ff;
  --cyan-dark: #083d42;
  --magenta: #bc00ff;
  --magenta-dark: #3e0a50;
  --green: #41d17d;
  --amber: #ffcc66;
  --danger: #ff6b78;
  --radius: 6px;
  --header-height: 72px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px),
    var(--bg);
  background-size: 48px 48px;
  color: var(--text);
  font-family: "Inter", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button {
  border: 0;
}

button:focus-visible,
input:focus-visible,
.quick-reply:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 20;
  padding: 8px 12px;
  transform: translateY(-160%);
  border-radius: var(--radius);
  background: var(--cyan);
  color: #071013;
  font-weight: 700;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  min-height: var(--header-height);
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px clamp(16px, 3vw, 40px);
  border-bottom: 1px solid var(--border);
  background: rgba(11, 11, 13, 0.96);
  backdrop-filter: blur(14px);
}

.brand-block,
.header-actions,
.conversation-header,
.request-header,
.completion-label,
.estimate-heading,
.message-form,
.request-actions {
  display: flex;
  align-items: center;
}

.brand-block {
  min-width: 0;
  gap: 18px;
}

.brand-logo {
  width: clamp(142px, 18vw, 208px);
  height: auto;
  object-fit: contain;
}

.product-name {
  display: grid;
  min-width: 0;
  gap: 2px;
  padding-left: 18px;
  border-left: 1px solid var(--border-strong);
}

.product-name strong {
  overflow-wrap: anywhere;
  color: var(--cyan);
  font-family: "Orbitron", "Inter", sans-serif;
  font-size: 14px;
}

.product-name span {
  color: var(--text-muted);
  font-size: 12px;
}

.header-actions {
  flex: 0 0 auto;
  gap: 12px;
}

.demo-status,
.availability,
.request-state,
.urgency-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.demo-status {
  gap: 8px;
  padding: 4px 10px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px rgba(65, 209, 125, 0.8);
}

.workspace {
  display: grid;
  width: min(1440px, 100%);
  height: calc(100vh - var(--header-height));
  min-height: 0;
  margin: 0 auto;
  overflow: hidden;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 410px);
  border-right: 1px solid var(--border);
  border-left: 1px solid var(--border);
  background: var(--surface);
}

.conversation {
  display: grid;
  min-width: 0;
  height: 100%;
  min-height: 0;
  grid-template-rows: auto minmax(360px, 1fr) auto;
  border-right: 1px solid var(--border);
}

.conversation-header,
.request-header {
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--magenta);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1,
h2 {
  margin-bottom: 0;
  font-family: "Orbitron", "Inter", sans-serif;
}

h1 {
  font-size: clamp(18px, 2vw, 24px);
}

h2 {
  font-size: 17px;
}

h3 {
  margin-bottom: 0;
  font-size: 13px;
}

.availability {
  padding: 4px 10px;
  border-color: rgba(65, 209, 125, 0.45);
  color: var(--green);
}

.chat {
  display: flex;
  overflow-y: auto;
  min-height: 0;
  flex-direction: column;
  gap: 12px;
  padding: 24px clamp(16px, 4vw, 44px);
  scrollbar-color: var(--border-strong) transparent;
}

.message-row {
  display: flex;
  max-width: min(680px, 88%);
  flex-direction: column;
  gap: 5px;
}

.message-row.user {
  align-self: flex-end;
  align-items: flex-end;
}

.message-row.assistant,
.message-row.system {
  align-self: flex-start;
}

.message-sender {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

.message {
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message-row.user .message {
  border-color: rgba(0, 240, 255, 0.55);
  background: var(--cyan-dark);
}

.message-row.assistant .message {
  border-left: 3px solid var(--magenta);
}

.message-row.system .message {
  border-color: rgba(65, 209, 125, 0.55);
  background: rgba(65, 209, 125, 0.08);
}

.typing {
  display: inline-flex;
  width: fit-content;
  gap: 5px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing 1s infinite ease-in-out;
}

.typing span:nth-child(2) {
  animation-delay: 0.14s;
}

.typing span:nth-child(3) {
  animation-delay: 0.28s;
}

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

.composer {
  padding: 16px 18px 14px;
  border-top: 1px solid var(--border);
  background: #131315;
}

.quick-replies {
  display: flex;
  overflow-x: auto;
  min-height: 34px;
  gap: 8px;
  margin-bottom: 10px;
  padding: 1px 1px 5px;
  scrollbar-width: thin;
}

.quick-reply {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 6px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.quick-reply:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.message-form {
  gap: 10px;
}

.message-form input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  outline: 0;
  background: var(--surface-raised);
  color: var(--text);
}

.message-form input::placeholder {
  color: #747985;
}

.message-form input:focus {
  border-color: var(--cyan);
}

.primary-button,
.secondary-button {
  min-height: 38px;
  padding: 8px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

.primary-button {
  border: 1px solid var(--cyan);
  background: var(--cyan);
  color: #061215;
}

.primary-button:hover {
  background: #7af7ff;
}

.secondary-button {
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
}

.secondary-button:hover {
  border-color: var(--magenta);
  color: #f1c4ff;
}

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

.privacy-note {
  margin: 9px 0 0;
  color: #777c86;
  font-size: 10px;
}

.request-panel {
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  background: #111113;
}

.request-state {
  padding: 4px 9px;
  border-color: rgba(188, 0, 255, 0.45);
  color: #e3a6fa;
}

.request-state.complete {
  border-color: rgba(65, 209, 125, 0.45);
  color: var(--green);
}

.completion-block {
  padding: 20px 22px 18px;
  border-bottom: 1px solid var(--border);
}

.completion-label {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--text-muted);
  font-size: 12px;
}

.completion-label strong {
  color: var(--cyan);
}

.progress-track {
  overflow: hidden;
  height: 5px;
  border-radius: 999px;
  background: var(--surface-soft);
}

.progress-value {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--cyan);
  transition: width 220ms ease;
}

.request-details {
  display: grid;
  margin: 0;
  padding: 10px 22px;
}

.detail-row {
  display: grid;
  min-width: 0;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid #29292e;
}

.detail-row:last-child {
  border-bottom: 0;
}

.detail-row dt,
.detail-row dd {
  margin: 0;
}

.detail-row dt {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

.detail-row dd {
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.detail-row dd.pending {
  color: #666b76;
  font-weight: 500;
}

.estimate-block {
  margin: 4px 22px 18px;
  padding: 15px;
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--cyan);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.estimate-heading {
  justify-content: space-between;
  gap: 12px;
}

.urgency-badge {
  min-height: 24px;
  padding: 3px 8px;
}

.urgency-badge.urgent {
  border-color: rgba(255, 107, 120, 0.55);
  color: var(--danger);
}

.estimate-value {
  margin: 14px 0 5px;
  color: var(--cyan);
  font-family: "Orbitron", "Inter", sans-serif;
  font-size: 20px;
  font-weight: 700;
}

.estimate-note {
  margin-bottom: 0;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.45;
}

.request-actions {
  gap: 9px;
  padding: 0 22px 22px;
}

.request-actions button {
  flex: 1 1 0;
  min-width: 0;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(360px, calc(100vw - 36px));
  padding: 10px 13px;
  transform: translateY(30px);
  border: 1px solid rgba(65, 209, 125, 0.55);
  border-radius: var(--radius);
  background: #14251a;
  color: #d8ffe6;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (max-width: 880px) {
  :root {
    --header-height: 64px;
  }

  .product-name,
  .demo-status {
    display: none;
  }

  .workspace {
    height: auto;
    min-height: calc(100svh - var(--header-height));
    overflow: visible;
    grid-template-columns: 1fr;
    border: 0;
  }

  .conversation {
    height: calc(100svh - var(--header-height));
    min-height: calc(100svh - var(--header-height));
    border-right: 0;
  }

  .request-panel {
    height: auto;
    overflow: visible;
    border-top: 1px solid var(--border);
  }

  .chat {
    min-height: 420px;
  }
}

@media (max-width: 520px) {
  .app-header {
    padding: 10px 12px;
  }

  .brand-logo {
    width: 150px;
  }

  .conversation-header,
  .request-header {
    align-items: flex-start;
    padding: 16px;
  }

  .availability {
    white-space: normal;
    text-align: center;
  }

  .chat {
    min-height: 390px;
    padding: 18px 12px;
  }

  .message-row {
    max-width: 94%;
  }

  .composer {
    padding: 12px;
  }

  .message-form {
    align-items: stretch;
  }

  .message-form input {
    min-width: 0;
  }

  .message-form .primary-button {
    padding-inline: 12px;
  }

  .detail-row {
    grid-template-columns: 94px minmax(0, 1fr);
  }
}

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

/* Local layout delta: keep engine/data; allow real wrapping instead of clipping. */
:root {
  --bg: #171717;
  --border: #85858e;
  --border-strong: #92929c;
}

body {
  min-width: 0;
}

.local-notice {
  position: relative;
  z-index: 1;
  background: #171717;
  max-width: 90rem;
  margin: 0 auto;
  padding: 12px 16px;
  color: #e0e0e0;
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.product-name strong,
h1,
h2,
h3,
.estimate-value {
  font-family: "ARPIA Graph Heading", sans-serif;
}

a {
  color: var(--cyan);
}

.app-header,
.brand-block,
.header-actions,
.conversation-header,
.request-header,
.estimate-heading,
.request-actions {
  flex-wrap: wrap;
  min-width: 0;
}

.app-header {
  gap: 12px;
}

.header-actions {
  flex: 1 1 300px;
  justify-content: flex-end;
}

.demo-status {
  display: inline-flex;
  white-space: normal;
  line-height: 1.5;
}

.status-dot {
  flex-shrink: 0;
}

.workspace {
  height: auto;
  overflow: visible;
}

.conversation {
  height: auto;
  grid-template-rows: auto minmax(300px, 1fr) auto;
}

.chat {
  min-height: 300px;
  max-height: 65svh;
}

.quick-replies {
  flex-wrap: wrap;
  overflow: visible;
}

.quick-reply {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.primary-button,
.secondary-button {
  white-space: normal;
  overflow-wrap: anywhere;
}

.message-form input {
  flex: 1 1 0;
  width: 0;
}

.message-form #sendButton {
  flex: 0 0 auto;
  min-width: 76px;
  white-space: nowrap;
  overflow-wrap: normal;
}

.privacy-note,
.detail-row dd.pending {
  color: #bfc1c8;
}

.estimate-value {
  font-size: 16px;
  overflow-wrap: anywhere;
}

.detail-row {
  border-color: var(--border);
}

:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

@media (max-width: 880px) {
  .conversation {
    height: auto;
    min-height: 0;
  }

  .header-actions {
    justify-content: flex-start;
  }
}
