/* =====================================================================
   聚流 · 控制台
   结构：左侧固定侧栏（工作区 / 分组导航 / 底部工具栏）+ 右侧内容区
   主题：浅色 / 深色，切换存在 localStorage，首屏由 <head> 内联脚本抢跑
   ===================================================================== */

/* ---------- Google Sans（本地自托管，仅拉丁子集；中文自动回退系统字体） ---------- */
@font-face { font-family: 'Google Sans'; font-style: normal; font-weight: 300; font-display: swap; src: url('fonts/GoogleSans-300.woff2') format('woff2'); unicode-range: U+0020-007E, U+00A0-00FF, U+2000-206F, U+2190-2193, U+2212, U+25A0-25FF; }
@font-face { font-family: 'Google Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/GoogleSans-400.woff2') format('woff2'); unicode-range: U+0020-007E, U+00A0-00FF, U+2000-206F, U+2190-2193, U+2212, U+25A0-25FF; }
@font-face { font-family: 'Google Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/GoogleSans-500.woff2') format('woff2'); unicode-range: U+0020-007E, U+00A0-00FF, U+2000-206F, U+2190-2193, U+2212, U+25A0-25FF; }
@font-face { font-family: 'Google Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/GoogleSans-600.woff2') format('woff2'); unicode-range: U+0020-007E, U+00A0-00FF, U+2000-206F, U+2190-2193, U+2212, U+25A0-25FF; }
@font-face { font-family: 'Google Sans'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/GoogleSans-700.woff2') format('woff2'); unicode-range: U+0020-007E, U+00A0-00FF, U+2000-206F, U+2190-2193, U+2212, U+25A0-25FF; }
@font-face { font-family: 'Google Sans'; font-style: italic; font-weight: 400; font-display: swap; src: url('fonts/GoogleSans-italic-400.woff2') format('woff2'); }

/* ---------- 令牌 ---------- */
:root {
  --font: 'Google Sans', system-ui, -apple-system, 'Segoe UI', 'PingFang SC',
          'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;

  --bg: #ffffff;
  --side-bg: #fafafa;
  --panel: #ffffff;
  --surface-2: #f7f7f7;
  --hover: #f2f2f2;
  --active: #ececec;
  --line: #ebebeb;
  --line-strong: #e2e2e2;

  --ink: #171717;
  --ink-2: #525252;
  --ink-3: #7c7c7c;
  --ink-4: #a3a3a3;

  --solid: #171717;
  --solid-ink: #ffffff;
  --solid-hover: #2e2e2e;

  --green: #0f7a45;
  --green-bg: #e9f7ef;
  --red: #c0352b;
  --red-bg: #fdeceb;
  --amber: #8a5a00;
  --amber-bg: #fdf4e3;

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 10px;
  --r-xl: 14px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow-pop: 0 14px 34px -10px rgba(0, 0, 0, .18), 0 2px 6px rgba(0, 0, 0, .05);
  --shadow-modal: 0 28px 70px -18px rgba(0, 0, 0, .38), 0 4px 14px rgba(0, 0, 0, .08);

  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-out: cubic-bezier(.22, 1, .36, 1);

  --side-w: 246px;
  color-scheme: light;
}

:root[data-theme='dark'] {
  --bg: #0a0a0a;
  --side-bg: #0c0c0c;
  --panel: #0f0f0f;
  --surface-2: #141414;
  --hover: #1a1a1a;
  --active: #232323;
  --line: #232323;
  --line-strong: #2e2e2e;

  --ink: #ededed;
  --ink-2: #a8a8a8;
  --ink-3: #7d7d7d;
  --ink-4: #5f5f5f;

  --solid: #ededed;
  --solid-ink: #0a0a0a;
  --solid-hover: #ffffff;

  --green: #4ade80;
  --green-bg: rgba(74, 222, 128, .12);
  --red: #f87171;
  --red-bg: rgba(248, 113, 113, .12);
  --amber: #fbbf24;
  --amber-bg: rgba(251, 191, 36, .12);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-pop: 0 16px 38px -10px rgba(0, 0, 0, .8), 0 2px 8px rgba(0, 0, 0, .5);
  --shadow-modal: 0 30px 80px -18px rgba(0, 0, 0, .85), 0 4px 16px rgba(0, 0, 0, .6);

  color-scheme: dark;
}

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

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, dl, dd, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
svg { display: block; }
::selection { background: rgba(23, 23, 23, .12); }
:root[data-theme='dark'] ::selection { background: rgba(255, 255, 255, .18); }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 4px;
}

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

