:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-soft: #eef2f7;
  --text: #18212f;
  --muted: #667085;
  --faint: #98a2b3;
  --line: #dce2ea;
  --line-strong: #c7d0dc;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-soft: #e8efff;
  --build: #2563eb;
  --build-soft: #eff6ff;
  --maintain: #d97706;
  --maintain-soft: #fff7e8;
  --operate: #059669;
  --operate-soft: #ecfdf5;
  --ok: #078447;
  --ok-soft: #eaf9f0;
  --danger: #c62f3a;
  --danger-soft: #fff0f1;
  --warn: #b86100;
  --warn-soft: #fff5df;
  --info: #506782;
  --info-soft: #edf3f8;
  --shadow: 0 10px 30px rgb(21 31 45 / 7%);
  --radius: 14px;
  --radius-small: 9px;
  --content: 1180px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
}

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

button,
input[type="button"],
input[type="submit"] {
  touch-action: manipulation;
}

a {
  color: var(--primary);
  text-decoration-thickness: .08em;
  text-underline-offset: .18em;
}

a:hover {
  color: var(--primary-hover);
}

:focus-visible {
  outline: 3px solid rgb(37 99 235 / 36%);
  outline-offset: 3px;
}

h1,
h2,
h3,
h4,
p,
dl,
dd {
  margin-top: 0;
}

h1,
h2,
h3,
h4 {
  color: var(--text);
  line-height: 1.25;
}

h1 {
  margin-bottom: .55rem;
  font-size: clamp(1.75rem, 6vw, 2.6rem);
  letter-spacing: -.025em;
}

h2 {
  margin-bottom: .65rem;
  font-size: 1.3rem;
}

h3 {
  margin-bottom: .5rem;
  font-size: 1.05rem;
}

h4 {
  margin-bottom: .35rem;
  font-size: 1rem;
}

code,
pre,
kbd,
samp {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

code {
  border-radius: 5px;
  background: var(--surface-soft);
  padding: .12rem .35rem;
  font-size: .88em;
}

.is-hidden,
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  min-height: 44px;
  transform: translateY(-140%);
  border-radius: var(--radius-small);
  background: var(--text);
  color: var(--surface);
  padding: 10px 16px;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgb(199 208 220 / 75%);
  background: rgb(255 255 255 / 92%);
  backdrop-filter: blur(16px);
}

.header-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(100%, var(--content));
  margin: 0 auto;
  padding: 10px 12px 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  min-height: 44px;
  color: var(--text);
  text-decoration: none;
}

.brand:hover {
  color: var(--text);
  text-decoration: none;
}

.brand-mark,
.gate-mark {
  display: grid;
  flex: none;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 800;
  line-height: 1;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  margin-left: 9px;
  line-height: 1.2;
}

.brand-copy strong {
  font-size: .98rem;
}

.brand-copy small {
  max-width: 28ch;
  overflow: hidden;
  color: var(--muted);
  font-size: .72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  width: 100%;
  gap: 3px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.nav-link,
.nav-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 44px;
  flex: none;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.nav-link:hover,
.nav-logout:hover {
  background: var(--surface-soft);
  color: var(--text);
  text-decoration: none;
}

.nav-link.is-active {
  background: var(--primary-soft);
  color: var(--primary);
}

.logout-form {
  display: inline-flex;
  margin: 0;
}

.nav-logout {
  color: var(--danger);
}

.unread-badge {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  margin-left: 5px;
  place-items: center;
  border-radius: 999px;
  background: var(--danger);
  color: #ffffff;
  padding: 0 5px;
  font-size: .7rem;
  font-weight: 800;
}

.site-main {
  width: min(100%, var(--content));
  margin: 0 auto;
  padding: 24px 12px 64px;
}

.site-footer {
  display: flex;
  width: min(calc(100% - 24px), var(--content));
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  margin: 0 auto;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .82rem;
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin: 4px 0 22px;
}

.page-heading-actions {
  flex-direction: column;
}

.eyebrow {
  margin-bottom: .35rem;
  color: var(--primary);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.lede {
  max-width: 68ch;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
}

.muted,
.panel-meta,
.live-status {
  color: var(--muted);
}

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

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-heading h2,
.panel-heading p {
  margin-bottom: 0;
}

.panel-meta {
  flex: none;
  font-size: .78rem;
}

.button,
.text-action,
.back-link,
.file-action {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}

.button {
  border: 1px solid var(--primary);
  border-radius: var(--radius-small);
  background: var(--primary);
  color: #ffffff;
  padding: 9px 16px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  border-color: var(--primary-hover);
  background: var(--primary-hover);
  color: #ffffff;
  text-decoration: none;
}

.button:disabled {
  border-color: var(--line-strong);
  background: var(--surface-soft);
  color: var(--faint);
  cursor: not-allowed;
}

.button-secondary {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--text);
}

.button-secondary:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.button-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.button-quiet:hover {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--text);
}

