/* Olivia Ussami — operations desk */

:root {
  --accent-warm: #c46a52;
  /* Calm coastal palette: powder blue, steel blue, deep teal, and blush. */
  --color-white: #ffffff;
  --color-light-gray: #b8ccd9;
  --color-medium-gray: #b8ccd9;
  --color-charcoal: #343434;
  --md-sys-color-primary: #c46a52;
  --md-sys-color-on-primary: #343434;
  --md-sys-color-primary-container: color-mix(in srgb, #c46a52 38%, #ffffff);
  --md-sys-color-on-primary-container: #343434;
  --md-sys-color-surface: #ffffff;
  --md-sys-color-surface-container: color-mix(in srgb, #b8ccd9 32%, #ffffff);
  --md-sys-color-surface-container-high: color-mix(in srgb, #b8ccd9 54%, #ffffff);
  --md-sys-color-outline: #b8ccd9;
  --md-sys-color-error: #343434;
  --md-sys-elevation-1: 0 1px 2px rgba(42, 102, 101, 0.12), 0 1px 3px 1px rgba(42, 102, 101, 0.08);
  --md-sys-elevation-2: 0 2px 6px 2px rgba(42, 102, 101, 0.12), 0 1px 2px rgba(42, 102, 101, 0.16);
  --brand-green: #2a6665;
  --ink: #343434;
  --ink-muted: color-mix(in srgb, #343434 76%, #ffffff);
  --border: #b8ccd9;
  --surface: #ffffff;
  --surface-muted: color-mix(in srgb, #b8ccd9 38%, #ffffff);
  --rail: #2a6665;
  --rail-width: 3.5rem;
  --sidebar-width: 15rem;
  --chat-composer-height: 4.5rem;
  --chat-fab-size: 3rem;
  --chat-fab-offset: 0.75rem;
  --chat-column-max: 44rem;
  --touch-min: 44px;
  --shadow-soft: 0 8px 28px rgba(42, 102, 101, 0.08);
  --shadow-sheet: 0 -16px 48px rgba(42, 102, 101, 0.12);
  --display: "Avenir Next", "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --sans: "Source Sans 3", "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius-lg: 1.15rem;
  --radius-md: 0.8rem;
  --radius-sm: 0.625rem;
  --radius-pill: 999px;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --motion-fast: 140ms;
  --motion-normal: 220ms;
  --ease-human: cubic-bezier(0.2, 0.8, 0.2, 1);
}

:where(button, textarea, input, select, a):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent-warm) 42%, transparent);
  outline-offset: 2px;
}

/* Keep Tailwind utility surfaces and neutrals inside the shared palette. */
.bg-white,
.bg-gray-50 { background-color: var(--color-white); }
.bg-gray-100 { background-color: var(--surface-muted); }
.border-gray-100,
.border-gray-200 { border-color: var(--color-light-gray); }
.text-gray-900,
.text-gray-700 { color: var(--color-charcoal); }
.text-gray-400,
.text-gray-500,
.text-gray-600 { color: var(--ink-muted); }

html {
  height: 100%;
}

body {
  height: 100dvh;
  overflow: hidden;
}

html.help-document {
  height: auto;
  min-height: 100%;
}

body.help-document {
  height: auto;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.app-shell {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

.main-column {
  min-height: 0;
  overflow: hidden;
}

main {
  min-height: 0;
}

.icon-rail-btn {
  display: flex;
  height: 2.5rem;
  width: 2.5rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.625rem;
  color: #a1a1aa;
  transition: background-color 0.15s, color 0.15s;
}

.icon-rail-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #d5e8f1;
}

.icon-rail-btn.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--accent-warm);
}

.icon-rail-logo {
  display: flex;
  height: 2rem;
  width: 2rem;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.olivia-lottie {
  display: block;
  overflow: hidden;
  border-radius: 999px;
  background: #ffffff;
  flex-shrink: 0;
}

.olivia-lottie svg {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.olivia-lottie--xs {
  width: 1.75rem;
  height: 1.75rem;
}

.olivia-lottie--sm {
  width: 2rem;
  height: 2rem;
}

.olivia-lottie--md {
  width: 3rem;
  height: 3rem;
}

.olivia-lottie--lg {
  width: 100%;
  height: 100%;
}

.olivia-avatar-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  border-radius: 999px;
  background: #c46a52;
  color: #2a6665;
  font-size: 0.7em;
  font-weight: 800;
}

#sidebar.secondary-nav {
  transform: translateX(calc(-100% - var(--rail-width)));
  box-shadow: none;
}

#sidebar.secondary-nav.is-open {
  transform: translateX(0);
  box-shadow: 8px 0 30px rgba(0, 0, 0, 0.06);
}

@media (min-width: 1024px) {
  #icon-rail {
    display: none;
  }

  #sidebar.secondary-nav {
    transform: translateX(0);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    max-height: none;
    border-radius: 0;
    border-right: 1px solid var(--border);
    box-shadow: none;
  }

  #sidebar.secondary-nav.is-open {
    box-shadow: 1px 0 0 #b8ccd9;
  }

  #sidebar-close {
    display: none;
  }

  #sidebar-backdrop {
    display: none !important;
  }

  .main-column {
    margin-left: var(--sidebar-width);
  }

  .page-hero {
    padding-left: 2rem;
    padding-right: 2rem;
  }

  body.chat-session-active .page-hero {
    padding-top: 1rem;
    padding-bottom: 0.875rem;
  }

  body.chat-session-active .page-subtitle {
    display: none;
  }

  body.chat-session-active .page-title {
    font-size: 1.375rem;
    line-height: 1.25;
  }

  .chat-toolbar,
  .chat-composer,
  .chat-queue-indicator {
    max-width: var(--chat-column-max);
    width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  .chat-toolbar {
    padding-left: 2rem;
    padding-right: 2rem;
  }

  .chat-composer {
    position: relative;
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

.screen-context {
  display: flex;
  gap: 0.75rem;
  align-items: end;
  padding: 0.5rem 0.75rem 0;
  background: #fff;
}
.screen-context-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.75rem;
  color: #6b7280;
  min-width: 0;
}
.screen-context-field:first-child { flex: 1; }
.screen-context-field input,
.screen-context-field select {
  font: inherit;
  color: #111827;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 0.35rem 0.5rem;
  background: #fff;
}
.composer-hints {
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  bottom: calc(100% - 0.25rem);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.35rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.composer-hints.hidden { display: none; }

.composer-hint {
  text-align: left;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  padding: 0.45rem 0.6rem;
  font-size: 0.875rem;
  color: #111827;
  cursor: pointer;
}

.composer-hint.active,
.composer-hint:hover { background: #f3f4f6; }

.chat-insights {
  margin-top: 0.65rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: #4b5563;
}

.chat-follow-up-caption {
  margin: 0.75rem 0 0.25rem;
  font-size: 0.75rem;
  color: #6b7280;
}

/* Builder workspace: one hierarchy for dense operational work. */
body.mode-tester .page-hero {
  border-bottom: 1px solid var(--color-light-gray);
  box-shadow: none;
}

.tester-toolbar-scroll {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  overflow: visible;
  padding: 0;
}

.tester-toolbar-group {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.15rem;
}

#tester-controls .tester-tab.side-nav-item {
  border: 1px solid transparent;
  background: transparent;
  box-shadow: none;
  white-space: nowrap;
  cursor: pointer;
}

#tester-controls .tester-tab.side-nav-item.active,
#tester-controls .tester-tab.side-nav-item.is-active {
  border-color: color-mix(in srgb, var(--accent-warm) 25%, var(--color-white));
  background: color-mix(in srgb, var(--accent-warm) 9%, var(--color-white));
  color: var(--color-charcoal);
  font-weight: 500;
  box-shadow: none;
}

.manager-page {
  max-width: 84rem !important;
  padding-bottom: 3rem;
}

/* The workspace toolbar is the canonical builder navigation. */
.builder-page-nav {
  display: none;
}

.manager-page-header {
  align-items: flex-start;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-light-gray);
  padding-bottom: 1.1rem;
}

.manager-page-header h2 {
  font-size: 1.45rem;
  line-height: 1.15;
}

.manager-page-header p {
  max-width: 42rem;
  line-height: 1.45;
}

.manager-page-header > div:last-child {
  justify-content: flex-end;
}

.manager-table-wrap {
  border-radius: 0.5rem;
  box-shadow: none;
}

.manager-table-wrap + .manager-table-wrap {
  margin-top: 1.25rem;
}

.manager-table-wrap th {
  background: #f7f9f9;
  color: #52606d;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.manager-table-wrap td {
  line-height: 1.4;
}

.manager-actions {
  justify-content: flex-end;
}

.manager-state {
  border-radius: 0.25rem;
}

.manager-generation-status {
  border-radius: 0.375rem;
}

details.manager-disclosure {
  margin-top: 1rem;
  border: 1px solid var(--color-light-gray);
  border-radius: 0.5rem;
  background: #fff;
}

details.manager-disclosure summary {
  cursor: pointer;
  padding: 0.75rem 0.9rem;
  color: #344054;
  font-size: 0.8125rem;
  font-weight: 700;
}

details.manager-disclosure .table-wrap {
  border-top: 1px solid var(--color-light-gray);
}

@media (max-width: 640px) {
  .manager-page-header > div:last-child {
    width: 100%;
    justify-content: flex-start;
  }

  .manager-page-header > div:last-child .ui-btn-secondary,
  .manager-page-header > div:last-child .ui-btn-primary {
    flex: 1 1 auto;
  }
}

/* Dedicated semantic-model workspace. */
.semantic-workspace {
  max-width: 84rem;
  padding-bottom: 3rem;
}

.semantic-workspace-nav,
body.mode-tester .builder-page-nav,
body.mode-semantic .builder-page-nav {
  display: flex;
  gap: 0.2rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-light-gray);
  padding-bottom: 0.55rem;
}

.semantic-workspace-nav button,
body.mode-tester .builder-page-nav button,
body.mode-semantic .builder-page-nav button {
  flex: 0 0 auto;
  border: 0;
  border-radius: 0.375rem;
  background: transparent;
  padding: 0.45rem 0.65rem;
  color: #52606d;
  font-size: 0.8125rem;
  font-weight: 650;
}

.semantic-workspace-nav button:hover,
.semantic-workspace-nav button.active,
body.mode-tester .builder-page-nav button:hover,
body.mode-tester .builder-page-nav button.active,
body.mode-semantic .builder-page-nav button:hover,
body.mode-semantic .builder-page-nav button.active {
  background: #eaf2f2;
  color: #1f5958;
}

.semantic-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.25rem 0 2rem;
}

