:root {
  --bg-top: #eaf1ff;
  --bg-bottom: #f8fbff;
  --surface: #ffffff;
  --text: #1b2336;
  --muted: #58637c;
  --primary: #1559d6;
  --primary-strong: #0f45aa;
  --secondary-bg: #edf3ff;
  --secondary-text: #224388;
  --danger: #bd1f2d;
  --border: #d6dff0;
  --success-bg: #e6f7eb;
  --success-text: #196f3d;
  --failed-bg: #fdecec;
  --failed-text: #9d1c1c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background: linear-gradient(165deg, var(--bg-top) 0%, var(--bg-bottom) 60%);
}

body.modal-open {
  overflow: hidden;
}

.login-body .page-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 250px;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, #fdfefe 0%, #f4f7ff 100%);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  font-size: 18px;
  font-weight: 700;
  color: #10377f;
  line-height: 1.3;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.side-nav a {
  text-decoration: none;
  color: var(--secondary-text);
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 8px;
}

.side-nav a:hover {
  background: #eef4ff;
}

.side-nav a.active {
  background: #dfeafe;
  color: #0c3e9c;
  font-weight: 600;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.user-badge {
  font-size: 13px;
  color: var(--muted);
}

.page-container {
  flex: 1;
  padding: 20px;
}

.card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(25, 42, 85, 0.07);
  padding: 20px;
  margin-bottom: 18px;
}

.card.narrow {
  width: min(420px, 100%);
}

h1,
h2,
h3 {
  margin: 0 0 12px;
}

.muted {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: 1fr 1.4fr;
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tile {
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  padding: 14px;
  background: linear-gradient(180deg, #fcfdff 0%, #f5f8ff 100%);
}

.tile:hover {
  border-color: #b2c4ec;
}

.helper-box {
  border: 1px dashed #bfd0f2;
  border-radius: 10px;
  padding: 12px;
  background: #f9fbff;
}

.helper-box h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #183a80;
}

.form-grid {
  display: grid;
  gap: 8px;
}

label {
  font-size: 13px;
  color: var(--muted);
}

label.inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
}

input[type='checkbox'] {
  width: auto;
}

button {
  border: none;
  border-radius: 8px;
  padding: 9px 14px;
  color: #fff;
  background: var(--primary);
  font-size: 14px;
  cursor: pointer;
}

button:hover {
  background: var(--primary-strong);
}

button.secondary {
  background: var(--secondary-bg);
  color: var(--secondary-text);
}

button.danger {
  background: var(--danger);
  color: #fff;
}

button.small {
  padding: 5px 9px;
  font-size: 12px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  padding: 9px 14px;
  color: #fff;
  background: var(--primary);
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}

.button-link:hover {
  background: var(--primary-strong);
}

.button-link.secondary {
  background: var(--secondary-bg);
  color: var(--secondary-text);
}

.button-link.small {
  padding: 5px 9px;
  font-size: 12px;
}

.row {
  display: flex;
  align-items: center;
}

.row.gap {
  gap: 8px;
}

.row.between {
  justify-content: space-between;
}

