/*
 * Keys Manage 样式
 * 设计规范：landing-page-design skill Part B
 *   字号只用 Tailwind 字阶（字号与行高成对使用）
 *   间距只用 --s-* 刻度；圆角只用 --r-*，嵌套圆角 = 外圆角 − 间隙
 *   深色背景只用 #000000 #181818 #1F1F1F #272727 #313131 #131209
 *   动效统一 --ease，只对 transform / opacity / 颜色做过渡
 */

@font-face {
  font-family: "Geist";
  src: url("fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --font: "Geist", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --s-25: 2px;
  --s-50: 4px;
  --s-75: 8px;
  --s-100: 12px;
  --s-200: 16px;
  --s-300: 24px;
  --s-400: 32px;
  --s-500: 40px;
  --s-600: 48px;
  --s-700: 64px;
  --s-800: 80px;
  --s-900: 96px;

  --r: 4px;
  --r-lg: 8px;
  --r-xl: 12px;
  --r-2xl: 16px;
  --r-full: 9999px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --t-move: 500ms;
  --t-color: 300ms;

  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --surface-3: #e4e4e7;
  --input-bg: #ffffff;
  --code-bg: #f4f4f5;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --text: #0a0a0a;
  --text-2: #52525b;
  --text-3: #71717a;
  --primary: #0a0a0a;
  --primary-hover: #27272a;
  --primary-text: #ffffff;
  --ok: #15803d;
  --warn: #b45309;
  --bad: #b91c1c;
  --focus: #2563eb;
  --nav-bg: rgba(255, 255, 255, 0.72);
  --panel-bg: rgba(250, 250, 250, 0.92);
  --hero-from: #000000;
  --hero-to: #666666;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #181818;
    --surface-2: #1f1f1f;
    --surface-3: #272727;
    --input-bg: #000000;
    --code-bg: #1f1f1f;
    --border: #272727;
    --border-strong: #313131;
    --text: #ededed;
    --text-2: #a1a1a1;
    --text-3: #8f8f8f;
    --primary: #ededed;
    --primary-hover: #ffffff;
    --primary-text: #000000;
    --ok: #4ade80;
    --warn: #fbbf24;
    --bad: #f87171;
    --focus: #60a5fa;
    --nav-bg: rgba(24, 24, 24, 0.72);
    --panel-bg: rgba(0, 0, 0, 0.92);
    --hero-from: #ffffff;
    --hero-to: #9b9b9b;
  }
}

/* 基础 */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 24px;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

body.menu-open { overflow: hidden; }

em, i, cite, address, dfn, var { font-style: normal; }

h1, h2, h3 { margin: 0; font-weight: 600; text-wrap: balance; }

p { margin: 0; text-wrap: pretty; }

a { color: inherit; text-decoration: none; }

code, pre, kbd, .mono { font-family: var(--mono); }

code {
  padding: var(--s-25) var(--s-50);
  border-radius: var(--r);
  background: var(--code-bg);
  font-size: 14px;
  line-height: 20px;
}

[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: var(--s-25);
}

.icon { width: 16px; height: 16px; flex: none; fill: currentColor; }
.icon-lg { width: 24px; height: 24px; }

.muted { color: var(--text-2); }

.link { font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }

.skip {
  position: fixed;
  top: var(--s-200);
  left: var(--s-200);
  z-index: 50;
  padding: var(--s-75) var(--s-100);
  border-radius: var(--r-lg);
  background: var(--primary);
  color: var(--primary-text);
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  transform: translateY(-200%);
  transition: transform var(--t-move) var(--ease);
}

.skip:focus { transform: none; }

/* 导航：悬浮在顶部、居中、按内容宽度 */

.nav-wrap {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  padding: var(--s-200) var(--s-200) 0;
  pointer-events: none;
}

.nav {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: var(--s-50);
  padding: var(--s-50);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  backdrop-filter: blur(12px) saturate(140%);
}

.brand,
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: var(--s-75);
  padding: var(--s-75) var(--s-100);
  border: 0;
  border-radius: var(--r-xl); /* 16 − 4 */
  background: transparent;
  color: var(--text-2);
  font: 600 14px/20px var(--font);
  cursor: pointer;
  transition: background-color var(--t-color) var(--ease), color var(--t-color) var(--ease), transform var(--t-color) var(--ease);
}

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