/* =====================================================================
   骨架
   ===================================================================== */
.app { display: flex; min-height: 100dvh; }

/* ---------- 侧栏 ---------- */
.side {
  position: sticky;
  top: 0;
  flex: none;
  width: var(--side-w);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 10px 10px 8px;
  background: var(--side-bg);
  border-right: 1px solid var(--line);
  z-index: 40;
}

.side__top { position: relative; }

/* 工作区按钮 */
.ws {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 7px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background-color .13s var(--ease-out);
}
.ws:hover { background: var(--hover); }
.ws[aria-expanded='true'] { background: var(--active); }

.ws__av {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .01em;
  background-image: linear-gradient(135deg, #0f766e 0%, #1d4ed8 48%, #7c3aed 100%);
  background-size: 220% 220%;
  animation: av-flow 14s ease-in-out infinite;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14);
}
@keyframes av-flow {
  0%, 100% { background-position: 0% 40%; }
  50% { background-position: 100% 60%; }
}

.ws__name {
  min-width: 0;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -.012em;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ws__chev {
  flex: none;
  margin-left: auto;
  color: var(--ink-3);
  transition: transform .18s var(--ease-out);
}
.ws[aria-expanded='true'] .ws__chev { transform: rotate(180deg); }

/* ---------- 账户弹出菜单 ---------- */
.menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 4px;
  width: 240px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
  box-shadow: var(--shadow-pop);
  z-index: 70;
  transform-origin: top left;
  animation: menu-in .15s var(--ease-out);
}
.menu[hidden] { display: none; }

@keyframes menu-in {
  from { opacity: 0; transform: scale(.965) translateY(-3px); }
  to { opacity: 1; transform: none; }
}

.menu__mail {
  padding: 7px 9px 8px;
  font-size: 12px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu__sep {
  height: 1px;
  margin: 5px -5px;
  background: var(--line);
}

.menu__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  font-size: 13px;
  color: var(--ink-2);
  text-align: left;
  cursor: pointer;
  transition: background-color .12s var(--ease-out), color .12s var(--ease-out);
}
.menu__item svg { flex: none; color: var(--ink-3); }
.menu__item:hover { background: var(--hover); color: var(--ink); }
.menu__item:hover svg { color: var(--ink-2); }
.menu__item--danger { color: var(--red); }
.menu__item--danger svg { color: currentColor; }
.menu__item--danger:hover { background: var(--red-bg); color: var(--red); }
.menu__item[hidden] { display: none; }
.menu__arrow { margin-left: auto; color: var(--ink-4); }

/* ---------- 导航 ---------- */
.nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav__sep {
  height: 1px;
  margin: 9px 7px;
  background: var(--line);
}

.nav__link {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 30px;
  padding: 0 7px;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--ink-2);
  transition: background-color .12s var(--ease-out), color .12s var(--ease-out);
}
.nav__link svg { flex: none; color: var(--ink-3); transition: color .12s var(--ease-out); }
.nav__link:hover { background: var(--hover); color: var(--ink); }
.nav__link:hover svg { color: var(--ink-2); }

.nav__link.is-active {
  background: var(--active);
  color: var(--ink);
  font-weight: 500;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.nav__link.is-active svg { color: var(--ink); }

.nav__link .count {
  margin-left: auto;
  padding: 0 5px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  border-radius: 5px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}
.nav__link[hidden] { display: none; }

/* ---------- 侧栏底部 ---------- */
.side__foot {
  margin-top: auto;
  padding: 8px 2px 0;
  display: flex;
  align-items: center;
  gap: 2px;
  border-top: 1px solid var(--line);
}

.iconbtn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  transition: background-color .12s var(--ease-out), color .12s var(--ease-out);
}
.iconbtn:hover { background: var(--hover); color: var(--ink); }
.side__foot .spacer { flex: 1; }

