:root {
  color-scheme: dark;
  --bg: #080a0d;
  --chrome: #0c1016;
  --panel: #111720;
  --panel-soft: #171f2a;
  --panel-strong: #090d13;
  --field: #0b1118;
  --field-border: #313b49;
  --text: #f6f8fb;
  --muted: #aab5c4;
  --quiet: #778497;
  --border: #273241;
  --border-soft: #1e2632;
  --accent: #2666e3;
  --accent-bright: #6aa2ff;
  --accent-soft: rgba(38, 102, 227, 0.22);
  --accent-row: rgba(60, 124, 255, 0.1);
  --danger: #ff5865;
  --ok: #29d482;
  --warn: #f2b84b;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  --shadow-soft: 0 10px 24px rgba(0, 0, 0, 0.18);
  --focus: rgba(106, 162, 255, 0.25);
  --preview-bg: #ffffff;
  --response-bg: #070b11;
  --response-text: #dce6f6;
  --dialog-shadow: 0 24px 80px rgba(0, 0, 0, 0.56);
  --backdrop: rgba(0, 0, 0, 0.66);
  --rail-width: 76px;
  --topbar-height: 68px;
  --send-column: minmax(320px, 360px);
  --editor-column: minmax(500px, 1fr);
  --right-column: minmax(500px, 0.92fr);
  --workbench-gap: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef2f7;
  --chrome: #f8fafc;
  --panel: #ffffff;
  --panel-soft: #f3f6fa;
  --panel-strong: #e7edf5;
  --field: #ffffff;
  --field-border: #bcc8d8;
  --text: #101828;
  --muted: #4c5b6f;
  --quiet: #6d7b8e;
  --border: #d3dce8;
  --border-soft: #e4eaf2;
  --accent: #1f5fd6;
  --accent-bright: #175cff;
  --accent-soft: rgba(31, 95, 214, 0.11);
  --accent-row: rgba(31, 95, 214, 0.055);
  --danger: #bf2f3c;
  --ok: #087747;
  --warn: #9b5a05;
  --shadow: 0 13px 30px rgba(35, 46, 65, 0.1);
  --shadow-soft: 0 8px 18px rgba(35, 46, 65, 0.08);
  --focus: rgba(31, 95, 214, 0.15);
  --preview-bg: #ffffff;
  --response-bg: #0d1117;
  --response-text: #d6deeb;
  --dialog-shadow: 0 24px 80px rgba(29, 39, 57, 0.24);
  --backdrop: rgba(15, 23, 42, 0.36);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  text-rendering: geometricPrecision;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--rail-width) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.rail {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 12px;
  padding: 14px 8px;
  border-right: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--chrome) 88%, #020407);
  min-height: 0;
}

:root[data-theme="light"] .rail {
  background: #e6edf6;
}

.brand-mark {
  width: 44px;
  height: 44px;
  margin: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.brand-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

.header-logo {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
}

.rail-nav {
  display: grid;
  gap: 8px;
  align-content: start;
}

.rail-item {
  display: grid;
  justify-items: center;
  gap: 5px;
  min-height: 62px;
  padding: 9px 4px;
  border-color: transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.rail-item span {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  line-height: 1;
}

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

.rail-item small {
  font-size: 11px;
  line-height: 1.1;
}

.rail-item b {
  min-width: 20px;
  min-height: 17px;
  padding: 2px 5px;
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel-soft) 82%, #000000);
  color: var(--quiet);
  font-size: 10px;
  line-height: 1.1;
  font-weight: 760;
}

.rail-item:hover {
  background: color-mix(in srgb, var(--panel-soft) 68%, transparent);
  color: var(--text);
}

.rail-item.active {
  background: linear-gradient(180deg, rgba(73, 132, 255, 0.44), rgba(24, 83, 203, 0.78));
  color: #ffffff;
  border-color: rgba(106, 162, 255, 0.38);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 10px 24px rgba(14, 60, 160, 0.22);
}

.rail-item.active b {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.13);
  color: #ffffff;
}