.nav-links { display: flex; align-items: center; gap: var(--s-25); }
.nav-links form { display: contents; }

.nav-link:hover,
.brand:hover { background: var(--surface-2); color: var(--text); }

.nav-link:active,
.brand:active { transform: scale(0.98); }

.nav-link[aria-current="page"] { background: var(--surface-3); color: var(--text); }

.menu-toggle {
  display: none;
  position: relative;
  width: 40px;
  height: 36px;
  border: 0;
  border-radius: var(--r-xl);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background-color var(--t-color) var(--ease);
}

.menu-toggle:hover { background: var(--surface-2); }

.menu-toggle span {
  position: absolute;
  left: var(--s-100);
  right: var(--s-100);
  height: 2px;
  border-radius: var(--r-full);
  background: currentColor;
  transition: transform var(--t-move) var(--ease);
}

.menu-toggle span:first-child { top: 0; transform: translateY(13px); }
.menu-toggle span:last-child { top: 0; transform: translateY(21px); }
.menu-toggle[aria-expanded="true"] span:first-child { transform: translateY(17px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:last-child { transform: translateY(17px) rotate(-45deg); }

.menu-panel {
  position: fixed;
  inset: 0;
  z-index: 15;
  display: none;
  flex-direction: column;
  gap: var(--s-75);
  padding: var(--s-900) var(--s-300) var(--s-300);
  background: var(--panel-bg);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t-color) var(--ease), visibility 0s var(--ease) var(--t-color);
}

.menu-panel form { display: contents; }

.menu-panel.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity var(--t-color) var(--ease), visibility 0s var(--ease);
}

.menu-link {
  display: flex;
  align-items: center;
  gap: var(--s-100);
  padding: var(--s-100) var(--s-200);
  border: 0;
  border-radius: var(--r-xl);
  background: transparent;
  color: var(--text-2);
  font: 600 24px/32px var(--font);
  text-align: left;
  cursor: pointer;
  opacity: 0;
  transform: translateY(var(--s-300));
  transition: opacity var(--t-move) var(--ease), transform var(--t-move) var(--ease), background-color var(--t-color) var(--ease), color var(--t-color) var(--ease);
}

.menu-link .icon { width: 24px; height: 24px; }
.menu-link[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.menu-panel.is-open .menu-link { opacity: 1; transform: none; }
/* 依次入场：每项间隔 60ms，整段不超过 400ms */
.menu-panel.is-open > .menu-link:nth-child(2) { transition-delay: 60ms; }
.menu-panel.is-open > .menu-link:nth-child(3) { transition-delay: 120ms; }
.menu-panel.is-open > .menu-link:nth-child(4) { transition-delay: 180ms; }
.menu-panel.is-open > .menu-link:nth-child(5) { transition-delay: 240ms; }
.menu-panel.is-open > form .menu-link { transition-delay: 300ms; }

/* 布局 */

.container {
  width: 100%;
  max-width: 1024px;
  margin: 0 auto;
  padding: var(--s-600) var(--s-300) var(--s-900);
  flex: 1;
}

.container:focus { outline: none; }

.footer {
  width: 100%;
  max-width: 1024px;
  margin: 0 auto;
  padding: 0 var(--s-300) var(--s-600);
  color: var(--text-3);
  font-size: 12px;
  line-height: 16px;
}

.stack { display: grid; gap: var(--s-300); }
.stack-sm { display: grid; gap: var(--s-100); }

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-300);
  margin-bottom: var(--s-400);
}

.page-head h1 { font-size: 30px; line-height: 36px; }

.lead {
  max-width: 680px;
  margin-top: var(--s-75);
  color: var(--text-2);
  font-size: 16px;
  line-height: 24px;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: var(--s-50);
  margin-bottom: var(--s-200);
  color: var(--text-2);
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  transition: color var(--t-color) var(--ease);
}

.back:hover { color: var(--text); }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-100); }

.hero { margin-bottom: var(--s-600); }