/* =====================================================================
   内容区
   ===================================================================== */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.mobile-bar {
  display: none;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 30;
}
.mobile-bar__title { font-size: 14.5px; font-weight: 500; letter-spacing: -.01em; }

.page {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 40px 40px 88px;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* 视图重新显示时会重新触发一次入场（display 从 none 切回来） */
.view:not([hidden]) { animation: page-in .24s var(--ease-out); }
.view[hidden] { display: none; }

/* 图标统一尺寸 */
.i { width: 16px; height: 16px; flex: none; }

/* 页头 */
.head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}
.head__title {
  font-size: 27px;
  font-weight: 500;
  letter-spacing: -.035em;
  line-height: 1.2;
}
.head__sub {
  margin-top: 7px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-3);
  max-width: 56ch;
}
.head__actions { display: flex; align-items: center; gap: 8px; flex: none; }

/* 分段标签 */
.tabs { display: inline-flex; align-items: center; gap: 2px; }
.tab {
  height: 30px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color .12s var(--ease-out), color .12s var(--ease-out),
              box-shadow .12s var(--ease-out);
}
.tab:hover { color: var(--ink); }
.tab.is-on {
  background: var(--active);
  color: var(--ink);
  font-weight: 500;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

/* 工具条 */
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.search {
  position: relative;
  flex: 1 1 220px;
  min-width: 0;
  max-width: 420px;
}
.search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-4);
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 34px;
  padding: 0 11px 0 32px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--panel);
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  transition: border-color .13s var(--ease-out), box-shadow .13s var(--ease-out);
}
.search input::placeholder { color: var(--ink-4); }
.search input:focus {
  outline: 0;
  border-color: var(--ink-3);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, .05);
}
:root[data-theme='dark'] .search input:focus { box-shadow: 0 0 0 3px rgba(255, 255, 255, .07); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--panel);
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color .12s var(--ease-out);
}
.chip:hover { background: var(--hover); color: var(--ink); }

/* =====================================================================
   表格（桌面用 grid 行，手机自动变卡片）
   ===================================================================== */
.table {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
  overflow: hidden;
}
.table__head,
.row {
  display: grid;
  grid-template-columns: var(--cols, 2fr 1fr 1fr);
  align-items: center;
  gap: 14px;
}
.table__head {
  height: 38px;
  padding: 0 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-3);
  letter-spacing: .01em;
}
.row {
  min-height: 58px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-2);
  transition: background-color .12s var(--ease-out);
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); }
.row__main { min-width: 0; }
.row__title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -.01em;
}
.row__meta {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--ink-4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row__actions { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }

.mono {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: -.01em;
  color: var(--ink-2);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 21px;
  padding: 0 7px;
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .01em;
  background: var(--surface-2);
  color: var(--ink-3);
  white-space: nowrap;
}
.pill--ok { background: var(--green-bg); color: var(--green); }
.pill--off { background: var(--red-bg); color: var(--red); }
.pill--warn { background: var(--amber-bg); color: var(--amber); }
.pill__dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* 空状态 */
.empty {
  padding: 54px 24px 58px;
  text-align: center;
}
.empty__icon {
  width: 38px;
  height: 38px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink-3);
}
.empty__title { font-size: 13.5px; font-weight: 500; color: var(--ink); }
.empty__text { margin-top: 5px; font-size: 12.5px; color: var(--ink-3); }
.empty__action { margin-top: 16px; }

