:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --panel: #ffffff;
  --panel-strong: #f0f3f8;
  --ink: #111827;
  --muted: #667085;
  --line: #d7dde8;
  --accent: #2563eb;
  --accent-ink: #ffffff;
  --danger: #dc2626;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.topbar {
  position: absolute;
  z-index: 10;
  top: 12px;
  left: 12px;
  right: 12px;
  display: grid;
  grid-template-columns: minmax(0, max-content) minmax(24px, 1fr) max-content;
  grid-template-areas: "workspace . actions";
  gap: 10px;
  align-items: start;
  pointer-events: none;
}

.workspace-strip,
.tool-strip,
.action-strip,
.inspector-panel,
.ai-panel,
.statusbar,
.viewport-controls {
  pointer-events: auto;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  padding: 0 5px 0 2px;
  font-size: 14px;
  font-weight: 750;
  letter-spacing: 0;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.brand-mark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--ink);
  border-radius: 5px 4px 6px 4px;
  transform: rotate(-7deg);
  background:
    linear-gradient(135deg, transparent 44%, #38bdf8 45% 56%, transparent 57%),
    #ffffff;
}

.tool-strip,
.workspace-strip,
.action-strip {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 5px;
  border-radius: 8px;
}

.tool-strip {
  position: absolute;
  top: 58px;
  left: 0;
  flex-direction: column;
  gap: 3px;
  width: 46px;
  overflow: visible;
}

.workspace-strip {
  grid-area: workspace;
  gap: 6px;
  max-width: 100%;
}

.utility-strip {
  display: contents;
  pointer-events: none;
}

.action-strip {
  grid-area: actions;
  gap: 6px;
}

.action-strip {
  pointer-events: auto;
}

.utility-strip .color-control > span,
.utility-strip .range-control > span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.workspace-select-control {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.workspace-select-control select {
  width: 132px;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
}

.workspace-command {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 32px;
  min-width: 32px;
  padding: 0;
}

.workspace-command svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.icon-button,
.mini-button,
.text-button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 7px;
}

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

.icon-button:hover,
.mini-button:hover,
.text-button:hover {
  background: var(--panel-strong);
}

.icon-button:disabled,
.mini-button:disabled,
.text-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.icon-button:disabled:hover,
.mini-button:disabled:hover,
.text-button:disabled:hover {
  background: transparent;
}

.icon-button.is-active {
  background: #e8f1ff;
  border-color: #b7cdfd;
  color: var(--accent);
}

.system-tool-picker {
  position: relative;
  display: inline-grid;
}

.system-tool-menu {
  position: absolute;
  z-index: 30;
  top: 0;
  left: calc(100% + 8px);
  display: grid;
  width: 178px;
  gap: 2px;
  padding: 5px;
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.system-tool-menu[hidden] {
  display: none;
}

.system-tool-option {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  align-items: center;
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
  text-align: left;
}

.system-tool-option svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.system-tool-option:hover,
.system-tool-option.is-active {
  background: #e8f1ff;
  border-color: #b7cdfd;
  color: var(--accent);
}

.icon-button:focus-visible,
.mini-button:focus-visible,
.text-button:focus-visible,
.system-tool-option:focus-visible,
.context-menu-option:focus-visible,
.workspace-select-control select:focus-visible,
.color-control input:focus-visible,
.toggle-control input:focus-visible,
.range-control input:focus-visible,
.inspector-field input:focus-visible,
.inspector-field select:focus-visible,
.inspector-field textarea:focus-visible,
#renameDialogInput:focus-visible {
  outline: 2px solid #9ab7fb;
  outline-offset: 2px;
}

.icon-button:disabled,
.mini-button:disabled,
.text-button:disabled {
  color: #a8b0bf;
  cursor: not-allowed;
  opacity: 0.68;
}

.icon-button.is-loading:disabled {
  background: #e8f1ff;
  border-color: #b7cdfd;
  color: var(--accent);
  cursor: progress;
  opacity: 1;
}

.icon-button.is-loading svg {
  animation: spin 0.8s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .icon-button.is-loading svg {
    animation: none;
  }
}