.hero-title {
  max-width: 680px;
  font-size: 36px;
  line-height: 40px;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, var(--hero-from), var(--hero-to));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.section { margin-top: var(--s-400); }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-200);
  margin-bottom: var(--s-200);
}

.section-head h2,
.card-head h2 { font-size: 20px; line-height: 28px; }

/* 卡片 */

.card {
  padding: var(--s-300);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  background: var(--surface);
}

.card + .card { margin-top: var(--s-300); }
.card[id] { scroll-margin-top: var(--s-900); } /* 跳到 #mail、#bark 时标题不被悬浮导航挡住 */

.card-flush { padding: 0; overflow: hidden; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-200);
  margin-bottom: var(--s-200);
}

.card-flush .card-head { margin: 0; padding: var(--s-300) var(--s-300) var(--s-200); }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-200);
  margin-bottom: var(--s-300);
}

.stat {
  display: grid;
  gap: var(--s-75);
  padding: var(--s-300);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  background: var(--surface);
  transition: background-color var(--t-color) var(--ease), transform var(--t-color) var(--ease);
}

.stat:hover { background: var(--surface-2); }
.stat:active { transform: scale(0.98); }

.stat-label { color: var(--text-2); font-size: 14px; line-height: 20px; }
.stat-value { font-size: 30px; line-height: 36px; font-weight: 600; }
.stat-value.is-warn { color: var(--warn); }
.stat-value.is-bad { color: var(--bad); }

/* 按钮 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-75);
  padding: var(--s-75) var(--s-100);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--text);
  font: 600 16px/24px var(--font);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--t-color) var(--ease), border-color var(--t-color) var(--ease), color var(--t-color) var(--ease), transform var(--t-color) var(--ease), opacity var(--t-color) var(--ease);
}

.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.btn-primary { border-color: var(--primary); background: var(--primary); color: var(--primary-text); }
.btn-primary:hover { border-color: var(--primary-hover); background: var(--primary-hover); }

.btn-danger { color: var(--bad); }

.btn-sm { padding: var(--s-50) var(--s-75); font-size: 14px; line-height: 20px; }

.btn-block { width: 100%; }

.btn.is-loading {
  pointer-events: none;
  opacity: 0.6;
  animation: pulse 1s var(--ease) infinite alternate;
}

/* 表单 */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-300) var(--s-200);
}

.span-2 { grid-column: 1 / -1; }

.field { display: grid; gap: var(--s-75); align-content: start; min-width: 0; margin: 0; padding: 0; border: 0; }

.field label,
.field legend {
  padding: 0;
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
}

.req { margin-left: var(--s-50); color: var(--bad); }

.input,
.field input:not([type="radio"]):not([type="checkbox"]),
.field select,
.field textarea,
.toolbar input {
  width: 100%;
  padding: var(--s-75) var(--s-100);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--input-bg);
  color: var(--text);
  font: 400 16px/24px var(--font);
  transition: border-color var(--t-color) var(--ease);
}

.field textarea { resize: vertical; min-height: 96px; }

.field .mono,
.field textarea.mono { font-family: var(--mono); font-size: 14px; line-height: 20px; }

.field select { min-height: 42px; cursor: pointer; } /* 和输入框一样高：8 + 24 + 8 + 边框 */

.field input:hover,
.field select:hover,
.field textarea:hover { border-color: var(--text-3); }

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible,
.toolbar input:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }

[aria-invalid="true"] { border-color: var(--bad) !important; }

.help { color: var(--text-3); font-size: 12px; line-height: 16px; }

.error-text { color: var(--bad); font-size: 14px; line-height: 20px; }

.form-error {
  display: flex;
  align-items: flex-start;
  gap: var(--s-75);
  padding: var(--s-100) var(--s-200);
  border: 1px solid var(--bad);
  border-radius: var(--r-xl);
  color: var(--bad);
  font-size: 14px;
  line-height: 20px;
}

.form-error .icon { margin-top: var(--s-25); }

.form-actions { display: flex; justify-content: flex-end; gap: var(--s-100); }

.input-group { display: flex; gap: var(--s-75); }
.input-group input { flex: 1; min-width: 0; }