.text-action,
.back-link {
  font-weight: 700;
  text-decoration: none;
}

.text-action:hover,
.back-link:hover {
  text-decoration: underline;
}

.empty-state {
  margin: 0;
  color: var(--muted);
  text-align: center;
}

.live-status {
  min-height: 26px;
  margin: 0 0 10px;
  font-size: .88rem;
}

/* 首页三端 */
.home-heading {
  margin-bottom: 18px;
}

.ends-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}

.end-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-top: 4px solid var(--end-accent);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.end-build {
  --end-accent: var(--build);
  --end-soft: var(--build-soft);
}

.end-maintain {
  --end-accent: var(--maintain);
  --end-soft: var(--maintain-soft);
}

.end-operate {
  --end-accent: var(--operate);
  --end-soft: var(--operate-soft);
}

.end-card-header {
  display: flex;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid var(--line);
  background: var(--end-soft);
  padding: 15px 16px;
}

.end-card-header h2 {
  margin: 0;
  color: var(--end-accent);
}

.end-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--end-accent);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--end-accent) 15%, transparent);
}

.registry-section,
.reach-card-list {
  padding: 16px;
}

.registry-section + .registry-section,
.reach-card-list {
  border-top: 1px solid var(--line);
}

.registry-section > h3,
.reach-card-list > h3 {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.registry-list {
  display: grid;
  gap: 10px;
}

.registry-item {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-raised);
  padding: 13px;
}

.registry-item.is-stale {
  border-color: #e6ad57;
  background: var(--warn-soft);
}

.registry-title-row,
.notice-title-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.registry-title-row h4,
.notice-title-row h3 {
  margin: 0;
}

.type-badge,
.stale-badge,
.level-badge,
.tag-list li {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: .7rem;
  font-weight: 800;
  line-height: 1.2;
}

.type-badge {
  background: var(--end-soft);
  color: var(--end-accent);
}

.stale-badge {
  border: 1px solid #e5aa50;
  background: var(--warn-soft);
  color: #8a4800;
}

.reach-line {
  display: block;
  max-width: 100%;
  margin: 10px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  padding: 8px 10px;
  font-size: .76rem;
  line-height: 1.45;
  white-space: nowrap;
}

.registry-meta {
  display: grid;
  gap: 5px;
  margin-bottom: 6px;
  font-size: .78rem;
}

.registry-meta > div {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  gap: 6px;
}

.registry-meta dt {
  color: var(--muted);
}

.registry-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.registry-item .text-action {
  min-height: 44px;
  margin-top: 2px;
  font-size: .82rem;
}

.reach-card-list ul,
.docs-list,
.health-results,
.file-list,
.tag-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.reach-card-list li + li {
  margin-top: 6px;
}

.reach-card-list a {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 9px;
  background: var(--end-soft);
  color: var(--text);
  padding: 8px 11px;
  font-size: .87rem;
  font-weight: 700;
  text-decoration: none;
}

.reach-card-list a:hover {
  color: var(--end-accent);
}

.reach-card-meta {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 5px;
}

/* 健康状态 */
.health-results {
  display: grid;
  gap: 8px;
}

