:root {
  --bg: #f3f6fb;
  --panel: rgba(255, 255, 255, .94);
  --panel-solid: #ffffff;
  --text: #172033;
  --muted: #748096;
  --line: #e2e8f2;
  --line-strong: #ccd6e5;
  --blue: #4b74ff;
  --blue-strong: #315bea;
  --blue-soft: #edf2ff;
  --cyan: #2e9ec5;
  --cyan-soft: #eaf9fd;
  --orange: #f58a45;
  --orange-soft: #fff2e8;
  --purple: #805cf6;
  --purple-soft: #f3efff;
  --green: #27a66f;
  --green-soft: #eaf8f1;
  --red: #e05d65;
  --red-soft: #fff0f1;
  --shadow: 0 16px 42px rgba(31, 48, 80, .08);
  --shadow-float: 0 18px 45px rgba(27, 44, 75, .14);
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; }
body {
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 0%, rgba(86, 126, 255, .12), transparent 30%),
    radial-gradient(circle at 96% 95%, rgba(128, 92, 246, .08), transparent 28%),
    var(--bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid rgba(75, 116, 255, .18);
  outline-offset: 2px;
}

.app-shell {
  height: 100vh;
  padding: 12px;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  grid-template-rows: 72px minmax(0, 1fr);
  gap: 12px;
}

.topbar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(260px, 620px) auto;
  align-items: center;
  gap: 22px;
  min-width: 0;
  padding: 10px 14px 10px 12px;
  border: 1px solid rgba(221, 229, 241, .9);
  border-radius: 20px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(22px);
  box-shadow: 0 10px 35px rgba(33, 50, 79, .06);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 220px; }
.brand-mark {
  width: 46px; height: 46px;
  position: relative;
  border-radius: 14px;
  background: linear-gradient(145deg, #547dff, #735cf5);
  box-shadow: 0 11px 24px rgba(75, 116, 255, .26);
}
.brand-mark span { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: white; }
.brand-mark span:nth-child(1) { left: 10px; top: 19px; }
.brand-mark span:nth-child(2) { left: 27px; top: 10px; }
.brand-mark span:nth-child(3) { left: 27px; top: 28px; }
.brand-mark::before, .brand-mark::after {
  content: ""; position: absolute; left: 16px; width: 14px; height: 2px; background: rgba(255,255,255,.9); transform-origin: left center;
}
.brand-mark::before { top: 21px; transform: rotate(-28deg); }
.brand-mark::after { top: 23px; transform: rotate(28deg); }
.brand h1 { margin: 0; font-size: 16px; letter-spacing: -.02em; }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }

