:root {
  color-scheme: dark;
  --bg: #05070d;
  --bg-2: #09111f;
  --panel: rgba(11, 17, 30, 0.88);
  --panel-strong: rgba(14, 22, 38, 0.96);
  --border: rgba(126, 255, 169, 0.12);
  --border-strong: rgba(126, 255, 169, 0.2);
  --text: #edf4ff;
  --muted: #9aa8c7;
  --accent: #7effa9;
  --accent-2: #73d9ff;
  --accent-3: #d1ff7a;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(126, 255, 169, 0.12), transparent 24%),
    radial-gradient(circle at top right, rgba(115, 217, 255, 0.12), transparent 24%),
    linear-gradient(180deg, #0b1020 0%, #05070d 100%);
}

body {
  padding: clamp(14px, 2vw, 28px);
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 100% 42px, 42px 100%;
  opacity: 0.35;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.75), transparent 92%);
}

a { color: inherit; text-decoration: none; }

.shell {
  max-width: 1600px;
  margin: 0 auto;
}

.app-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.workspace {
  display: grid;
  gap: 20px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  overflow: hidden;
}

.sidebar {
  position: sticky;
  top: 18px;
  padding: 22px;
  display: grid;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #06100a;
  background: linear-gradient(135deg, rgba(126, 255, 169, 0.95), rgba(115, 217, 255, 0.82));
  box-shadow: 0 0 0 1px rgba(126, 255, 169, 0.25), 0 18px 40px rgba(126, 255, 169, 0.08);
}

.kicker {
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 11px;
  color: var(--accent);
}

.sidebar h2,
.hero-main h1,
.result h2 {
  margin: 0;
}

.sidebar-note,
.lead {
  color: var(--muted);
  line-height: 1.65;
}

.sidebar-nav {
  display: grid;
  gap: 8px;
}

.sidebar-nav a {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.03);
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.sidebar-nav a:hover {
  transform: translateY(-1px);
  border-color: rgba(126, 255, 169, 0.24);
  background: rgba(126, 255, 169, 0.08);
}

