/* OneStack 管理台 —— Stitch 导出设计还原（玻璃拟态 + 浮动导航 + Dock）
   来源：用户在 Stitch 生成并导出的「总览 (Scrollable Dock)」设计。
   不依赖 Tailwind / Google Fonts：系统字体 + 手写等价样式 + 内联 SVG 图标。 */

:root {
  --bg: #f8f9ff;
  --ink: #0d1c2f;
  --ink-2: #45474c;
  --outline: #75777d;
  --outline-2: #c5c6cd;
  --primary: #091426;
  --green: #059669;
  --green-bright: #10b981;
  --green-bg: #ecfdf5;
  --green-border: #a7f3d0;
  --red: #dc2626;
  --red-deep: #991b1b;
  --red-bg: #fef2f2;
  --red-border: #fecaca;
  --blue: #2563eb;
  --blue-bg: #eff6ff;
  --blue-border: #bfdbfe;
  --amber: #d97706;
  --amber-deep: #92400e;
  --amber-bg: #fffbeb;
  --amber-border: #fde68a;
  --glass-bg: rgba(255, 255, 255, 0.66);
  --glass-border: rgba(255, 255, 255, 0.5);
  --glass-shadow: 0 8px 32px rgba(31, 38, 135, 0.06);
  --nav-bg: rgba(255, 255, 255, 0.7);
  --nav-shadow: 0 4px 24px rgba(0, 0, 0, 0.05);
  --r-xl: 24px;
  --r-lg: 16px;
  --r-md: 12px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--ink);
  font: 400 14px/1.6 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter",
    "PingFang SC", "Hiragino Sans GB", "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* 流动渐变底 */
body.fluid {
  background: linear-gradient(-45deg, #e0e7ff, #f3e8ff, #fae8ff, #ffedd5);
  background-size: 400% 400%;
  animation: gradientMove 15s ease infinite;
  padding-bottom: 120px;
}
@keyframes gradientMove {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

a { color: inherit; text-decoration: none; }
::selection { background: rgba(37, 99, 235, 0.14); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(13, 28, 47, 0.18); border-radius: 4px; }

/* 背景注册趋势曲线（真实数据，由 JS 注入 path） */
.hero-chart-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.15;
  pointer-events: none;
}
.hero-chart-bg svg { width: 100%; height: 100%; }

/* --- 玻璃材质 -------------------------------------------------------- */

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

/* --- 顶部浮动导航 ----------------------------------------------------- */

.topnav {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 2rem);
  max-width: 1280px;
  height: 64px;
  border-radius: var(--r-xl);
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: var(--nav-shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 40;
}

.topnav .brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.topnav .brand h1 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: var(--primary);
  white-space: nowrap;
}
.topnav .divider { width: 1px; height: 24px; background: rgba(197, 198, 205, 0.3); }
.topnav .status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
}
.topnav .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green-bright);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.65; }
}

.topnav .spacer { flex: 1; }

.topnav .account {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background 200ms var(--ease);
  white-space: nowrap;
}
.topnav .account:hover { background: rgba(255, 255, 255, 0.5); }
.topnav .account .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #dde9ff, #c5d8f7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
}
.topnav .account .email {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topnav .account a { color: var(--ink-2); font-size: 12px; border-left: 1px solid rgba(197,198,205,.3); padding-left: 10px; }
.topnav .account a:hover { color: var(--red); }

@media (max-width: 860px) {
  .topnav .status { display: none; }
  .topnav .divider { display: none; }
  .topnav .account .email { display: none; }
}

/* --- 底部 Dock 导航 --------------------------------------------------- */

.dock {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  filter: drop-shadow(0 12px 24px rgba(13, 28, 47, 0.14));
}
.dock .dock-inner {
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  display: flex;
  align-items: center;
  padding: 8px;
  gap: 6px;
}
.dock a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: all 200ms var(--ease);
}
.dock a:hover { background: rgba(255, 255, 255, 0.4); color: var(--primary); }
.dock a.active {
  color: var(--primary);
  font-weight: 700;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 1px 3px rgba(13, 28, 47, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.8);
}
.dock .dock-sep { width: 1px; height: 24px; background: rgba(197, 198, 205, 0.3); margin: 0 6px; }
.dock a.icon-only { padding: 10px 12px; }
.dock svg { width: 20px; height: 20px; }
@media (max-width: 700px) {
  .dock a span { display: none; }
  .dock a { padding: 10px 12px; }
}

/* --- 主区 ------------------------------------------------------------- */

