:root {
  --bg: #f3f2ef;
  --card: #ffffff;
  --text: #191919;
  --muted: #666666;
  --accent: #0A66C2;
  --accent-2: #004182;
  --accent-hover: #004182;
  --navy: #0A66C2;
  --navy-mid: #004182;
  --danger: #cc1016;
  --border: #e0e0e0;
  --border-soft: #e8e8e8;
  --ok: #057642;
  --shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
  --radius: 8px;
  --radius-pill: 24px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 1.15rem; }

/* LinkedIn-inspired white header */
.site-header {
  background: #ffffff;
  color: var(--text);
  padding: 0.65rem 0;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header a { color: var(--muted); }
.site-header a:hover { color: var(--accent); text-decoration: none; }
.site-header .logo {
  font-weight: 700;
  margin-right: 1.25rem;
  color: var(--accent);
  letter-spacing: -0.01em;
  font-size: 1.15rem;
}
.site-header .logo:hover { color: var(--accent-hover); }
.brand {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.5rem;
}
.brand nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.85rem;
  font-size: 0.92rem;
  font-weight: 500;
  margin-left: auto;
}
.brand nav a {
  padding: 0.35rem 0.45rem;
  border-radius: 4px;
  color: #191919;
}
.brand nav a:hover {
  color: var(--accent);
  background: transparent;
}
/* Primary CTA in header — LinkedIn blue pill button */
.brand nav a.nav-cta,
.site-header a.nav-cta {
  display: inline-block;
  background: var(--accent);
  color: #fff !important;
  border: 1px solid var(--accent);
  border-radius: var(--radius-pill);
  padding: 0.4rem 1.05rem;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none !important;
  box-shadow: none;
}
.brand nav a.nav-cta:hover,
.site-header a.nav-cta:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff !important;
}

.site-footer {
  margin-top: 3.25rem;
  padding: 1.65rem 0;
  color: var(--muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
  background: #ffffff;
}

.hero {
  background: linear-gradient(135deg, #004182, #0A66C2);
  color: #fff;
  padding: 2rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}
.hero a { color: #fff; }
.hero .btn {
  background: #fff;
  color: var(--accent) !important;
  border: 1px solid #fff;
}
.hero .btn.secondary {
  background: transparent;
  border: 1px solid #fff;
  color: #fff !important;
}
.hero .btn:hover { text-decoration: none; filter: brightness(0.97); }
.hero .btn.secondary:hover { background: rgba(255, 255, 255, 0.12); }

/* Homepage hero layout — brand blue, harmonized with white nav */
.hero--lab {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(220px, 0.85fr);
  gap: 1.75rem;
  align-items: center;
  padding: 2.35rem 2.15rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
  background:
    radial-gradient(ellipse at 85% 15%, rgba(255, 255, 255, 0.18), transparent 45%),
    linear-gradient(135deg, #004182 0%, #0A66C2 55%, #378fe9 100%);
}
.hero__copy { min-width: 0; }
.hero__eyebrow {
  display: inline-block;
  margin: 0 0 0.85rem;
  padding: 0.28rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
  color: #e8f1fb;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
}
.hero--lab h1 {
  margin: 0 0 0.85rem;
  font-size: clamp(1.55rem, 3.2vw, 2.05rem);
  line-height: 1.25;
  font-weight: 740;
  letter-spacing: -0.02em;
}
.hero__lead {
  margin: 0 0 1.35rem;
  max-width: 38rem;
  font-size: 1.02rem;
  line-height: 1.65;
  color: #e8f1fb;
}
.hero__actions { margin: 0; }
.hero__figure {
  margin: 0;
  justify-self: end;
  width: 100%;
  max-width: 400px;
}
.hero__figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 65, 130, 0.35);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
}
.hero__caption {
  margin-top: 0.55rem;
  font-size: 0.8rem;
  color: #d0e4f7;
  text-align: center;
}

.section-head {
  margin-bottom: 1.1rem;
}
.section-head h2 {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}
.section-head .muted { margin: 0; }

.arch-path {
  margin-bottom: 1.85rem;
}
.arch-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.arch-step {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1rem 1.15rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  min-height: 100%;
}
.arch-step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  margin-bottom: 0.65rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
}
.arch-step h3 {
  margin: 0 0 0.4rem;
  font-size: 1.02rem;
}
.arch-step p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}
.arch-step code {
  font-size: 0.84em;
  background: #eaf2fb;
  color: var(--accent-2);
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
}