.sidebar-footer {
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.direct-link {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.direct-link code {
  display: block;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(11, 17, 30, 0.95);
  border: 1px solid rgba(126, 255, 169, 0.12);
  color: var(--accent);
  word-break: break-all;
  font-size: 0.92rem;
}

.muted-title {
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.small { font-size: 0.88rem; }

.hero-main {
  padding: clamp(20px, 2.2vw, 30px);
  position: relative;
  min-height: 280px;
}

.hero-main::after {
  content: "";
  position: absolute;
  inset: auto -50px -60px auto;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(126, 255, 169, 0.13), transparent 70%);
}

.hero-top {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.hero-main h1 {
  font-size: clamp(2.2rem, 4vw, 4.8rem);
  line-height: 0.94;
  letter-spacing: -0.04em;
  margin-top: 8px;
  text-shadow: 0 0 24px rgba(126, 255, 169, 0.12);
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-meta,
.meta,
.actions,
.assistant-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-meta {
  margin-top: 22px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(126, 255, 169, 0.08);
  border: 1px solid rgba(126, 255, 169, 0.15);
  color: var(--text);
  font-size: 0.92rem;
}

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

.stat {
  padding: 16px;
  border-radius: 18px;
  background: var(--panel-strong);
  border: 1px solid var(--border);
}

.stat strong {
  display: block;
  font-size: 1.5rem;
  letter-spacing: -0.03em;
}

.stat span {
  color: var(--muted);
  font-size: 0.9rem;
}

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

.card {
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(13, 19, 34, 0.96), rgba(10, 15, 27, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.06);
  min-height: 132px;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 1.08rem;
}

.card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

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

.proposal-card {
  min-height: 170px;
}

.proposal-card p {
  min-height: 72px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip-soft {
  padding: 8px 12px;
  background: rgba(115, 217, 255, 0.08);
  border-color: rgba(115, 217, 255, 0.14);
  font-size: 0.84rem;
}

.section-head,
.support-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
}

.section-head h1,
.section-head h2,
.support-head h1,
.support-head h2 {
  margin-bottom: 6px;
  font-size: clamp(1.5rem, 2.8vw, 2.2rem);
}

.section-head .lead,
.support-head .lead {
  max-width: 850px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.12fr 0.88fr;
  gap: 20px;
}

.layout-stack {
  display: grid;
  gap: 16px;
}

.result {
  padding: clamp(18px, 2vw, 24px);
}

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

.sheet-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.sheet-item {
  padding: 14px;
  border-radius: 16px;
  background: rgba(11, 17, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.sheet-item span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
}

.sheet-item strong {
  display: block;
  margin-top: 6px;
}

.sheet-meta {
  color: var(--muted);
  font-size: 0.88rem;
}

.metric {
  padding: 16px;
  border-radius: 18px;
  background: rgba(11, 17, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 1.18rem;
  letter-spacing: -0.02em;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  font-size: 0.94rem;
  color: var(--muted);
}

.field-help {
  color: rgba(154, 168, 199, 0.82);
  font-size: 0.84rem;
  line-height: 1.45;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #0b1322;
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(126, 255, 169, 0.38);
  box-shadow: 0 0 0 3px rgba(126, 255, 169, 0.1);
}

.field textarea {
  min-height: 120px;
  resize: vertical;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(126, 255, 169, 0.18);
  background: linear-gradient(135deg, rgba(126, 255, 169, 0.16), rgba(115, 217, 255, 0.12));
  color: var(--text);
  font-weight: 700;
  transition: transform 120ms ease, border-color 120ms ease, filter 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(126, 255, 169, 0.32);
  filter: brightness(1.05);
}

.btn.secondary {
  background: rgba(11, 17, 30, 0.92);
}

.table-wrap {
  overflow: auto;
  margin-top: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.9rem;
}

.svg-frame {
  overflow: auto;
  border-radius: 18px;
  background: #050913;
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 14px;
}

.svg-frame svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}

.search-results {
  margin-top: 16px;
}

.support-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.support-card {
  min-height: 164px;
}

.support-card h3 {
  margin-top: 10px;
  min-height: 46px;
}

.support-card p {
  min-height: 42px;
  word-break: break-word;
}

.support-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.support-badge,
.support-type {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.support-badge {
  background: rgba(126, 255, 169, 0.1);
  border: 1px solid rgba(126, 255, 169, 0.18);
  color: var(--accent);
}

.support-type {
  background: rgba(115, 217, 255, 0.08);
  border: 1px solid rgba(115, 217, 255, 0.14);
  color: var(--accent-2);
}

.support-feature {
  min-height: 100%;
}

.support-feature h3 {
  margin-top: 10px;
  font-size: 1.4rem;
}

.support-feature code {
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(11, 17, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.assistant-card {
  display: grid;
  gap: 16px;
}

.assistant-answer {
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(126, 255, 169, 0.12), rgba(115, 217, 255, 0.08));
  border: 1px solid rgba(126, 255, 169, 0.18);
  line-height: 1.65;
}

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

.assistant-column {
  display: grid;
  gap: 10px;
}

.assistant-item {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(11, 17, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: grid;
  gap: 4px;
}

.assistant-item strong {
  font-size: 0.98rem;
}

.assistant-item span {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.empty-state {
  display: grid;
  gap: 8px;
}

.tool-active {
  border-color: rgba(126, 255, 169, 0.78) !important;
  background: linear-gradient(135deg, rgba(126, 255, 169, 0.34), rgba(115, 217, 255, 0.22)) !important;
  box-shadow: 0 0 0 3px rgba(126, 255, 169, 0.12), 0 14px 30px rgba(126, 255, 169, 0.1);
  transform: translateY(-1px);
}

.editor-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.editor-sidebar {
  position: sticky;
  top: 18px;
  padding: 22px;
  display: grid;
  gap: 18px;
}

.editor-toolbar {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 20px;
  background: rgba(11, 17, 30, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.editor-inspector {
  padding: 16px;
  border-radius: 20px;
  background: rgba(11, 17, 30, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: grid;
  gap: 12px;
}

.editor-empty {
  color: var(--muted);
  line-height: 1.6;
}

.editor-workspace {
  display: grid;
  gap: 20px;
}

.editor-hero {
  padding: clamp(18px, 2vw, 26px);
}

.editor-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  min-width: 320px;
}

.editor-stage-panel {
  padding: 18px;
}

.editor-stage-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.editor-hints {
  color: var(--muted);
  font-size: 0.92rem;
}

.editor-active-tool {
  flex: 0 0 auto;
  max-width: 420px;
  border-radius: 999px;
  padding: 11px 15px;
  background: linear-gradient(135deg, rgba(126, 255, 169, 0.16), rgba(115, 217, 255, 0.12));
  border: 1px solid rgba(126, 255, 169, 0.24);
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 800;
}

.editor-quickbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px;
  margin-bottom: 14px;
  border-radius: 20px;
  background: rgba(11, 17, 30, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.editor-quickbar button {
  border: 1px solid rgba(126, 255, 169, 0.16);
  border-radius: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 13px;
  cursor: pointer;
  font-weight: 800;
}

.editor-layerbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  margin: -4px 0 14px;
  border-radius: 18px;
  background: rgba(5, 9, 19, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.editor-layerbar button {
  border: 1px solid rgba(126, 255, 169, 0.18);
  border-radius: 999px;
  background: rgba(126, 255, 169, 0.08);
  color: var(--text);
  padding: 9px 13px;
  cursor: pointer;
  font-weight: 800;
}

.editor-layerbar button.layer-hidden {
  opacity: 0.58;
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.editor-tool-btn {
  width: 100%;
}

.editor-stage {
  overflow: auto;
  border-radius: 22px;
  background: #041019;
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 12px;
}

.editor-canvas {
  width: 100%;
  min-width: 960px;
  height: auto;
  display: block;
  border-radius: 18px;
}

.editor-canvas.is-placing {
  cursor: crosshair;
}

.editor-canvas.is-linking {
  cursor: cell;
}

.editor-link {
  fill: none;
  stroke-width: 4;
  marker-end: url(#editor-arrow);
  vector-effect: non-scaling-stroke;
}

.editor-link-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 26;
  pointer-events: stroke;
  cursor: pointer;
}

.editor-link-group.is-selected .editor-link,
.editor-node.is-selected .editor-node-body {
  filter: drop-shadow(0 0 12px rgba(126, 255, 169, 0.45));
  stroke-width: 3.5;
}

.editor-node.is-link-source .editor-node-body {
  filter: drop-shadow(0 0 16px rgba(255, 209, 102, 0.55));
  stroke: #ffd166;
  stroke-width: 4;
}

.editor-link-label {
  fill: var(--text);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.editor-node {
  cursor: move;
}

.editor-node .editor-node-body {
  transition: filter 120ms ease, stroke 120ms ease, opacity 120ms ease;
}

.editor-node-hit {
  fill: transparent;
  stroke: transparent;
  pointer-events: all;
  cursor: move;
}

.editor-node-label {
  font-weight: 800;
  pointer-events: none;
}

.editor-node-kind {
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  pointer-events: none;
}

.editor-resize-hit {
  fill: var(--accent);
  stroke: #06111d;
  stroke-width: 3;
  cursor: nwse-resize;
  filter: drop-shadow(0 0 10px rgba(126, 255, 169, 0.5));
}

.editor-canvas-tag {
  fill: #7effa9;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.24em;
}

.editor-canvas-title {
  fill: #edf4ff;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.editor-canvas-subtitle {
  fill: rgba(237, 244, 255, 0.82);
  font-size: 14px;
}

.editor-form {
  display: grid;
  gap: 12px;
}

.editor-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
}

.editor-form input,
.editor-form select {
  width: 100%;
}

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

.editor-form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
}

.editor-form-grid input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #0b1322;
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}

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

.editor-grid-actions button,
.editor-direction-pad button {
  border: 1px solid rgba(126, 255, 169, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  padding: 11px 12px;
  cursor: pointer;
  font-weight: 800;
}

.editor-direction-pad {
  display: grid;
  grid-template-columns: repeat(3, 48px);
  grid-template-areas:
    ". up ."
    "left right down";
  justify-content: center;
  gap: 8px;
}

.editor-direction-pad [data-grow-direction="up"] { grid-area: up; }
.editor-direction-pad [data-grow-direction="left"] { grid-area: left; }
.editor-direction-pad [data-grow-direction="right"] { grid-area: right; }
.editor-direction-pad [data-grow-direction="down"] { grid-area: down; }

.editor-direction-pad button {
  min-height: 46px;
  font-size: 1.22rem;
  background: linear-gradient(135deg, rgba(126, 255, 169, 0.13), rgba(115, 217, 255, 0.08));
}

.editor-grid-actions button:hover,
.editor-direction-pad button:hover,
.editor-quickbar button:hover {
  border-color: rgba(126, 255, 169, 0.36);
  transform: translateY(-1px);
}

.editor-check {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.editor-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.footer {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 8px 0 24px;
}

.workspace > .panel {
  position: relative;
}

.workspace > .panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(126, 255, 169, 0.02), transparent 18%);
  pointer-events: none;
}

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

  .sidebar {
    position: static;
  }

  .section-grid,
  .result-grid,
  .assistant-columns,
  .sheet-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .editor-sidebar {
    position: static;
  }

  .editor-summary {
    min-width: 0;
  }
}

@media (max-width: 1400px) {
  .section-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 780px) {
  body {
    padding: 16px;
  }

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

  .form-grid,
  .section-grid,
  .result-grid,
  .stats,
  .assistant-columns,
  .sheet-grid,
  .proposal-grid,
  .support-grid,
  .editor-form-grid,
  .editor-summary {
    grid-template-columns: 1fr;
  }

  .hero-main h1 {
    font-size: clamp(2rem, 11vw, 3.6rem);
  }

  .editor-canvas {
    min-width: 760px;
  }

  .card,
  .metric,
  .stat,
  .assistant-item,
  .editor-toolbar,
  .editor-inspector {
    border-radius: 18px;
  }

  .direct-link code {
    font-size: 0.86rem;
  }
}