.semantic-kicker {
  margin: 0 0 0.35rem;
  color: #5b7373;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.semantic-hero h2,
.semantic-next-step h3,
.semantic-section-heading h3 {
  margin: 0;
  color: var(--color-charcoal);
  font-family: var(--display);
  font-weight: 600;
}

.semantic-hero h2 { font-size: 2rem; line-height: 1.05; }
.semantic-hero p:not(.semantic-kicker) { max-width: 39rem; margin: 0.7rem 0 0; color: #667085; }

.roadmap-list { display: grid; gap: 0.55rem; margin: 0; padding: 0; list-style: none; }
.roadmap-list li { display: grid; grid-template-columns: 2.25rem minmax(0, 1fr) auto; align-items: start; gap: 0.85rem; border-bottom: 1px solid var(--color-light-gray); padding: 1rem 0; }
.roadmap-list li > span { display: grid; width: 2rem; height: 2rem; place-items: center; border: 1px solid #cbd5d9; border-radius: 50%; color: #52606d; font-size: 0.8125rem; font-weight: 700; }
.roadmap-list strong { color: var(--color-charcoal); font-size: 0.9375rem; }
.roadmap-list p { margin: 0.25rem 0 0; color: #667085; font-size: 0.8125rem; line-height: 1.45; }
.roadmap-list em { align-self: center; color: #667085; font-size: 0.75rem; font-style: normal; font-weight: 700; text-transform: uppercase; }
.roadmap-list .is-complete > span { border-color: #1f5958; background: #eaf2f2; color: #1f5958; }
.roadmap-list .is-complete em { color: #1f5958; }
.roadmap-list .is-current { border-left: 3px solid var(--accent-warm); padding-left: 0.75rem; background: #fff8fa; }
.roadmap-list .is-current > span { border-color: var(--accent-warm); color: var(--accent-warm); }
.roadmap-list .is-current em { color: var(--accent-warm); }

@media (max-width: 640px) {
  .roadmap-list li { grid-template-columns: 2.25rem minmax(0, 1fr); }
  .roadmap-list em { grid-column: 2; justify-self: start; }
}

.semantic-stage-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.5rem;
}

.semantic-stage {
  position: relative;
  min-height: 9rem;
  border: 1px solid var(--color-light-gray);
  border-radius: 0.5rem;
  background: #fff;
  padding: 0.85rem;
  text-align: left;
}

.semantic-stage:hover { border-color: #93b7b6; background: #f9fcfc; }
.semantic-stage span { display: block; color: #738080; font-size: 0.75rem; font-weight: 700; }
.semantic-stage strong { display: block; margin-top: 0.7rem; color: #344054; font-size: 0.8125rem; }
.semantic-stage b { display: block; margin-top: 0.2rem; color: #1f5958; font-size: 1.8rem; line-height: 1; }
.semantic-stage small { display: block; margin-top: 0.5rem; color: #667085; font-size: 0.75rem; line-height: 1.35; }

.semantic-next-step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  border: 1px solid #c9dcdb;
  border-left: 4px solid #2a6665;
  border-radius: 0.5rem;
  background: #f6fbfb;
  padding: 1rem 1.1rem;
}

.semantic-next-step h3 { font-size: 1.1rem; }
.semantic-next-step p:not(.semantic-kicker) { margin: 0.3rem 0 0; color: #52606d; font-size: 0.875rem; }

.semantic-review-queue {
  border-top: 1px solid var(--color-light-gray);
  padding-top: 1.5rem;
}

.semantic-section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; }
.semantic-section-heading h3 { font-size: 1.2rem; }
.semantic-review-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.65rem; }
.semantic-review-item { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; border: 1px solid var(--color-light-gray); border-radius: 0.5rem; background: #fff; padding: 0.85rem; text-align: left; }
.semantic-review-item:hover { border-color: #93b7b6; }
.semantic-review-item strong, .semantic-review-item small { display: block; }
.semantic-review-item strong { color: #344054; font-size: 0.8125rem; }
.semantic-review-item small { margin-top: 0.25rem; color: #667085; font-size: 0.75rem; line-height: 1.35; }
.semantic-review-item b { color: #1f5958; font-size: 1.25rem; }
.semantic-empty { border: 1px dashed #c9dcdb; border-radius: 0.5rem; padding: 1rem; color: #667085; font-size: 0.875rem; }

@media (max-width: 900px) {
  .semantic-stage-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .semantic-review-list { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .semantic-hero, .semantic-next-step, .semantic-section-heading { align-items: flex-start; flex-direction: column; }
  .semantic-hero .ui-btn-primary, .semantic-next-step .ui-btn-primary { width: 100%; }
  .semantic-stage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .semantic-stage { min-height: 7.8rem; }
}

@media (max-width: 1023px) {
  #icon-rail {
    display: none !important;
  }

  #sidebar-backdrop {
    z-index: 50;
  }

  #sidebar.secondary-nav {
    z-index: 55;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    max-height: min(78vh, 560px);
    border-right: none;
    border-top: 1px solid var(--border);
    border-radius: 1rem 1rem 0 0;
    transform: translateY(100%);
    box-shadow: none;
  }

  #sidebar.secondary-nav.is-open {
    transform: translateY(0);
    box-shadow: var(--shadow-sheet);
  }

  .mobile-sheet-handle {
    margin: 0.5rem auto 0;
    height: 0.25rem;
    width: 2.5rem;
    border-radius: 999px;
    background: #d1d5db;
  }

  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 20;
    padding-top: calc(0.625rem + env(safe-area-inset-top, 0px));
    padding-bottom: 0.625rem;
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.94);
  }

  .mobile-header-row {
    min-height: 2.75rem;
  }

  .page-breadcrumb {
    line-height: 1.2;
  }

  .page-subtitle {
    line-height: 1.3;
  }

  .mobile-brand-mark {
    display: flex;
    height: 2rem;
    width: 2rem;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: none;
    border-radius: 999px;
    padding: 0;
    background: #09090b;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
  }

  .mobile-brand-mark:active {
    transform: scale(0.96);
  }

  .mobile-help-link {
    display: flex;
    height: 2rem;
    width: 2rem;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    color: #343434;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
  }

  .mobile-help-link:hover {
    background: #ffffff;
    color: var(--accent-warm);
  }

  .mobile-help-link:active {
    transform: scale(0.96);
  }

  .tester-toolbar-scroll:not(.hidden) {
    display: flex;
    flex-direction: column;
    overflow: visible;
    padding: 0;
  }

  .tester-toolbar-scroll:not(.hidden)::-webkit-scrollbar {
    display: none;
  }

  body.panel-ai-active .chat-composer,
  body.mode-assistant .chat-composer {
    position: fixed;
    right: 0;
    left: 0;
    bottom: 0;
    z-index: 35;
    margin: 0;
    padding-bottom: calc(0.625rem + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-soft);
  }

  body.chat-session-active .page-breadcrumb,
  body.chat-session-active .page-subtitle {
    display: none;
  }

  body.chat-session-active .page-hero {
    padding-top: calc(0.5rem + env(safe-area-inset-top, 0px));
    padding-bottom: 0.5rem;
  }

  body.chat-session-active .page-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
  }

  body.chat-session-active .page-title::before {
    content: "";
    flex-shrink: 0;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 999px;
    background: var(--accent-warm);
  }

  body.chat-session-active[data-assistant="customer"] .page-title::before {
    background: var(--accent-warm);
  }

  body.chat-session-active[data-assistant="rider"] .page-title::before {
    background: var(--brand-green);
  }

  body.chat-session-active .chat-toolbar {
    display: none;
  }

  body.chat-home-active .page-subtitle {
    display: block;
  }

  body.panel-ai-active .chat-thread,
  body.mode-assistant .chat-thread {
    padding-bottom: calc(
      var(--chat-composer-height) + var(--chat-fab-size) + var(--chat-fab-offset)
      + env(safe-area-inset-bottom, 0px) + 0.75rem
    );
  }

  body.panel-ai-active .chat-composer,
  body.mode-assistant .chat-composer,
  body.panel-ai-active .chat-new-fab,
  body.mode-assistant .chat-new-fab {
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.22s ease;
    will-change: transform, opacity;
  }

  body.chat-chrome-hidden.panel-ai-active .chat-composer,
  body.chat-chrome-hidden.mode-assistant .chat-composer,
  body.chat-chrome-hidden.panel-ai-active .chat-new-fab,
  body.chat-chrome-hidden.mode-assistant .chat-new-fab {
    transform: translateY(calc(100% + env(safe-area-inset-bottom, 0px) + 1rem));
    opacity: 0;
    pointer-events: none;
  }

  .chat-new-fab {
    position: fixed;
    right: 1rem;
    bottom: calc(
      var(--chat-composer-height) + env(safe-area-inset-bottom, 0px) + var(--chat-fab-offset)
    );
    z-index: 36;
    display: flex;
    height: var(--chat-fab-size);
    width: var(--chat-fab-size);
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent-warm), #c46a52);
    color: #d5e8f1;
    box-shadow: 0 8px 24px rgba(241, 209, 201, 0.28);
  }

  .chat-new-fab:active {
    transform: scale(0.96);
  }

  body.chat-chrome-hidden .chat-new-fab:active {
    transform: translateY(calc(100% + env(safe-area-inset-bottom, 0px) + 1rem)) scale(0.96);
  }

  #new-chat {
    display: none;
  }

  .chat-nav-btn {
    display: flex;
    height: var(--touch-min);
    width: var(--touch-min);
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--ink-muted);
    transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
  }

  .chat-nav-btn:active {
    background: var(--surface-muted);
    color: var(--ink);
  }
}

/* Desktop composer and dock share one visual baseline and control height. */
@media (min-width: 1024px) {
  :root { --desktop-composer-control-height: 3.25rem; }

  .chat-input,
  .chat-send {
    min-height: var(--desktop-composer-control-height);
    height: var(--desktop-composer-control-height);
  }

  .chat-send { width: var(--desktop-composer-control-height); }

  /* The tester launcher is part of the composer row, not a smaller action
     inside a message bubble. Keep every composer control on one baseline. */
  .chat-composer {
    position: relative;
    align-items: center !important;
    min-height: calc(var(--desktop-composer-control-height) + 1.5rem);
  }

  .chat-composer #tester-tools-toggle {
    width: var(--desktop-composer-control-height);
    min-width: var(--desktop-composer-control-height);
    height: var(--desktop-composer-control-height);
    min-height: var(--desktop-composer-control-height);
    margin: 0;
  }

  #icon-rail.icon-rail {
    bottom: 0.75rem;
    height: var(--desktop-composer-control-height);
    padding: 0.2rem;
    box-sizing: border-box;
  }

  #icon-rail .icon-rail-btn {
    width: calc(var(--desktop-composer-control-height) - 0.5rem);
    height: calc(var(--desktop-composer-control-height) - 0.5rem);
  }

  #sidebar.secondary-nav,
  #sidebar.secondary-nav.is-open {
    left: 0 !important;
    right: auto !important;
    top: 0 !important;
    bottom: 0 !important;
    width: var(--sidebar-width) !important;
    transform: translateX(0) !important;
  }

  .main-column { margin-left: var(--sidebar-width) !important; }
  #icon-rail.icon-rail { display: none !important; }
  body.mode-tester #icon-rail.icon-rail {
    display: flex !important;
    left: 1.25rem !important;
    right: auto !important;
    bottom: 1.25rem !important;
    top: auto !important;
    width: auto !important;
    height: auto !important;
  }
  body.mode-tester #icon-rail .chat-composer { display: none !important; }
  body.mode-tester #tester-workspace-tabs { display: flex !important; }
}

/* Welcome content is Olivia's first message, not a separate dashboard. */
.chat-home-message {
  width: 100%;
  align-items: flex-start;
}

.chat-home-message > .chat-bubble {
  width: min(100%, 58rem);
  max-width: min(100%, 58rem);
}

.chat-home-message .chat-home-hero,
.chat-home-message .chat-home-help {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.chat-home-message .chat-home-hero { padding: 0 0 1.15rem; }

.chat-home-message .chat-home-help {
  margin-top: 1.25rem;
  padding: 1rem 0 0;
  border-top: 1px solid rgba(184, 204, 217, 0.55);
}

.chat-home-message .chat-home-assistant-head { align-items: flex-start; }

.olivia-welcome-copy {
  display: grid;
  gap: 0.8rem;
}

.olivia-welcome-copy .chat-home-lead { margin: 0; }

@media (max-width: 640px) {
  .chat-home-message > .chat-bubble { width: calc(100% - 2.75rem); }
  .chat-home-message .chat-home-cards { grid-template-columns: 1fr; }
}

/* Conversation glass — translucent depth without tinting the white canvas. */
.chat-row.assistant .chat-bubble {
  border: 1px solid rgba(184, 204, 217, 0.58);
  background: rgba(255, 255, 255, 0.72);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95) inset,
    0 18px 48px rgba(42, 102, 101, 0.09),
    0 2px 8px rgba(42, 102, 101, 0.05);
  backdrop-filter: blur(24px) saturate(1.15);
  -webkit-backdrop-filter: blur(24px) saturate(1.15);
}

.chat-row.user .chat-bubble {
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: rgba(241, 209, 201, 0.88);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.42) inset,
    0 16px 38px rgba(241, 209, 201, 0.2),
    0 2px 7px rgba(42, 102, 101, 0.06);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
}

.chat-row.assistant.error .chat-bubble {
  border-color: rgba(241, 209, 201, 0.48);
  background: rgba(255, 255, 255, 0.8);
}

.chat-bubble .chat-summary,
.chat-bubble .chat-debug,
.chat-bubble .chat-table-wrap {
  border-color: rgba(184, 204, 217, 0.5);
  background: rgba(255, 255, 255, 0.46);
}

.chat-reply-context {
  border-color: rgba(184, 204, 217, 0.58);
  border-left-color: var(--accent-warm);
  background: rgba(255, 255, 255, 0.76);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 -12px 38px rgba(42, 102, 101, 0.07);
  backdrop-filter: blur(24px) saturate(1.12);
  -webkit-backdrop-filter: blur(24px) saturate(1.12);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .chat-row.assistant .chat-bubble,
  .chat-reply-context {
    background: rgba(255, 255, 255, 0.96);
  }

  .chat-row.user .chat-bubble {
    background: var(--accent-warm);
  }
}

@media (min-width: 1024px) {
  .chat-nav-btn,
  .mobile-sheet-handle,
  .chat-new-fab,
  .chat-pull-refresh {
    display: none !important;
  }

  #new-chat {
    display: inline-flex;
  }
}

.nav-group-label {
  margin-bottom: 0.375rem;
  padding: 0 0.75rem;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #b8ccd9;
}

.nav-section-focus .nav-group-label {
  color: var(--accent-warm);
}

.assistant-nav-item,
.side-nav-item,
#tester-entry {
  border: 1px solid transparent;
  border-radius: 0.625rem;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

@media (max-width: 1023px) {
  .assistant-nav-item,
  .side-nav-item,
  #tester-entry {
    min-height: var(--touch-min);
    display: flex;
    align-items: center;
  }
}

.assistant-nav-item.is-active,
.side-nav-item.is-active,
#tester-entry.is-active {
  background: #ffffff;
  border-color: #b8ccd9;
  color: var(--ink);
  font-weight: 500;
}

