:root {
  --background: #ffffff;
  --background-secondary: #f8f9fa;
  --border: #e5e7eb;
  --text: #111827;
  --text-secondary: #6b7280;
  --blue: #00a9e0;
  --blue-soft: #eef9fd;
  --shadow: 0 12px 32px rgba(17, 24, 39, 0.12);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

body {
  height: 100%;
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background: var(--background);
  overflow: hidden;
}

button,
textarea,
input {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 72px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 32px;
  align-items: center;
  padding: 0 48px;
  border-bottom: 1px solid var(--border);
  background: var(--background);
}

.boyden-logo {
  height: 36px;
  width: auto;
  display: block;
}

.gejst-logo {
  width: 126px;
  height: auto;
  display: block;
  opacity: 0.85;
}

.layout {
  height: calc(100vh - 72px);
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.header-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  min-width: 0;
}

.nav-item {
  min-height: 72px;
  display: flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  color: #4b5563;
  text-decoration: none;
  font-size: 15px;
  white-space: nowrap;
}

.nav-item.active {
  border-bottom-color: var(--blue);
  color: var(--blue);
}

.main-content {
  max-width: 1100px;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  overflow-x: clip;
  padding: 48px 64px 80px;
}

.page-title {
  margin: 0 0 40px;
  font-size: 48px;
  line-height: 1.1;
  font-weight: 500;
  letter-spacing: 0;
}

.page-subtitle {
  margin: 0 0 40px;
  color: var(--text-secondary);
  font-size: 17px;
  line-height: 1.5;
}

.overview-grid {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--border);
}

.overview-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 22px 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.overview-link h2 {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 24px;
  font-weight: 500;
}

.overview-link p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.5;
}

.overview-meta {
  color: var(--text-secondary);
  font-size: 14px;
  white-space: nowrap;
}

.prompt-structure {
  margin-bottom: 32px;
  border-top: 1px solid var(--border);
}

.section-title {
  margin: 0 0 14px;
  font-size: 24px;
  font-weight: 500;
}

.structure-row {
  display: grid;
  grid-template-columns: 40px 140px minmax(0, 1fr);
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.structure-icon {
  color: var(--blue);
  font-size: 18px;
}

.structure-label {
  font-weight: 600;
  color: var(--text);
}

.structure-description {
  color: #4b5563;
  line-height: 1.5;
}

.template-card {
  margin: 0 0 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.template-card-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  background: var(--background-secondary);
}

.prompt-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-left: auto;
  justify-content: flex-end;
}

.template-body {
  max-height: 340px;
  overflow: auto;
  padding: 16px;
  white-space: pre-wrap;
  color: #374151;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

.examples {
  margin-top: 16px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}

.examples-title {
  margin: 0;
  color: var(--text);
  font-size: 24px;
  font-weight: 500;
}

.example-accordion {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
  border-bottom: 1px solid var(--border);
}

.example-accordion:first-of-type {
  border-top: 1px solid var(--border);
  margin-top: 18px;
}

.example-accordion summary {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 16px;
  padding: 18px 0;
  position: relative;
  padding-right: 40px;
  color: var(--blue);
  font-size: 20px;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}

.example-accordion summary > span:first-child {
  min-width: 0;
}

.example-accordion summary::-webkit-details-marker {
  display: none;
}

.example-accordion summary::after {
  content: "+";
  color: var(--blue);
  font-size: 24px;
  line-height: 1;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.example-accordion[open] summary::after {
  content: "−";
}

.example-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 188px;
  gap: 16px;
  align-items: start;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.chat-thread {
  padding: 18px 0 30px;
  display: grid;
  gap: 18px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.chat-message {
  display: block;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.chat-role {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 13px;
}

.chat-role > span:last-child {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--background-secondary);
}

.chat-avatar {
  width: 10px;
  height: 10px;
  margin-top: 9px;
  border-radius: 999px;
  display: block;
  background: #f3f4f6;
}

.chat-avatar.assistant {
  background: var(--blue);
  color: #ffffff;
}

.chat-bubble {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  contain: inline-size;
  overflow: hidden;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--background);
  font-size: 15px;
  line-height: 1.6;
}

.chat-message.user .chat-bubble {
  background: var(--background-secondary);
  border-color: #ddebfa;
}

.template-token {
  margin: 0 0 2px;
  color: var(--text-secondary);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
}

.example-input {
  margin: 0;
  white-space: normal;
}

.chat-bubble h1 {
  margin: 0 0 16px;
  color: var(--text);
  font-size: 24px;
  line-height: 1.2;
  font-weight: 600;
}

.chat-bubble h2 {
  margin: 22px 0 10px;
  color: var(--text);
  font-size: 20px;
  font-weight: 600;
}

.chat-bubble h3,
.chat-bubble h4 {
  margin: 18px 0 8px;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
}

.chat-bubble p,
.chat-bubble ul,
.chat-bubble ol {
  margin-top: 0;
}

.chat-bubble p,
.chat-bubble li {
  color: var(--text);
}

.chat-bubble a {
  color: var(--blue);
  text-underline-offset: 3px;
}

.table-scroll {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 16px 0;
  overflow-x: auto;
  overflow-y: visible;
  overscroll-behavior-x: contain;
  contain: inline-size;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--background);
  scrollbar-gutter: stable both-edges;
  scrollbar-color: var(--blue) #e5e7eb;
  scrollbar-width: auto;
}

.table-scroll::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}

