:root {
  /* Aligned with public `.qh-site` stone / teal palette */
  --bg: #fafaf8;
  --panel: #ffffff;
  --accent: #14b8a6;
  --accent-hover: #0d9488;
  --text: #1c1917;
  --muted: #57534e;
  --danger: #9f1239;
  --border: #e7e5e4;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

/* Tenant chat UI: full-viewport shell only when this class is on body (see index.html). */
body.qh-app {
  height: 100%;
  overflow: hidden;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  grid-template-rows: 1fr;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
.app-shell > main {
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  padding: 1rem;
  padding-top: max(1rem, env(safe-area-inset-top, 0px));
  padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.tenant-sidebar-close {
  display: none;
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
}

.tenant-sidebar-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tenant-sidebar-toggle {
  display: none;
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  cursor: pointer;
  color: var(--text);
}

.tenant-sidebar-toggle__bar {
  display: block;
  width: 1.25rem;
  height: 2px;
  background: currentColor;
  position: relative;
  box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
}

.tenant-header-new-btn {
  display: none;
  flex-shrink: 0;
  white-space: nowrap;
  min-height: 2.75rem;
  padding: 0 1rem;
  font-weight: 600;
  border-radius: 999px;
  border: 2px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

.tenant-header-new-btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

.thread-header-body {
  flex: 1;
  min-width: 0;
}

.thread-header-hint {
  display: block;
  margin-top: 0.35rem;
  line-height: 1.4;
  color: var(--muted);
  font-size: 0.8rem;
}

.tenant-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 199;
  margin: 0;
  padding: 0;
  border: none;
  background: rgba(28, 25, 23, 0.45);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tenant-sidebar-backdrop:not([hidden]) {
  display: block;
}

body.qh-app button:focus-visible,
body.qh-app input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sidebar-title-block {
  min-width: 0;
}
.sidebar-header h1 {
  margin: 0;
  font-size: 1.1rem;
}
.sidebar-tagline {
  margin: 0.2rem 0 0;
  font-size: 0.75rem;
  color: var(--muted, #6b7280);
  line-height: 1.2;
}

.conversation-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-footer {
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.sidebar-sign-out-btn {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}

.sidebar-sign-out-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.sidebar-legal {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--muted);
}

.sidebar-legal a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sidebar-legal a:hover {
  color: var(--accent);
}

.sidebar-legal-sep {
  margin: 0 0.25rem;
}

.conversation-item {
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 0;
  box-sizing: border-box;
}

.conversation-item-content {
  width: 100%;
  padding: 0.65rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  box-sizing: border-box;
}

.conversation-item-row {
  position: relative;
  width: 100%;
  min-height: 2rem;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.conversation-item-expand {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.7rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.conversation-item-expand:hover {
  background: var(--border);
  color: var(--text);
}

.conversation-item-title {
  flex: 1;
  min-width: 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.35;
  cursor: pointer;
}

.conversation-sub-list {
  list-style: none;
  padding: 0.25rem 0 0.5rem 1.5rem;
  margin: 0;
  border-top: 1px solid var(--border);
}

.conversation-sub-item {
  margin: 0.2rem 0;
}

.conversation-sub-link {
  display: block;
  width: 100%;
  padding: 0.35rem 0.5rem;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  text-align: left;
  color: var(--text);
}
.conversation-sub-link:hover {
  background: rgba(0, 0, 0, 0.06);
}
.conversation-sub-link--selected,
.conversation-sub-link.conversation-sub-link--selected:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--accent);
  font-weight: 600;
  border-left: 3px solid var(--accent);
  margin-left: -3px;
  padding-left: calc(0.5rem + 3px);
}
.conversation-sub-item.has-content .conversation-sub-link {
  font-weight: 500;
}
.conversation-sub-item.has-content .conversation-sub-link::before {
  content: "● ";
  color: var(--accent);
  font-weight: normal;
}

.conversation-item-date {
  display: block;
  color: var(--muted);
  font-size: 0.85em;
}

.conversation-item.active {
  border-color: var(--accent);
  background: #e6fffb;
}

.conversation-item-menu {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.conversation-item-menu:hover {
  background: var(--border);
  color: var(--text);
}

.conversation-item-dropdown {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 0.25rem;
  min-width: 120px;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.conversation-item-dropdown button {
  padding: 0.5rem 0.75rem;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  font-size: 0.9rem;
  color: var(--text);
}

.conversation-item-dropdown button:hover {
  background: var(--bg);
}

.conversation-item-dropdown button[data-action="delete"]:hover {
  background: #fef2f2;
  color: var(--danger);
}

.main-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.thread-header {
  flex-shrink: 0;
  padding: 0.85rem 1rem;
  padding-top: max(0.85rem, env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 1px 0 var(--border);
}

.thread-header h2 {
  margin: 0;
  font-size: clamp(1rem, 2.5vw + 0.65rem, 1.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

.main-content-wrapper {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.main-content-view {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.main-content-view[hidden] {
  display: none !important;
}

.chat-thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}
.chat-thread > * {
  min-width: 0;
  flex-shrink: 0;
}

.artifact-view-header {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
}
.artifact-view-header button {
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 0.9rem;
}
.artifact-view-header button:hover {
  background: var(--border);
}
.artifact-view-export {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.artifact-view-export button {
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
}
.artifact-view-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto;
  padding: 1rem;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}

.requirement-blocks-view {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: relative;
}
.requirement-blocks-view.requirement-blocks-view--loading {
  opacity: 0.75;
  pointer-events: none;
}
.requirement-blocks-loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 10px;
  font-size: 0.9rem;
  color: var(--text, #333);
}
.requirement-blocks-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border, #ddd);
  border-top-color: var(--accent, #2563eb);
  border-radius: 50%;
  animation: requirement-spin 0.8s linear infinite;
}
@keyframes requirement-spin {
  to { transform: rotate(360deg); }
}
.requirement-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  background: #fff;
}
.requirement-block-input {
  display: block;
  width: 100%;
  min-height: 420px;
  padding: 0.5rem;
  margin: 0 0 0.5rem 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
  resize: vertical;
  box-sizing: border-box;
}
.requirement-block-input:focus {
  outline: none;
  border-color: var(--accent, #2563eb);
}
.requirement-block-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.requirement-block-rewrite-btn {
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
}
.requirement-block-rewrite-btn:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.requirement-block-rewrite-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.requirement-block-edit-btn,
.requirement-block-done-btn {
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
}
.requirement-block-edit-btn:hover,
.requirement-block-done-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.requirement-block-remove-btn {
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
}
.requirement-block-remove-btn:hover:not(:disabled) {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
}
.requirement-block-remove-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.requirement-rewrite-response {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  margin-top: 0.5rem;
  background: #f8fafc;
}
.requirement-rewrite-content {
  font-size: 0.95rem;
  line-height: 1.55;
  margin-bottom: 0.75rem;
}
.requirement-rewrite-content .requirement-rewrite-heading {
  margin-top: 1rem;
  margin-bottom: 0.4rem;
  font-size: 1rem;
  color: var(--text, #1e293b);
}
.requirement-rewrite-content .requirement-rewrite-heading:first-child {
  margin-top: 0;
}
.requirement-rewrite-content .requirement-rewrite-numbered {
  margin: 0.35rem 0 0 0.5rem;
}
.requirement-rewrite-content ul {
  margin: 0.35rem 0 0 1.5rem;
  padding: 0;
}
.requirement-rewrite-content li {
  margin-bottom: 0.25rem;
}
.requirement-rewrite-content p {
  margin: 0.4rem 0;
}
.requirement-rewrite-content a {
  color: var(--accent, #2563eb);
  text-decoration: none;
}
.requirement-rewrite-content a:hover {
  text-decoration: underline;
}
.requirement-rewrite-content strong {
  font-weight: 600;
}
.requirement-rewrite-content em {
  font-style: italic;
}
.requirement-rewrite-content .requirement-rewrite-hr {
  margin: 1rem 0;
  border: none;
  border-top: 1px solid var(--border, #e2e8f0);
}
.requirement-rewrite-content .requirement-rewrite-h3 {
  font-size: 1rem;
  margin: 1rem 0 0.4rem 0;
  color: var(--text, #1e293b);
}
.requirement-block-content {
  margin-bottom: 0.5rem;
}
.requirement-rewrite-actions {
  display: flex;
  gap: 0.5rem;
}
.requirement-rewrite-actions button {
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
}
.requirement-rewrite-actions button:first-child:hover {
  background: #22c55e;
  color: #fff;
  border-color: #22c55e;
}
.requirement-rewrite-actions button:last-child:hover {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
}
.requirement-block pre {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 0.9rem;
}
.artifact-view-add-block {
  margin-right: 0.5rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
}
.artifact-view-add-block:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.artifact-save-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}
.artifact-save-actions button {
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
}
.artifact-save-actions button:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.artifact-editor-modal {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  width: min(900px, 92vw);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.artifact-editor-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.artifact-editor-textarea {
  width: 100%;
  min-height: 420px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem;
  font-family: "IBM Plex Mono", "Consolas", monospace;
  font-size: 0.9rem;
  line-height: 1.4;
}

.artifact-editor-actions {
  margin-top: 0.75rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.msg-add-to-requirement {
  margin-top: 0.5rem;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
}
.msg-add-to-requirement:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.msg {
  max-width: min(85%, 42rem);
  min-width: 0;
  padding: 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-wrap: break-word;
  word-break: break-word;
  overflow-x: hidden;
  box-sizing: border-box;
}
.msg > div,
.msg > p,
.msg > pre {
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: break-word;
}

.msg.user {
  align-self: flex-end;
  background: #dbf4ff;
}

.msg.assistant {
  align-self: flex-start;
  background: var(--panel);
}

.thread-msg-loading {
  align-self: flex-start;
}
.thread-loading-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.thread-spinner {
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--accent, #0369a1);
  animation: thread-spin 0.65s linear infinite;
  flex-shrink: 0;
  box-sizing: border-box;
}
@keyframes thread-spin {
  to {
    transform: rotate(360deg);
  }
}
.thread-stream-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.attachments {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.artifact-panel {
  border-top: 1px solid var(--border);
  max-height: 38vh;
  overflow-y: auto;
  padding: 0.75rem 1rem;
  background: #fff;
}

.artifact {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.artifact pre {
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  font-family: inherit;
}

.summary-content {
  font-size: 0.95rem;
  line-height: 1.5;
}

.summary-content .summary-heading {
  margin-top: 1rem;
  margin-bottom: 0.35rem;
}

.summary-content .summary-heading:first-child {
  margin-top: 0;
}

.summary-content ul {
  margin: 0.25rem 0 0 1.25rem;
  padding: 0;
}

.summary-content li {
  margin-bottom: 0.2rem;
}

.summary-content p {
  margin: 0.35rem 0;
}

.summary-content .summary-numbered {
  margin-left: 0.5rem;
}

/* Automation artifact: readable markdown (headers, blockquote, code, lists) */
.automation-content {
  font-size: 0.95rem;
  line-height: 1.55;
}

.automation-content h1 {
  font-size: 1.25rem;
  margin: 0 0 0.5rem 0;
  color: var(--text);
  font-weight: 600;
}

.automation-content h2 {
  font-size: 1.1rem;
  margin: 1.25rem 0 0.5rem 0;
  color: var(--accent);
  font-weight: 600;
}

.automation-content h2:first-child {
  margin-top: 0;
}

.automation-content h3 {
  font-size: 1rem;
  margin: 1rem 0 0.4rem 0;
  color: var(--text);
  font-weight: 600;
}

.automation-content .automation-table-wrap {
  overflow-x: auto;
  margin: 0.75rem 0;
}

.automation-content .automation-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.automation-content .automation-table thead {
  background: var(--accent);
  color: #fff;
}

.automation-content .automation-table th {
  text-align: left;
  padding: 0.55rem 0.75rem;
  font-weight: 600;
}

.automation-content .automation-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.automation-content .automation-table tbody tr:nth-child(even) {
  background: #fafafa;
}

.automation-content .automation-table tbody tr:hover {
  background: #f4f4f2;
}

.automation-content blockquote {
  margin: 0.75rem 0;
  padding: 0.6rem 0.85rem;
  border-left: 4px solid var(--accent);
  background: #f8faf9;
  border-radius: 0 8px 8px 0;
}

.automation-content blockquote p {
  margin: 0.25rem 0;
}

.automation-content blockquote p:first-child {
  margin-top: 0;
}

.automation-content pre {
  margin: 0.75rem 0;
  padding: 0.85rem 1rem;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.45;
}

.automation-content pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-family: "IBM Plex Mono", "Consolas", monospace;
}

.automation-content ul {
  margin: 0.5rem 0 0.5rem 1.25rem;
  padding: 0;
}

.automation-content li {
  margin-bottom: 0.25rem;
}

.automation-content p {
  margin: 0.4rem 0;
}

.automation-content br {
  display: block;
  content: "";
  margin-top: 0.35rem;
}

.artifact header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.card-grid {
  display: grid;
  gap: 0.6rem;
}

.testcase-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem;
  background: #fcfcfc;
}

.care {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.care section {
  border: 1px dashed var(--border);
  padding: 0.4rem;
  border-radius: 8px;
  font-size: 0.85rem;
}

/* Test data table: human-readable layout */
.testdata-wrap {
  overflow-x: auto;
  margin-top: 0.5rem;
}

.testdata-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.testdata-table thead {
  background: var(--accent);
  color: #fff;
}

.testdata-table th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.testdata-table tbody tr {
  border-bottom: 1px solid var(--border);
}

.testdata-table tbody tr:nth-child(even) {
  background: #fafafa;
}

.testdata-table tbody tr:hover {
  background: #f4f4f2;
}

.testdata-table td {
  padding: 0.55rem 0.75rem;
  vertical-align: top;
}

.testdata-table .col-id {
  font-weight: 500;
  color: var(--accent);
  white-space: nowrap;
}

.testdata-table .col-linked {
  font-size: 0.85em;
  color: var(--muted);
}

.testdata-table .col-value {
  font-family: "IBM Plex Mono", "Consolas", monospace;
  font-size: 0.88em;
  max-width: 14rem;
  word-break: break-word;
}

.testdata-table .col-desc {
  max-width: 20rem;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.testdata-table .col-cat {
  white-space: nowrap;
}

.cat-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.8em;
  font-weight: 500;
}

.cat-badge.cat-valid {
  background: #d1fae5;
  color: #065f46;
}

.cat-badge.cat-boundary {
  background: #fef3c7;
  color: #92400e;
}

.cat-badge.cat-invalid {
  background: #fee2e2;
  color: #991b1b;
}

.cat-badge.cat-critical {
  background: #dbeafe;
  color: #1e40af;
}

.testdata-table .col-title {
  max-width: 16rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.testdata-table .col-actual {
  min-width: 10rem;
}

.testdata-table .col-actual textarea {
  width: 100%;
  min-height: 2.5rem;
  resize: vertical;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: inherit;
}

.composer {
  flex-shrink: 0;
  padding: 0.8rem;
  padding-bottom: max(0.8rem, env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -1px 0 var(--border);
}

#messageInput {
  width: 100%;
  box-sizing: border-box;
  padding: 0.6rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 0.5rem;
  font: inherit;
}

.requirement-upload-toolbar {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.6);
}

.requirement-upload-toolbar--busy {
  opacity: 0.65;
  pointer-events: none;
}

.requirement-upload-hint {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.requirement-upload-btn {
  margin-right: 0.5rem;
}

.requirement-file-input {
  display: none;
}

#messageInput:disabled {
  background: #f5f5f4;
  color: var(--muted);
  cursor: not-allowed;
}

.composer-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
}

button {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

button:disabled {
  background: #f5f5f4;
  color: var(--muted);
  cursor: not-allowed;
  border-color: var(--border);
}

button:disabled:hover {
  border-color: var(--border);
}

.danger {
  border-color: var(--danger);
  color: var(--danger);
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    position: relative;
  }

  .tenant-sidebar-toggle,
  .tenant-header-new-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .tenant-sidebar-close {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(20rem, 88vw);
    max-width: 100%;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    border-right: 1px solid var(--border);
    border-bottom: none;
    box-shadow: 4px 0 24px rgba(28, 25, 23, 0.12);
  }

  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }

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

  .tenant-sidebar-backdrop {
    z-index: 199;
  }

  .care {
    grid-template-columns: 1fr 1fr;
  }

  .composer-actions {
    flex-wrap: wrap;
    justify-content: stretch;
  }

  .composer-actions button {
    min-height: 2.75rem;
    flex: 1 1 auto;
  }
}

@media (max-width: 520px) {
  .thread-header-hint {
    font-size: 0.72rem;
    line-height: 1.35;
  }

  .composer-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .composer-actions button {
    width: 100%;
  }

  .care {
    grid-template-columns: 1fr;
  }

  .msg {
    max-width: 100%;
  }
}

@media (min-width: 901px) {
  .tenant-sidebar-backdrop {
    display: none !important;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html:has(.qh-site--marketing) {
    scroll-behavior: smooth;
  }
}

/* ---------- Public site shell (landing, /login, /manage) ---------- */
.qh-site {
  --site-bg: #fafaf8;
  --site-surface: #ffffff;
  --site-ink: #1c1917;
  --site-muted: #57534e;
  --site-accent: #14b8a6;
  --site-accent-hover: #0d9488;
  --site-border: #e7e5e4;
  /* Sticky header height: must fit tallest logo (marketing 64px) + vertical padding */
  --site-header-h: 5.75rem;
  --site-max: 72rem;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--site-ink);
  background: var(--site-bg);
}

.qh-site a:focus-visible {
  outline: 2px solid var(--site-accent);
  outline-offset: 2px;
}

.qh-site .skip-link {
  position: absolute;
  left: -9999px;
  top: 0.5rem;
  z-index: 200;
  padding: 0.5rem 1rem;
  background: var(--site-accent);
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
}
.qh-site .skip-link:focus {
  left: 0.5rem;
}

.qh-site .site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  box-sizing: border-box;
  min-height: var(--site-header-h);
  padding-block: 0.875rem;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(231, 229, 228, 0.7);
  background: rgba(250, 250, 248, 0.92);
  backdrop-filter: blur(10px);
}

.qh-site--marketing {
  --site-header-h: 6.25rem;
}

/* Marketing landing: layered background so white cards read as “floating” surfaces */
.qh-site.qh-site--marketing {
  --site-bg: #f0f3f2;
  /* Viewport / shell gutters (header, main, footer) */
  --site-gutter: 1.75rem;
  /* Extra inset inside sections so banded cards & copy aren’t flush to rounded edges */
  --site-section-inset: clamp(1.1rem, 4.5vw, 1.85rem);
  background: linear-gradient(180deg, #f6f8f7 0%, #eef1f0 38%, #e8eceb 100%);
}

@media (min-width: 640px) {
  .qh-site.qh-site--marketing {
    --site-gutter: 2rem;
  }
}

@media (min-width: 900px) {
  .qh-site.qh-site--marketing {
    --site-gutter: 2.25rem;
  }
}

.qh-site--marketing .site-header {
  padding-block: 1rem;
}

.qh-site .site-header__inner {
  width: 100%;
  max-width: var(--site-max);
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* Keeps the row to two in-flow flex items (logo | cluster). On small screens the
 * fixed drawer nav is out of flow, so only the hamburger sizes the cluster — avoids
 * WebKit flex + space-between oddities with a third sibling. */
.qh-site .site-header__end {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.qh-site--marketing .site-header__inner {
  padding-left: max(var(--site-gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--site-gutter), env(safe-area-inset-right, 0px));
}

.qh-site .site-logo {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  color: var(--site-ink);
  text-decoration: none;
}
.qh-site .site-logo__img {
  display: block;
  height: 48px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}
.qh-site--marketing .site-logo__img {
  height: 64px;
}
.qh-site .site-logo:hover {
  color: var(--site-accent);
}

.qh-site .nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--site-border);
  border-radius: 8px;
  background: var(--site-surface);
  cursor: pointer;
  color: var(--site-ink);
}
.qh-site .nav-toggle__bar {
  display: block;
  width: 1.25rem;
  height: 2px;
  background: currentColor;
  position: relative;
  box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
}

.qh-site .site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.25rem;
}

.qh-site .site-nav a {
  color: var(--site-muted);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
}
.qh-site .site-nav a:hover {
  color: var(--site-accent);
}

.qh-site .site-nav a.nav-cta {
  color: var(--site-accent);
}

.qh-site .site-nav a.nav-active {
  color: var(--site-ink);
  font-weight: 600;
}

.qh-site .site-nav__user {
  color: var(--site-muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.qh-site .site-nav .btn--nav-signout {
  margin-left: 0.25rem;
}

/* Manage / operator: compact header nav */
.qh-site .site-nav--operator {
  justify-content: flex-end;
}
.qh-site .site-nav--operator .site-nav__public {
  color: var(--site-muted);
}
.qh-site .site-nav--operator .site-nav__public:hover {
  color: var(--site-accent);
}
.qh-site-dashboard-section {
  margin-bottom: 1.25rem;
}
.qh-site-dashboard-section-title {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 600;
}
.qh-site-dashboard-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.qh-site-dashboard-section-head .qh-site-dashboard-section-title {
  margin-bottom: 0;
}

.qh-site .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.15rem;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: 999px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

/* `.btn` sets display; without this, `hidden` on buttons/links does not hide them. */
.qh-site [hidden] {
  display: none !important;
}
.qh-site .btn--primary {
  background: var(--site-accent);
  color: #fff;
  border: 2px solid var(--site-accent);
}
.qh-site .btn--primary:hover {
  background: var(--site-accent-hover);
  border-color: var(--site-accent-hover);
  color: #fff;
}
.qh-site .btn--ghost {
  background: transparent;
  color: var(--site-accent);
  border: 2px solid var(--site-accent);
}
.qh-site .btn--ghost:hover {
  background: rgba(20, 184, 166, 0.1);
}

.qh-site-main {
  max-width: var(--site-max);
  margin: 0 auto;
  padding: 0 1.25rem max(4rem, calc(2.5rem + env(safe-area-inset-bottom, 0px)));
}

/* Home / skip links to #main: clear sticky header (same idea as section anchors) */
.qh-site main#main {
  scroll-margin-top: calc(var(--site-header-h) + 1rem);
}

.qh-site.qh-site--marketing .qh-site-main {
  padding-left: max(var(--site-gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--site-gutter), env(safe-area-inset-right, 0px));
  padding-bottom: max(4rem, calc(2.5rem + env(safe-area-inset-bottom, 0px)));
}

.qh-site-main--narrow {
  max-width: 28rem;
  padding-top: 2rem;
  padding-bottom: max(3rem, calc(1.75rem + env(safe-area-inset-bottom, 0px)));
}

.qh-site-main--wide {
  max-width: 40rem;
  padding-top: 2rem;
  padding-bottom: max(3rem, calc(1.75rem + env(safe-area-inset-bottom, 0px)));
}

.qh-site-kicker {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--site-accent);
  margin: 0 0 0.75rem;
}

.qh-site-page-title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 3vw + 0.5rem, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.qh-site-lead {
  margin: 0 0 1.5rem;
  line-height: 1.6;
  color: var(--site-muted);
  font-size: 0.95rem;
}

.qh-site-main--legal {
  max-width: 42rem;
  padding-top: 2rem;
  padding-bottom: max(3rem, calc(1.75rem + env(safe-area-inset-bottom, 0px)));
}

.legal-doc {
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--site-text, #1a1a1a);
}

.legal-doc h2 {
  margin: 2rem 0 0.75rem;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.legal-doc h2:first-child {
  margin-top: 0;
}

.legal-doc p,
.legal-doc ul {
  margin: 0 0 1rem;
}

.legal-doc ul {
  padding-left: 1.25rem;
}

.legal-doc li {
  margin-bottom: 0.35rem;
}

.legal-doc a {
  color: var(--site-accent);
}

.legal-doc .legal-meta {
  font-size: 0.875rem;
  color: var(--site-muted);
  margin-bottom: 1.5rem;
}

.qh-site-card {
  background: var(--site-surface);
  border: 1px solid var(--site-border);
  border-radius: 12px;
  padding: 1.35rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 2px rgba(28, 25, 23, 0.04);
}

.qh-site-card h2 {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.qh-site-form label {
  display: block;
  margin-top: 0.85rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--site-ink);
}
.qh-site-form label:first-of-type {
  margin-top: 0;
}
.qh-site-form input,
.qh-site-form textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  margin-top: 0.35rem;
  box-sizing: border-box;
  border: 1px solid var(--site-border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--site-ink);
  background: #fff;
}
.qh-site-form textarea {
  min-height: 6rem;
  line-height: 1.5;
  resize: vertical;
}

/* Password field + show/hide (login, manage, accept-invite) */
.qh-password-wrap {
  position: relative;
  margin-top: 0.35rem;
}
.qh-site-form label .qh-password-wrap {
  margin-top: 0.35rem;
}
.qh-password-wrap .qh-password-input {
  width: 100%;
  margin-top: 0;
  padding-right: 2.75rem;
  box-sizing: border-box;
  border: 1px solid var(--site-border, #e7e5e4);
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  padding-left: 0.65rem;
}
.qh-site-form .qh-password-wrap .qh-password-input {
  border-color: var(--site-border);
}
.qh-password-toggle {
  position: absolute;
  right: 0.3rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--site-muted, #57534e);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.qh-password-toggle:hover {
  color: var(--site-accent, #14b8a6);
  background: rgba(20, 184, 166, 0.1);
}
.qh-password-toggle:focus-visible {
  outline: 2px solid var(--site-accent, #14b8a6);
  outline-offset: 2px;
}
.qh-password-toggle__eye {
  align-items: center;
  justify-content: center;
  line-height: 0;
}
/* Slashed eye = password hidden; open eye = password visible */
.qh-password-toggle__eye--open {
  display: none;
}
.qh-password-toggle__eye--off {
  display: flex;
}
.qh-password-toggle--visible .qh-password-toggle__eye--open {
  display: flex;
}
.qh-password-toggle--visible .qh-password-toggle__eye--off {
  display: none;
}

.auth-panel label .qh-password-wrap {
  display: block;
  margin-top: 0.25rem;
}
.auth-panel .qh-password-wrap .qh-password-input {
  border: 1px solid var(--border, #d6d3d1);
  border-radius: 8px;
}

.qh-site-form .btn {
  margin-top: 1.1rem;
  width: 100%;
}

.qh-site-card > .btn {
  margin-top: 0.75rem;
}

.qh-site-msg--error {
  color: #b91c1c;
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

.btn--sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.85rem;
  line-height: 1.15;
}

.qh-site-hr {
  border: none;
  border-top: 1px solid var(--site-border);
  margin: 1.25rem 0;
}

.qh-site-pre {
  margin: 0.75rem 0 0;
  padding: 0.75rem;
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  background: #f5f5f4;
  border: 1px solid var(--site-border);
  border-radius: 8px;
  max-height: 16rem;
  overflow: auto;
}

.qh-site-table-wrap {
  margin-top: 0.75rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--site-border);
  border-radius: 10px;
  background: var(--site-surface);
}

.qh-site-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.qh-site-table th,
.qh-site-table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--site-border);
  vertical-align: top;
}

.qh-site-table th {
  font-weight: 600;
  color: var(--site-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #f5f5f4;
}

.qh-site-table tbody tr:last-child td {
  border-bottom: none;
}

.qh-site-table tbody tr:hover td {
  background: rgba(20, 184, 166, 0.06);
}

.qh-site .site-footer {
  background: #f5f5f4;
  border-top: 1px solid var(--site-border);
  padding: 2.5rem 1.25rem max(2rem, calc(1.25rem + env(safe-area-inset-bottom, 0px)));
  margin-top: auto;
}

.qh-site.qh-site--marketing .site-footer {
  padding-left: max(var(--site-gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--site-gutter), env(safe-area-inset-right, 0px));
}

.qh-site .site-footer__grid {
  max-width: var(--site-max);
  margin: 0 auto;
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .qh-site .site-footer__grid {
    grid-template-columns: 2fr 1fr 1fr;
  }
}

.qh-site .site-footer h3 {
  margin: 0 0 0.75rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--site-muted);
}
.qh-site .site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.qh-site .site-footer li {
  margin-bottom: 0.5rem;
}
.qh-site .site-footer a {
  color: var(--site-ink);
  text-decoration: none;
  font-size: 0.9rem;
}
.qh-site .site-footer a:hover {
  color: var(--site-accent);
}

.qh-site .site-footer__bottom {
  max-width: var(--site-max);
  margin: 2rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--site-border);
  font-size: 0.85rem;
  color: var(--site-muted);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  align-items: flex-start;
}

.qh-site .site-footer__parent {
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--site-muted);
  opacity: 0.92;
}

.qh-site--marketing .section-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--site-accent);
  margin: 0 0 0.5rem;
}

.qh-site--marketing .hero {
  position: relative;
  padding: 2.5rem var(--site-section-inset) 3rem;
  border-bottom: 1px solid rgba(231, 229, 228, 0.55);
  background:
    radial-gradient(ellipse 70% 55% at 92% 18%, rgba(20, 184, 166, 0.14), transparent 58%),
    radial-gradient(ellipse 55% 45% at 8% 88%, rgba(30, 58, 138, 0.08), transparent 55%);
}
@media (min-width: 640px) {
  .qh-site--marketing .hero {
    padding: 3.5rem var(--site-section-inset) 4rem;
  }
}

/* Hero aside: stacked below copy on small screens; second column on large */
.qh-site--marketing .hero__accent {
  margin-top: 1.75rem;
  border-radius: 16px;
  border: 1px solid rgba(231, 229, 228, 0.85);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.72) 100%),
    linear-gradient(135deg, rgba(20, 184, 166, 0.16) 0%, rgba(30, 58, 138, 0.1) 100%);
  box-shadow: 0 4px 24px rgba(28, 25, 23, 0.07), 0 1px 3px rgba(28, 25, 23, 0.04);
}

.qh-site--marketing .hero__accent-inner {
  padding: 1.1rem 1.25rem 1.2rem;
}

.qh-site--marketing .hero__accent-kicker {
  margin: 0 0 0.85rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--site-accent);
}

.qh-site--marketing .hero__accent-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.qh-site--marketing .hero__accent-list li {
  position: relative;
  padding-left: 1.15rem;
  font-size: 0.94rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--site-ink);
}

.qh-site--marketing .hero__accent-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--site-accent);
}

@media (min-width: 960px) {
  .qh-site--marketing .hero {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 2rem 2.5rem;
    /* Left column stays top-aligned; row height follows the copy column */
    align-items: start;
  }
  .qh-site--marketing .hero__accent {
    margin-top: 0;
    /* Center the card vertically in the hero so space above/below matches */
    align-self: center;
    width: 100%;
    height: fit-content;
  }
}

.qh-site--marketing .hero__copy {
  min-width: 0;
}

.qh-site--marketing .hero h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.75rem, 4vw + 1rem, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  max-width: 20ch;
}

.qh-site--marketing .hero .lead {
  margin: 0 0 1.75rem;
  font-size: clamp(1rem, 1.5vw + 0.85rem, 1.2rem);
  line-height: 1.6;
  color: var(--site-muted);
  max-width: 38rem;
}

.qh-site--marketing .hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
}

.qh-site--marketing section[id] {
  scroll-margin-top: calc(var(--site-header-h) + 1rem);
  padding: 2.75rem var(--site-section-inset);
  border-bottom: 1px solid rgba(231, 229, 228, 0.55);
}
/* Alternate bands: same horizontal extent as hero & siblings (no negative margins) */
.qh-site--marketing section[id]:nth-of-type(even) {
  background: rgba(255, 255, 255, 0.55);
  border-radius: 12px;
  padding: 2.75rem var(--site-section-inset);
  border-bottom: none;
  box-shadow: 0 0 0 1px rgba(231, 229, 228, 0.45);
  margin-bottom: 0.35rem;
}
.qh-site--marketing section[id]:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
}

.qh-site--marketing section h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.25rem, 2vw + 0.5rem, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.qh-site--marketing section p {
  margin: 0 0 1rem;
  line-height: 1.65;
  color: var(--site-muted);
  max-width: 42rem;
}
.qh-site--marketing section p:last-child {
  margin-bottom: 0;
}
.qh-site--marketing #pricing .pricing-cta {
  margin-top: 1.4rem;
  margin-bottom: 0.35rem;
}
.qh-site--marketing #pricing .pricing-cta .btn {
  width: auto;
  min-width: 14rem;
}

