:root {
  color-scheme: light;
  --ink: #142033;
  --muted: #657084;
  --line: #d7dfeb;
  --paper: #f4f7fb;
  --surface: rgba(255, 255, 255, 0.9);
  --white: #fff;
  --teal: #0f766e;
  --shadow: 0 20px 55px rgba(20, 32, 51, 0.13);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 12%, rgba(15, 118, 110, 0.18), transparent 28%),
    radial-gradient(circle at 86% 18%, rgba(37, 99, 235, 0.15), transparent 25%),
    linear-gradient(180deg, #eef5f8 0%, var(--paper) 46%, #f8fafc 100%);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
}

button, input, select, textarea { font: inherit; }

button, .button-like {
  min-height: 38px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
}

.quiet { background: var(--white); color: var(--ink); }
#importData { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.app-shell { width: min(1500px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 42px; }
.app-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 6px 0 18px; }
.eyebrow, label span, .metric-strip span, .root-node span, .node-card small { color: var(--muted); font-size: 12px; font-weight: 850; letter-spacing: 0.02em; }
h1, h2, h3, p { margin: 0; }
h1 { margin-top: 8px; max-width: 100%; font-size: clamp(34px, 5.4vw, 76px); line-height: 0.96; letter-spacing: 0; overflow-wrap: anywhere; word-break: break-word; }
.header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }

.overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 12px 0 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.66);
}

label { display: grid; gap: 7px; }
input, select, textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 750;
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); outline: 4px solid rgba(15, 118, 110, 0.14); }

.metric-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.metric-strip article { min-height: 88px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 16px; box-shadow: 0 12px 34px rgba(20, 32, 51, 0.08); }
.metric-strip strong { display: block; margin-top: 8px; font-size: 32px; line-height: 1; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 430px); gap: 16px; align-items: stretch; }
.map-panel, .editor-panel { border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, 0.78); box-shadow: var(--shadow); }
.map-panel { min-height: 720px; overflow: hidden; }
.map-canvas { position: relative; min-height: 720px; height: 72vh; padding: 24px; }
#connectorLayer, .node-layer { position: absolute; inset: 0; }
#connectorLayer { width: 100%; height: 100%; pointer-events: none; }

.root-node {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  display: grid;
  width: min(280px, 70vw);
  min-height: 190px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: linear-gradient(160deg, rgba(255,255,255,0.98), rgba(239,247,249,0.92));
  color: var(--ink);
  padding: 34px 24px;
  place-items: center;
  text-align: center;
  transform: translate(-50%, -50%);
  box-shadow: 0 24px 70px rgba(20, 32, 51, 0.2);
}

.root-node textarea {
  min-height: 76px;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: center;
  font-size: 26px;
  line-height: 1.15;
  font-weight: 950;
  overflow-wrap: anywhere;
  resize: none;
}
.root-node textarea:focus { outline: 0; }

.node-card {
  position: absolute;
  z-index: 3;
  display: grid;
  width: 260px;
  min-height: 132px;
  border: 1px solid var(--line);
  border-top: 7px solid var(--node-color);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
  padding: 14px;
  text-align: left;
  box-shadow: 0 16px 40px rgba(20, 32, 51, 0.13);
  transform: translate(-50%, -50%);
}
.node-card.is-active { border-color: var(--ink); box-shadow: 0 0 0 4px rgba(20,32,51,0.08), 0 20px 50px rgba(20,32,51,0.18); }
.node-card h3 { margin-top: 6px; font-size: 20px; line-height: 1.18; overflow-wrap: anywhere; }
.node-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.chip { border-radius: 999px; background: #eef2f7; padding: 5px 8px; color: #344054; font-size: 12px; font-weight: 850; }
.progress-track { height: 8px; overflow: hidden; border-radius: 999px; background: #e8eef5; margin-top: 12px; }
.progress-fill { height: 100%; border-radius: inherit; background: var(--node-color); }

.editor-panel { padding: 18px; }
.editor-head, .task-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
h2 { margin-top: 6px; font-size: 27px; line-height: 1.15; }
h3 { font-size: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.wide { grid-column: 1 / -1; }
.task-head { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.task-list { display: grid; gap: 10px; }
.task-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) 112px 34px; gap: 8px; align-items: center; }
.task-row input[type="checkbox"] { width: 18px; height: 18px; padding: 0; }
.task-row input, .task-row select { min-height: 36px; }
.task-row.is-done input[type="text"] { color: var(--muted); text-decoration: line-through; }
.icon-button { min-height: 34px; width: 34px; padding: 0; background: #fff; color: var(--ink); }
.empty-state { border: 1px dashed var(--line); border-radius: 10px; padding: 14px; color: var(--muted); font-size: 14px; font-weight: 800; text-align: center; }

@media (max-width: 1120px) {
  .app-header { align-items: flex-start; flex-direction: column; }
  .header-actions { justify-content: flex-start; }
  .overview, .metric-strip, .workspace { grid-template-columns: 1fr; }
  .map-canvas, .map-panel { min-height: 780px; }
}

@media (max-width: 640px) {
  .app-shell { width: min(100% - 22px, 1500px); padding-top: 18px; }
  .header-actions, .header-actions button, .button-like { width: 100%; }
  h1 { font-size: 30px; line-height: 1.08; word-break: break-all; }
  .map-canvas, .map-panel { min-height: 980px; height: auto; }
  .root-node { top: 130px; width: 250px; min-height: 170px; }
  .root-node textarea { font-size: 22px; }
  .node-card { width: calc(100% - 30px); }
  .form-grid, .task-row { grid-template-columns: 1fr; }
  .task-row input[type="checkbox"], .task-row .icon-button { width: 100%; }
}