.color-control,
.range-control,
.toggle-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.color-control {
  padding: 0 6px;
  border-radius: 7px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.color-control input {
  width: 24px;
  height: 24px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.toggle-control {
  padding: 0 7px;
}

.toggle-control input {
  accent-color: var(--accent);
}

.toggle-control.is-disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.toggle-control.is-disabled input {
  cursor: not-allowed;
}

.toggle-control.compact {
  color: var(--ink);
  font-size: 12px;
}

.range-control {
  padding: 0 6px;
  border-left: 1px solid var(--line);
}

.range-control input {
  width: 70px;
  accent-color: var(--accent);
}

.text-button {
  min-width: 58px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 650;
}

.text-button.primary {
  background: var(--ink);
  color: var(--accent-ink);
}

.text-button.primary:hover {
  background: #263244;
}

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

.text-button.danger:hover {
  border-color: #fecaca;
  background: #fef2f2;
}

.canvas-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #fbfcff;
}

#canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

#canvas[data-tool="select"] {
  cursor: default;
}

#canvas[data-tool="hand"],
#canvas.is-panning {
  cursor: grab;
}

#canvas.is-panning {
  cursor: grabbing;
}

#canvas[data-tool="text"] {
  cursor: text;
}

#canvas[data-tool="eraser"] {
  cursor: cell;
}

#textEditor {
  position: absolute;
  z-index: 20;
  display: none;
  min-width: 120px;
  min-height: 36px;
  max-width: min(520px, calc(100vw - 48px));
  padding: 4px 6px;
  overflow: hidden;
  resize: none;
  border: 1px dashed var(--accent);
  border-radius: 4px;
  outline: none;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  line-height: 1.25;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.12);
}

.minimap {
  position: absolute;
  z-index: 9;
  bottom: 74px;
  left: 12px;
  width: 184px;
  height: 128px;
  padding: 8px;
  pointer-events: none;
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

#minimapCanvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 5px;
  background: #f8fafc;
}

.minimap-viewport {
  position: absolute;
  min-width: 6px;
  min-height: 6px;
  border: 2px solid var(--accent);
  border-radius: 3px;
  background: rgba(37, 99, 235, 0.1);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.92),
    0 0 0 1px rgba(37, 99, 235, 0.12);
}

.context-menu {
  position: absolute;
  z-index: 35;
  display: grid;
  width: 184px;
  gap: 2px;
  padding: 5px;
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.context-menu[hidden] {
  display: none;
}

.context-menu-option {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  align-items: center;
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
  text-align: left;
}

.context-menu-option svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.context-menu-option:hover,
.context-menu-option:focus-visible {
  background: #e8f1ff;
  border-color: #b7cdfd;
  color: var(--accent);
}

.command-palette-backdrop {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 92px 12px 24px;
  background: rgba(15, 23, 42, 0.14);
  pointer-events: auto;
}

.command-palette-backdrop[hidden] {
  display: none;
}

.command-palette-card {
  display: grid;
  width: min(520px, calc(100vw - 24px));
  max-height: min(620px, calc(100vh - 116px));
  gap: 10px;
  padding: 12px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.2);
  backdrop-filter: blur(18px);
}

.command-palette-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.command-palette-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 780;
  letter-spacing: 0;
}

.command-palette-search {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid #9ab7fb;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.command-palette-search svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#commandPaletteInput {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

#commandPaletteInput::placeholder {
  color: #8a94a6;
}

.command-palette-results {
  display: grid;
  gap: 5px;
  overflow: auto;
  padding-right: 2px;
}

.command-palette-option {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) max-content;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.command-palette-option:hover,
.command-palette-option.is-active {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.command-palette-option:disabled {
  cursor: default;
  opacity: 0.54;
}

.command-palette-option:disabled:hover {
  border-color: transparent;
  background: transparent;
}

.command-palette-option-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
}

.command-palette-option-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.command-palette-option-text {
  min-width: 0;
}

.command-palette-option-title,
.command-palette-option-detail,
.command-palette-empty {
  overflow-wrap: anywhere;
}

.command-palette-option-title {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 720;
  letter-spacing: 0;
  line-height: 1.2;
}

.command-palette-option-detail {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
}

.command-palette-shortcut {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 24px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0;
  white-space: nowrap;
}

.command-palette-shortcut[hidden] {
  display: none;
}

.command-palette-empty {
  padding: 16px 8px 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
  text-align: center;
}

.help-center-backdrop {
  position: fixed;
  z-index: 70;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(3px);
}

.help-center-backdrop[hidden],
.help-panel[hidden] {
  display: none;
}

.help-center-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1120px, calc(100vw - 48px));
  height: min(720px, calc(100vh - 48px));
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 86%, transparent);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.help-center-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 28px 22px;
  border-bottom: 1px solid var(--line);
}