.qh-site--marketing .feature-grid {
  display: grid;
  gap: 1.25rem;
  margin-top: 1.5rem;
}
@media (min-width: 640px) {
  .qh-site--marketing .feature-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }
}

.qh-site--marketing .feature-card {
  background: var(--site-surface);
  border: 1px solid rgba(231, 229, 228, 0.95);
  border-radius: 12px;
  padding: 1.25rem 1.35rem;
  box-shadow: 0 1px 2px rgba(28, 25, 23, 0.05), 0 6px 20px rgba(28, 25, 23, 0.06);
}
.qh-site--marketing .feature-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--site-ink);
}
.qh-site--marketing .feature-card p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
}

.qh-site--marketing .demo-box {
  background: var(--site-surface);
  border: 1px solid rgba(231, 229, 228, 0.95);
  border-radius: 12px;
  padding: 1.35rem;
  margin-top: 1rem;
  max-width: 32rem;
  box-shadow: 0 1px 2px rgba(28, 25, 23, 0.05), 0 8px 28px rgba(28, 25, 23, 0.07);
}

/* Demo: center block so wide viewports don’t feel empty on the right */
.qh-site--marketing #demo .section-label,
.qh-site--marketing #demo h2,
.qh-site--marketing #demo > p {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  max-width: 40rem;
}
.qh-site--marketing #demo .demo-box {
  margin-left: auto;
  margin-right: auto;
}
.qh-site--marketing .demo-box label {
  display: block;
  margin-top: 0.85rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--site-ink);
}
.qh-site--marketing .demo-box label:first-of-type {
  margin-top: 0;
}
.qh-site--marketing .demo-box input,
.qh-site--marketing .demo-box textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  margin-top: 0.35rem;
  box-sizing: border-box;
  border: 1px solid var(--site-border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
}
.qh-site--marketing .demo-box button[type="submit"] {
  margin-top: 1.1rem;
}

