/* ============================================
   GovernarcAI — Global styles
   ============================================ */
:root {
  --navy: #1F3864;
  --navy-dark: #162a4d;
  --blue: #2E75B6;
  --blue-hover: #2563a0;
  --white: #FFFFFF;
  --gray: #F4F6F9;
  --text: #1a2238;
  --text-muted: #5a6478;
  --border: #e3e7ee;
  --shadow-sm: 0 2px 4px rgba(31, 56, 100, 0.06);
  --shadow-md: 0 8px 24px rgba(31, 56, 100, 0.08);
  --shadow-lg: 0 16px 40px rgba(31, 56, 100, 0.12);
  --radius: 12px;
  --radius-lg: 16px;
  --container: 1160px;
  --nav-h: 100px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --danger: #B91C1C;
  --danger-soft: #FEE2E2;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-h);
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

h2 {
  text-align: center;
  width: 100%;
  display: block;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}
.container--narrow { max-width: 780px; }
.center { text-align: center; }

/* ============================================
   Navigation
   ============================================ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  min-height: var(--nav-h);
  background: var(--white);
  z-index: 100;
  transition: box-shadow 0.3s var(--ease);
}
.nav.is-scrolled { box-shadow: var(--shadow-sm); }

.nav__inner {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav__logo {
  display: inline-flex;
  align-items: center;
  padding-left: 24px;
  margin: 0;
}
.nav__logo-img {
  height: 80px;
  width: auto;
  max-width: 360px;
  object-fit: contain;
  display: block;
}

.nav__links {
  padding-right: 24px;
}

.nav__links {
  display: flex;
  gap: 36px;
  align-items: center;
}
.nav__link {
  font-weight: 500;
  color: var(--text);
  position: relative;
  padding: 6px 0;
  transition: color 0.2s var(--ease);
}
.nav__link::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  width: 0; height: 2px;
  background: var(--blue);
  transition: width 0.25s var(--ease);
}
.nav__link:hover { color: var(--blue); }
.nav__link:hover::after { width: 100%; }

.nav__toggle {
  display: none;
  width: 40px; height: 40px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  padding: 0;
}
.nav__toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--navy);
  transition: all 0.3s var(--ease);
  border-radius: 1px;
}
.nav__toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle.is-open span:nth-child(2) { opacity: 0; }
.nav__toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 999px;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.btn--primary {
  background: var(--blue);
  color: var(--white);
  box-shadow: 0 8px 20px rgba(46, 117, 182, 0.35);
}
.btn--primary:hover {
  background: var(--blue-hover);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(46, 117, 182, 0.45);
}
.btn--primary:active { transform: translateY(0); }
.btn--large { padding: 18px 36px; font-size: 17px; }

/* ============================================
   Hero
   ============================================ */
.hero {
  position: relative;
  min-height: 100vh;
  background: var(--navy);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: calc(var(--nav-h) + 40px) 24px 60px;
}
.hero__grid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.55;
}
.hero__content {
  position: relative;
  z-index: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
}
.hero__title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
  text-align: center;
}
.hero__subtitle {
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.85);
  margin: 0 0 40px;
  text-align: center;
}
.hero .btn {
  margin: 0 auto;
  display: block;
  width: fit-content;
}

/* ============================================
   Sections
   ============================================ */
.section {
  padding: 100px 0;
}
.section--gray { background: var(--gray); }
.section--navy { background: var(--navy); color: var(--white); }

.section__title {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  margin: 0 0 56px;
  color: var(--navy);
}
.section__title--light { color: var(--white); }
.section__lede {
  font-size: 1.125rem;
  color: var(--text-muted);
  margin: 0 0 36px;
}

/* Reveal animation */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ============================================
   Service cards
   ============================================ */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
  border: 1px solid var(--border);
}
.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}
.card__icon {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: rgba(46, 117, 182, 0.1);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}
.card__title {
  font-size: 1.375rem;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--navy);
}
.card__desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.975rem;
  line-height: 1.65;
}

/* ============================================
   Production callout
   ============================================ */