.help-center-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 26px;
  font-weight: 780;
  letter-spacing: -0.02em;
}

.help-center-header p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.help-center-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 0;
}

.help-center-nav {
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
  padding: 14px 10px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: #f8fafc;
}

.help-topic {
  position: relative;
  width: 100%;
  min-height: 42px;
  padding: 8px 12px 8px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #344054;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.25;
  text-align: left;
}

.help-topic:hover,
.help-topic:focus-visible {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: var(--accent);
}

.help-topic.is-active {
  background: #e8f1ff;
  color: var(--accent);
}

.help-topic.is-active::before {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 3px;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
  content: "";
}

.help-center-content {
  min-width: 0;
  min-height: 0;
  padding: 26px 32px 40px;
  overflow: auto;
  outline: none;
  scroll-behavior: smooth;
}

.help-center-content:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.34);
}

.help-panel {
  max-width: 760px;
  margin: 0 auto;
  color: #344054;
  font-size: 14px;
  line-height: 1.6;
}

.help-panel h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 23px;
  font-weight: 780;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.help-panel h4 {
  margin: 24px 0 8px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 750;
  line-height: 1.3;
}

.help-panel p,
.help-panel ul,
.help-panel ol {
  margin: 8px 0 0;
}

.help-panel ul,
.help-panel ol {
  padding-left: 22px;
}

.help-panel li + li {
  margin-top: 7px;
}

.help-steps {
  display: grid;
  gap: 12px;
  padding: 0 !important;
  list-style: none;
}

.help-steps li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  margin: 0 !important;
}

.help-steps li > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 12px;
  font-weight: 780;
}

.help-callout {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 12px;
  margin-top: 24px;
  padding: 13px 15px;
  border: 1px solid #b7cdfd;
  border-radius: 8px;
  background: #eff6ff;
  color: #344054;
}

.help-callout strong {
  color: #1d4ed8;
}

.help-callout-warning {
  border-color: #f6d68a;
  background: #fffbeb;
}

.help-callout-warning strong {
  color: #a16207;
}

.help-shortcut-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.help-shortcut-grid > div {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 12px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.help-center-card kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 26px;
  padding: 2px 7px;
  border: 1px solid #cbd5e1;
  border-bottom-width: 2px;
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font-family: inherit;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.1;
  white-space: nowrap;
}

.help-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.help-detail-grid section {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.help-detail-grid h4,
.help-detail-grid p {
  margin: 0;
}

.help-detail-grid p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.help-shortcut-table {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.help-shortcut-table section:last-child {
  grid-column: 1 / -1;
}

.help-shortcut-table h4 {
  margin: 0 0 8px;
}

.help-shortcut-table dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 16px;
  margin: 0;
}

.help-shortcut-table dl > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  border-bottom: 1px solid #edf0f5;
}

.help-shortcut-table dt,
.help-shortcut-table dd {
  margin: 0;
}