.row.wrap {
  flex-wrap: wrap;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead {
  background: #f5f8ff;
}

th,
td {
  padding: 8px 10px;
  border-bottom: 1px solid #edf1f8;
  text-align: left;
  vertical-align: top;
}

.status {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.status.success {
  background: var(--success-bg);
  color: var(--success-text);
}

.status.failed {
  background: var(--failed-bg);
  color: var(--failed-text);
}

.detail-box {
  background: #0e1528;
  color: #d8e2ff;
  border-radius: 10px;
  padding: 12px;
  overflow: auto;
  min-height: 220px;
  font-size: 12px;
  white-space: pre-wrap;
  line-height: 1.55;
}

.error {
  color: var(--danger);
  margin-top: 8px;
  font-size: 13px;
}

.hidden {
  display: none;
}

.hidden.form-section {
  display: none;
}

.detail-tabs .tab-btn {
  min-width: 112px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #587096;
  font-weight: 700;
  transition:
    background-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}

.detail-tabs .tab-btn:hover {
  background: rgba(255, 255, 255, 0.72);
  color: #244a8f;
}

.detail-tabs .tab-btn.active {
  background: linear-gradient(180deg, #2360d5 0%, #194ead 100%);
  border-color: #1a4cac;
  color: #fff;
  box-shadow: 0 12px 24px rgba(25, 78, 173, 0.22);
  transform: translateY(-1px);
}

.center-tabs {
  display: inline-flex;
  gap: 8px;
  margin-bottom: 6px;
  padding: 6px;
  border: 1px solid #dbe6fb;
  border-radius: 16px;
  background: linear-gradient(180deg, #f5f8ff 0%, #edf3ff 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.prompt-tabs {
  margin-bottom: 12px;
}

.page-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 0 10px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #315bb1;
  margin-bottom: 8px;
}

.subtle-card {
  background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
}

.compact-box {
  min-height: 120px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.overview-strip {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  margin-bottom: 18px;
}

.overview-tile {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(39, 100, 220, 0.12), transparent 36%),
    linear-gradient(180deg, #ffffff 0%, #f6f9ff 100%);
}

.overview-kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #4468b8;
}

.overview-value {
  margin-top: 10px;
  font-size: 34px;
  font-weight: 700;
  color: #143f97;
}

.overview-desc {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.managed-invoke-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr);
  margin-bottom: 18px;
}

.hero-note-card {
  margin-bottom: 0;
}

.managed-side-note {
  margin-bottom: 0;
  display: grid;
  gap: 12px;
}

.note-list {
  display: grid;
  gap: 10px;
}

.note-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.managed-toolbar-card {
  display: grid;
  gap: 14px;
}

.managed-toolbar-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-note {
  font-size: 12px;
  color: var(--muted);
}

.managed-toolbar-grid {
  grid-template-columns: minmax(260px, 1.4fr) minmax(180px, 1fr) minmax(160px, 0.8fr);
}

.managed-group-card {
  display: grid;
  gap: 14px;
}

.group-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.group-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid #d5e1f9;
  border-radius: 999px;
  background: #f8fbff;
  color: #234787;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease;
}

.group-filter-chip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(35, 72, 151, 0.08);
  font-size: 12px;
}

.group-filter-chip:hover {
  background: #eef4ff;
  border-color: #c7d8fb;
}

.group-filter-chip.active {
  border-color: #123f96;
  background: linear-gradient(180deg, #1d57c4 0%, #123f96 100%);
  color: #fff;
  box-shadow: 0 12px 24px rgba(18, 63, 150, 0.18);
}

.group-filter-chip.active span {
  background: rgba(255, 255, 255, 0.18);
}

.managed-table-card {
  padding: 0;
  overflow: hidden;
}

.managed-table-card__header {
  padding: 20px 20px 12px;
}

.managed-table-card .table-shell {
  padding: 0 12px 12px;
}

.managed-api-table {
  min-width: 1120px;
}

.managed-api-table thead th {
  padding-top: 12px;
  padding-bottom: 12px;
  color: #405071;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.managed-api-table tbody tr {
  transition: background-color 0.18s ease;
}

.managed-api-table tbody tr:hover {
  background: #fbfdff;
}

.id-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #eef4ff;
  color: #224a97;
  font-weight: 700;
}

.api-name-cell,
.api-path-cell,
.provider-cell {
  display: grid;
  gap: 6px;
}

.provider-title {
  font-weight: 600;
  color: var(--text);
}

.mini-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #d3e0f9;
  background: #f8fbff;
  color: #234787;
  font-size: 12px;
  font-weight: 600;
}

.mini-pill--strong {
  background: #123f96;
  border-color: #123f96;
  color: #fff;
}

.mini-pill--group {
  background: #eef5ff;
  border-color: #d2e1fb;
  color: #1f4c98;
}

.api-path-box {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 10px;
  background: #f5f8ff;
  color: #183f87;
}

.version-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 6px 10px;
  border-radius: 10px;
  background: #edf3ff;
  color: #174291;
  font-weight: 700;
}

