:root {
  color-scheme: light;
  --forest-950: #102a25;
  --forest-900: #173f36;
  --forest-800: #205247;
  --forest-100: #deebe5;
  --ink: #1b2622;
  --muted: #69756f;
  --cream: #f4efe5;
  --paper: #fffdf9;
  --white: #ffffff;
  --line: #e2ddd3;
  --gold: #c79544;
  --gold-soft: #f3e7cf;
  --success: #2d8a62;
  --warning: #c27b25;
  --danger: #b64a4a;
  --shadow-lg: 0 30px 80px rgba(26, 47, 40, 0.13);
  --shadow-md: 0 16px 40px rgba(26, 47, 40, 0.09);
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--cream);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(255, 255, 255, 0.96), transparent 32rem),
    linear-gradient(145deg, #f7f3eb 0%, #f1ebdf 52%, #e9eee9 100%);
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-header {
  width: min(1440px, calc(100% - 48px));
  min-height: 84px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgba(23, 63, 54, 0.12);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--forest-950);
}

.brand-lockup > span:last-child {
  display: grid;
  gap: 1px;
}

.brand-lockup strong {
  font-size: 0.9rem;
  letter-spacing: 0.18em;
}

.brand-lockup small {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.brand-monogram {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: var(--paper);
  background: var(--forest-900);
  box-shadow: 0 8px 22px rgba(23, 63, 54, 0.2);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  font-weight: 700;
}

.header-actions,
.environment-badge {
  display: flex;
  align-items: center;
}

.header-actions {
  gap: 20px;
}

.environment-badge {
  gap: 9px;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid rgba(23, 63, 54, 0.12);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 253, 249, 0.66);
  font-size: 0.74rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #aab3ae;
  box-shadow: 0 0 0 4px rgba(170, 179, 174, 0.15);
}

.status-dot.ready {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(45, 138, 98, 0.14);
}

.status-dot.warning {
  background: var(--warning);
  box-shadow: 0 0 0 4px rgba(194, 123, 37, 0.14);
}

.contact-link {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 0.66rem;
  text-align: right;
}

.contact-link strong {
  color: var(--forest-900);
  font-size: 0.79rem;
}

.contact-link:hover strong,
.site-footer a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.workspace-shell {
  width: min(1440px, calc(100% - 48px));
  min-height: calc(100dvh - 142px);
  margin: 0 auto;
  padding: 38px 0 28px;
  display: grid;
  grid-template-columns: minmax(300px, 0.76fr) minmax(580px, 1.24fr);
  gap: clamp(30px, 4.5vw, 72px);
  align-items: stretch;
}

.overview-panel {
  min-width: 0;
  padding: clamp(12px, 2vw, 28px) 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.eyebrow,
.section-kicker {
  margin: 0;
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.overview-copy h1 {
  max-width: 620px;
  margin: 14px 0 0;
  color: var(--forest-950);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.7rem, 5.1vw, 5.4rem);
  font-weight: 500;
  line-height: 0.96;
  letter-spacing: -0.045em;
}

.intro {
  max-width: 540px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.status-card,
.guardrails {
  padding: 22px;
  border: 1px solid rgba(23, 63, 54, 0.11);
  border-radius: 22px;
  background: rgba(255, 253, 249, 0.66);
  box-shadow: 0 12px 34px rgba(34, 55, 48, 0.045);
  backdrop-filter: blur(12px);
}

.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.section-heading h2,
.guardrails h2 {
  margin: 6px 0 0;
  color: var(--forest-950);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
  font-weight: 600;
}

.live-pill,
.channel-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
}

.live-pill {
  min-height: 28px;
  padding: 0 11px;
  color: var(--forest-800);
  background: var(--forest-100);
}

.connection-list {
  margin: 20px 0 0;
  display: grid;
}

.connection-list > div {
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr);
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.connection-list dt,
.connection-list dd {
  font-size: 0.76rem;
  line-height: 1.4;
}

.connection-list dt {
  color: var(--muted);
}

.connection-list dd {
  margin: 0;
  color: var(--forest-950);
  font-weight: 750;
  overflow-wrap: anywhere;
}

.guardrail-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.guardrail-grid span {
  min-height: 37px;
  padding: 0 11px;
  display: flex;
  align-items: center;
  border-radius: 10px;
  color: #53635d;
  background: rgba(222, 235, 229, 0.62);
  font-size: 0.72rem;
  font-weight: 700;
}

.guardrail-grid span::before {
  content: "✓";
  margin-right: 7px;
  color: var(--success);
  font-weight: 900;
}

.overview-actions {
  margin-top: auto;
  padding: 17px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid rgba(23, 63, 54, 0.12);
  border-radius: 15px;
  color: var(--muted);
  background: rgba(255, 253, 249, 0.62);
  font-size: 0.7rem;
}

.overview-actions > div {
  display: grid;
  gap: 4px;
}

.overview-actions strong {
  color: var(--forest-950);
  font-size: 0.76rem;
}

.overview-actions > a {
  flex: 0 0 auto;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--paper);
  background: var(--forest-900);
  font-size: 0.72rem;
  font-weight: 800;
}