.main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 104px clamp(16px, 3vw, 32px) 40px;
  position: relative;
  z-index: 10;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: var(--r-xl);
  padding: 16px 32px;
  margin-bottom: 28px;
}
.page-head h2 { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.page-head .sub { color: var(--ink-2); font-size: 13px; margin-top: 4px; }

/* --- 玻璃卡片通用 ----------------------------------------------------- */

.card-glass {
  border-radius: var(--r-xl);
  padding: 24px;
  margin-bottom: 24px;
}
.card-glass > h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
}
.card-glass .card-body {
  padding: 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* --- 总览：状态头 ----------------------------------------------------- */

.status-hero {
  border-radius: var(--r-xl);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  animation: rise 300ms var(--ease) both;
}
.status-hero .lead { display: flex; align-items: center; gap: 20px; }
.status-hero .icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.status-hero .icon-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--green-bright);
  opacity: 0.1;
}
.status-hero .icon-wrap svg { position: relative; color: var(--green); width: 28px; height: 28px; }
.status-hero h3 { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.status-hero p { margin: 4px 0 0; color: var(--ink-2); font-size: 13px; }

.pending-cta {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(254, 202, 202, 0.5);
  border-radius: var(--r-lg);
  padding: 14px 18px;
  cursor: pointer;
  transition: background 200ms var(--ease);
  position: relative;
  overflow: hidden;
}
.pending-cta:hover { background: rgba(255, 255, 255, 0.6); }
.pending-cta::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--red-bg);
  opacity: 0.4;
}
.pending-cta svg { position: relative; color: var(--red); width: 22px; height: 22px; }
.pending-cta .text { position: relative; }
.pending-cta .strong { display: block; font-size: 13px; font-weight: 700; color: var(--red-deep); }
.pending-cta .note { display: block; font-size: 11px; color: #b91c1c; opacity: 0.85; }
.pending-cta .chev { position: relative; color: var(--red); transition: transform 200ms var(--ease); }
.pending-cta:hover .chev { transform: translateX(4px); }

/* --- 总览：指标网格 --------------------------------------------------- */

.metrics {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}
.metric {
  border-radius: var(--r-xl);
  padding: 20px;
  height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 300ms var(--ease);
  animation: rise 300ms var(--ease) both;
}
.metric:hover { transform: translateY(-4px); }
.metric .label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-2);
  opacity: 0.75;
  display: flex;
  align-items: center;
  gap: 4px;
}
.metric .value-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}
.metric .value {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.metric .corner { color: rgba(69, 71, 76, 0.5); }
.metric .corner.green { color: rgba(5, 150, 105, 0.8); }
.metric .corner.amber { color: rgba(217, 119, 6, 0.8); }
.metric .live {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--green);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
}
.metric .live i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green-bright);
  animation: pulse 1.8s ease-in-out infinite;
  box-shadow: 0 0 4px var(--green-bright);
}
.metric .tip {
  position: absolute;
  top: -44px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(13, 28, 47, 0.12);
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 200ms var(--ease);
  z-index: 10;
  pointer-events: none;
}
.metric { position: relative; }
.metric:hover .tip { opacity: 1; visibility: visible; }
@media (max-width: 1000px) { .metrics { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .metrics { grid-template-columns: repeat(1, 1fr); } }

/* --- 总览：主行（认证方式 + 近期事件） ------------------------------- */

.dash-row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 24px;
}
@media (max-width: 1000px) { .dash-row { grid-template-columns: 1fr; } }

.auth-method { display: flex; flex-direction: column; gap: 22px; }
.auth-method .row-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 8px;
}
.auth-method .method { display: flex; align-items: center; gap: 12px; font-size: 13px; font-weight: 500; }
.auth-method .m-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
}
.auth-method .count { font-family: var(--mono); font-size: 14px; font-weight: 700; }
.auth-method .track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  overflow: hidden;
}
.auth-method .fill {
  height: 100%;
  border-radius: 999px;
  background: rgba(9, 20, 38, 0.75);
  transition: width 600ms var(--ease);
}
.auth-method .fill.alt-1 { background: rgba(84, 95, 115, 0.65); }
.auth-method .fill.alt-2 { background: rgba(117, 119, 125, 0.55); }

/* --- 事件列表 --------------------------------------------------------- */

