/* ============================================================
   汇枢 · 界面样式
   浅色工作台风格：白卡、柔和阴影、统一圆角、靛蓝主色
   ============================================================ */

:root {
  color-scheme: light;

  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f9fafc;

  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;
  --faint: #98a2b3;

  --line: #e6e8f0;
  --line-2: #eff1f7;

  --brand: #4f46e5;
  --brand-ink: #4038c9;
  --brand-soft: #eef0ff;
  --violet: #7c3aed;
  --teal: #0d9488;

  --ok: #067647;
  --ok-soft: #ecfdf3;
  --danger: #d92d20;
  --danger-soft: #fef3f2;

  --r-xs: 8px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;

  --sh-xs: 0 1px 2px rgb(16 24 40 / 5%);
  --sh-sm: 0 1px 3px rgb(16 24 40 / 7%), 0 1px 2px rgb(16 24 40 / 4%);
  --sh-md: 0 8px 20px -8px rgb(16 24 40 / 14%), 0 2px 6px -2px rgb(16 24 40 / 7%);
  --sh-lg: 0 28px 64px -24px rgb(16 24 40 / 26%), 0 8px 20px -12px rgb(16 24 40 / 12%);

  --top: 64px;
  --shell: min(1160px, calc(100% - 48px));

  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(900px 480px at 82% -6%, #ebe9ff 0%, transparent 62%),
    radial-gradient(760px 420px at 4% 2%, #e8f4ff 0%, transparent 58%),
    var(--bg);
  background-attachment: fixed;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
svg { display: block; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 6px;
}

.mono { font-family: ui-monospace, "SF Mono", Consolas, "Liberation Mono", monospace; font-variant-numeric: tabular-nums; }

.skip-link {
  position: absolute; left: 16px; top: -80px; z-index: 90;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  background: var(--ink); color: #fff;
  font-size: 13px; text-decoration: none;
  transition: top .16s ease;
}
.skip-link:focus { top: 14px; }

/* ============================================================
   顶部导航
   ============================================================ */

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgb(255 255 255 / 78%);
  backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid rgb(230 232 240 / 80%);
}
.topbar-inner {
  width: var(--shell);
  min-height: var(--top);
  margin: 0 auto;
  display: flex; align-items: center; gap: 28px;
}

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.brand-mark {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: #fff;
  color: #fff;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgb(16 24 40 / 8%), 0 4px 10px -4px rgb(16 24 40 / 22%);
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-mark svg { width: 19px; height: 19px; }
.brand-name { font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; }

/* 水平导航：胶囊容器 + 白色选中块 */
.nav-tabs {
  display: flex; align-items: center; gap: 2px;
  padding: 4px;
  border-radius: 999px;
  background: #f1f2f8;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent);
}
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tabs:empty { display: none; }

.nav-item {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 13px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px; text-decoration: none; white-space: nowrap;
  transition: color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.nav-item:hover { color: var(--ink); background: rgb(255 255 255 / 62%); }
.nav-item[aria-current="page"] {
  color: var(--ink);
  font-weight: 500;
  background: #fff;
  box-shadow: 0 1px 2px rgb(16 24 40 / 8%), 0 0 0 1px rgb(16 24 40 / 4%);
}
.nav-index { display: none; }
.nav-count {
  min-width: 17px; padding: 0 5px;
  border-radius: 999px;
  background: #e6e8f3; color: var(--muted);
  font-size: 11px; line-height: 17px; text-align: center;
  font-variant-numeric: tabular-nums;
}
.nav-count:empty { display: none; }
.nav-item[aria-current="page"] .nav-count { background: var(--brand-soft); color: var(--brand); }

/* 账号 */
.topbar-account { position: relative; margin-left: auto; flex-shrink: 0; }
.framelab-return { flex-shrink: 0; margin-left: auto; white-space: nowrap; }
.framelab-return:not([hidden]) + .topbar-account { margin-left: 0; }
.avatar-button {
  display: inline-flex; align-items: center; gap: 9px;
  height: 38px; padding: 0 11px 0 4px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: none; cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.avatar-button:hover, .avatar-button[aria-expanded="true"] { background: #fff; border-color: var(--line); box-shadow: var(--sh-xs); }
.avatar-initial {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(140deg, #8b7cf8, #4f46e5 70%);
  color: #fff; font-size: 12px; font-weight: 600;
}
.avatar-name { max-width: 132px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.avatar-caret { width: 11px; height: 11px; fill: none; stroke: var(--faint); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform .18s ease; }
.avatar-button[aria-expanded="true"] .avatar-caret { transform: rotate(180deg); }

.user-menu {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 60;
  width: 258px; padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: #fff;
  box-shadow: var(--sh-lg);
  animation: menu-in .16s ease both;
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-6px) scale(.985); } to { opacity: 1; transform: none; } }
.user-menu-head {
  display: grid; gap: 3px;
  margin-bottom: 6px; padding: 12px 12px 13px;
  border-bottom: 1px solid var(--line-2);
}
.user-menu-head strong { font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
.user-menu-head span { color: var(--muted); font-size: 12px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.user-menu-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 9px 12px;
  border: 0; border-radius: var(--r-xs);
  background: none; text-align: left;
  color: var(--ink-2); font-size: 13px; cursor: pointer;
  transition: background-color .14s ease, color .14s ease;
}
.user-menu-item svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; color: var(--faint); }
.user-menu-item:hover { background: var(--surface-2); color: var(--ink); }
.user-menu-item.danger { color: var(--danger); }
.user-menu-item.danger svg { color: var(--danger); }
.user-menu-item.danger:hover { background: var(--danger-soft); }

/* ============================================================
   按钮与表单
   ============================================================ */

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fff; color: var(--ink-2);
  box-shadow: var(--sh-xs);
  font-size: 13px; font-weight: 500; line-height: 1; white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .12s ease;
}
.button:hover { border-color: #d5d9e6; color: var(--ink); background: #fcfcfe; }
.button:active { transform: translateY(.5px); }
.button:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.button.primary {
  border-color: transparent;
  background: linear-gradient(140deg, #5b52ef 0%, #4f46e5 55%, #4338ca 100%);
  color: #fff;
  box-shadow: 0 4px 12px -4px rgb(79 70 229 / 55%);
}
.button.primary:hover { background: linear-gradient(140deg, #5449ea 0%, #473fdc 55%, #3a30b8 100%); color: #fff; }

.button.ghost, .button.quiet { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.button.ghost:hover, .button.quiet:hover { background: var(--surface-2); color: var(--ink); }

.button.danger { color: var(--danger); }
.button.danger:hover { border-color: #f3c3bf; background: var(--danger-soft); color: var(--danger); }
.button.ghost.danger { border-color: transparent; }

.button.large { min-height: 46px; padding: 0 22px; border-radius: 12px; font-size: 14px; }
.button.block { width: 100%; }

.icon-button {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 1px solid transparent; border-radius: var(--r-xs);
  background: none; color: var(--muted); cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.icon-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.icon-button:hover { background: var(--surface-2); color: var(--ink); }

.field { display: grid; gap: 6px; margin: 0 0 15px; color: var(--ink-2); font-size: 12.5px; font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%; height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fff; color: var(--ink);
  font-size: 13.5px; font-weight: 400;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { height: auto; padding: 10px 12px; resize: vertical; }
.field input:hover, .field select:hover { border-color: #d3d8e5; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgb(79 70 229 / 12%);
}
.field input::placeholder, .field textarea::placeholder { color: var(--faint); font-weight: 400; }
.field input[readonly] { background: var(--surface-2); color: var(--muted); }
.field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%2398a2b3' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; background-size: 12px; padding-right: 30px; }

.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.form-actions .button { flex: 1; min-width: 0; }
.form-note { min-height: 18px; margin: 0 0 6px; color: var(--danger); font-size: 12.5px; line-height: 1.6; }
.form-help { margin-top: 16px; color: var(--faint); font-size: 12px; line-height: 1.8; }
.form-help:empty { display: none; }

/* ============================================================
   登录 / 注册
   ============================================================ */

.auth {
  width: var(--shell);
  min-height: calc(100vh - var(--top) - 120px);
  margin: 0 auto;
  display: grid; place-items: center;
  padding: 56px 0 72px;
}
.auth-card {
  width: 100%; max-width: 960px;
  display: grid; grid-template-columns: 1.02fr .98fr;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: #fff;
  box-shadow: var(--sh-lg);
  overflow: hidden;
}

.auth-aside {
  position: relative;
  display: flex; flex-direction: column; justify-content: center; gap: 34px;
  padding: 44px 42px 40px;
  background:
    radial-gradient(520px 320px at 100% 0%, #3b339f 0%, transparent 60%),
    linear-gradient(158deg, #221c63 0%, #2b2482 48%, #191447 100%);
  color: #fff;
  overflow: hidden;
}
.auth-aside::after {
  content: "";
  position: absolute; inset: 0;
  background-image: linear-gradient(rgb(255 255 255 / 4%) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / 4%) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(120% 90% at 80% 10%, #000 20%, transparent 78%);
  pointer-events: none;
}
.auth-aside-top { position: relative; z-index: 1; }
.auth-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px 5px 9px;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 999px;
  background: rgb(255 255 255 / 8%);
  color: #dcd8ff; font-size: 11.5px; letter-spacing: .02em;
}
.auth-pill i { width: 6px; height: 6px; border-radius: 50%; background: #6ee7b7; box-shadow: 0 0 0 3px rgb(110 231 183 / 18%); }
.auth-aside h2 { margin: 22px 0 0; font-size: 34px; font-weight: 600; line-height: 1.24; letter-spacing: -.035em; }
.auth-aside p { max-width: 330px; margin: 16px 0 0; color: #b9b3e2; font-size: 13px; line-height: 1.85; }
.auth-points { position: relative; z-index: 1; display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.auth-points li { display: flex; align-items: baseline; gap: 11px; color: #cfcaea; font-size: 12.5px; line-height: 1.6; }
.auth-points span { color: #8a81c9; font-size: 11px; font-variant-numeric: tabular-nums; letter-spacing: .06em; }

.auth-form-wrap {
  display: flex; flex-direction: column; justify-content: center;
  padding: 48px 46px;
  background: #fff;
}
.auth-tabs { display: flex; gap: 4px; margin-bottom: 26px; padding: 4px; border-radius: 10px; background: #f1f2f8; }
.auth-tab {
  flex: 1; height: 34px;
  border: 0; border-radius: 8px; background: none;
  color: var(--muted); font-size: 13px; cursor: pointer;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.auth-tab[aria-selected="true"] { background: #fff; color: var(--ink); font-weight: 500; box-shadow: var(--sh-xs); }

.eyebrow { margin: 0 0 10px; color: var(--faint); font-size: 11.5px; font-weight: 500; letter-spacing: .08em; }
.auth-form .eyebrow { color: var(--brand); }
.auth-form h1 { margin: 0 0 8px; font-size: 27px; font-weight: 650; letter-spacing: -.03em; }
.auth-subtitle { margin: 0 0 26px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.auth-form .field { margin-bottom: 14px; }
.auth-foot { margin: 28px 0 0; padding-top: 18px; border-top: 1px solid var(--line-2); color: var(--faint); font-size: 11.5px; letter-spacing: .04em; }

.captcha-row { display: grid; grid-template-columns: minmax(0, 1fr) 112px; gap: 10px; align-items: center; }
.captcha-row img { width: 112px; height: 42px; border: 1px solid var(--line); border-radius: var(--r-sm); object-fit: contain; background: #f4f7fb; cursor: pointer; }
.captcha-row img:hover { border-color: var(--brand); }

/* ============================================================
   页面外壳
   ============================================================ */

.view { display: none; }
.view.view-active { display: block; animation: view-in .22s ease both; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.home { width: var(--shell); margin: 0 auto; padding: 60px 0 88px; }
.page { width: var(--shell); margin: 0 auto; padding: 40px 0 80px; }

.panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: var(--sh-xs);
}

/* ---------- 首屏 ---------- */

.hero { display: grid; grid-template-columns: minmax(0, 1.04fr) minmax(0, .96fr); align-items: center; gap: 56px; padding: 8px 0 20px; }

.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 10px;
  border: 1px solid #e3e1ff;
  border-radius: 999px;
  background: #f4f3ff;
  color: var(--brand-ink);
  font-size: 12px; letter-spacing: .01em;
}
.hero-badge i { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px rgb(79 70 229 / 14%); }

.hero h1 {
  margin: 20px 0 0;
  font-size: clamp(34px, 4.2vw, 54px);
  font-weight: 650;
  line-height: 1.16;
  letter-spacing: -.035em;
}
.hero h1 span {
  background: linear-gradient(100deg, #5b52ef 0%, #7c3aed 52%, #4338ca 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub { max-width: 460px; margin: 18px 0 0; color: var(--muted); font-size: 14px; line-height: 1.85; text-wrap: pretty; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }

.hero-actions .button.ghost { border-color: var(--line); background: #fff; box-shadow: var(--sh-xs); color: var(--ink-2); }
.hero-actions .button.ghost:hover { border-color: #d5d9e6; background: #fcfcfe; color: var(--ink); }

.hero-stats { display: flex; gap: 0; margin: 38px 0 0; padding-top: 24px; border-top: 1px solid var(--line); }
.hero-stats > div { padding-right: 30px; margin-right: 30px; border-right: 1px solid var(--line-2); }
.hero-stats > div:last-child { padding-right: 0; margin-right: 0; border-right: 0; }
.hero-stats dt { margin: 0; color: var(--faint); font-size: 12px; }
.hero-stats dd { margin: 6px 0 0; font-size: 26px; font-weight: 650; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.hero-stats dd.is-text { padding-top: 5px; font-size: 18px; font-weight: 600; letter-spacing: -.01em; }

/* 右侧预览卡 */
.hero-visual { position: relative; }
.hero-glow {
  position: absolute; inset: -24px 0 -12px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgb(124 58 237 / 22%), rgb(79 70 229 / 10%) 55%, transparent 78%);
  filter: blur(18px);
  pointer-events: none;
}
.preview {
  position: relative;
  border: 1px solid rgb(255 255 255 / 60%);
  border-radius: var(--r-xl);
  background: linear-gradient(168deg, #ffffff 0%, #f7f7ff 100%);
  box-shadow: var(--sh-lg);
  overflow: hidden;
}
.preview-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-2);
  background: rgb(255 255 255 / 80%);
}
.preview-dots { display: inline-flex; gap: 5px; }
.preview-dots i { width: 8px; height: 8px; border-radius: 50%; background: #e2e5ef; }
.preview-dots i:first-child { background: #ffc7c2; }
.preview-dots i:nth-child(2) { background: #ffe0a8; }
.preview-dots i:last-child { background: #b6e8cf; }
.preview-title { color: var(--muted); font-size: 12px; letter-spacing: .02em; }
.preview-live { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; color: var(--ok); font-size: 11px; }
.preview-live i { width: 5px; height: 5px; border-radius: 50%; background: #12b76a; }

.preview-list { display: grid; align-content: start; gap: 2px; margin: 0; padding: 14px; list-style: none; min-height: 168px; }
.preview-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  background: #fff;
  box-shadow: 0 1px 2px rgb(16 24 40 / 5%), 0 0 0 1px rgb(16 24 40 / 3.5%);
}
.preview-icon {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 7px;
  background: linear-gradient(140deg, #7f74f7, #4f46e5);
  color: #fff; font-size: 11px; font-weight: 600;
}
.preview-icon.has-image { background: #fff; box-shadow: 0 0 0 1px var(--line-2); overflow: hidden; }
.preview-icon.has-image img { width: 100%; height: 100%; object-fit: contain; display: block; }
.preview-icon[data-tone="1"] { background: linear-gradient(140deg, #a78bfa, #7c3aed); }
.preview-icon[data-tone="2"] { background: linear-gradient(140deg, #5eead4, #0d9488); }
.preview-icon[data-tone="3"] { background: linear-gradient(140deg, #fbbf77, #ea7c1f); }
.preview-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); font-size: 12.5px; }
.preview-flag { display: inline-flex; align-items: center; gap: 5px; color: var(--faint); font-size: 10.5px; }
.preview-flag::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #d0d5dd; }
.preview-flag.on { color: var(--ok); }
.preview-flag.on::before { background: #12b76a; box-shadow: 0 0 0 3px rgb(18 183 106 / 14%); }
.preview-empty { display: grid; place-items: center; padding: 44px 0; color: var(--faint); font-size: 12.5px; }

.preview-foot { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 16px; }
.tag-chip {
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 10.5px;
}

/* ---------- 区块通用 ---------- */

.section { margin-top: 68px; scroll-margin-top: 90px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.section-head-text h2 { margin: 0; font-size: 21px; font-weight: 650; letter-spacing: -.025em; }
.section-head-text p { margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.pill {
  flex-shrink: 0;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--sh-xs);
}

.notice {
  margin: 0 0 18px;
  padding: 13px 16px;
  border: 1px solid #ffe0b2;
  border-radius: var(--r-md);
  background: #fffaf0;
  color: #b54708;
  font-size: 13px; line-height: 1.7;
}
.page-note { margin: 16px 0 0; color: var(--faint); font-size: 12px; line-height: 1.8; }
.page-note:empty { display: none; }
.admin-message { min-height: 18px; margin: 10px 0 0; color: var(--danger); font-size: 12.5px; line-height: 1.6; }
.admin-message:empty { min-height: 0; margin: 0; }
.admin-message[data-state="ok"] { color: var(--ok); }

/* ---------- 项目卡 ---------- */

.project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
/* 只有一个项目时不要硬留半张空位 */
.project-grid[data-count="1"] { grid-template-columns: minmax(0, 1fr); max-width: 640px; }
/* 正好三个时排成一行，比 "两上一下" 更整齐 */
.project-grid[data-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.project-card {
  position: relative;
  display: flex; flex-direction: column;
  min-height: 176px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: var(--sh-xs);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.project-card:hover { transform: translateY(-3px); border-color: #dcd9fb; box-shadow: var(--sh-md); }
.project-card[aria-busy="true"] { opacity: .6; pointer-events: none; }

.pc-main {
  display: flex; flex-direction: column; flex: 1;
  padding: 20px 20px 0;
  text-decoration: none; color: inherit;
}
.pc-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pc-icon {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(140deg, #7f74f7, #4f46e5);
  color: #fff; font-size: 16px; font-weight: 600;
  box-shadow: 0 6px 14px -6px rgb(79 70 229 / 60%);
}
/* 项目提供了自己的图标：撤掉渐变底和字，让图标自己说话。
   选择器要比下面的 data-tone 更具体，否则彩色渐变会盖回来。 */
.project-card .pc-icon.has-image {
  background: #fff;
  color: transparent;
  box-shadow: 0 0 0 1px var(--line-2), 0 6px 14px -8px rgb(16 24 40 / 26%);
  overflow: hidden;
}
.pc-icon.has-image img { width: 100%; height: 100%; object-fit: contain; display: block; }
.project-card[data-tone="1"] .pc-icon { background: linear-gradient(140deg, #a78bfa, #7c3aed); box-shadow: 0 6px 14px -6px rgb(124 58 237 / 55%); }
.project-card[data-tone="2"] .pc-icon { background: linear-gradient(140deg, #5eead4, #0d9488); box-shadow: 0 6px 14px -6px rgb(13 148 136 / 50%); }
.project-card[data-tone="3"] .pc-icon { background: linear-gradient(140deg, #fbbf77, #ea7c1f); box-shadow: 0 6px 14px -6px rgb(234 124 31 / 50%); }
.project-card[data-tone] .pc-icon.has-image {
  background: #fff;
  box-shadow: 0 0 0 1px var(--line-2), 0 6px 14px -8px rgb(16 24 40 / 26%);
}

.pc-state {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 11px; font-weight: 500;
}
.pc-state::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #12b76a; box-shadow: 0 0 0 3px rgb(18 183 106 / 14%); }

.pc-main h3 { margin: 15px 0 6px; font-size: 17.5px; font-weight: 650; letter-spacing: -.02em; }
.pc-main p {
  margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--muted); font-size: 12.5px; line-height: 1.75;
}

.pc-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 18px; padding: 12px 20px;
  border-top: 1px solid var(--line-2);
}
.pc-open { display: inline-flex; align-items: center; gap: 6px; color: var(--brand); font-size: 12.5px; font-weight: 500; }
.pc-open svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .18s ease; }
.project-card:hover .pc-open svg { transform: translateX(3px); }
.project-actions { display: flex; gap: 6px; }
.project-actions .button { min-height: 28px; padding: 0 9px; font-size: 11.5px; border-radius: 7px; box-shadow: none; background: var(--surface-2); border-color: transparent; }
.project-actions .button:hover { background: #eef0f6; border-color: transparent; }
.project-actions .button.danger:hover { background: var(--danger-soft); }
.project-card .pc-foot .pc-open.is-hidden { display: none; }

/* ---------- 特性 ---------- */

.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin: 0; padding: 0; list-style: none; }
.feature {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: var(--sh-xs);
  transition: transform .18s ease, box-shadow .18s ease;
}
.feature:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
.feature-icon {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 11px;
}
.feature-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.feature-icon.tone-indigo { background: #eef0ff; color: #4f46e5; }
.feature-icon.tone-violet { background: #f5eeff; color: #7c3aed; }
.feature-icon.tone-teal { background: #e6fbf7; color: #0d9488; }
.feature h3 { margin: 16px 0 7px; font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.feature p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.8; }

/* ============================================================
   内页通用头部
   ============================================================ */

.view-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 28px;
  margin-bottom: 24px;
}
.view-head > div:first-child { flex: 1; min-width: 0; }
.view-head .eyebrow { margin-bottom: 8px; color: var(--brand); }
.view-head h2 { margin: 0; font-size: 27px; font-weight: 650; letter-spacing: -.03em; }
.view-head p:last-child { max-width: 660px; margin: 9px 0 0; color: var(--muted); font-size: 13px; line-height: 1.75; }
.view-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; flex-shrink: 0; }

/* ============================================================
   交接箱
   ============================================================ */

.handoff-list { display: grid; }
.handoff-loading { margin: 0; padding: 26px 0; color: var(--faint); font-size: 13px; }
.empty-handoffs {
  margin: 0; padding: 26px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--muted); font-size: 13px; line-height: 1.8;
}
.handoff-row {
  display: grid; grid-template-columns: minmax(160px, .6fr) minmax(0, 1.4fr) auto;
  gap: 24px; align-items: start;
  padding: 18px 0;
  border-bottom: 1px solid var(--line-2);
}
.handoff-row:last-child { border-bottom: 0; }
.handoff-row-head { display: grid; gap: 5px; }
.handoff-row-head strong { font-size: 14px; font-weight: 600; }
.handoff-row-head span, .handoff-status { color: var(--faint); font-size: 12px; line-height: 1.6; }
.handoff-content summary { color: var(--brand); font-size: 12.5px; cursor: pointer; }
.handoff-content pre {
  max-height: 240px; overflow: auto;
  margin: 12px 0 0; padding: 14px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface-2);
  white-space: pre-wrap; overflow-wrap: anywhere;
  font: 12px/1.7 ui-monospace, Consolas, monospace;
}
.handoff-row-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

/* ============================================================
   账号 / 访问控制
   ============================================================ */

.admin-body { display: grid; grid-template-columns: minmax(280px, .82fr) minmax(0, 1.18fr); gap: 18px; align-items: stretch; }
.admin-body:has(> [hidden]) { grid-template-columns: minmax(0, 1fr); }

.create-user h3, .user-list-wrap h3 { margin: 0 0 18px; font-size: 14px; font-weight: 650; letter-spacing: -.01em; }
.create-user .field { margin-bottom: 13px; }
.create-user .field input, .create-user .field select { height: 38px; font-size: 13px; }
.user-list-wrap { min-width: 0; }

.user-list { display: grid; }
.user-row {
  display: grid; grid-template-columns: minmax(120px, 1fr) minmax(120px, 1.05fr) 64px auto;
  align-items: center; gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line-2);
  font-size: 13px;
}
.user-row:last-child { border-bottom: 0; }
.user-name { min-width: 0; }
.user-name strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 600; }
.user-name span { display: block; margin-top: 3px; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.user-meta { display: grid; gap: 3px; min-width: 0; }
.user-role { color: var(--ink-2); font-size: 12px; }
.user-grants { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--faint); font-size: 12px; }
.user-row select { width: 100%; min-width: 0; height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--r-xs); background: #fff; font-size: 12px; }
.user-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.user-actions .button { min-height: 30px; padding: 0 9px; font-size: 11.5px; }
.user-status { color: var(--faint); font-size: 11.5px; }
.user-status.active { color: var(--ok); }
.empty-users { margin: 14px 0; color: var(--faint); font-size: 13px; }

.grant-field { margin: 0 0 16px; padding: 0; border: 0; }
.grant-field legend { margin-bottom: 8px; padding: 0; color: var(--ink-2); font-size: 12.5px; font-weight: 500; }
.grant-list { display: grid; gap: 7px; margin-bottom: 9px; }
.grant-item, .grant-all { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.grant-item input, .grant-all input { width: 15px; height: 15px; margin: 0; accent-color: var(--brand); }
.grant-all { margin-top: 6px; padding-top: 10px; border-top: 1px dashed var(--line); }

.section-gap { margin-top: 26px !important; padding-top: 20px; border-top: 1px solid var(--line-2); }
.panel-hint { margin: 0 0 4px; color: var(--faint); font-size: 12px; line-height: 1.7; }

.reset-password-form { margin-top: 16px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }

.invite-list { display: grid; }
.invite-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center; gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-2);
}
.invite-row:last-child { border-bottom: 0; }
.invite-main { display: grid; gap: 4px; min-width: 0; }
.invite-main code { color: var(--brand); font: 13px/1.4 ui-monospace, Consolas, monospace; letter-spacing: .06em; }
.invite-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--faint); font-size: 12px; }
.invite-state { padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 11px; white-space: nowrap; }
.invite-state.active { background: var(--ok-soft); color: var(--ok); }
.invite-actions { display: flex; gap: 6px; }
.invite-actions .button { min-height: 30px; font-size: 11.5px; }

/* ============================================================
   操作日志
   ============================================================ */

.audit-filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-2);
}
.audit-field { display: grid; gap: 6px; color: var(--ink-2); font-size: 12px; font-weight: 500; }
.audit-field input, .audit-field select {
  height: 36px; min-width: 132px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--r-xs);
  background: #fff; color: var(--ink); font-size: 12.5px; font-weight: 400;
}
.audit-field input:focus, .audit-field select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgb(79 70 229 / 12%); }
.audit-field input[type="search"] { min-width: 200px; }
.audit-filter-actions { display: flex; gap: 8px; }
.audit-hint { margin: 0; padding: 14px 0 4px; color: var(--faint); font-size: 12px; }
.audit-hint:empty { display: none; }
.audit-hint.warn { color: var(--danger); }
.audit-list { max-height: 62vh; overflow: auto; }
.audit-row {
  display: grid; grid-template-columns: 148px 118px minmax(0, 1fr) 108px;
  gap: 14px; padding: 11px 0;
  border-bottom: 1px solid var(--line-2);
  font-size: 12.5px;
}
.audit-time { color: var(--faint); font-variant-numeric: tabular-nums; }
.audit-action { color: var(--ink-2); font-weight: 500; }
.audit-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.audit-ip { color: var(--faint); text-align: right; font-variant-numeric: tabular-nums; }

/* ============================================================
   角色
   ============================================================ */

.role-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.role-card {
  display: flex; flex-direction: column; gap: 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: var(--sh-xs);
}
.role-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.role-card-head h3 { margin: 0; font-size: 15.5px; font-weight: 650; letter-spacing: -.01em; }
.role-badge { padding: 2.5px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 11px; }
.role-badge.builtin { background: var(--brand-soft); color: var(--brand-ink); }
.role-desc { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.75; }
.role-perms { display: flex; flex-wrap: wrap; gap: 6px; }
.role-perm { padding: 3px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); font: 11px/1.5 ui-monospace, Consolas, monospace; }
.role-perm.super { background: var(--brand-soft); color: var(--brand-ink); }
.role-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 4px; }
.role-users { color: var(--faint); font-size: 12px; }
.role-actions { display: flex; gap: 6px; }
.role-actions .button { min-height: 30px; padding: 0 10px; font-size: 11.5px; }

.permission-summary { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.permission-groups { display: grid; gap: 12px; }
.permission-group { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.permission-group-head { padding: 10px 13px; border-bottom: 1px solid var(--line-2); background: var(--surface-2); font-size: 12px; font-weight: 600; }
.permission-item {
  display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 10px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--line-2);
  cursor: pointer;
  transition: background-color .14s ease;
}
.permission-item:last-child { border-bottom: 0; }
.permission-item:hover { background: var(--surface-2); }
.permission-item input { width: 15px; height: 15px; margin: 1px 0 0; accent-color: var(--brand); }
.permission-item strong { display: block; font-size: 12.5px; font-weight: 500; }
.permission-item span { display: block; margin-top: 3px; color: var(--faint); font-size: 11.5px; line-height: 1.6; }

/* ============================================================
   中转站
   ============================================================ */

.relay-summary { margin: 0 0 18px; padding: 13px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; color: var(--muted); font-size: 12.5px; line-height: 1.8; box-shadow: var(--sh-xs); }
.relay-summary code { color: var(--brand); font: 12px/1.6 ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }
.relay-summary:empty { display: none; }
.relay-columns { display: grid; grid-template-columns: minmax(0, 1.06fr) minmax(0, .94fr); gap: 18px; align-items: start; }
.relay-column { min-width: 0; }
.relay-column h3 { display: flex; align-items: baseline; gap: 8px; margin: 0 0 12px; font-size: 14px; font-weight: 650; }
.relay-count { color: var(--faint); font-size: 11.5px; font-weight: 400; }
.station-list, .binding-list { display: grid; gap: 12px; }

.station-card { border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; box-shadow: var(--sh-xs); }
.station-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 15px 0; }
.station-title { min-width: 0; }
.station-title strong { display: block; font-size: 13.5px; font-weight: 650; }
.station-url { display: block; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--faint); font: 11px/1.6 ui-monospace, Consolas, monospace; }
.station-actions { display: flex; gap: 5px; flex-shrink: 0; }
.station-actions .button { min-height: 27px; padding: 0 8px; font-size: 11px; }
.station-keys { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 15px 0; }
.key-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3.5px 8px;
  border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--muted);
  font-size: 11px; line-height: 1.5;
}
.key-chip i { width: 5px; height: 5px; border-radius: 50%; background: #12b76a; }
.key-chip.cooling { border-color: #f5c7c3; background: var(--danger-soft); color: var(--danger); }
.key-chip.cooling i { background: var(--danger); }
.key-chip.off { opacity: .5; }
.key-chip button { border: 0; background: none; padding: 0; color: var(--brand); font-size: 11px; cursor: pointer; }
.station-foot { display: flex; flex-wrap: wrap; gap: 12px; padding: 10px 15px 13px; color: var(--faint); font-size: 11px; }
.station-foot span { display: inline-flex; align-items: center; gap: 5px; }
.station-foot span::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #d0d5dd; }
.station-foot .warn::before { background: var(--danger); }
.station-foot .ok::before { background: #12b76a; }

.binding-card { padding: 14px 15px; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; box-shadow: var(--sh-xs); }
.binding-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.binding-card-head strong { font-size: 13.5px; font-weight: 650; }
.binding-state { color: var(--faint); font-size: 11px; }
.binding-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.binding-tag { padding: 3.5px 8px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-ink); font-size: 11px; line-height: 1.5; }
.binding-tag em { color: var(--brand-ink); font-style: normal; font-weight: 600; }
.binding-tag.empty { background: var(--surface-2); color: var(--faint); }
.binding-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 12px; }
.binding-actions .button { min-height: 28px; padding: 0 9px; font-size: 11.5px; }

/* ============================================================
   弹窗
   ============================================================ */

.dialog {
  width: min(460px, calc(100% - 32px));
  max-height: min(88vh, 780px);
  overflow: auto;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: #fff;
  color: var(--ink);
  box-shadow: var(--sh-lg);
  scrollbar-width: thin;
  scrollbar-color: #d5d9e6 transparent;
}
.dialog.wide { width: min(660px, calc(100% - 32px)); }
.dialog::backdrop { background: rgb(16 24 40 / 42%); backdrop-filter: blur(3px); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.dialog-head .eyebrow { margin-bottom: 6px; color: var(--brand); }
.dialog-head h2 { margin: 0; font-size: 21px; font-weight: 650; letter-spacing: -.025em; }
.dialog .field { margin-bottom: 10px; }
/* 弹窗里的动作按钮靠右、按内容取宽 —— 撑满整行会显得笨重 */
.dialog .form-actions { justify-content: flex-end; }
.dialog .form-actions .button { flex: 0 0 auto; }
.dialog-block { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-2); }
.dialog-block h3 { margin: 0 0 14px; font-size: 13.5px; font-weight: 650; }
.dialog-block .form-actions { margin-top: 14px; }
.dialog-block .form-actions .button { flex: 0 0 auto; }
.profile-note { margin: 10px 0 0; color: var(--faint); font-size: 12px; line-height: 1.7; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; }
.inline-check { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; color: var(--ink-2); font-size: 12.5px; }
.inline-check input { width: 15px; height: 15px; margin: 0; accent-color: var(--brand); }
.inline-stack { display: grid; align-content: center; gap: 2px; padding-bottom: 10px; }
.dialog-details { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.dialog-details summary { color: var(--brand); font-size: 12.5px; cursor: pointer; }
.dialog-details .field { margin-top: 12px; }
.dialog textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--ink); font: 12px/1.7 ui-monospace, Consolas, monospace;
  resize: vertical;
}

/* 角色弹窗：头尾固定、中间滚动 */
#role-dialog { max-height: min(90vh, 820px); overflow: hidden; padding: 0; }
#role-dialog[open] { display: flex; flex-direction: column; }
#role-dialog > form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
#role-dialog .dialog-head { position: static; margin: 0; padding: 22px 24px 16px; border-bottom: 1px solid var(--line-2); }
.role-body { flex: 1; min-height: 0; overflow: auto; padding: 18px 24px 6px; }
#role-dialog .form-actions { position: static; margin: 0; padding: 14px 24px 18px; border-top: 1px solid var(--line-2); }
#role-dialog .admin-message { margin: 0; padding: 0 24px 10px; }

/* 密钥编辑行 */
.key-editor { display: grid; gap: 8px; margin-bottom: 10px; }
.key-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) 62px 52px 26px; gap: 6px; align-items: center; }
.key-row input[type="text"], .key-row input[type="password"], .key-row input[type="number"] {
  width: 100%; min-width: 0; height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line); border-radius: var(--r-xs);
  font-size: 12px;
}
.key-row .key-enabled { display: grid; place-items: center; }
.key-row .key-enabled input { width: 15px; height: 15px; margin: 0; accent-color: var(--brand); }
.key-row .key-remove { border: 0; background: none; padding: 0; color: var(--danger); font-size: 16px; line-height: 1; cursor: pointer; }

.binding-stations { display: grid; gap: 10px; margin: 14px 0 18px; }
.binding-station { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.binding-station.on { border-color: #c9c5fb; box-shadow: 0 0 0 3px rgb(79 70 229 / 8%); }
.binding-pick { display: flex; align-items: center; gap: 9px; padding: 12px 13px; font-size: 12.5px; cursor: pointer; }
.binding-pick input { width: 15px; height: 15px; margin: 0; accent-color: var(--brand); }
.binding-pick strong { font-weight: 600; }
.binding-pick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--faint); font: 11px/1.5 ui-monospace, Consolas, monospace; }
.binding-detail { padding: 0 13px 13px; border-top: 1px dashed var(--line); }
.model-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 12px 0 8px; }
.model-toolbar .button { min-height: 28px; padding: 0 9px; font-size: 11.5px; }
.model-manual { flex: 1; min-width: 120px; height: 28px; padding: 0 9px; border: 1px solid var(--line); border-radius: var(--r-xs); font-size: 12px; }
.model-list { display: flex; flex-wrap: wrap; gap: 6px; max-height: 132px; overflow: auto; padding: 2px 0 6px; }
.model-item {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3.5px 8px;
  border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); font: 11px/1.5 ui-monospace, Consolas, monospace;
  cursor: pointer;
}
.model-item.on { border-color: #c9c5fb; background: var(--brand-soft); color: var(--brand-ink); }
.model-item input { width: 12px; height: 12px; margin: 0; accent-color: var(--brand); }
.empty-models { color: var(--faint); font-size: 11.5px; line-height: 1.7; }

/* ============================================================
   页脚
   ============================================================ */

.site-foot { border-top: 1px solid var(--line); background: rgb(255 255 255 / 60%); }
.site-foot-inner {
  width: var(--shell); margin: 0 auto;
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px;
  padding: 22px 0 24px;
  color: var(--faint); font-size: 12px;
}
.site-foot-brand { color: var(--ink-2); font-weight: 600; }
.site-foot-meta { margin-left: auto; }

/* ============================================================
   瞬态反馈
   ============================================================ */

.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: grid; gap: 8px; justify-items: end; pointer-events: none; }
.toast {
  max-width: min(380px, calc(100vw - 40px));
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: #fff;
  box-shadow: var(--sh-md);
  color: var(--ink-2); font-size: 12.5px; line-height: 1.6;
  pointer-events: auto; cursor: pointer;
  animation: toast-in .2s ease both;
}
.toast[data-tone="ok"] { border-left: 3px solid #12b76a; }
.toast[data-tone="error"] { border-left: 3px solid var(--danger); color: var(--danger); }
.toast[data-leaving="true"] { animation: toast-out .16s ease both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ============================================================
   响应式
   ============================================================ */

@media (max-width: 1100px) {
  .hero { grid-template-columns: 1fr; gap: 44px; }
  .hero-visual { max-width: 520px; }
  .admin-body { grid-template-columns: 1fr; }
  .relay-columns { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .topbar-inner { flex-wrap: wrap; gap: 8px; padding: 8px 0 4px; }
  .nav-tabs { order: 3; width: 100%; margin: 0 0 6px; padding: 3px; }
  .nav-item { height: 28px; padding: 0 11px; font-size: 12.5px; }
  .avatar-button { height: 34px; }
  .home { padding: 40px 0 64px; }
  .page { padding: 28px 0 64px; }
  .section { margin-top: 52px; }
  .view-head { flex-direction: column; align-items: flex-start; gap: 14px; }
  .view-actions { justify-content: flex-start; }
  .auth-card { grid-template-columns: 1fr; }
  .auth-aside { padding: 32px 30px; gap: 28px; }
  .auth-aside h2 { font-size: 27px; }
  .auth-points { display: none; }
  .auth-form-wrap { padding: 34px 30px 38px; }
}

@media (max-width: 720px) {
  :root { --shell: calc(100% - 32px); }
  .auth { padding: 28px 0 48px; }
  .hero h1 { font-size: 32px; }
  .hero-stats { flex-wrap: wrap; gap: 18px 0; }
  .hero-stats > div { padding-right: 20px; margin-right: 20px; }
  .hero-stats dd { font-size: 22px; }
  .project-grid, .project-grid[data-count="3"] { grid-template-columns: 1fr; }
  .project-grid[data-count="1"] { max-width: none; }
  .feature-grid { grid-template-columns: 1fr; }
  .role-list { grid-template-columns: 1fr; }
  .handoff-row { grid-template-columns: 1fr; gap: 12px; }
  .handoff-row-actions { justify-content: flex-start; }
  .user-row { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
  .user-row .user-meta { grid-column: 1 / -1; }
  .user-row .user-status { display: none; }
  .user-row .user-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .invite-row { grid-template-columns: minmax(0, 1fr) auto; }
  .invite-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .audit-row { grid-template-columns: 104px minmax(0, 1fr); gap: 10px; font-size: 12px; }
  .audit-ip { display: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .key-row { grid-template-columns: minmax(0, 1fr) 56px 44px 26px; }
  .key-row > :nth-child(2) { grid-column: 1 / -1; }
  .dialog { padding: 20px; border-radius: var(--r-lg); }
  .dialog.wide { width: calc(100% - 20px); }
  .section-head { flex-direction: column; align-items: flex-start; gap: 10px; }
}

@media (max-width: 420px) {
  .avatar-name { display: none; }
  .avatar-button { padding: 0 5px 0 3px; }
  .user-menu { width: 224px; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .button { width: 100%; }
  .toast-stack { left: 12px; right: 12px; justify-items: stretch; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