.overview-actions > a:hover {
  background: var(--forest-800);
}

.conversation-panel {
  min-height: 690px;
  max-height: calc(100dvh - 146px);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  border: 1px solid rgba(23, 63, 54, 0.12);
  border-radius: 30px;
  background: var(--paper);
  box-shadow: var(--shadow-lg);
}

.conversation-header {
  min-height: 92px;
  padding: 20px 24px;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.contact-avatar {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: var(--paper);
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.2), transparent 34%),
    var(--forest-900);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
  font-weight: 700;
}

.contact-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.contact-copy strong {
  color: var(--forest-950);
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.contact-copy small {
  color: var(--muted);
  font-size: 0.72rem;
}

.channel-pill {
  min-height: 31px;
  padding: 0 12px;
  color: #8e3c46;
  background: #f7e5e7;
}

.route-banner,
.setup-notice {
  margin: 14px 22px 0;
  border-radius: 14px;
}

.route-banner {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid #d8d1c4;
  background: #f8f4ec;
}

.route-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--forest-800);
  background: var(--forest-100);
  font-weight: 900;
}

.route-banner > span:last-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.route-banner strong {
  color: var(--forest-950);
  font-size: 0.75rem;
}

.route-banner small {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.45;
}

.route-banner b {
  color: #45554f;
  font-weight: 800;
}

.setup-notice {
  padding: 11px 13px;
  display: grid;
  gap: 3px;
  border: 1px solid #e8c98f;
  color: #78521b;
  background: #fff6e4;
  font-size: 0.72rem;
}

.setup-notice[hidden] {
  display: none;
}

.message-list {
  min-height: 0;
  overflow-y: auto;
  padding: 26px 28px 22px;
  scrollbar-width: thin;
  scrollbar-color: #cbc5ba transparent;
  overscroll-behavior: contain;
}

.empty-state {
  min-height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  color: var(--muted);
}

.empty-state[hidden] {
  display: none;
}

.empty-monogram {
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: var(--forest-900);
  background: var(--forest-100);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
}

.empty-monogram {
  width: 60px;
  height: 60px;
  margin-bottom: 16px;
  font-size: 1.55rem;
}

.empty-state strong {
  color: var(--forest-950);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
}

.empty-state p {
  max-width: 360px;
  margin: 9px 0 0;
  font-size: 0.78rem;
  line-height: 1.6;
}

.message {
  display: grid;
  margin-bottom: 20px;
}

.message.outbound {
  justify-items: end;
}

.message.inbound {
  justify-items: start;
}

