:root {
  --ink: #17243d;
  --ink-2: #35435d;
  --muted: #71809b;
  --muted-2: #9aa6b9;
  --line: #e5eaf1;
  --line-strong: #d8e0eb;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #f0f4f8;
  --navy: #111d36;
  --teal: #0a9b8f;
  --teal-dark: #067b73;
  --teal-pale: #e9f8f6;
  --blue: #4267df;
  --blue-pale: #edf1ff;
  --violet: #7c5ce5;
  --violet-pale: #f2efff;
  --amber: #d88c27;
  --amber-pale: #fff6e9;
  --red: #d95b62;
  --red-pale: #fff0f1;
  --green: #2c9c69;
  --shadow-sm: 0 3px 12px rgba(31, 48, 76, 0.06);
  --shadow-md: 0 16px 42px rgba(25, 43, 73, 0.12);
  --shadow-lg: 0 30px 70px rgba(20, 34, 58, 0.2);
  --radius: 14px;
  --radius-sm: 9px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--surface-2);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  min-width: 780px;
  background: var(--surface-2);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex="0"]:focus-visible {
  outline: 3px solid rgba(66, 103, 223, 0.22);
  outline-offset: 2px;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.icon-sm {
  width: 16px;
  height: 16px;
}

.app-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  width: 100%;
  height: 100%;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 26px 17px 18px;
  border-right: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  box-shadow: 8px 0 28px rgba(31, 48, 76, 0.05);
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  padding: 0 5px 21px;
}

.brand-logo-surface {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 43px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(31, 48, 76, 0.07);
}

.brand-logo {
  display: block;
  width: 100%;
  max-width: 162px;
  height: auto;
}

.workspace-switcher {
  display: grid;
  grid-template-columns: 33px 1fr 16px;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0 0 22px;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #f8fafc;
  color: var(--ink);
  text-align: left;
}

.workspace-switcher:hover {
  border-color: #c6d0dd;
  background: #f2f6f9;
}

.workspace-avatar {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  border-radius: 9px;
  background: linear-gradient(135deg, #1ab6a7, #4a68db);
  font-size: 13px;
  font-weight: 750;
}

.workspace-switcher span:nth-child(2) {
  display: grid;
  gap: 2px;
}

.workspace-switcher small,
.user-menu small {
  color: var(--muted);
  font-size: 13px;
}

.workspace-switcher strong,
.user-menu strong {
  font-size: 13px;
  font-weight: 650;
}

.workspace-switcher .icon {
  color: #8391a5;
  transform: rotate(90deg);
}

.primary-nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #5e6d84;
  text-align: left;
  font-size: 13px;
  font-weight: 570;
  transition: 160ms ease;
}

.nav-item:hover {
  background: #f3f6f9;
  color: var(--ink);
}

.nav-item.active {
  background: #e8f6f4;
  color: #126d66;
}

.nav-item.active .icon {
  color: #4bddc8;
}

.nav-badge {
  display: grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: #22b9a9;
  color: white;
  font-size: 13px;
  font-weight: 750;
}

.beta-chip {
  padding: 3px 5px;
  border-radius: 4px;
  background: rgba(124, 92, 229, 0.25);
  color: #bbaaf7;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.6px;
}

.sidebar-spacer {
  flex: 1;
}

.demo-card {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid #cfe8e4;
  border-radius: 12px;
  background: linear-gradient(145deg, #effaf8, #f3f4fd);
}

.demo-card-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-bottom: 3px;
  border-radius: 9px;
  background: rgba(63, 213, 192, 0.15);
  color: #58dfcd;
}

.demo-card strong {
  font-size: 13px;
}

.demo-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.demo-card button {
  display: flex;
  align-items: center;
  gap: 5px;
  width: max-content;
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #65e2d1;
  font-size: 13px;
  font-weight: 680;
}

.user-menu {
  display: grid;
  grid-template-columns: 34px 1fr 18px;
  align-items: center;
  gap: 9px;
  margin-top: 15px;
  padding: 13px 9px 2px;
  border-top: 1px solid var(--line);
}

.user-menu > span:nth-child(2) {
  display: grid;
  gap: 2px;
}

.user-menu .icon {
  color: #8b98aa;
}

/* Presentation mode: hide the areas marked in the review screenshot. */
.topbar-actions,
.home-hero,
.beta-chip {
  display: none !important;
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 50%;
  color: white;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.2px;
}

