:root {
  --bg: #100f0c;
  --bg-2: #18160f;
  --panel: #1c1a15;
  --panel-2: #262218;
  --line: #3a3428;
  --text: #f4efe4;
  --muted: #a89b86;
  --faint: #6f6556;
  --accent: #e2a04a;
  --accent-2: #8f5d16;
  --ok: #8fbf7a;
  --ok-bg: #1a2a16;
  --warn: #e6c15a;
  --warn-bg: #2c2410;
  --danger: #ef7a6a;
  --danger-bg: #2c1612;
  --info: #8eb6d9;
  --info-bg: #152230;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  --font: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", serif;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(226, 160, 74, 0.08), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100%;
}
body { padding-bottom: 32px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 22px 18px 64px; }
.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.04em;
}
.brand:hover { text-decoration: none; color: var(--accent); }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px;
  display: inline-grid; place-items: center;
  background: var(--accent); color: #1a1206; font-size: 13px; font-weight: 800;
}
.brand-name { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; }
.nav { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.nav a { color: var(--muted); font-size: 0.92rem; }
.nav a:hover { color: var(--text); }

.kicker {
  margin: 0 0 6px;
  color: var(--accent);
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  text-transform: uppercase;
}
h1 {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  line-height: 1.15;
  font-weight: 600;
  margin: 0 0 8px;
}
h2 { font-size: 1.05rem; margin: 0 0 10px; }
h3 { margin: 0 0 6px; font-size: 1rem; }
.sub { color: var(--muted); margin: 0 0 16px; max-width: 68ch; }

.pipeline {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin: 8px 0 18px;
}
.pipe {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  min-width: 0;
}
.pipe:hover { text-decoration: none; border-color: var(--accent-2); color: var(--text); }
.pipe.here { border-color: var(--accent); background: rgba(226, 160, 74, 0.1); color: var(--text); }
.pipe.filled .pipe-idx { color: var(--ok); }
.pipe-idx { font-size: 0.72rem; letter-spacing: 0.08em; }
.pipe-name { font-weight: 650; color: var(--text); font-size: 0.92rem; }
.pipe-hint { font-size: 0.72rem; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.banner {
  border-radius: 12px;
  padding: 12px 14px;
  margin: 0 0 14px;
  border: 1px solid var(--line);
  background: var(--info-bg);
  color: var(--info);
  font-size: 0.92rem;
}
.banner.warn { background: var(--warn-bg); border-color: #6d5820; color: var(--warn); }
.banner.danger { background: var(--danger-bg); border-color: #6d3228; color: #ffc7be; }
.banner.ok { background: var(--ok-bg); border-color: #345428; color: #d5f0c8; }
.banner.neutral { background: var(--panel); color: var(--muted); }

.panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.025), transparent 80px), var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.panel.flat { box-shadow: none; }

.grid-2 { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.grid-main { display: grid; grid-template-columns: 280px 1fr; gap: 14px; }
@media (max-width: 980px) {
  .pipeline { grid-template-columns: repeat(3, 1fr); }
  .grid-2, .grid-3, .grid-main { grid-template-columns: 1fr; }
}

label { display: block; font-size: 0.82rem; color: var(--muted); margin: 10px 0 4px; }
.req::after { content: " *"; color: var(--danger); }
input[type="text"], input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  background: #12100c;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(226, 160, 74, 0.45);
  border-color: var(--accent);
}
.field-error { border-color: var(--danger) !important; }

.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 0; }
button, .btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  line-height: 1.3;
}
button:hover, .btn:hover { border-color: var(--accent-2); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #1b1206; font-weight: 700; }
button.ok, .btn.ok { background: #2f6b32; border-color: #2f6b32; color: #f3fff0; }
button.ghost { background: transparent; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.tiny { padding: 4px 10px; font-size: 0.8rem; }

.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (max-width: 720px) { .choice-grid { grid-template-columns: 1fr; } }
.choice {
  border: 1px solid var(--line);
  background: #14120e;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  text-align: left;
}
.choice strong { display: block; color: var(--text); }
.choice span { color: var(--muted); font-size: 0.82rem; }
.choice.active { border-color: var(--accent); background: rgba(226, 160, 74, 0.1); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 0.82rem;
}
.chip.on, .chip:hover { color: var(--text); border-color: var(--accent); }

.steps { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.step {
  padding: 6px 12px;
  border-radius: 999px;
  background: #14120e;
  border: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted);
}
.step.active { background: var(--accent); border-color: var(--accent); color: #1b1206; font-weight: 700; }
.step.done { border-color: var(--ok); color: var(--ok); }

.card {
  background: #14120e;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 150px;
}
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.card h3 { font-family: var(--serif); font-size: 1.25rem; }
.card .go { margin-top: auto; align-self: flex-start; }
.cards a.card { color: inherit; }
.cards a.card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-1px); }

.muted { color: var(--muted); font-size: 0.9rem; }
.faint { color: var(--faint); font-size: 0.8rem; }
.err { color: #ffc7be; font-size: 0.9rem; margin: 8px 0 0; }
.ok-msg { color: #d5f0c8; font-size: 0.9rem; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid transparent;
  vertical-align: middle;
}
.badge.red { background: #4a201b; color: #ffc7be; border-color: #7a3a32; }
.badge.yellow { background: #3d3112; color: #ffe7a3; border-color: #6d5820; }
.badge.green { background: #1d331c; color: #d5f0c8; border-color: #345428; }
.badge.blue { background: #172838; color: #d5e8f8; border-color: #2a4d68; }
.badge.gray { background: #242018; color: var(--muted); }

.pre, .script {
  white-space: pre-wrap;
  background: #0d0c09;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-size: 0.92rem;
  min-height: 48px;
}
.script { font-size: 1rem; line-height: 1.7; }

.footer-note {
  margin-top: 28px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.7;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 22px 16px;
  text-align: center;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.15);
}
.empty strong { display: block; color: var(--text); margin-bottom: 4px; }

.hidden { display: none !important; }

#sph-toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 20;
}
.toast {
  background: #241e14;
  border: 1px solid var(--accent-2);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  max-width: min(360px, 80vw);
  box-shadow: var(--shadow);
}
.toast.err { border-color: #7a3a32; background: #2c1612; }
.toast.out { opacity: 0; transition: opacity 0.25s; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 720px) { .metrics { grid-template-columns: 1fr 1fr; } }
.metric {
  background: #14120e;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.metric b { display: block; font-family: var(--serif); font-size: 1.35rem; font-weight: 600; }
.metric span { color: var(--muted); font-size: 0.78rem; }

.week-list { display: flex; flex-direction: column; gap: 8px; }
.week-item {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: #14120e;
  border: 1px solid var(--line);
}
.day-no { font-family: var(--serif); color: var(--accent); font-size: 1.1rem; }

.check-item { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0; }
.check-item input { margin-top: 5px; accent-color: var(--accent); }
.check-item label { margin: 0; color: var(--text); font-size: 0.92rem; }

.bar-wrap { margin: 8px 0; }
.bar-label { display: flex; justify-content: space-between; gap: 8px; font-size: 0.85rem; }
.bar { height: 8px; background: #0d0c09; border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, #8f5d16, var(--accent)); }

.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tabs button.active { background: var(--accent); border-color: var(--accent); color: #1b1206; font-weight: 700; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.table th, .table td { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: left; white-space: nowrap; }
.table th { color: var(--muted); font-weight: 600; }

.quadrant-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 720px) { .quadrant-grid { grid-template-columns: 1fr; } }
.quadrant {
  min-height: 120px;
  border-radius: 12px;
  padding: 12px;
  background: #100e0b;
  border: 1px solid var(--line);
}
.quadrant.hh { border-color: #345428; }
.quadrant.hl { border-color: #6d5820; }
.quadrant.lh { border-color: #2a4d68; }
.quadrant.ll { border-color: #3a3428; }
.quadrant h4 { margin: 0 0 6px; }
.quadrant ul { margin: 8px 0 0; padding-left: 18px; }

.chat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 440px;
  overflow-y: auto;
  background: #0d0c09;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.bubble {
  max-width: 86%;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 0.94rem;
  white-space: pre-wrap;
}
.bubble.user { align-self: flex-end; background: #3d2a12; border-bottom-right-radius: 4px; }
.bubble.bot { align-self: flex-start; background: #242018; border-bottom-left-radius: 4px; }
.bubble.sys { align-self: center; background: transparent; color: var(--faint); font-size: 0.78rem; }

.meter { height: 8px; background: #0d0c09; border-radius: 999px; overflow: hidden; margin-top: 6px; }
.meter > span { display: block; height: 100%; width: 0; background: var(--info); }
.meter.warm > span { background: var(--warn); }
.meter.hot > span { background: var(--danger); }

.timeline { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tl {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  background: #100e0b;
  min-height: 92px;
}
.tl.on { border-color: var(--accent); }
.tl b { display: block; font-size: 0.82rem; }

.angle-card { position: relative; }
.angle-card.picked { border-color: var(--accent); }
.kv { margin: 0; }
.kv b { color: var(--muted); font-weight: 600; }

details.fold { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #14120e; }
details.fold summary { cursor: pointer; font-weight: 650; }
details.fold[open] summary { margin-bottom: 8px; }

.hero-block { margin-bottom: 8px; }
.split-title { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.stat-inline { color: var(--muted); font-size: 0.8rem; }