.bubble {
  max-width: min(78%, 560px);
  padding: 11px 15px 12px;
  border: 1px solid #ded9cf;
  border-radius: 17px;
  color: #32403a;
  background: var(--white);
  box-shadow: 0 7px 18px rgba(30, 50, 43, 0.055);
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.outbound .bubble {
  border-color: var(--forest-900);
  border-bottom-right-radius: 5px;
  color: var(--paper);
  background: var(--forest-900);
}

.inbound .bubble {
  border-bottom-left-radius: 5px;
}

.message-meta {
  max-width: min(82%, 590px);
  margin-top: 6px;
  padding: 0 3px;
  color: #84908a;
  font-size: 0.63rem;
  line-height: 1.45;
}

.outbound .message-meta {
  text-align: right;
}

.message-status.failed,
.message-status.undelivered {
  color: var(--danger);
  font-weight: 800;
}

.composer {
  padding: 16px 20px 18px;
  display: grid;
  gap: 9px;
  border-top: 1px solid var(--line);
  background: #fbf8f2;
}

.composer-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.composer-copy label {
  color: var(--forest-950);
  font-size: 0.71rem;
  font-weight: 800;
}

.composer-copy span {
  color: var(--muted);
  font-size: 0.65rem;
}

.composer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.composer textarea {
  width: 100%;
  min-height: 48px;
  max-height: 110px;
  resize: none;
  padding: 13px 14px;
  border: 1px solid #cfc8bc;
  border-radius: 13px;
  outline: none;
  color: var(--ink);
  background: var(--white);
  font-size: 0.88rem;
  line-height: 1.4;
}

.composer textarea::placeholder {
  color: #909891;
}

.composer textarea:focus {
  border-color: var(--forest-800);
  box-shadow: 0 0 0 3px rgba(32, 82, 71, 0.1);
}

.composer textarea:disabled {
  color: #8a928e;
  background: #eeece7;
}

.composer button {
  min-width: 98px;
  min-height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 13px;
  color: var(--paper);
  background: var(--forest-900);
  box-shadow: 0 8px 18px rgba(23, 63, 54, 0.18);
  font-size: 0.78rem;
  font-weight: 800;
  transition: background 150ms ease, transform 150ms ease, opacity 150ms ease;
}

.composer button:hover:not(:disabled) {
  background: var(--forest-800);
  transform: translateY(-1px);
}

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

.composer-note {
  margin: 0;
  color: #8a938e;
  font-size: 0.62rem;
}

.site-footer {
  width: min(1440px, calc(100% - 48px));
  min-height: 58px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid rgba(23, 63, 54, 0.1);
  color: var(--muted);
  font-size: 0.66rem;
}

.site-footer a {
  color: var(--forest-800);
  font-weight: 800;
}

.footer-credit {
  opacity: 0.68;
  text-align: right;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 10;
  max-width: min(460px, calc(100% - 32px));
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 12px;
  color: var(--paper);
  background: rgba(16, 42, 37, 0.96);
  box-shadow: 0 18px 44px rgba(15, 35, 29, 0.22);
  font-size: 0.76rem;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 980px) {
  .workspace-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .overview-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .overview-copy,
  .overview-actions {
    grid-column: 1 / -1;
  }

  .overview-copy h1 {
    max-width: 760px;
    font-size: clamp(3rem, 9vw, 5.2rem);
  }

  .conversation-panel {
    min-height: 720px;
    max-height: 900px;
  }
}

@media (max-width: 680px) {
  .app-header,
  .workspace-shell,
  .site-footer {
    width: min(100% - 28px, 1440px);
  }

  .app-header {
    min-height: 74px;
  }

  .environment-badge {
    display: none;
  }

  .contact-link {
    font-size: 0;
  }

  .contact-link strong {
    font-size: 0.72rem;
  }

  .workspace-shell {
    padding-top: 24px;
    gap: 26px;
  }

  .overview-panel {
    display: flex;
    padding: 0;
  }

  .overview-copy h1 {
    font-size: clamp(2.7rem, 14vw, 4.4rem);
  }

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

  .conversation-panel {
    min-height: calc(100dvh - 100px);
    max-height: none;
    border-radius: 22px;
  }

  .conversation-header {
    padding: 16px;
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .contact-avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }

  .channel-pill {
    display: none;
  }

  .route-banner,
  .setup-notice {
    margin-right: 14px;
    margin-left: 14px;
  }

  .message-list {
    padding-right: 16px;
    padding-left: 16px;
  }

  .bubble {
    max-width: 88%;
  }

  .composer {
    padding: 14px;
  }

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

  .composer textarea {
    font-size: 16px;
  }

  .composer button {
    min-width: 48px;
    padding: 0;
  }

  .composer button span:first-child,
  .composer-note {
    display: none;
  }

  .site-footer {
    align-items: start;
    flex-direction: column;
    justify-content: center;
    padding: 16px 0;
  }

  .footer-credit {
    text-align: left;
  }

}

@media (max-height: 760px) and (min-width: 981px) {
  .workspace-shell {
    padding-top: 24px;
  }

  .conversation-panel {
    min-height: 610px;
  }

  .overview-panel {
    gap: 18px;
  }

  .status-card,
  .guardrails {
    padding: 18px;
  }

  .overview-copy h1 {
    font-size: clamp(2.8rem, 4.7vw, 4.6rem);
  }
}

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