.check {
  display: inline-flex;
  align-items: center;
  gap: var(--s-75);
  font-size: 14px;
  line-height: 20px;
  cursor: pointer;
}

.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }

.segmented {
  display: inline-flex;
  justify-self: start;
  gap: var(--s-50);
  padding: var(--s-50);
  border-radius: var(--r-xl);
  background: var(--surface-2);
}

.segmented label { position: relative; cursor: pointer; }

.segmented input { position: absolute; opacity: 0; pointer-events: none; }

.segmented span {
  display: block;
  padding: var(--s-50) var(--s-100);
  border-radius: var(--r-lg); /* 12 − 4 */
  color: var(--text-2);
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  transition: background-color var(--t-color) var(--ease), color var(--t-color) var(--ease);
}

.segmented input:checked + span { background: var(--surface); color: var(--text); }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: var(--s-25); }
.segmented label:hover span { color: var(--text); }

/* 用链接切换视图时的分段按钮 */
.segmented a {
  display: inline-flex;
  align-items: center;
  gap: var(--s-50);
  padding: var(--s-50) var(--s-100);
  border-radius: var(--r-lg); /* 12 − 4 */
  color: var(--text-2);
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  transition: background-color var(--t-color) var(--ease), color var(--t-color) var(--ease);
}

.segmented a:hover { color: var(--text); }
.segmented a[aria-current="page"] { background: var(--surface); color: var(--text); }

/* 工具栏、标签 */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-100);
  margin-bottom: var(--s-200);
}

.search { position: relative; flex: 1 1 240px; max-width: 400px; }
.search .icon { position: absolute; left: var(--s-100); top: var(--s-100); color: var(--text-3); pointer-events: none; }
.toolbar .search input { padding-left: var(--s-500); }

.chips { display: flex; flex-wrap: wrap; gap: var(--s-75); }

.chip {
  display: inline-flex;
  align-items: center;
  padding: var(--s-25) var(--s-100);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  color: var(--text-2);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  transition: background-color var(--t-color) var(--ease), color var(--t-color) var(--ease);
}

a.chip:hover { background: var(--surface-2); color: var(--text); }
.chip[aria-current="true"] { border-color: var(--text); color: var(--text); }

/* 表格 */

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 20px; }

th {
  padding: var(--s-100) var(--s-200);
  color: var(--text-3);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

td { padding: var(--s-100) var(--s-200); border-top: 1px solid var(--border); vertical-align: middle; }

th:first-child, td:first-child { padding-left: var(--s-300); }
th:last-child, td:last-child { padding-right: var(--s-300); }

tbody tr { transition: background-color var(--t-color) var(--ease); }
tbody tr:hover { background: var(--surface-2); }

.row-link { font-weight: 600; }
.row-link:hover { text-decoration: underline; text-underline-offset: 4px; }

.cell-sub { display: block; color: var(--text-3); font-size: 12px; line-height: 16px; }

.nowrap { white-space: nowrap; }

.notes { white-space: pre-line; }

.list { display: grid; gap: var(--s-50); margin: 0; padding-left: var(--s-300); font-size: 14px; line-height: 20px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.td-mono { font-family: var(--mono); }

.td-actions { text-align: right; white-space: nowrap; }

/* 状态标签 */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s-50);
  padding: var(--s-25) var(--s-75);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  white-space: nowrap;
}

.badge::before { content: ""; width: 8px; height: 8px; border-radius: var(--r-full); background: currentColor; }
.badge-ok { color: var(--ok); }
.badge-warn { color: var(--warn); }
.badge-bad { color: var(--bad); }
.badge-muted { color: var(--text-3); }

/* 提示 */

.flashes { display: grid; gap: var(--s-100); margin-bottom: var(--s-300); }

.flash {
  display: flex;
  align-items: flex-start;
  gap: var(--s-100);
  padding: var(--s-100) var(--s-200);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--surface);
  font-size: 14px;
  line-height: 20px;
}