.callout-wrap {
  padding: 0 24px;
}
.callout {
  max-width: 860px;
  margin: 80px auto;
  background: #F4F6F9;
  border-left: 4px solid #2E75B6;
  border-radius: 8px;
  padding: 40px 48px;
}
.callout__title {
  color: #1F3864;
  font-weight: 700;
  font-size: 22px;
  margin: 0 0 20px;
  letter-spacing: -0.01em;
}
.callout__body {
  color: #3a4256;
  font-size: 16px;
  line-height: 1.7;
  margin: 0 0 24px;
}
.callout__body p { margin: 0 0 16px; }
.callout__body p:last-child { margin-bottom: 0; }
.callout__label {
  color: #2E75B6;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  line-height: 1.5;
}

@media (max-width: 720px) {
  .callout { padding: 28px 24px; margin: 56px auto; }
  .callout__title { font-size: 20px; }
}

/* ============================================
   How it works — steps
   ============================================ */
.steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  position: relative;
}
.steps::before {
  content: '';
  position: absolute;
  top: 28px;
  left: 12.5%;
  right: 12.5%;
  height: 2px;
  background: linear-gradient(to right, var(--blue) 0%, rgba(46, 117, 182, 0.3) 100%);
  z-index: 0;
}
.step {
  position: relative;
  text-align: center;
  padding: 0 12px;
  z-index: 1;
}
.step__num {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 auto 20px;
  border: 4px solid var(--white);
  box-shadow: 0 6px 16px rgba(31, 56, 100, 0.25);
}
.step__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 8px;
}
.step__desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0;
}

/* ============================================
   About
   ============================================ */
.about {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 56px;
  align-items: center;
}
.about__copy p {
  font-size: 1.075rem;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
}
.proof {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.proof__item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  font-size: 1.05rem;
  font-weight: 500;
}
.proof__check {
  flex-shrink: 0;
  color: var(--blue);
  margin-top: 2px;
}

/* ============================================
   Footer
   ============================================ */
.footer {
  background: var(--navy-dark);
  color: rgba(255, 255, 255, 0.75);
  padding: 36px 0;
}
.footer__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
  align-items: center;
}
.footer__left { text-align: left; }
.footer__center { text-align: center; font-size: 0.9rem; }
.footer__center p { margin: 0; }
.footer__right { text-align: right; display: flex; gap: 24px; justify-content: flex-end; }
.footer__logo { height: 32px; width: auto; }
.footer__link {
  font-size: 0.9rem;
  transition: color 0.2s var(--ease);
}
.footer__link:hover { color: var(--blue); }

/* ============================================
   Chat widget — base panel (legacy)
   ============================================ */
.chat {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 360px;
  max-width: calc(100vw - 32px);
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(31, 56, 100, 0.25);
  z-index: 200;
  display: none;
  overflow: hidden;
  animation: chatIn 0.25s var(--ease);
}
.chat.is-open { display: block; }
@keyframes chatIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: none; }
}
.chat__header {
  background: var(--navy);
  color: var(--white);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.chat__title { font-weight: 600; font-size: 1rem; }
.chat__close {
  color: var(--white);
  padding: 4px;
  border-radius: 6px;
  display: flex;
  transition: background 0.2s var(--ease);
}
.chat__close:hover { background: rgba(255, 255, 255, 0.12); }
.chat__body {
  padding: 24px 20px;
  color: var(--text-muted);
  font-size: 0.95rem;
  min-height: 120px;
}
.chat__body p { margin: 0; }

/* ============================================
   Chat widget — intake state machine (Sub-step 9.4)
   ============================================
   Visibility model:
   - #chat-widget-container carries data-state at all times.
   - Container hides when data-state="CLOSED".
   - Inner .chat panel shows in all non-CLOSED, non-MINIMIZED states.
   - Each sub-state element defaults to display: none and is shown by
     a state-scoped selector with higher specificity.
   ============================================ */

/* --- Group 1: Data-state visibility architecture --- */

/* Container visibility (overrides legacy .chat { display: none } via ID specificity) */
#chat-widget-container[data-state="CLOSED"] {
  display: none;
}
#chat-widget-container[data-state]:not([data-state="CLOSED"]) {
  display: block;
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 360px;
  max-width: calc(100vw - 32px);
  z-index: 200;
}

