:root {
  color-scheme: light;
  --bg: #ffffff;
  --panel: #ffffff;
  --border: #e5e7eb;
  --text: #111111;
  --muted: #6f7177;
  --accent: #637675;
  --accent-dark: #506261;
  --secondary: #806265;
  --secondary-light: #f5f0f1;
  --danger: #b42318;
  --shadow: 0 3px 12px rgb(15 23 42 / 8%);
  --app-gutter: 32px;
  --app-container: 1180px;
  --app-wide-container: 1440px;
  --dashboard-container: 95vw;
  --app-readable: 980px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #fbfbfa;
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

.brand {
  font-weight: 700;
  text-decoration: none;
}

.app-main {
  min-height: 100vh;
  padding: 28px 0 48px;
  background: #fbfbfa;
}

.app-main-flush {
  padding: 0;
}

.app-container {
  width: min(var(--app-container), calc(100% - var(--app-gutter)));
  margin-inline: auto;
}

.app-container-wide {
  width: min(var(--app-wide-container), calc(100% - var(--app-gutter)));
  margin-inline: auto;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}

.icon-button:hover {
  border-color: var(--border);
  background: #f2f4f7;
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--secondary);
  cursor: pointer;
  font: inherit;
}

.link-button.danger {
  color: var(--danger);
}

.messages {
  max-width: 960px;
  margin: 16px auto 0;
  padding: 0 16px;
}

.message {
  margin: 0 0 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.message.error {
  border-color: #fecdca;
  color: var(--danger);
  background: #fffbfa;
}

.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: calc(100vh - 76px);
  padding: 16px 24px 44px;
  text-align: center;
}

.login-brand {
  display: grid;
  place-items: center;
  min-height: 172px;
  margin-bottom: 8px;
}

.login-logo,
.login-logo-fallback {
  width: 268px;
  height: 268px;
}

.login-logo {
  object-fit: contain;
}

.login-logo-fallback {
  display: grid;
  place-items: center;
  border: 12px solid #262424;
  border-radius: 36px;
  color: #262424;
  font-size: 5rem;
  font-weight: 900;
  line-height: 1;
}

.login-copy {
  max-width: 780px;
}

.login-copy h1 {
  margin: 0;
  color: #637675;
  font-size: clamp(2.2rem, 5vw, 3.35rem);
  font-weight: 800;
  line-height: 1.08;
}

.login-tagline {
  margin: 6px 0 0;
  color: var(--accent);
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 800;
  line-height: 1.14;
}

.login-subtitle {
  max-width: 720px;
  margin: 72px auto 36px;
  color: #111111;
  font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.35;
}

.login-action {
  min-width: 220px;
  min-height: 48px;
}

.chat-shell {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  min-height: 100vh;
}

.app-rail {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  height: 100vh;
  padding: 32px 0 22px;
  border-right: 1px solid #f2f3f5;
  background: #ffffff;
}

.rail-form {
  display: contents;
}

.rail-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #111111;
  cursor: pointer;
  text-decoration: none;
}

.rail-button:hover {
  background: #f4f4f5;
}

.rail-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.rail-menu {
  position: relative;
}

.rail-menu summary {
  list-style: none;
}

.rail-menu summary::-webkit-details-marker {
  display: none;
}

