/* degravity 控制台：原生 CSS，自适应浅色 / 深色 */

:root {
  color-scheme: light dark;

  --bg: oklch(0.972 0.004 262);
  --surface: oklch(0.997 0.002 262);
  --surface-2: oklch(0.955 0.006 262);
  --surface-3: oklch(0.93 0.008 262);
  --line: oklch(0.905 0.007 262);
  --line-strong: oklch(0.84 0.01 262);
  --text: oklch(0.23 0.018 262);
  --text-2: oklch(0.46 0.016 262);
  --text-3: oklch(0.56 0.014 262);

  --accent: oklch(0.5 0.19 266);
  --accent-hover: oklch(0.45 0.19 266);
  --accent-ink: oklch(0.99 0.005 266);
  --accent-soft: oklch(0.94 0.035 266);
  --accent-text: oklch(0.46 0.19 266);

  --ok: oklch(0.62 0.15 152);
  --ok-soft: oklch(0.95 0.045 152);
  --ok-ink: oklch(0.4 0.11 152);
  --warn: oklch(0.74 0.15 72);
  --warn-soft: oklch(0.955 0.055 82);
  --warn-ink: oklch(0.47 0.11 62);
  --danger: oklch(0.56 0.2 26);
  --danger-soft: oklch(0.955 0.03 26);
  --danger-ink: oklch(0.48 0.18 26);

  --shadow-sm: 0 1px 2px oklch(0.3 0.02 262 / 0.06);
  --shadow-lg: 0 10px 24px -10px oklch(0.25 0.03 262 / 0.3), 0 2px 6px oklch(0.25 0.03 262 / 0.08);

  --radius: 10px;
  --radius-sm: 7px;
  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: oklch(0.17 0.008 262);
    --surface: oklch(0.205 0.009 262);
    --surface-2: oklch(0.235 0.01 262);
    --surface-3: oklch(0.27 0.011 262);
    --line: oklch(0.285 0.011 262);
    --line-strong: oklch(0.36 0.013 262);
    --text: oklch(0.945 0.005 262);
    --text-2: oklch(0.74 0.012 262);
    --text-3: oklch(0.64 0.012 262);

    --accent: oklch(0.52 0.18 266);
    --accent-hover: oklch(0.47 0.18 266);
    --accent-ink: oklch(0.99 0.005 266);
    --accent-soft: oklch(0.3 0.06 266);
    --accent-text: oklch(0.76 0.12 266);

    --ok: oklch(0.72 0.15 152);
    --ok-soft: oklch(0.3 0.05 152);
    --ok-ink: oklch(0.84 0.12 152);
    --warn: oklch(0.8 0.14 76);
    --warn-soft: oklch(0.32 0.05 72);
    --warn-ink: oklch(0.87 0.11 80);
    --danger: oklch(0.68 0.17 26);
    --danger-soft: oklch(0.3 0.06 26);
    --danger-ink: oklch(0.82 0.11 26);

    --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.3);
    --shadow-lg: 0 12px 24px -10px oklch(0 0 0 / 0.6), 0 2px 6px oklch(0 0 0 / 0.3);
  }
}

/* ---------- 基础 ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

::selection { background: var(--accent-soft); color: var(--text); }

[hidden] { display: none !important; }

h1, h2, h3, p { margin: 0; }

code, .mono, .mono-input {
  font-family: var(--mono);
  font-size: 0.92em;
  letter-spacing: 0;
}

code {
  padding: 0.05em 0.35em;
  border-radius: 4px;
  background: var(--surface-3);
}

a { color: var(--accent-text); text-underline-offset: 2px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ic {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.spacer { flex: 1; }

* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

/* ---------- 启动态 ---------- */

.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--text-2);
}