.flash .icon { margin-top: var(--s-25); }
.notice { margin-bottom: var(--s-300); }
.flash-ok .icon { color: var(--ok); }
.flash-warn { border-color: var(--warn); }
.flash-warn .icon { color: var(--warn); }
.flash-bad { border-color: var(--bad); }
.flash-bad .icon { color: var(--bad); }

/* 详情 */

.kv {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: var(--s-100) var(--s-300);
  margin: 0;
  font-size: 14px;
  line-height: 20px;
}

.kv dt { color: var(--text-2); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* 值和复制按钮放在一行；负边距抵消小按钮多出的高度，和左侧标签对齐 */
.copy-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-75); margin: calc(var(--s-50) * -1) 0; }
.secret-mask { color: var(--text-3); letter-spacing: 2px; }

.with-icon { display: inline-flex; align-items: center; gap: var(--s-50); white-space: nowrap; }

.code-block { position: relative; }

.code-block pre {
  margin: 0;
  padding: var(--s-200);
  padding-right: var(--s-900);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--code-bg);
  font-size: 14px;
  line-height: 20px;
  overflow-x: auto;
  white-space: pre;
}

.code-block pre.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }

.code-block .btn {
  position: absolute;
  top: var(--s-75);
  right: var(--s-75);
  border-radius: var(--r); /* 12 − 8 */
}

.code-label { margin-bottom: var(--s-75); color: var(--text-2); font-size: 14px; line-height: 20px; }

.confirm { position: relative; }
.confirm summary { list-style: none; }
.confirm summary::-webkit-details-marker { display: none; }

.confirm-body {
  position: absolute;
  right: 0;
  top: calc(100% + var(--s-75));
  z-index: 5;
  display: grid;
  gap: var(--s-100);
  width: 280px;
  padding: var(--s-200);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  background: var(--surface);
  font-size: 14px;
  line-height: 20px;
}

.confirm[open] .confirm-body { animation: rise var(--t-move) var(--ease); }

/* 空状态与错误页 */

.empty {
  display: grid;
  justify-items: center;
  gap: var(--s-200);
  padding: var(--s-700) var(--s-300);
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--r-full);
  background: var(--surface-2);
  color: var(--text-2);
}

.empty h2 { font-size: 20px; line-height: 28px; }
.empty p { max-width: 440px; color: var(--text-2); font-size: 14px; line-height: 20px; }
.empty-inline { padding: var(--s-300); color: var(--text-2); font-size: 14px; line-height: 20px; }

/* 两步验证 */

.totp-setup { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s-400); align-items: start; }
.totp-qr { display: block; width: 205px; height: 205px; border: 1px solid var(--border); border-radius: var(--r-xl); }

.steps { display: grid; gap: var(--s-300); margin: 0; padding-left: var(--s-300); }
.steps li { padding-left: var(--s-50); }
.steps li::marker { color: var(--text-3); font-weight: 600; }
.steps h2 { margin-bottom: var(--s-50); font-size: 16px; line-height: 24px; }
.steps .muted { margin-bottom: var(--s-100); font-size: 14px; line-height: 20px; }

.code-input { letter-spacing: 2px; }
.auth .auth-alt { display: grid; gap: var(--s-75); width: 100%; text-align: center; }

/* 登录 */

.auth { display: grid; justify-items: center; gap: var(--s-300); max-width: 400px; margin: var(--s-700) auto 0; text-align: center; }
.auth .lead { margin: 0; }
.auth form { width: 100%; text-align: left; }
.auth .flash { width: 100%; text-align: left; }

.auth-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--r-xl);
  background: var(--primary);
  color: var(--primary-text);
}

/* 提醒事项 */

.agenda { display: grid; gap: var(--s-300); }
.agenda .card + .card { margin-top: 0; }
.agenda + .card { margin-top: var(--s-300); }

.r-list { margin: 0; padding: 0; list-style: none; }

.r-item {
  display: flex;
  align-items: center;
  gap: var(--s-100);
  padding: var(--s-100) var(--s-300);
  border-top: 1px solid var(--border);
  transition: background-color var(--t-color) var(--ease);
}

.r-item:hover { background: var(--surface-2); }
.r-item form { display: contents; }