.rail-foot {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.app-header {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  flex: 0 0 var(--topbar-height);
  min-height: var(--topbar-height);
  padding: 10px 18px;
  border-bottom: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--chrome) 96%, transparent);
}

.header-brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
  font-weight: 760;
  letter-spacing: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent);
  border-radius: 7px;
  background: color-mix(in srgb, var(--ok) 14%, transparent);
  color: var(--ok);
  font-size: 12px;
  font-weight: 760;
}

.status-pill[data-state="idle"] {
  border-color: color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--panel-soft) 80%, transparent);
  color: var(--muted);
}

.status-pill[data-state="sending"] {
  border-color: color-mix(in srgb, var(--warn) 36%, transparent);
  background: color-mix(in srgb, var(--warn) 14%, transparent);
  color: var(--warn);
}

.status-pill[data-state="error"] {
  border-color: color-mix(in srgb, var(--danger) 36%, transparent);
  background: color-mix(in srgb, var(--danger) 13%, transparent);
  color: var(--danger);
}

.top-meta {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  gap: 0;
  border-left: 1px solid var(--border-soft);
}

.top-meta div {
  min-width: 118px;
  padding: 0 20px;
  border-right: 1px solid var(--border-soft);
}

.top-meta span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.top-meta strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
}

.top-meta strong:first-letter {
  color: inherit;
}

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

.status-row {
  display: none;
}

.layout {
  display: grid;
  grid-template-columns: var(--send-column) var(--editor-column) var(--right-column);
  gap: var(--workbench-gap);
  flex: 1 1 auto;
  height: calc(100dvh - var(--topbar-height));
  min-height: 0;
  padding: var(--workbench-gap);
  overflow: hidden;
}

.console-shell {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.section-view {
  display: none;
}

.section-view.active {
  display: flex;
}

.section-view.active.layout {
  display: grid;
}

.operator-grid {
  display: contents;
}

.right-column {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto 52px;
  min-width: 0;
  min-height: 0;
  height: 100%;
  gap: var(--workbench-gap);
  overflow: hidden;
}

.send-panel,
.editor-panel,
.preview-panel,
.summary-panel,
.response-panel,
.auth-panel,
.data-view {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 96%, #000000);
  box-shadow: var(--shadow);
  overflow: hidden;
}

:root[data-theme="light"] .send-panel,
:root[data-theme="light"] .editor-panel,
:root[data-theme="light"] .preview-panel,
:root[data-theme="light"] .summary-panel,
:root[data-theme="light"] .response-panel,
:root[data-theme="light"] .auth-panel,
:root[data-theme="light"] .data-view {
  background: var(--panel);
}

.data-view {
  height: calc(100dvh - var(--topbar-height));
  margin: var(--workbench-gap);
  padding: 0;
}

.data-view.section-view:not(.active) {
  display: none;
}

.data-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  flex: 0 0 auto;
  min-height: 68px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel-soft) 96%, #ffffff), color-mix(in srgb, var(--panel-soft) 82%, #05080d));
}

:root[data-theme="light"] .data-header {
  background: linear-gradient(180deg, #ffffff, #f4f7fb);
}

.data-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  flex: 0 0 auto;
  padding: 12px 14px 13px;
  border-bottom: 1px solid var(--border-soft);
}

.stat-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-soft) 88%, #020407);
  box-shadow: var(--shadow-soft);
}

:root[data-theme="light"] .stat-card {
  background: #f8fafc;
}

.stat-card em {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.2;
}

.stat-card strong {
  display: block;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
}

.stat-card small {
  display: block;
  margin-top: 7px;
  color: var(--quiet);
  font-size: 11px;
  line-height: 1.3;
}

.data-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  line-height: 1.35;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 94%, #020407);
  color: var(--muted);
  font-size: 11px;
  font-weight: 780;
  text-align: left;
  text-transform: uppercase;
}