/* Inner panel — flex column with fixed height so .chat__messages flex:1 works */
#chat-widget-container:not([data-state="CLOSED"]):not([data-state="MINIMIZED"]) > .chat {
  display: flex;
  flex-direction: column;
  position: static;
  width: 100%;
  max-width: 100%;
  height: 560px;
  max-height: calc(100vh - 48px);
}
#chat-widget-container[data-state="MINIMIZED"] > .chat {
  display: none;
}

/* All sub-state elements default to hidden — state selectors below show them */
#chat-widget-container .chat__gate,
#chat-widget-container .chat__messages,
#chat-widget-container .chat__input-area,
#chat-widget-container .chat__progress,
#chat-widget-container .chat__loading,
#chat-widget-container .chat__quick-replies,
#chat-widget-container .chat__error-banner,
#chat-widget-container .chat__terminal,
#chat-widget-container .chat__confirm-modal,
#chat-widget-container .chat__pill {
  display: none;
}

/* GATE */
#chat-widget-container[data-state="GATE"] .chat__gate {
  display: flex;
}

/* Message list — visible in all chat-active states */
#chat-widget-container[data-state="CHAT_IDLE"] .chat__messages,
#chat-widget-container[data-state="CHAT_SENDING"] .chat__messages,
#chat-widget-container[data-state="CHAT_ERROR"] .chat__messages,
#chat-widget-container[data-state="CHAT_CLOSED_ROUTE"] .chat__messages,
#chat-widget-container[data-state="CONFIRM_CLOSE"] .chat__messages {
  display: flex;
}

/* Input area — visible in chat-active states (NOT CHAT_CLOSED_ROUTE / CONFIRM_CLOSE) */
#chat-widget-container[data-state="CHAT_IDLE"] .chat__input-area,
#chat-widget-container[data-state="CHAT_SENDING"] .chat__input-area,
#chat-widget-container[data-state="CHAT_ERROR"] .chat__input-area {
  display: flex;
}

/* Progress bar — only when data-progress="true" in chat-active states */
#chat-widget-container[data-state="CHAT_IDLE"][data-progress="true"] .chat__progress,
#chat-widget-container[data-state="CHAT_SENDING"][data-progress="true"] .chat__progress,
#chat-widget-container[data-state="CHAT_ERROR"][data-progress="true"] .chat__progress {
  display: block;
}

/* Loading indicator — only in CHAT_SENDING */
#chat-widget-container[data-state="CHAT_SENDING"] .chat__loading {
  display: flex;
}

/* Quick-reply chips — show in CHAT_IDLE & CHAT_SENDING when data-quick-replies="true";
   CHAT_SENDING fades to opacity 0 (rule below) so layout doesn't collapse on send */
#chat-widget-container[data-state="CHAT_IDLE"][data-quick-replies="true"] .chat__quick-replies,
#chat-widget-container[data-state="CHAT_SENDING"][data-quick-replies="true"] .chat__quick-replies {
  display: flex;
}

/* Error banner */
#chat-widget-container[data-state="CHAT_ERROR"] .chat__error-banner {
  display: flex;
}

/* Terminal end block */
#chat-widget-container[data-state="CHAT_CLOSED_ROUTE"] .chat__terminal {
  display: flex;
}

/* Confirm-close modal */
#chat-widget-container[data-state="CONFIRM_CLOSE"] .chat__confirm-modal {
  display: flex;
}

/* MINIMIZED pill */
#chat-widget-container[data-state="MINIMIZED"] .chat__pill {
  display: flex;
}

/* Disable input during CHAT_SENDING */
#chat-widget-container[data-state="CHAT_SENDING"] .chat__input,
#chat-widget-container[data-state="CHAT_SENDING"] .chat__send-btn {
  pointer-events: none;
}

/* Fade quick replies during CHAT_SENDING — preserves layout, no shift on re-appear */
#chat-widget-container[data-state="CHAT_SENDING"] .chat__quick-replies {
  opacity: 0;
  pointer-events: none;
}

/* --- Group 2: GATE state --- */

.chat__gate {
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  overflow-y: auto;
  max-height: 100%;
  box-sizing: border-box;
}

.chat__gate-copy {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}

.chat__gate-copy strong { font-weight: 600; }

.chat__gate-copy ul {
  margin: 8px 0 8px 0;
  padding-left: 18px;
}

.chat__gate-copy ul li {
  margin-bottom: 4px;
}