.rail-menu .conversation-list {
  position: absolute;
  left: 44px;
  top: -8px;
  z-index: 20;
  width: 260px;
  max-height: 420px;
  padding: 10px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.rail-bottom {
  margin-top: auto;
}

.sidebar {
  display: none;
  padding: 16px;
  border-right: 1px solid var(--border);
  background: var(--panel);
  overflow-y: auto;
}

.conversation-list {
  display: grid;
  gap: 6px;
  margin-top: 16px;
}

.conversation-link {
  display: block;
  padding: 10px 12px;
  overflow: hidden;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-link:hover,
.conversation-link.active {
  background: #f4f4f5;
  color: #111111;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 100vh;
  background: #fbfbfa;
}

.chat-header {
  position: sticky;
  top: 0;
  z-index: 5;
  min-width: 0;
  border-bottom: 1px solid #eceff1;
  background: rgb(251 251 250 / 94%);
  backdrop-filter: blur(10px);
}

.chat-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: var(--app-readable);
  min-width: 0;
  margin-inline: auto;
  padding: 18px 32px;
}

.chat-header-inner > div {
  min-width: 0;
}

.chat-header h1 {
  max-width: min(640px, 60vw);
  margin: 0;
  overflow: hidden;
  color: #111111;
  font-size: 1rem;
  font-weight: 750;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-kicker {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.chat-transcript {
  display: grid;
  align-content: center;
  gap: 18px;
  width: min(var(--app-readable), calc(100% - var(--app-gutter)));
  margin-inline: auto;
  padding: 34px 0 24px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.chat-transcript:has(.chat-message) {
  align-content: start;
}

.welcome-state {
  align-self: center;
  justify-self: center;
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(560px, 100%);
  margin-bottom: 28px;
  text-align: center;
}

.welcome-state h2 {
  margin: 0;
  color: #111111;
  font-size: clamp(1.55rem, 2vw, 2rem);
  line-height: 1.1;
}

.welcome-state p {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.chat-message {
  display: grid;
  gap: 8px;
  width: min(820px, 100%);
  min-width: 0;
  padding: 0;
  border: 1px solid #e6e7eb;
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgb(15 23 42 / 4%);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.chat-message.user {
  justify-self: end;
  border-color: #d9e2df;
  background: #eef4f2;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 12px 14px 0;
}

.message-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #eef0f2;
  color: #383a40;
  font-size: 0.72rem;
  font-weight: 800;
}

.chat-message.user .message-avatar {
  background: var(--accent);
  color: #ffffff;
}

.message-meta strong {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--muted);
}

.message-body {
  padding: 0 14px 14px 52px;
  line-height: 1.5;
}

.message-body p {
  margin: 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.message-body p + p,
.message-body ul,
.message-body ol,
.message-body pre {
  margin-top: 10px;
}

.message-body pre {
  overflow-x: auto;
  padding: 12px;
  border-radius: 8px;
  background: #101418;
  color: #f8fafc;
}

.message-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 14px 52px;
}

.message-attachments a {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid #d7dddf;
  border-radius: 8px;
  background: #ffffff;
}

.message-attachments img {
  width: 132px;
  height: 92px;
  object-fit: cover;
}

.composer {
  display: grid;
  width: min(770px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 28px;
  background: transparent;
}

.composer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 4px 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

.composer label {
  color: #383a40;
  font-weight: 700;
}

.composer-head span {
  text-align: right;
}

.composer-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font: inherit;
}

.composer-box {
  min-height: 104px;
  padding: 14px;
  border: 1px solid #e6e7eb;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgb(15 23 42 / 9%);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.composer-box:focus-within {
  border-color: #c2d0cd;
  box-shadow: 0 12px 32px rgb(80 98 97 / 14%);
}

.composer-box textarea {
  display: block;
  height: auto;
  min-height: 34px;
  max-height: 220px;
  resize: none;
  border: 0;
  outline: 0;
  padding: 0 4px;
  color: #111111;
  font-size: 1rem;
  line-height: 1.5;
  background: transparent;
}

.composer-box textarea::placeholder {
  color: #737373;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  margin-top: 12px;
}

.composer-file-button,
.composer-mic-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: #383a40;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
}

.composer-file-button {
  padding: 0 12px;
}

.composer-mic-button {
  min-width: 48px;
  padding: 0 10px;
}

.composer-file-button:hover,
.composer-mic-button:hover {
  background: #f4f4f5;
}

.composer-mic-button:disabled,
.composer-file-button:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.58;
}

.composer-mic-button.is-listening {
  border-color: var(--secondary);
  background: var(--secondary);
  color: #ffffff;
}

.composer-file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.send-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.send-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.composer-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.chat-image-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
  margin-top: 10px;
}

.chat-image-preview:empty {
  display: none;
}

.chat-image-preview-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 180px;
  padding: 5px 8px;
  border: 1px solid #d7dddf;
  border-radius: 999px;
  background: #f7f8f8;
  color: #383a40;
  font-size: 0.78rem;
  font-weight: 700;
}

.chat-image-preview-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-image-preview-item button {
  border: 0;
  border-radius: 999px;
  padding: 3px 6px;
  background: #e8eeee;
  color: #383a40;
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
}

.chat-image-preview-item button:hover {
  background: #d9e2e1;
}

.send-button {
  background: var(--accent);
  color: #ffffff;
}

.send-button:hover {
  background: var(--accent-dark);
}

.send-button:disabled,
.composer.is-sending .send-button {
  cursor: wait;
  background: var(--accent);
}

.button-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgb(255 255 255 / 45%);
  border-top-color: #ffffff;
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

.composer.is-sending .send-icon {
  display: none;
}

.composer.is-sending .button-spinner {
  display: inline-block;
}

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