:root[data-theme="light"] .data-table th {
  background: #f8fafc;
}

.data-table td {
  max-width: 340px;
  padding: 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 64%, transparent);
  color: var(--text);
  vertical-align: top;
}

.data-table tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--panel-soft) 18%, transparent);
}

.data-table tr:hover td {
  background: var(--accent-row);
}

.data-table tr[data-issue-key] {
  cursor: pointer;
}

.data-table tr.selected-issue td {
  background: color-mix(in srgb, var(--accent-soft) 58%, transparent);
}

.data-table tr.selected-issue td:first-child {
  box-shadow: inset 3px 0 0 var(--accent-bright);
}

.data-table button {
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.row-action {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.mini-select {
  min-width: 0;
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--field);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #ffffff 4%, transparent);
}

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--field);
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.pill.ok {
  border-color: rgba(41, 212, 130, 0.24);
  background: rgba(41, 212, 130, 0.13);
  color: var(--ok);
}

.pill.warn {
  border-color: rgba(242, 184, 75, 0.28);
  background: rgba(242, 184, 75, 0.14);
  color: var(--warn);
}

.pill.danger {
  border-color: rgba(255, 88, 101, 0.26);
  background: rgba(255, 88, 101, 0.12);
  color: var(--danger);
}

.section-message {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 12px 14px;
  border-top: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.section-message[data-state="error"] {
  background: color-mix(in srgb, var(--danger) 9%, transparent);
  color: var(--danger);
}

.data-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
  flex: 1 1 auto;
  min-height: 0;
}

.detail-pane {
  min-width: 0;
  padding: 16px;
  border-left: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--panel-soft) 76%, transparent);
  color: var(--muted);
  overflow: auto;
  font-size: 12px;
  line-height: 1.45;
}

.detail-pane h3 {
  margin: 0 0 9px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.25;
}

.issue-detail-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-bottom: 10px;
  padding: 0 8px;
  border: 1px solid rgba(88, 141, 255, 0.28);
  border-radius: 999px;
  background: rgba(88, 141, 255, 0.13);
  color: var(--accent-bright);
  font-size: 11px;
  font-weight: 780;
  text-transform: uppercase;
}

.issue-detail-subject {
  margin: 0;
  color: var(--muted);
}

.detail-action {
  display: grid;
  gap: 8px;
  margin: 16px 0 12px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--field) 82%, transparent);
  box-shadow: inset 0 1px 0 color-mix(in srgb, #ffffff 5%, transparent);
}

.detail-action label {
  color: var(--text);
  font-weight: 760;
}

.detail-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.detail-list span {
  display: grid;
  gap: 3px;
  padding-bottom: 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 64%, transparent);
}

.detail-list em {
  color: var(--quiet);
  font-style: normal;
  font-size: 11px;
}

.detail-list strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  word-break: break-word;
}

.tab-row {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.log-table {
  display: none;
}

.log-table.active {
  display: block;
}

.auth-panel {
  width: min(520px, calc(100vw - 120px));
  margin: 34px auto;
}

.auth-panel form {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex: 0 0 auto;
  min-height: 44px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-soft);
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel-soft) 96%, #ffffff), color-mix(in srgb, var(--panel-soft) 82%, #05080d));
}

:root[data-theme="light"] .panel-header {
  background: linear-gradient(180deg, #ffffff, #f4f7fb);
}

.compact-header {
  align-items: center;
}

h2 {
  margin: 0;
  font-size: 14px;
  line-height: 1.25;
  font-weight: 760;
  letter-spacing: 0;
}

.panel-subtitle {
  margin: 3px 0 0;
  color: var(--quiet);
  font-size: 12px;
  line-height: 1.35;
}

.panel-body {
  display: grid;
  gap: 14px;
  align-content: start;
  flex: 1 1 auto;
  min-height: 0;
  padding: 14px;
  overflow: auto;
}

label {
  display: grid;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.label-note {
  color: var(--muted);
  font-weight: 650;
}

.hint,
.footer-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 450;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--field-border);
  border-radius: 7px;
  background: var(--field);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  min-height: 38px;
  padding: 9px 11px;
  outline: none;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #ffffff 5%, transparent);
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

input:hover,
textarea:hover,
select:hover {
  border-color: color-mix(in srgb, var(--accent-bright) 36%, var(--field-border));
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-bright);
  box-shadow: 0 0 0 3px var(--focus);
}