/* 勾选完成的圆圈；::after 把可点击区域放大到 40px */
.r-check {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: background-color var(--t-color) var(--ease), border-color var(--t-color) var(--ease), color var(--t-color) var(--ease), transform var(--t-color) var(--ease);
}

.r-check::after { content: ""; position: absolute; inset: calc(var(--s-75) * -1); }
.r-check .icon { width: 12px; height: 12px; opacity: 0; transition: opacity var(--t-color) var(--ease); }
.r-check:hover { border-color: var(--text-2); }
.r-check:hover .icon,
.r-check:focus-visible .icon { opacity: 1; }
.r-check:active { transform: scale(0.98); }
.r-check.is-checked { border-color: var(--primary); background: var(--primary); color: var(--primary-text); }
.r-check.is-checked .icon { opacity: 1; }
.r-check.is-static { border-color: transparent; background: transparent; color: var(--text-3); cursor: default; }
.r-check.is-static .icon { width: 16px; height: 16px; opacity: 1; }

.r-time { flex: none; min-width: 48px; color: var(--text-2); font-size: 14px; line-height: 20px; white-space: nowrap; }
.r-time.with-date { min-width: 96px; }
.r-main { display: grid; flex: 1; gap: var(--s-25); min-width: 0; }
.r-title { font-size: 14px; line-height: 20px; font-weight: 600; overflow-wrap: anywhere; }
.r-title:hover { text-decoration: underline; text-underline-offset: 4px; }

.r-meta { display: flex; flex-wrap: wrap; gap: var(--s-25) var(--s-100); color: var(--text-3); font-size: 12px; line-height: 16px; }
.r-meta:empty { display: none; }
.r-meta .icon { width: 12px; height: 12px; }
.r-note { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.r-item.is-past .r-time,
.r-item.is-past .r-title { color: var(--text-3); }
.r-item.is-done .r-title { color: var(--text-3); text-decoration: line-through; }
.r-item.is-overdue .r-time { color: var(--bad); }

.done-box > summary { list-style: none; cursor: pointer; }
.done-box > summary::-webkit-details-marker { display: none; }
.done-box:not([open]) > summary { padding-bottom: var(--s-300); }
.done-caret { transition: transform var(--t-move) var(--ease); }
.done-box[open] .done-caret { transform: rotate(90deg); }

/* 日历 */

.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }

.cal-wd {
  padding: var(--s-75) var(--s-100);
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
}

.cal-day {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s-25);
  min-width: 0;
  min-height: 112px;
  padding: var(--s-75);
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  transition: background-color var(--t-color) var(--ease);
}

.cal-grid > :nth-child(7n + 1) { border-left: 0; }
.cal-day.is-selected { background: var(--surface-2); }

.cal-num {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-bottom: var(--s-25);
  border-radius: var(--r-full);
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  transition: background-color var(--t-color) var(--ease), color var(--t-color) var(--ease);
}

.cal-num:hover { background: var(--surface-3); }

/* 日期格子右上角的加号：鼠标移上去或键盘聚焦时出现；有 JS 时点格子空白处也能新增 */
.cal-add {
  position: absolute;
  top: var(--s-75);
  right: var(--s-75);
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-full);
  color: var(--text-2);
  opacity: 0;
  transition: opacity var(--t-color) var(--ease), background-color var(--t-color) var(--ease), color var(--t-color) var(--ease);
}

.cal-day:hover .cal-add,
.cal-add:focus-visible { opacity: 1; }
.cal-add:hover { background: var(--surface-3); color: var(--text); }
.js .cal-day { cursor: pointer; }
.js .cal-day:hover { background: var(--surface-2); }
.cal-day.is-other .cal-num { color: var(--text-3); }
.cal-day.is-today .cal-num { background: var(--primary); color: var(--primary-text); }

.cal-item,
.cal-more {
  display: block;
  padding: 0 var(--s-50);
  border-radius: var(--r);
  font-size: 12px;
  line-height: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background-color var(--t-color) var(--ease);
}