.help-shortcut-table dd {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.help-faq {
  display: grid;
  gap: 9px;
  margin-top: 18px;
}

.help-faq details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.help-faq summary {
  padding: 13px 15px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

.help-faq details p {
  margin: 0;
  padding: 0 15px 14px;
  color: var(--muted);
}

.help-faq code {
  padding: 2px 5px;
  border-radius: 4px;
  background: #eef2f7;
  color: var(--ink);
  font-size: 12px;
}

.help-center-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.help-center-footer kbd {
  min-width: 26px;
  min-height: 22px;
  margin: 0 4px;
}

.inspector-panel {
  position: absolute;
  z-index: 14;
  top: 68px;
  right: 12px;
  display: grid;
  width: min(320px, calc(100vw - 24px));
  max-height: calc(100vh - 126px);
  gap: 12px;
  padding: 12px;
  overflow: auto;
  border-radius: 8px;
}

.inspector-panel[hidden] {
  display: none;
}

.inspector-panel.is-left {
  right: auto;
  left: 70px;
}

.inspector-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.inspector-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: 0;
}

#inspectorSummary {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.inspector-group {
  display: grid;
  gap: 9px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.inspector-group:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.inspector-section-label {
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
}

.inspector-note {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.inspector-group[hidden],
.inspector-field[hidden] {
  display: none;
}

.inspector-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.inspector-field input,
.inspector-field select,
.inspector-field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  background: #ffffff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.inspector-field input,
.inspector-field select {
  height: 34px;
  padding: 0 9px;
}

.inspector-field textarea {
  min-height: 76px;
  padding: 8px 9px;
  resize: vertical;
  line-height: 1.35;
}

.inspector-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.inspector-name-style-controls {
  grid-template-columns: 1fr;
}

.inspector-color-control {
  justify-content: space-between;
  width: 100%;
}

.inspector-toggle,
.inspector-range {
  justify-content: space-between;
  width: 100%;
  padding: 0;
  border-left: 0;
}

.inspector-range input {
  width: min(144px, 54%);
}

.ai-panel {
  position: absolute;
  z-index: 15;
  top: 68px;
  bottom: 64px;
  right: 12px;
  display: grid;
  grid-template-rows: 56px minmax(0, 1fr);
  width: min(520px, calc(100vw - 24px));
  max-height: none;
  gap: 0;
  padding: 0;
  overflow: hidden;
  border-color: #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.14);
  backdrop-filter: none;
}

.ai-panel-header {
  padding: 0 16px 0 18px;
  border-bottom: 1px solid #e2e8f0;
}

.ai-panel-heading {
  display: grid;
  gap: 2px;
}

.ai-panel-heading span {
  color: #64748b;
  font-size: 10px;
  font-weight: 600;
}

.ai-header-icon-button {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
}

.ai-header-icon-button:hover,
.ai-header-icon-button:focus-visible {
  background: #f1f5f9;
  color: #0f172a;
}

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

.ai-mode-symbols {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.ai-workspace-shell {
  display: grid;
  min-height: 0;
  grid-template-columns: 112px minmax(0, 1fr);
}

.thinking-mode-rail {
  display: grid;
  min-height: 0;
  align-content: start;
  gap: 4px;
  padding: 16px 8px;
  overflow-y: auto;
  border-right: 1px solid #e2e8f0;
  background: #f8fafc;
}

.thinking-mode-rail button {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  min-height: 44px;
  gap: 8px;
  padding: 0 7px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

#thinkingMergeProblems:disabled {
  display: none;
}

.thinking-mode-rail button:hover {
  background: #f1f5f9;
  color: #334155;
}

.thinking-mode-rail button[aria-selected="true"] {
  background: #eaf2ff;
  color: #2563eb;
}

.thinking-mode-rail svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ai-workspace-main {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  overflow: hidden;
  background: #ffffff;
}

.thinking-workspace-heading {
  padding: 22px 24px 16px;
}

.thinking-workspace-heading h3,
.thinking-workspace-heading p {
  margin: 0;
}

.thinking-workspace-heading h3 {
  color: #0f172a;
  font-size: 19px;
  font-weight: 760;
  letter-spacing: -0.015em;
}

.thinking-workspace-heading p {
  margin-top: 5px;
  color: #64748b;
  font-size: 11px;
  line-height: 1.45;
}

.thinking-workspace-scroll {
  display: grid;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
}

.thinking-context-control {
  display: grid;
  gap: 6px;
  padding: 0 24px 14px;
}

.thinking-context-button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 36px;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  color: #0f172a;
  text-align: left;
  cursor: pointer;
}

.thinking-context-button::after {
  content: none;
}

.thinking-export-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(4px);
}

.thinking-export-backdrop[hidden] {
  display: none;
}

.thinking-export-card {
  width: min(440px, calc(100vw - 32px));
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.22);
}

.thinking-export-header,
.thinking-export-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.thinking-export-header h2,
.thinking-export-header p {
  margin: 0;
}

.thinking-export-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.thinking-export-card > .toggle-control {
  margin-top: 20px;
}

.thinking-export-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

.thinking-context-button .thinking-context-label {
  font-size: 12px;
  font-weight: 750;
}

.thinking-context-button small {
  overflow: hidden;
  color: #64748b;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thinking-context-manage {
  color: #2563eb;
  font-size: 11px;
  font-weight: 700;
}

.thinking-context-drawer {
  display: grid;
  max-height: 220px;
  gap: 8px;
  padding: 9px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.thinking-workspace-progress {
  display: grid;
  gap: 7px;
  padding: 0 24px 18px;
}

.thinking-workspace-progress[hidden] {
  display: none;
}

.thinking-workspace-progress > div:first-child {
  display: flex;
  justify-content: space-between;
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
}

.thinking-workspace-progress-track {
  height: 3px;
  overflow: hidden;
  border-radius: 3px;
  background: #e2e8f0;
}

.thinking-workspace-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #2563eb;
}