.avatar-noah { background: linear-gradient(135deg, #375fc5, #6d82e9); }
.maya { background: linear-gradient(135deg, #cc6b7c, #e6968c); }
.sam { background: linear-gradient(135deg, #4b8d83, #75b9a9); }
.ai-avatar { background: linear-gradient(135deg, #0d9a8e, #416fce); }
.ai-avatar .icon { width: 18px; height: 18px; }

.main-area {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 76px minmax(0, 1fr);
  background: var(--surface-2);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(14px);
  z-index: 10;
}

.topbar h1 {
  margin: 3px 0 0;
  font-size: 20px;
  letter-spacing: -0.45px;
}

.eyebrow {
  color: #8a97ab;
  font-size: 13px;
  font-weight: 780;
  letter-spacing: 1.35px;
}

.topbar-actions,
.conversation-actions,
.workflow-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.demo-mode {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid #d9e4f0;
  border-radius: 999px;
  background: #f7fafc;
  color: #64738c;
  font-size: 13px;
  font-weight: 660;
}

.demo-mode span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #29ac78;
  box-shadow: 0 0 0 4px rgba(41, 172, 120, 0.1);
}

.icon-button,
.ghost-button,
.secondary-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 670;
  transition: 150ms ease;
}

.icon-button {
  width: 36px;
  padding: 0;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: #60708a;
}

.icon-button:hover,
.ghost-button:hover,
.secondary-button:hover {
  border-color: #bdc8d8;
  background: #f4f7fa;
}

.icon-button.small { width: 31px; min-height: 31px; }
.icon-button.tiny { width: 26px; min-height: 26px; border: 0; }

.ghost-button,
.secondary-button {
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: #455570;
}

.primary-button {
  padding: 0 15px;
  border: 1px solid var(--teal);
  background: var(--teal);
  color: #fff;
  box-shadow: 0 5px 14px rgba(10, 155, 143, 0.18);
}

.primary-button:hover {
  border-color: var(--teal-dark);
  background: var(--teal-dark);
  transform: translateY(-1px);
}

.views {
  min-width: 0;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.view {
  display: none;
  width: 100%;
  height: 100%;
  overflow: auto;
}

.view.active {
  display: block;
}

#view-home {
  padding: 24px 30px 32px;
}

.home-hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  min-height: 245px;
  overflow: hidden;
  border-radius: 18px;
  background: linear-gradient(120deg, #121f38 0%, #172a48 55%, #18485a 100%);
  box-shadow: 0 14px 38px rgba(24, 42, 70, 0.14);
}

.home-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.09) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(90deg, transparent 30%, #000 100%);
}

.hero-copy {
  position: relative;
  z-index: 2;
  align-self: center;
  padding: 34px 8% 34px 42px;
  color: #fff;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  color: #6fe1d2;
  font-size: 13px;
  font-weight: 680;
  letter-spacing: 0.2px;
}

.hero-copy h2 {
  max-width: 560px;
  margin: 0;
  font-size: clamp(30px, 3vw, 44px);
  font-weight: 680;
  line-height: 1.08;
  letter-spacing: -1.7px;
}

.hero-copy h2 em {
  color: #54d7c4;
  font-family: Georgia, serif;
  font-weight: 500;
}

.hero-copy p {
  max-width: 560px;
  margin: 14px 0 21px;
  color: #b6c3d4;
  font-size: 13px;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  gap: 9px;
}

.hero-actions .primary-button {
  min-height: 40px;
  padding: 0 17px;
  background: #31bba9;
  border-color: #31bba9;
}

.hero-actions .secondary-button {
  min-height: 40px;
  border-color: rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.06);
  color: #e2eaf3;
}

.hero-actions .secondary-button:hover {
  background: rgba(255,255,255,0.11);
}

.hero-visual {
  position: relative;
  min-height: 245px;
}

.hero-core {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 90px;
  height: 90px;
  border: 1px solid rgba(96, 229, 211, 0.42);
  border-radius: 50%;
  background: rgba(14, 34, 58, 0.85);
  box-shadow: 0 0 0 12px rgba(43, 186, 168, 0.06), 0 20px 40px rgba(0,0,0,0.22);
  transform: translate(-50%, -50%);
  color: white;
}

.hero-logo-mark {
  display: block;
  width: 58px;
  height: 52px;
  object-fit: contain;
}

.orbit-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  border: 1px solid rgba(125, 222, 209, 0.16);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.ring-one { width: 220px; height: 145px; }
.ring-two { width: 320px; height: 205px; }

.orbit-card {
  position: absolute;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 9px;
  background: rgba(23, 39, 68, 0.9);
  color: #dce8f2;
  box-shadow: 0 10px 26px rgba(5, 16, 29, 0.24);
  font-size: 13px;
  font-weight: 650;
  backdrop-filter: blur(8px);
}

.orbit-card .icon {
  width: 17px;
  height: 17px;
  color: #51d5c3;
}

.orbit-chat { left: 8%; top: 28%; }
.orbit-learn { right: 6%; top: 22%; }
.orbit-flow { right: 13%; bottom: 18%; }

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 15px 0;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 10px;
}

.stat-icon.teal { color: var(--teal); background: var(--teal-pale); }
.stat-icon.blue { color: var(--blue); background: var(--blue-pale); }
.stat-icon.violet { color: var(--violet); background: var(--violet-pale); }
.stat-icon.amber { color: var(--amber); background: var(--amber-pale); }

.stat-card > div,
.knowledge-stats article > div {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  column-gap: 7px;
  min-width: 0;
}

.stat-card small,
.knowledge-stats article small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.stat-card strong,
.knowledge-stats article strong {
  margin-top: 3px;
  font-size: 22px;
  letter-spacing: -0.5px;
}

.stat-card span,
.knowledge-stats article span {
  color: var(--muted);
  font-size: 13px;
}

.positive {
  color: var(--green) !important;
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(285px, 0.7fr);
  gap: 15px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.feature-panel,
.activity-panel {
  padding: 19px;
}

.section-heading,
.panel-header,
.context-header,
.knowledge-list-header,
.library-heading,
.config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-heading h3,
.context-header h3,
.library-heading h3,
.config-header h3 {
  margin: 3px 0 0;
  font-size: 15px;
  letter-spacing: -0.25px;
}

.section-heading.compact h3 {
  font-size: 14px;
}

.step-label {
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.feature-card {
  position: relative;
  min-width: 0;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-align: left;
  transition: 180ms ease;
}

.feature-card::after {
  content: "";
  position: absolute;
  right: -25px;
  bottom: -35px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  opacity: 0.45;
}

.chat-card::after { background: var(--teal-pale); }
.knowledge-card::after { background: var(--blue-pale); }
.flow-card::after { background: var(--violet-pale); }

.feature-card:hover {
  border-color: #c7d2df;
  box-shadow: 0 10px 25px rgba(30, 51, 79, 0.08);
  transform: translateY(-2px);
}

.feature-number {
  position: absolute;
  right: 12px;
  top: 11px;
  color: #bdc5d1;
  font-size: 13px;
  font-weight: 750;
}

.feature-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-bottom: 14px;
  border-radius: 10px;
}

.chat-card .feature-icon { color: var(--teal); background: var(--teal-pale); }
.knowledge-card .feature-icon { color: var(--blue); background: var(--blue-pale); }
.flow-card .feature-icon { color: var(--violet); background: var(--violet-pale); }

.feature-card strong {
  display: block;
  font-size: 13px;
}

.feature-card p {
  min-height: 44px;
  margin: 7px 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.48;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
}

.knowledge-card .text-link { color: var(--blue); }
.flow-card .text-link { color: var(--violet); }

.activity-list {
  display: grid;
  gap: 0;
  margin-top: 12px;
}

.activity-item {
  position: relative;
  display: grid;
  grid-template-columns: 33px 1fr;
  gap: 10px;
  min-height: 68px;
}

.activity-symbol {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f9fbfd;
  color: #6a7a92;
}

.activity-symbol .icon { width: 16px; height: 16px; }
.activity-line { position: absolute; left: 15px; top: 30px; bottom: -2px; width: 1px; background: var(--line); }
.activity-item:last-child .activity-line { display: none; }
.activity-line.success::before,
.activity-line.active::before { content: ""; position: absolute; left: -2px; top: -30px; width: 5px; height: 5px; border-radius: 50%; background: var(--green); }
.activity-line.active::before { background: var(--blue); }

.activity-item > div {
  min-width: 0;
  padding-top: 1px;
}

.activity-item strong {
  display: block;
  font-size: 13px;
}

.activity-item p {
  margin: 3px 0 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.activity-item p b { color: var(--ink-2); font-weight: 650; }
.activity-item small { color: var(--muted-2); font-size: 13px; }

/* Chat */
.chat-view.active {
  display: grid;
  grid-template-columns: 255px minmax(490px, 1fr) 255px;
  overflow: hidden;
  background: #fff;
}

.rooms-panel,
.context-panel,
.conversation-panel {
  min-width: 0;
  min-height: 0;
}

.rooms-panel,
.context-panel {
  overflow: auto;
  background: #fbfcfe;
}

.rooms-panel {
  padding: 21px 14px;
  border-right: 1px solid var(--line);
}

.panel-header h2,
.conversation-header h2,
.knowledge-toolbar h2,
.workflow-title h2 {
  margin: 3px 0 0;
  font-size: 18px;
  letter-spacing: -0.4px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: #8a98ab;
}

.rooms-panel > .search-field {
  margin: 16px 0;
}

.search-field input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
}

.search-field input::placeholder {
  color: #a3adbd;
}

.room-section-label {
  display: flex;
  justify-content: space-between;
  margin: 14px 8px 7px;
  color: #9aa5b6;
  font-size: 13px;
  font-weight: 760;
  letter-spacing: 1.1px;
}

.room-section-label button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--teal);
  font-size: 13px;
  font-weight: 650;
}

.room-item {
  display: grid;
  grid-template-columns: 35px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
}

.room-item:hover { background: #f1f5f9; }
.room-item.active { background: #eaf7f5; }

.room-avatar {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border-radius: 10px;
  color: #fff;
  font-size: 13px;
  font-weight: 750;
}

.room-avatar.harbour { background: linear-gradient(135deg, #118d87, #3faca3); }
.room-avatar.tender { background: linear-gradient(135deg, #4e62be, #8392e2); }
.room-avatar.hr { background: linear-gradient(135deg, #9c6a42, #c99a74); }
.room-avatar.ops { background: linear-gradient(135deg, #7f5cb7, #a98bd8); }
.room-avatar.finance { background: linear-gradient(135deg, #a36068, #d58c92); }

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

.room-copy strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-copy small,
.room-time {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unread {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.conversation-panel {
  display: grid;
  grid-template-rows: 67px minmax(0, 1fr) auto;
  background: #fff;
}

.conversation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
}

.conversation-header > div:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
}

.conversation-header h2 { font-size: 14px; }

.conversation-header h2 + span {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.conversation-header h2 + span i,
.agent-card small i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.message-area {
  overflow: auto;
  padding: 15px 26px 20px;
  scroll-behavior: smooth;
}

.date-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 19px;
  color: #9ca7b7;
  font-size: 13px;
  font-weight: 650;
}

.date-divider::before,
.date-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.message-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 15px;
}

.message-row.own {
  flex-direction: row-reverse;
}

.message-row.own .message-meta {
  flex-direction: row-reverse;
}

.message-row.own .message-bubble {
  border-color: #c7ebe6;
  background: #eaf8f6;
}

.message-content {
  max-width: min(620px, 83%);
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
}

.message-meta strong { font-size: 13px; }
.message-meta > span { color: var(--muted-2); font-size: 13px; }

.ai-label {
  display: inline-block;
  margin-left: 4px;
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--teal-pale);
  color: var(--teal);
  font-size: 13px;
  letter-spacing: 0.5px;
}

.message-bubble {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px 12px 12px 12px;
  background: #f8fafc;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.52;
}

.message-row.own .message-bubble { border-radius: 12px 4px 12px 12px; }
.message-bubble p { margin: 0 0 6px; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble ol { margin: 4px 0 9px; padding-left: 19px; }
.message-bubble li { margin: 2px 0; }
.ai-bubble { background: linear-gradient(140deg, #f3fbfa, #f6f9fd); border-color: #d7e9e7; }
.ai-bubble.low-confidence { border-left: 3px solid var(--amber); }

.source-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 7px;
  border: 1px solid #d8e6e4;
  border-radius: 6px;
  background: rgba(255,255,255,0.76);
  color: #5b6a7f;
  font-size: 13px;
}

.confidence-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid #e3ebe9;
}

.confidence-row span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #9b6d2c;
  font-size: 13px;
  font-weight: 650;
}

.confidence-row span::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
}

.teach-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--teal);
  border-radius: 7px;
  background: #fff;
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
}

.typing-bubble {
  display: flex;
  gap: 4px;
  width: max-content;
  padding: 11px 13px;
}

.typing-bubble i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #7d8b9f;
  animation: typing 1.1s infinite ease-in-out;
}
.typing-bubble i:nth-child(2) { animation-delay: 130ms; }
.typing-bubble i:nth-child(3) { animation-delay: 260ms; }
@keyframes typing { 0%, 70%, 100% { opacity: .35; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-3px); } }

.summary-card {
  margin: 10px 0 18px 44px;
  padding: 14px;
  border: 1px solid #cfe1ee;
  border-radius: 12px;
  background: linear-gradient(135deg, #f4fafc, #f7f5ff);
  font-size: 13px;
}

.summary-card > div:first-child {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
  color: var(--blue);
}

.summary-card strong { color: var(--ink); }
.summary-card p { margin: 0 0 7px; line-height: 1.45; color: var(--ink-2); }
.summary-card ul { margin: 0; padding-left: 17px; color: var(--muted); line-height: 1.5; }

.demo-prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 17px 0 2px 44px;
  padding: 11px 12px;
  border: 1px dashed #aadbd5;
  border-radius: 10px;
  background: #f2fbf9;
}

.demo-prompt > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.prompt-icon {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 8px;
  background: var(--teal-pale);
  color: var(--teal);
}

.demo-prompt > div > span:last-child {
  display: grid;
  gap: 2px;
}
.demo-prompt strong { font-size: 13px; }
.demo-prompt small { color: var(--muted); font-size: 13px; }
.demo-prompt button {
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  background: var(--teal);
  color: #fff;
  font-size: 13px;
  font-weight: 670;
  white-space: nowrap;
}

.composer-wrap {
  padding: 9px 19px 12px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.composer-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
}

.composer-tools button {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #72819a;
  font-size: 13px;
}

.composer-tools span {
  margin-left: auto;
  color: var(--teal);
  font-size: 13px;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 35px;
  align-items: end;
  gap: 9px;
  padding: 6px 7px 6px 11px;
  border: 1px solid #cfd8e5;
  border-radius: 10px;
  background: #fff;
}

.composer:focus-within {
  border-color: #86cfc6;
  box-shadow: 0 0 0 3px rgba(10, 155, 143, 0.08);
}

.composer textarea {
  max-height: 100px;
  resize: none;
  padding: 7px 0 5px;
  border: 0;
  outline: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.4;
}

.send-button {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border: 0;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
}

.send-button:hover { background: var(--teal-dark); }
.send-button .icon { width: 17px; height: 17px; }
.composer-hint { display: block; margin-top: 5px; color: #9aa5b6; font-size: 13px; text-align: center; }

.context-panel {
  padding: 19px 16px;
  border-left: 1px solid var(--line);
}

.context-section {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.context-label {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 10px;
  color: #8996aa;
  font-size: 13px;
  font-weight: 760;
  letter-spacing: 1px;
}

.context-label b {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--surface-3);
  color: #7d8aa0;
  font-size: 13px;
}

.member-stack {
  display: flex;
  padding-left: 7px;
}

.member-stack .avatar,
.member-stack button {
  width: 31px;
  height: 31px;
  margin-left: -7px;
  border: 2px solid #fbfcfe;
}

.member-stack button {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #edf1f5;
  color: #7c8aa0;
}

.agent-card {
  display: grid;
  grid-template-columns: 34px 1fr 26px;
  align-items: center;
  gap: 8px;
}

.agent-card > div {
  display: grid;
  gap: 3px;
}

.agent-card strong { font-size: 13px; }
.agent-card small { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; }

.agent-capabilities {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.agent-capabilities span {
  padding: 4px 6px;
  border-radius: 5px;
  background: #edf7f5;
  color: #46756f;
  font-size: 13px;
}

.knowledge-source {
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr) 15px;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-bottom: 7px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
}

.knowledge-source > span:nth-child(2) { display: grid; gap: 3px; min-width: 0; }
.knowledge-source strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.knowledge-source small { color: var(--muted); font-size: 13px; }
.knowledge-source .icon { color: #9aa6b7; }

.file-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 33px;
  border-radius: 5px 5px 8px 5px;
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
}
.file-icon.pdf { background: var(--red-pale); color: var(--red); }
.file-icon.doc { background: var(--blue-pale); color: var(--blue); }

.text-button {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 0;
  border: 0;
  background: transparent;
  color: var(--teal);
  font-size: 13px;
  font-weight: 650;
}

/* Knowledge */
.knowledge-view {
  padding: 27px 31px 34px;
}

.knowledge-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.knowledge-toolbar h2 {
  margin-top: 5px;
  font-size: 24px;
}

.knowledge-toolbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.knowledge-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 13px;
  margin: 22px 0 15px;
}

.knowledge-stats article {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.knowledge-table-panel {
  overflow: auto;
}

.knowledge-list-header {
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
}

.filter-tabs {
  display: flex;
  gap: 4px;
}

.filter-tabs button {
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #71809a;
  font-size: 13px;
  font-weight: 650;
}

.filter-tabs button:hover { background: var(--surface-3); }
.filter-tabs button.active { background: var(--ink); color: #fff; }
.filter-tabs button span { margin-left: 3px; opacity: 0.7; }

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

.knowledge-list-actions .search-field {
  width: 185px;
}

.knowledge-table {
  min-width: 830px;
}

.knowledge-row {
  display: grid;
  grid-template-columns: minmax(230px, 1.5fr) 105px minmax(150px, 1fr) 110px 100px 30px;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 9px 17px;
  border-bottom: 1px solid #edf0f4;
}

.knowledge-row:last-child { border-bottom: 0; }
.knowledge-row:hover:not(.table-head) { background: #fafcfe; }

.knowledge-row.table-head {
  min-height: 38px;
  background: #f7f9fc;
  color: #8794a7;
  font-size: 13px;
  font-weight: 770;
  letter-spacing: 0.9px;
}

.entry-main {
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.entry-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--teal);
  background: var(--teal-pale);
}

.entry-icon .icon { width: 16px; height: 16px; }
.entry-icon.faq { color: var(--blue); background: var(--blue-pale); }
.entry-icon.alias { color: var(--violet); background: var(--violet-pale); }
.entry-icon.correction { color: var(--amber); background: var(--amber-pale); }

.entry-main > span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.entry-main strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-main small,
.knowledge-row > small {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.type-chip,
.status-chip {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.type-chip { background: #f0f3f7; color: #617087; }
.status-chip { gap: 5px; background: #eaf7f0; color: #29805a; }
.status-chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #36a474; }
.status-chip.pending { color: #9b6d2c; background: var(--amber-pale); }
.status-chip.pending::before { background: var(--amber); }
.row-menu { width: 26px; min-height: 26px; border: 0; background: transparent; }
.empty-knowledge { padding: 40px; color: var(--muted); font-size: 13px; text-align: center; }

/* Workflow builder */
.workflow-view.active {
  display: grid;
  grid-template-rows: 59px minmax(0, 1fr);
  overflow: hidden;
  background: #f4f7fa;
}

.workflow-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding: 0 17px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.workflow-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.workflow-title > .icon-button .icon { transform: rotate(180deg); }
.workflow-title h2 { font-size: 14px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #f1f3f6;
  color: #6f7b8f;
  font-size: 13px;
  font-weight: 700;
}

.status-pill.published { background: #e9f7f0; color: #27815a; }

.saved-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #8a97aa;
  font-size: 13px;
}

.saved-label.unsaved { color: var(--amber); }

.builder-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 245px;
  min-width: 0;
  min-height: 0;
}

.node-library,
.config-panel {
  min-height: 0;
  overflow: auto;
  background: #fff;
  z-index: 3;
}

.node-library {
  padding: 17px 13px;
  border-right: 1px solid var(--line);
}

.node-library > p {
  margin: 5px 0 15px;
  color: var(--muted);
  font-size: 13px;
}

.node-group {
  display: grid;
  gap: 6px;
  margin: 14px 0;
}

.node-group > span {
  color: #919caf;
  font-size: 13px;
  font-weight: 760;
  letter-spacing: 0.9px;
}

.palette-node {
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr) 14px;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  text-align: left;
  transition: 150ms ease;
}

.palette-node:hover {
  border-color: #bfcbd9;
  box-shadow: var(--shadow-sm);
  transform: translateX(2px);
}

.palette-node > span:nth-child(2) { display: grid; gap: 3px; }
.palette-node strong { font-size: 13px; }
.palette-node small { color: var(--muted); font-size: 13px; }
.palette-node > .icon { color: #9aa5b6; }

.node-icon {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 8px;
  font-style: normal;
}

.node-icon .icon { width: 16px; height: 16px; }
.node-icon.trigger { background: var(--teal-pale); color: var(--teal); }
.node-icon.ai { background: var(--blue-pale); color: var(--blue); }
.node-icon.logic { background: var(--violet-pale); color: var(--violet); }
.node-icon.review { background: var(--amber-pale); color: var(--amber); }
.node-icon.action { background: #eef6fb; color: #4c8bad; }

.library-tip {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  margin-top: 15px;
  padding: 11px;
  border-radius: 9px;
  background: linear-gradient(145deg, #f0efff, #eef8f7);
  color: var(--violet);
}

.library-tip > .icon { width: 18px; height: 18px; }
.library-tip strong { display: block; color: var(--ink); font-size: 13px; }
.library-tip p { margin: 3px 0 6px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.library-tip button { padding: 0; border: 0; background: transparent; color: var(--violet); font-size: 13px; font-weight: 700; }

.workflow-canvas-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #eef2f6;
}

.canvas-toolbar {
  position: absolute;
  left: 13px;
  right: 13px;
  top: 11px;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.canvas-toolbar > div {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(255,255,255,0.95);
  box-shadow: var(--shadow-sm);
  pointer-events: auto;
}

.tool-button {
  display: grid;
  place-items: center;
  min-width: 27px;
  height: 27px;
  padding: 0 6px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #63728a;
  font-size: 13px;
}

.tool-button:hover,
.tool-button.active { background: #edf1f5; color: var(--ink); }
.tool-button.connecting { background: var(--teal-pale); color: var(--teal); }
.tool-separator { width: 1px; height: 17px; margin: 0 3px; background: var(--line); }
#zoom-label { min-width: 38px; color: var(--muted); font-size: 13px; text-align: center; }
.canvas-help { padding: 7px 9px; border-radius: 6px; background: rgba(255,255,255,0.8); color: #8390a4; font-size: 13px; }

.workflow-canvas {
  position: absolute;
  inset: 0;
  min-width: 1440px;
  min-height: 650px;
  overflow: auto;
  transform-origin: 0 0;
}

.canvas-grid {
  position: absolute;
  inset: 0;
  width: 1700px;
  height: 850px;
  background-image: radial-gradient(#cdd5df 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: 0.75;
}

.connections {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  width: 1700px;
  height: 850px;
  overflow: visible;
  pointer-events: none;
}

.connection-line {
  fill: none;
  stroke: #9eabbc;
  stroke-width: 2;
}

.connection-line.yes { stroke: #48a97a; }
.connection-line.no { stroke: #d39a44; }
.connection-line.new { stroke: #6e83df; stroke-dasharray: 5 4; }

.flow-node {
  position: absolute;
  z-index: 2;
  width: 190px;
  min-height: 112px;
  padding: 12px;
  border: 1px solid #d2dae5;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 5px 13px rgba(40, 56, 79, 0.08);
  user-select: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 120ms ease;
  cursor: grab;
}

.flow-node:hover,
.flow-node.selected {
  border-color: #6a82df;
  box-shadow: 0 0 0 3px rgba(87, 111, 213, 0.1), 0 10px 22px rgba(40, 56, 79, 0.1);
}

.flow-node.connect-source {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(10, 155, 143, 0.13);
}

.flow-node.dragging {
  cursor: grabbing;
  z-index: 6;
  opacity: 0.92;
  transform: scale(1.02);
}

.flow-node.running {
  border-color: #4c84df;
  box-shadow: 0 0 0 4px rgba(66, 103, 223, 0.11), 0 10px 23px rgba(40, 56, 79, 0.1);
}

.flow-node.complete {
  border-color: #41a775;
}

.flow-node.routed-out {
  opacity: 0.44;
}

.run-state {
  position: absolute;
  right: -7px;
  top: -7px;
  display: none;
  place-items: center;
  width: 19px;
  height: 19px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.14);
}

.flow-node.complete .run-state { display: grid; }
.run-state .icon { width: 11px; height: 11px; stroke-width: 2.4; }

.node-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}

.node-top .node-icon { width: 28px; height: 28px; }
.node-menu { color: #8e9aae; font-size: 13px; letter-spacing: 1px; }
.node-step { display: block; margin-bottom: 4px; color: #8f9bad; font-size: 13px; font-weight: 800; letter-spacing: 0.85px; }
.flow-node strong { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.flow-node small { display: block; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }

.port {
  position: absolute;
  z-index: 3;
  width: 9px;
  height: 9px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #7e8ca2;
  box-shadow: 0 0 0 1px #a7b2c2;
}
.port-in { left: -5px; top: 51px; }
.port-out { right: -5px; top: 51px; }
.port-out-top { top: 31px; }
.port-out-bottom { top: 78px; }
.node-logic .branch-label { position: absolute; right: -25px; color: #94a0b2; font-size: 13px; font-weight: 760; }
.node-logic .branch-label.yes { top: 26px; color: #3c9b6c; }
.node-logic .branch-label.no { top: 74px; color: #b98436; }

.execution-drawer {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 13px;
  z-index: 8;
  max-height: 250px;
  overflow: hidden;
  border: 1px solid #d4dce7;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(22, 37, 61, 0.15);
  transform: translateY(calc(100% + 20px));
  transition: transform 240ms ease;
}

.execution-drawer.open { transform: translateY(0); }

.execution-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.execution-header > div { display: flex; align-items: center; gap: 9px; }
.execution-header > div > div { display: grid; gap: 3px; }
.execution-header strong { font-size: 13px; }
.execution-header small { color: var(--muted); font-size: 13px; }
.execution-dot { width: 9px; height: 9px; border: 2px solid #d4dbe5; border-radius: 50%; }
.execution-dot.running { border-color: #adc0ec; border-top-color: var(--blue); animation: spin 700ms linear infinite; }
.execution-dot.complete { border: 0; background: var(--green); box-shadow: 0 0 0 4px rgba(44,156,105,0.12); }
@keyframes spin { to { transform: rotate(360deg); } }

.execution-body {
  max-height: 190px;
  overflow: auto;
  padding: 10px 12px 12px;
}

.empty-execution {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 80px;
  color: var(--muted);
}
.empty-execution span { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 8px; background: var(--blue-pale); color: var(--blue); }
.empty-execution p { max-width: 360px; margin: 0; font-size: 13px; line-height: 1.45; }

.execution-list {
  display: grid;
  gap: 5px;
}

.execution-row {
  display: grid;
  grid-template-columns: 21px minmax(150px, 1fr) 100px 70px;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border-radius: 7px;
  background: #f7f9fb;
  font-size: 13px;
}
.execution-row > span:first-child { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #e6f5ed; color: var(--green); }
.execution-row > span:first-child .icon { width: 11px; height: 11px; }
.execution-row strong { font-size: 13px; }
.execution-row span { color: var(--muted); }
.execution-row .result { color: var(--green); font-weight: 650; }
.execution-row.waiting .result { color: var(--amber); }

.config-panel {
  border-left: 1px solid var(--line);
}

.config-header {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.config-content {
  display: grid;
  gap: 13px;
  padding: 15px;
}

.config-content label {
  display: grid;
  gap: 6px;
  color: #637188;
  font-size: 13px;
  font-weight: 650;
}

.config-content input,
.config-content select,
.config-content textarea {
  width: 100%;
  padding: 9px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  outline: 0;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.config-content textarea { resize: vertical; }
.config-content textarea { min-height: 145px; }
.config-content input:focus,
.config-content select:focus,
.config-content textarea:focus { border-color: #94a7de; box-shadow: 0 0 0 3px rgba(66,103,223,0.07); }
.config-row { display: grid; grid-template-columns: 1.4fr .6fr; gap: 8px; }

.config-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
}

.config-toggle > div { display: grid; gap: 3px; }
.config-toggle strong { font-size: 13px; }
.config-toggle small { color: var(--muted); font-size: 13px; }
.toggle { width: 31px; height: 18px; padding: 2px; border: 0; border-radius: 999px; background: #c9d1dc; transition: 150ms; }
.toggle span { display: block; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.18); transition: 150ms; }
.toggle.on { background: var(--teal); }
.toggle.on span { transform: translateX(13px); }

.test-input {
  display: grid;
  gap: 7px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.test-input > div {
  display: grid;
  grid-template-columns: 30px 1fr 15px;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfc;
}
.test-input > div > span:nth-child(2) { display: grid; gap: 3px; }
.test-input strong { font-size: 13px; }
.test-input small { color: var(--muted); font-size: 13px; }
.test-input > div > .icon { color: var(--green); }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 30px;
  background: rgba(10, 21, 39, 0.52);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: 180ms ease;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  width: min(660px, 92vw);
  max-height: 92vh;
  overflow: auto;
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  transform: translateY(15px) scale(0.98);
  transition: 180ms ease;
}

.modal-backdrop.open .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 22px 15px;
  border-bottom: 1px solid var(--line);
}

.modal-header > div:first-child { display: flex; align-items: flex-start; gap: 11px; }
.modal-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: var(--teal-pale); color: var(--teal); }
.modal-header h2 { margin: 3px 0 3px; font-size: 19px; letter-spacing: -0.4px; }
.modal-header p { margin: 0; color: var(--muted); font-size: 13px; }

#teach-form {
  padding: 17px 22px 20px;
}

.type-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.type-picker label {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 1px 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
}

.type-picker label:hover { background: #fafcfd; }
.type-picker label.selected { border-color: #67bfb5; background: #f2fbf9; box-shadow: 0 0 0 2px rgba(10,155,143,0.07); }
.type-picker input { position: absolute; opacity: 0; pointer-events: none; }
.type-icon { grid-row: 1 / 3; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--surface-3); color: #6a7890; }
.type-picker label.selected .type-icon { background: var(--teal-pale); color: var(--teal); }
.type-icon .icon { width: 15px; height: 15px; }
.type-picker strong { align-self: end; font-size: 13px; }
.type-picker small { color: var(--muted); font-size: 13px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
  margin-top: 17px;
}

.form-grid label {
  display: grid;
  gap: 6px;
  color: #53627a;
  font-size: 13px;
  font-weight: 650;
}

.form-grid label span {
  margin-left: 4px;
  color: #9ba5b5;
  font-size: 13px;
  letter-spacing: 0.7px;
}

.form-grid label:nth-child(1),
.form-grid label:nth-child(2) { grid-column: 1 / -1; }

.form-grid input,
.form-grid textarea,
.form-grid select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: 0;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
  line-height: 1.5;
}

.form-grid textarea { resize: vertical; }
.form-grid input:focus,
.form-grid textarea:focus,
.form-grid select:focus { border-color: #75bfb6; box-shadow: 0 0 0 3px rgba(10,155,143,0.08); }

.modal-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 15px;
  padding: 11px;
  border-radius: 9px;
  background: #f4f7fb;
  color: #65758c;
}
.modal-note > .icon { width: 18px; height: 18px; color: var(--blue); }
.modal-note strong { display: block; margin-bottom: 3px; color: var(--ink-2); font-size: 13px; }
.modal-note p { margin: 0; font-size: 13px; line-height: 1.45; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 17px -22px -20px;
  padding: 13px 22px;
  border-top: 1px solid var(--line);
  background: #fbfcfe;
}

/* Guide drawer and toast */
.guide-drawer {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 90;
  width: 380px;
  padding: 22px;
  background: #fff;
  box-shadow: -24px 0 60px rgba(16, 30, 52, 0.2);
  transform: translateX(105%);
  transition: transform 240ms ease;
}

.guide-drawer.open { transform: translateX(0); }
.drawer-scrim { position: fixed; inset: 0; z-index: 80; background: rgba(13,24,42,0.36); opacity: 0; visibility: hidden; transition: 200ms ease; }
.drawer-scrim.open { opacity: 1; visibility: visible; }

.guide-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.guide-header > div { display: flex; gap: 10px; }
.guide-spark { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 auto; border-radius: 10px; background: linear-gradient(135deg, var(--teal-pale), var(--violet-pale)); color: var(--teal); }
.guide-header h2 { margin: 4px 0 0; font-size: 18px; line-height: 1.2; letter-spacing: -0.4px; }
.guide-progress { height: 4px; margin: 22px 0; overflow: hidden; border-radius: 99px; background: #edf1f5; }
.guide-progress span { display: block; width: 25%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--blue)); transition: width 200ms; }
.guide-steps { display: grid; gap: 8px; }
.guide-step { display: grid; grid-template-columns: 27px 1fr 16px; align-items: center; gap: 10px; width: 100%; padding: 13px 11px; border: 1px solid var(--line); border-radius: 10px; background: #fff; text-align: left; transition: 160ms; }
.guide-step:hover { border-color: #b9c8d8; transform: translateX(-2px); }
.guide-step.active { border-color: #8bcfc6; background: #f2faf9; }
.guide-step > span { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 50%; background: #eff2f6; color: #718097; font-size: 13px; font-weight: 750; }
.guide-step.active > span { background: var(--teal); color: #fff; }
.guide-step > div { display: grid; gap: 4px; }
.guide-step strong { font-size: 13px; }
.guide-step p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.guide-step > .icon { color: #a1abba; }
.guide-tip { position: absolute; left: 22px; right: 22px; bottom: 22px; display: flex; gap: 9px; padding: 12px; border-radius: 10px; background: linear-gradient(135deg, #f1f5fb, #eff9f7); color: var(--teal); }
.guide-tip .icon { width: 18px; height: 18px; }
.guide-tip p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.guide-tip strong { color: var(--ink); }

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 120;
  display: grid;
  grid-template-columns: 34px 1fr 20px;
  align-items: center;
  gap: 9px;
  min-width: 310px;
  max-width: 390px;
  padding: 11px 12px;
  border: 1px solid #d8e6e2;
  border-radius: 11px;
  background: #fff;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(15px);
  transition: 180ms ease;
}

.toast.show { opacity: 1; visibility: visible; transform: translateY(0); }
.toast-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: #eaf7f0; color: var(--green); }
.toast > div { display: grid; gap: 3px; }
.toast strong { font-size: 13px; }
.toast p { margin: 0; color: var(--muted); font-size: 13px; }
.toast > button { display: grid; place-items: center; padding: 0; border: 0; background: transparent; color: #8794a6; }

@media (max-width: 1280px) {
  .app-shell { grid-template-columns: 205px minmax(0, 1fr); }
  .sidebar { padding-left: 12px; padding-right: 12px; }
  .chat-view.active { grid-template-columns: 225px minmax(450px, 1fr) 225px; }
  .builder-shell { grid-template-columns: 200px minmax(0, 1fr) 225px; }
  .context-panel { padding-left: 13px; padding-right: 13px; }
  .hero-copy h2 { font-size: 34px; }
  .feature-card { padding: 15px; }
}

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 188px minmax(0, 1fr); }
  .sidebar { padding-left: 10px; padding-right: 10px; }
  .brand { padding-left: 8px; }
  .topbar { padding-left: 24px; padding-right: 24px; }
  .chat-view.active { grid-template-columns: 218px minmax(0, 1fr); }
  .chat-view .context-panel { display: none; }
  .builder-shell { grid-template-columns: 185px minmax(0, 1fr) 210px; }
  .node-library { padding-left: 10px; padding-right: 10px; }
  .config-content { padding-left: 12px; padding-right: 12px; }
  .knowledge-toolbar h2 { font-size: 21px; }
  .knowledge-toolbar .primary-button { flex: 0 0 auto; }
  .knowledge-view { padding-left: 24px; padding-right: 24px; }
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .activity-panel { display: none; }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 166px minmax(0, 1fr); }
  .sidebar { padding-left: 8px; padding-right: 8px; }
  .brand { padding-left: 3px; padding-right: 3px; }
  .brand-logo-surface { padding-left: 8px; padding-right: 8px; }
  .workspace-switcher { grid-template-columns: 31px 1fr 14px; gap: 7px; padding-left: 7px; padding-right: 7px; }
  .nav-item { padding-left: 10px; padding-right: 10px; }
  .demo-card { padding: 10px; }
  .topbar { padding-left: 20px; padding-right: 20px; }
  .topbar-actions .demo-mode { display: none; }
  #view-home { padding-left: 20px; padding-right: 20px; }
  .home-hero { grid-template-columns: 1fr; }
  .hero-visual { display: none; }
  .hero-copy { padding-left: 34px; padding-right: 34px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .feature-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .chat-view.active { grid-template-columns: 205px minmax(0, 1fr); }
  .rooms-panel { padding-left: 10px; padding-right: 10px; }
  .message-area { padding-left: 18px; padding-right: 18px; }
  .knowledge-view { padding: 24px 20px 30px; }
  .knowledge-list-header { align-items: flex-start; flex-direction: column; }
  .knowledge-list-actions { width: 100%; }
  .knowledge-list-actions .search-field { flex: 1; }
  .builder-shell { grid-template-columns: 175px minmax(0, 1fr); }
  .config-panel { display: none; }
  .workflow-actions .saved-label { display: none; }
}

@media (max-height: 760px) {
  .sidebar { padding-top: 18px; }
  .brand { padding-bottom: 16px; }
  .workspace-switcher { margin-bottom: 14px; }
  .demo-card { padding: 11px; }
  #view-home { padding-top: 18px; }
  .home-hero { min-height: 210px; }
  .hero-visual { min-height: 210px; }
  .hero-copy { padding-top: 26px; padding-bottom: 26px; }
  .stat-card { padding-top: 11px; padding-bottom: 11px; }
}

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