input::placeholder,
textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 70%, transparent);
}

textarea {
  min-height: 0;
  resize: none;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.field-with-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  gap: 8px;
  align-items: end;
}

.mode-field {
  position: relative;
}

.mode-select {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 3px;
  border: 1px solid var(--field-border);
  border-radius: 8px;
  background: var(--field);
  box-shadow: inset 0 1px 0 color-mix(in srgb, #ffffff 5%, transparent);
}

.mode-switch button {
  min-height: 38px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.mode-switch button.is-active {
  background: linear-gradient(180deg, rgba(81, 142, 255, 0.56), rgba(25, 82, 203, 0.86));
  color: #ffffff;
  box-shadow: 0 8px 22px rgba(21, 70, 190, 0.28);
}

.field-count {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  font-weight: 600;
  justify-self: end;
}

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

.hidden {
  display: none !important;
}

button {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--field);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  min-height: 36px;
  padding: 0 12px;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #ffffff 5%, transparent);
  transition: transform 120ms ease, border-color 140ms ease, background 140ms ease, color 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

button.primary {
  border-color: color-mix(in srgb, var(--accent-bright) 72%, var(--accent));
  background: linear-gradient(180deg, #2f73ff, #1554d6);
  color: #ffffff;
  min-height: 44px;
  box-shadow: 0 10px 24px rgba(21, 84, 214, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

button:hover {
  border-color: color-mix(in srgb, var(--accent-bright) 40%, var(--border));
  background: color-mix(in srgb, var(--field) 82%, var(--accent-soft));
}

button.primary:hover {
  filter: brightness(1.04);
}

button:active {
  transform: translateY(1px);
}

button:focus-visible {
  border-color: var(--accent-bright);
  box-shadow: 0 0 0 3px var(--focus), inset 0 1px 0 color-mix(in srgb, #ffffff 7%, transparent);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

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

.muted-button.is-active {
  color: #ffffff;
  border-color: rgba(77, 134, 255, 0.42);
  background: color-mix(in srgb, var(--accent-soft) 76%, var(--field));
}

:root[data-theme="light"] .muted-button.is-active {
  color: var(--accent-bright);
  border-color: color-mix(in srgb, var(--accent-bright) 32%, var(--border));
  background: color-mix(in srgb, var(--accent-soft) 72%, #ffffff);
}

.theme-toggle {
  min-width: 44px;
  overflow: hidden;
  text-indent: -999px;
  position: relative;
}

.theme-toggle::after {
  content: "☼";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-indent: 0;
}

:root[data-theme="light"] .theme-toggle::after {
  content: "☾";
}

.editor-panel {
  background: #0b1118;
  height: 100%;
}

.editor-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 0 0 auto;
  min-height: 40px;
  padding: 6px 14px;
  border-bottom: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--panel) 92%, #020407);
}

.editor-toolbar button {
  min-height: 28px;
  font-size: 12px;
}

.editor-body {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  padding: 0;
  overflow: auto;
}

.has-code-editor .editor-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.has-code-editor .editor-gutter {
  display: none;
}

.editor-gutter {
  padding: 12px 10px;
  border-right: 1px solid var(--border);
  background: #0d141d;
  color: var(--quiet);
  font: 12px/1.66 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  text-align: right;
  white-space: pre;
  overflow: hidden;
}

.editor-label,
.editor-label textarea {
  min-height: 0;
}

.CodeMirror {
  height: 100%;
  min-height: 0;
  flex: 1 1 auto;
  background: #0a1017;
  color: #e8edf5;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12.5px;
  line-height: 1.66;
}

.CodeMirror-scroll {
  min-height: 0;
}

.CodeMirror-sizer {
  min-height: 100% !important;
}

.CodeMirror-gutters {
  background: #0d151f;
  border-right: 1px solid var(--border-soft);
}

.CodeMirror-linenumber {
  color: var(--quiet);
}

.CodeMirror-cursor {
  border-left-color: #ffffff;
}

.CodeMirror-selected {
  background: rgba(77, 134, 255, 0.26) !important;
}

.CodeMirror-dialog {
  background: var(--panel-soft);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  font-family: inherit;
}

.CodeMirror-dialog input {
  min-height: 30px;
  width: min(420px, 100%);
}

.plain-editor {
  white-space: pre-wrap;
}

.editor-expanded .layout {
  grid-template-columns: var(--send-column) minmax(0, 1fr);
}

.editor-expanded .right-column {
  display: none;
}

.editor-expanded .editor-panel {
  grid-column: 2 / -1;
}

.editor-label {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
}

.editor-label textarea {
  flex: 1 1 auto;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: #0b1118;
  color: #e8edf5;
  font-size: 12.5px;
  line-height: 1.66;
  padding: 12px 14px;
  white-space: pre;
  overflow: auto;
}

.editor-status {
  display: flex;
  align-items: center;
  gap: 28px;
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 14px;
  border-top: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 12px;
  background: color-mix(in srgb, var(--panel-soft) 88%, #020407);
}

:root[data-theme="light"] .editor-toolbar,
:root[data-theme="light"] .editor-status {
  background: #edf2f8;
}

.editor-status span:last-child {
  margin-left: auto;
}

.editor-status strong {
  color: var(--muted);
  font-weight: 650;
}

.preview-panel {
  min-height: 0;
  height: 100%;
}

.preview-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.preview-actions button {
  min-height: 28px;
  font-size: 12px;
}

.preview-frame {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  border: 0;
  background: var(--preview-bg);
  transition: width 160ms ease, margin 160ms ease, border-radius 160ms ease;
}

.preview-frame.is-mobile-preview {
  width: min(390px, calc(100% - 28px));
  margin: 14px auto;
  border: 1px solid #d8dee9;
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
}

.summary-panel {
  min-height: 0;
  max-height: min(280px, 34dvh);
}

.run-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--field);
  color: var(--muted);
  font-size: 12px;
}

.telemetry-panel {
  display: grid;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
  padding: 12px;
  border-bottom: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--panel) 92%, var(--panel-soft));
  overflow: auto;
}

.people-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.people-summary span {
  padding: 11px 12px;
  border: 1px solid color-mix(in srgb, var(--border) 84%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-soft) 86%, #020407);
  min-width: 0;
  box-shadow: var(--shadow-soft);
}

:root[data-theme="light"] .people-summary span {
  background: #f8fafc;
}

.people-summary strong {
  display: block;
  color: var(--text);
  font-size: 19px;
  line-height: 1.1;
  margin-bottom: 4px;
}

.people-summary em,
.people-summary small {
  display: block;
  font-style: normal;
}

.people-summary em {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
}

.people-summary small {
  color: var(--quiet);
  font-size: 11px;
}

.people-summary span:nth-child(2) strong {
  color: var(--ok);
}

.people-summary span:nth-child(3) strong {
  color: var(--danger);
}

.people-summary span:nth-child(4) strong {
  color: var(--accent-bright);
}

.send-summary,
.metrics-summary {
  padding: 0 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.send-summary strong,
.metrics-summary strong {
  color: var(--text);
}

.response-panel {
  min-height: 52px;
}

.response-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 0;
  border-radius: 0;
  background: color-mix(in srgb, var(--panel) 90%, transparent);
}

.response-toggle strong {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--field);
  color: var(--muted);
  font-size: 12px;
}

.status {
  width: min(460px, 100%);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 13px;
  background: color-mix(in srgb, var(--panel) 94%, var(--panel-soft));
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}

.status[data-state="sending"] {
  border-color: color-mix(in srgb, var(--warn) 28%, var(--border));
  background: color-mix(in srgb, var(--warn) 9%, var(--panel));
}

.status[data-state="sent"] {
  border-color: color-mix(in srgb, var(--ok) 28%, var(--border));
  background: color-mix(in srgb, var(--ok) 8%, var(--panel));
}

.status[data-state="error"] {
  border-color: color-mix(in srgb, var(--danger) 30%, var(--border));
  background: color-mix(in srgb, var(--danger) 9%, var(--panel));
}

.status strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  margin-bottom: 2px;
}

.status[data-state="sent"] strong {
  color: var(--ok);
}

.status[data-state="error"] strong {
  color: var(--danger);
}

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

code {
  color: var(--text);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent-bright) 26%, transparent);
  border-radius: 5px;
  padding: 1px 4px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 11px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