.qh-site--marketing #demoThanks {
  margin-top: 0.85rem;
  color: #15803d;
  font-size: 0.9rem;
  display: none;
}

@media (max-width: 767px) {
  /*
   * `backdrop-filter` on `.site-header` creates a containing block for `position: fixed`
   * children in supporting browsers, so the drawer was sized/clipped to the header strip
   * and only the first link appeared. Disable backdrop blur on small screens so the menu
   * is positioned against the viewport.
   */
  .qh-site .site-header {
    backdrop-filter: none;
    background: rgba(250, 250, 248, 0.98);
  }

  .qh-site .nav-toggle {
    display: flex;
  }

  .qh-site .site-nav {
    position: fixed;
    top: var(--site-header-h);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 0;
    padding: 1rem 1.25rem 2rem;
    padding-bottom: max(2rem, env(safe-area-inset-bottom, 0px));
    background: var(--site-bg);
    border-top: 1px solid var(--site-border);
    transform: translateX(100%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.2s ease, visibility 0.2s;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .qh-site .site-nav.is-open {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }

  .qh-site .site-nav a {
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--site-border);
    font-size: 1.05rem;
  }

  .qh-site .site-nav .btn {
    margin-top: 0.75rem;
    justify-content: center;
  }

  .qh-site .site-header__end {
    flex-wrap: nowrap;
    gap: 0;
  }
}

.qh-site--stack {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  /* iOS Safari: min-height chain; fill-available helps when vh/dvh disagree with the visible window */
  min-height: -webkit-fill-available;
}
.qh-site--stack > .qh-site-main {
  flex: 1 0 auto;
}
.qh-site--stack .site-footer {
  margin-top: auto;
}

/* My Account overlay */
.account-view {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  overflow: auto;
  padding: 1rem 1.25rem 2rem;
}
.account-view__panel {
  max-width: 42rem;
  margin: 0 auto;
}
.account-view__head {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.account-back-btn {
  align-self: flex-start;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
  color: var(--text);
}
.account-view__title {
  margin: 0;
  font-size: 1.35rem;
}
.account-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}
.account-section h3,
.account-section h4 {
  margin: 0 0 0.6rem;
  font-size: 1.05rem;
}
/* Labels outside .account-form (e.g. GitHub repo fields) must stack as blocks so
   multi-line fields like exclude patterns don’t sit inline with the previous row. */
.account-section > label:not(.account-check) {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.6rem;
  font-size: 0.9rem;
}
.account-email {
  margin: 0;
  font-weight: 600;
}
.account-muted,
.account-hint {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0.25rem 0 0.75rem;
}
.account-hint--warn {
  color: #b45309;
  font-weight: 600;
}
.account-usage-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #ececec;
  overflow: hidden;
  margin: 0.2rem 0 0.35rem;
}
.account-usage-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #14b8a6, #22c55e);
}
.account-list {
  margin: 0 0 1rem;
  padding-left: 1.1rem;
}
.account-trust-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f6f6f4;
  font-size: 0.75rem;
}
.account-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 28rem;
}
.account-form label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.9rem;
}
.account-form input,
.account-form select {
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}
.account-check {
  flex-direction: row !important;
  align-items: center;
  gap: 0.4rem !important;
}
.account-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.account-table th,
.account-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.4rem 0.35rem;
  text-align: left;
  vertical-align: middle;
}
.account-role-sel {
  min-width: 8rem;
}
.account-sm-btn,
.account-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  font: inherit;
  cursor: pointer;
}
.account-sm-btn--danger {
  color: #b91c1c;
  border-color: #fca5a5;
}
.account-sm-btn--danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.account-llm-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.35rem;
}
.account-llm-meta {
  flex: 1;
  min-width: 12rem;
}
.account-llm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.account-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.account-modal-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  max-width: 24rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}
.account-modal-title {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}
.account-modal-text {
  margin: 0 0 1rem;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.45;
}
.account-modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.account-modal-box--wide {
  max-width: 28rem;
  width: 100%;
  max-height: min(90vh, 36rem);
  overflow: auto;
}