.table-scroll::-webkit-scrollbar-track {
  background: #e5e7eb;
  border-radius: 999px;
}

.table-scroll::-webkit-scrollbar-thumb {
  background: var(--blue);
  border: 3px solid #e5e7eb;
  border-radius: 999px;
}

.chat-bubble table {
  width: var(--table-width, 960px);
  min-width: 100%;
  max-width: none;
  margin: 0;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}

.chat-bubble th,
.chat-bubble td {
  min-width: 0;
  max-width: none;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-top: 0;
  border-left: 0;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}

.chat-bubble th {
  background: var(--background-secondary);
  text-align: left;
  font-weight: 600;
}

.output-mark {
  background: #c8f1ff;
  box-shadow: inset 0 -2px 0 var(--blue);
  border-radius: 3px;
  scroll-margin: 120px;
}

.output-mark.output-mark-pending {
  background: #fff1a8;
  box-shadow: inset 0 -2px 0 #d69b00;
}

.comment-sidebar {
  position: sticky;
  top: 24px;
  z-index: 20;
  align-self: start;
  max-height: calc(100vh - 112px);
  overflow: auto;
  scrollbar-gutter: stable;
  scrollbar-color: var(--blue) #e5e7eb;
  scrollbar-width: thin;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--background);
  box-shadow: 0 8px 22px rgba(17, 24, 39, 0.08);
}

.comment-sidebar::-webkit-scrollbar {
  width: 10px;
}

.comment-sidebar::-webkit-scrollbar-track {
  background: #e5e7eb;
  border-radius: 999px;
}

.comment-sidebar::-webkit-scrollbar-thumb {
  background: var(--blue);
  border: 2px solid #e5e7eb;
  border-radius: 999px;
}

.comment-sidebar-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--background);
}

.comment-sidebar-header h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.comment-list {
  padding: 8px 10px;
}

.empty {
  margin: 0;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.45;
}

.comment-item {
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}

.comment-item:first-child {
  padding-top: 0;
}

.comment-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.comment-item blockquote {
  margin: 0 0 6px;
  padding-left: 8px;
  border-left: 2px solid var(--blue);
  color: #4b5563;
  font-size: 10.5px;
  line-height: 1.4;
}

.comment-item p {
  margin: 0 0 6px;
  font-size: 11px;
  line-height: 1.4;
}

.comment-meta {
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 10.5px;
}

.feedback-popover {
  position: fixed;
  z-index: 40;
  width: 320px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--background);
  box-shadow: var(--shadow);
}

.feedback-popover[hidden] {
  display: none;
}

.selected-preview {
  max-height: 92px;
  margin: 0 0 12px;
  overflow: auto;
  padding: 10px 12px;
  border-radius: 8px;
  color: #4b5563;
  background: var(--background-secondary);
  font-size: 13px;
  line-height: 1.4;
}

.name-field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: #4b5563;
  font-size: 13px;
}

.name-field input,
.feedback-popover textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--text);
  background: var(--background);
}

.popover-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.popover-actions button {
  border: 1px solid var(--border);
  background: var(--background);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
}

.popover-footer {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.button {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
  background: var(--background);
  cursor: pointer;
}

.button.primary {
  border: none;
  background: var(--blue);
  color: #ffffff;
}

.link-button {
  padding: 0;
  border: 0;
  color: var(--blue);
  background: transparent;
  cursor: pointer;
  font-weight: 500;
}

@media (max-width: 760px) {
  .site-header {
    height: auto;
    grid-template-columns: 1fr auto;
    gap: 12px 20px;
    padding: 16px 20px 0;
  }

  .layout {
    height: calc(100vh - 107px);
  }

  .header-nav {
    grid-column: 1 / -1;
    order: 3;
    justify-content: flex-start;
    gap: 20px;
    overflow-x: auto;
    border-top: 1px solid var(--border);
  }

  .gejst-logo {
    justify-self: end;
  }

  .nav-item {
    flex: 0 0 auto;
    min-height: 42px;
    border-bottom: 2px solid transparent;
  }

  .nav-item.active {
    border-bottom-color: var(--blue);
  }

  .main-content {
    padding: 28px 20px 56px;
  }

  .page-title {
    font-size: 36px;
  }

  .structure-row {
    grid-template-columns: 32px 1fr;
    gap: 0 12px;
  }

  .structure-description {
    grid-column: 2;
    margin-top: 4px;
  }

  .chat-message {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .example-body {
    grid-template-columns: 1fr;
  }

  .comment-sidebar {
    position: static;
    max-height: none;
  }

  .chat-bubble {
    max-width: 100%;
  }

  .feedback-popover {
    width: min(320px, calc(100vw - 24px));
  }
}