@keyframes dashboard-thinking-pulse {
  70% {
    box-shadow: 0 0 0 9px rgb(96 115 113 / 0%);
  }

  100% {
    box-shadow: 0 0 0 0 rgb(96 115 113 / 0%);
  }
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--secondary);
  border-radius: 8px;
  background: var(--panel);
  color: var(--secondary);
  font: inherit;
  text-decoration: none;
}

.secondary-action:hover {
  background: var(--secondary-light);
}

.primary-action:hover {
  background: var(--accent-dark);
}

.primary-action:disabled {
  background: var(--accent);
  cursor: wait;
}

.primary-action:disabled:hover {
  background: var(--accent);
}

.full-width {
  width: 100%;
}

.empty-state {
  margin: 0;
  color: var(--muted);
}

.memory-panel {
  width: min(var(--app-readable), calc(100% - var(--app-gutter)));
  margin: 0 auto;
}

.memory-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.memory-header h1 {
  margin: 0 0 6px;
  font-size: 1.5rem;
}

.memory-header p {
  margin: 0;
  color: var(--muted);
}

.memory-form {
  display: grid;
  gap: 10px;
}

.memory-form label {
  font-weight: 700;
}

.memory-form textarea {
  min-height: 58vh;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  line-height: 1.5;
}

.memory-actions {
  display: flex;
  justify-content: flex-end;
}