.side-nav-item.is-active {
  color: var(--accent-warm);
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.status-pill.ok {
  border-color: rgba(42, 102, 101, 0.25);
  color: var(--brand-green);
  background: rgba(42, 102, 101, 0.06);
}

.status-pill.error {
  border-color: rgba(241, 209, 201, 0.25);
  color: var(--accent-warm);
  background: rgba(241, 209, 201, 0.06);
}

.ui-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  background: #ffffff;
}

.ui-card-header {
  border-bottom: 1px solid #d5e8f1;
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink);
}

.ui-card-body {
  padding: 1rem;
}

.visual-builder-section {
  border-bottom: 1px solid var(--color-light-gray);
  padding-bottom: 1.25rem;
}

.manager-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.builder-page-nav {
  display: flex;
  overflow-x: auto;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--color-light-gray);
  padding-bottom: 0.5rem;
}

.builder-page-nav button {
  flex: 0 0 auto;
  border-radius: 0.375rem;
  padding: 0.4rem 0.65rem;
  color: #52606d;
  font-size: 0.8125rem;
  font-weight: 600;
}

.builder-page-nav button:hover,
.builder-page-nav button.active {
  background: #eefbf3;
  color: #26724d;
}

.manager-page-header h2 {
  margin: 0;
  color: var(--color-charcoal);
  font-size: 1.25rem;
  font-weight: 700;
}

.manager-page-header p {
  margin: 0.3rem 0 0;
  color: #667085;
  font-size: 0.875rem;
}

.manager-table-wrap {
  overflow: hidden;
  border: 1px solid var(--color-light-gray);
  border-radius: 0.5rem;
  background: var(--color-white);
}

.manager-generation-status {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  margin: 0 0 1rem;
  border-left: 3px solid var(--accent-warm);
  background: #fff8f5;
  padding: 0.625rem 0.75rem;
  color: #52606d;
  font-size: 0.875rem;
}

.manager-generation-status.is-success {
  border-left-color: #26724d;
  background: #eefbf3;
  color: #26724d;
}

.manager-generation-status.is-error {
  border-left-color: #b42318;
  background: #fff4f2;
  color: #b42318;
}

.manager-spinner {
  display: inline-block;
  width: 0.875rem;
  height: 0.875rem;
  margin-right: 0.45rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: manager-spin 0.7s linear infinite;
}

@keyframes manager-spin {
  to { transform: rotate(360deg); }
}

.manager-table-wrap .table-wrap {
  margin: 0;
}

.manager-table-wrap th,
.manager-table-wrap td {
  vertical-align: top;
}

.manager-code {
  color: #667085;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.75rem;
}

.manager-state {
  display: inline-flex;
  border: 1px solid #b7dfca;
  border-radius: 999px;
  background: #eefbf3;
  padding: 0.15rem 0.5rem;
  color: #26724d;
  font-size: 0.75rem;
  font-weight: 700;
}

.manager-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.builder-modal-panel {
  width: min(42rem, 100%);
  max-height: min(48rem, calc(100vh - 2rem));
  overflow-y: auto;
  border: 1px solid var(--color-light-gray);
  border-radius: 0.75rem;
  background: var(--color-white);
  padding: 1.25rem;
  box-shadow: 0 24px 80px rgba(42, 102, 101, 0.18);
}

.builder-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.builder-modal-header h2 {
  margin: 0;
  color: var(--color-charcoal);
  font-size: 1.125rem;
  font-weight: 700;
}

.visual-builder-section:last-of-type {
  border-bottom: 0;
  padding-bottom: 0;
}

.visual-builder-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.visual-builder-heading h3 {
  margin: 0;
  color: var(--color-charcoal);
  font-size: 0.9375rem;
  font-weight: 700;
}

.visual-builder-heading span,
.visual-field > span {
  color: #667085;
  font-size: 0.75rem;
}

.visual-field {
  display: grid;
  gap: 0.375rem;
}

.visual-field > span {
  font-weight: 600;
}

.visual-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  border: 1px solid var(--color-light-gray);
  border-left: 3px solid var(--accent-warm);
  border-radius: 0.5rem;
  background: #fafafa;
  padding: 0.625rem 0.75rem;
  color: #52606d;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8125rem;
}

.visual-preview b {
  color: var(--color-charcoal);
  font-family: inherit;
}

.visual-recipe-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid var(--color-light-gray);
  border-radius: 0.5rem;
  padding: 0.875rem;
  font-size: 0.875rem;
}

.visual-recipe-item p {
  margin: 0.25rem 0 0;
}

.visual-recipe-name {
  margin-left: 0.5rem;
  color: #667085;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.75rem;
}

.visual-recipe-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.5rem;
}

#visual-recipe-result .table-wrap {
  max-height: 20rem;
}

@media (max-width: 640px) {
  .visual-builder-heading,
  .visual-recipe-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .visual-recipe-actions {
    width: 100%;
  }

  .manager-page-header {
    align-items: stretch;
    flex-direction: column;
  }

  .manager-actions {
    min-width: 11rem;
  }
}

.ui-input,
.ui-select,
.ui-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  background: #ffffff;
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  color: var(--ink);
}

.chat-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  background: #ffffff;
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  color: var(--ink);
}

.ui-textarea {
  resize: vertical;
}

.ui-input:focus,
.ui-select:focus,
.ui-textarea:focus,
.chat-input:focus {
  outline: none;
  border-color: rgba(241, 209, 201, 0.55);
  box-shadow: 0 0 0 3px rgba(241, 209, 201, 0.12);
}

.ui-btn-primary {
  border-radius: 0.625rem;
  background: var(--accent-warm);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #d5e8f1;
}

.ui-btn-primary:hover {
  background: var(--accent-warm);
}

.ui-btn-secondary {
  border-radius: 0.625rem;
  border: 1px solid var(--border);
  background: #ffffff;
  padding: 0.5rem 0.875rem;
  font-size: 0.875rem;
  color: var(--ink);
}

.ui-btn-secondary:hover {
  background: var(--surface-muted);
}

.ui-btn-ghost {
  border-radius: 999px;
  border: 1px solid rgba(42, 102, 101, 0.25);
  background: rgba(42, 102, 101, 0.06);
  padding: 0.375rem 0.75rem;
  font-weight: 600;
  color: var(--brand-green);
}

body.mode-assistant .tester-only {
  display: none !important;
}

body.mode-assistant .assistant-chat {
  display: flex !important;
}

body.mode-semantic .assistant-chat,
body.mode-semantic .tester-only {
  display: none !important;
}

body.mode-semantic #new-chat,
body.mode-semantic .unified-dock-more,
body.mode-semantic .mobile-conversation-actions {
  display: none !important;
}

.db-status-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: default;
}

.db-status-badge::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 0;
  top: calc(100% + .45rem);
  z-index: 5;
  width: max-content;
  max-width: 22rem;
  padding: .45rem .6rem;
  border-radius: 8px;
  background: #203534;
  color: #fff;
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.35;
  text-transform: none;
  white-space: pre-line;
  opacity: 0;
  pointer-events: none;
}

.db-status-badge:hover::after,
.db-status-badge:focus-visible::after { opacity: 1; }

.db-status-badge.ok {
  background: rgba(42, 102, 101, 0.12);
  color: var(--brand-green);
}

.db-status-badge.error {
  background: rgba(241, 209, 201, 0.1);
  color: var(--accent-warm);
}

.db-status-badge.idle {
  background: var(--surface-muted);
  color: var(--ink-muted);
}

.db-connect-details dd {
  overflow-wrap: anywhere;
}

.db-connect-hint code {
  color: inherit;
}

.db-saved-profile {
  display: none;
}

.db-profile-card-wrap { position: relative; min-width: 0; }
.db-profile-card-wrap .db-profile-card { width: 100%; height: 100%; padding-bottom: 2.75rem; }
.db-profile-delete {
  position: absolute;
  right: 1rem;
  bottom: .65rem;
  padding: .25rem .5rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #be123c;
  font-size: .8rem;
  cursor: pointer;
}
.db-profile-delete:hover { background: #fff1f2; }
.db-profile-delete:focus-visible { outline: 2px solid #be123c; outline-offset: 2px; }
.db-profile-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid #b8ccd9;
  border-radius: 0.875rem;
  background: #ffffff;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.db-profile-card:hover {
  background: #ffffff;
}

.db-profile-card.is-selected {
  border-color: rgba(0, 180, 180, 0.55);
  box-shadow: 0 0 0 1px rgba(0, 180, 180, 0.18);
}

.db-profile-card.is-active.is-selected {
  background: rgba(0, 180, 180, 0.04);
}

.db-profile-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
}

.db-profile-card-name {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #343434;
}

.db-profile-card-db {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #343434;
}

.db-profile-card-route {
  font-size: 0.75rem;
  color: #343434;
}

.db-profile-card-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.db-profile-card-status.ok {
  background: rgba(42, 102, 101, 0.12);
  color: var(--brand-green);
}

.db-profile-card-status.error {
  background: rgba(241, 209, 201, 0.1);
  color: var(--accent-warm);
}

.db-profile-card-status.idle {
  background: var(--surface-muted);
  color: var(--ink-muted);
}

.db-saved-profile-main {
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0.7rem;
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.db-saved-profile-main:hover {
  background: #ffffff;
}

.db-saved-profile-name {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #343434;
}

.db-saved-profile-meta {
  display: block;
  margin-top: 0.125rem;
  font-size: 0.6875rem;
  color: #343434;
}

.db-saved-profile-action {
  flex: 0 0 auto;
  padding: 0 0.65rem;
  border: 0;
  border-left: 1px solid #b8ccd9;
  background: #ffffff;
  color: #343434;
  font-size: 0.6875rem;
  font-weight: 600;
  cursor: pointer;
}

.db-saved-profile-action:hover {
  background: #ffffff;
}

.db-saved-profile-action.danger {
  color: #be123c;
}

body.mode-tester .page-hero {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.tester-controls {
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
}

.tester-controls:not(.hidden) {
  display: block;
}

.tester-scope-bar {
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  background: var(--surface-muted);
}

.chat-toolbar .tester-scope-bar {
  margin-right: 0.25rem;
}

/* Icon switcher is the tester control. The native select stays for value + a11y. */
.tester-assistant-icons {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

#tester-assistant-select {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.tester-assistant-icon {
  display: grid;
  width: 2.15rem;
  height: 2.15rem;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink-muted);
  cursor: pointer;
}

.tester-assistant-icon svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.85;
}

.tester-assistant-icon:hover,
.tester-assistant-icon:focus-visible {
  border-color: var(--accent-warm);
  color: var(--color-charcoal);
}

.tester-assistant-icon.is-active {
  border-color: var(--accent-warm);
  background: color-mix(in srgb, var(--accent-warm) 18%, #ffffff);
  color: var(--color-charcoal);
}

body.mode-tester #tester-scope-wrap:not(.hidden) {
  display: flex !important;
}

body.mode-assistant #tester-scope-wrap {
  display: none !important;
}

/* Tester controls read as a compact, centered control stack instead of an
   offset toolbar: label, selector, then the active-assistant indicator. */
body.mode-tester .chat-toolbar {
  justify-content: center;
  padding-block: 0.75rem;
}

body.mode-tester .chat-toolbar-start {
  flex: 0 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

body.mode-tester #tester-scope-wrap:not(.hidden) {
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  text-align: center;
}

body.mode-tester #tester-assistant-select {
  text-align: center;
  text-align-last: center;
}

body.mode-tester .chat-assistant-badge {
  margin: 0;
}

/* Tester header hierarchy: mode title, service status, then assistant scope. */
body.mode-tester .mobile-header-row {
  flex-wrap: wrap;
  justify-content: center;
}

body.mode-tester .assistant-header-identity {
  flex: 0 0 100%;
}

body.mode-tester .mobile-header-actions {
  flex: 0 0 100%;
  justify-content: center;
}

.tester-header-assistant {
  display: none;
  justify-content: center;
  margin-top: 0.6rem;
}

body.mode-tester .tester-header-assistant {
  display: flex;
}

body.mode-tester .tester-header-assistant #tester-scope-wrap:not(.hidden) {
  display: flex !important;
}

body.mode-tester .chat-toolbar {
  display: none;
}

@media (max-width: 1023px) {
  body.mode-tester .page-hero {
    top: 0;
  }

  .tester-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .tester-scope-bar {
    justify-content: space-between;
  }

  #tester-assistant-select {
    flex: 1;
    max-width: none;
  }
}

@media (min-width: 1024px) {
  .chat-composer {
    position: relative;
  }
}

.response-tabs button {
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: #ffffff;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.response-tabs button.active {
  border-color: rgba(241, 209, 201, 0.45);
  background: rgba(241, 209, 201, 0.08);
  color: var(--accent-warm);
  font-weight: 600;
}

.table-wrap,
.chat-table-wrap {
  overflow-x: auto;
  margin-top: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  background: #ffffff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

table th,
table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #d5e8f1;
  text-align: left;
  white-space: nowrap;
}

table th {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
  background: var(--surface-muted);
}

