:root {
  color-scheme: light dark;
  --ink: #14181f;
  --muted: #626c7a;
  --faint: #8890a0;
  --line: #e2e5eb;
  --line-strong: #c7cdd6;
  --surface: #ffffff;
  --paper: #eef0f4;
  --nav: #0b1220;
  --nav-line: rgba(255, 255, 255, 0.08);
  --blue: #2563eb;
  --blue-ink: #1d4ed8;
  --blue-soft: #eaf1ff;
  --green: #15803d;
  --green-soft: #eafaf0;
  --red: #dc2626;
  --red-soft: #fdecec;
  --amber: #b45309;
  --amber-soft: #fdf3e3;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 8px 24px -12px rgba(15, 23, 42, 0.22);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.10);
  --radius: 12px;
  --topbar-h: 57px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eef1f6;
    --muted: #a1abbb;
    --faint: #6c7688;
    --line: #262d3b;
    --line-strong: #37405494;
    --surface: #161c28;
    --paper: #0c1119;
    --nav: #070a11;
    --nav-line: rgba(255, 255, 255, 0.06);
    --blue-soft: #16233f;
    --green-soft: #10281c;
    --red-soft: #2e1417;
    --amber-soft: #2c2011;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 12px 28px -14px rgba(0, 0, 0, 0.65);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
  font-size: 14.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 7px 14px;
  font-weight: 500;
  transition: border-color .12s ease, background .12s ease, transform .06s ease;
}
button:hover { border-color: var(--blue); color: var(--blue-ink); }
button:active { transform: translateY(1px); }
button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
button.primary:hover { background: var(--blue-ink); border-color: var(--blue-ink); color: #fff; }
button.danger { border-color: var(--red); color: var(--red); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

input[type=text], input[type=password], input[type=search], input[type=time], select, textarea {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--surface);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

#app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 24px;
  background: var(--nav);
  color: #e7eaf0;
  border-bottom: 1px solid var(--nav-line);
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-h);
}
.topbar .brand {
  font-weight: 700;
  letter-spacing: -.01em;
  margin-right: 4px;
  white-space: nowrap;
  color: #fff;
}
.topbar nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.topbar nav button {
  background: transparent;
  border: 1px solid transparent;
  color: #b7c0d1;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13.5px;
  font-weight: 500;
}
.topbar nav button:hover { color: #fff; border-color: transparent; background: rgba(255,255,255,0.06); }
.topbar nav button.active {
  background: #fff;
  color: var(--nav);
  border-color: transparent;
}
.topbar .who { color: #8b95a8; font-size: 12.5px; white-space: nowrap; }
.topbar > button { white-space: nowrap; }

.main { flex: 1; padding: 28px 24px 60px; max-width: 1240px; width: 100%; margin: 0 auto; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 18px;
}

.hero {
  background: linear-gradient(155deg, var(--surface), var(--paper));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 28px 24px;
  margin-bottom: 18px;
}
.hero h1 { margin: 0 0 6px; font-size: 22px; letter-spacing: -.01em; }
.hero p { margin: 0; color: var(--muted); font-size: 13.5px; max-width: 640px; }
.hero .stat-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 16px;
  min-width: 108px;
  box-shadow: var(--shadow-sm);
}
.stat-tile .n { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.stat-tile .l { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.hero .lock-note {
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--amber);
  background: var(--amber-soft);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 12px;
  display: inline-block;
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: .02em;
}
.badge.public { color: var(--green); background: var(--green-soft); }
.badge.private { color: var(--amber); background: var(--amber-soft); }

.layout-2col { display: grid; grid-template-columns: 272px 1fr; gap: 18px; align-items: start; }
@media (max-width: 820px) { .layout-2col { grid-template-columns: 1fr; } }

.layout-2col > .tree {
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
  height: calc(100vh - var(--topbar-h) - 32px);
}
@media (max-width: 820px) {
  .layout-2col > .tree { position: static; height: 50vh; }
}

.tree { display: flex; flex-direction: column; gap: 2px; overflow: auto; padding: 14px; margin: 0; }
.tree-group { margin-bottom: 14px; }
.tree-group:last-child { margin-bottom: 0; }
.tree-group h4 {
  margin: 0 0 6px;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--faint);
  letter-spacing: .06em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 6px;
}
.tree-group h4 .count { font-weight: 400; color: var(--faint); }
.tree-item {
  display: block;
  padding: 6px 10px;
  border-radius: 7px;
  color: var(--ink);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid transparent;
}
.tree-item:hover { background: var(--paper); text-decoration: none; }
.tree-item.active { background: var(--blue-soft); color: var(--blue-ink); border-color: var(--blue); font-weight: 600; }

.doc-view { line-height: 1.75; }
.doc-view h1 { font-size: 22px; margin: 0 0 14px; letter-spacing: -.01em; }
.doc-view h2 { font-size: 18px; margin: 28px 0 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.doc-view h2:first-of-type { border-top: none; padding-top: 0; margin-top: 18px; }
.doc-view h3 { font-size: 15.5px; margin: 20px 0 8px; color: var(--ink); }
.doc-view h4, .doc-view h5, .doc-view h6 { font-size: 14px; margin: 16px 0 6px; color: var(--muted); }
.doc-view p { margin: 0 0 12px; }
.doc-view ul, .doc-view ol { margin: 0 0 12px; padding-left: 22px; }
.doc-view li { margin: 3px 0; }
.doc-view li > ul, .doc-view li > ol { margin-top: 4px; margin-bottom: 0; }
.doc-view table { border-collapse: collapse; width: 100%; margin: 14px 0; font-size: 13px; }
.doc-view th, .doc-view td { border: 1px solid var(--line); padding: 7px 11px; text-align: left; vertical-align: top; }
.doc-view th { background: var(--paper); font-weight: 600; }
.doc-view tr:nth-child(even) td { background: color-mix(in srgb, var(--paper) 45%, transparent); }
.doc-view pre { background: var(--paper); border: 1px solid var(--line); padding: 12px 14px; border-radius: 8px; overflow: auto; font-size: 12.5px; line-height: 1.55; }
.doc-view code { background: var(--paper); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.doc-view pre code { background: none; padding: 0; }
.doc-view blockquote { border-left: 3px solid var(--blue); margin: 10px 0; padding: 4px 14px; color: var(--muted); background: var(--paper); border-radius: 0 8px 8px 0; }
.doc-view hr { border: none; border-top: 1px solid var(--line); margin: 20px 0; }
.doc-view mark { background: #fde68a; color: #1a1f27; padding: 0 2px; border-radius: 3px; }

.toc { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; }
.toc div { padding: 2px 0; color: var(--muted); border-left: 2px solid var(--line); padding-left: 10px; }

.search-row { display: flex; gap: 8px; margin-bottom: 16px; }
.search-row input { flex: 1; }
.search-hit { padding: 12px 0; border-bottom: 1px solid var(--line); }
.search-hit:last-child { border-bottom: none; }
.search-hit a { font-weight: 600; font-size: 14px; }
.search-hit .path { font-size: 12px; color: var(--faint); margin-top: 2px; }
.search-hit .snippet { font-size: 13px; margin-top: 6px; color: var(--muted); }

.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .editor-grid { grid-template-columns: 1fr; } }
.editor-grid textarea { min-height: 62vh; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.6; }
.editor-grid .doc-view { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; min-height: 62vh; overflow: auto; background: var(--paper); }
.editor-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.hint-banner { background: var(--blue-soft); border: 1px solid transparent; border-radius: 8px; padding: 10px 14px; font-size: 12.5px; color: var(--blue-ink); margin-bottom: 14px; }

.login-card { max-width: 380px; margin: 64px auto; padding: 28px; }
.login-card h2 { margin-top: 0; margin-bottom: 18px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--nav);
  color: #fff;
  padding: 11px 18px;
  border-radius: 9px;
  box-shadow: var(--shadow);
  font-size: 13px;
  z-index: 100;
}
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }

.empty-state { color: var(--muted); font-size: 13.5px; padding: 32px 0; text-align: center; }
.stale { color: var(--amber); font-weight: 600; }
.ok { color: var(--green); font-weight: 600; }
.tabbar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tabbar button.sub-active { background: var(--blue-soft); border-color: var(--blue); color: var(--blue-ink); }

table.reg-table { border-collapse: collapse; width: 100%; font-size: 13px; }
table.reg-table th, table.reg-table td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
table.reg-table th { background: var(--paper); cursor: pointer; user-select: none; font-weight: 600; }
table.reg-table th:hover { color: var(--blue-ink); }
table.reg-table tr:nth-child(even) td { background: color-mix(in srgb, var(--paper) 45%, transparent); }

h3 { letter-spacing: -.005em; }

/* CPO Product Ops workbench */
.cpo-shell { max-width: 1240px; margin: 0 auto; padding-bottom: 48px; }
.cpo-login {
  min-height: calc(100vh - var(--topbar-h) - 32px);
  display: grid;
  place-content: center;
  text-align: center;
  max-width: 680px;
  margin: 0 auto;
}
.cpo-login h1 { font-size: clamp(34px, 6vw, 64px); line-height: 1.04; margin: 10px 0 16px; letter-spacing: -.045em; }
.cpo-login p { color: var(--muted); font-size: 17px; }
.cpo-login button { justify-self: center; margin-top: 12px; }
.eyebrow { color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.cpo-hero {
  min-height: 330px;
  border-radius: 20px;
  padding: clamp(28px, 5vw, 64px);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 28px;
  background:
    radial-gradient(circle at 84% 10%, rgba(59, 130, 246, .32), transparent 28%),
    linear-gradient(135deg, #07111f 0%, #0e2340 58%, #142f50 100%);
  color: #f7fbff;
  box-shadow: 0 24px 80px -38px rgba(2, 20, 48, .85);
}
.cpo-hero .eyebrow { color: #78aefc; }
.cpo-hero h1 { max-width: 880px; font-size: clamp(34px, 5vw, 62px); line-height: 1.04; letter-spacing: -.045em; margin: 14px 0 16px; }
.cpo-hero p { color: #b8c9dc; margin: 0; font-size: 16px; }
.cpo-hero button { flex: 0 0 auto; }
.cpo-kicker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: -1px 22px 0;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 14px 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.cpo-kicker span { padding: 17px 22px; color: var(--muted); border-right: 1px solid var(--line); }
.cpo-kicker span:last-child { border: 0; }
.cpo-kicker b { color: var(--ink); font-size: 20px; margin-right: 5px; }
.cpo-section-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin: 42px 0 16px; }
.cpo-section-head h2, .cpo-reminder h2 { margin: 4px 0 0; font-size: 25px; letter-spacing: -.025em; }
.cpo-objectives { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cpo-objective { padding: 20px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: var(--shadow-sm); }
.cpo-objective-top { display: flex; justify-content: space-between; gap: 16px; font-weight: 700; }
.cpo-objective-top strong { font-variant-numeric: tabular-nums; }
.progress { height: 6px; margin: 16px 0 11px; background: var(--paper); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, #2563eb, #60a5fa); border-radius: inherit; }
.cpo-objective-meta { color: var(--muted); font-size: 12.5px; }
.cpo-objective-meta b { color: var(--amber); }
.cpo-actions { display: grid; gap: 10px; }
.cpo-action { padding: 20px 22px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: var(--shadow-sm); }
.cpo-action-head { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; }
.cpo-action h3 { margin: 11px 0 5px; font-size: 17px; }
.cpo-action p { margin: 0 0 14px; color: var(--muted); }
.cpo-action-foot { display: flex; flex-wrap: wrap; gap: 10px 24px; color: var(--faint); font-size: 12px; }
.urgency { padding: 2px 8px; border-radius: 999px; font-weight: 700; }
.urgency.overdue { color: var(--red); background: var(--red-soft); }
.urgency.due-soon { color: var(--amber); background: var(--amber-soft); }
.urgency.on-track { color: var(--green); background: var(--green-soft); }
.cpo-reminder {
  display: grid;
  grid-template-columns: 1fr 150px auto;
  gap: 22px;
  align-items: center;
  margin-top: 38px;
  padding: 26px;
  border: 1px solid color-mix(in srgb, var(--blue) 30%, var(--line));
  border-radius: 15px;
  background: linear-gradient(135deg, var(--blue-soft), var(--surface));
}
.cpo-reminder p { color: var(--muted); margin: 8px 0 0; max-width: 720px; }
.cpo-reminder label { color: var(--muted); font-size: 12px; }
.cpo-reminder input { margin-top: 5px; }

@media (max-width: 780px) {
  .cpo-hero { min-height: 400px; align-items: flex-start; flex-direction: column; }
  .cpo-kicker { grid-template-columns: 1fr; }
  .cpo-kicker span { border-right: 0; border-bottom: 1px solid var(--line); }
  .cpo-objectives { grid-template-columns: 1fr; }
  .cpo-reminder { grid-template-columns: 1fr; }
}