.billing-plan-picker.billing-plan-picker,
.billing-plan-picker.account-modal-box--wide {
  max-width: 34rem;
}

.billing-plan-picker-overlay {
  z-index: 10020;
}
.billing-plan-picker__hint {
  margin-top: 0;
  font-size: 0.88rem;
}
.billing-plan-picker__list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.billing-plan-picker__row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg, rgba(0, 0, 0, 0.02));
}
.billing-plan-picker__main {
  flex: 1;
  min-width: 0;
}
.billing-plan-picker__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.6rem;
}
.billing-plan-picker__plan-name {
  font-size: 1.05rem;
  font-weight: 700;
}
.billing-plan-picker__price-line {
  margin-top: 0.35rem;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.billing-plan-picker__per {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  margin-left: 0.15rem;
}
.billing-plan-picker__badge {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 4px;
  background: var(--border);
  color: var(--muted);
}
.billing-plan-picker__bullets {
  margin: 0.55rem 0 0;
  padding-left: 1.2rem;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.5;
}
.billing-plan-picker__bullets li {
  margin: 0.2rem 0;
}
.billing-plan-picker__action {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  padding-left: 0.25rem;
}
.billing-plan-picker__choose {
  white-space: nowrap;
  min-width: 7.5rem;
}

@media (max-width: 520px) {
  .billing-plan-picker__row {
    flex-direction: column;
    align-items: stretch;
  }
  .billing-plan-picker__action {
    align-self: stretch;
    padding-left: 0;
    padding-top: 0.35rem;
    justify-content: stretch;
  }
  .billing-plan-picker__choose {
    width: 100%;
    min-width: 0;
  }
}

/* Generate-from-codebase confirmation (in-app modal) */
.codebase-generate-confirm-overlay {
  z-index: 10050;
}
.codebase-generate-confirm .codebase-confirm-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 0.75rem;
  margin: 0 0 1rem;
  font-size: 0.9rem;
}
.codebase-generate-confirm .codebase-confirm-dl dt {
  color: var(--muted);
  font-weight: 600;
}
.codebase-generate-confirm .codebase-confirm-dl dd {
  margin: 0;
  word-break: break-word;
}
.codebase-source-wrap {
  margin-bottom: 0.75rem;
}
.codebase-source-wrap .account-check {
  display: block;
  margin: 0.35rem 0;
}
.codebase-scope-wrap {
  margin-top: 0.45rem;
  padding-left: 1.35rem;
}
.codebase-local-folder-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem;
  margin: 0 0 0.75rem;
  background: #f8fafc;
}
.codebase-local-folder-wrap .account-sm-btn {
  margin-right: 0.5rem;
}
.codebase-preview-wrap {
  margin-bottom: 0.75rem;
}
.codebase-local-files {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  margin-bottom: 0.75rem;
}
.codebase-local-files-list {
  max-height: 14rem;
  overflow: auto;
  border-top: 1px solid var(--border);
  padding-top: 0.35rem;
}
.codebase-local-files-list .account-check,
.codebase-option {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  margin: 0.2rem 0;
}
.codebase-multiselect {
  position: relative;
}
.codebase-multiselect__control {
  width: 100%;
  min-height: 2.3rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 0.4rem 0.55rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: pointer;
}
.codebase-multiselect__chips {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  flex: 1 1 auto;
  text-align: left;
  max-height: 12rem;
  overflow: auto;
}
.codebase-multiselect__placeholder {
  color: var(--muted);
}
.codebase-multiselect__caret {
  color: var(--muted);
}
.codebase-multiselect__menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 2;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
}
.codebase-option {
  margin: 0.25rem 0;
}
.codebase-option--all {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.35rem;
  margin-bottom: 0.35rem;
}
.codebase-option--disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.codebase-scope-label {
  margin: 0.2rem 0;
  font-size: 0.9rem;
  color: var(--text, inherit);
}
.codebase-select-hint {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent, #6366f1);
  border-radius: 6px;
  background: #f8fafc;
  padding: 0.5rem 0.65rem;
  margin: 0.4rem 0 0.6rem;
  line-height: 1.4;
}
.codebase-multiselect__search {
  margin-bottom: 0.4rem;
}
.codebase-files-search {
  width: 100%;
  box-sizing: border-box;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
}
.codebase-multiselect__counter {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
  padding-left: 0.1rem;
}
.codebase-files-empty,
.codebase-files-truncated {
  font-size: 0.8rem;
  margin: 0.3rem 0;
}
.codebase-ext-group {
  margin-bottom: 0.45rem;
}
.codebase-ext-group__title {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0.2rem 0 0.25rem;
  padding-left: 0.1rem;
}
.codebase-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  background: #f8fafc;
  max-width: 100%;
}
.codebase-chip code {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 26rem;
}
.codebase-chip__remove {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: 0;
}
.codebase-excluded-preview {
  margin: 0.25rem 0 0;
  max-height: 8rem;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 0.82rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem;
}

