:root {
  --bg: #0c1019;
  --bg-soft: #131a28;
  --panel: #161e2e;
  --panel-2: #1c2638;
  --line: #283248;
  --text: #e7ecf5;
  --muted: #93a0b8;
  --faint: #6a7691;
  --brand: #4f8cff;
  --brand-2: #6ee7c7;
  --warn: #f5a524;
  --danger: #f0556a;
  --ok: #34d399;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .35);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1100px 600px at 12% -10%, rgba(79, 140, 255, .14), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(110, 231, 199, .10), transparent 55%);
  pointer-events: none;
  z-index: 0;
}

/* ---- header ---- */
.site-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(12, 16, 25, .6);
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  font-size: 26px;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(79,140,255,.25), rgba(110,231,199,.18));
  border: 1px solid var(--line);
  border-radius: 12px;
}
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: .2px; }
.brand-sub { font-size: 12px; color: var(--faint); letter-spacing: 1px; }
.head-tags { display: flex; gap: 8px; }
.tag {
  font-size: 12px; color: var(--muted);
  border: 1px solid var(--line);
  padding: 4px 10px; border-radius: 999px;
  background: var(--panel);
}

/* ---- layout ---- */
.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(340px, 460px) 1fr;
  gap: 20px;
  padding: 22px 28px 40px;
  max-width: 1500px;
  margin: 0 auto;
  align-items: start;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.input-panel {
  padding: 20px;
  position: sticky;
  top: 22px;
}
.panel-title h1 { font-size: 20px; margin: 2px 0 6px; }
.panel-title p { color: var(--muted); margin: 0 0 14px; font-size: 14px; }
.panel-title strong { color: var(--brand-2); font-weight: 600; }

textarea#input {
  width: 100%;
  height: 320px;
  resize: vertical;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  padding: 14px;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, "PingFang SC", monospace;
  font-size: 13.5px;
  line-height: 1.7;
  outline: none;
  transition: border-color .15s;
}
textarea#input:focus { border-color: var(--brand); }

.actions { display: flex; gap: 10px; margin: 14px 0 12px; flex-wrap: wrap; }
.btn {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  transition: all .15s;
}
.btn:hover { border-color: var(--brand); transform: translateY(-1px); }
.btn.primary {
  background: linear-gradient(135deg, var(--brand), #3a6fe0);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}
.btn.ghost { background: transparent; color: var(--muted); }
.btn.sm { padding: 6px 12px; font-size: 13px; }

.how {
  font-size: 12.5px;
  color: var(--faint);
  line-height: 1.7;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
}
.how span { color: var(--muted); font-weight: 600; }
.how code {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
  color: var(--brand-2);
  font-size: 12px;
}

/* ---- output ---- */
.output-panel { padding: 18px; min-height: 400px; }
.empty { text-align: center; padding: 80px 20px; color: var(--faint); }
.empty-ico { font-size: 46px; margin-bottom: 10px; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.stats { display: flex; gap: 10px; flex-wrap: wrap; }
.stat {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 16px;
  text-align: center;
  min-width: 78px;
}
.stat-val { font-size: 20px; font-weight: 700; color: var(--brand-2); }
.stat-label { font-size: 11.5px; color: var(--muted); }
.export { display: flex; gap: 8px; }

/* reminders */
.reminders {
  background: rgba(245, 165, 36, .06);
  border: 1px solid rgba(245, 165, 36, .3);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.reminders h3 { margin: 0 0 8px; font-size: 14px; color: var(--warn); }
.reminder {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 13.5px; color: var(--text);
  padding: 3px 0;
}
.reminder .dot {
  width: 7px; height: 7px; border-radius: 50%;
  margin-top: 8px; flex: 0 0 auto;
  background: var(--faint);
}
.reminder.high .dot { background: var(--danger); }
.reminder.medium .dot { background: var(--warn); }
.reminder.info .dot { background: var(--brand); }
.reminder.high { color: #ffd9df; }

/* canvas */
.canvas {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  align-items: start;
}
.phase {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.phase-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}
.phase-no {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), #3a6fe0);
  color: #fff; font-size: 13px; font-weight: 700;
  border-radius: 7px; flex: 0 0 auto;
}
.phase-head h2 { margin: 0; font-size: 15px; flex: 1; }
.phase-count { font-size: 12px; color: var(--faint); }
.phase-body { padding: 10px; display: flex; flex-direction: column; gap: 10px; }

.task {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
}
.task-title { font-size: 14px; font-weight: 600; line-height: 1.5; margin-bottom: 8px; }
.task-fields { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.field {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 3px 8px;
  font-size: 12.5px;
}
.field-k { color: var(--faint); }
.field-v {
  color: var(--text); min-width: 38px; outline: none;
  border-bottom: 1px dashed transparent;
}
.field-v:focus { border-bottom-color: var(--brand); }
.field-v:empty::before {
  content: attr(data-placeholder);
  color: var(--danger);
}
.field.missing { border-color: rgba(240, 85, 106, .4); }

.meta-row { display: flex; gap: 6px; font-size: 12.5px; margin-top: 5px; line-height: 1.5; }
.meta-k {
  flex: 0 0 auto; color: var(--faint);
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 5px; padding: 0 6px; height: fit-content;
}
.meta-v { color: var(--muted); }
.meta-v.inferred { color: var(--faint); font-style: italic; }
.meta-v em, .meta-row em { color: var(--warn); font-style: normal; font-size: 11.5px; }

.flags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.flag {
  font-size: 11.5px;
  color: var(--danger);
  background: rgba(240, 85, 106, .1);
  border: 1px solid rgba(240, 85, 106, .3);
  border-radius: 999px;
  padding: 1px 9px;
}

.hint { font-size: 12.5px; color: var(--faint); margin-top: 16px; text-align: center; }

/* footer */
.site-foot {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 18px 28px 30px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 12.5px;
}
.foot-dir { color: var(--muted); }

/* toast */
.toast {
  position: fixed;
  bottom: 26px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--panel-2);
  border: 1px solid var(--brand);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: all .25s;
  z-index: 20;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* responsive */
@media (max-width: 920px) {
  .layout { grid-template-columns: 1fr; padding: 16px; }
  .input-panel { position: static; }
  textarea#input { height: 200px; }
  .site-head { padding: 14px 16px; }
  .head-tags { display: none; }
  .canvas { grid-template-columns: 1fr; }
}