.events-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px !important;
  background: rgba(255, 255, 255, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
.events-head button {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  background: rgba(255, 255, 255, 0.4);
  border: none;
  border-radius: 999px;
  padding: 4px 14px;
  cursor: pointer;
  transition: background 200ms var(--ease);
}
.events-head button:hover { background: rgba(255, 255, 255, 0.65); }

.event-list { list-style: none; margin: 0; padding: 8px; }
.event-item {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 18px;
  border-radius: var(--r-md);
  transition: background 200ms var(--ease);
  animation: rise 260ms var(--ease) both;
}
.event-item:hover { background: rgba(255, 255, 255, 0.4); }
.event-item .e-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.8);
  position: relative;
  overflow: hidden;
}
.event-item .e-icon::before { content: ""; position: absolute; inset: 0; opacity: 0.45; }
.event-item .e-icon svg { position: relative; width: 18px; height: 18px; }
.event-item .e-icon.green::before { background: var(--green-bg); }
.event-item .e-icon.green svg { color: var(--green); }
.event-item .e-icon.blue::before { background: var(--blue-bg); }
.event-item .e-icon.blue svg { color: var(--blue); }
.event-item .e-icon.amber::before { background: var(--amber-bg); }
.event-item .e-icon.amber svg { color: var(--amber); }
.event-item .e-icon.gray::before { background: #f1f5f9; }
.event-item .e-icon.gray svg { color: #475569; }
.event-item .body { flex: 1; min-width: 0; }
.event-item .title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 2px;
}
.event-item .title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-item .when {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.5);
  padding: 1px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.event-item .sub { font-size: 13px; color: var(--ink-2); opacity: 0.85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); }
.event-item.warn {
  background: rgba(255, 251, 235, 0.35);
  border: 1px solid rgba(253, 230, 138, 0.25);
}
.event-item.warn .title, .event-item.warn .sub { color: var(--amber-deep); }

/* --- 自定义下拉（替代原生 select 弹层） ------------------------------- */

.dd { position: relative; display: inline-flex; }
.dd-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--outline-2);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(13, 28, 47, 0.04);
  cursor: pointer;
  transition: all 180ms var(--ease);
}
.dd-trigger:hover { background: #fff; border-color: rgba(24, 24, 27, 0.28); }
.dd-trigger svg { transition: transform 180ms var(--ease); color: var(--ink-2); }
.dd-trigger[aria-expanded="true"] {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(9, 20, 38, 0.08);
  background: #fff;
}
.dd-label { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dd-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 100%;
  z-index: 30;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 12px 32px -6px rgba(13, 28, 47, 0.18);
  border-radius: 14px;
  padding: 6px;
}
.dd-panel.open { display: flex; flex-direction: column; animation: rise 160ms var(--ease) both; }
.dd-option {
  border: none;
  background: transparent;
  border-radius: 9px;
  padding: 8px 14px;
  text-align: left;
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
  box-shadow: none;
  cursor: pointer;
  transition: background 120ms var(--ease);
}
.dd-option:hover { background: rgba(239, 244, 255, 0.9); }
.dd-option.active {
  color: var(--verdigris-deep, #23614f);
  background: var(--verdigris-soft, #e9f2ef);
  font-weight: 600;
}

/* --- Tab 页签（分段控件，Stitch 风） ---------------------------------- */

.tab-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 5px;
  margin-bottom: 18px;
  width: fit-content;
}
.tab-bar button {
  border: none;
  background: transparent;
  color: var(--ink-2);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: none;
}
.tab-bar button:hover { background: rgba(255, 255, 255, 0.45); }
.tab-bar button.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px -2px rgba(9, 20, 38, 0.4);
}

/* 紧凑页头（替代大标题玻璃条）；窄屏自动换行 */
.compact-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  row-gap: 10px;
  margin: 4px 0 16px;
  animation: rise 260ms var(--ease) both;
}
.compact-head h2 { font-size: 17px; font-weight: 650; margin: 0; letter-spacing: -0.01em; }
.compact-head .sub { color: var(--ink-2); font-size: 12.5px; }
.compact-head .spacer { flex: 1; }
.compact-head .email-line {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
}

/* 用户列表单元格：主行 + 灰色小字副行 */
.cell-two b { display: block; font-weight: 600; font-size: 13px; }
.cell-two span {
  display: block;
  color: var(--ink-2);
  font-size: 11.5px;
  font-family: var(--mono);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-panel { display: none; }
.tab-panel.visible { display: block; animation: rise 240ms var(--ease) both; }

/* --- 表格与工具栏（用户/客户端/审计页） ------------------------------ */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  border-radius: var(--r-xl);
  padding: 18px 24px;
  margin-bottom: 24px;
}
.toolbar input, .toolbar select,
.compact-head input, .compact-head select {
  border: 1px solid var(--outline-2);
  background: rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  box-shadow: 0 1px 2px rgba(13, 28, 47, 0.04);
  transition: all 180ms var(--ease);
}
.toolbar input:focus, .toolbar select:focus,
.compact-head input:focus, .compact-head select:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(9, 20, 38, 0.08);
}
.toolbar input[type="search"], .compact-head input[type="search"] { width: 240px; }
.toolbar .spacer { flex: 1; }