.thinking-context-drawer[hidden],
.thinking-mode-panel[hidden],
.thinking-suggestions[hidden] {
  display: none;
}

.thinking-context-heading {
  display: grid;
  gap: 2px;
  font-size: 11px;
}

.thinking-context-heading span {
  color: var(--muted);
}

.thinking-context-list {
  display: grid;
  gap: 5px;
}

.thinking-context-list > strong {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.thinking-context-item {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.35;
}

.thinking-mode-panel {
  display: grid;
  min-height: 0;
  gap: 10px;
  padding: 0 24px 24px;
  overflow: auto;
}

.thinking-chat-panel {
  padding: 0 24px 24px;
}

.thinking-clarify-panel {
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.thinking-clarify-content {
  display: grid;
  min-height: 0;
  align-content: start;
  gap: 12px;
  padding: 0 24px 20px;
  overflow-y: auto;
}

.thinking-question-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
}

.thinking-question-card strong {
  color: #0f172a;
  font-size: 13px;
  line-height: 1.4;
}

.thinking-question-card p {
  margin: 0;
  color: #64748b;
  font-size: 11px;
  line-height: 1.5;
}

.thinking-question-card p span {
  color: #334155;
  font-weight: 750;
}

.thinking-composer {
  display: grid;
  gap: 8px;
  padding: 12px 16px 14px;
  border-top: 1px solid #e2e8f0;
  background: #ffffff;
}

.thinking-composer-input {
  display: block;
}

.thinking-composer-input > span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.thinking-composer textarea {
  width: 100%;
  min-height: 68px;
  padding: 11px 12px;
  resize: none;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  outline: none;
  background: #ffffff;
  color: #0f172a;
  font-size: 12px;
  line-height: 1.45;
}

.thinking-composer textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.thinking-composer-actions {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 6px;
}

#thinkingClarifyUnsure {
  justify-self: end;
}

.thinking-composer-tool {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
}

.thinking-composer-tool:hover {
  background: #f1f5f9;
  color: #2563eb;
}

.thinking-panel-intro {
  display: grid;
  gap: 3px;
}

.thinking-panel-intro strong {
  color: var(--ink);
  font-size: 13px;
}

.thinking-panel-intro span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.thinking-field {
  display: grid;
  min-width: 0;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.thinking-field input,
.thinking-field select,
.thinking-field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
}

.thinking-field input,
.thinking-field select {
  height: 34px;
  padding: 0 8px;
}

.thinking-field textarea {
  padding: 8px;
  resize: vertical;
}

.thinking-inline-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.thinking-inline-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.thinking-result,
.thinking-conversation,
.thinking-perspective-options {
  display: grid;
  gap: 8px;
}

.thinking-problem-summary {
  padding: 7px 9px;
  border-radius: 7px;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.thinking-problem-tree {
  display: grid;
  gap: 6px;
}

.thinking-problem-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
}

.thinking-problem-row input[type="text"] {
  min-width: 0;
  height: 30px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  font-size: 11px;
}

.thinking-problem-row input[type="text"]:focus {
  border-color: var(--accent);
  background: #ffffff;
  outline: none;
}

.thinking-problem-row.is-closed input[type="text"] {
  color: var(--muted);
  text-decoration: line-through;
}

.thinking-problem-actions {
  display: flex;
  gap: 3px;
}

.thinking-problem-actions button {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #ffffff;
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
}

.thinking-suggestions {
  display: grid;
  min-height: 0;
  gap: 8px;
  padding: 10px;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.thinking-suggestions-heading,
.thinking-suggestion-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.thinking-suggestions-heading strong {
  font-size: 12px;
}

.thinking-suggestions-heading span {
  color: var(--muted);
  font-size: 11px;
}

#thinkingSuggestionList {
  display: grid;
  gap: 7px;
}

.thinking-suggestion-card {
  display: grid;
  gap: 7px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.thinking-suggestion-card.is-selected {
  border-color: color-mix(in srgb, var(--accent) 54%, white);
  background: color-mix(in srgb, var(--accent) 5%, white);
}

.thinking-suggestion-title {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
}

.thinking-suggestion-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.thinking-review-card {
  display: grid;
  gap: 7px;
  padding: 9px;
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 8px;
  background: #ffffff;
}

.thinking-review-card.severity-notice {
  border-left-color: #2563eb;
}

.thinking-review-card.severity-attention {
  border-left-color: #d97706;
}

.thinking-review-card.severity-material {
  border-left-color: #ea580c;
}

.thinking-review-card.severity-critical {
  border-left-color: #dc2626;
}

.thinking-review-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  text-transform: capitalize;
}

