:root {
  --forest-950: #072a2c;
  --forest-900: #0b3839;
  --forest-800: #104b4c;
  --forest-700: #17605f;
  --jade-600: #3d956b;
  --jade-500: #52b184;
  --jade-300: #a8d6c3;
  --jade-50: #edf7f1;
  --paper-50: #fcfbf7;
  --paper-100: #f6f3ec;
  --paper-200: #eee8de;
  --ink-900: #182728;
  --ink-700: #3d4b4b;
  --ink-500: #606d6c;
  --ink-300: #96a29f;
  --line: #d9dfd9;
  --line-strong: #c6d1c9;
  --wechat: #07c160;
  --coral: #d86754;
  --coral-soft: #fae8e3;
  --amber: #b27627;
  --amber-soft: #f8eedc;
  --blue: #607ea9;
  --blue-soft: #eaf0f8;
  --danger: #b94a50;
  --danger-soft: #f8e8e9;
  --font-ui: "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI", sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", "Microsoft YaHei UI", sans-serif;
  --font-mono: "Cascadia Mono", Consolas, "Microsoft YaHei UI", monospace;
  --radius: 8px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink-900);
  background: #e9ece7;
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.55;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
[hidden] { display: none !important; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.icon-sm { width: 15px; height: 15px; }

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, .9fr) minmax(440px, 1.1fr);
  background: var(--paper-50);
}
.login-brand {
  position: relative;
  overflow: hidden;
  padding: 54px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #f1f7f3;
  background: var(--forest-950);
}
.login-brand::before,
.login-brand::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(168, 214, 195, .16);
  border-radius: 50%;
}
.login-brand::before { width: 460px; height: 460px; right: -220px; top: -160px; }
.login-brand::after { width: 320px; height: 320px; left: -170px; bottom: -130px; }
.login-brand img { position: relative; z-index: 1; width: 210px; height: auto; }
.login-copy { position: relative; z-index: 1; max-width: 430px; }
.login-copy .eyebrow { color: var(--jade-300); }
.login-copy h1 { margin: 10px 0 14px; font-family: var(--font-display); font-size: clamp(30px, 4vw, 48px); line-height: 1.12; }
.login-copy p { margin: 0; color: #a8bbb6; font-size: 14px; }
.login-facts { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 8px; }
.login-facts span { padding: 6px 9px; border: 1px solid rgba(168, 214, 195, .16); border-radius: 999px; color: #b7cac4; font-size: 11px; }
.login-form-wrap { display: grid; place-items: center; padding: 34px; }
.login-form { width: min(390px, 100%); }
.login-form h2 { margin: 0 0 5px; font-family: var(--font-display); font-size: 26px; }
.login-form > p { margin: 0 0 28px; color: var(--ink-500); }
.login-submit { width: 100%; min-height: 46px; margin-top: 28px; font-size: 12px; }
.login-foot { margin-top: 22px; color: var(--ink-300); font-size: 11px; }

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  color: #edf5f1;
  background: var(--forest-950);
}
.brand {
  height: 76px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(220, 231, 228, .09);
}
.brand img { width: 154px; height: auto; }
.admin-tag {
  margin: 15px 14px 8px;
  padding: 10px 11px;
  border: 1px solid rgba(168, 214, 195, .13);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(255, 255, 255, .035);
}
.admin-tag .icon { color: var(--jade-300); }
.admin-tag strong, .admin-tag span { display: block; }
.admin-tag strong { font-size: 11px; }
.admin-tag span { color: #9db2ac; font-size: 9px; }
.nav { flex: 1; padding: 10px 11px; overflow: auto; }
.nav-label { margin: 15px 9px 7px; color: #9db2ac; font-size: 9px; font-weight: 700; letter-spacing: .08em; }
.nav-label:first-child { margin-top: 0; }
.nav-item {
  width: 100%;
  min-height: 38px;
  margin: 2px 0;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #9db2ac;
  background: transparent;
  text-align: left;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.055); }
.nav-item.active { color: #fff; background: rgba(168,214,195,.13); box-shadow: inset 3px 0 0 var(--jade-500); }
.nav-item span { flex: 1; }
.nav-count { min-width: 20px; height: 19px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; color: #ffede8; background: rgba(216,103,84,.24); font-size: 9px; }
.nav-count:empty { display: none; }
.sidebar-foot { padding: 13px 13px 16px; border-top: 1px solid rgba(220,231,228,.09); }
.cloud-state { padding: 10px; border: 1px solid rgba(220,231,228,.11); border-radius: var(--radius); background: rgba(255,255,255,.03); }
.cloud-state strong { display: flex; align-items: center; gap: 7px; font-size: 10px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--jade-500); box-shadow: 0 0 0 3px rgba(82,177,132,.13); }
.dot.offline { background: var(--danger); box-shadow: 0 0 0 3px rgba(185,74,80,.14); }
.cloud-state span { display: block; margin-top: 3px; color: #9db2ac; font-size: 8px; }
.operator { margin-top: 10px; padding: 3px 5px; display: flex; align-items: center; gap: 9px; }
.operator-avatar { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; color: var(--forest-950); background: var(--paper-100); font-size: 11px; font-weight: 700; }
.operator strong, .operator span { display: block; }
.operator strong { font-size: 10px; }
.operator span { color: #9db2ac; font-size: 8px; }

.workspace { min-width: 0; background: #f1f2ee; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 62px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(252,251,247,.97);
  backdrop-filter: blur(12px);
}
.context { display: flex; align-items: center; gap: 7px; min-width: 170px; }
.context span { color: var(--ink-500); font-size: 10px; }
.context strong { font-size: 12px; }
.spacer { flex: 1; }
.env-chip { padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; display: flex; align-items: center; gap: 6px; color: var(--ink-500); background: var(--paper-50); font-size: 9px; white-space: nowrap; }
.icon-button { width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 6px; display: inline-grid; place-items: center; color: var(--ink-700); background: var(--paper-50); }
.icon-button:hover { border-color: var(--jade-500); background: var(--jade-50); }
.operator-chip { height: 32px; padding: 0 9px 0 4px; border: 1px solid var(--line); border-radius: 999px; display: flex; align-items: center; gap: 7px; background: var(--paper-50); font-size: 9px; }
.operator-chip i { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: var(--forest-950); background: var(--paper-200); font-size: 9px; font-style: normal; font-weight: 700; }

main { padding: 22px 24px 42px; overflow: hidden; }
.page { display: none; }
.page.active { display: block; animation: pageIn 180ms var(--ease); }
@keyframes pageIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page-head { margin-bottom: 18px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.eyebrow { margin: 0; color: var(--forest-700); font-size: 9px; font-weight: 750; letter-spacing: .09em; }
h1 { margin: 6px 0 4px; font-family: var(--font-display); font-size: 27px; line-height: 1.2; font-weight: 700; }
.page-head p { margin: 0; color: var(--ink-500); font-size: 10px; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--ink-700);
  background: var(--paper-50);
  font-size: 10px;
  font-weight: 600;
  text-decoration: none;
}
.button:hover { border-color: var(--jade-500); }
.button.primary { color: #07302f; border-color: var(--jade-300); background: var(--jade-300); }
.button.primary:hover { background: #b8dece; }
.button.secondary { background: var(--paper-100); }
.button.danger { color: var(--danger); border-color: #e2bdc0; background: var(--danger-soft); }
.button.small { min-height: 28px; padding: 0 9px; font-size: 9px; }
.button.quiet { border-color: transparent; background: transparent; color: var(--ink-500); }
.link-button { padding: 0; border: 0; color: var(--forest-700); background: transparent; font-size: 10px; font-weight: 650; }
.link-button:hover { text-decoration: underline; }

.metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--paper-50); }
.metric { min-height: 116px; padding: 17px 18px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric span { display: block; color: var(--ink-500); font-size: 9px; }
.metric strong { display: block; margin-top: 7px; font-family: var(--font-display); font-size: 25px; line-height: 1.1; }
.metric small { display: block; margin-top: 8px; color: var(--ink-500); font-size: 9px; }
.metric small b { color: var(--forest-700); }
.dashboard-grid { margin-top: 14px; display: grid; grid-template-columns: minmax(0,1.35fr) minmax(300px,.65fr); gap: 14px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-50); overflow: hidden; }
.panel + .panel { margin-top: 14px; }
.panel-head { min-height: 54px; padding: 12px 15px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.panel-head h2, .panel-head h3 { margin: 0; font-size: 12px; }
.panel-head p { margin: 2px 0 0; color: var(--ink-500); font-size: 8px; }
.panel-body { padding: 15px; }
.empty-state { min-height: 150px; padding: 24px; display: grid; place-items: center; color: var(--ink-500); text-align: center; }
.empty-state strong { display: block; color: var(--ink-700); font-size: 12px; }
.empty-state span { display: block; max-width: 390px; margin-top: 4px; font-size: 10px; }
.loading { min-height: 130px; display: grid; place-items: center; color: var(--ink-500); font-size: 10px; }
.loading::before { content: ""; width: 16px; height: 16px; margin-right: 8px; border: 2px solid var(--line); border-top-color: var(--jade-600); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.activity-list { display: grid; }
.activity-row { min-height: 58px; padding: 9px 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 32px minmax(0,1fr) auto; align-items: center; gap: 10px; }
.activity-row:first-child { border-top: 0; padding-top: 0; }
.activity-icon { width: 32px; height: 32px; border-radius: 7px; display: grid; place-items: center; color: var(--amber); background: var(--amber-soft); }
.activity-row strong { display: block; font-size: 10px; }
.activity-row p { margin: 2px 0 0; color: var(--ink-500); font-size: 8px; }
.activity-meta { text-align: right; color: var(--ink-500); font-size: 8px; white-space: nowrap; }

.toolbar { padding: 12px 15px; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.search { min-width: 210px; flex: 1; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; display: flex; align-items: center; gap: 7px; background: #fff; }
.search .icon { color: var(--ink-500); }
.search input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; font-size: 11px; }
.select, .field input, .field select, .field textarea {
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: 0;
  background: #fff;
  font-size: 11px;
}
.select { width: auto; min-width: 128px; }
.field input:focus, .field select:focus, .field textarea:focus, .select:focus { border-color: var(--jade-600); box-shadow: 0 0 0 3px rgba(61,149,107,.11); }
.field textarea { min-height: 86px; resize: vertical; }
.field { display: grid; gap: 6px; }
.field label { color: var(--ink-700); font-size: 10px; font-weight: 650; }
.field small { color: var(--ink-500); font-size: 9px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }

.table-wrap { width: 100%; overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.data-table th { padding: 10px 12px; color: var(--ink-500); background: #f8f7f2; font-size: 9px; font-weight: 650; text-align: left; white-space: nowrap; }
.data-table td { padding: 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr:hover { background: #fbfaf6; }
.data-table strong, .data-table small { display: block; }
.data-table strong { font-size: 10px; font-weight: 650; }
.data-table small { margin-top: 2px; color: var(--ink-500); font-size: 8px; }
.table-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.status { width: max-content; padding: 3px 7px; border-radius: 999px; display: inline-flex; align-items: center; gap: 4px; color: var(--ink-500); background: #ecefeb; font-size: 8px; font-weight: 650; white-space: nowrap; }
.status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status.green { color: #287a52; background: var(--jade-50); }
.status.amber { color: var(--amber); background: var(--amber-soft); }
.status.blue { color: #516f9b; background: var(--blue-soft); }
.status.red { color: var(--danger); background: var(--danger-soft); }
.status.gray { color: var(--ink-500); background: #ecefeb; }

.release-flow { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); border-bottom: 1px solid var(--line); }
.release-step { min-height: 76px; padding: 13px 14px; border-right: 1px solid var(--line); display: flex; gap: 10px; }
.release-step:last-child { border-right: 0; }
.release-number { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: var(--forest-800); background: var(--jade-300); font-family: var(--font-mono); font-size: 9px; font-weight: 700; }
.release-step strong { display: block; font-size: 10px; }
.release-step p { margin: 3px 0 0; color: var(--ink-500); font-size: 8px; line-height: 1.5; }
.diagnostic-layout { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 14px; }
.diagnostic-detail { min-height: 430px; }
.detail-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.detail-title h2 { margin: 0; font-size: 14px; }
.detail-title p { margin: 3px 0 0; color: var(--ink-500); font-size: 9px; }
.detail-section { margin-top: 18px; }
.detail-section h3 { margin: 0 0 8px; font-size: 10px; }
.code-preview { margin: 0; padding: 12px; min-height: 180px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; color: #dfeae5; background: var(--forest-950); font: 10px/1.65 var(--font-mono); white-space: pre-wrap; word-break: break-word; }
.state-steps { display: grid; grid-template-columns: repeat(5,1fr); gap: 5px; margin: 10px 0 16px; }
.state-step { padding-top: 8px; border-top: 3px solid var(--line); color: var(--ink-500); font-size: 8px; text-align: center; }
.state-step.done { border-color: var(--jade-500); color: var(--forest-700); }
.meta-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.meta-grid div { padding: 9px; border: 1px solid var(--line); border-radius: 6px; background: #faf9f5; }
.meta-grid span, .meta-grid strong { display: block; }
.meta-grid span { color: var(--ink-500); font-size: 8px; }
.meta-grid strong { margin-top: 2px; font-size: 10px; }

.modal-scrim { position: fixed; inset: 0; z-index: 100; padding: 24px; display: grid; place-items: center; background: rgba(7,42,44,.42); backdrop-filter: blur(4px); }
.modal { width: min(620px,100%); max-height: calc(100vh - 48px); overflow: auto; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--paper-50); box-shadow: 0 24px 72px rgba(7,42,44,.24); animation: modalIn 180ms var(--ease); }
@keyframes modalIn { from { opacity: 0; transform: translateY(6px) scale(.99); } to { opacity: 1; transform: none; } }
.modal-head { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.modal-head h2 { margin: 0; font-family: var(--font-display); font-size: 17px; }
.modal-head p { margin: 3px 0 0; color: var(--ink-500); font-size: 9px; }
.modal-body { padding: 18px; }
.modal-foot { padding: 13px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.code-reveal { padding: 16px; border: 1px solid var(--jade-300); border-radius: 7px; background: var(--jade-50); }
.code-reveal span { display: block; color: var(--ink-500); font-size: 9px; }
.code-reveal strong { display: block; margin: 7px 0 10px; font: 700 22px/1.3 var(--font-mono); letter-spacing: .02em; word-break: break-all; }
.notice { padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink-500); background: #f7f6f1; font-size: 9px; }
.notice.warning { color: var(--amber); border-color: #ead8b9; background: var(--amber-soft); }
.form-error { margin: 10px 0 0; padding: 9px 11px; border: 1px solid #e7c0c3; border-radius: 6px; color: var(--danger); background: var(--danger-soft); font-size: 10px; }
.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: grid; gap: 8px; }
.toast { min-width: 260px; max-width: 390px; padding: 11px 13px; border: 1px solid var(--line-strong); border-left: 3px solid var(--jade-500); border-radius: 6px; background: var(--paper-50); box-shadow: 0 12px 36px rgba(7,42,44,.16); font-size: 10px; animation: toastIn 180ms var(--ease); }
.toast.error { border-left-color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.facts { display: flex; flex-wrap: wrap; gap: 8px; }
.fact { padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-500); background: #fff; font-size: 8px; }

@media (max-width: 1080px) {
  .app { grid-template-columns: 196px minmax(0,1fr); }
  .dashboard-grid, .diagnostic-layout { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2,1fr); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 760px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: 290px; padding: 30px; }
  .login-copy h1 { font-size: 32px; }
  .login-facts { display: none; }
  .app { display: block; }
  .sidebar { position: static; width: 100%; height: auto; }
  .brand { height: 62px; }
  .admin-tag, .sidebar-foot { display: none; }
  .nav { padding: 6px; display: flex; overflow: auto; }
  .nav-label { display: none; }
  .nav-item { width: auto; min-width: max-content; padding: 0 11px; }
  .nav-item span { flex: none; }
  .nav-count { display: none; }
  .topbar { padding: 0 12px; }
  .context span, .env-chip, .operator-chip { display: none; }
  main { padding: 16px 12px 32px; }
  .page-head { align-items: flex-start; flex-direction: column; gap: 12px; }
  .metrics, .form-grid, .release-flow, .meta-grid { grid-template-columns: 1fr; }
  .metric { border-right: 0; border-bottom: 1px solid var(--line); }
  .metric:last-child { border-bottom: 0; }
  .release-step { border-right: 0; border-bottom: 1px solid var(--line); }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search, .select { width: 100%; }
  .modal-scrim { padding: 10px; }
  .modal { max-height: calc(100vh - 20px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