/* =====================================================================
   按钮
   ===================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: var(--solid);
  color: var(--solid-ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -.005em;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .13s var(--ease-out), border-color .13s var(--ease-out),
              color .13s var(--ease-out), transform .1s var(--ease-out), opacity .13s;
}
.btn:hover:not(:disabled) { background: var(--solid-hover); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn--ghost {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}
.btn--ghost:hover:not(:disabled) { background: var(--hover); border-color: var(--ink-4); }
.btn--quiet { background: transparent; color: var(--ink-2); }
.btn--quiet:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.btn--danger { background: transparent; color: var(--red); border-color: transparent; }
.btn--danger:hover:not(:disabled) { background: var(--red-bg); }
.btn--sm { height: 28px; padding: 0 9px; font-size: 12px; border-radius: var(--r-sm); }
.btn--icon { width: 30px; padding: 0; }

/* =====================================================================
   卡片 / 概览
   ===================================================================== */
.card {
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
}
.card__label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-3);
  letter-spacing: .01em;
}
.card__value {
  margin-top: 10px;
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.card__hint { margin-top: 3px; font-size: 11.5px; color: var(--ink-4); }
.card__value--date { font-size: 19px; letter-spacing: -.02em; }

.grid-3 {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 22px;
}

/* 账户条 */
.account {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 15px 16px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
}
.account__av {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  background-image: linear-gradient(135deg, #0f766e 0%, #1d4ed8 48%, #7c3aed 100%);
  background-size: 220% 220%;
  animation: av-flow 14s ease-in-out infinite;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
}
.account__txt { min-width: 0; }
.account__mail {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -.01em;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account__meta {
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--ink-4);
}
.account__meta .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-4); }
.account__actions { margin-left: auto; display: flex; gap: 6px; flex: none; }

/* 区块标题 */
.section { margin-top: 26px; }
.section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.section__title { font-size: 13px; font-weight: 500; color: var(--ink); letter-spacing: -.005em; }
.section__link { font-size: 12px; color: var(--ink-3); }
.section__link:hover { color: var(--ink); }

/* 代码块 */
.code {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  overflow: hidden;
}
.code__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px 0 13px;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-3);
}
.code__bar .spacer { flex: 1; }
.code pre {
  margin: 0;
  padding: 13px 14px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.75;
  color: var(--ink-2);
}
.code .k { color: var(--ink); }
.code .s { color: #0f766e; }
:root[data-theme='dark'] .code .s { color: #5eead4; }
.code .c { color: var(--ink-4); }

.copy-inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 7px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--panel);
  font-size: 11px;
  color: var(--ink-3);
  cursor: pointer;
}
.copy-inline:hover { color: var(--ink); border-color: var(--ink-4); }

/* 键值列表（设置页） */
.kvlist { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); overflow: hidden; }
.kvrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.kvrow:last-child { border-bottom: 0; }
.kvrow__k { color: var(--ink-3); }
.kvrow__v { color: var(--ink); font-weight: 500; text-align: right; word-break: break-all; }

/* 表单 */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.field__hint { font-size: 11.5px; color: var(--ink-4); }
.field__label .label-en {
  margin-left: 6px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-4);
  vertical-align: 1px;
}
.input {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--panel);
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  transition: border-color .13s var(--ease-out), box-shadow .13s var(--ease-out);
}
.input::placeholder { color: var(--ink-4); }
.input:focus {
  outline: 0;
  border-color: var(--ink-3);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, .05);
}
:root[data-theme='dark'] .input:focus { box-shadow: 0 0 0 3px rgba(255, 255, 255, .07); }
select.input { cursor: pointer; }

.form { display: grid; gap: 13px; max-width: 380px; }
.form__foot { display: flex; align-items: center; gap: 8px; margin-top: 2px; }

/* 开关（设置页外观） */
.switch {
  position: relative;
  width: 38px;
  height: 22px;
  flex: none;
  border: 0;
  border-radius: 11px;
  background: var(--line-strong);
  cursor: pointer;
  transition: background-color .18s var(--ease-out);
}
.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .2s var(--ease-out);
}
.switch[aria-checked='true'] { background: var(--ink); }
.switch[aria-checked='true']::after { transform: translateX(16px); }
:root[data-theme='dark'] .switch[aria-checked='true']::after { background: var(--bg); }