.danger-zone {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.danger-action {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #fecdca;
  border-radius: 8px;
  background: #fffbfa;
  color: var(--danger);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.danger-action:hover {
  background: #fef3f2;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

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

.button.primary:hover {
  background: var(--accent-dark);
}

.button.secondary {
  border: 1px solid var(--border);
  background: #ffffff;
  color: #111111;
}

.button.secondary:hover {
  background: #f4f4f5;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.dashboard-admin-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dashboard-admin-actions form {
  margin: 0;
}

.dashboard-shell,
.dashboard-shell-wide {
  width: min(var(--dashboard-container), calc(100% - var(--app-gutter)));
  margin: 0 auto;
}

.dashboard-create-shell,
.dashboard-build-shell {
  width: min(1840px, calc(100% - var(--app-gutter)));
}

.dashboard-topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.dashboard-topbar h1 {
  margin: 8px 0 0;
  font-size: clamp(1.4rem, 2vw, 1.9rem);
  line-height: 1.15;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.dashboard-draft-section {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
}

.dashboard-draft-section > h2 {
  margin: 0;
  color: #383a40;
  font-size: 1rem;
}

.dashboard-card,
.builder-questions,
.dashboard-builder-form,
.dashboard-runtime,
.empty-state {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.dashboard-card {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
}

.dashboard-card-main {
  min-width: 0;
}

.dashboard-card h2,
.builder-questions h2 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.dashboard-card h2 a {
  text-decoration: none;
}

.dashboard-card p,
.builder-questions p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.dashboard-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dashboard-card-meta span {
  padding: 4px 8px;
  border-radius: 999px;
  background: #f4f4f5;
  color: #383a40;
  font-size: 0.78rem;
  font-weight: 700;
}

.dashboard-card-actions {
  display: grid;
  align-content: center;
  gap: 8px;
  margin-left: auto;
}

.dashboard-card-actions form {
  margin: 0;
}

.dashboard-card-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 104px;
  min-height: 25px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

.dashboard-card-action.edit {
  background: var(--accent);
  color: #ffffff;
}

.dashboard-card-action.delete {
  background: var(--secondary);
  color: #ffffff;
}

.dashboard-card-action:hover {
  filter: brightness(0.94);
}

.dashboard-builder-form,
.builder-questions {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.dashboard-create-form {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 150px);
}

.dashboard-create-layout,
.dashboard-build-layout {
  display: grid;
  grid-template-columns: minmax(320px, 440px) minmax(620px, 1fr);
  align-items: start;
  gap: 20px;
}

.dashboard-create-sidebar,
.dashboard-build-sidebar {
  position: sticky;
  top: 18px;
  min-width: 0;
}

.dashboard-build-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: calc(100vh - 76px);
  gap: 16px;
}

.dashboard-create-form .form-actions {
  margin-top: auto;
}

.dashboard-submit-button {
  position: relative;
  gap: 8px;
  min-width: 150px;
}

.dashboard-builder-form.is-sending .dashboard-submit-button,
.dashboard-edit-composer.is-sending .dashboard-submit-button {
  cursor: wait;
  border-color: transparent;
  background: var(--accent);
  color: #ffffff;
  opacity: 1;
}

.dashboard-builder-form.is-sending .dashboard-submit-label,
.dashboard-edit-composer.is-sending .dashboard-submit-label {
  visibility: hidden;
}

.dashboard-builder-form.is-sending .button-spinner,
.dashboard-edit-composer.is-sending .button-spinner {
  position: absolute;
  top: calc(50% - 9px);
  left: calc(50% - 9px);
  display: inline-block;
}

.builder-questions {
  margin-bottom: 16px;
  border-color: #fedf89;
  background: #fffcf5;
}

.dashboard-builder-form label,
.dashboard-builder-form legend {
  display: grid;
  gap: 7px;
  color: #383a40;
  font-weight: 700;
}

.dashboard-builder-form input[type="text"],
.dashboard-builder-form input:not([type]),
.dashboard-builder-form textarea,
.dashboard-filter-bar input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 11px;
  font: inherit;
}

.dashboard-builder-form fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.schema-explorer {
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 92px);
  padding: 16px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.schema-explorer-header {
  display: grid;
  gap: 10px;
}

.schema-explorer-header h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.schema-explorer-header p,
.schema-table-description,
.schema-column-main p,
.schema-explorer-status,
.schema-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.btn-secondary,
.schema-refresh-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid var(--secondary);
  border-radius: 8px;
  padding: 8px 12px;
  background: #ffffff;
  color: var(--secondary);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.btn-secondary:hover,
.schema-refresh-button:hover {
  background: var(--secondary-light);
}

.btn-secondary:disabled,
.schema-refresh-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.schema-explorer-status {
  padding: 9px 10px;
  border: 1px solid #d9eadf;
  border-radius: 8px;
  background: #f5fbf7;
  color: #24613d;
  font-weight: 700;
}

.schema-search-form,
.schema-search-label {
  display: grid;
  gap: 7px;
}

.schema-search-label {
  color: #383a40;
  font-size: 0.86rem;
  font-weight: 700;
}

.schema-search-label input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 11px;
  font: inherit;
}

.schema-table-list {
  display: grid;
  gap: 8px;
  min-height: 0;
  padding-right: 2px;
}

.schema-explorer-count {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.schema-table-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfbfa;
}

.schema-table-card summary {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

.schema-table-card summary::-webkit-details-marker {
  display: none;
}

.schema-table-name {
  overflow-wrap: anywhere;
  font-weight: 800;
}

.schema-table-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.schema-table-body {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.schema-copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: center;
  gap: 8px;
}

.schema-insert-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  color: var(--accent-dark);
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
}

.schema-insert-button:hover {
  border-color: var(--accent);
  background: #eef3f3;
}

.schema-full-name {
  overflow-wrap: anywhere;
  color: #383a40;
  font-size: 0.78rem;
}

.schema-column-list {
  display: grid;
  gap: 6px;
}

.schema-column-panel {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.schema-load-columns-button {
  width: 100%;
}

.schema-column-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 8px;
  border: 1px solid #edf0f2;
  border-radius: 8px;
  background: #ffffff;
}

.schema-column-main {
  min-width: 0;
}

.schema-column-main code {
  overflow-wrap: anywhere;
  font-weight: 800;
}

.schema-column-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 4px;
}

.schema-column-badges span {
  border-radius: 999px;
  padding: 3px 7px;
  background: #eef3f3;
  color: #415a58;
  font-size: 0.72rem;
  font-weight: 800;
}

.group-grid,
.access-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.access-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.access-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 8px;
}

.access-row select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: #ffffff;
  font: inherit;
}

.access-row-fixed {
  opacity: 0.62;
}

.access-row-fixed .checkbox-row {
  background: #eef3f3;
}

.access-row-fixed input {
  cursor: not-allowed;
}

.access-fixed-permission {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: #eef3f3;
  color: #58706d;
  font-weight: 800;
}

.checkbox-row {
  display: flex !important;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px !important;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafafa;
  font-weight: 600 !important;
}

.checkbox-row small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.dashboard-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dashboard-filter-bar input[type="number"] {
  max-width: 120px;
}

.dashboard-query-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -8px 0 16px;
  color: var(--muted);
  font-size: 0.85rem;
}

.dashboard-query-meta span {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafafa;
}

/* Reusable dashboard design system for generated dashboard templates. */
.hx-dashboard {
  display: grid;
  gap: 18px;
  width: 100%;
  color: #1f2933;
}

.hx-dashboard,
.hx-dashboard * {
  box-sizing: border-box;
}

.hx-dashboard-vertical {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  color: #1f2933;
}

.tier-tabs,
.tier-controls,
.tier-data {
  width: 100%;
  min-width: 0;
}