/* ---------- 品牌 ---------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 650;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand-mark {
  position: relative;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--accent);
}
/* 一个"悬浮"的小圆和底线：反重力 */
.brand-mark::before {
  content: "";
  position: absolute;
  left: 6px; top: 4px;
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 1.75px solid var(--accent-ink);
}
.brand-mark::after {
  content: "";
  position: absolute;
  left: 5px; right: 5px; bottom: 4.5px;
  height: 1.75px;
  border-radius: 2px;
  background: var(--accent-ink);
}

.brand--lg { font-size: 16px; }

/* ---------- 按钮与表单 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 550;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { background: var(--surface-3); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn.is-busy { cursor: progress; opacity: 0.7; }

.btn--sm { height: 30px; padding: 0 11px; font-size: 13px; }
.btn--block { width: 100%; height: 38px; }

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn--primary:active { background: var(--accent-hover); }

.btn--ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }

.btn--danger { color: var(--danger-ink); }
.btn--danger-solid {
  background: var(--danger);
  border-color: var(--danger);
  color: oklch(0.99 0 0);
}
.btn--danger-solid:hover { background: var(--danger); filter: brightness(1.06); }

.btn.is-done { color: var(--ok-ink); }
.btn--primary.is-done { color: var(--accent-ink); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.is-done { color: var(--ok-ink); }
.icon-btn--danger:hover { color: var(--danger-ink); background: var(--danger-soft); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.field-hint { font-size: 12.5px; color: var(--text-2); }

.input, .select {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: var(--text-3); }
.input:hover, .select:hover { border-color: var(--text-3); }
.input:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input:disabled { opacity: 0.55; cursor: not-allowed; }
.input[aria-invalid="true"] { border-color: var(--danger); }

.textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.5; word-break: break-all; }
.mono-input { font-size: 13px; }
.select { padding-right: 8px; cursor: pointer; }

.form-error {
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger-ink);
  font-size: 13px;
  word-break: break-word;
}

.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.form-actions--top { margin-bottom: 12px; }

/* 分段选择 */
.seg {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
}
.seg button {
  height: 28px;
  padding: 0 11px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.seg button:hover { color: var(--text); }
.seg button[aria-checked="true"] {
  background: var(--surface);
  color: var(--text);
  font-weight: 550;
  box-shadow: var(--shadow-sm);
}
.seg--sm button { height: 24px; padding: 0 9px; font-size: 12px; }

/* 开关 */
.switch {
  position: relative;
  width: 34px;
  height: 20px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--line-strong);
  cursor: pointer;
  transition: background-color 0.2s var(--ease);
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: oklch(1 0 0);
  box-shadow: 0 1px 2px oklch(0 0 0 / 0.25);
  transition: transform 0.2s var(--ease);
}
.switch[aria-checked="true"] { background: var(--ok); }
.switch[aria-checked="true"]::after { transform: translateX(14px); }
.switch:disabled { opacity: 0.5; cursor: progress; }

/* 胶囊 */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
  background: var(--surface-3);
  color: var(--text-2);
}
.pill::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.pill--ok { background: var(--ok-soft); color: var(--ok-ink); }
.pill--warn { background: var(--warn-soft); color: var(--warn-ink); }
.pill--danger { background: var(--danger-soft); color: var(--danger-ink); }
.pill--plain::before { display: none; }

.tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface-3);
  color: var(--text-2);
}
.tag--accent { background: var(--accent-soft); color: var(--accent-text); }
.tag--warn { background: var(--warn-soft); color: var(--warn-ink); }
.tag--danger { background: var(--danger-soft); color: var(--danger-ink); }