.thinking-review-number {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: #e2e8f0;
  color: var(--ink);
  font-size: 10px;
  font-weight: 800;
}

.thinking-review-severity {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.thinking-review-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.thinking-review-card select {
  width: 100%;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font-size: 11px;
}

#decisionMatrix {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow: auto;
  border-collapse: collapse;
  font-size: 10px;
}

#decisionMatrix caption {
  padding: 6px 0;
  color: var(--muted);
  text-align: left;
  font-weight: 700;
}

#decisionMatrix th,
#decisionMatrix td {
  min-width: 126px;
  padding: 6px;
  border: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

#decisionMatrix th:first-child {
  min-width: 92px;
}

#decisionMatrix thead th {
  background: #f8fafc;
}

#decisionMatrix thead th:not(:first-child) {
  display: grid;
  gap: 5px;
}

#decisionMatrix input,
#decisionMatrix select {
  width: 100%;
  min-width: 0;
  height: 28px;
  margin-bottom: 4px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #ffffff;
  color: var(--ink);
  font-size: 10px;
}

#decisionMatrix small {
  display: block;
  color: var(--muted);
  line-height: 1.3;
}

.thinking-suggestion-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.thinking-suggestion-actions button {
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.ai-panel[hidden] {
  display: none;
}

.ai-panel-header,
.ai-panel-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ai-panel h2 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: 0;
}

.ai-panel-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-selection-controls {
  display: grid;
  gap: 7px;
}

.ai-selection-controls[hidden] {
  display: none;
}

.ai-mode-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
}

.ai-mode-option,
.ai-prompt-chips button {
  min-height: 28px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  cursor: pointer;
}

.ai-mode-option:hover,
.ai-mode-option.is-active {
  background: #dbeafe;
  color: #1d4ed8;
}

.ai-scope-note {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.ai-prompt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.ai-prompt-chips button {
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid #dbeafe;
  background: #eff6ff;
  color: #1d4ed8;
}

.ai-prompt-chips button:hover {
  border-color: #93c5fd;
  background: #dbeafe;
}

.ai-messages {
  display: grid;
  gap: 7px;
  max-height: min(220px, 30vh);
  overflow: auto;
  padding-right: 2px;
}

.ai-messages:empty {
  display: none;
}

.ai-message {
  display: grid;
  gap: 3px;
  max-width: 92%;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.35;
  white-space: pre-wrap;
}

.ai-message.is-user {
  justify-self: end;
  border-color: #bfdbfe;
  background: #eff6ff;
}

.ai-message.is-assistant {
  justify-self: start;
  background: #f8fafc;
}

.ai-preview {
  display: grid;
  gap: 7px;
  padding: 8px 9px;
  border: 1px solid #c7d2fe;
  border-radius: 7px;
  background: #eef2ff;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.35;
}

.ai-preview[hidden] {
  display: none;
}

.ai-preview-title {
  color: #3730a3;
  font-size: 12px;
  font-weight: 750;
}

.ai-preview-actions,
.ai-action-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.ai-provider-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
}

.ai-provider-control label {
  position: relative;
  cursor: pointer;
}

.ai-provider-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.ai-provider-control span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 30px;
  border-radius: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.ai-provider-control input:checked + span {
  background: #ffffff;
  color: var(--accent);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
}

.ai-provider-control input:focus-visible + span {
  outline: 2px solid #9ab7fb;
  outline-offset: 2px;
}

#aiPrompt {
  width: 100%;
  min-height: 78px;
  max-height: min(180px, 30vh);
  padding: 9px 10px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  background: #ffffff;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.4;
}

#aiPrompt:focus {
  border-color: #9ab7fb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

#aiStatus {
  flex: 1 1 140px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

#aiStatus.is-error {
  color: var(--danger);
}

.mcp-settings-backdrop {
  position: absolute;
  z-index: 42;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(17, 24, 39, 0.28);
  backdrop-filter: blur(3px);
}

.mcp-settings-backdrop[hidden] {
  display: none;
}