.action-stack {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.empty-state {
  padding: 44px 16px;
  text-align: center;
}

.empty-state__title {
  font-size: 15px;
  font-weight: 700;
  color: #23417b;
}

.empty-state__desc {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.toolbar-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(220px, 1.4fr) minmax(180px, 1fr) minmax(160px, 0.8fr);
}

.table-shell {
  overflow: auto;
}

.compact-table-shell {
  max-height: 320px;
}

.table-link {
  color: #123f96;
  text-decoration: none;
  font-weight: 600;
}

.table-link:hover {
  text-decoration: underline;
}

.table-subtext {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.editor-page {
  display: grid;
  gap: 18px;
}

.page-hero--editor,
.page-hero--managed {
  align-items: center;
}

.editor-status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex: 1;
}

.workspace-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #d7e2f9;
  background: #f8fbff;
  color: #234987;
  font-size: 12px;
  font-weight: 700;
}

.workspace-pill--soft {
  background: #ffffff;
}

.workspace-pill--success {
  background: #e8f7ec;
  border-color: #ccead5;
  color: #196c3a;
}

.workspace-pill--danger {
  background: #fdeeee;
  border-color: #f3d1d4;
  color: #a12028;
}

.editor-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(360px, 1.08fr) minmax(320px, 0.82fr) minmax(380px, 1.14fr);
  align-items: start;
}

.editor-pane {
  min-height: 100%;
  padding: 0;
  overflow: hidden;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 250, 255, 0.98) 100%);
}

.editor-pane--left,
.editor-pane--right {
  position: sticky;
  top: 20px;
}

.editor-pane--center,
.editor-pane--center .workspace-section,
.editor-pane--center .form-section,
.editor-pane--center .parameter-group,
.editor-pane--center .parameter-item {
  overflow: visible;
}

.workspace-section {
  padding: 18px;
  border-bottom: 1px solid #ebf0fb;
}

.workspace-section:last-child {
  border-bottom: none;
}

@media (min-width: 981px) {
  .editor-page {
    height: calc(100vh - 40px);
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
  }

  .editor-layout {
    height: 100%;
    min-height: 0;
    align-items: stretch;
  }

  .editor-pane {
    height: 100%;
    min-height: 0;
  }

  .editor-pane--left,
  .editor-pane--center {
    position: relative;
    top: auto;
    scrollbar-gutter: stable;
  }

  .editor-pane--left {
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .editor-pane--left .workspace-section {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
  }

  .editor-pane--left #prompt-editor-system:not(.hidden),
  .editor-pane--left #prompt-editor-user:not(.hidden) {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    gap: 8px;
  }

  .editor-pane--left .prompt-markdown-editor,
  .editor-pane--left #helper-user-prompt {
    flex: 1;
    min-height: 0;
  }

  .editor-pane--center {
    overflow: auto;
  }

  .editor-pane--right {
    position: relative;
    top: auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .editor-pane--right .workspace-section {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
  }

  .editor-pane--right .debug-chat-shell {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
  }

  .editor-pane--right .debug-thread {
    flex: 1;
    min-height: 0;
    max-height: none;
  }
}

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

.pane-title-eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4d6eb4;
  margin-bottom: 8px;
}

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

.pane-title-row h2 {
  margin: 0;
  line-height: 1.2;
}

.icon-help-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid #d4def6;
  background: #f8fbff;
  color: #234987;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.icon-help-button:hover {
  background: #edf4ff;
}

.icon-help-button--close {
  width: 32px;
  height: 32px;
  font-size: 18px;
  line-height: 1;
}

.surface-card {
  border: 1px solid #e1e9fb;
  border-radius: 14px;
  padding: 14px;
  background: #ffffff;
}

.surface-card + .surface-card {
  margin-top: 12px;
}