/* =====================================================================
   弹窗
   ===================================================================== */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 10, 10, .34);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: fade-in .16s var(--ease-out);
}
.backdrop[hidden] { display: none; }
@keyframes fade-in { from { opacity: 0; } }

.modal {
  width: min(440px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--panel);
  box-shadow: var(--shadow-modal);
  transform-origin: center;
  animation: modal-in .2s var(--ease-out);
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(.97) translateY(6px); }
  to { opacity: 1; transform: none; }
}

.modal__head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.modal__title { font-size: 15.5px; font-weight: 500; letter-spacing: -.02em; }
.modal__sub { margin-top: 4px; font-size: 12.5px; line-height: 1.6; color: var(--ink-3); }
.modal__close { margin-left: auto; flex: none; }
.modal__body { display: grid; gap: 13px; }
.modal__foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}
.modal__foot .spacer { flex: 1; }

/* 密钥一次性展示 */
.secret {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
  word-break: break-all;
}
.warn {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 10px 11px;
  border-radius: var(--r-md);
  background: var(--amber-bg);
  color: var(--amber);
  font-size: 12px;
  line-height: 1.6;
}
.warn svg { flex: none; margin-top: 2px; }

/* 表单提示 */
.form-note { min-height: 18px; font-size: 12px; color: var(--ink-3); }
.form-note[data-kind='error'] { color: var(--red); }
.form-note[data-kind='ok'] { color: var(--green); }

/* 提示条（Toast） */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 12px);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: var(--shadow-pop);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s var(--ease-out), transform .22s var(--ease-out);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast svg { color: var(--green); }

/* 加载骨架 */
.loading { color: var(--ink-4); font-size: 13px; padding: 20px 0; }
.skeleton {
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--hover) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* 滚动条（桌面） */
@media (pointer: fine) {
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border: 3px solid var(--bg);
    border-radius: 999px;
  }
  ::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }
  ::-webkit-scrollbar-track { background: transparent; }
}

/* =====================================================================
   响应式
   ===================================================================== */
@media (max-width: 1080px) {
  .page { padding: 32px 26px 72px; }
}

/* 平板 / 手机：侧栏变抽屉 */
@media (max-width: 900px) {
  :root { --side-w: 264px; }

  .side {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-102%);
    transition: transform .28s var(--ease-out);
    box-shadow: var(--shadow-modal);
    z-index: 80;
  }
  .side.is-open { transform: none; }

  .scrim {
    position: fixed;
    inset: 0;
    z-index: 75;
    background: rgba(10, 10, 10, .36);
    opacity: 0;
    pointer-events: none;
    transition: opacity .24s var(--ease-out);
  }
  .scrim.is-on { opacity: 1; pointer-events: auto; }

  .mobile-bar { display: flex; }
  .page { padding: 22px 16px 64px; }
  .head { margin-bottom: 18px; gap: 12px; }
  .head__title { font-size: 22px; }
  .head__sub { font-size: 12.5px; }
  /* 手机上统计卡改成两列弹性流：奇数张时最后一张自动拉通 */
  .grid-3 { display: flex; flex-wrap: wrap; gap: 10px; }
  .grid-3 > .card { flex: 1 1 calc(50% - 6px); min-width: 0; }
  .card { padding: 14px 14px 13px; }
  .card__value { margin-top: 7px; font-size: 21px; }
  .card__label { font-size: 11px; }
  .card__hint { font-size: 11px; line-height: 1.45; }
  .account { padding: 13px; gap: 11px; }
  .account__actions { display: none; }
  /* 顶栏已经显示了页面名，正文里不重复 */
  .view:not([data-view='overview']) .head__title { display: none; }
  .view:not([data-view='overview']) .head { margin-bottom: 16px; }
  .row__actions .iconbtn { width: 36px; height: 36px; }
}