.tier-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid #d8dee4;
}

.tab-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  margin-bottom: -1px;
  border: 1px solid transparent;
  border-bottom-color: #d8dee4;
  border-radius: 8px 8px 0 0;
  padding: 9px 14px;
  color: #53616f;
  font-size: 0.92rem;
  font-weight: 800;
  text-decoration: none;
}

.tab-link:hover {
  background: #f3f6f6;
  color: #111827;
}

.tab-link.is-active,
.tab-link[aria-current="page"] {
  border-color: #d8dee4;
  border-bottom-color: #ffffff;
  background: #ffffff;
  color: var(--accent-dark);
}

.tier-controls {
  border: 1px solid #d8dee4;
  border-radius: 8px;
  padding: 14px;
  background: #f7f9f9;
}

.controls-form {
  width: 100%;
}

.controls-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 14px 18px;
}

.control-group {
  display: grid;
  gap: 6px;
  min-width: min(220px, 100%);
}

.control-label {
  color: #344054;
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.2;
}

.limit-group {
  width: 136px;
  min-width: 136px;
}

.season-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill-badge {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.pill-badge input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.pill-badge span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid #cbd5df;
  border-radius: 999px;
  padding: 7px 12px;
  background: #ffffff;
  color: #344054;
  font-size: 0.88rem;
  font-weight: 750;
}

.pill-badge input:checked + span {
  border-color: var(--accent);
  background: #eef4f2;
  color: var(--accent-dark);
}

.pill-badge input:focus-visible + span {
  outline: 2px solid rgb(99 118 117 / 28%);
  outline-offset: 2px;
}

.control-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.btn-dashboard {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.btn-dashboard.primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-dashboard.primary:hover {
  background: var(--accent-dark);
}

.btn-dashboard.secondary {
  border-color: #cbd5df;
  background: #ffffff;
  color: #344054;
}

.btn-dashboard.secondary:hover,
.btn-dashboard.link:hover {
  background: #f1f5f5;
}

.btn-dashboard.link {
  border-color: transparent;
  background: transparent;
  color: #344054;
}

.tier-data {
  display: flex;
  flex-direction: column;
}

.hx-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 4px;
}

.hx-header-main {
  min-width: 0;
}

.hx-title {
  margin: 0;
  color: #111827;
  font-size: clamp(1.45rem, 2vw, 2.15rem);
  font-weight: 800;
  line-height: 1.12;
}

.hx-subtitle {
  max-width: 1100px;
  margin: 6px 0 0;
  color: #53616f;
  font-size: 0.98rem;
  line-height: 1.45;
}

.hx-actions,
.hx-toolbar,
.dashboard-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}

.hx-toolbar,
.dashboard-controls {
  width: 100%;
  padding: 14px;
  border: 1px solid #d8dee4;
  border-radius: 8px;
  background: #f7f9f9;
}

.hx-field {
  display: grid;
  gap: 5px;
  min-width: min(220px, 100%);
}

.hx-field--sm {
  min-width: 128px;
}

.hx-field--lg {
  min-width: min(320px, 100%);
}

.hx-label,
.hx-field label,
.dashboard-controls label {
  color: #344054;
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.2;
}

.hx-help {
  color: #64707d;
  font-size: 0.78rem;
  line-height: 1.25;
}

.hx-input,
.hx-select,
.dashboard-controls input,
.dashboard-controls select {
  width: 100%;
  min-height: 38px;
  border: 1px solid #cbd5df;
  border-radius: 8px;
  padding: 8px 10px;
  background: #ffffff;
  color: #111827;
  font: inherit;
}

.hx-input:focus,
.hx-select:focus,
.dashboard-controls input:focus,
.dashboard-controls select:focus {
  outline: 2px solid rgb(99 118 117 / 22%);
  outline-offset: 1px;
  border-color: var(--accent);
}

.hx-check-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 10px 0 0;
}

.hx-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  color: #344054;
  font-size: 0.9rem;
  font-weight: 650;
}

.hx-filter-group {
  width: 100%;
  margin: 2px 0 0;
  border: 1px solid #d8dee4;
  border-radius: 8px;
  padding: 12px 14px 10px;
}

.hx-filter-group legend {
  padding: 0 6px;
  color: #344054;
  font-size: 0.84rem;
  font-weight: 750;
}

.hx-button,
.dashboard-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 14px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 750;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.hx-button:hover,
.dashboard-controls button:hover {
  background: var(--accent-dark);
}

.hx-button--secondary {
  border-color: #cbd5df;
  background: #ffffff;
  color: #344054;
}