/* Tenant app: generic message modal (errors / notices; replaces window.alert) */
.tenant-message-modal-overlay {
  z-index: 10050;
}
.tenant-message-modal--error .tenant-message-modal__title {
  color: #b91c1c;
}
.tenant-message-modal__body {
  margin-bottom: 0.5rem;
}

.tenant-banner-host {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10080;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(34rem, calc(100vw - 2rem));
}
.tenant-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}
.tenant-banner--success {
  background: #eaf7ee;
  border-color: #b7e2c2;
  color: #1f5c2f;
}
.tenant-banner--info {
  background: #e8f2fa;
  border-color: #bad4eb;
  color: #144261;
}
.tenant-banner--warning {
  background: #fff8e8;
  border-color: #f1dfa8;
  color: #6a4a0b;
}
.tenant-banner--error {
  background: #fdecec;
  border-color: #efc0c0;
  color: #7d1f1f;
}
.tenant-banner__text {
  flex: 1 1 auto;
  min-width: 0;
}
.tenant-banner__close {
  border: none;
  background: transparent;
  color: inherit;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.tenant-confirm-modal-overlay {
  z-index: 10050;
}
.account-btn--danger {
  background: #b91c1c !important;
  border-color: #b91c1c !important;
  color: #fff !important;
}
.account-btn {
  padding: 0.4rem 0.75rem;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.sidebar-account-btn {
  display: block;
  width: 100%;
  margin-bottom: 0.5rem;
  padding: 0.45rem 0.6rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  cursor: pointer;
  text-align: center;
}
.requirement-codegen-bar {
  margin: 0.75rem 0 1rem;
  padding: 0.75rem 0.85rem;
  background: #f5f5f3;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.requirement-codegen-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.45rem 0.75rem;
  font: inherit;
  cursor: pointer;
  margin-right: 0.5rem;
}
.requirement-codegen-hint {
  display: inline-block;
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 40rem;
  vertical-align: middle;
}
.requirement-codegen-hint--job-busy {
  display: block;
  margin: 0 0 0.5rem;
  font-weight: 600;
  color: var(--site-accent, #333);
}

.qh-blog .blog-hero {
  padding: 2.2rem 0 1rem;
}
.qh-blog .blog-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
  align-items: start;
}
.qh-blog .blog-list {
  display: grid;
  gap: 1rem;
}
.blog-meta {
  color: var(--site-muted);
  font-size: 0.82rem;
  margin: 0 0 0.45rem;
}
.blog-tag {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--site-border);
  border-radius: 999px;
  font-size: 0.75rem;
  margin: 0 0.3rem 0.3rem 0;
  background: #f5f5f4;
}
.blog-content p {
  line-height: 1.75;
  margin: 0 0 1rem;
}
.blog-content h2,
.blog-content h3,
.blog-content h4 {
  margin: 1.35rem 0 0.6rem;
  line-height: 1.35;
}
.blog-content ul,
.blog-content ol {
  margin: 0 0 1rem 1.25rem;
  padding: 0;
}
.blog-content li {
  margin-bottom: 0.35rem;
}
.blog-content pre {
  margin: 1rem 0;
  padding: 0.85rem;
  border-radius: 10px;
  background: #111827;
  color: #e5e7eb;
  overflow-x: auto;
}
.blog-content code {
  font-family: "IBM Plex Mono", "Consolas", monospace;
}
.blog-filters {
  margin: 0 0 1rem;
}
.blog-filter-label {
  margin: 0 0 0.45rem;
  color: var(--site-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.blog-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.blog-filter-chip {
  border: 1px solid var(--site-border);
  border-radius: 999px;
  background: #fff;
  color: var(--site-muted);
  font-size: 0.82rem;
  padding: 0.28rem 0.65rem;
}
.blog-filter-chip.is-active,
.blog-filter-chip:hover {
  border-color: var(--site-accent);
  color: var(--site-accent);
}
.blog-featured {
  margin-bottom: 1rem;
}
.blog-featured-card {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  background: var(--site-surface);
  border: 1px solid var(--site-border);
  border-radius: 14px;
  overflow: hidden;
}
.blog-featured-card__cover {
  min-height: 14rem;
  background: linear-gradient(140deg, #115e59, #14b8a6);
  display: flex;
  align-items: flex-end;
  text-decoration: none;
}
.blog-featured-card__cover span {
  margin: 1rem;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  font-size: 0.76rem;
  padding: 0.2rem 0.5rem;
}
.blog-featured-card__content {
  padding: 1.2rem 1.2rem 1.35rem;
}
.blog-featured-card__content h2 {
  margin: 0 0 0.55rem;
  font-size: clamp(1.2rem, 1.4vw + 0.95rem, 1.65rem);
  line-height: 1.25;
}
.blog-featured-card__content h2 a {
  text-decoration: none;
  color: var(--site-ink);
}
.blog-featured-card__content h2 a:hover {
  color: var(--site-accent);
}
.blog-list--cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}
.blog-card {
  border: 1px solid var(--site-border);
  border-radius: 12px;
  background: #f5f5f4;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.blog-card__cover {
  display: block;
  min-height: 9.5rem;
  background: linear-gradient(145deg, #0f766e, #2dd4bf);
  text-decoration: none;
  position: relative;
}
.blog-card__cover span {
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  color: #fff;
  font-size: 0.72rem;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  padding: 0.15rem 0.45rem;
}
.blog-card__body {
  padding: 0.95rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.blog-card__title {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
  line-height: 1.35;
}
.blog-card__title a {
  text-decoration: none;
  color: var(--site-ink);
}
.blog-card__title a:hover {
  color: var(--site-accent);
}
.blog-card__excerpt {
  margin: 0 0 0.55rem;
  color: var(--site-muted);
  line-height: 1.55;
  font-size: 0.9rem;
  min-height: 4.2rem;
}
.blog-card__tags {
  margin-top: auto;
}
.blog-side-title {
  margin: 0 0 0.7rem;
  font-size: 0.95rem;
}
.blog-recent-item {
  margin: 0 0 0.6rem;
}
.blog-recent-item a {
  color: var(--site-ink);
  text-decoration: none;
  line-height: 1.45;
}
.blog-recent-item a:hover {
  color: var(--site-accent);
}
.blog-post-shell {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(16rem, 1fr);
  gap: 1.25rem;
  align-items: start;
}
.blog-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin: 1.1rem 0 0.9rem;
  color: var(--site-muted);
  font-size: 0.82rem;
}
.blog-breadcrumb a {
  color: var(--site-muted);
  text-decoration: none;
}
.blog-breadcrumb a:hover {
  color: var(--site-accent);
}
#blogBreadcrumbCurrent {
  color: var(--site-ink);
  font-weight: 600;
}
.blog-post-article {
  padding: 1.4rem 1.4rem 1.55rem;
}
.blog-post-article h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.45rem, 1.6vw + 1rem, 2.1rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.blog-post-hero {
  width: 100%;
  max-height: 26rem;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--site-border);
  margin: 0.7rem 0 0.9rem;
  background: #f5f5f4;
}
.blog-post-ad-row {
  margin-top: 1rem;
}
.blog-newsletter-form {
  margin-top: 0.25rem;
}
.blog-newsletter-label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--site-muted);
  font-size: 0.88rem;
}
.blog-newsletter-row {
  display: flex;
  gap: 0.5rem;
}
.blog-newsletter-row input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--site-border);
  border-radius: 8px;
  font-family: inherit;
}
.blog-newsletter-row .btn {
  white-space: nowrap;
}
.blog-newsletter-msg {
  margin: 0.55rem 0 0;
  min-height: 1.1rem;
  color: #15803d;
  font-size: 0.85rem;
}
.blog-admin-post-btn {
  display: block;
  width: 100%;
  text-align: left;
  margin-bottom: 0.5rem;
}
.qh-blog-admin .qh-site-main {
  max-width: 92rem;
}
.qh-blog-admin .site-header__inner,
.qh-blog-admin .site-footer__grid,
.qh-blog-admin .site-footer__bottom {
  max-width: 92rem;
}
.blog-admin-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.blog-admin-topic-row {
  margin-bottom: 0.55rem;
}
.blog-admin-topic-row #draftTopicInput {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--site-border);
  border-radius: 8px;
  font: inherit;
}
.blog-admin-toolbar .blog-admin-msg {
  flex: 1 1 auto;
}
.blog-admin-msg {
  font-size: 0.9rem;
  min-height: 1.2rem;
}
.blog-admin-layout {
  display: grid;
  grid-template-columns: minmax(14rem, 20%) minmax(0, 80%);
  gap: 1rem;
  align-items: start;
}
.blog-admin-panel {
  position: sticky;
  top: calc(var(--site-header-h) + 0.75rem);
}
.blog-admin-panel__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}
.blog-admin-panel__head h2 {
  margin: 0;
}
.blog-admin-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.blog-admin-count {
  font-size: 0.74rem;
  color: var(--site-muted);
  border: 1px solid var(--site-border);
  border-radius: 999px;
  padding: 0.15rem 0.4rem;
}
.blog-admin-filter-pill {
  font: inherit;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.blog-admin-filter-pill:hover {
  border-color: var(--site-accent);
  color: var(--site-ink);
}
.blog-admin-filter-pill.is-active {
  border-color: var(--site-accent);
  background: rgba(20, 184, 166, 0.12);
  color: var(--site-ink);
  font-weight: 600;
}
.blog-admin-empty-filter {
  font-size: 0.85rem;
  color: var(--site-muted);
  margin: 0.35rem 0 0;
  line-height: 1.45;
}
.blog-admin-posts {
  margin-top: 0.85rem;
  max-height: 72vh;
  overflow: auto;
}
.blog-admin-post-btn {
  border: 1px solid var(--site-border);
  border-radius: 10px;
  background: #fff;
  padding: 0.55rem 0.65rem;
}
.blog-admin-post-btn.is-active {
  border-color: var(--site-accent);
  background: rgba(20, 184, 166, 0.08);
}
.blog-admin-post-btn__title {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--site-ink);
  margin-bottom: 0.2rem;
}
.blog-admin-post-btn__meta {
  display: block;
  font-size: 0.78rem;
  color: var(--site-muted);
}
.blog-admin-post-btn__meta--image {
  margin-top: 0.18rem;
}
.blog-image-status {
  display: inline-block;
  border-radius: 999px;
  padding: 0.05rem 0.4rem;
  font-size: 0.72rem;
  border: 1px solid var(--site-border);
  color: var(--site-muted);
  background: #fff;
}
.blog-image-status--generated {
  border-color: #86efac;
  color: #166534;
  background: #f0fdf4;
}
.blog-image-status--stock-fallback {
  border-color: #fde68a;
  color: #92400e;
  background: #fffbeb;
}
.blog-image-status--local-fallback,
.blog-image-status--none {
  border-color: #fecaca;
  color: #991b1b;
  background: #fef2f2;
}
.blog-admin-editor h2 {
  margin: 0;
}
.blog-admin-editor-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin: 0 0 0.8rem;
}
.blog-admin-editor-head .blog-admin-msg {
  text-align: right;
  font-size: 0.82rem;
}
.blog-admin-form {
  display: grid;
  gap: 0.75rem;
}
.blog-admin-form label {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  line-height: 1.25;
}
.blog-admin-form input,
.blog-admin-form select,
.blog-admin-form textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.blog-admin-form input,
.blog-admin-form select {
  min-height: 2.75rem;
  padding: 0.5rem 0.65rem;
  font: inherit;
}
.blog-admin-form select {
  line-height: 1.2;
  -webkit-appearance: none;
  appearance: none;
  padding-right: 2rem;
  background-color: #fff;
  background-image: linear-gradient(45deg, transparent 50%, #6b7280 50%), linear-gradient(135deg, #6b7280 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(50% - 3px), calc(100% - 11px) calc(50% - 3px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.blog-admin-form textarea {
  resize: vertical;
}
.blog-admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  align-items: start;
}
.blog-admin-status-field {
  max-width: 24rem;
}
.blog-admin-status-field select {
  width: 100%;
}
.blog-admin-schedule-field {
  width: 100%;
}
.blog-admin-image-preview {
  border: 1px solid var(--site-border);
  border-radius: 10px;
  background: #fafaf9;
  padding: 0.6rem;
}
.blog-admin-helper-text {
  margin: -0.2rem 0 0.1rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--site-muted);
}
.blog-admin-image-preview__label {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  color: var(--site-muted);
}
.blog-admin-image-preview img {
  width: 100%;
  max-height: 15rem;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--site-border);
  background: #f5f5f4;
}
.blog-admin-content {
  min-height: 28rem;
  font-family: "IBM Plex Mono", "Consolas", monospace;
  line-height: 1.5;
}
.blog-admin-submit-row {
  margin-top: 1rem;
}