.health-item {
  display: grid;
  grid-template-columns: auto minmax(90px, 1fr);
  gap: 2px 10px;
  min-height: 54px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-raised);
  padding: 9px 12px;
}

.health-indicator {
  grid-row: 1 / span 2;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--faint);
}

.health-name {
  font-weight: 750;
}

.health-state {
  grid-column: 2;
  font-size: .78rem;
}

.health-detail {
  grid-column: 2;
  color: var(--muted);
  font-size: .75rem;
  overflow-wrap: anywhere;
}

.health-item.is-ok .health-indicator {
  background: var(--ok);
}

.health-item.is-ok .health-state {
  color: var(--ok);
}

.health-item.is-bad .health-indicator {
  background: var(--danger);
}

.health-item.is-bad .health-state {
  color: var(--danger);
}

.health-item.is-tolerated .health-indicator,
.health-item.is-unknown .health-indicator {
  background: var(--faint);
}

.health-item.is-tolerated .health-state,
.health-item.is-unknown .health-state {
  color: var(--muted);
}

/* 提醒 */
.notice-list {
  display: grid;
  gap: 10px;
}

.notice {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  border: 1px solid var(--line);
  border-left: 4px solid var(--info);
  border-radius: 10px;
  background: var(--info-soft);
  padding: 13px 12px;
}

.notice-copy {
  min-width: 0;
}

.notice-copy p {
  margin: 7px 0 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.notice-info {
  border-left-color: var(--info);
  background: var(--info-soft);
}

.notice-info .level-badge {
  background: #dbe6ef;
  color: #405a75;
}

.notice-warn {
  border-left-color: var(--warn);
  background: var(--warn-soft);
}

.notice-warn .level-badge {
  background: #ffe3ad;
  color: #814300;
}

.notice-urgent {
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

.notice-urgent .level-badge {
  background: #ffdadd;
  color: #9e202c;
}

.notice-meta {
  color: var(--muted);
  font-size: .76rem;
}

.notice-dismiss {
  flex: none;
}

.notice-list-compact .notice-dismiss {
  display: none;
}

.notice-list-compact .notice {
  padding: 11px 12px;
}

/* 触达卡与文档 */
.back-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
}

.back-row code {
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reach-heading {
  align-items: center;
}

.summary-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 0;
}

.summary-grid > div {
  min-width: 0;
  border-left: 3px solid var(--primary);
  padding-left: 11px;
}

.summary-grid dt {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.summary-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.tag-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.tag-list li {
  background: var(--primary-soft);
  color: var(--primary);
}

.markdown-body {
  min-width: 0;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: clamp(18px, 4vw, 42px);
  line-height: 1.78;
}

.markdown-body > :first-child {
  margin-top: 0;
}

.markdown-body > :last-child {
  margin-bottom: 0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  margin-top: 1.55em;
  scroll-margin-top: 130px;
}

.markdown-body a {
  overflow-wrap: anywhere;
}

.markdown-body img,
.markdown-body video {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.markdown-body pre {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f1f4f8;
  padding: 13px 15px;
  font-size: .84rem;
  line-height: 1.55;
}

.markdown-body pre code {
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.markdown-body blockquote {
  margin: 1.2rem 0;
  border-left: 4px solid var(--primary);
  background: var(--primary-soft);
  padding: 9px 16px;
  color: var(--muted);
}

.markdown-body table {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--line);
  padding: 7px 11px;
  text-align: left;
}

.markdown-body th {
  background: var(--surface-soft);
}

.markdown-body hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2rem 0;
}

.docs-list-panel {
  padding: 8px;
}

.docs-list li + li {
  border-top: 1px solid var(--line);
}

.docs-list a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 12px;
  min-height: 62px;
  align-items: center;
  border-radius: 9px;
  color: var(--text);
  padding: 10px 12px;
  font-weight: 700;
  text-decoration: none;
}

.docs-list a:hover {
  background: var(--surface-soft);
  color: var(--primary);
}

.docs-list code {
  grid-column: 1;
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: .72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.docs-list a > :last-child {
  grid-column: 2;
  grid-row: 1 / span 2;
}

/* 素材与上传 */
.dropzone {
  display: flex;
  min-height: 190px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border: 2px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--surface-soft);
  padding: 22px 14px;
  text-align: center;
  transition: border-color .15s ease, background-color .15s ease, transform .15s ease;
}

.dropzone p {
  margin-bottom: 5px;
}

.dropzone .button {
  margin-top: 12px;
}

.dropzone.is-dragging {
  transform: translateY(-2px);
  border-color: var(--primary);
  background: var(--primary-soft);
}

.visually-hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.upload-queue {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.upload-queue:empty {
  display: none;
}

.upload-item {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-raised);
  padding: 9px 11px;
}

.upload-item-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
  font-size: .82rem;
}