dialog {
  width: min(840px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--dialog-shadow);
}

dialog::backdrop {
  background: var(--backdrop);
}

.dialog-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.response {
  display: block;
  min-height: 360px;
  max-height: min(62vh, 620px);
  overflow: auto;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--response-bg);
  color: var(--response-text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 1320px) {
  body {
    overflow: auto;
  }

  .app-shell,
  .workspace,
  .console-shell {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
  }

  .data-view {
    height: auto;
    min-height: calc(100dvh - var(--topbar-height) - 16px);
  }

  .top-meta {
    display: none;
  }

  .layout {
    grid-template-columns: minmax(320px, 370px) minmax(520px, 1fr);
    height: auto;
    min-height: calc(100dvh - var(--topbar-height));
    overflow: visible;
  }

  .right-column {
    grid-column: 1 / -1;
    grid-template-rows: minmax(520px, 68dvh) auto auto;
    height: auto;
    overflow: visible;
  }

  .summary-panel {
    max-height: none;
  }

  .editor-panel {
    min-height: min(760px, calc(100dvh - var(--topbar-height) - 16px));
  }
}

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

  .rail {
    position: sticky;
    top: 0;
    z-index: 10;
    display: block;
    min-height: 0;
    padding: 7px 8px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .rail-nav {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
  }

  .rail-item {
    min-height: 50px;
    padding: 6px 2px;
  }

  .rail-item span {
    width: 18px;
    height: 18px;
  }

  .rail-item svg {
    width: 17px;
    height: 17px;
  }

  .rail-item small {
    font-size: 10px;
  }

  .rail-item b {
    display: none;
  }

  .rail-foot {
    display: none;
  }

  .app-header {
    grid-template-columns: 1fr;
    align-items: stretch;
    flex-basis: auto;
    min-height: 0;
    gap: 10px;
    padding: 12px;
    height: auto;
  }

  .header-brand,
  .header-actions {
    flex-wrap: wrap;
  }

  .header-logo {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  h1 {
    font-size: 18px;
  }

  .layout {
    grid-template-columns: 1fr;
    padding: 10px;
    min-height: 0;
  }

  .operator-grid {
    display: grid;
    gap: 10px;
  }

  .right-column {
    grid-column: auto;
    grid-template-rows: minmax(520px, 70dvh) auto auto;
  }

  .send-panel,
  .editor-panel,
  .preview-panel {
    min-height: 520px;
  }

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

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

  .data-split {
    grid-template-columns: 1fr;
  }

  .detail-pane {
    border-left: 0;
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 640px) {
  .auth-panel {
    width: calc(100vw - 32px);
    margin: 12px auto;
  }

  .people-summary {
    grid-template-columns: 1fr;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .field-with-button {
    grid-template-columns: 1fr;
  }

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

  .row-action {
    grid-template-columns: 1fr;
  }
}