.home-panels { margin-bottom: 0.5rem; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.card--soft {
  box-shadow: var(--shadow-sm);
  padding: 1.35rem 1.3rem;
}
.card--soft h2 {
  margin-top: 0;
  margin-bottom: 0.85rem;
  font-size: 1.12rem;
}
.feature-list {
  margin: 0;
  padding-left: 1.15rem;
}
.feature-list li {
  margin-bottom: 0.45rem;
  color: var(--text);
}
.feature-list code {
  font-size: 0.86em;
  background: #f3f2ef;
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
}
.grid-2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.product-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.product img, .detail-img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 8px;
  background: #e8e8e8;
}
.detail-img { height: 220px; margin-bottom: 1rem; }
.price { font-weight: 700; color: var(--accent-2); }
.muted, .meta { color: var(--muted); font-size: 0.92rem; }

/* LinkedIn-style buttons */
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff !important;
  border: 1px solid var(--accent);
  border-radius: var(--radius-pill);
  padding: 0.5rem 1.2rem;
  cursor: pointer;
  text-decoration: none !important;
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  text-decoration: none;
}
.btn.secondary {
  background: #fff;
  color: var(--accent) !important;
  border: 1px solid var(--accent);
}
.btn.secondary:hover {
  background: #eaf2fb;
  border-color: var(--accent-hover);
  color: var(--accent-hover) !important;
}
.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff !important;
}
.btn.danger:hover {
  filter: brightness(0.92);
}

.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.form label { display: block; margin-bottom: 0.85rem; font-weight: 600; }
.form input, .form textarea {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  background: #fff;
}
.form input:focus, .form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(10, 102, 194, 0.2);
}
.flash-list { list-style: none; padding: 0; }
.flash {
  padding: 0.65rem 0.9rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
}
.flash.success { background: #ddf6e8; color: var(--ok); }
.flash.error { background: #fce8e8; color: var(--danger); }
.arch {
  background: #1b1f23;
  color: #e8e8e8;
  padding: 1rem 1.05rem;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.45;
  margin: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.kb-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.search-bar { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.search-bar input {
  flex: 1;
  min-width: 200px;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}
.search-bar input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(10, 102, 194, 0.2);
}
.kb-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.kb-table th, .kb-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.65rem;
  text-align: left;
}
.kb-table th {
  background: #fafafa;
  font-weight: 600;
  color: var(--text);
}
.kb-table tr:last-child td { border-bottom: none; }
.row-actions { display: flex; gap: 0.5rem; align-items: center; }
.inline { display: inline; }
.doc-content {
  white-space: pre-wrap;
  word-break: break-word;
  background: #fafafa;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.content-box { margin: 1rem 0; }

@media (max-width: 900px) {
  .hero--lab {
    grid-template-columns: 1fr;
    padding: 1.75rem 1.35rem;
  }
  .hero__figure {
    justify-self: stretch;
    max-width: none;
  }
  .arch-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .brand nav { margin-left: 0; }
}

@media (max-width: 560px) {
  .arch-steps {
    grid-template-columns: 1fr;
  }
  .hero--lab h1 {
    font-size: 1.45rem;
  }
}

/* Station AI agent */
.agent-page { margin-bottom: 1.5rem; }
.agent-card { margin-bottom: 1.25rem; }
.agent-form fieldset.mode-select {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem 1rem;
  margin: 0 0 1rem;
  background: #fafafa;
}
.agent-form fieldset.mode-select legend {
  padding: 0 0.35rem;
  font-weight: 700;
  color: var(--accent-2);
}
.mode-option {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  margin-bottom: 0.65rem;
  font-weight: 500;
  cursor: pointer;
}
.mode-option:last-child { margin-bottom: 0; }
.mode-option input { margin-top: 0.35rem; accent-color: var(--accent); }
.mode-option span { display: flex; flex-direction: column; gap: 0.15rem; }
.mode-option small { color: var(--muted); font-weight: 400; font-size: 0.86rem; }
.agent-result h2 { margin-top: 0; }
.agent-subhead {
  margin: 1.25rem 0 0.55rem;
  font-size: 1.02rem;
  color: var(--accent-2);
}
.agent-answer {
  white-space: pre-wrap;
  word-break: break-word;
  background: #f7fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.05rem;
  line-height: 1.65;
}
.workflow-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}
.workflow-steps > li {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 0.75rem 0.9rem;
  box-shadow: var(--shadow-sm);
}
.workflow-step__title {
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--text);
}
.workflow-step__note {
  color: var(--muted);
  font-size: 0.92rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.agent-docs {
  margin: 0;
  padding-left: 1.15rem;
}
.agent-docs li { margin-bottom: 0.35rem; }

/* Multi-turn chat thread */
.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
  max-height: min(60vh, 640px);
  overflow-y: auto;
  padding: 1rem 1.1rem;
}
.chat-bubble {
  max-width: min(92%, 720px);
  border-radius: 12px;
  padding: 0.7rem 0.95rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.chat-bubble--user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-2);
}
.chat-bubble--assistant {
  align-self: flex-start;
  background: #fff;
  color: var(--text);
}
.chat-bubble__role {
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  opacity: 0.85;
  letter-spacing: 0.02em;
}
.chat-bubble--user .chat-bubble__role { color: rgba(255, 255, 255, 0.9); }
.chat-bubble--assistant .chat-bubble__role { color: var(--accent-2); }
.chat-bubble__content {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
  font-size: 0.95rem;
}