/* Phones: cap markdown editor height so “Save Post” stays reachable; scroll inside the field */
@media (max-width: 767px) {
  .blog-admin-content {
    min-height: 11rem;
    max-height: min(24rem, 52vh);
    max-height: min(24rem, 52dvh);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .blog-admin-posts {
    max-height: min(40vh, 16rem);
    max-height: min(40dvh, 16rem);
  }
}

/* Narrow phones (~430px wide): tighter caps + svh for URL-bar chrome; sticky primary actions */
@media (max-width: 480px) {
  /* Blog admin: don’t let flex “fill” behavior fight a long form — main sizes to content */
  .qh-site.qh-blog-admin.qh-site--stack > .qh-site-main {
    flex: 0 0 auto;
    min-width: 0;
  }

  .blog-admin-content {
    max-height: min(14rem, 40vh);
    max-height: min(14rem, 40dvh);
    max-height: min(14rem, 40svh);
  }

  .blog-admin-posts {
    max-height: min(28vh, 11rem);
    max-height: min(28dvh, 11rem);
    max-height: min(28svh, 11rem);
  }

  .qh-blog-admin .blog-admin-submit-row {
    position: sticky;
    bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
    z-index: 4;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    background: var(--site-surface);
    border-top: 1px solid var(--site-border);
    box-shadow: 0 -10px 24px rgba(250, 250, 248, 0.95);
  }

  /* Marketing landing: keep demo submit reachable above home indicator */
  .qh-site--marketing #demo .demo-box button[type="submit"] {
    position: sticky;
    bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
    z-index: 3;
    box-shadow: 0 6px 20px rgba(250, 250, 248, 0.92);
  }

  .qh-site .site-footer__bottom {
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
  }
}
@media (max-width: 1060px) {
  .blog-list--cards {
    grid-template-columns: 1fr;
  }
  .blog-featured-card {
    grid-template-columns: 1fr;
  }
  .blog-featured-card__cover {
    min-height: 11rem;
  }
}
@media (max-width: 900px) {
  .qh-blog .blog-layout {
    grid-template-columns: 1fr;
  }
  .blog-admin-layout {
    grid-template-columns: 1fr;
  }
  .blog-admin-panel {
    position: static;
  }
  .blog-admin-grid {
    grid-template-columns: 1fr;
  }
  .blog-admin-status-field {
    max-width: none;
  }
  .blog-post-shell {
    grid-template-columns: 1fr;
  }
  .blog-newsletter-row {
    flex-direction: column;
  }
  .blog-newsletter-row .btn {
    width: 100%;
  }
}