table.grid {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 13px;
}
table.grid th, table.grid td {
  text-align: left;
  padding: 10px 14px 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
  vertical-align: top;
  white-space: nowrap;
}
table.grid th {
  color: var(--ink-2);
  font-weight: 550;
  font-size: 12px;
  padding-top: 4px;
}
table.grid tbody tr { transition: background 160ms var(--ease); animation: rise 260ms var(--ease) both; }
table.grid tbody tr:hover { background: rgba(255, 255, 255, 0.4); }
table.grid td.wrap, table.grid th.wrap { white-space: normal; }
table.grid td.mono {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.dim { color: var(--ink-2); }
.small { font-size: 12px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink-2);
  border: 1px solid rgba(255, 255, 255, 0.7);
}
.badge.ok { background: var(--green-bg); color: var(--green); border-color: var(--green-border); }
.badge.warn { background: var(--amber-bg); color: var(--amber-deep); border-color: var(--amber-border); }
.badge.danger { background: var(--red-bg); color: var(--red-deep); border-color: var(--red-border); }

.chip {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.7);
  font-size: 11.5px;
  line-height: 1.8;
  margin: 1px 2px 1px 0;
  color: var(--ink-2);
}

/* --- 控件 ------------------------------------------------------------- */

button, .button {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1.6;
  transition: all 200ms var(--ease);
}
button:hover, .button:hover { background: rgba(255, 255, 255, 0.8); }
button:active, .button:active { transform: scale(0.97); }
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover { background: #1a2b45; }
button.danger { color: var(--red); border-color: rgba(220, 38, 38, 0.35); background: rgba(255,255,255,.5); }
button.danger:hover { background: var(--red-bg); }
button:disabled { opacity: 0.4; cursor: default; transform: none; }

.pagination {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: flex-end;
  padding-top: 16px;
  color: var(--ink-2);
  font-size: 12.5px;
  font-family: var(--mono);
}

/* --- 详情页 ----------------------------------------------------------- */

.kv { display: grid; grid-template-columns: 96px 1fr; gap: 7px 16px; font-size: 13px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; word-break: break-all; font-family: var(--mono); font-size: 12.5px; }

.flash {
  border-radius: var(--r-md);
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 13px;
  border: 1px solid;
}
.flash.ok { color: var(--green); border-color: var(--green-border); background: var(--green-bg); }
.flash.error { color: var(--red-deep); border-color: var(--red-border); background: var(--red-bg); }

details.metadata summary { cursor: pointer; color: var(--ink-2); font-size: 12px; }
details.metadata pre {
  font-family: var(--mono);
  font-size: 11.5px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: var(--r-md);
  padding: 12px;
  overflow-x: auto;
  max-width: 480px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--ink-2);
}
.back-link:hover { color: var(--primary); }

.loading {
  color: var(--ink-2);
  padding: 64px 0;
  text-align: center;
  font-size: 13px;
}
.loading::after {
  content: "";
  display: block;
  width: 96px;
  height: 2px;
  margin: 14px auto 0;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(13, 28, 47, 0.25), transparent);
  animation: shimmer 1.2s ease-in-out infinite;
}
@keyframes shimmer { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

/* --- 登录页（Stitch 两步式设计还原）----------------------------------- */

body.login-page-body {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px 16px;
  overflow-x: hidden;
}
body.login-page-body.fluid { animation: none; }

/* 呼吸光斑背景 */
.login-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    radial-gradient(circle at 15% 50%, rgba(213, 227, 253, 0.4) 0%, transparent 50%),
    radial-gradient(circle at 85% 30%, rgba(221, 233, 255, 0.4) 0%, transparent 50%);
  animation: bgBreathe 15s ease-in-out infinite alternate;
}
@keyframes bgBreathe {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.05); opacity: 1; }
}

/* 错误 toast（顶部滑入） */
.login-toast {
  position: fixed;
  top: 28px;
  left: 50%;
  transform: translate(-50%, -16px);
  z-index: 50;
  background: var(--red-bg);
  color: var(--red-deep);
  border: 1px solid rgba(186, 26, 26, 0.2);
  box-shadow: 0 8px 24px rgba(186, 26, 26, 0.12);
  border-radius: var(--r-md);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: all 300ms var(--ease);
}
.login-toast.show { opacity: 1; transform: translate(-50%, 0); }
.login-toast.ok { background: var(--green-bg); color: var(--green); border-color: rgba(5, 150, 105, 0.2); box-shadow: 0 8px 24px rgba(5, 150, 105, 0.1); }
.login-toast svg { width: 18px; height: 18px; flex-shrink: 0; }