/* ---------- 登录 ---------- */

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-panel {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 32px 28px 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.login-title { margin-top: 12px; font-size: 20px; font-weight: 650; letter-spacing: -0.01em; }
.login-sub { margin-top: -10px; color: var(--text-2); }
.login-hint { font-size: 12.5px; color: var(--text-2); }

/* ---------- 控制台骨架 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: color-mix(in oklch, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
}
.topbar-inner {
  max-width: 920px;
  margin: 0 auto;
  height: 52px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar-actions { display: flex; gap: 4px; }

.page {
  max-width: 920px;
  margin: 0 auto;
  padding: 28px 24px 96px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.notice {
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--warn-soft);
  color: var(--warn-ink);
  font-size: 13px;
}
.notice code { background: color-mix(in oklch, var(--warn-ink) 12%, transparent); }

/* ---------- 接入 ---------- */

.connect {
  padding: 22px 22px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.connect-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.connect-title { font-size: 13px; font-weight: 550; color: var(--text-2); }
.connect-origin { margin-top: 2px; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; word-break: break-all; }
.connect-origin .mono { font-size: 1em; }
.key-pick { display: flex; flex-direction: column; gap: 6px; min-width: 220px; }

.connect-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 14px;
}
.connect-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
}
.connect-block-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.connect-block-title { font-size: 14px; font-weight: 600; }

.code {
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text);
}
.code .tok-k { color: var(--accent-text); }
.code .tok-dim { color: var(--text-2); }

.kv { width: 100%; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.kv-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px 4px 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
}
.kv dt { font-size: 12.5px; color: var(--text-2); }
.kv dd { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }

.connect-foot { margin-top: 14px; }

/* ---------- 区块 ---------- */

.block { display: flex; flex-direction: column; gap: 12px; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.block-title-wrap { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.block-title { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
.block-count { font-size: 12.5px; color: var(--text-2); }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.empty {
  padding: 28px 20px;
  text-align: center;
  color: var(--text-2);
}
.empty-title { color: var(--text); font-weight: 600; margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

/* ---------- 账号行 ---------- */

.row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 14px;
  row-gap: 8px;
  padding: 14px 16px;
}
.row + .row { border-top: 1px solid var(--line); }
.row.is-off .row-title, .row.is-off .row-meta { opacity: 0.6; }

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--line-strong);
  align-self: start;
  margin-top: 6px;
}
.dot--ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot--warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.dot--danger { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

.row-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row-titleline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.row-sub { color: var(--text-2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  font-size: 12.5px;
  color: var(--text-2);
}
.row-meta .mono { font-size: 12px; }
.row-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

.row-actions { display: flex; align-items: center; gap: 4px; justify-self: end; }
.row-actions .switch { margin: 0 6px; }

.probe-result { font-size: 12.5px; font-weight: 550; white-space: nowrap; }
.probe-result--ok { color: var(--ok-ink); }

.row-note {
  grid-column: 2 / -1;
  font-size: 12.5px;
  color: var(--danger-ink);
  word-break: break-word;
}

.row-edit {
  grid-column: 2 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
  gap: 10px 12px;
  padding: 12px;
  margin-top: 2px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.row-edit .field-hint, .row-edit .form-error, .row-edit .form-actions { grid-column: 1 / -1; }

/* ---------- 密钥行 ---------- */

.key-token {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
}
.key-token .mono {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  color: var(--text);
}
.key-token .icon-btn { width: 26px; height: 26px; }

.create-key { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.create-key-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 110px;
  gap: 12px 16px;
  align-items: end;
}
.create-key.is-new { box-shadow: 0 0 0 3px var(--accent-soft); }
.row.is-fresh { background: color-mix(in oklch, var(--accent-soft) 45%, transparent); }

/* ---------- 折叠抽屉 ---------- */

.drawer {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.drawer + .drawer { margin-top: -28px; }
.drawer-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 13px 16px;
  cursor: pointer;
  list-style: none;
  border-radius: var(--radius);
  user-select: none;
}
.drawer-summary::-webkit-details-marker { display: none; }
.drawer-summary:hover { background: var(--surface-2); }
.drawer-title { font-weight: 600; }
.drawer-chev { color: var(--text-2); transition: transform 0.2s var(--ease); }
.drawer[open] .drawer-chev { transform: rotate(90deg); }
.drawer[open] .drawer-summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom: 1px solid var(--line); }
.drawer-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; }

.alias-list { display: flex; flex-direction: column; gap: 6px; }
.alias-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 8px;
}
.alias-row .ic { color: var(--text-3); }
.alias-head { font-size: 12px; color: var(--text-2); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 12.5px;
}
.table th {
  position: sticky;
  top: 0;
  padding: 8px 10px;
  text-align: left;
  font-weight: 550;
  color: var(--text-2);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table .nowrap { white-space: nowrap; }
.table .err { color: var(--danger-ink); max-width: 260px; word-break: break-word; }
.status-code { font-family: var(--mono); font-weight: 600; }
.status-code--ok { color: var(--ok-ink); }
.status-code--warn { color: var(--warn-ink); }
.status-code--danger { color: var(--danger-ink); }

/* ---------- 弹窗 ---------- */

.dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: auto;
}
.dialog::backdrop { background: oklch(0.2 0.02 262 / 0.42); }
.dialog[open] { animation: dialog-in 0.22s var(--ease); }
@keyframes dialog-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 10px 20px;
}
.dialog-title { font-size: 18px; font-weight: 650; }
.dialog-body { padding: 18px 20px 20px; }
.dialog-body form, .dialog-body [role="tabpanel"] { display: flex; flex-direction: column; gap: 14px; }

