:root {
  --bg: #0f1116;
  --panel: #171a22;
  --panel-2: #1e222c;
  --line: #2a2f3b;
  --text: #e6e8ee;
  --muted: #98a0b3;
  --accent: #5b8cff;
  --memory: #3fbf8f;
  --knowledge: #b58cff;
  --danger: #ff6b6b;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }

button {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { filter: brightness(1.1); }
button:disabled { opacity: .5; cursor: not-allowed; }

input, select, textarea {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex: none;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.brand { font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.brand small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; letter-spacing: 0; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav button { text-align: left; background: none; border: none; padding: 8px 10px; border-radius: 8px; color: var(--muted); }
.nav button.active { background: var(--panel-2); color: var(--text); font-weight: 600; }
.nav button:hover { color: var(--text); }
.sidebar .foot { margin-top: auto; font-size: 12px; color: var(--muted); }

.main { flex: 1; padding: 26px 32px 60px; max-width: 1100px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 10px; }
.sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; min-width: 180px; }
.chip {
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px;
  background: none; color: var(--muted); cursor: pointer;
}
.chip.on { border-color: var(--accent); color: var(--text); background: rgba(91, 140, 255, .12); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; cursor: pointer; transition: border-color .15s;
}
.card:hover { border-color: var(--accent); }
.card h3 { margin: 0 0 2px; font-size: 15px; }
.card .slug { color: var(--muted); font-size: 12px; }
.card .metrics { display: flex; gap: 16px; margin-top: 12px; }
.metric .n { font-size: 20px; font-weight: 700; }
.metric .n.memory { color: var(--memory); }
.metric .n.knowledge { color: var(--knowledge); }
.metric .l { font-size: 11px; color: var(--muted); }
.card .when { margin-top: 10px; font-size: 12px; color: var(--muted); }

.timeline { position: relative; margin-left: 6px; padding-left: 22px; }
.timeline::before {
  content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px;
  width: 2px; background: var(--line);
}
.entry { position: relative; margin-bottom: 16px; }
.entry::before {
  content: ""; position: absolute; left: -22px; top: 7px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--memory); border: 2px solid var(--bg);
}
.entry.knowledge::before { background: var(--knowledge); }
.entry .box {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px;
}
.entry .meta { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 6px; flex-wrap: wrap; }
.badge { border-radius: 6px; padding: 1px 8px; font-size: 11px; font-weight: 600; }
.badge.memory { background: rgba(63, 191, 143, .16); color: var(--memory); }
.badge.knowledge { background: rgba(181, 140, 255, .16); color: var(--knowledge); }
.badge.status { background: var(--panel-2); color: var(--muted); }
.badge.warn { background: rgba(255, 200, 60, .16); color: #d8b13c; }
.entry .title { font-weight: 600; margin-bottom: 4px; }
.entry .summary { color: #c9cede; white-space: pre-wrap; }
.entry .ask { color: var(--muted); font-size: 13px; margin-top: 8px; }
.entry .tags { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; }
.entry details { margin-top: 10px; }
.entry summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.entry pre {
  white-space: pre-wrap; word-break: break-word; background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 8px 0 0;
  font-size: 12px; max-height: 420px; overflow: auto;
}

/* The tables carry short values (a key prefix, a status, a timestamp) that
   must not be broken into vertical columns. The table scrolls horizontally
   instead: on a narrow screen a column squeezed to one character per line
   is unreadable, and the label in the first column is enough context. */
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); font-size: 13px; white-space: nowrap; }
th { color: var(--muted); font-weight: 500; }
code { background: var(--panel-2); border-radius: 5px; padding: 1px 6px; font-size: 12px; }

.notice { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; }
.notice.warn { border-color: #6b5a1f; background: rgba(255, 200, 60, .07); }
.notice.error { border-color: #6b2f2f; background: rgba(255, 107, 107, .08); }
.notice.ok { border-color: #2f6b4d; background: rgba(63, 191, 143, .08); }
.keyreveal { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.keyreveal input { font-family: ui-monospace, monospace; }
/* A two-character label like "复制" was squeezed into a vertical column on a
   narrow screen, because the flex row had no room for it and the browser was
   free to break between the two characters. */
.keyreveal button { white-space: nowrap; flex: none; }
.empty { color: var(--muted); padding: 26px 0; text-align: center; }
.muted { color: var(--muted); }

.connect { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.connect .panel { width: 100%; max-width: 460px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.connect h1 { margin-bottom: 6px; }
.connect .row { margin-top: 14px; }
label.f { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }

.review-title, .review-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.review-title { margin-bottom: 14px; }
.review-title .sub { margin-bottom: 0; }
.review-layout { display: grid; grid-template-columns: minmax(220px, 290px) minmax(0, 1fr); gap: 16px; align-items: start; }
.review-list, .review-detail { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.review-list { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.review-item { width: 100%; display: flex; flex-direction: column; text-align: left; gap: 3px; padding: 12px; background: transparent; border-color: transparent; }
.review-item span, .eyebrow { color: var(--muted); font-size: 12px; }
.review-item.selected { background: var(--panel-2); border-color: var(--accent); }
.review-detail { padding: 20px; min-width: 0; }
.review-detail h2 { margin: 3px 0 12px; }
.review-detail h3 { margin: 18px 0 8px; font-size: 14px; }
.review-content { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 14px; }
.source-list { display: grid; gap: 8px; }
.source-card { border: 1px solid var(--line); border-radius: 9px; padding: 12px; min-width: 0; }
.source-card pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0 0; font: inherit; }
.review-warning { margin: 14px 0; border-left: 3px solid #d7a53b; background: rgba(255, 200, 60, .07); padding: 10px 12px; color: #e9d19a; }
.review-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.review-form .f { display: flex; flex-direction: column; gap: 5px; }
.review-form .full { grid-column: 1 / -1; }
.review-form .check-row { display: flex; align-items: center; gap: 8px; color: var(--text); }
.danger-button { border-color: #6b2f2f; color: #ff9a9a; }

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; padding: 12px; border-right: 0; border-bottom: 1px solid var(--line); gap: 8px; }
  .sidebar .foot { display: none; }
  .nav { flex-direction: row; overflow-x: auto; }
  .nav button { white-space: nowrap; }
  .main { padding: 18px 14px 42px; }
  .review-layout { grid-template-columns: 1fr; }
  .review-list { max-height: 260px; overflow: auto; }
  .review-form { grid-template-columns: 1fr; }
  .review-form .full { grid-column: auto; }
  .review-detail { padding: 14px; }
}

/* ------------------------------------------------------------------ console skin -- */
:root {
  --bg: #070b14;
  --panel: rgba(14, 21, 37, .86);
  --panel-2: rgba(24, 35, 57, .9);
  --line: rgba(117, 146, 199, .2);
  --text: #eaf2ff;
  --muted: #8294b5;
  --accent: #58b8ff;
  --memory: #4ce0bb;
  --knowledge: #b797ff;
  --radius: 14px;
}

body {
  min-height: 100vh;
  background: radial-gradient(circle at 12% 0%, rgba(32, 91, 155, .24), transparent 32rem),
    radial-gradient(circle at 90% 20%, rgba(89, 54, 171, .16), transparent 34rem), var(--bg);
  letter-spacing: .01em;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .23;
  background-image: linear-gradient(rgba(126, 173, 237, .08) 1px, transparent 1px), linear-gradient(90deg, rgba(126, 173, 237, .08) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(to bottom, black, transparent 88%);
}

.sidebar {
  position: relative;
  background: linear-gradient(180deg, rgba(12, 20, 37, .95), rgba(9, 14, 27, .86));
  border-right-color: rgba(112, 161, 230, .18);
  box-shadow: 18px 0 60px rgba(0, 0, 0, .2);
}
.brand { display: flex; align-items: center; gap: 8px; letter-spacing: .08em; text-transform: uppercase; }
.brand-symbol { display: grid; place-items: center; width: 27px; height: 27px; border: 1px solid var(--accent); border-radius: 8px; color: var(--accent); box-shadow: 0 0 16px rgba(88, 184, 255, .35); }
.brand small { width: 100%; margin-left: 35px; margin-top: -3px; }
.nav { margin-top: 14px; }
.nav button { position: relative; border-left: 2px solid transparent; letter-spacing: .02em; }
.nav button.active { background: linear-gradient(90deg, rgba(88, 184, 255, .18), transparent); border-left-color: var(--accent); box-shadow: inset 12px 0 26px rgba(88, 184, 255, .04); }
.nav button.active::after { content: ""; position: absolute; right: 10px; top: 50%; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.main { position: relative; max-width: 1280px; padding-top: 20px; }
.mainbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; color: var(--muted); font-size: 11px; letter-spacing: .12em; }
.mainbar-key, .live-pill { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; background: rgba(12, 22, 40, .55); font-family: ui-monospace, monospace; letter-spacing: 0; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--memory); box-shadow: 0 0 10px var(--memory); }
.page-kicker, .eyebrow, .panel-topline { color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: .18em; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.page-heading .sub { margin-bottom: 22px; }
.overview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 4px 0 24px; }
.overview-card { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(135deg, rgba(18, 30, 53, .92), rgba(11, 18, 32, .72)); }
.overview-card::after { content: ""; position: absolute; right: -18px; bottom: -30px; width: 100px; height: 100px; border-radius: 50%; background: currentColor; opacity: .09; filter: blur(8px); }
.overview-card strong { font-size: 29px; line-height: 1.1; color: var(--text); }
.overview-card > span:last-child { color: var(--muted); font-size: 12px; }
.overview-label { font-size: 10px; letter-spacing: .14em; color: currentColor; }
.accent-blue { color: var(--accent); }
.accent-green { color: var(--memory); }
.accent-purple { color: var(--knowledge); }
.card, .review-list, .review-detail, .entry .box { background: linear-gradient(145deg, rgba(18, 28, 48, .92), rgba(11, 17, 30, .9)); box-shadow: 0 12px 32px rgba(0, 0, 0, .12); }
.card:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(31, 138, 232, .14); }
.connect { position: relative; overflow: hidden; background: radial-gradient(circle at 70% 15%, rgba(42, 119, 198, .22), transparent 28rem), var(--bg); }
.connect-layout { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); align-items: center; gap: clamp(48px, 9vw, 140px); width: min(1120px, 100%); }
.connect-intro { max-width: 560px; }
.brand-mark { display: flex; align-items: center; gap: 12px; color: var(--accent); font-weight: 800; letter-spacing: .16em; margin-bottom: 60px; }
.brand-mark > span { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--accent); border-radius: 11px; font-size: 20px; box-shadow: 0 0 24px rgba(88, 184, 255, .35); }
.brand-mark small { font-size: 11px; }
.connect-intro h1 { max-width: 540px; margin: 12px 0 18px; font-size: clamp(34px, 5vw, 62px); line-height: 1.1; letter-spacing: -.045em; white-space: pre-line; }
.connect-intro p { max-width: 470px; color: var(--muted); font-size: 16px; }
.connect-features { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; color: #b4c8e8; font-size: 12px; }
.connect-features span { padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; background: rgba(18, 35, 60, .5); }
.connect-panel { width: 100%; padding: 28px; background: rgba(11, 19, 35, .86); box-shadow: 0 24px 80px rgba(0, 0, 0, .32), 0 0 0 1px rgba(88, 184, 255, .08); }
.panel-topline { margin-bottom: 22px; }
.auth-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.auth-tabs button { flex: 1; border: 0; border-radius: 8px 8px 0 0; background: transparent; color: var(--muted); padding: 10px; }
.auth-tabs button.active { color: var(--text); background: rgba(88, 184, 255, .1); box-shadow: inset 0 -2px var(--accent); }
.panel-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 18px; color: #c7dcfb; font-size: 13px; }
.form-stack { display: grid; gap: 12px; }
.form-stack .f { margin: 0; }
.wide { width: 100%; padding: 11px 14px; }
.helper { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.register-success { text-align: center; }
.register-success h2 { margin: 10px 0 4px; }
.register-success .keyreveal { text-align: left; margin: 18px 0; }
.success-icon { display: grid; place-items: center; width: 42px; height: 42px; margin: auto; border-radius: 50%; color: var(--memory); border: 1px solid var(--memory); box-shadow: 0 0 22px rgba(76, 224, 187, .25); font-size: 23px; }
.connect-orbit { position: absolute; border: 1px solid rgba(88, 184, 255, .13); border-radius: 50%; pointer-events: none; }
.orbit-a { width: 640px; height: 640px; left: -250px; bottom: -300px; }
.orbit-b { width: 540px; height: 540px; right: -200px; top: -220px; }

@media (max-width: 820px) {
  .connect-layout { grid-template-columns: 1fr; gap: 30px; }
  .connect-intro { text-align: center; }
  .connect-intro p { margin-left: auto; margin-right: auto; }
  .brand-mark { justify-content: center; margin-bottom: 28px; }
  .connect-features { justify-content: center; }
  .overview-grid { grid-template-columns: 1fr; }
  .page-heading { align-items: flex-start; }
}

/* ------------------------------------------------------- health / tiers */

.accent-red { color: var(--danger); }

.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 16px 18px;
}
.panel h2 { font-size: 14px; color: var(--muted); font-weight: 600; letter-spacing: .3px; }
.panel .sub { margin: 10px 0 0; font-size: 12px; }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; }
.bar-label { flex: none; width: 96px; color: var(--muted); }
.bar-track { flex: 1; height: 8px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar-value { flex: none; width: 92px; text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }

.gap-list { margin: 0; padding-left: 18px; color: #c9cede; font-size: 13px; }
.gap-list li { margin-bottom: 4px; }

.panel table { width: 100%; border-collapse: collapse; font-size: 13px; }
.panel td { padding: 5px 0; border-bottom: 1px solid var(--line); }
.panel tr:last-child td { border-bottom: none; }
.panel td.num { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.panel td.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--muted); word-break: break-all; }