/* 顶部白名单胶囊 */
.login-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--ink-2);
  background: var(--surface-container-low, #eff4ff);
  border: 1px solid rgba(204, 219, 244, 0.6);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 24px;
  animation: rise 300ms var(--ease) both;
}
.login-notice svg { width: 15px; height: 15px; }

.login-stage {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 登录卡 */
.login-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 4px 24px -4px rgba(13, 28, 47, 0.05), 0 0 1px rgba(13, 28, 47, 0.1);
  border-radius: var(--r-lg);
  padding: 32px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: rise 300ms var(--ease) both;
}
.login-card .brand-block {
  width: 48px;
  height: 48px;
  border-radius: var(--r-lg);
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(13, 28, 47, 0.2);
}
.login-card .brand-block svg { width: 26px; height: 26px; }
.login-card h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 4px; color: var(--primary); text-align: center; }
.login-card .sub { color: var(--ink-2); font-size: 13px; margin: 0 0 36px; text-align: center; }

/* OAuth 按钮（品牌 logo 全宽） */
.oauth-col { width: 100%; display: flex; flex-direction: column; gap: 12px; margin-bottom: 28px; }
.oauth-btn {
  width: 100%;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--outline-2);
  border-radius: var(--r-md);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  transition: background 150ms var(--ease), transform 120ms var(--ease);
}
.oauth-btn:hover { background: #eff4ff; }
.oauth-btn:active { transform: scale(0.98); }
.oauth-btn svg { width: 20px; height: 20px; }

/* “或”分隔线 */
.login-divider {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.login-divider::before, .login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(197, 198, 205, 0.5);
}
.login-divider span { color: var(--ink-2); font-size: 13px; }

/* 邮箱验证码（两步） */
.otp-flow { width: 100%; }
.otp-flow h2 { font-size: 18px; font-weight: 600; margin: 0 0 16px; color: var(--primary); }
.otp-step { display: none; flex-direction: column; gap: 14px; }
.otp-step.visible { display: flex; animation: rise 260ms var(--ease) both; }

.field {
  position: relative;
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid var(--outline-2);
  border-radius: var(--r-md);
  transition: box-shadow 150ms var(--ease), border-color 150ms var(--ease);
}
.field:focus-within { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(9, 20, 38, 0.1); }
.field > svg { position: absolute; left: 12px; width: 18px; height: 18px; color: var(--ink-2); pointer-events: none; }
.field input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 14px 12px 40px;
  font-size: 14px;
  height: 46px;
  color: var(--ink);
  outline: none;
}
.field input.mono-code {
  font-family: var(--mono);
  letter-spacing: 0.5em;
  text-align: center;
  padding-left: 14px;
}
.field input.mono-code::placeholder { letter-spacing: normal; text-align: left; padding-left: 26px; }

.btn-block {
  width: 100%;
  height: 46px;
  justify-content: center;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 500;
}
button.btn-dark {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px -2px rgba(9, 20, 38, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
button.btn-dark:hover { background: #233144; border-color: #233144; }

.step2-head { display: flex; justify-content: space-between; align-items: center; }
.step2-head .email-chip {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 6px 12px;
  background: #eff4ff;
  border-radius: 999px;
}
.step2-head .edit-link {
  flex-shrink: 0;
  color: var(--primary);
  font-size: 13px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 4px;
}
.step2-head .edit-link:hover { text-decoration: underline; }

.btn-loading { position: relative; color: transparent !important; }
.btn-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.login-foot {
  margin-top: 28px;
  color: rgba(69, 71, 76, 0.6);
  font-size: 12px;
  text-align: center;
}

/* SPA 内未登录视图（无骨架） */
body.authless .topnav, body.authless .dock { display: none; }
body.authless .main { padding-top: 12vh; }
.login-wrap { max-width: 420px; margin: 0 auto; padding: 0 16px; }
.login-wrap .login-card h1 { margin-top: 0; }

.error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 20px;
}
.error-card {
  max-width: 440px;
  border-radius: 28px;
  padding: 40px 44px;
  text-align: center;
}
.error-card h1 { font-size: 18px; font-weight: 700; margin: 0 0 8px; }
.error-card p { color: var(--ink-2); font-size: 13px; }

/* --- 动效 ------------------------------------------------------------ */

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

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