.upload-item-heading strong {
  overflow-wrap: anywhere;
}

.upload-state {
  flex: 0 1 auto;
  color: var(--muted);
  font-size: .75rem;
  overflow-wrap: anywhere;
  text-align: right;
}

.upload-item progress {
  display: block;
  width: 100%;
  height: 8px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--surface-soft);
  accent-color: var(--primary);
}

.upload-item progress::-webkit-progress-bar {
  border-radius: 999px;
  background: var(--surface-soft);
}

.upload-item progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--primary);
}

.upload-item.is-done {
  border-color: #7fc99f;
  background: var(--ok-soft);
}

.upload-item.is-done .upload-state {
  color: var(--ok);
}

.upload-item.is-failed {
  border-color: #ef9ba3;
  background: var(--danger-soft);
}

.upload-item.is-failed .upload-state {
  color: var(--danger);
}

.files-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.file-area {
  min-width: 0;
  margin-bottom: 0;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 66px;
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
}

.file-item:last-child {
  border-bottom: 0;
}

.file-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.file-name {
  overflow-wrap: anywhere;
  font-size: .9rem;
}

.file-meta {
  color: var(--muted);
  font-size: .74rem;
}

.file-actions {
  display: flex;
  flex: none;
  gap: 4px;
}

.file-action {
  min-width: 48px;
  border-radius: 8px;
  padding: 7px 8px;
  font-size: .82rem;
  font-weight: 700;
  text-decoration: none;
}

.file-action:hover {
  background: var(--primary-soft);
  text-decoration: none;
}

/* 登录门控与自检 */
.gate-shell,
.diagnostic-main {
  width: 100%;
  max-width: 720px;
  margin: 3vh auto 0;
}

.gate-card,
.diagnostic-card,
.install-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: clamp(20px, 5vw, 38px);
}

.gate-mark {
  width: 48px;
  height: 48px;
  margin-bottom: 18px;
  border-radius: 13px;
  font-size: 1.25rem;
}

.gate-steps {
  margin: 22px 0;
  padding-left: 1.6rem;
}

.gate-steps li {
  padding: 5px 0 5px 5px;
}

.install-notes,
.gate-callout {
  margin: 20px 0;
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 15px 16px;
}

.install-notes h2 {
  font-size: 1rem;
}

.install-notes ul {
  margin: 0;
  padding-left: 1.3rem;
}

.install-notes li + li {
  margin-top: 8px;
}

.gate-callout p {
  margin: 0;
}

.gate-callout-warn {
  border: 1px solid #e5aa50;
  background: var(--warn-soft);
}

.gate-action {
  width: 100%;
}

.login-form {
  display: grid;
  gap: 8px;
  margin-top: 22px;
}

.login-form label {
  font-size: .84rem;
  font-weight: 750;
}

.login-form input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  background: var(--surface);
  padding: 10px 12px;
}

.login-form .button {
  margin-top: 8px;
}

.form-error {
  margin: 13px 0 0;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  padding: 9px 11px;
  font-weight: 700;
}

.selftest-page .site-main {
  max-width: 820px;
}

.diagnostic-main {
  margin-top: 0;
}

.diagnostic-card,
.install-card {
  margin-bottom: 18px;
}