/* Agent thread sidebar + layout */
.agent-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 1.15rem;
  align-items: start;
}
.agent-sidebar {
  padding: 0.9rem 0.95rem;
  position: sticky;
  top: 4.2rem;
  max-height: calc(100vh - 5.5rem);
  overflow-y: auto;
}
.agent-sidebar__head {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.75rem;
}
.agent-sidebar__hint {
  font-size: 0.78rem;
  line-height: 1.35;
}
.thread-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.thread-list__item a {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  border: 1px solid transparent;
  color: var(--text);
  text-decoration: none;
}
.thread-list__item a:hover {
  background: #f7fafc;
  border-color: var(--border);
  text-decoration: none;
}
.thread-list__item.is-active a {
  background: #e8f1fb;
  border-color: #b6d0ef;
}
.thread-list__title {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}
.thread-list__meta {
  font-size: 0.75rem;
}
.chat-thread--empty {
  padding: 1rem 1.1rem;
}
@media (max-width: 820px) {
  .agent-layout {
    grid-template-columns: 1fr;
  }
  .agent-sidebar {
    position: static;
    max-height: 220px;
  }
}

/* KB import result badges */
.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}
.badge-ok { background: #e6f4ea; color: var(--ok); }
.badge-skip { background: #fff4e5; color: #b54708; }
.badge-fail { background: #fce8e6; color: var(--danger); }
.kb-header .actions { margin-left: auto; }

/* Chunk search & detail */
.chunk-hit-list { display: grid; gap: 0.75rem; }
.chunk-hit h3 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.chunk-snippet { margin: 0.4rem 0 0; line-height: 1.55; color: var(--text); }
.chunk-snippet mark {
  background: #fff3bf;
  color: inherit;
  padding: 0 0.15rem;
  border-radius: 2px;
}
.chunk-list { display: grid; gap: 0.85rem; }
.chunk-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  background: #fafafa;
}
.chunk-block--focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(10, 102, 194, 0.2);
}
.chunk-block__head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 0.45rem;
  align-items: baseline;
}
.chunk-text {
  margin: 0;
  max-height: 280px;
  overflow: auto;
  font-size: 0.92rem;
}
details.card > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
}