.question-bar {
  min-width: 0;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid #e1e7f1;
  border-radius: 13px;
  background: rgba(247, 249, 253, .88);
}
.question-label { flex: 0 0 auto; padding: 5px 8px; border-radius: 7px; color: var(--blue-strong); background: var(--blue-soft); font-size: 10px; font-weight: 800; }
.question-bar strong { min-width: 0; overflow: hidden; color: #3b465b; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { display: flex; justify-content: flex-end; gap: 8px; }
.soft-button, .toolbar-button, .toolbar-group button {
  border: 1px solid #dce4ef;
  border-radius: 10px;
  color: #4d5b71;
  background: rgba(255,255,255,.9);
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}
.soft-button { padding: 8px 11px; font-size: 11px; font-weight: 700; }
.soft-button:hover, .toolbar-button:hover, .toolbar-group button:hover { color: var(--blue-strong); border-color: #bfcdf0; background: var(--blue-soft); }

.left-rail {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  min-height: 0;
  padding: 10px 8px;
  border: 1px solid rgba(220, 228, 240, .92);
  border-radius: 22px;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}
.rail-button {
  width: 56px; min-height: 51px;
  display: grid; place-items: center;
  gap: 1px;
  border: 0; border-radius: 14px;
  color: #7d889b; background: transparent;
  font-size: 10px; font-weight: 700;
  transition: .16s ease;
}
.rail-icon { font-size: 20px; font-weight: 500; line-height: 1; }
.rail-button:hover { color: var(--blue); background: #f3f6fc; }
.rail-button.active { color: var(--blue); background: var(--blue-soft); }
.rail-button.primary { min-height: 48px; color: white; background: linear-gradient(145deg, #557dff, #4368ed); font-size: 24px; box-shadow: 0 10px 22px rgba(75,116,255,.26); }
.rail-button.primary:hover { transform: translateY(-1px); }
.rail-spacer { flex: 1; }

.workspace {
  grid-column: 2;
  grid-row: 2;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 12px;
}
.canvas-panel, .inspector {
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(220, 228, 240, .95);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.canvas-panel { position: relative; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; min-width: 0; }

.canvas-toolbar {
  min-height: 58px;
  padding: 9px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #e8edf5;
  background: rgba(255,255,255,.92);
  z-index: 5;
}
.toolbar-section, .toolbar-group { display: flex; align-items: center; gap: 7px; }
.toolbar-section { min-width: 0; flex-wrap: wrap; }
.toolbar-right { flex: 0 0 auto; }
.toolbar-group button { min-width: 34px; height: 34px; padding: 0 9px; font-size: 12px; font-weight: 800; }
.toolbar-group .zoom-label { min-width: 52px; color: #5d6a80; }
.toolbar-divider { width: 1px; height: 25px; margin: 0 3px; background: #e3e8f0; }
.toolbar-button { height: 34px; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 750; }
.toolbar-button.active { color: white; border-color: var(--blue); background: var(--blue); box-shadow: 0 7px 16px rgba(75,116,255,.22); }
.toolbar-button.danger:not(:disabled) { color: var(--red); }
.toolbar-button.danger:not(:disabled):hover { border-color: #f0bcc0; background: var(--red-soft); }
.toolbar-button:disabled { opacity: .4; cursor: not-allowed; }

.focus-switch { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.focus-switch > span { display: grid; text-align: right; }
.focus-switch b { color: #4b586f; font-size: 11px; }
.focus-switch small { margin-top: 2px; color: #96a0b1; font-size: 9px; }
.focus-switch input { position: absolute; opacity: 0; pointer-events: none; }
.focus-switch i { width: 38px; height: 22px; position: relative; border-radius: 999px; background: #cdd5e2; transition: .18s ease; }
.focus-switch i::after { content: ""; width: 16px; height: 16px; position: absolute; top: 3px; left: 3px; border-radius: 50%; background: white; box-shadow: 0 2px 7px rgba(23,32,51,.2); transition: transform .18s ease; }
.focus-switch input:checked + i { background: var(--blue); }
.focus-switch input:checked + i::after { transform: translateX(16px); }

.interaction-hint {
  min-height: 28px;
  padding: 6px 14px;
  display: flex; align-items: center; gap: 7px;
  color: #7d899b; background: #fbfcfe;
  border-bottom: 1px solid #edf1f6;
  font-size: 9px;
}
.hint-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 4px rgba(75,116,255,.10); }
.interaction-hint.connecting { color: #8a5b27; background: #fffaf4; }
.interaction-hint.connecting .hint-dot { background: var(--orange); box-shadow: 0 0 0 4px rgba(245,138,69,.12); }

.map-viewport {
  min-height: 520px;
  position: relative;
  overflow: hidden;
  cursor: default;
  touch-action: none;
  background-color: #f9fbfe;
  background-image:
    linear-gradient(rgba(224,230,240,.42) 1px, transparent 1px),
    linear-gradient(90deg, rgba(224,230,240,.42) 1px, transparent 1px),
    radial-gradient(circle at 48% 45%, rgba(87,128,255,.06), transparent 38%);
  background-size: 24px 24px, 24px 24px, auto;
}
.map-viewport.is-panning { cursor: grabbing; }
.map-viewport.connect-mode { cursor: crosshair; }
.map-stage {
  width: 1600px;
  height: 1000px;
  position: absolute;
  left: 0; top: 0;
  transform-origin: 0 0;
  will-change: transform;
}
.edge-layer, .node-layer { position: absolute; inset: 0; width: 100%; height: 100%; }
.edge-layer { overflow: visible; z-index: 1; }
.node-layer { z-index: 2; pointer-events: none; }
.edge-visible {
  fill: none;
  stroke: #c8d3e2;
  stroke-width: 2.1;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
  transition: opacity .18s ease, stroke .18s ease, stroke-width .18s ease;
}
.edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 15;
  pointer-events: stroke;
  cursor: pointer;
  vector-effect: non-scaling-stroke;
}
.edge-group:hover .edge-visible { stroke: #8ca3c6; stroke-width: 3; }
.edge-group.upstream .edge-visible { stroke: var(--cyan); stroke-width: 3.2; filter: drop-shadow(0 0 3px rgba(46,158,197,.18)); }
.edge-group.downstream .edge-visible { stroke: var(--orange); stroke-width: 3.2; filter: drop-shadow(0 0 3px rgba(245,138,69,.18)); }
.edge-group.selected .edge-visible { stroke: var(--purple); stroke-width: 4; filter: drop-shadow(0 0 5px rgba(128,92,246,.26)); }
.edge-group.dimmed { opacity: .13; }
.edge-group.processing .edge-visible { stroke-dasharray: 9 6; animation: dash .7s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -30; } }

.map-node {
  width: 208px;
  min-height: 92px;
  position: absolute;
  padding: 13px 14px 12px;
  pointer-events: auto;
  border: 1px solid #dbe3ef;
  border-radius: 17px;
  color: var(--text);
  background: rgba(255,255,255,.98);
  box-shadow: 0 8px 24px rgba(28,46,78,.09);
  text-align: left;
  user-select: none;
  touch-action: none;
  transition: border-color .16s ease, box-shadow .16s ease, opacity .16s ease, filter .16s ease, transform .16s ease;
}
.map-node:hover { border-color: #bdcbe0; box-shadow: 0 13px 31px rgba(28,46,78,.14); transform: translateY(-1px); }
.map-node.dragging { z-index: 20; cursor: grabbing; transition: none; box-shadow: 0 22px 48px rgba(28,46,78,.2); transform: scale(1.015); }
.map-node.selected { z-index: 5; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(75,116,255,.12), 0 15px 34px rgba(28,46,78,.15); }
.map-node.upstream { border-color: rgba(46,158,197,.72); background: linear-gradient(145deg, #ffffff, #f3fcff); box-shadow: 0 0 0 3px rgba(46,158,197,.09), 0 10px 25px rgba(28,46,78,.10); }
.map-node.downstream { border-color: rgba(245,138,69,.72); background: linear-gradient(145deg, #ffffff, #fff8f2); box-shadow: 0 0 0 3px rgba(245,138,69,.09), 0 10px 25px rgba(28,46,78,.10); }
.map-node.dimmed { opacity: .21; filter: saturate(.3); }
.map-node.connect-source { border-color: var(--purple); box-shadow: 0 0 0 5px rgba(128,92,246,.14), 0 15px 34px rgba(28,46,78,.15); }
.map-node.processing { border-color: var(--blue); animation: nodePulse 1s ease-in-out infinite; }
@keyframes nodePulse { 50% { box-shadow: 0 0 0 8px rgba(75,116,255,.14), 0 16px 35px rgba(28,46,78,.15); } }
.map-node.root {
  width: 248px;
  min-height: 132px;
  padding: 20px;
  border: 0;
  color: white;
  background: linear-gradient(145deg, #587fff 0%, #4167ea 55%, #6c58e9 100%);
  box-shadow: 0 19px 42px rgba(65,103,234,.28);
}
.map-node.root:hover { box-shadow: 0 22px 48px rgba(65,103,234,.34); }
.map-node.root .node-kicker, .map-node.root .node-summary, .map-node.root .node-confidence { color: rgba(255,255,255,.78); }
.map-node.root .node-type-icon { color: white; background: rgba(255,255,255,.16); }
.map-node.root .confidence-bar { background: rgba(255,255,255,.18); }
.map-node.root .confidence-bar i { background: white; }
.node-top { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.node-type-icon { width: 26px; height: 26px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 8px; color: var(--blue); background: var(--blue-soft); font-size: 12px; font-weight: 900; }
.node-kicker { min-width: 0; overflow: hidden; color: #8994a6; font-size: 9px; font-weight: 800; text-overflow: ellipsis; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.node-lock { margin-left: auto; color: #7f8ba0; font-size: 11px; }
.map-node h4 { margin: 0 0 6px; font-size: 14px; line-height: 1.28; }
.map-node.root h4 { font-size: 17px; line-height: 1.35; }
.node-summary { min-height: 30px; margin: 0; overflow: hidden; color: #69768b; font-size: 10px; line-height: 1.48; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.node-bottom { margin-top: 11px; display: flex; align-items: center; gap: 9px; }
.node-confidence { flex: 1; color: #8792a5; font-size: 9px; }
.confidence-bar { height: 3px; margin-top: 4px; overflow: hidden; border-radius: 999px; background: #e9edf3; }
.confidence-bar i { height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--purple)); }
.node-status { padding: 4px 6px; border-radius: 999px; color: #25815a; background: var(--green-soft); font-size: 8px; font-weight: 800; }
.node-status.processing { color: var(--blue-strong); background: var(--blue-soft); }
.node-status.affected { color: #bc642c; background: var(--orange-soft); }

.canvas-empty-tip {
  position: absolute;
  left: 50%; bottom: 18px;
  padding: 7px 10px;
  border: 1px solid rgba(215,224,237,.9);
  border-radius: 999px;
  color: #929daf;
  background: rgba(255,255,255,.8);
  backdrop-filter: blur(10px);
  font-size: 9px;
  transform: translateX(-50%);
  pointer-events: none;
}
.canvas-footer {
  min-height: 42px;
  padding: 8px 13px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  border-top: 1px solid #e8edf5;
  background: rgba(252,253,255,.96);
}
.graph-stats, .legend { display: flex; align-items: center; gap: 14px; color: #78859a; font-size: 9px; }
.graph-stats span, .legend span { display: inline-flex; align-items: center; gap: 6px; }
.graph-stats b { color: #4b586f; }
.stat-dot { width: 7px; height: 7px; border-radius: 50%; }
.stat-dot.nodes { background: var(--blue); }
.stat-dot.edges { background: var(--purple); }
.legend-line { width: 20px; height: 2px; border-radius: 4px; }
.legend-line.upstream { background: var(--cyan); }
.legend-line.downstream { background: var(--orange); }
.legend-line.neutral { background: #c8d3e2; }

.inspector { display: flex; flex-direction: column; overflow-y: auto; }
.inspector-header {
  position: sticky; top: 0; z-index: 10;
  padding: 18px 18px 14px;
  display: flex; justify-content: space-between; align-items: flex-start;
  border-bottom: 1px solid #e8edf5;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(16px);
}
.inspector-header h2 { margin: 0; font-size: 17px; }
.inspector-header p { margin: 4px 0 0; color: var(--muted); font-size: 9px; letter-spacing: .1em; }
.status-pill { padding: 6px 8px; border-radius: 999px; color: #25815a; background: var(--green-soft); font-size: 9px; font-weight: 800; }
.inspector-section { padding: 15px 18px; border-bottom: 1px solid #edf1f6; }
.selected-card { margin: 14px 14px 0; border: 1px solid #dfe6f0; border-radius: 16px; background: linear-gradient(145deg, #ffffff, #f9fbfe); box-shadow: 0 8px 22px rgba(37,53,82,.05); }
.eyebrow { margin: 0 0 8px; color: var(--blue); font-size: 9px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.selected-card h3 { margin: 0 0 6px; font-size: 16px; }
.selected-card > p:not(.eyebrow) { margin: 0; color: #68758a; font-size: 11px; line-height: 1.5; }
.meta-row { margin-top: 12px; display: flex; justify-content: space-between; gap: 8px; color: #8490a3; font-size: 9px; }
.field-label { display: block; margin-bottom: 8px; color: #445167; font-size: 11px; font-weight: 800; }
textarea, input, select {
  width: 100%;
  border: 1px solid #d8e1ed;
  border-radius: 11px;
  color: var(--text);
  background: white;
  outline: 0;
}
textarea { padding: 11px 12px; resize: vertical; line-height: 1.55; }
input, select { height: 40px; padding: 0 11px; }
textarea:focus, input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(75,116,255,.09); }
.field-footer { margin-top: 8px; display: flex; justify-content: space-between; align-items: center; color: #8793a6; font-size: 9px; }
.lock-toggle, .dialog-check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.lock-toggle input, .dialog-check input { width: 15px; height: 15px; accent-color: var(--blue); }
.section-heading { margin-bottom: 11px; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.section-heading h3 { margin: 0; font-size: 12px; }
.section-heading p { margin: 4px 0 0; color: #8b96a8; font-size: 9px; }
.ai-badge { padding: 5px 7px; border-radius: 7px; color: white; background: linear-gradient(145deg, var(--blue), var(--purple)); font-size: 9px; font-weight: 900; }
.deep-actions { display: grid; gap: 8px; }
.deep-action {
  width: 100%;
  padding: 10px;
  display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px;
  border: 1px solid #dfe6f0; border-radius: 12px;
  color: #425068; background: white; text-align: left;
  transition: .16s ease;
}
.deep-action:hover { transform: translateY(-1px); box-shadow: 0 9px 20px rgba(34,50,78,.08); }
.deep-action.downstream:hover { border-color: #f2bd99; background: #fffaf6; }
.deep-action.parallel:hover { border-color: #c9bbfa; background: #fbf9ff; }
.action-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; font-size: 16px; font-weight: 900; }
.downstream .action-icon { color: #c96c32; background: var(--orange-soft); }
.parallel .action-icon { color: #6748d0; background: var(--purple-soft); }
.deep-action > span:nth-child(2) { min-width: 0; display: grid; gap: 2px; }
.deep-action b { font-size: 11px; }
.deep-action small { color: #8894a6; font-size: 9px; }
.action-arrow { color: #9ca7b7; font-size: 20px; }
.action-stack { display: grid; gap: 8px; }
.primary-action, .secondary-action, .danger-action {
  width: 100%; min-height: 39px;
  border-radius: 11px;
  font-size: 10px; font-weight: 800;
  transition: transform .16s ease, opacity .16s ease, box-shadow .16s ease, background .16s ease;
}
.primary-action { border: 0; color: white; background: linear-gradient(135deg, #4b74ff, #735cf5); box-shadow: 0 9px 20px rgba(75,116,255,.22); }
.primary-action:hover:not(:disabled) { transform: translateY(-1px); }
.primary-action:disabled, .secondary-action:disabled, .deep-action:disabled { opacity: .45; cursor: not-allowed; }
.secondary-action { border: 1px solid #d9e1ed; color: #4d5a70; background: white; }
.secondary-action:hover:not(:disabled) { border-color: #becbe0; background: #f8faff; }
.danger-action { border: 1px solid #f0c1c4; color: var(--red); background: var(--red-soft); }
.section-title-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.section-title-row h3 { margin: 0; font-size: 12px; }
.section-title-row > span { color: var(--blue); font-size: 9px; font-weight: 800; }
.impact-caption { margin: 11px 0 7px; color: #bd672f; font-size: 9px; font-weight: 800; }
.upstream-caption { color: #267e9e; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-list span { padding: 5px 7px; border-radius: 7px; font-size: 9px; font-weight: 700; }
.upstream-tags span { color: #277b98; background: var(--cyan-soft); }
.downstream-tags span { color: #b8622e; background: var(--orange-soft); }
.live-indicator { display: inline-flex !important; align-items: center; gap: 5px; color: #23875a !important; }
.live-indicator i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(39,166,111,.10); }
.activity-log { margin: 11px 0 0; padding: 0; display: grid; gap: 9px; list-style: none; }
.activity-log li { position: relative; padding-left: 16px; color: #6e7a8e; font-size: 9px; line-height: 1.5; }
.activity-log li::before { content: ""; position: absolute; left: 1px; top: 5px; width: 6px; height: 6px; border-radius: 50%; background: #aab6c7; }
.activity-log li strong { color: #3e4b61; }
.edge-route { display: flex; align-items: center; gap: 8px; color: #59657a; font-size: 11px; }
.edge-route strong { padding: 6px 8px; border-radius: 8px; background: #f0f4fa; }
.empty-inspector { min-height: 460px; padding: 50px 28px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-inspector[hidden], .edge-inspector[hidden], #nodeInspector[hidden] { display: none !important; }
.empty-illustration { width: 108px; height: 70px; position: relative; margin-bottom: 20px; }
.empty-illustration i { position: absolute; width: 28px; height: 20px; border: 2px solid #c8d4e6; border-radius: 7px; background: #f9fbfe; }
.empty-illustration i:nth-child(1) { left: 0; top: 25px; }
.empty-illustration i:nth-child(2) { right: 0; top: 5px; }
.empty-illustration i:nth-child(3) { right: 0; bottom: 0; }
.empty-illustration::before, .empty-illustration::after { content: ""; position: absolute; left: 28px; width: 52px; height: 2px; background: #d6dfec; transform-origin: left center; }
.empty-illustration::before { top: 34px; transform: rotate(-22deg); }
.empty-illustration::after { top: 38px; transform: rotate(20deg); }
.empty-inspector h3 { margin: 0; font-size: 15px; }
.empty-inspector p { max-width: 280px; margin: 9px 0 18px; color: #7c889a; font-size: 10px; line-height: 1.6; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 50;
  padding: 10px 14px;
  border-radius: 11px;
  color: white; background: rgba(23,32,51,.94);
  box-shadow: 0 15px 35px rgba(0,0,0,.2);
  font-size: 11px;
  opacity: 0; pointer-events: none;
  transform: translate(-50%, 22px);
  transition: .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.modal-dialog {
  width: min(520px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid #dfe6f0;
  border-radius: 18px;
  background: white;
  box-shadow: 0 35px 90px rgba(21,34,56,.27);
}
.modal-dialog::backdrop { background: rgba(25,35,52,.28); backdrop-filter: blur(6px); }
.modal-dialog form { padding: 20px; }
.dialog-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dialog-header h2 { margin: 0; font-size: 17px; }
.dialog-header p { margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.icon-close { width: 32px; height: 32px; border: 0; border-radius: 9px; color: #657188; background: #f1f4f8; font-size: 19px; }
.form-grid { margin-top: 17px; display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid label { display: grid; gap: 7px; color: #4d5a6e; font-size: 10px; font-weight: 750; }
.full-width { grid-column: 1 / -1; }
.dialog-check { display: flex !important; grid-template-columns: auto 1fr; font-weight: 500 !important; }
.dialog-actions { margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.history-dialog { width: min(570px, calc(100vw - 28px)); }
.history-list { margin-top: 16px; display: grid; gap: 9px; max-height: 52vh; overflow: auto; }
.history-item { padding: 11px; border: 1px solid #e1e7f0; border-radius: 11px; background: #fbfdff; }
.history-item h4 { margin: 0 0 5px; font-size: 11px; }
.history-item p { margin: 3px 0 0; color: #6c788c; font-size: 10px; line-height: 1.48; }
.history-item time { display: block; margin-top: 7px; color: #9aa5b5; font-size: 8px; }
.secondary-action.full { margin-top: 15px; }

@media (max-width: 1180px) {
  .topbar { grid-template-columns: auto minmax(260px, 1fr) auto; }
  .workspace { grid-template-columns: minmax(0, 1fr) 330px; }
  .focus-switch > span { display: none; }
}
@media (max-width: 920px) {
  body { overflow: auto; }
  .app-shell { height: auto; min-height: 100vh; display: block; padding: 8px; }
  .topbar { display: flex; margin-bottom: 8px; }
  .question-bar { flex: 1; }
  .brand p, .top-actions { display: none; }
  .left-rail { display: none; }
  .workspace { display: block; }
  .canvas-panel { height: 76vh; min-height: 610px; }
  .inspector { margin-top: 8px; max-height: none; }
}
@media (max-width: 640px) {
  .topbar { padding: 9px; border-radius: 16px; }
  .brand { min-width: auto; }
  .brand h1 { font-size: 13px; }
  .brand-mark { width: 39px; height: 39px; }
  .brand-mark span:nth-child(1) { left: 8px; top: 16px; }
  .brand-mark span:nth-child(2) { left: 23px; top: 8px; }
  .brand-mark span:nth-child(3) { left: 23px; top: 24px; }
  .brand-mark::before { left: 14px; top: 18px; }
  .brand-mark::after { left: 14px; top: 21px; }
  .question-bar { padding: 8px 10px; }
  .question-label { display: none; }
  .canvas-panel, .inspector { border-radius: 16px; }
  .canvas-toolbar { align-items: flex-start; }
  .toolbar-section { gap: 5px; }
  .toolbar-divider, .toolbar-button span:first-child { display: none; }
  .toolbar-button { padding: 0 8px; }
  .zoom-group button:not(#fitBtn), .focus-switch { display: none; }
  .interaction-hint { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .legend { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .full-width { grid-column: auto; }
}