/* 表格在窄屏变卡片 */
@media (max-width: 720px) {
  .table { border: 0; background: transparent; border-radius: 0; }
  .table__head { display: none; }
  .row {
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 7px 10px;
    min-height: 0;
    padding: 13px;
    margin-bottom: 8px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--panel);
  }
  .row:hover { background: var(--panel); }
  .row > .row__main { grid-column: 1; grid-row: 1; }
  .row > .row__actions { grid-column: 2; grid-row: 1; align-self: start; }
  .row > *:not(.row__main):not(.row__actions) { grid-column: 1 / -1; }
  .cell--stack {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--ink-3);
  }
  .cell--stack::before {
    content: attr(data-label);
    flex: none;
    font-size: 11px;
    color: var(--ink-4);
  }
  .cell--stack select { height: 30px !important; }
  .toolbar { gap: 6px; }
  .search { max-width: none; }
  .head { flex-direction: column; align-items: flex-start; }
  .head__actions { width: 100%; }
  .head__actions .btn { flex: 1; }

  .modal {
    width: 100%;
    max-height: calc(100dvh - 32px);
    padding: 18px;
    border-radius: var(--r-xl);
  }
  .toast { bottom: 18px; }
}

@media (max-width: 380px) {
  .page { padding: 18px 12px 56px; }
  .head__title { font-size: 20px; }
  .ws__name { font-size: 13px; }
}

/* 减少动效 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .page { animation: none; }
}

/* 刘海屏 */
@supports (padding: max(0px)) {
  @media (max-width: 900px) {
    .side {
      padding-top: max(10px, env(safe-area-inset-top));
      padding-bottom: max(8px, env(safe-area-inset-bottom));
    }
    .page { padding-bottom: max(64px, calc(48px + env(safe-area-inset-bottom))); }
  }
}

/* =====================================================================
   概览：问候 / 统计卡 / 图表面板
   ===================================================================== */
.hello {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.hello__title {
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -.035em;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tabs--range { flex: none; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.stat {
  min-width: 0;
  padding: 15px 16px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
}
.stat__label { font-size: 11.5px; color: var(--ink-3); }
.stat__value {
  margin-top: 9px;
  font-size: 23px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stat__sub {
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--ink-4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}
.panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 16px 16px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
}
.panel__title { font-size: 13px; font-weight: 500; color: var(--ink); letter-spacing: -.005em; }
.panel__sub { margin-top: 3px; font-size: 11.5px; color: var(--ink-4); }
.panel__body {
  position: relative;
  min-width: 0;
  height: 190px;
  margin-top: 14px;
}
.panel__body--rank {
  height: auto;
  min-height: 0;
  flex: 1;
  display: flex;
  align-items: center;
  margin-top: 16px;
}
.rank { width: 100%; }

.chart { display: block; width: 100%; height: 100%; color: var(--ink-4); overflow: visible; }
.chart text { font-family: var(--font); font-size: 10px; fill: currentColor; }
.chart .grid-line { stroke: currentColor; stroke-opacity: .13; }
.chart .bar { transition: opacity .12s var(--ease-out); }
.chart .bar:hover { opacity: .8; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--ink-3);
}
.legend span { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.legend i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.legend b { font-weight: 500; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.rank { display: grid; gap: 12px; }
.rank__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; }
.rank__name {
  font-size: 12px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank__val { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.rank__bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.rank__bar i { display: block; height: 100%; border-radius: 3px; }

.chart-empty {
  display: grid;
  place-items: center;
  height: 100%;
  font-size: 12px;
  color: var(--ink-4);
}

@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .hello { margin-bottom: 16px; gap: 10px; }
  .hello__title { font-size: 22px; }
  .panels { grid-template-columns: minmax(0, 1fr); }
  .panel__body { height: 176px; }
  .stat { padding: 13px 14px 12px; }
  .stat__value { font-size: 20px; }
}

@media (max-width: 420px) {
  .tabs--range .tab { padding: 0 8px; font-size: 11.5px; }
  .hello__title { font-size: 20px; }
}



.notice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-3);
}
.notice svg { flex: none; color: var(--ink-4); }