.surface-card--muted {
  background: linear-gradient(180deg, #fbfcff 0%, #f5f8ff 100%);
}

.surface-card h3,
.form-section h3 {
  margin-bottom: 8px;
}

.prompt-actions {
  margin-top: 6px;
}

.auto-sync-tip {
  margin: 4px 0 0;
  font-size: 12px;
}

.prompt-markdown-editor {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  line-height: 1.75;
  tab-size: 2;
  white-space: pre-wrap;
  word-break: break-word;
  background:
    linear-gradient(180deg, #fbfdff 0%, #f4f8ff 100%);
}

.editor-form-grid {
  gap: 14px;
}

.form-section {
  display: grid;
  gap: 8px;
  border: 1px solid #e4ebfb;
  border-radius: 16px;
  padding: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
}

.form-section__header {
  margin-bottom: 2px;
}

.form-row-inline {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.form-row-inline > label:first-child {
  margin: 0;
  text-align: right;
  line-height: 1.4;
}

.form-row-inline--top {
  align-items: start;
}

.form-row-inline--checkbox {
  align-items: center;
}

.parameter-group {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #e7eefc;
  border-radius: 14px;
  background: #fcfdff;
}

.parameter-group + .parameter-group {
  margin-top: 6px;
}

.parameter-group__title {
  font-size: 13px;
  font-weight: 700;
  color: #274787;
}

.parameter-item {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid #e6edfb;
  border-radius: 12px;
  background: #ffffff;
}

.parameter-item--inline {
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.parameter-item--inline label {
  margin: 0;
  line-height: 1.4;
}

.field-label-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
  text-align: right;
}

.field-label-wrap label {
  text-align: right;
  white-space: nowrap;
}

.field-label-wrap--row {
  justify-content: flex-end;
}

.field-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid #c7d8f7;
  background: #f6f9ff;
  color: #2a5ab2;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  z-index: 30;
}

.field-help__tooltip {
  display: none;
}

.field-help__tooltip strong {
  color: #ffffff;
}

.floating-field-tooltip {
  position: fixed;
  left: 0;
  top: 0;
  width: min(280px, calc(100vw - 32px));
  padding: 10px 12px;
  border: 1px solid #d9e5fb;
  border-radius: 12px;
  background: rgba(19, 31, 58, 0.96);
  color: #f8fbff;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  text-align: left;
  box-shadow: 0 16px 32px rgba(17, 31, 61, 0.28);
  pointer-events: none;
  z-index: 4000;
}

.floating-field-tooltip strong {
  color: #ffffff;
}

.parameter-item__hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.parameter-grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.editor-pane--center .parameter-grid,
.editor-pane--center .parameter-grid--two,
.editor-pane--center .inline-form-grid {
  grid-template-columns: 1fr;
}

.param-hint-card {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #dde7fb;
  border-radius: 12px;
  background: #f8fbff;
  color: #38517f;
  font-size: 12px;
  line-height: 1.6;
}

.editor-pane--center textarea,
.editor-pane--center select,
.editor-pane--center input {
  min-width: 0;
}

.editor-pane--center textarea {
  min-height: 64px;
}

.segmented {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f6f9ff;
}

.segment-btn {
  padding: 7px 14px;
  border-radius: 999px;
  background: transparent;
  color: #365288;
}

.segment-btn:hover {
  background: #e8f0ff;
}

.segment-btn.active {
  background: #163f92;
  color: #fff;
}

.inline-form-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.parameter-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.checkbox-line {
  min-height: 42px;
}

.code-editor {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  line-height: 1.6;
  min-height: 180px;
}

.version-section {
  margin-top: 0;
  padding-top: 18px;
}

.version-section--sidebar {
  padding-top: 18px;
}

.invoke-preview {
  margin-bottom: 16px;
  border: 1px solid #dde7fb;
  border-radius: 14px;
  padding: 14px;
  background: linear-gradient(180deg, #fcfdff 0%, #f6f9ff 100%);
}

.invoke-preview-title {
  font-size: 13px;
  font-weight: 600;
  color: #294b8f;
  margin-bottom: 8px;
}

.debug-chat-shell {
  border: 1px solid #dde7fb;
  border-radius: 16px;
  background: linear-gradient(180deg, #fcfdff 0%, #f7faff 100%);
  overflow: hidden;
}

.debug-chat-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid #e7eefb;
}

.debug-chat-title {
  font-size: 14px;
  font-weight: 700;
  color: #223f79;
}

.debug-chat-subtitle {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

.debug-thread {
  display: grid;
  gap: 12px;
  max-height: 520px;
  padding: 16px;
  overflow: auto;
}

.debug-thread__section {
  display: grid;
  gap: 10px;
}

.debug-thread__section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #4b6cae;
}

.debug-thread__section-note {
  margin-top: -4px;
  font-size: 12px;
  color: var(--muted);
}

.debug-thread__stack,
.debug-thread__conversation {
  display: grid;
  gap: 10px;
}

.debug-bubble {
  display: grid;
  gap: 8px;
  max-width: 88%;
  padding: 12px 14px;
  border-radius: 16px;
  line-height: 1.65;
  font-size: 13px;
  box-shadow: 0 12px 24px rgba(25, 42, 85, 0.06);
}

.debug-bubble__meta {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.8;
}

.debug-bubble__content {
  word-break: break-word;
}

.debug-bubble__text {
  white-space: pre-wrap;
}

.debug-bubble__code {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(208, 221, 248, 0.9);
  border-radius: 12px;
  background: rgba(246, 249, 255, 0.88);
  color: #1d2f56;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow: auto;
}

.debug-bubble--assistant .debug-bubble__code,
.debug-bubble--pending .debug-bubble__code {
  background: rgba(244, 248, 255, 0.94);
}

.debug-bubble--user .debug-bubble__code {
  background: rgba(236, 244, 255, 0.95);
  border-color: rgba(188, 209, 248, 0.95);
}

.debug-bubble--error .debug-bubble__code {
  background: rgba(255, 247, 248, 0.98);
  border-color: rgba(243, 209, 212, 0.95);
  color: #7f1d26;
}

.debug-bubble--user {
  justify-self: end;
  border: 1px solid #cfe0ff;
  background: linear-gradient(180deg, #edf4ff 0%, #e4efff 100%);
  color: #123b84;
}

.debug-bubble--assistant {
  justify-self: start;
  border: 1px solid #e0e9fb;
  background: #ffffff;
  color: #1b2336;
}

.debug-bubble--pending {
  justify-self: start;
  border: 1px solid #d8e5ff;
  background: linear-gradient(180deg, #f7faff 0%, #edf4ff 100%);
  color: #214588;
}

.debug-bubble--error {
  justify-self: start;
  border: 1px solid #f3d1d4;
  background: #fff3f4;
  color: #8f1d27;
}

.debug-empty-state {
  padding: 20px 14px;
  border: 1px dashed #d7e3fb;
  border-radius: 14px;
  background: #fbfcff;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.debug-history-list {
  display: grid;
  gap: 10px;
}

.debug-history-item {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 14px;
  border: 1px solid #e1e9fb;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  color: inherit;
  text-align: left;
  cursor: default;
}

.debug-history-item--current {
  border-color: #cddcfd;
  background: linear-gradient(180deg, #ffffff 0%, #eef4ff 100%);
  box-shadow: 0 12px 24px rgba(30, 63, 128, 0.08);
}

.debug-history-item__top,
.debug-history-item__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.debug-history-item__time,
.debug-history-item__footer {
  font-size: 12px;
  color: var(--muted);
}

.debug-history-item__title {
  font-size: 14px;
  font-weight: 700;
  color: #223f79;
}

.debug-history-item__summary {
  font-size: 13px;
  color: #394866;
  line-height: 1.6;
}

.debug-history-item__line {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  font-size: 13px;
  line-height: 1.6;
  color: #394866;
}

.debug-history-item__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6a7fae;
}

.debug-history-item__badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(231, 238, 255, 0.92);
  color: #355392;
  font-size: 11px;
  font-weight: 700;
}

.debug-history-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.debug-composer {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 14px;
  border: 1px solid #dde7fb;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.debug-composer textarea {
  min-height: 96px;
  resize: vertical;
  border-radius: 14px;
}

.debug-composer__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.debug-composer__hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.prompt-tip-box {
  margin-top: 14px;
}

.help-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
}

.help-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(13, 22, 43, 0.52);
  backdrop-filter: blur(4px);
}

.help-modal__panel {
  position: relative;
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  margin: 32px auto;
  padding: 18px;
  border: 1px solid #dbe5fb;
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
  box-shadow: 0 28px 60px rgba(15, 31, 68, 0.22);
  overflow: auto;
}

.help-modal__panel--wide {
  width: min(860px, calc(100vw - 32px));
}

.help-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.help-modal__body {
  display: grid;
  gap: 12px;
}

.app-toast {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 2400;
  min-width: 220px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #d9e6fb;
  background: #ffffff;
  box-shadow: 0 18px 36px rgba(15, 31, 68, 0.18);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.app-toast--success {
  border-color: #cde7d4;
  background: linear-gradient(180deg, #f7fcf8 0%, #eef8f1 100%);
  color: #1d6a3b;
}

.app-toast--error {
  border-color: #f1d1d5;
  background: linear-gradient(180deg, #fff8f8 0%, #fff0f1 100%);
  color: #9a2230;
}

@media (max-width: 1440px) {
  .managed-invoke-grid {
    grid-template-columns: 1fr;
  }

  .editor-layout {
    gap: 12px;
    grid-template-columns: minmax(300px, 1fr) minmax(248px, 0.74fr) minmax(300px, 1.02fr);
  }

  .workspace-section {
    padding: 12px;
  }

  .editor-page {
    gap: 12px;
  }

  .page-hero--editor {
    gap: 12px;
    padding-bottom: 6px;
  }

  .editor-status-strip {
    gap: 8px;
  }

  .workspace-pill {
    min-height: 30px;
    padding: 4px 10px;
    font-size: 11px;
  }

  .hero-actions {
    gap: 8px;
  }

  .editor-page button,
  .editor-page .button-link {
    padding: 7px 11px;
    border-radius: 7px;
    font-size: 13px;
  }

  .editor-page button.small,
  .editor-page .button-link.small {
    padding: 4px 8px;
    font-size: 11px;
  }

  .center-tabs {
    gap: 6px;
    padding: 4px;
    border-radius: 14px;
  }

  .detail-tabs .tab-btn {
    min-width: 92px;
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 12px;
  }

  .pane-title-eyebrow {
    margin-bottom: 6px;
    font-size: 10px;
  }

  .pane-title-row {
    gap: 8px;
  }

  .pane-title-row h2 {
    font-size: 18px;
  }

  .icon-help-button {
    width: 22px;
    height: 22px;
    font-size: 11px;
  }

  .surface-card {
    padding: 12px;
    border-radius: 12px;
  }

  .prompt-markdown-editor {
    font-size: 12px;
    line-height: 1.55;
  }

  .editor-form-grid {
    gap: 10px;
  }

  .form-section {
    gap: 6px;
    padding: 12px;
    border-radius: 14px;
  }

  .form-section h3 {
    margin-bottom: 6px;
    font-size: 16px;
  }

  .form-row-inline {
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 8px;
  }

  .editor-pane--center .form-row-inline {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .form-row-inline > label:first-child,
  .parameter-item--inline label,
  .editor-page label {
    font-size: 12px;
  }

  .editor-page input,
  .editor-page select,
  .editor-page textarea {
    padding: 8px 10px;
    border-radius: 7px;
    font-size: 12px;
  }

  .parameter-group {
    gap: 6px;
    padding: 10px;
    border-radius: 12px;
  }

  .parameter-group__title {
    font-size: 12px;
  }

  .parameter-grid,
  .inline-form-grid {
    gap: 10px;
  }

  .parameter-item {
    gap: 4px;
    padding: 8px 10px;
    border-radius: 10px;
  }

  .parameter-item--inline {
    grid-template-columns: 118px minmax(0, 1fr);
    gap: 8px;
  }

  .editor-pane--center .parameter-item--inline {
    grid-template-columns: 126px minmax(0, 1fr);
  }

  .editor-pane--center .form-row-inline > label:first-child,
  .editor-pane--center .parameter-item--inline label {
    text-align: left;
  }

  .field-label-wrap {
    gap: 4px;
  }

  .editor-pane--center .field-label-wrap,
  .editor-pane--center .field-label-wrap label,
  .editor-pane--center .field-label-wrap--row {
    justify-content: flex-start;
    text-align: left;
  }

  .field-help {
    width: 14px;
    height: 14px;
    font-size: 10px;
  }

  .parameter-item__hint,
  .auto-sync-tip,
  .debug-chat-subtitle,
  .debug-thread__section-title,
  .debug-composer__hint {
    font-size: 11px;
  }

  .debug-chat-header {
    padding: 10px 12px 8px;
  }

  .debug-chat-title {
    font-size: 12px;
  }

  .debug-thread {
    gap: 10px;
    padding: 10px;
  }

  .debug-bubble {
    gap: 6px;
    max-width: 92%;
    padding: 8px 10px;
    border-radius: 12px;
    font-size: 11px;
  }

  .editor-pane--left .pane-header,
  .editor-pane--right .pane-header {
    gap: 10px;
    margin-bottom: 12px;
  }

  .editor-pane--left .pane-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .editor-pane--right .pane-header h2 {
    margin: 0;
    font-size: 18px;
    line-height: 1.2;
  }

  .editor-pane--left .pane-header .row,
  .editor-pane--right .pane-header .row {
    gap: 6px;
    flex-wrap: nowrap;
    align-items: center;
  }

  .editor-pane--left .pane-header > .row {
    justify-self: end;
  }

  .editor-pane--left .icon-help-button {
    width: 20px;
    min-width: 20px;
    height: 20px;
    font-size: 10px;
    flex: 0 0 20px;
  }

  .editor-pane--left #template-modal-open,
  .editor-pane--left #version-modal-open {
    width: 24px;
    min-width: 24px;
    flex-basis: 24px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    letter-spacing: -0.04em;
  }

  .editor-pane--left .segmented {
    padding: 3px;
  }

  .editor-pane--left .segment-btn {
    padding: 4px 7px;
    font-size: 10px;
  }

  .editor-pane--left .center-tabs {
    gap: 4px;
    margin-bottom: 8px;
    padding: 3px;
  }

  .editor-pane--left .detail-tabs .tab-btn {
    min-width: 78px;
    padding: 5px 8px;
    font-size: 11px;
  }

  .editor-pane--left .prompt-actions {
    gap: 6px;
    flex-wrap: nowrap;
  }

  .editor-pane--left .prompt-actions button {
    padding: 4px 8px;
    font-size: 11px;
  }

  .editor-pane--left label,
  .editor-pane--right label,
  .editor-pane--left .muted,
  .editor-pane--right .muted,
  .editor-pane--left .auto-sync-tip,
  .editor-pane--right .debug-chat-subtitle,
  .editor-pane--right .debug-empty-state,
  .editor-pane--right .debug-composer__hint {
    font-size: 11px;
  }

  .editor-pane--right .debug-empty-state {
    padding: 14px 10px;
  }

  .editor-pane--right .debug-composer {
    gap: 8px;
    margin-top: 8px;
    padding: 10px;
    border-radius: 14px;
  }

  .editor-pane--right .debug-composer textarea {
    min-height: 82px;
    font-size: 12px;
  }

  .editor-pane--right .debug-composer__footer {
    gap: 8px;
  }

  .editor-pane--right .debug-composer__footer .row {
    gap: 6px;
    flex-wrap: nowrap;
  }

  .editor-pane--right #run-draft-test {
    padding: 6px 10px;
    font-size: 12px;
  }

  .editor-pane--right #run-saved-async,
  .editor-pane--right #clear-debug {
    padding: 6px 9px;
    font-size: 11px;
  }

  .editor-pane--right .debug-bubble__meta,
  .editor-pane--right .debug-history-item__label,
  .editor-pane--right .debug-history-item__badge {
    font-size: 10px;
  }

  .editor-pane--right .debug-history-item__title,
  .editor-pane--right .debug-history-item__summary,
  .editor-pane--right .debug-history-item__line {
    font-size: 11px;
  }

  .editor-pane--right .debug-bubble__code {
    padding: 10px 12px;
    font-size: 11px;
  }
}

@media (max-width: 1280px) {
  .editor-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .editor-layout > :last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 980px) {
  .app-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }

  .toolbar-grid,
  .managed-toolbar-grid,
  .inline-form-grid,
  .parameter-grid,
  .editor-layout,
  .overview-strip {
    grid-template-columns: 1fr;
  }

  .form-row-inline,
  .parameter-item--inline {
    grid-template-columns: 1fr;
  }

  .form-row-inline > label:first-child,
  .parameter-item--inline label {
    text-align: left;
  }

  .field-label-wrap,
  .field-label-wrap label,
  .field-label-wrap--row {
    justify-content: flex-start;
    text-align: left;
  }

  .field-help__tooltip {
    display: none;
  }

  .managed-toolbar-head,
  .note-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .parameter-grid--two {
    grid-template-columns: 1fr;
  }

  .editor-layout > :last-child {
    grid-column: auto;
  }

  .editor-pane--left,
  .editor-pane--right {
    position: static;
  }

  .page-hero {
    flex-direction: column;
  }

  .page-container {
    padding: 14px;
  }
}