.hx-button--secondary:hover {
  background: #f1f5f5;
}

.hx-button--danger {
  background: var(--danger);
}

.hx-button--danger:hover {
  background: #8f1d14;
}

.hx-back-link {
  flex: 0 0 auto;
}

.hx-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid #d8dee4;
}

.hx-tab {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  margin-bottom: -1px;
  border: 1px solid transparent;
  border-bottom-color: #d8dee4;
  border-radius: 8px 8px 0 0;
  padding: 8px 12px;
  color: #53616f;
  font-size: 0.9rem;
  font-weight: 750;
  text-decoration: none;
}

.hx-tab:hover {
  background: #f3f6f6;
  color: #111827;
}

.hx-tab.is-active,
.hx-tab.active,
.hx-tab--active,
.hx-tab[aria-current="page"] {
  border-color: #d8dee4;
  border-bottom-color: #ffffff;
  background: #ffffff;
  color: #111827;
}

.hx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.hx-kpi {
  display: grid;
  gap: 6px;
  min-width: 0;
  border: 1px solid #d8dee4;
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgb(15 23 42 / 4%);
}

.hx-kpi-label {
  color: #64707d;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hx-kpi-value {
  color: #111827;
  font-size: clamp(1.45rem, 2vw, 2rem);
  font-weight: 850;
  line-height: 1.05;
}

.hx-kpi-note {
  color: #64707d;
  font-size: 0.86rem;
  line-height: 1.35;
}

.hx-panel,
.dashboard-panel,
.dashboard-card,
.dashboard-table-card,
.mr-table-card {
  width: 100%;
  max-width: 100%;
  border: 1px solid #d8dee4;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgb(15 23 42 / 5%);
  overflow: hidden;
}

.hx-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid #e5eaf0;
  background: #fbfcfd;
}

.hx-panel-title {
  margin: 0;
  color: #111827;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.25;
}

.hx-panel-body {
  padding: 16px;
}

.hx-panel--table .hx-panel-body {
  padding: 0;
}

.table-cache-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  margin-left: auto;
  white-space: nowrap;
}

.cache-control-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.control-label-sm {
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 700;
}

.hx-input-sm {
  width: 64px;
  padding: 5px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #111827;
  font-size: 0.9rem;
  text-align: center;
}

.btn-dashboard-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #111827;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.btn-dashboard-sm.secondary:hover {
  background: #f8fafc;
}

.btn-dashboard-sm:disabled,
.btn-dashboard-sm[disabled] {
  cursor: progress;
  opacity: 0.68;
}

.cache-countdown-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid #dbe3ea;
  border-radius: 999px;
  background: #f8fafc;
  color: #334155;
  font-size: 0.82rem;
  white-space: nowrap;
}

.hx-table-wrap,
.dashboard-table-frame,
.ds-scroll {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

.hx-table,
.dashboard-table,
.dashboard-runtime table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

.hx-table th,
.hx-table td,
.dashboard-table th,
.dashboard-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5eaf0;
  text-align: left;
  vertical-align: top;
}

.hx-table th,
.dashboard-table th {
  background: #f7f8fa;
  color: #383f47;
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hx-table tbody tr:hover,
.dashboard-table tbody tr:hover {
  background: #fafbfb;
}

.hx-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: #64707d;
  font-size: 0.85rem;
}

.hx-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid #d8dee4;
  border-radius: 8px;
  padding: 4px 8px;
  background: #ffffff;
}

.hx-chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
  gap: 14px;
}

.hx-empty {
  display: grid;
  min-height: 120px;
  place-items: center;
  border: 1px dashed #cbd5df;
  border-radius: 8px;
  padding: 18px;
  background: #fafbfb;
  color: #64707d;
  text-align: center;
}

.hx-muted {
  color: #64707d;
}

.dashboard-runtime {
  padding: 18px;
  overflow-x: auto;
}

.dashboard-runtime .dashboard-container,
.dashboard-runtime .dashboard-panel,
.dashboard-runtime .dashboard-table-card,
.dashboard-runtime .mr-table-card,
.dashboard-runtime .hx-panel--table,
.dashboard-runtime .ds-tablewrap {
  width: 100% !important;
  max-width: 100% !important;
}

.dashboard-runtime .dashboard-table-frame,
.dashboard-runtime .ds-scroll {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto;
}

.dashboard-plotly-slot {
  min-height: 240px;
}