.test-results {
  display: grid;
  gap: 8px;
  margin: 22px 0;
}

.test-row {
  display: grid;
  grid-template-columns: minmax(110px, .7fr) minmax(0, 1.3fr);
  gap: 12px;
  min-height: 52px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-raised);
  padding: 9px 12px;
}

.test-row dt {
  color: var(--muted);
  font-size: .8rem;
  font-weight: 800;
}

.test-row dd {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.test-row code {
  min-width: 0;
  overflow-wrap: anywhere;
}

.test-dot {
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  background: var(--faint);
}

.test-row.is-good {
  border-color: #83cba2;
  background: var(--ok-soft);
}

.test-row.is-good .test-dot {
  background: var(--ok);
}

.test-row.is-bad {
  border-color: #ef9ba3;
  background: var(--danger-soft);
}

.test-row.is-bad .test-dot {
  background: var(--danger);
}

.test-conclusion {
  margin: 0;
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 13px 15px;
  font-weight: 750;
}

.test-conclusion.is-good {
  background: var(--ok-soft);
  color: var(--ok);
}

.test-conclusion.is-bad {
  background: var(--danger-soft);
  color: var(--danger);
}

/* v0.2 会话驾驶舱 */
.cockpit-shell [hidden] {
  display: none !important;
}

.cockpit-gate-wrap {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px 14px;
}

.cockpit-gate-card {
  width: min(100%, 680px);
}

.cockpit-gate-card h1 {
  font-size: clamp(1.7rem, 7vw, 2.45rem);
}

.gate-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.cockpit-login-form .button {
  width: 100%;
}

.enroll-json {
  width: 100%;
  min-height: 180px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  background: var(--surface);
  padding: 12px;
  resize: vertical;
}

.cockpit-app {
  min-height: 100vh;
}

.cockpit-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 4px 18px rgb(21 31 45 / 7%);
}

.cockpit-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: min(100%, 1680px);
  margin: 0 auto;
  padding: 8px 12px;
}

.cockpit-brand {
  min-width: 0;
  flex: 0 1 auto;
}