.json-output {
  overflow-x: auto;
  border-radius: 0.625rem;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  padding: 0.875rem;
  font-size: 0.75rem;
  color: var(--ink);
}

.json-output .key { color: #c46a52; }
.json-output .string { color: var(--brand-green); }
.json-output .number { color: #ca8a04; }
.json-output .boolean { color: var(--accent-warm); }
.json-output .null { color: var(--ink-muted); }

.alert-slot .alert {
  border-radius: 0.625rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
}

.alert-slot .alert.error {
  background: rgba(241, 209, 201, 0.08);
  border: 1px solid rgba(241, 209, 201, 0.2);
  color: #c46a52;
}

.alert-slot .alert.success {
  background: rgba(42, 102, 101, 0.08);
  border: 1px solid rgba(42, 102, 101, 0.2);
  color: var(--brand-green);
}

.meta-slot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 0.75rem;
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.meta-slot span {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  background: var(--surface-muted);
}

.empty-state {
  color: var(--ink-muted);
  font-size: 0.875rem;
}

.schema-discovery-note,
.schema-reference {
  color: var(--ink-muted);
  font-size: 0.75rem;
  line-height: 1.45;
}

.schema-discovery-note {
  grid-column: 1 / -1;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.schema-table-vendor {
  border-color: color-mix(in srgb, var(--accent-warm) 42%, var(--border));
}

.schema-vendor-badge {
  display: inline-block;
  margin-left: 0.35rem;
  border-radius: 999px;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  font-family: var(--sans);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.4rem;
  text-transform: uppercase;
  vertical-align: middle;
}

.assistant-chat {
  background:
    radial-gradient(circle at top right, rgba(241, 209, 201, 0.04), transparent 42%),
    #d5e8f1;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.panel[data-panel="ai"] {
  min-height: 0;
  overflow: hidden;
}

.panel[data-panel="ai"].active {
  display: flex;
  flex-direction: column;
}

.chat-toolbar {
  flex-shrink: 0;
  min-height: 2.75rem;
}

.chat-assistant-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  max-width: 100%;
  padding: 0.3125rem 0.625rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-assistant-badge::before {
  content: "";
  flex-shrink: 0;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--accent-warm);
}

.chat-assistant-badge[data-assistant="vendor"]::before {
  background: var(--accent-warm);
}

.chat-assistant-badge[data-assistant="customer"]::before {
  background: var(--accent-warm);
}

.chat-assistant-badge[data-assistant="rider"]::before {
  background: var(--brand-green);
}

body.chat-home-active .chat-assistant-badge,
body:not(.chat-session-active) .chat-assistant-badge {
  display: none !important;
}

@media (min-width: 1024px) {
  body.chat-session-active .chat-assistant-badge {
    display: inline-flex !important;
  }
}

.chat-thread-shell {
  position: relative;
  min-height: 0;
}

.chat-pull-refresh {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.5rem;
  height: 0;
  overflow: hidden;
  color: var(--ink-muted);
  font-size: 0.75rem;
  font-weight: 600;
  pointer-events: none;
  transition: height 0.22s ease;
}

.chat-pull-refresh-text {
  padding-bottom: 0.375rem;
}

.chat-pull-refresh-spinner {
  width: 1.125rem;
  height: 1.125rem;
  margin-bottom: 0.3125rem;
  border: 2px solid rgba(241, 209, 201, 0.22);
  border-top-color: var(--accent-warm);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.chat-thread-shell.is-pulling .chat-pull-refresh-spinner,
.chat-thread-shell.is-refreshing .chat-pull-refresh-spinner {
  opacity: 1;
  transform: scale(1);
}

.chat-thread-shell.is-refreshing .chat-pull-refresh-spinner {
  animation: chat-ptr-spin 0.7s linear infinite;
}

.chat-thread-shell.is-pulling .chat-thread,
.chat-thread-shell.is-refreshing .chat-thread {
  transition: transform 0.08s linear;
}

@keyframes chat-ptr-spin {
  to { transform: rotate(360deg); }
}

.chat-thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding: 1rem;
  max-width: var(--chat-column-max);
  width: 100%;
  margin: 0 auto;
}

@media (min-width: 640px) {
  .chat-thread {
    padding: 1.25rem 1.5rem;
    gap: 0.75rem;
  }
}

@media (min-width: 1024px) {
  .chat-thread {
    padding: 1.5rem 2rem 2rem;
    gap: 0.875rem;
  }
}

.chat-composer {
  flex-shrink: 0;
  z-index: 30;
  background: #ffffff;
}

.chat-queue-indicator {
  flex-shrink: 0;
  padding: 0.375rem 1rem 0;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #c46a52;
  background: #ffffff;
  border-top: 1px solid rgba(241, 209, 201, 0.15);
}

.chat-queue-indicator.hidden {
  display: none;
}

body.chat-is-loading .chat-send {
  background: linear-gradient(135deg, #c46a52, #c46a52);
  opacity: 1;
}

.chat-row.user.queued .chat-bubble {
  background: linear-gradient(135deg, rgba(241, 209, 201, 0.5), rgba(12, 125, 136, 0.5));
  border: 1px dashed rgba(255, 255, 255, 0.65);
}

.chat-queued-label {
  display: inline-block;
  margin-top: 0.25rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

@media (min-width: 1024px) {
  .main-column {
    padding-bottom: 0;
  }
}

.chat-row {
  display: flex;
  width: 100%;
  align-items: flex-end;
  gap: 0.5rem;
}

.chat-row.user { justify-content: flex-end; }
.chat-row.assistant { justify-content: flex-start; }

.chat-row-avatar {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  overflow: hidden;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.chat-row.user .chat-row-avatar {
  display: none;
}

.chat-row .chat-bubble {
  min-width: 0;
}

@keyframes chat-row-in-user {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes chat-row-in-assistant {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-row.user.chat-row-enter {
  animation: chat-row-in-user 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.chat-row.assistant.chat-row-enter {
  animation: chat-row-in-assistant 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.chat-bubble {
  max-width: min(88%, 520px);
  padding: 0.6875rem 0.9375rem 0.5625rem;
  border-radius: 1.125rem;
  font-size: 0.875rem;
  line-height: 1.5;
  word-break: break-word;
}

@media (min-width: 1024px) {
  .chat-bubble {
    max-width: min(78%, 540px);
    font-size: 0.9375rem;
  }
}

.chat-row.user .chat-bubble {
  background: linear-gradient(160deg, #c46a52 0%, #c46a52 100%);
  color: #d5e8f1;
  border-bottom-right-radius: 0.35rem;
  box-shadow: 0 10px 24px rgba(241, 209, 201, 0.22);
}

.chat-row.assistant .chat-bubble {
  background: var(--md-sys-color-surface);
  border: 1px solid var(--border);
  color: var(--ink);
  border-bottom-left-radius: 0.25rem;
  box-shadow: var(--md-sys-elevation-1);
}

.chat-row.assistant.error .chat-bubble {
  background: #fff1f2;
  border-color: rgba(241, 209, 201, 0.25);
  color: #c46a52;
}

.chat-bubble-text { white-space: pre-wrap; }

.chat-bubble-time {
  display: block;
  margin-top: 0.25rem;
  text-align: right;
  font-size: 0.625rem;
  color: var(--ink-muted);
}

.chat-row.user .chat-bubble-time {
  color: rgba(255, 255, 255, 0.75);
}

.chat-debug {
  margin-top: 0.75rem;
}

.chat-debug-divider {
  margin: 0.75rem 0;
  border-top: 1px solid var(--border);
}

.chat-debug-section + .chat-debug-divider {
  margin-top: 0;
}

.chat-debug-label {
  margin-bottom: 0.5rem;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.chat-debug-sublabel {
  margin: 0.625rem 0 0.375rem;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #b8ccd9;
}

.chat-debug-metrics {
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--ink-muted);
}

.chat-debug-metrics strong {
  color: var(--ink);
  font-weight: 600;
}

.chat-debug-sql {
  margin-top: 0.5rem;
}

.chat-sql-query {
  overflow-x: auto;
  border-radius: 0.5rem;
  background: #ffffff;
  padding: 0.625rem 0.75rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: #343434;
}

.chat-bubble .generated-query {
  margin-top: 0;
}

.chat-bubble .generated-query-json {
  max-height: 12rem;
  overflow: auto;
  font-size: 0.6875rem;
}

.chat-input {
  min-height: var(--touch-min);
  max-height: 120px;
  resize: none;
  border-radius: 1.375rem;
  border: 1px solid var(--md-sys-color-outline);
  background: var(--md-sys-color-surface);
  color: var(--ink);
  padding: 0.6875rem 1rem;
  flex: 1;
}

.chat-input:focus {
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-sys-color-primary) 18%, transparent);
  outline: none;
}

/* iOS Safari auto-zooms inputs < 16px and may stay zoomed after blur */
@supports (-webkit-touch-callout: none) {
  .chat-input {
    font-size: 16px !important;
    line-height: 1.35;
    -webkit-text-size-adjust: 100%;
  }
}

@media screen and (max-width: 1023px) {
  .chat-input {
    font-size: 16px;
    line-height: 1.35;
  }
}

.chat-send {
  display: flex;
  height: var(--touch-min);
  width: var(--touch-min);
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--md-sys-color-primary);
  color: #d5e8f1;
  transition: transform 0.12s ease, background 0.15s ease, opacity 0.15s ease;
  box-shadow: var(--md-sys-elevation-1);
}

.chat-send:active:not(:disabled) {
  transform: scale(0.92);
}

.chat-send:hover:not(:disabled) {
  background: #2a6665;
  box-shadow: var(--md-sys-elevation-2);
}

.chat-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chat-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--ink-muted);
}

.chat-home {
  position: relative;
  margin: 0 auto;
  max-width: 40rem;
  padding: 1.5rem 0 2rem;
  animation: chat-home-in 0.45s ease;
}

@keyframes chat-home-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-home-hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 1.5rem;
  padding: 1.75rem 1.25rem;
  border-radius: 1.25rem;
  border: 1px solid rgba(241, 209, 201, 0.15);
  background:
    radial-gradient(circle at 12% 20%, rgba(241, 209, 201, 0.14), transparent 42%),
    radial-gradient(circle at 88% 10%, rgba(241, 209, 201, 0.1), transparent 38%),
    radial-gradient(circle at 70% 90%, rgba(42, 102, 101, 0.08), transparent 40%),
    linear-gradient(145deg, #d5e8f1 0%, #d5e8f1 55%, #fffbf0 100%);
}

.chat-home-hero::after {
  content: "";
  position: absolute;
  inset: -40% -20% auto auto;
  width: 12rem;
  height: 12rem;
  border-radius: 50%;
  background: rgba(255, 242, 0, 0.12);
  animation: chat-home-float 8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes chat-home-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-12px, 8px) scale(1.05); }
}

.chat-home-avatar .olivia-lottie,
.chat-row-avatar .olivia-lottie,
.icon-rail-logo .olivia-lottie,
.mobile-brand-mark .olivia-lottie {
  width: 100%;
  height: 100%;
}

.chat-home-avatar {
  position: relative;
  z-index: 1;
  display: inline-flex;
  height: 4.5rem;
  width: 4.5rem;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 999px;
  padding: 0;
  background: #ffffff;
  box-shadow:
    0 8px 24px rgba(9, 9, 11, 0.2),
    0 0 0 3px rgba(241, 209, 201, 0.18);
}

.chat-home-title {
  position: relative;
  z-index: 1;
  margin-top: 0.875rem;
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
}

.chat-home-lead {
  position: relative;
  z-index: 1;
  margin-top: 0.5rem;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--ink-muted);
}

.chat-home-section-label {
  margin-bottom: 0.625rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #b8ccd9;
}

.chat-home-help {
  margin-top: 1.25rem;
  padding: 0.875rem 1rem;
  border-radius: 0.875rem;
  border: 1px solid rgba(241, 209, 201, 0.2);
  background: linear-gradient(180deg, rgba(241, 209, 201, 0.05), #d5e8f1);
}

.chat-home-help .chat-home-section-label {
  margin-bottom: 0.5rem;
}

.chat-home-help-steps {
  margin: 0;
  padding-left: 1.125rem;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--ink-muted);
}

.chat-home-help-steps li {
  margin-bottom: 0.35rem;
}

.chat-home-help-steps li:last-child {
  margin-bottom: 0;
}

.chat-home-help-link {
  color: var(--accent-warm);
  font-weight: 600;
  text-decoration: none;
}

.chat-home-help-link:hover {
  text-decoration: underline;
}

.chat-home-cards {
  display: grid;
  gap: 0.625rem;
}

@media (min-width: 480px) {
  .chat-home-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.chat-home-card {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 0.875rem;
  border-radius: 0.875rem;
  border: 1px solid var(--border);
  background: #ffffff;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.chat-home-card:hover {
  border-color: rgba(241, 209, 201, 0.35);
  box-shadow: 0 6px 18px rgba(241, 209, 201, 0.1);
  transform: translateY(-1px);
}

.chat-home-card.is-active {
  border-color: rgba(241, 209, 201, 0.45);
  background: linear-gradient(180deg, rgba(241, 209, 201, 0.06), #d5e8f1);
}

.chat-home-card-accent-cyan { border-top: 3px solid var(--accent-warm); }
.chat-home-card-accent-pink { border-top: 3px solid var(--accent-warm); }
.chat-home-card-accent-green { border-top: 3px solid var(--brand-green); }

.chat-home-card-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.chat-home-card-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink);
}

.chat-home-card-desc {
  font-size: 0.6875rem;
  line-height: 1.4;
  color: var(--ink-muted);
}

.chat-home-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.vendor-home-capabilities {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 0 0 1.45rem;
}

.vendor-home-capability {
  min-height: 7.5rem;
  border-left: 3px solid var(--accent-warm);
  background: #f7fbfb;
  padding: 0.8rem 0.9rem;
  text-align: left;
}

.vendor-home-capability:nth-child(2) { border-left-color: var(--accent-warm); background: #fff8fa; }
.vendor-home-capability:nth-child(3) { border-left-color: var(--brand-green); background: #f6fbf7; }
.vendor-home-capability-label { display: block; margin-bottom: 0.45rem; color: #52606d; font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; }
.vendor-home-capability strong { display: block; color: #263238; font-size: 0.875rem; line-height: 1.35; }
.vendor-home-capability small { display: block; margin-top: 0.6rem; color: #667085; font-size: 0.75rem; line-height: 1.4; }

@media (max-width: 720px) {
  .vendor-home-capabilities { grid-template-columns: 1fr; }
  .vendor-home-capability { min-height: auto; }
}

.chat-home-prompt {
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #ffffff;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--ink);
  text-align: left;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.12s ease;
  animation: chat-home-in 0.35s ease both;
}

.chat-home-prompts .chat-home-prompt:nth-child(1) { animation-delay: 0.03s; }
.chat-home-prompts .chat-home-prompt:nth-child(2) { animation-delay: 0.06s; }
.chat-home-prompts .chat-home-prompt:nth-child(3) { animation-delay: 0.09s; }
.chat-home-prompts .chat-home-prompt:nth-child(4) { animation-delay: 0.12s; }
.chat-home-prompts .chat-home-prompt:nth-child(5) { animation-delay: 0.15s; }

.chat-home-prompt:active {
  transform: scale(0.97);
}

.chat-home-prompt:hover {
  border-color: #c46a52;
  background: #fff;
  color: #203534;
}

.chat-home-roadmap {
  display: flex;
  width: 100%;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  border: 1px solid rgba(241, 209, 201, 0.2);
  border-radius: 0.875rem;
  background: linear-gradient(180deg, rgba(241, 209, 201, 0.05), rgba(213, 232, 241, 0.35));
  padding: 0.8rem 0.9rem;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
}
.chat-home-roadmap span { font-size: 0.875rem; font-weight: 700; }
.chat-home-roadmap small { color: var(--ink-muted); font-size: 0.75rem; }
.chat-home-roadmap:hover { border-color: rgba(241, 209, 201, 0.4); }
@media (max-width: 640px) { .chat-home-roadmap { align-items: flex-start; flex-direction: column; gap: 0.2rem; } }

.chat-home-assistant-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.chat-home-assistant-head .chat-home-avatar {
  margin: 0;
  height: 2.5rem;
  width: 2.5rem;
  border-radius: 0.75rem;
  font-size: 1rem;
}

.chat-home-assistant-meta h2 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ink);
}

.chat-home-assistant-meta p {
  margin-top: 0.125rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--ink-muted);
}

.chat-typing-dots {
  display: inline-flex;
  gap: 0.25rem;
}

.chat-progress {
  display: flex;
  min-width: min(22rem, 68vw);
  align-items: center;
  gap: 0.65rem;
  color: var(--ink-muted);
  font-size: 0.8125rem;
}

.chat-progress-label {
  min-width: 0;
  flex: 1;
}

.chat-progress-time {
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  opacity: 0.72;
}

.chat-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-warm);
  animation: chat-typing 1.2s infinite ease-in-out;
}

.chat-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing-dots span:nth-child(3) { animation-delay: 0.3s; }

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

.schema-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 768px) {
  .schema-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.schema-table h3 {
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent-warm);
}

.schema-table ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  list-style: none;
}