.chat__gate-btn {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: var(--blue);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  transition: background 150ms var(--ease), transform 80ms var(--ease);
}

.chat__gate-btn:hover  { background: var(--blue-hover); }
.chat__gate-btn:active { transform: scale(0.98); }
.chat__gate-btn:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

/* --- Group 3: Message bubble system --- */

.chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px 16px;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  position: relative;
}

.chat__message {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  animation: bubbleIn 120ms ease-out both;
}

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

.chat__message--assistant {
  align-self: flex-start;
  align-items: flex-start;
}

.chat__bubble {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}

.chat__message--user .chat__bubble {
  background: var(--navy);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.chat__message--assistant .chat__bubble {
  background: #EEF2F7;
  color: #1A1A2E;
  border-bottom-left-radius: 4px;
}

@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- Group 4: Input area --- */

.chat__input-area {
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px 12px 12px;
  border-top: 1px solid #E0E6EF;
  background: #ffffff;
  flex-shrink: 0;
}

.chat__input {
  flex: 1;
  resize: none;
  border: 1.5px solid #C5D0DE;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  line-height: 1.5;
  font-family: inherit;
  color: #1A1A2E;
  background: #ffffff;
  min-height: 38px;
  max-height: 120px;
  overflow-y: auto;
  transition: border-color 150ms var(--ease);
}

.chat__input:focus {
  outline: none;
  border-color: var(--blue);
}

.chat__input:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.chat__input:disabled {
  background: #F4F7FA;
  color: #8A99AA;
  cursor: not-allowed;
}

.chat__send-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--blue);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms var(--ease), transform 80ms var(--ease);
  color: #ffffff;
}

.chat__send-btn:hover:not(:disabled)  { background: var(--blue-hover); }
.chat__send-btn:active:not(:disabled) { transform: scale(0.93); }

.chat__send-btn:disabled {
  background: #C5D0DE;
  cursor: not-allowed;
}

.chat__send-btn:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

/* --- Group 5: Tiered loading indicator --- */

.chat__loading {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 4px 16px 8px 16px;
  flex-shrink: 0;
}

.chat__loading-dots {
  display: flex;
  gap: 5px;
  align-items: center;
  height: 20px;
}

.chat__loading-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8A99AA;
  animation: dotBounce 1.2s ease-in-out infinite;
}

.chat__loading-dot:nth-child(2) { animation-delay: 0.2s; }
.chat__loading-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBounce {
  0%, 60%, 100% { transform: translateY(0);    opacity: 0.5; }
  30%           { transform: translateY(-5px); opacity: 1;   }
}

/* Stage label — JS sets data-loading-stage="1|2|3" on .chat__loading and
   writes the text into a real text node inside .chat__loading-label
   (so aria-live="polite" announcements work). CSS only frames the slot. */
.chat__loading-label {
  font-size: 11px;
  font-style: italic;
  color: #8A99AA;
  min-height: 14px;
  transition: opacity 200ms ease;
}

.chat__loading[data-loading-stage="1"] .chat__loading-label {
  opacity: 0;
}

/* --- Group 6: Progress bar --- */

.chat__progress {
  height: 4px;
  background: #E0E6EF;
  flex-shrink: 0;
  overflow: hidden;
}

.chat__progress-fill {
  height: 100%;
  background: var(--blue);
  width: var(--progress-pct, 0%);
  transition: width 400ms ease;
  border-radius: 0 2px 2px 0;
}

/* --- Group 7: Quick-reply chips --- */

.chat__quick-replies {
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 16px 10px 16px;
  flex-shrink: 0;
  transition: opacity 120ms var(--ease);
}

.chat__chip {
  padding: 6px 14px;
  border-radius: 9999px;
  border: 1.5px solid var(--blue);
  background: #ffffff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 120ms var(--ease), color 120ms var(--ease), transform 80ms var(--ease);
  white-space: nowrap;
  min-height: 32px;
  display: flex;
  align-items: center;
}

.chat__chip:hover {
  background: var(--blue);
  color: #ffffff;
}

.chat__chip:active { transform: scale(0.96); }

.chat__chip:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

/* --- Group 8: Error banner --- */

.chat__error-banner {
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin: 0 12px 4px 12px;
  background: #FDF6E3;
  border: 1px solid #E8C84A;
  border-radius: 8px;
  font-size: 12px;
  color: #5C4A00;
  flex-shrink: 0;
}