.cockpit-brand .brand-copy strong,
.cockpit-brand .brand-copy small {
  max-width: min(30vw, 260px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cockpit-nav {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.cockpit-nav-link,
.cockpit-nav-button {
  display: inline-flex;
  min-width: 48px;
  min-height: 44px;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  font-size: .86rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.cockpit-nav-link:hover,
.cockpit-nav-button:hover {
  background: var(--surface-soft);
  color: var(--text);
  text-decoration: none;
}

.cockpit-ops {
  display: flex;
  width: min(100%, 1680px);
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  margin: 0 auto;
  padding: 0 12px 8px;
  color: var(--muted);
  font-size: .72rem;
  scrollbar-width: thin;
}

.cockpit-ops > span {
  flex: none;
  margin-right: 3px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.cockpit-ops button {
  min-height: 44px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--faint);
  padding: 7px 10px;
  font-size: .76rem;
  cursor: not-allowed;
}

.feed-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 50;
  width: min(100%, 480px);
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: -18px 0 48px rgb(17 24 39 / 22%);
  padding: 18px 14px 36px;
}

.feed-drawer-heading,
.feed-drawer-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.feed-drawer-heading {
  margin-bottom: 10px;
}

.feed-drawer-heading h2,
.feed-drawer-heading p,
.feed-drawer-tools p {
  margin-bottom: 0;
}

.feed-drawer-tools {
  align-items: flex-start;
  margin-bottom: 12px;
}

.feed-drawer .notice {
  flex-direction: column;
}

.feed-drawer .notice-dismiss {
  align-self: flex-end;
}

.cockpit-main {
  display: grid;
  width: min(100%, 1680px);
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin: 0 auto;
  padding: 14px 10px 48px;
}

.cockpit-panel {
  min-width: 0;
  margin: 0;
  padding: 14px;
}

.cockpit-panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.cockpit-panel-heading h1,
.cockpit-panel-heading p {
  margin-bottom: 0;
}

.cockpit-panel-heading h1 {
  font-size: clamp(1.45rem, 5vw, 2rem);
}

.connection-state {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 4px 10px;
  font-size: .75rem;
  white-space: nowrap;
}

.attach-block {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
  padding: 11px;
}

.attach-block > label {
  display: block;
  margin-bottom: 6px;
  font-size: .8rem;
  font-weight: 750;
}

.attach-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.attach-row input {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  background: var(--surface);
  padding: 9px 11px;
}

.recents-list {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-top: 8px;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.recents-empty {
  margin: 3px 0 0;
  font-size: .76rem;
}

.recent-item {
  display: inline-flex;
  min-width: 0;
  flex: none;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.recent-name,
.recent-forget {
  min-height: 44px;
  border: 0;
  background: transparent;
  padding: 7px 10px;
  font-size: .76rem;
  cursor: pointer;
}

.recent-name {
  max-width: min(58vw, 260px);
  overflow: hidden;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-name:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.recent-forget {
  border-left: 1px solid var(--line);
  color: var(--danger);
  white-space: nowrap;
}

.recent-forget:hover {
  background: var(--danger-soft);
}

.recent-forget:disabled {
  color: var(--faint);
  cursor: wait;
}

.pane-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.pane-toolbar > strong {
  min-width: 0;
  flex: 1 1 220px;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: .84rem;
}

.pane-toolbar-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pane-toolbar-actions .button {
  padding-inline: 11px;
  font-size: .78rem;
}

#paneview pre {
  width: 100%;
  height: min(52vh, 640px);
  min-height: min(300px, 52vh);
  overflow: auto;
  margin: 0;
  border: 1px solid #263d34;
  border-radius: 9px;
  background: #12211b;
  color: #d6e4da;
  padding: 12px;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  overscroll-behavior: contain;
  white-space: pre-wrap;
  word-break: break-all;
}

.keybar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.keybar button {
  min-width: 48px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 7px 10px;
  font-size: .79rem;
  font-weight: 700;
  cursor: pointer;
}

.keybar button:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.keybar button:disabled {
  color: var(--faint);
  cursor: not-allowed;
}

.sendbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
  gap: 7px;
  margin-top: 10px;
}

.sendbar textarea {
  width: 100%;
  min-height: 46px;
  max-height: 152px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  background: var(--surface);
  padding: 10px 11px;
  line-height: 1.45;
  resize: none;
}

.sendbar .button {
  min-width: 48px;
  padding-inline: 11px;
}

.pane-status {
  margin: 8px 0 0;
  overflow-wrap: anywhere;
}

.cockpit-upload {
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.cockpit-dropzone {
  min-height: 150px;
  padding: 16px 12px;
}

.cockpit-files .cockpit-files-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.cockpit-file-area {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-raised);
  padding: 12px;
}

.cockpit-file-area .panel-heading {
  margin-bottom: 4px;
}

.cockpit-file-area .file-item {
  align-items: flex-start;
}

.cockpit-file-area .file-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (min-width: 900px) {
  .cockpit-main {
    grid-template-columns: minmax(0, 1.7fr) minmax(330px, .9fr);
    align-items: start;
    gap: 16px;
    padding: 18px 16px 56px;
  }

  .cockpit-panel {
    padding: 18px;
  }

  .cockpit-files {
    position: sticky;
    top: 132px;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
  }
}

@media (min-width: 560px) {
  .header-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
  }

  .site-nav {
    width: auto;
  }

  .site-main {
    padding: 34px 18px 72px;
  }

  .site-footer {
    width: min(calc(100% - 36px), var(--content));
  }

  .page-heading-actions {
    flex-direction: row;
    align-items: center;
  }

  .health-item {
    grid-template-columns: auto minmax(110px, 1fr) auto minmax(120px, 1.2fr);
  }

  .health-indicator {
    grid-row: auto;
  }

  .health-state,
  .health-detail {
    grid-column: auto;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 820px) {
  .panel {
    padding: 22px;
  }

  .files-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1040px) {
  .ends-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0d1118;
    --surface: #151b24;
    --surface-raised: #19212c;
    --surface-soft: #202936;
    --text: #eef2f7;
    --muted: #a7b2c2;
    --faint: #788598;
    --line: #303b49;
    --line-strong: #445164;
    --primary: #79a7ff;
    --primary-hover: #a5c3ff;
    --primary-soft: #1b3158;
    --build-soft: #142b50;
    --maintain-soft: #3b2b15;
    --operate-soft: #12372d;
    --ok: #4ad587;
    --ok-soft: #123326;
    --danger: #ff8790;
    --danger-soft: #421e24;
    --warn: #f2ad4d;
    --warn-soft: #3d2c14;
    --info: #9db3ca;
    --info-soft: #202d3b;
    --shadow: 0 12px 32px rgb(0 0 0 / 24%);
  }

  .site-header {
    border-bottom-color: rgb(48 59 73 / 90%);
    background: rgb(21 27 36 / 92%);
  }

  .type-badge,
  .tag-list li {
    color: var(--text);
  }

  .stale-badge {
    border-color: #8f622d;
    background: #422e17;
    color: #ffd08a;
  }

  .notice-info .level-badge {
    background: #304359;
    color: #c7d9ea;
  }

  .notice-warn .level-badge {
    background: #583d17;
    color: #ffd18b;
  }

  .notice-urgent .level-badge {
    background: #5a252c;
    color: #ffc2c7;
  }

  .markdown-body pre {
    background: #10151d;
  }

  .gate-callout-warn {
    border-color: #8f622d;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  .site-header,
  .site-footer,
  .back-row,
  .dropzone,
  .upload-queue,
  .notice-dismiss {
    display: none !important;
  }

  body,
  .markdown-body,
  .panel,
  .end-card {
    background: #ffffff;
    color: #000000;
    box-shadow: none;
  }

  .site-main {
    width: 100%;
    max-width: none;
    padding: 0;
  }
}

/* 中英语言切换器 */
.lang-switch {
  display: inline-flex;
  flex: none;
  align-items: center;
  align-self: center;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 2px;
}

.lang-switch button {
  min-width: 32px;
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 3px 7px;
  font-size: .72rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.lang-switch button:hover {
  background: var(--surface);
  color: var(--text);
}

.lang-switch button[aria-pressed="true"] {
  background: var(--primary);
  color: #ffffff;
}

.lang-switch button:focus-visible {
  position: relative;
  z-index: 1;
}

.cockpit-gate-card,
.gate-card {
  position: relative;
}

.cockpit-gate-card > .lang-switch,
.gate-card > .lang-switch {
  position: absolute;
  top: 12px;
  right: 12px;
}

/* 三类服务器边界标示（面板机/会话机/产品机；规则见 docs/DERIVE.md §0.5）
   独立整行条（不塞进 header-inner 与品牌/导航争行）；窄屏横向滚动而非重叠——照 .cockpit-ops 同款响应式。 */
.cockpit-servers {
  display: flex;
  width: min(100%, 1680px);
  align-items: center;
  gap: 0.4rem;
  margin: 0 auto;
  padding: 0 12px 8px;
  overflow-x: auto;
  scrollbar-width: thin;
  font-size: 0.72rem;
}

.cockpit-servers .srv-item {
  display: inline-flex;
  flex: none;
  align-items: baseline;
  gap: 0.35em;
  padding: 0.12rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
  cursor: help;
}

.cockpit-servers .srv-role {
  color: var(--muted);
}

.cockpit-servers .srv-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 600;
  color: var(--text);
}

/* 便签编辑区（打字存为素材 md，密钥类不经 AI 会话明文） */
.cockpit-note {
  margin: 0.75rem 0;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.cockpit-note .note-text {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.86rem;
  resize: vertical;
  box-sizing: border-box;
}

.cockpit-note .note-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.cockpit-note .note-count {
  color: var(--muted);
  font-size: 0.72rem;
}