.schema-table li {
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background: var(--surface-muted);
  padding: 0.2rem 0.45rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
}

.perf-bars {
  display: grid;
  gap: 0.75rem;
}

.perf-bar-row {
  display: grid;
  grid-template-columns: 5rem 1fr 3.5rem;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.8125rem;
}

.perf-bar-track {
  height: 0.5rem;
  overflow: hidden;
  border-radius: 999px;
  background: #b8ccd9;
}

.perf-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-warm), var(--accent-warm));
}

.perf-history {
  max-height: 320px;
  overflow-y: auto;
}

.perf-history-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #d5e8f1;
  font-size: 0.8125rem;
}

.perf-history-item:hover {
  background: var(--surface-muted);
}

.chat-thread::-webkit-scrollbar,
.perf-history::-webkit-scrollbar,
.secondary-nav nav::-webkit-scrollbar {
  width: 6px;
}

.chat-thread::-webkit-scrollbar-thumb,
.perf-history::-webkit-scrollbar-thumb,
.secondary-nav nav::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 999px;
}

.chat-more {
  margin-top: 0.375rem;
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.chat-export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.625rem;
}

.chat-export-btn {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  background: var(--md-sys-color-surface);
  color: var(--ink);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.375rem 0.75rem;
  cursor: pointer;
  min-height: 2.5rem;
  transition: box-shadow 0.15s, border-color 0.15s, color 0.15s, background 0.15s, transform 0.12s ease;
}

.chat-export-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.chat-export-btn:hover {
  border-color: rgba(241, 209, 201, 0.4);
  color: var(--accent-warm);
  box-shadow: var(--md-sys-elevation-1);
}

.chat-export-btn-primary {
  border-color: rgba(241, 209, 201, 0.3);
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.chat-export-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.report-actions {
  padding-top: 0.25rem;
  border-top: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
}

.export-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.export-modal.hidden {
  display: none;
}

@keyframes export-modal-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes export-modal-up {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.export-modal:not(.hidden) .export-modal-backdrop {
  animation: export-modal-fade 0.2s ease both;
}

.export-modal:not(.hidden) .export-modal-panel {
  animation: export-modal-up 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.export-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
}

.export-modal-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(960px, 100%);
  max-height: min(85vh, 900px);
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.16);
}

.export-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #d5e8f1;
}

.export-modal-header h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.export-modal-close {
  appearance: none;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
}

.export-modal-close:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.export-modal-meta {
  margin: 0;
  padding: 0.625rem 1.25rem 0;
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

.export-modal-body {
  flex: 1;
  overflow: auto;
  margin: 0.75rem 1.25rem;
  max-height: none;
}

.reason-view {
  display: grid;
  gap: 0.75rem;
}

.reason-card {
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  padding: 0.85rem 1rem;
  background: #ffffff;
}

.reason-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.reason-card-head strong {
  font-size: 1rem;
}

.reason-card-head span {
  font-size: 1.25rem;
  font-weight: 650;
  color: #c46a52;
}

.reason-card p {
  margin: 0.4rem 0 0;
  color: #343434;
  font-size: 0.875rem;
  line-height: 1.4;
}

.export-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.875rem 1.25rem 1rem;
  border-top: 1px solid #d5e8f1;
}

.export-loading {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--ink-muted);
  font-size: 0.875rem;
}

/* ChatGPT-style conversation: open assistant messages, quiet user prompts. */
.chat-row.assistant .chat-bubble,
.chat-row.assistant.error .chat-bubble {
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.chat-row.user .chat-bubble {
  max-width: min(78%, 36rem);
  border: 1px solid color-mix(in srgb, var(--color-light-gray) 56%, var(--color-white));
  background: color-mix(in srgb, var(--color-light-gray) 24%, var(--color-white));
  color: var(--color-charcoal);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.chat-row.assistant .chat-message-actions {
  margin-top: 0.55rem;
}

.chat-row.assistant .chat-bubble-time {
  opacity: 0.58;
}

.chat-row.user .chat-bubble-time,
.chat-row.user .chat-user-reply-label {
  color: color-mix(in srgb, var(--color-charcoal) 72%, var(--color-white));
}

@media (max-width: 640px) {
  .chat-row.user .chat-bubble {
    max-width: 88%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-row-enter,
  .chat-home,
  .chat-home-prompt,
  .export-modal:not(.hidden) .export-modal-backdrop,
  .export-modal:not(.hidden) .export-modal-panel,
  .chat-typing-dots span,
  .chat-home-hero::after {
    animation: none !important;
  }

  .chat-send:active:not(:disabled),
  .chat-export-btn:active:not(:disabled),
  .chat-home-prompt:active {
    transform: none;
  }
}

/* Level-2 desk: quieter color, editorial type, calmer chat */

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--surface);
}

h1, h2, .page-title, #nav-section-title {
  font-family: var(--display);
  letter-spacing: -0.02em;
}

.icon-rail {
  background: var(--rail);
}

.secondary-nav {
  background: var(--surface);
  border-color: var(--border);
}

.assistant-chat {
  background: #ffffff;
}

.chat-toolbar {
  background: #ffffff;
  border-bottom-color: var(--border);
  backdrop-filter: blur(16px);
}

.chat-row.assistant .chat-bubble {
  background: #ffffff;
  border: 1px solid rgba(42, 102, 101, 0.06);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, var(--shadow-soft);
  border-radius: var(--radius-lg);
  border-bottom-left-radius: 0.35rem;
}

.chat-row.user .chat-bubble {
  background: linear-gradient(160deg, #c46a52 0%, #c46a52 100%);
  box-shadow: 0 10px 24px rgba(241, 209, 201, 0.22);
  border-radius: var(--radius-lg);
  border-bottom-right-radius: 0.35rem;
}

.chat-bubble {
  padding: 0.85rem 1.05rem 0.7rem;
  line-height: 1.55;
}

.chat-bubble-time {
  letter-spacing: 0.04em;
  font-weight: 500;
}

.chat-composer {
  background: #ffffff;
  border-top: 1px solid var(--border);
  backdrop-filter: blur(18px);
  gap: 0.65rem;
}

.chat-reply-context {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: min(100%, var(--chat-column-max));
  margin: 0 auto;
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--border);
  border-left: 3px solid var(--accent-warm);
  background: #ffffff;
  color: var(--ink);
}

.chat-reply-context.hidden { display: none; }

.chat-reply-context-copy {
  display: grid;
  min-width: 0;
  gap: 0.1rem;
  font-size: 0.75rem;
}