.chat__error-banner-text {
  flex: 1;
  line-height: 1.4;
}

.chat__error-retry {
  background: none;
  border: none;
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.chat__error-retry:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- Group 9: CHAT_CLOSED_ROUTE terminal block --- */

.chat__terminal {
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 20px 20px 20px;
  flex-shrink: 0;
}

.chat__terminal-rule {
  width: 100%;
  height: 1px;
  background: #E0E6EF;
  margin-bottom: 4px;
}

.chat__terminal-wordmark {
  font-size: 11px;
  font-weight: 600;
  color: #8A99AA;
  letter-spacing: 0.02em;
}

.chat__terminal-copy {
  font-size: 12px;
  color: #8A99AA;
  text-align: center;
  line-height: 1.4;
}

/* --- Group 10: MINIMIZED pill --- */

.chat__pill {
  position: fixed;
  bottom: 24px;
  right: 24px;
  height: 48px;
  padding: 0 16px;
  border-radius: 24px;
  background: var(--navy);
  color: #ffffff;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(31, 56, 100, 0.28);
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: box-shadow 150ms var(--ease);
  z-index: 9999;
}

.chat__pill:hover {
  box-shadow: 0 6px 20px rgba(31, 56, 100, 0.38);
}

.chat__pill:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 2px;
}

.chat__pill-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  opacity: 0.85;
}

.chat__pill-chevron {
  width: 14px;
  height: 14px;
  opacity: 0.7;
}

.chat__pill-unread {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--blue);
  border: 1.5px solid var(--navy);
  display: none;
}

#chat-widget-container[data-state="MINIMIZED"][data-unread="true"] .chat__pill-unread {
  display: block;
}

/* --- Group 11: CONFIRM_CLOSE modal --- */

.chat__confirm-modal {
  position: absolute;
  inset: 0;
  background: rgba(31, 56, 100, 0.55);
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  border-radius: inherit;
}

.chat__confirm-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 20px;
  width: 100%;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.chat__confirm-copy {
  font-size: 13px;
  line-height: 1.5;
  color: #1A1A2E;
  text-align: center;
}

.chat__confirm-actions {
  display: flex;
  gap: 8px;
}

.chat__confirm-cancel {
  flex: 1;
  padding: 9px 0;
  border: 1.5px solid #C5D0DE;
  border-radius: 8px;
  background: #ffffff;
  color: #4A5568;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 120ms var(--ease), color 120ms var(--ease);
}

.chat__confirm-cancel:hover {
  border-color: var(--navy);
  color: var(--navy);
}

.chat__confirm-cancel:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.chat__confirm-close-btn {
  flex: 1;
  padding: 9px 0;
  border: none;
  border-radius: 8px;
  background: var(--blue);
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  opacity: 0.85;
  transition: opacity 120ms var(--ease);
}

.chat__confirm-close-btn:hover { opacity: 1; }

.chat__confirm-close-btn:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

/* Header — minimize button (companion to existing .chat__close) */
.chat__minimize {
  color: #ffffff;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.2s var(--ease);
}
.chat__minimize:hover { background: rgba(255, 255, 255, 0.12); }
.chat__minimize:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 2px;
}

.chat__header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Reduced-motion suppression for widget animations
   (Note: the global *-rule below also nullifies these via !important — kept
   here for documentation and as a fallback if the global rule is ever scoped.) */
@media (prefers-reduced-motion: reduce) {
  .chat__message    { animation: none; }
  .chat__loading-dot {
    animation: none;
    opacity: 0.7;
  }
}

/* --- Group 12: Accessibility tokens --- */

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

:focus:not(:focus-visible) {
  outline: none;
}

/* Pill rides on a navy background — needs a white ring to be visible */
.chat__pill:focus-visible {
  outline-color: #ffffff;
}

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

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 960px) {
  .cards { grid-template-columns: 1fr; gap: 20px; }

  .steps { grid-template-columns: 1fr; gap: 32px; }
  .steps::before { display: none; }
  .step { padding: 0; }

  .about { grid-template-columns: 1fr; gap: 32px; }

  .footer__inner { grid-template-columns: 1fr; text-align: center; }
  .footer__left, .footer__right { text-align: center; justify-content: center; }
  .footer__left img { margin: 0 auto; }
}