.tabs {
  display: flex;
  gap: 18px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
}
.tab {
  position: relative;
  padding: 8px 0 11px;
  border: 0;
  background: none;
  color: var(--text-2);
  font: inherit;
  font-weight: 550;
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); }
.tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.step { position: relative; padding-left: 36px; padding-bottom: 22px; }
.step:last-child { padding-bottom: 4px; }
.step::before {
  content: "";
  position: absolute;
  left: 11px; top: 28px; bottom: 4px;
  width: 1px;
  background: var(--line);
}
.step:last-child::before { display: none; }
.step-head { display: flex; align-items: center; gap: 12px; margin-left: -36px; min-height: 24px; }
.step-no {
  display: inline-grid;
  place-items: center;
  width: 23px; height: 23px;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 650;
}
.step-title { font-size: 15px; font-weight: 600; }
.step-body { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin-top: 12px; }
.step-body .field { align-self: stretch; }
.step.is-locked .step-no { background: var(--surface-3); color: var(--text-2); }
.step.is-locked .step-title { color: var(--text-2); }
.step.is-done .step-no { background: var(--ok-soft); color: var(--ok-ink); }

.linkbox {
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 6px 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.linkbox-url {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  color: var(--text-2);
}

/* ---------- 提示 ---------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}
.toast {
  padding: 9px 14px;
  border-radius: 9px;
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.24s var(--ease);
}
.toast--error { background: var(--danger); color: oklch(0.99 0 0); }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity 0.2s, transform 0.2s; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 窄屏 ---------- */

@media (max-width: 720px) {
  .topbar-inner { padding: 0 16px; }
  .page { padding: 20px 16px 72px; gap: 32px; }
  .drawer + .drawer { margin-top: -20px; }
  .connect { padding: 16px; }
  .connect-grid { grid-template-columns: minmax(0, 1fr); }
  .key-pick { min-width: 0; width: 100%; }
  .connect-origin { font-size: 17px; }

  .row { grid-template-columns: auto minmax(0, 1fr); }
  .row-actions { grid-column: 2 / -1; justify-self: start; flex-wrap: wrap; margin-left: -6px; }
  .row-note, .row-edit { grid-column: 2 / -1; }
  .row-edit { grid-template-columns: minmax(0, 1fr); }

  .create-key-grid { grid-template-columns: minmax(0, 1fr); }
  .create-key-grid .seg { flex-wrap: wrap; }
  .field--narrow { max-width: 140px; }

  .alias-row { grid-template-columns: minmax(0, 1fr) 30px; }
  .alias-row > .ic { display: none; }
  .alias-row > :nth-child(3) { grid-column: 1; }
  .alias-row > :nth-child(4) { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .alias-head { display: none; }
}

@media (max-width: 420px) {
  .topbar-actions .btn span { display: none; }
  .login-panel { padding: 26px 20px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