.chat-reply-context-copy span {
  overflow: hidden;
  color: var(--ink-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-reply-cancel {
  margin-left: auto;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  color: var(--ink-muted);
  font-size: 1.25rem;
}

.chat-reply-cancel:hover { background: var(--surface-muted); color: var(--ink); }
.chat-reply-actions { display: flex; margin-top: 0.45rem; }

.chat-reply-btn {
  min-height: 2rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink-muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.chat-reply-btn:hover { border-color: var(--accent-warm); color: var(--ink); }

.chat-user-reply-label {
  margin-top: 0.4rem;
  padding-top: 0.35rem;
  border-top: 1px solid rgba(42, 102, 101, 0.2);
  font-size: 0.68rem;
  opacity: 0.8;
}

.chat-input {
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(42, 102, 101, 0.04);
}

.chat-input:focus {
  border-color: rgba(241, 209, 201, 0.45);
  box-shadow: 0 0 0 4px rgba(241, 209, 201, 0.1);
  outline: none;
}

.chat-send {
  background: var(--accent-warm);
  box-shadow: 0 8px 18px rgba(241, 209, 201, 0.28);
}

.chat-send:hover:not(:disabled) {
  background: #c46a52;
}

body.chat-is-loading .chat-send {
  background: linear-gradient(135deg, #c46a52, #c46a52);
}

.ui-btn-primary {
  background: var(--accent-warm);
}

.ui-btn-primary:hover {
  background: #c46a52;
}

.chat-export-btn {
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.export-modal-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 24px 80px rgba(42, 102, 101, 0.18);
}

.export-modal-header h2 {
  font-family: var(--display);
}

.reason-card {
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.page-hero,
.ui-card,
.card {
  background: #ffffff;
}

:focus-visible {
  outline-color: rgba(241, 209, 201, 0.75);
}

/* L3: home density + shop pick list */

.chat-home {
  max-width: 38rem;
  padding: 1.15rem 0 1.5rem;
}

.chat-home-kicker {
  position: relative;
  z-index: 1;
  margin: 0 0 0.35rem;
  font-size: 0.6875rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-warm);
}

.chat-home-hero {
  margin-bottom: 1.15rem;
  padding: 1.25rem 1.15rem 1.15rem;
  border: 1px solid var(--border);
  background:
    radial-gradient(ellipse 80% 70% at 0% 0%, rgba(241, 209, 201, 0.08), transparent 55%),
    #d5e8f1;
  box-shadow: var(--shadow-soft);
}

.chat-home-hero::after {
  display: none;
}

.chat-home-title {
  margin-top: 0;
  font-family: var(--display);
  font-size: 1.65rem;
  font-weight: 600;
}

.chat-home-lead {
  margin-top: 0.35rem;
  max-width: 28rem;
}

.chat-home-section-label {
  color: var(--ink-muted);
  letter-spacing: 0.08em;
}

.chat-home-cards {
  gap: 0.5rem;
}

.chat-home-card {
  gap: 0.3rem;
  padding: 0.7rem 0.75rem 0.75rem;
  background: #ffffff;
  box-shadow: none;
}

.chat-home-card:hover {
  border-color: rgba(241, 209, 201, 0.35);
  box-shadow: var(--shadow-soft);
}

.chat-home-card.is-active {
  border-color: rgba(241, 209, 201, 0.4);
  background: linear-gradient(180deg, rgba(241, 209, 201, 0.06), #d5e8f1);
}

.chat-home-card-icon,
.chat-home-avatar-mark {
  display: inline-grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 0.45rem;
  font-family: var(--display);
  font-size: 0.82rem;
  font-weight: 600;
  color: #c46a52;
  background: rgba(241, 209, 201, 0.1);
}

.chat-home-card-accent-pink .chat-home-card-icon {
  color: #c46a52;
  background: rgba(241, 209, 201, 0.08);
}

.chat-home-card-accent-green .chat-home-card-icon {
  color: #343434;
  background: rgba(42, 102, 101, 0.1);
}

.chat-home-card-title {
  font-size: 0.875rem;
}

.chat-home-card-desc {
  font-size: 0.72rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chat-home-help {
  margin-top: 1rem;
  padding: 0.75rem 0.85rem;
  border-color: var(--border);
  background: #ffffff;
}

.chat-home-prompts {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.15rem;
}

.chat-home-prompt {
  width: 100%;
  border-radius: 0.7rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.8125rem;
  background: #ffffff;
}

.chat-home-prompt:hover {
  border-color: #c46a52;
  background: #fff;
  color: #203534;
}

.chat-pick-list {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.7rem;
}

.chat-follow-ups {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chat-follow-ups .chat-pick {
  width: auto;
  padding: 0.4rem 0.75rem;
}

.chat-follow-ups .chat-pick-name {
  font-size: 0.85rem;
}

.chat-pick {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.65rem;
  align-items: center;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 0.7rem;
  border: 1px solid var(--border);
  background: #ffffff;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.chat-pick:has(.chat-pick-index) {
  grid-template-columns: 1.6rem minmax(0, 1fr);
}

.chat-pick:hover {
  border-color: rgba(241, 209, 201, 0.4);
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.chat-pick-index {
  display: grid;
  place-items: center;
  height: 1.6rem;
  width: 1.6rem;
  border-radius: 999px;
  background: rgba(241, 209, 201, 0.1);
  color: #c46a52;
  font-size: 0.75rem;
  font-weight: 700;
}

.chat-pick-copy {
  display: grid;
  gap: 0.05rem;
  min-width: 0;
}

.chat-pick-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
  overflow-wrap: anywhere;
  word-break: normal;
}

.chat-pick-meta {
  font-size: 0.72rem;
  color: var(--ink-muted);
}

.chat-pick-more {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  color: var(--ink-muted);
}

/* Olivia conversational design system — warm, quiet, and human. */
body,
.assistant-chat,
.chat-thread,
.chat-thread-shell,
.main-column,
.page-hero,
.secondary-nav,
.chat-toolbar,
.chat-composer {
  background: var(--color-white);
}

body {
  color: var(--color-charcoal);
  font-family: var(--sans);
}

h1,
h2,
h3,
.page-title,
#nav-section-title,
.chat-home-title {
  font-family: var(--display);
  font-weight: 500;
  letter-spacing: -0.035em;
}

.page-subtitle,
.chat-home-lead,
.chat-home-card-desc,
.chat-bubble-time,
.chat-more {
  color: color-mix(in srgb, var(--color-charcoal) 68%, var(--color-white));
}

.assistant-nav-item,
.side-nav-item,
#tester-entry {
  border-radius: var(--radius-md);
  transition:
    color var(--motion-fast) ease,
    border-color var(--motion-fast) ease,
    background var(--motion-fast) ease;
}

.assistant-nav-item.is-active,
.side-nav-item.is-active,
#tester-entry.is-active {
  border-color: color-mix(in srgb, var(--accent-warm) 25%, var(--color-white));
  background: color-mix(in srgb, var(--accent-warm) 9%, var(--color-white));
  color: var(--color-charcoal);
}

.chat-row .chat-bubble {
  border-radius: 1.35rem;
}

.chat-row.assistant .chat-bubble {
  border: 1px solid color-mix(in srgb, var(--color-light-gray) 58%, var(--color-white));
  background: var(--color-white);
  box-shadow: 0 12px 36px rgba(42, 102, 101, 0.07);
}

.chat-row.user .chat-bubble {
  border: 0;
  background: var(--accent-warm);
  color: var(--color-charcoal);
  box-shadow: 0 10px 26px rgba(241, 209, 201, 0.18);
}

.chat-row.user .chat-bubble-time,
.chat-row.user .chat-user-reply-label {
  color: var(--color-charcoal);
}

.chat-input {
  min-height: 3.25rem;
  border-color: var(--color-light-gray);
  border-radius: var(--radius-pill);
  background: var(--color-white);
  padding: 0.8rem 1.1rem;
  transition:
    border-color var(--motion-fast) ease,
    box-shadow var(--motion-normal) var(--ease-human);
}

.chat-input:focus {
  border-color: var(--accent-warm);
  box-shadow: 0 0 0 5px rgba(241, 209, 201, 0.12);
}

.chat-send,
.ui-btn-primary,
.chat-export-btn-primary,
.chat-new-fab {
  background: var(--accent-warm);
  color: var(--color-charcoal);
}

.chat-send,
.chat-new-fab {
  box-shadow: 0 8px 22px rgba(241, 209, 201, 0.22);
  transition:
    transform var(--motion-fast) var(--ease-human),
    box-shadow var(--motion-normal) var(--ease-human);
}

.chat-send:hover:not(:disabled),
.ui-btn-primary:hover,
.chat-new-fab:hover {
  background: var(--accent-warm);
  filter: saturate(1.06);
}

.chat-send:hover:not(:disabled),
.chat-new-fab:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(241, 209, 201, 0.28);
}

.ui-card,
.card,
.chat-home-card,
.chat-home-hero,
.reason-card {
  border-color: var(--color-light-gray);
  background: var(--color-white);
  box-shadow: none;
}

.chat-home-card-accent-cyan,
.chat-home-card-accent-pink,
.chat-home-card-accent-green {
  border-top-color: var(--accent-warm);
}

.chat-home-card.is-active {
  border-color: var(--accent-warm);
  background: color-mix(in srgb, var(--accent-warm) 6%, var(--color-white));
}

.chat-reply-context {
  border-left-color: var(--accent-warm);
  box-shadow: 0 -8px 30px rgba(42, 102, 101, 0.04);
}

.chat-reply-btn:hover,
.chat-export-btn:hover {
  border-color: var(--accent-warm);
  color: var(--color-charcoal);
}

/* Final conversation material and actions layer. */
.chat-message-actions {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  margin-top: 0.7rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(184, 204, 217, 0.52);
}

.chat-view-results {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.25rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--color-white);
  color: var(--color-charcoal);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--motion-fast) ease, background var(--motion-fast) ease, transform var(--motion-fast) var(--ease-human);
}

.chat-view-results svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-view-results:hover {
  border-color: var(--accent-warm);
  background: color-mix(in srgb, var(--accent-warm) 10%, var(--color-white));
}

.chat-view-results:active { transform: scale(0.98); }

.chat-action-icon {
  display: inline-grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: color-mix(in srgb, var(--color-charcoal) 68%, var(--color-white));
  cursor: pointer;
  transition:
    color var(--motion-fast) ease,
    background var(--motion-fast) ease,
    transform var(--motion-fast) var(--ease-human);
}

.chat-action-icon svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-action-icon:hover {
  background: rgba(241, 209, 201, 0.12);
  color: var(--color-charcoal);
}

.chat-action-icon:active { transform: scale(0.92); }
.chat-action-icon:disabled { cursor: default; opacity: 0.42; }
.chat-action-icon.is-success { background: rgba(241, 209, 201, 0.16); color: var(--color-charcoal); }

.chat-message-actions .chat-export-actions,
.chat-message-actions .report-actions,
.chat-message-actions .chat-reply-actions {
  display: contents;
}

.chat-row.assistant .chat-bubble,
.chat-row.assistant.error .chat-bubble {
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.chat-row.user .chat-bubble {
  max-width: min(78%, 36rem);
  border: 1px solid color-mix(in srgb, var(--color-light-gray) 56%, var(--color-white));
  background: color-mix(in srgb, var(--color-light-gray) 24%, var(--color-white));
  color: var(--color-charcoal);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.chat-reply-context {
  border-color: rgba(184, 204, 217, 0.58);
  border-left-color: var(--accent-warm);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 -12px 38px rgba(42, 102, 101, 0.07);
  backdrop-filter: blur(24px) saturate(1.12);
  -webkit-backdrop-filter: blur(24px) saturate(1.12);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .chat-row.assistant .chat-bubble,
  .chat-reply-context { background: rgba(255, 255, 255, 0.96); }
  .chat-row.user .chat-bubble { background: color-mix(in srgb, var(--color-light-gray) 24%, var(--color-white)); }
}

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

/* Unified workspace layout. Shared controls retain the original component styles. */
:root { --sidebar-width: 15rem; --chat-column-max: 52rem; --border: #dfe5e4; --ink: #203534; --ink-muted: #5c6d6b; }
.ui-refined { background: #fff; color: var(--ink); }
.ui-refined .app-shell { height: 100dvh; min-height: 0; overflow: hidden; }
.ui-refined .main-column { height: 100%; min-width: 0; margin: 0 !important; }
.ui-refined .page-hero { display: block !important; padding: 1rem 1.5rem !important; background: #fff; border-bottom: 1px solid var(--border); transform: none !important; opacity: 1 !important; }
.ui-refined .page-title { font: 600 1.2rem/1.3 "Source Sans 3", sans-serif; letter-spacing: -.02em; }
.ui-refined .assistant-status { font-size: .8rem; color: var(--ink-muted); }
.ui-refined .assistant-status-pulse { display: none; }
.ui-refined .tester-header-assistant { margin-top: .5rem; }
.ui-refined.mode-assistant .tester-header-assistant { display: none; }
.ui-refined #sidebar.secondary-nav { position: fixed !important; inset: 0 auto 0 0 !important; display: flex !important; width: var(--sidebar-width) !important; max-height: none !important; height: 100dvh; border-radius: 0 !important; border: 0; border-right: 1px solid var(--border); box-shadow: none !important; background: #f7f9f8 !important; z-index: 50; }
.ui-refined #sidebar.secondary-nav.is-open { visibility: visible; opacity: 1; pointer-events: auto; transform: none !important; }
.ui-refined #nav-section-title { font-size: 1.15rem; }
.ui-refined .sidebar-actions { display: grid; gap: .5rem; padding: 1rem .75rem 0; }
.ui-refined .sidebar-conversation-actions { border-top: 1px solid var(--border); margin-top: 1rem; padding-top: .75rem; }
.ui-refined .side-nav-item, .ui-refined .assistant-nav-item { display: flex; width: 100%; min-height: 42px; align-items: center; padding: .65rem .75rem; border-radius: 6px; font-size: .9rem; text-align: left; }
.ui-refined .assistant-nav-item.is-active, .ui-refined .side-nav-item.active { background: #e4efeb; color: #205650; box-shadow: inset 3px 0 #2a6665; }
.ui-refined .mobile-sheet-handle, .ui-refined .chat-toolbar, .ui-refined .tester-assistant-icons, .ui-refined #chat-nav-open, .ui-refined .tester-chat-menu { display: none !important; }
.ui-refined .assistant-chat { display: flex !important; flex-direction: column; min-height: 0; padding: 0 !important; background: #fff; background-image: none; border: 0; border-radius: 0; box-shadow: none; }
.ui-refined .panel[data-panel="ai"] { padding: 0 !important; min-height: 0; }
.ui-refined .chat-thread-shell { min-height: 0; flex: 1; }
.ui-refined .chat-thread { display: block !important; width: 100%; max-width: none !important; padding: 2rem max(1.5rem, calc((100% - 50rem) / 2)) !important; overflow-x: hidden; overflow-y: auto; }
.ui-refined .chat-home { width: 100%; max-width: none; padding: 2rem 0; margin: auto; }
.ui-refined .chat-home-message > .chat-bubble { width: 100% !important; max-width: none !important; border: 0; padding: 0; box-shadow: none; background: transparent; }
.ui-refined .chat-home-message > .chat-row-avatar { display: none; }
.ui-refined .chat-home-hero { padding: 0 !important; margin-bottom: 1.75rem; border: 0 !important; background: none !important; }
.ui-refined .chat-home-hero::after { display: none; }
.ui-refined .chat-home-title { font: 600 1.8rem/1.25 "Source Sans 3", sans-serif !important; letter-spacing: -.035em; }
.ui-refined .chat-home-lead { color: var(--ink-muted); max-width: 38rem; margin-top: .7rem; font-size: 1rem; }
.ui-refined .chat-home-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.ui-refined .chat-home-card { min-height: 0; padding: 1rem; border: 1px solid var(--border); border-radius: 8px; background: #fff; box-shadow: none; }
.ui-refined .chat-home-card-icon { display: none; }
.ui-refined .chat-home-card-desc { display: block; font-size: .85rem; line-height: 1.5; color: var(--ink-muted); }
.ui-refined .chat-home-prompts { display: flex !important; flex-wrap: wrap; gap: .5rem; }
.ui-refined .chat-home-prompt { width: auto !important; max-width: 100%; padding: .7rem .9rem; background: #f7f9f8; border: 1px solid var(--border); border-radius: 6px; text-align: left; white-space: normal; color: #203534; }
.ui-refined .chat-home-prompt:hover { color: #203534; border-color: #c46a52; background: #fff; }
.ui-refined .chat-row { max-width: 100%; margin-bottom: 1.5rem; gap: .6rem; }
.ui-refined .chat-bubble { min-width: 0; max-width: calc(100% - 2.75rem); border-radius: 10px; box-shadow: none; overflow-wrap: anywhere; line-height: 1.65; }
.ui-refined .chat-row.assistant > .chat-bubble { background: #fff; border: 0; padding: .15rem .25rem; }
.ui-refined .chat-row.user > .chat-bubble { background: #edf4f1; border: 1px solid #e0eae5; }
.ui-refined .chat-narration p + p { margin-top: .85rem; }
.ui-refined .chat-narration ul, .ui-refined .chat-narration ol { padding-left: 1.4rem; margin: .8rem 0; }
.ui-refined .chat-narration ul { list-style: disc; }
.ui-refined .chat-narration ol { list-style: decimal; }
.ui-refined .chat-narration li + li { margin-top: .35rem; }
.ui-refined .chat-table-wrap, .ui-refined .table-wrap { max-width: 100%; overflow: auto; }
.ui-refined .chat-table-wrap { margin-top: 1rem; border: 1px solid var(--border); border-radius: 6px; }
.ui-refined th { background: #f5f8f6; color: #455a56; font-weight: 600; }
.ui-refined td, .ui-refined th { padding: .65rem .85rem; }
.ui-refined .chat-metric { display: flex; flex-direction: column; margin: 1rem 0; padding: .9rem 1rem; background: #f0f6f3; border-left: 3px solid #2a6665; border-radius: 4px; }
.ui-refined .chat-metric span { font-size: .8rem; color: var(--ink-muted); }
.ui-refined .chat-metric strong { font-size: 2rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.ui-refined .chat-record { margin-top: 1rem; }
.ui-refined .chat-record > div { display: grid; grid-template-columns: minmax(7rem, 1fr) 2fr; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--border); }
.ui-refined .chat-record dt { color: var(--ink-muted); font-size: .85rem; }
.ui-refined .chat-record dd { margin: 0; }
.ui-refined .chat-error { border-left: 3px solid #b44737; padding: .75rem 1rem; background: #fff5f2; border-radius: 4px; color: #73382e; }
.ui-refined #chat-composer-home { position: relative !important; inset: auto !important; width: 100%; max-width: 52rem; margin: 0 auto; padding: .5rem 1.5rem max(.5rem, env(safe-area-inset-bottom)); background: #fff; transform: none !important; opacity: 1 !important; }
.ui-refined .chat-composer { position: relative !important; inset: auto !important; display: flex !important; align-items: flex-end; width: 100%; padding: .55rem .65rem !important; background: #fff; border: 1px solid #b6c6c0; border-radius: 10px; box-shadow: 0 2px 8px #20353408; transform: none !important; opacity: 1 !important; overflow: visible; }
.ui-refined .chat-composer:focus-within { border-color: #2a6665; box-shadow: 0 0 0 3px rgba(42, 102, 101, .18); }
.ui-refined .chat-input { min-height: 44px; height: auto; max-height: 160px; overflow-y: auto; font-size: 16px; line-height: 1.45; padding: .65rem .5rem; border: 0; background: transparent; resize: none; outline: none; }
.ui-refined .chat-input:focus,
.ui-refined .chat-input:focus-visible { outline: none; box-shadow: none; border-color: transparent; }
.ui-refined .chat-send { width: 44px; height: 44px; min-height: 44px; border-radius: 7px; background: #2a6665 !important; color: #fff !important; }
.ui-refined .composer-help { margin-top: .4rem; font-size: .75rem; color: var(--ink-muted); text-align: center; }
.ui-refined .olivia-query-guide { display: none !important; }
.ui-refined.question-guide-open .olivia-query-guide { display: block !important; position: absolute !important; top: 5rem; right: 1rem; bottom: auto !important; width: min(24rem, calc(100vw - 2rem)); max-height: calc(100dvh - 7rem); overflow-y: auto; padding: 1.25rem; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 30px #20353420; z-index: 30; }
.ui-refined .ui-card { border-radius: 8px; box-shadow: none; }
.ui-refined .ui-btn-primary { background: #2a6665; color: #fff; }
.ui-refined button:disabled { opacity: .5; cursor: not-allowed; }
.ui-refined :is(button, a, input, textarea, select, summary, [tabindex]):focus-visible { outline: 3px solid #39796e; outline-offset: 3px; }
.ui-refined .chat-input:focus-visible { outline: none; outline-offset: 0; }
.ui-refined .export-modal-panel, .ui-refined .builder-modal-panel { width: min(60rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); overflow: auto; border-radius: 10px; }
.ui-refined .skip-link { position: fixed; top: -5rem; left: 1rem; z-index: 100; padding: .75rem; background: #fff; color: #205650; }
.ui-refined .skip-link:focus { top: .5rem; }
#tester-toolbar :is(#vendor-catalog-upload, #vendor-catalog-preview, #vendor-catalog-test, #vendor-catalog-publish, #vendor-catalog-status) { display: none; }
@media (min-width: 1024px) {
  .ui-refined .main-column { margin-left: var(--sidebar-width) !important; }
  .ui-refined #sidebar.secondary-nav { visibility: visible !important; opacity: 1 !important; pointer-events: auto !important; transform: none !important; }
  .ui-refined #sidebar-close, .ui-refined #sidebar-open, .ui-refined #sidebar-backdrop { display: none !important; }
}
@media (max-width: 1023px) {
  .ui-refined #sidebar.secondary-nav { width: min(19rem, 85vw) !important; transform: translateX(-100%) !important; visibility: hidden; }
  .ui-refined #sidebar.secondary-nav.is-open { transform: none !important; visibility: visible; }
  .ui-refined .main-column { margin-left: 0 !important; }
}
@media (max-width: 600px) {
  .ui-refined .page-hero { padding: .75rem 1rem !important; }
  .ui-refined .mobile-brand-mark, .ui-refined .mobile-help-link { display: none !important; }
  .ui-refined .chat-thread { padding: 1.25rem 1rem !important; }
  .ui-refined .chat-home { padding: .5rem 0; }
  .ui-refined .chat-home-cards { grid-template-columns: 1fr; }
  .ui-refined .chat-home-title { font-size: 1.5rem !important; }
  .ui-refined #chat-composer-home { padding-left: .75rem; padding-right: .75rem; }
  .ui-refined .chat-bubble { max-width: calc(100% - 2rem); }
  .ui-refined .chat-row-avatar { width: 1.5rem; flex-basis: 1.5rem; }
  .ui-refined .chat-progress { min-width: 0; }
  .ui-refined .chat-summary { grid-template-columns: 1fr; }
  .ui-refined .page-title { font-size: 1.05rem; }
}
@media (prefers-reduced-motion: reduce) {
  .ui-refined *, .ui-refined *::before, .ui-refined *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
/* Navigation remains reachable at compact widths, regardless of legacy rail rules. */
@media (max-width: 1023px) { .ui-refined #sidebar-open { display: inline-flex !important; } }
.ui-refined .assistant-header-identity { justify-content: flex-start !important; text-align: left !important; }
.ui-refined .assistant-header-copy { text-align: left !important; }
.ui-refined .assistant-status { border: 0; padding: 0; box-shadow: none; background: none; justify-content: flex-start; }
.ui-refined .chat-home-kicker { color: #5c6d6b; }
.ui-refined .page-subtitle { color: var(--ink-muted); }
.ui-refined .ui-btn-ghost { border-radius: 6px; }
.ui-refined #sidebar :is(#new-chat, #brand-home) { display: flex !important; justify-content: flex-start; }
.ui-refined #sidebar #new-chat { justify-content: center; }
.ui-refined .nav-group-label { color: #647571; letter-spacing: .08em; }
.ui-refined .chat-home, .ui-refined .chat-home * { animation: none !important; opacity: 1; }
.ui-refined .assistant-header-identity { align-items: center !important; }
.ui-refined .assistant-header-copy { display: block !important; width: 100%; }
.ui-refined .page-title { text-align: left !important; }
.ui-refined.mode-tester #tester-controls:not(.hidden) { display: block !important; margin-top: .75rem; }
.ui-refined #tester-toolbar { display: block; overflow: visible; }
.ui-refined #tester-assistant-select { position: static; width: auto; max-width: 100%; height: auto; padding: .4rem .6rem; margin: 0; clip: auto; overflow: visible; border: 1px solid var(--border); border-radius: 6px; }
#tester-scope-wrap,
.ui-refined.mode-tester #tester-scope-wrap { display: none !important; }
.ui-refined .tester-scope-label { display: inline; }

.session-facts {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: .65rem;
  margin-right: .35rem;
}
.session-fact {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .75rem;
  line-height: 1.2;
  color: #5c6b6b;
  white-space: nowrap;
  text-decoration: none;
}
.session-fact.is-ok { color: #20574e; }
.session-fact.is-off { color: #873d2a; }

/* Studio tools occupy their own title bar above the page controls. */
.ui-refined.mode-tester .page-hero {
  height: auto !important;
  min-height: 4.5rem !important;
  padding: .75rem 1.75rem !important;
  border-bottom: 1px solid var(--border) !important;
  background: #f7faf9;
}
.ui-refined.mode-tester .mobile-header-row { flex-wrap: nowrap; justify-content: space-between; }
.ui-refined.mode-tester .assistant-header-identity { display: flex !important; flex: 1 1 auto; }
.ui-refined.mode-tester .tester-header-assistant { display: none !important; }
.ui-refined.mode-tester .mobile-header-actions {
  flex: 0 1 auto;
  position: relative;
  z-index: 45;
  top: auto;
  right: auto;
  display: flex !important;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: .4rem;
  width: max-content;
  max-width: min(28rem, 60vw);
  margin: 0;
  padding: .45rem;
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(32, 53, 52, .1);
}
.ui-refined.mode-tester .mobile-header-actions :is(a, button, .stat-pill) {
  position: relative;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
}
.ui-refined .header-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #244f4b;
}
.ui-refined .header-icon::after,
.ui-refined .chat-session-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  right: calc(100% + .5rem);
  top: 50%;
  transform: translateY(-50%);
  padding: .3rem .55rem;
  border-radius: 6px;
  background: #203534;
  color: #fff;
  font-size: .75rem;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}
.ui-refined .header-icon:hover::after,
.ui-refined .header-icon:focus-visible::after,
.ui-refined .chat-session-icon:hover::after,
.ui-refined .chat-session-icon:focus-visible::after { opacity: 1; }
.ui-refined.mode-tester .status-pill.ok { color: #20574e; }
.ui-refined.mode-tester .status-pill.error { color: #873d2a; }

/* Navigation opens as a centered pause menu over whatever is on screen. */
.ui-refined .main-column { margin-left: 0 !important; }
.ui-refined #sidebar.secondary-nav {
  position: fixed !important;
  inset: auto !important;
  top: 50% !important;
  left: 50% !important;
  width: min(40rem, calc(100vw - 2rem)) !important;
  height: auto !important;
  max-height: min(40rem, calc(100dvh - 3rem)) !important;
  transform: translate(-50%, -50%) !important;
  display: flex !important;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border) !important;
  border-radius: 16px !important;
  background: #fff !important;
  box-shadow: 0 28px 70px rgba(32, 53, 52, .28) !important;
  z-index: 60;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.ui-refined #sidebar.secondary-nav.is-open {
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  transform: translate(-50%, -50%) !important;
}
.ui-refined #sidebar-close { display: inline-flex !important; }
.ui-refined #sidebar-open { display: inline-flex !important; }
.ui-refined #sidebar-backdrop:not(.hidden) { display: block !important; z-index: 55; background: rgba(32, 53, 52, .45); }
.ui-refined.mode-tester #sidebar .sidebar-actions,
.ui-refined.mode-tester #sidebar .sidebar-conversation-actions,
.ui-refined.mode-tester #sidebar > div:last-child,
.ui-refined.mode-tester #nav-section-developer > .nav-group-label { display: none !important; }
.ui-refined.mode-tester #sidebar > .flex {
  position: relative;
  flex: 0 0 auto;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid #dce7e3;
  padding: 1rem 1.25rem;
  background: #f7faf9;
}
.ui-refined.mode-tester #sidebar > .flex > div { display: block; min-width: 0; }
.ui-refined.mode-tester #sidebar nav {
  display: block !important;
  padding: 1rem !important;
}
.ui-refined.mode-tester #sidebar #tester-toolbar {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  grid-auto-rows: 6.5rem;
  gap: .5rem;
  width: 100%;
  padding: 0 !important;
  border: 0;
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}
.ui-refined.mode-tester .pause-catalog-hooks { display: none !important; }
.ui-refined #sidebar .pause-card {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  width: 100%;
  height: 6.5rem;
  min-height: 6.5rem;
  max-height: 6.5rem;
  margin: 0;
  padding: .6rem !important;
  border: 0;
  border-radius: 10px;
  background: #fff;
  color: #203534;
  text-align: center;
  white-space: normal;
  box-shadow: none;
  transition: background-color .16s ease, border-color .16s ease;
}
.ui-refined #sidebar .pause-card span { font-size: .82rem; font-weight: 600; line-height: 1.2; }
.ui-refined #sidebar .pause-card svg { color: #2a6665; }
.ui-refined #sidebar .pause-card.active,
.ui-refined #sidebar .pause-card.is-active { background: #e7f3ef; }
.ui-refined #sidebar .pause-card:hover { background: #f7f9f8; }
.ui-refined #sidebar .pause-card:focus-visible {
  outline: 2px solid #2a6665;
  outline-offset: -4px;
  background: #e7f3ef;
}
.ui-refined.mode-tester #sidebar > nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.25rem !important;
}
.ui-refined.mode-tester #nav-section-developer { margin-top: 0; padding-top: 0; border-top: 0; }
.ui-refined.mode-tester #tester-controls { margin-top: 0; }
.ui-refined.mode-tester #sidebar-close { flex-shrink: 0; }
@media (max-width: 380px) {
  .ui-refined.mode-tester #sidebar #tester-toolbar { grid-auto-rows: 5.5rem; }
  .ui-refined #sidebar .pause-card { height: 5.5rem; min-height: 5.5rem; max-height: 5.5rem; }
  .ui-refined #sidebar .pause-card span { font-size: .75rem; }
}
.ui-refined.mode-tester #sidebar-tagline,
.ui-refined.mode-tester #sidebar > .flex > div > p:first-child { display: none !important; }
.ui-refined.mode-tester #nav-section-title { margin-top: 0 !important; font-size: 1.125rem; line-height: 1.5; color: #203534; }
.ui-refined .chat-session-actions {
  position: fixed;
  z-index: 45;
  right: 1.75rem;
  bottom: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.ui-refined .chat-session-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  color: #244f4b;
  background: rgba(255, 255, 255, .96);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(32, 53, 52, .12);
  cursor: pointer;
}
.ui-refined .chat-session-icon:hover { background: #f1f7f5; border-color: #2a6665; }

/* Reveal each answer once. Keep numbers and table rows intact and readable. */
@keyframes response-data-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: no-preference) {
  .ui-refined .chat-row.user.chat-row-enter { animation-duration: 180ms; }
  .ui-refined .chat-row.assistant.chat-row-enter { animation-duration: 280ms; }
  .ui-refined .chat-row.assistant.chat-row-enter :is(.chat-metric, .chat-summary, .chat-record, .chat-table-wrap) {
    animation: response-data-in 300ms cubic-bezier(.22, 1, .36, 1) 60ms both;
  }
  .ui-refined .chat-row.assistant.chat-row-enter .chat-message-actions {
    animation: response-data-in 180ms ease-out 140ms both;
  }
}

/* Business chat and the developer Studio have distinct navigation. */
html:not(.studio-route) #nav-section-developer,
html:not(.studio-route) #nav-section-assistants { display: none !important; }
html.studio-route #nav-section-assistants,
html.studio-route #brand-home { display: none !important; }
html.studio-route .studio-link { display: none; }
html:not(.studio-route) .chat-link { display: none; }
.chat-follow-ups .chat-follow-up {
  display: inline-flex; min-height: var(--touch-min); border-radius: var(--radius-pill);
  gap: .65rem; border: 1px solid #b8ceca; background: #f1f7f5; color: #244f4b;
}
.chat-follow-ups .chat-follow-up::after { content: "→"; font-size: 1.1rem; }
.chat-follow-ups .chat-follow-up:hover { background: #e3efeb; border-color: #2a6665; }
.chat-distribution { margin: 1rem 0; display: grid; gap: .6rem; }
.chat-distribution figcaption { font-weight: 600; }
.chat-bar-row { display: grid; grid-template-columns: minmax(6rem, 1fr) 2fr auto; gap: .7rem; align-items: center; }
.chat-bar-track { height: .65rem; background: #edf2f0; border-radius: 1rem; overflow: hidden; }
.chat-bar-fill { display: block; height: 100%; background: #2a6665; border-radius: inherit; }
.chat-delta { display: inline-block; padding: .4rem .7rem; border-radius: var(--radius-pill); background: #edf2f0; font-variant-numeric: tabular-nums; }
.chat-delta.up { color: #20574e; background: #e7f3ef; }
.chat-delta.down { color: #873d2a; background: #faeee8; }
.chat-inspector { margin: .8rem 0; }
.chat-inspector > summary { cursor: pointer; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: .6rem; min-height: var(--touch-min); }
.chat-inspector-body { background: white; border: 1px solid var(--border); padding: 1rem; overflow: auto; max-height: 65vh; }
.chat-inspector .chat-table-wrap { max-height: none; }
@media (min-width: 1200px) {
  body:has(.chat-inspector[open]) { --chat-column-max: 100%; }
  body:has(.chat-inspector[open]) main { margin-right: 48vw; }
  .chat-inspector[open] > .chat-inspector-body { position: fixed; z-index: 35; right: 1rem; top: 6rem; bottom: 1rem; width: 46vw; max-height: none; box-shadow: var(--shadow-soft); border-radius: var(--radius-lg); }
}

/* Shared workspace design system. Keep component states on the same scale. */
.ui-refined {
  --surface-muted: #f7faf9;
  --color-light-gray: #dfe5e4;
  --brand-green: #2a6665;
  --radius-sm: .5rem;
  --radius-md: .75rem;
  --radius-lg: 1rem;
  --display: var(--sans);
  font-family: var(--sans);
}
.ui-refined :is(button, input, select, textarea) { font-family: inherit; }
.ui-refined :is(.ui-btn-primary, .ui-btn-secondary, .ui-btn-ghost) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 44px;
  padding: .625rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.25;
  box-shadow: none;
  transition: background-color .14s ease, border-color .14s ease;
}
.ui-refined .ui-btn-primary { background: var(--brand-green); color: #fff; }
.ui-refined .ui-btn-primary:hover:not(:disabled) { background: #205650; filter: none; }
.ui-refined .ui-btn-secondary { background: #fff; color: var(--ink); border-color: var(--border); }
.ui-refined .ui-btn-ghost { background: var(--surface-muted); color: var(--brand-green); border-color: var(--border); }
.ui-refined :is(.ui-btn-secondary, .ui-btn-ghost):hover:not(:disabled) { background: #e7f3ef; border-color: #adc9c2; }
.ui-refined button:disabled { opacity: .5; cursor: not-allowed; }
.ui-refined :is(.ui-input, .ui-select, .ui-textarea) {
  min-height: 44px;
  border-color: var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font-size: .875rem;
}
.ui-refined :is(.ui-input, .ui-select, .ui-textarea):focus {
  border-color: var(--brand-green);
  box-shadow: 0 0 0 3px #2a66651f;
}
.ui-refined :is(button, a, input, select, textarea, summary):focus-visible { outline: 2px solid var(--brand-green); outline-offset: 3px; }
.ui-refined .ui-card { border-color: var(--border); border-radius: var(--radius-md); background: #fff; box-shadow: none; }
.ui-refined .ui-card-header { padding: 1rem 1.25rem; border-color: var(--border); font-size: .9375rem; font-weight: 600; }
.ui-refined .ui-card-body { padding: 1.25rem; }
.ui-refined .panel:not([data-panel="ai"]) { padding: 1.5rem !important; }
.ui-refined .db-profile-card { border-color: var(--border); border-radius: var(--radius-md); color: var(--ink); box-shadow: none; }
.ui-refined .db-profile-card:hover { background: var(--surface-muted); }
.ui-refined .db-profile-card.is-selected { border-color: var(--brand-green); background: #e7f3ef; box-shadow: none; }
.ui-refined .db-profile-card-route { color: var(--ink-muted); }
.ui-refined .db-profile-card-status.idle { background: #edf2f0; color: var(--ink-muted); }
.ui-refined .db-profile-card-status.ok { background: #e0eeea; color: #205650; }
.ui-refined .db-profile-card-status.error { background: #faeee8; color: #873d2a; }
.ui-refined .db-profile-delete { min-height: 36px; bottom: .35rem; }
.ui-refined .db-profile-delete:focus-visible { outline-color: #be123c; }
.ui-refined .header-icon { border-radius: var(--radius-sm); }
.ui-refined.mode-tester .mobile-header-actions { padding: 0; border: 0; background: transparent; box-shadow: none; }
.ui-refined .chat-home-prompt:hover { border-color: var(--brand-green); background: var(--surface-muted); }
.ui-refined #sidebar .pause-card { border: 0; box-shadow: none; }
.ui-refined #sidebar .pause-card:focus-visible { outline-offset: -4px; }
@media (max-width: 640px) {
  .ui-refined.mode-tester .mobile-header-row { flex-wrap: wrap; }
  .ui-refined.mode-tester .mobile-header-actions { width: 100%; max-width: 100%; justify-content: flex-start; }
  .ui-refined.mode-tester .page-hero { padding: .75rem 1rem !important; }
  .ui-refined .panel:not([data-panel="ai"]) { padding: 1rem !important; }
  .ui-refined :is(.ui-card-header, .ui-card-body) { padding: 1rem; }
}

.account-admin-dialog { width: min(56rem, calc(100vw - 2rem)); max-height: 85dvh; padding: 0; border: 1px solid var(--border); border-radius: .75rem; color: var(--ink); }
.account-admin-dialog::backdrop { background: #20353488; }
.account-admin-row { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; padding: 1rem 0; border-bottom: 1px solid var(--border); }
.account-admin-row > div { flex: 1; min-width: 14rem; }
.account-admin-row .ui-select { width: auto; }

#email-login { overflow-y: auto; }
.auth-card { max-height: calc(100dvh - 2rem); overflow-y: auto; color: var(--ink); }
.auth-card label { font-size: .875rem; font-weight: 600; }
.auth-switch { margin-top: 1rem; text-align: center; font-size: .875rem; color: var(--ink-muted); }
.auth-switch button, .auth-link { color: var(--brand-green); text-decoration: underline; text-underline-offset: 3px; }
.auth-link { display: block; margin: .75rem auto 0; font-size: .875rem; }
.auth-mfa summary { cursor: pointer; font-size: .875rem; color: var(--brand-green); }

.mfa-qr { display: block; max-width: 100%; height: auto; margin: 1rem auto; background: #fff; }
.mfa-manual-key { display: block; overflow-wrap: anywhere; padding: .75rem; background: var(--surface-muted); font-family: var(--mono); }

.chat-session-label { display: none; }
@media (max-width: 640px) {
  /* Reserve an action row in the flex layout, above the input and send button. */
  .ui-refined .chat-session-actions {
    position: static;
    inset: auto;
    z-index: auto;
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
    gap: .5rem;
    width: 100%;
    padding: .5rem .75rem 0;
    background: #fff;
  }
  .ui-refined .chat-session-icon {
    width: auto;
    height: 44px;
    min-height: 44px;
    gap: .375rem;
    padding: .5rem .75rem;
    border-radius: var(--radius-sm);
    box-shadow: none;
    font-size: .8125rem;
    font-weight: 600;
  }
  .ui-refined .chat-session-label { display: inline; }
  .ui-refined .chat-session-icon::after { display: none; }
  .ui-refined #chat-composer-home { flex-shrink: 0; }
  .ui-refined .composer-help { font-size: .6875rem; margin-top: .375rem; }
  .ui-refined .mobile-header-actions { flex-wrap: wrap; justify-content: flex-end; gap: .25rem; max-width: 65%; }
  .ui-refined .chat-thread { padding-bottom: 1rem !important; }
}