.cal-item { background: var(--surface-2); }
.cal-day.is-selected .cal-item { background: var(--surface-3); }
.cal-item:hover { background: var(--surface-3); }
.cal-item .td-mono { color: var(--text-2); }
.cal-item.is-done { color: var(--text-3); text-decoration: line-through; }
.cal-item.is-overdue { color: var(--bad); }
.cal-more { color: var(--text-2); font-weight: 600; }
.cal-more:hover { background: var(--surface-3); }

.cal-dots { display: none; gap: var(--s-25); justify-content: center; }
.cal-dots span { width: 4px; height: 4px; border-radius: var(--r-full); background: var(--text-2); }
.cal-dots span.is-overdue { background: var(--bad); }

/* 弹窗：遮罩是纯色半透明，内容区单独一层，点到 dialog 本身就是点到了遮罩 */

.dialog {
  width: min(560px, calc(100vw - var(--s-400)));
  max-height: calc(100vh - var(--s-400));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  background: var(--surface);
  color: var(--text);
  overflow: auto;
}

.dialog::backdrop { background: rgba(0, 0, 0, 0.48); }
.dialog[open] { animation: rise var(--t-move) var(--ease); }
.dialog-body { display: grid; gap: var(--s-200); padding: var(--s-300); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-200); }
.dialog-head h2 { font-size: 20px; line-height: 28px; }
.dialog-delete { margin-right: auto; }

.dialog-confirm {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-100);
  padding: var(--s-100) var(--s-200);
  border: 1px solid var(--bad);
  border-radius: var(--r-xl);
  font-size: 14px;
  line-height: 20px;
}

/* 动效 */

@keyframes pulse { from { opacity: 1; } to { opacity: 0.4; } }
@keyframes rise { from { opacity: 0; transform: translateY(var(--s-75)); } to { opacity: 1; transform: none; } }

.js .reveal {
  opacity: 0;
  transform: translateY(var(--s-400));
  transition: opacity 700ms var(--ease), transform 700ms var(--ease);
}

.js .reveal.is-visible { opacity: 1; transform: none; }

.is-busy [data-skeleton] {
  border-radius: var(--r);
  background: var(--surface-3);
  color: transparent !important;
  animation: pulse 1s var(--ease) infinite alternate;
}

.is-busy [data-skeleton] * { visibility: hidden; }

@media (prefers-reduced-motion: reduce) {
  .js .reveal,
  .menu-link,
  .confirm[open] .confirm-body,
  .dialog[open] { transform: none !important; animation: none; }
  .btn:active, .stat:active, .nav-link:active, .brand:active { transform: none; }
  .menu-toggle span, .skip { transition: none; }
}

/* 窄屏 */

@media (max-width: 767px) {
  .nav { width: 100%; justify-content: space-between; }
  .nav-links { display: none; }
  .menu-toggle { display: block; }
  .menu-panel { display: flex; }
  .container { padding: var(--s-400) var(--s-200) var(--s-700); }
  .footer { padding: 0 var(--s-200) var(--s-400); }
  .hero-title { font-size: 30px; line-height: 36px; }
  .page-head h1 { font-size: 24px; line-height: 32px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: var(--s-25) 0; }
  .kv dd { margin-bottom: var(--s-100); }
  .card { padding: var(--s-200); }
  .card-flush { padding: 0; }
  .card-flush .card-head { padding: var(--s-200) var(--s-200) var(--s-100); }
  th:first-child, td:first-child { padding-left: var(--s-200); }
  th:last-child, td:last-child { padding-right: var(--s-200); }
  .confirm-body { width: min(280px, calc(100vw - var(--s-400))); }
  .r-item { padding: var(--s-100) var(--s-200); align-items: flex-start; }
  /* 窄屏日历只显示日期和小圆点，整个格子都可以点 */
  .cal-wd { padding: var(--s-75) 0; text-align: center; }
  .cal-day { align-items: center; min-height: 56px; padding: var(--s-50) 0; }
  .cal-num::after { content: ""; position: absolute; inset: 0; }
  .cal-item, .cal-more, .cal-add { display: none; }
  .dialog-body { padding: var(--s-200); }
  .totp-setup { grid-template-columns: minmax(0, 1fr); justify-items: start; }
  .input-group { flex-wrap: wrap; }
  .cal-dots { display: flex; }
}
