:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --line: #2a2f3a;
  --text: #e7ebf2;
  --muted: #9aa3b2;
  --accent: #4f8cff;
  --accent-2: #28d39f;
  --chip: #232834;
  --chip-on: #173a5e;
  --danger: #ff6b6b;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: radial-gradient(1200px 600px at 70% -10%, #1a2030 0%, var(--bg) 55%);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1140px; margin: 0 auto; padding: 0 20px; }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(15, 17, 21, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 26px; }
.brand-name { font-weight: 700; font-size: 16px; }
.brand-sub { color: var(--muted); font-size: 12.5px; }
.ghost-link { color: var(--muted); text-decoration: none; font-size: 14px; border: 1px solid var(--line); padding: 7px 12px; border-radius: 8px; }
.ghost-link:hover { color: var(--text); border-color: var(--accent); }

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 22px;
  padding-top: 26px;
  padding-bottom: 30px;
  align-items: start;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.form { position: sticky; top: 86px; }
.panel-title { margin: 0 0 16px; font-size: 15px; letter-spacing: 0.3px; color: var(--text); }

/* Fields */
.field { display: block; margin-bottom: 15px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field-label .hint, .hint { font-style: normal; font-size: 11.5px; color: #6f7785; }
input, select, textarea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 9px;
  padding: 10px 11px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  transition: all 0.12s ease;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.on {
  background: var(--chip-on);
  border-color: var(--accent);
  color: #cfe2ff;
}

/* Buttons */
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.btn {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 9px;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s ease;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: linear-gradient(180deg, #5a93ff, #3f7cf0); border-color: #3f7cf0; color: #fff; font-weight: 600; flex: 1; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { color: var(--muted); }
.btn.small { padding: 7px 11px; font-size: 12.5px; }
.micro { color: #6f7785; font-size: 11.5px; margin: 12px 0 0; }

/* Output */
.output { min-height: 420px; }
.output-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.output-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.result { margin-top: 14px; }

.empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 40px 20px;
  text-align: center;
}
.empty .big { font-size: 30px; margin-bottom: 8px; }

/* Generated doc */
.doc-title { font-size: 20px; font-weight: 700; margin: 6px 0 4px; }
.doc-meta { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.doc-context { background: var(--panel-2); border-left: 3px solid var(--accent-2); padding: 8px 12px; border-radius: 6px; font-size: 13.5px; color: #cfd6e1; margin: 8px 0 4px; }

.sec { border-top: 1px solid var(--line); padding: 16px 0 4px; }
.sec h3 { font-size: 15px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.sec h3 .num { color: var(--accent); font-variant-numeric: tabular-nums; }
.sec ul { margin: 0; padding-left: 20px; }
.sec li { margin: 5px 0; font-size: 14px; }

.toc { display: flex; flex-wrap: wrap; gap: 6px 14px; list-style: none; padding: 0; }
.toc li { font-size: 12.5px; color: var(--muted); }

.scope-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.scope-col h4 { margin: 0 0 6px; font-size: 13px; }
.scope-in h4 { color: var(--accent-2); }
.scope-out h4 { color: var(--danger); }

.phase { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.phase:last-child { border-bottom: none; }
.phase .span { flex: 0 0 110px; font-size: 12.5px; color: var(--accent); font-weight: 600; }
.phase .pp { color: var(--muted); }
.phase .name { font-weight: 600; font-size: 14px; }
.phase .focus { color: var(--muted); font-size: 13px; }

.check li { list-style: none; }
.check ul { padding-left: 0; }
.check li::before { content: "☐ "; color: var(--accent); }

.risk { padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.risk:last-child { border-bottom: none; }
.risk .r { color: var(--danger); }
.risk .m { color: var(--accent-2); }

.agenda { counter-reset: ag; padding-left: 0; list-style: none; }
.agenda li { counter-increment: ag; padding: 5px 0 5px 30px; position: relative; font-size: 14px; }
.agenda li::before {
  content: counter(ag);
  position: absolute; left: 0; top: 4px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--chip-on); color: #cfe2ff;
  font-size: 12px; text-align: center; line-height: 20px;
}
.pricing-note { color: var(--muted); font-size: 12.5px; margin-top: 8px; }

/* How / footer */
.how { padding: 28px 20px 10px; color: var(--muted); }
.how h2 { color: var(--text); font-size: 18px; }
.how strong { color: var(--text); }
.how-note { font-size: 13.5px; }
.footer { border-top: 1px solid var(--line); color: #6f7785; font-size: 13px; padding: 20px 0 40px; text-align: center; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: #20303f; border: 1px solid var(--accent); color: #cfe2ff;
  padding: 10px 18px; border-radius: 10px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all 0.22s ease; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Responsive */
@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; }
  .form { position: static; }
  .scope-grid { grid-template-columns: 1fr; }
  .brand-sub { display: none; }
}

/* Print */
@media print {
  .topbar, .form, .how, .footer, .output-actions, .ghost-link { display: none !important; }
  body { background: #fff; color: #000; }
  .layout { display: block; padding: 0; }
  .panel { border: none; box-shadow: none; background: #fff; padding: 0; }
  .sec { border-color: #ccc; }
  .doc-meta, .focus, .pp, .toc li { color: #555; }
  .sec h3 .num, .phase .span { color: #000; }
  .scope-in h4 { color: #0a6; }
  .scope-out h4 { color: #c33; }
}