.mcp-settings-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(920px, calc(100vw - 36px));
  max-height: min(760px, calc(100vh - 36px));
  border: 1px solid color-mix(in srgb, var(--line) 86%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 97%, transparent);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
  overflow: hidden;
  backdrop-filter: blur(18px);
}

.mcp-settings-header,
.mcp-settings-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.mcp-settings-footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.mcp-settings-header h2,
.mcp-tool-panel-header h3 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: 0;
}

.mcp-settings-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 0;
}

.mcp-server-list-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border-right: 1px solid var(--line);
  background: #f8fafc;
}

.mcp-server-list-actions,
.mcp-settings-actions,
.mcp-tool-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mcp-server-list-actions .text-button {
  min-width: 0;
  flex: 1 1 0;
  padding: 0 8px;
  font-size: 12px;
}

.mcp-server-list {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 0;
  overflow: auto;
}

.mcp-server-list-item {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.mcp-server-list-item:hover,
.mcp-server-list-item.is-active {
  border-color: #93c5fd;
  background: #eff6ff;
}

.mcp-server-list-title {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mcp-server-list-meta,
.mcp-empty-state,
#mcpSettingsStatus {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

#mcpSettingsStatus.is-error {
  color: var(--danger);
}

.mcp-server-editor {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
  min-height: 0;
  padding: 12px;
  overflow: auto;
}

.mcp-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(120px, 0.8fr);
  gap: 10px;
}

.mcp-transport-fields {
  display: grid;
  gap: 10px;
}

.mcp-transport-fields[hidden] {
  display: none;
}

.mcp-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.mcp-field input,
.mcp-field select,
.mcp-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  background: #ffffff;
  color: var(--ink);
  font-size: 13px;
}

.mcp-field input,
.mcp-field select {
  height: 36px;
  padding: 0 10px;
}

.mcp-field textarea {
  min-height: 74px;
  padding: 9px 10px;
  resize: vertical;
  line-height: 1.35;
}

.mcp-field input:focus,
.mcp-field select:focus,
.mcp-field textarea:focus {
  border-color: #9ab7fb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.mcp-toggle {
  justify-content: flex-start;
  min-height: 36px;
  padding: 0;
  border: 0;
}

.mcp-tool-panel {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.mcp-tool-list {
  display: grid;
  gap: 6px;
  max-height: 160px;
  overflow: auto;
}

.mcp-tool-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  font-size: 12px;
}

.mcp-tool-item span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rename-dialog-backdrop {
  position: absolute;
  z-index: 40;
  inset: 0;
  display: grid;
  place-items: start center;
  padding: max(76px, 15vh) 16px 16px;
  background: rgba(17, 24, 39, 0.28);
  backdrop-filter: blur(3px);
}

.rename-dialog-backdrop[hidden] {
  display: none;
}

.rename-dialog-card {
  display: grid;
  width: min(420px, calc(100vw - 32px));
  gap: 14px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--line) 86%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
  backdrop-filter: blur(18px);
}

.rename-dialog-header,
.rename-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rename-dialog-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: 0;
}

.rename-dialog-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

#renameDialogInput {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  background: #ffffff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

#renameDialogInput:focus {
  border-color: #9ab7fb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.rename-dialog-actions {
  justify-content: flex-end;
}

.rename-dialog-actions .text-button {
  min-width: 74px;
}

.rename-dialog-actions .text-button:disabled {
  background: #e7ebf2;
  color: #8a94a6;
}

.statusbar {
  position: absolute;
  z-index: 10;
  right: 12px;
  bottom: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 5px 6px 5px 14px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
}

#hintText {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewport-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 3px;
  border-radius: 7px;
  box-shadow: none;
}

.mini-button {
  min-width: 30px;
  height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  font-weight: 750;
}

.zoom-label {
  min-width: 54px;
  font-size: 12px;
}

.fit-viewport-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.fit-viewport-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 1320px) {
  .topbar {
    grid-template-columns: minmax(0, max-content) minmax(0, 1fr) max-content;
    grid-template-areas: "workspace . actions";
  }

  .workspace-strip {
    justify-self: start;
    max-width: 100%;
    overflow-x: auto;
  }

  .tool-strip {
    top: 58px;
  }

  .action-strip {
    justify-self: end;
    align-self: start;
  }
}