@media (max-width: 720px) {
  .section { padding: 72px 0; }
  .section__title { margin-bottom: 40px; }

  .nav__toggle { display: flex; }
  .nav__links {
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: var(--white);
    flex-direction: column;
    gap: 0;
    padding: 12px 0;
    box-shadow: var(--shadow-md);
    transform: translateY(-10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  }
  .nav__links.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }
  .nav__link {
    padding: 14px 24px;
    width: 100%;
  }
  .nav__link::after { display: none; }

  .card { padding: 32px 24px; }

  .chat { right: 12px; bottom: 12px; left: 12px; width: auto; }

  /* --- Group 13: Chat widget — mobile extensions --- */

  /* Container takes full bottom anchor on mobile */
  #chat-widget-container[data-state]:not([data-state="CLOSED"]) {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
  }

  /* Inner panel goes near-full-screen */
  #chat-widget-container .chat {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 90vh;
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
  }

  /* iOS zoom suppression — 16px minimum on input */
  .chat__input { font-size: 16px; }

  /* Touch targets — minimum 44px (chips at 40px per spec) */
  .chat__gate-btn          { min-height: 44px; }
  .chat__send-btn          { width: 44px; height: 44px; }
  .chat__chip              { min-height: 40px; }
  .chat__confirm-cancel,
  .chat__confirm-close-btn { min-height: 44px; }

  /* Pill respects iOS safe-area-inset on notched devices */
  .chat__pill {
    bottom: max(24px, env(safe-area-inset-bottom, 24px));
  }

  /* --- Mobile extensions for Groups 14–18 --- */

  .chat__file-btn {
    width: 44px;
    height: 44px;
  }

  .chat__file-chip {
    max-width: 100%;
    font-size: 14px;
    padding: 8px 10px 8px 12px;
  }

  .chat__file-chip__name {
    font-size: 14px;
  }

  .chat__file-chip__remove {
    width: 36px;
    height: 36px;
  }

  .chat__file-error__body {
    font-size: 14px;
  }

  .chat__file-error__body a {
    display: inline-block;
    padding: 2px 0;
  }
}

/* ============================================
   Chat widget — file upload affordances (Sub-step 9.4 V2)
   ============================================
   Driven by three new container attributes:
   - data-files-attached="0|1|2|3" — chip rendering & file-btn disable
   - data-dragover="true"          — drag/drop overlay visibility
   - data-uploading="true"         — upload progress indicator
   - data-file-error="size_exceeded|wrong_type|upload_failed|none"
                                   — error banner variant
   ============================================ */

/* === Group 14 — File attachment button === */

.chat__file-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 120ms var(--ease), color 120ms var(--ease);
  flex-shrink: 0;
}

.chat__file-btn:hover {
  background: #EEF2F7;
  color: var(--blue);
}

.chat__file-btn:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.chat__file-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.chat__file-btn svg {
  width: 20px;
  height: 20px;
}

/* Hide file button outside CHAT_IDLE */
#chat-widget-container[data-state="GATE"] .chat__file-btn,
#chat-widget-container[data-state="CLOSED"] .chat__file-btn,
#chat-widget-container[data-state="MINIMIZED"] .chat__file-btn,
#chat-widget-container[data-state="CHAT_SENDING"] .chat__file-btn,
#chat-widget-container[data-state="CHAT_ERROR"] .chat__file-btn,
#chat-widget-container[data-state="CHAT_CLOSED_ROUTE"] .chat__file-btn,
#chat-widget-container[data-state="CONFIRM_CLOSE"] .chat__file-btn {
  display: none;
}

/* Disable file button when max files reached */
#chat-widget-container[data-files-attached="3"] .chat__file-btn {
  opacity: 0.4;
  pointer-events: none;
  cursor: not-allowed;
}

/* === Group 15 — File chip system === */

.chat__file-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px 0 12px;
  max-width: 100%;
}

#chat-widget-container[data-files-attached="0"] .chat__file-chips,
#chat-widget-container:not([data-files-attached]) .chat__file-chips {
  display: none;
}

.chat__file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 10px;
  background: #EEF2F7;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  max-width: 240px;
  animation: chipEnter 120ms var(--ease);
}