/* Tenant app: QA agent modal */
.tenant-header-agent-btn {
  margin-right: 0.5rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  border-radius: 6px;
  border: 1px solid var(--site-border, #ddd);
  background: var(--site-surface, #fff);
  cursor: pointer;
}
.tenant-header-agent-btn:hover {
  border-color: var(--site-accent, #333);
}
.tenant-header-agent-btn--busy {
  border-color: var(--site-accent, #333);
  opacity: 0.92;
  cursor: default;
}
.tenant-header-agent-btn--busy:hover {
  border-color: var(--site-accent, #333);
}

.qa-agent-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.qa-agent-modal[hidden] {
  display: none !important;
}
.qa-agent-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 15, 20, 0.45);
}
.qa-agent-modal__panel {
  position: relative;
  z-index: 1;
  width: min(32rem, 100%);
  max-height: min(85vh, 32rem);
  overflow: auto;
  background: var(--site-surface, #fff);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  border: 1px solid var(--site-border, #e5e5e5);
}
.qa-agent-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--site-border, #eee);
}
.qa-agent-modal__head h2 {
  margin: 0;
  font-size: 1.1rem;
}
.qa-agent-modal__close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #666;
}
.qa-agent-modal__body {
  padding: 1rem;
  font-size: 0.92rem;
  line-height: 1.45;
}
.qa-agent-modal__body .qa-agent-steps {
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  margin: 0.75rem 0;
  padding-left: 1rem;
}
.qa-agent-modal__body .qa-agent-q {
  margin: 0.5rem 0 0.25rem;
  font-weight: 600;
}
.qa-agent-modal__body input[type="text"] {
  width: 100%;
  padding: 0.4rem 0.5rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--site-border, #ccc);
  border-radius: 6px;
}
.qa-agent-modal__body input[type="number"] {
  width: 100%;
  max-width: 8rem;
  padding: 0.4rem 0.5rem;
  margin-top: 0.2rem;
  border: 1px solid var(--site-border, #ccc);
  border-radius: 6px;
}
.qa-agent-intro-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin: 0.75rem 0;
}
.qa-agent-intro-options label {
  display: flex;
  flex-direction: column;
  font-size: 0.88rem;
  font-weight: 600;
}
.qa-agent-intro-hint {
  margin: 0 0 0.5rem;
}
.qa-agent-suggestion {
  margin: 0 0 0.5rem;
  padding: 0.4rem 0.6rem;
  border-left: 3px solid var(--site-accent, #2563eb);
  background: rgba(37, 99, 235, 0.06);
  border-radius: 4px;
  font-weight: 600;
}
.qa-agent-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.qa-agent-modal__actions button {
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
}