@media (max-width: 740px) {
  .topbar {
    top: 8px;
    right: 8px;
    left: 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .brand {
    display: none;
  }

  .workspace-strip,
  .tool-strip,
  .action-strip {
    max-width: 100%;
    overflow-x: auto;
  }

  .workspace-strip {
    order: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 32px 32px;
    width: 100%;
    overflow: visible;
  }

  .workspace-select-control,
  .workspace-select-control select {
    width: 100%;
  }

  .workspace-command {
    width: 32px;
    min-width: 32px;
  }

  .tool-strip {
    position: static;
    order: 2;
    flex-direction: row;
    width: 100%;
  }

  .system-tool-menu {
    top: calc(100% + 8px);
    left: 0;
  }

  .action-strip {
    order: 3;
    width: 100%;
  }

  .command-palette-backdrop {
    padding: 132px 8px 16px;
  }

  .command-palette-card {
    max-height: calc(100vh - 148px);
  }

  .command-palette-option {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .command-palette-shortcut {
    display: none;
  }

  .help-center-backdrop {
    padding: 8px;
  }

  .help-center-card {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    border-radius: 9px;
  }

  .help-center-header {
    padding: 16px;
  }

  .help-center-header h2 {
    font-size: 21px;
  }

  .help-center-header p {
    font-size: 12px;
  }

  .help-center-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .help-center-nav {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px;
  }

  .help-topic {
    width: auto;
    min-height: 38px;
    padding: 7px 11px;
    white-space: nowrap;
  }

  .help-topic.is-active::before {
    top: auto;
    right: 9px;
    bottom: 2px;
    left: 9px;
    width: auto;
    height: 3px;
  }

  .help-center-content {
    padding: 20px 18px 32px;
  }

  .help-panel h3 {
    font-size: 20px;
  }

  .help-detail-grid,
  .help-shortcut-table {
    grid-template-columns: 1fr;
  }

  .help-shortcut-table section:last-child {
    grid-column: auto;
  }

  .help-shortcut-table dl {
    grid-template-columns: 1fr;
  }

  .ai-panel {
    top: 112px;
    bottom: 68px;
    right: 8px;
    left: 8px;
    width: auto;
  }

  .ai-workspace-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .thinking-mode-rail {
    grid-auto-columns: minmax(76px, 1fr);
    grid-auto-flow: column;
    grid-template-columns: none;
    gap: 2px;
    padding: 6px 8px;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid #e2e8f0;
  }

  .thinking-mode-rail button {
    grid-template-columns: 1fr;
    justify-items: center;
    min-height: 48px;
    gap: 2px;
    padding: 4px 8px;
    text-align: center;
  }

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

  .thinking-workspace-heading {
    padding: 16px 18px 12px;
  }

  .thinking-context-control,
  .thinking-workspace-progress {
    padding-right: 18px;
    padding-left: 18px;
  }

  .thinking-mode-panel,
  .thinking-chat-panel {
    padding-right: 18px;
    padding-left: 18px;
  }

  .thinking-clarify-panel {
    padding: 0;
  }

  .thinking-clarify-content {
    padding-right: 18px;
    padding-left: 18px;
  }

  .thinking-composer-actions {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
  }

  .thinking-inline-fields {
    grid-template-columns: 1fr;
  }

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

  .mcp-settings-backdrop {
    padding: 8px;
  }

  .mcp-settings-card {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .mcp-settings-layout {
    grid-template-columns: 1fr;
  }

  .mcp-server-list-panel {
    grid-template-rows: auto auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .mcp-server-list {
    grid-auto-flow: column;
    grid-auto-columns: minmax(170px, 1fr);
    overflow-x: auto;
  }

  .mcp-editor-grid {
    grid-template-columns: 1fr;
  }

  .mcp-settings-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .mcp-settings-actions {
    justify-content: flex-end;
  }

  .inspector-panel {
    top: auto;
    right: 8px;
    bottom: 68px;
    left: 8px;
    width: auto;
    max-height: min(46vh, 360px);
  }

  .inspector-panel.is-left {
    right: 8px;
    left: 8px;
  }

  .range-control input {
    width: 100%;
    min-width: 0;
  }

  .statusbar {
    right: 8px;
    bottom: 8px;
    left: 8px;
    align-items: center;
    flex-direction: row;
    gap: 8px;
    min-height: 48px;
    padding: 6px 8px 6px 12px;
  }

  .minimap {
    bottom: 68px;
    left: 8px;
    width: 120px;
    height: 84px;
    padding: 6px;
  }

  .viewport-controls {
    flex: 0 0 auto;
  }
}