@keyframes chipEnter {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chat__file-chip__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-muted);
}

.chat__file-chip__name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
  min-width: 0;
}

.chat__file-chip__size {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.chat__file-chip__remove {
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: background 120ms var(--ease), color 120ms var(--ease);
}

.chat__file-chip__remove:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.chat__file-chip__remove:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

@media (prefers-reduced-motion: reduce) {
  .chat__file-chip {
    animation: none;
  }
}

/* === Group 16 — Drag-and-drop overlay === */

.chat__dragdrop-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(46, 117, 182, 0.08);
  border: 2px dashed var(--blue);
  border-radius: var(--radius);
  pointer-events: none;
  z-index: 5;
  animation: overlayFade 100ms var(--ease);
}

#chat-widget-container[data-dragover="true"][data-state="CHAT_IDLE"] .chat__dragdrop-overlay {
  display: flex;
}

.chat__dragdrop-overlay__label {
  font-size: 14px;
  font-weight: 600;
  color: var(--blue);
  background: var(--white);
  padding: 8px 16px;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

@keyframes overlayFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .chat__dragdrop-overlay {
    animation: none;
  }
}

/* Warn variant when max files reached */
#chat-widget-container[data-files-attached="3"][data-dragover="true"] .chat__dragdrop-overlay {
  background: rgba(232, 200, 74, 0.12);
  border-color: #E8C84A;
}

#chat-widget-container[data-files-attached="3"][data-dragover="true"] .chat__dragdrop-overlay__label {
  color: #5C4A00;
}

/* === Group 17 — Upload progress indicator === */

.chat__upload-progress {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 6px 12px;
  background: #EEF2F7;
  border-top: 1px solid var(--border);
}

#chat-widget-container[data-uploading="true"] .chat__upload-progress {
  display: flex;
}

.chat__upload-progress__label {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat__upload-progress__bar {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.chat__upload-progress__fill {
  height: 100%;
  width: var(--upload-pct, 0%);
  background: var(--blue);
  border-radius: 2px;
  transition: width 200ms var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  .chat__upload-progress__fill {
    transition: none;
  }
}

/* Suppress upload progress outside CHAT_IDLE and CHAT_SENDING */
#chat-widget-container[data-state="GATE"] .chat__upload-progress,
#chat-widget-container[data-state="CLOSED"] .chat__upload-progress,
#chat-widget-container[data-state="MINIMIZED"] .chat__upload-progress,
#chat-widget-container[data-state="CHAT_ERROR"] .chat__upload-progress,
#chat-widget-container[data-state="CHAT_CLOSED_ROUTE"] .chat__upload-progress,
#chat-widget-container[data-state="CONFIRM_CLOSE"] .chat__upload-progress {
  display: none !important;
}

/* === Group 18 — File error states === */
/* Palette intentionally matches Group 8 (existing conversational error banner)
   for visual consistency. Inline hexes match Group 8 exactly. */

.chat__file-error {
  display: none;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: #FDF6E3;
  border-top: 1px solid #E8C84A;
  border-bottom: 1px solid #E8C84A;
  font-size: 13px;
  color: #5C4A00;
}

#chat-widget-container[data-file-error="size_exceeded"] .chat__file-error,
#chat-widget-container[data-file-error="wrong_type"] .chat__file-error,
#chat-widget-container[data-file-error="upload_failed"] .chat__file-error {
  display: flex;
}

.chat__file-error__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #E8C84A;
  margin-top: 1px;
}

.chat__file-error__body {
  flex: 1;
  min-width: 0;
  line-height: 1.4;
}

.chat__file-error__body strong {
  font-weight: 600;
}

.chat__file-error__body a {
  color: #5C4A00;
  text-decoration: underline;
  font-weight: 500;
}

.chat__file-error__body a:hover {
  color: var(--blue);
}

.chat__file-error__body a:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 2px;
}

.chat__file-error__dismiss {
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #5C4A00;
  flex-shrink: 0;
  transition: background 120ms var(--ease);
}

.chat__file-error__dismiss:hover {
  background: rgba(120, 53, 15, 0.12);
}

.chat__file-error__dismiss:focus-visible {
  outline: 2px solid #E8C84A;
  outline-offset: 1px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero__grid { display: none; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