.dashboard-chart-fallback {
  display: grid;
  min-height: 240px;
  place-items: center;
  border: 1px dashed #cbd5d1;
  border-radius: 8px;
  color: #637675;
  background: #f8faf9;
  font-size: 0.9rem;
  text-align: center;
  padding: 1rem;
}

.dashboard-runtime table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
}

.dashboard-runtime th,
.dashboard-runtime td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.dashboard-runtime th {
  background: #f7f8fa;
  color: #383a40;
  font-size: 0.82rem;
  text-transform: uppercase;
}

.dashboard-edit-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(var(--app-container), calc(100% - var(--app-gutter)));
  height: calc(100vh - 76px);
  min-height: 560px;
  margin: 0 auto;
  gap: 16px;
}

#dashboard-edit-stream-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto auto;
  min-height: 0;
  gap: 16px;
}

.dashboard-edit-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.dashboard-edit-header h1 {
  margin: 8px 0 6px;
  font-size: clamp(1.4rem, 2vw, 1.9rem);
  line-height: 1.15;
}

.dashboard-edit-header p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.dashboard-edit-chat,
.dashboard-edit-composer {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.dashboard-edit-chat {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 0;
  padding: 16px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.dashboard-edit-chat *,
.dashboard-thinking-log * {
  overflow-anchor: none;
}

.dashboard-bottom-anchor {
  width: 100%;
  height: 1px;
  clear: both;
  overflow-anchor: auto;
}

.dashboard-edit-message {
  width: min(780px, 100%);
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.dashboard-edit-message.user {
  justify-self: end;
  background: #f4f4f5;
}

.dashboard-edit-message.assistant {
  justify-self: start;
}

.dashboard-edit-message strong {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.82rem;
}

.dashboard-edit-message p {
  margin: 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.dashboard-message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.dashboard-message-attachments span {
  padding: 4px 8px;
  border-radius: 999px;
  background: #ffffff;
  color: #383a40;
  font-size: 0.78rem;
  font-weight: 700;
}

.dashboard-edit-composer {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.dashboard-edit-composer[data-dashboard-edit-composer] {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.dashboard-edit-thinking-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid #dce4e4;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 2px 8px rgb(15 23 42 / 9%);
}

.dashboard-thinking-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dashboard-thinking-header h2 {
  margin: 0;
  color: #20242a;
  font-size: 0.98rem;
  line-height: 1.2;
}

.dashboard-thinking-header p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.dashboard-thinking-pulse {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgb(96 115 113 / 42%);
  animation: dashboard-thinking-pulse 1.5s infinite;
}

.dashboard-thinking-log {
  display: grid;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  padding: 2px;
  scroll-behavior: smooth;
}

.dashboard-thinking-entry {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #e1e6e7;
  border-radius: 8px;
  background: #f7f9f9;
  color: #30363d;
  font-size: 0.86rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.dashboard-live-stream {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #d8e1e2;
  border-radius: 8px;
  background: #0f172a;
  color: #e5eef0;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.dashboard-live-stream code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.prompt-audit-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  margin-top: 10px;
}

.prompt-audit-control details {
  min-width: 0;
}

.prompt-audit-copy {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 0.78rem;
}

.dashboard-thinking-entry span {
  color: #5d6d6c;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.dashboard-thinking-entry.thought {
  border-color: #d8e4e2;
  background: #f3f8f7;
}

.dashboard-thinking-entry.error {
  border-color: #f1c8c8;
  background: #fff5f5;
}

.dashboard-edit-bottom-messages .message {
  margin-bottom: 0;
}

.dashboard-edit-page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.dashboard-edit-composer label {
  color: #383a40;
  font-weight: 700;
}

.dashboard-edit-composer select {
  width: min(420px, 100%);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 11px;
  background: #ffffff;
  color: #383a40;
  font: inherit;
}

.dashboard-field-help {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.dashboard-edit-field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-mic-button {
  min-width: 48px;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: var(--accent);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.dashboard-mic-button:hover {
  filter: brightness(0.94);
}

.dashboard-mic-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.dashboard-mic-button.is-listening {
  background: var(--secondary);
}

.dashboard-edit-composer-box {
  min-height: 120px;
  padding: 14px;
  border: 1px solid #e1e5e7;
  border-radius: 28px;
  background: #ffffff;
  box-shadow: 0 2px 8px rgb(15 23 42 / 9%);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.dashboard-edit-composer-box:focus-within {
  border-color: #c2d0cd;
  box-shadow: 0 4px 14px rgb(80 98 97 / 13%);
}

.dashboard-edit-composer-box textarea {
  display: block;
  min-height: 52px;
  max-height: 220px;
  resize: none;
  border: 0;
  outline: 0;
  padding: 0 8px;
  background: transparent;
  color: #111111;
  font-size: 1rem;
  line-height: 1.5;
}

.dashboard-edit-composer-box textarea::placeholder {
  color: #737373;
}

.dashboard-edit-composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  margin-top: 12px;
}

.dashboard-edit-composer-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dashboard-attachment-button,
.dashboard-send-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}

.dashboard-attachment-button {
  position: relative;
  background: #ffffff;
  color: #383a40;
  font-size: 1.4rem;
  font-weight: 400;
  line-height: 1;
}

.dashboard-attachment-button:hover {
  background: #f4f4f5;
}

.dashboard-attachment-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.dashboard-edit-composer-box .dashboard-mic-button {
  min-width: 48px;
  min-height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: #5f6f6e;
}

.dashboard-edit-composer-box .dashboard-mic-button:hover {
  background: #f4f4f5;
  filter: none;
}

.dashboard-send-button {
  position: relative;
  min-width: 34px;
  border: 0;
  background: var(--accent);
  color: #ffffff;
}

.dashboard-send-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.dashboard-send-button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.dashboard-send-button .button-spinner {
  position: absolute;
}

.dashboard-edit-composer.is-sending .dashboard-send-button .send-icon {
  display: none;
}

.dashboard-edit-composer-box .dashboard-voice-status {
  display: block;
  min-height: 0;
  margin-top: 8px;
  padding: 0 8px;
}

.dashboard-voice-status {
  min-height: 18px;
  color: var(--muted);
  font-size: 0.82rem;
}

.dashboard-attachment-field {
  display: grid;
  gap: 6px;
}

.dashboard-attachment-field input {
  width: 100%;
  padding: 10px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #f7f8f8;
  color: #383a40;
}

.dashboard-pasted-screenshots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dashboard-pasted-screenshot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: #383a40;
  font-size: 0.82rem;
  font-weight: 700;
}

.dashboard-pasted-screenshot span {
  max-width: min(320px, 70vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-pasted-screenshot button {
  border: 0;
  border-radius: 6px;
  padding: 4px 7px;
  background: #eef1f1;
  color: #383a40;
  cursor: pointer;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
}

.dashboard-pasted-screenshot button:hover {
  background: #dde4e3;
}

@media (max-width: 1100px) {
  .dashboard-create-layout,
  .dashboard-build-layout {
    grid-template-columns: 1fr;
  }

  .dashboard-create-sidebar,
  .dashboard-build-sidebar {
    position: static;
  }

  .schema-explorer {
    max-height: none;
  }
}

@media (max-width: 760px) {
  .chat-shell {
    grid-template-columns: 52px minmax(0, 1fr);
    min-height: 100vh;
  }

  .app-rail {
    gap: 14px;
    padding-top: 20px;
  }

  .sidebar {
    display: none;
  }

  .rail-menu .conversation-list {
    width: min(260px, calc(100vw - 76px));
  }

  .chat-panel {
    min-height: 100vh;
  }

  .chat-header-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    width: calc(100% - 24px);
    padding: 14px 16px;
  }

  .chat-header h1 {
    max-width: calc(100vw - 88px);
  }

  .chat-transcript {
    gap: 14px;
    padding: 24px 12px 18px;
  }

  .chat-message {
    border-radius: 10px;
  }

  .message-body {
    padding-left: 14px;
  }

  .message-attachments {
    padding-left: 14px;
  }

  .message-attachments img {
    width: 112px;
    height: 84px;
  }

  .composer {
    width: calc(100% - 20px);
    padding-bottom: 16px;
  }

  .composer-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .composer-head span {
    text-align: left;
  }

  .composer-head-actions {
    align-items: flex-start;
    justify-content: space-between;
    width: 100%;
  }

  .composer-box {
    min-height: 96px;
    border-radius: 14px;
  }

  .composer-hint {
    max-width: 190px;
  }

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

  .dashboard-topbar,
  .dashboard-filter-bar,
  .dashboard-edit-header {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-edit-shell {
    height: 100vh;
    min-height: 0;
  }

  .dashboard-edit-page-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .hx-panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .table-cache-controls {
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
  }

  .dashboard-card {
    flex-direction: column;
  }

  .dashboard-card-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-left: 0;
  }

  .dashboard-card-action {
    width: 100%;
    min-width: 0;
  }

  .control-actions {
    width: 100%;
    margin-left: 0;
  }

  .dashboard-filter-bar input[type="number"] {
    max-width: none;
  }
}
