/* ==========================================================================
   粒粒满 · 公众号爆文系统  |  style.css
   设计系统：令牌 → 基础 → 组件 → 视图 → 响应式 → 无障碍
   默认浅色（长表格阅读优先），右上角可切深色
   ========================================================================== */

/* ============================ 1. 设计令牌 ============================ */
:root {
  /* 品牌色 */
  --brand: #4C5BF0;
  --brand-h: #3B49DF;
  --brand-s: #EEF0FE;      /* 品牌浅底 */
  --brand-b: #D9DEFF;      /* 品牌浅边 */
  --grad: linear-gradient(135deg, #6B5BFF 0%, #3D7BF7 100%);

  /* 功能色 */
  --hot: #E23B3B;          /* 热度值 / 涨 */
  --hot-s: #FDECEC;
  --ok: #12A150;
  --ok-s: #E9F7EF;
  --warn: #E08A00;
  --warn-s: #FDF4E3;

  /* 中性色 */
  --bg: #F4F5F9;
  --surface: #FFFFFF;
  --surface-2: #FAFBFD;
  --surface-3: #F4F6FA;
  --line: #E6E9F0;
  --line-2: #EFF1F6;
  --text: #12141C;
  --text-2: #5A6273;
  --text-3: #98A0B0;

  /* 阴影 */
  --sh-1: 0 1px 2px rgba(16, 20, 40, .05);
  --sh-2: 0 4px 14px -4px rgba(16, 20, 40, .10), 0 1px 3px rgba(16, 20, 40, .05);
  --sh-3: 0 18px 44px -14px rgba(16, 20, 40, .22), 0 4px 10px rgba(16, 20, 40, .06);
  --sh-brand: 0 8px 22px -8px rgba(76, 91, 240, .55);

  /* 圆角 */
  --r-1: 6px;
  --r-2: 10px;
  --r-3: 14px;
  --r-4: 20px;
  --r-pill: 999px;

  /* 间距（4 的倍数） */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px;
  --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px;

  /* 字号 */
  --f-xs: 12px; --f-sm: 13px; --f-base: 14px; --f-md: 15px;
  --f-lg: 17px; --f-xl: 20px; --f-2xl: 24px; --f-3xl: 30px;

  /* 动效 */
  --e-1: 140ms cubic-bezier(.4, 0, .2, 1);
  --e-2: 260ms cubic-bezier(.4, 0, .2, 1);

  --sidebar-w: 248px;
  --z-sticky: 30;
  --z-modal: 90;
  --z-toast: 120;
}

[data-theme="dark"] {
  --brand: #7C87FF;
  --brand-h: #9099FF;
  --brand-s: #1B2043;
  --brand-b: #2E3568;
  --grad: linear-gradient(135deg, #6B5BFF 0%, #3D7BF7 100%);

  --hot: #FF6E6E;
  --hot-s: #35191C;
  --ok: #3DD68C;
  --ok-s: #11291E;
  --warn: #F0B44A;
  --warn-s: #2E2413;

  --bg: #0A0B12;
  --surface: #141722;
  --surface-2: #181C29;
  --surface-3: #1D2130;
  --line: #272C3B;
  --line-2: #202533;
  --text: #E9ECF5;
  --text-2: #A0A8BB;
  --text-3: #6E7689;

  --sh-1: 0 1px 2px rgba(0, 0, 0, .4);
  --sh-2: 0 4px 14px -4px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .3);
  --sh-3: 0 20px 48px -16px rgba(0, 0, 0, .7), 0 4px 12px rgba(0, 0, 0, .4);
  --sh-brand: 0 8px 22px -8px rgba(124, 135, 255, .5);
}

/* ============================ 2. 基础 ============================ */
* { box-sizing: border-box; }

html, body { height: 100%; }

/* hidden 属性的兜底。.btn / .tab-soon / .qr-lock 这些自带 display，
   优先级高于浏览器默认的 [hidden] { display: none }，会把 hidden 顶掉 —— 必须用 !important 压回来 */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: var(--f-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(720px 320px at 12% -6%, rgba(108, 91, 255, .10), transparent 70%),
    radial-gradient(680px 300px at 92% 0%, rgba(61, 123, 247, .08), transparent 72%);
}
[data-theme="dark"] body::before {
  background:
    radial-gradient(720px 320px at 12% -6%, rgba(108, 91, 255, .20), transparent 70%),
    radial-gradient(680px 300px at 92% 0%, rgba(61, 123, 247, .14), transparent 72%);
}

h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-1);
}
::selection { background: var(--brand); color: #fff; }

/* 滚动条 */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--line);
  border: 3px solid transparent;
  border-radius: 99px;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

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

/* ============================ 3. 壳层 ============================ */
.app {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
}

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex: none;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: var(--s5);
  padding: var(--s5) var(--s4) var(--s4);
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s1); }
.brand-mark {
  width: 40px; height: 40px; flex: none;
  border-radius: 12px;
  background: var(--grad);
  color: #fff;
  display: grid; place-items: center;
  font-size: var(--f-lg); font-weight: 700;
  box-shadow: var(--sh-brand);
  letter-spacing: .5px;
}
.brand-txt { min-width: 0; }
.brand-txt h1 {
  font-size: var(--f-md); font-weight: 700;
  letter-spacing: -.2px; white-space: nowrap;
}
.brand-txt span {
  display: block;
  font-size: 11px; color: var(--text-3);
  letter-spacing: .6px; text-transform: uppercase;
}

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-label {
  font-size: 11px; font-weight: 600; letter-spacing: .8px;
  color: var(--text-3); padding: 0 var(--s3) var(--s2);
  text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: var(--s3);
  width: 100%;
  padding: 10px var(--s3);
  border: 0; background: transparent;
  border-radius: var(--r-2);
  color: var(--text-2);
  font-size: var(--f-base); font-weight: 500;
  cursor: pointer; text-align: left;
  transition: background var(--e-1), color var(--e-1);
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item .ico { width: 18px; height: 18px; flex: none; }
.nav-item .txt { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item .badge {
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
  padding: 1px 7px; border-radius: var(--r-pill);
  background: var(--surface-3); color: var(--text-3);
  border: 1px solid var(--line);
}
.nav-item.on {
  background: var(--brand-s);
  color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand-b);
}
.nav-item.on .ico { color: var(--brand); }
.nav-item.on .badge { background: var(--brand); color: #fff; border-color: transparent; }
.nav-item.soon { cursor: default; opacity: .62; }
.nav-item.soon:hover { background: transparent; color: var(--text-2); }

.side-foot {
  margin-top: auto;
  display: flex; flex-direction: column; gap: var(--s2);
  padding-top: var(--s4);
  border-top: 1px solid var(--line-2);
}
.side-note {
  font-size: var(--f-xs); line-height: 1.6;
  color: var(--text-3);
  padding: 0 var(--s1) var(--s1);
}
.side-note b { color: var(--text-2); }

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

.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky);
  display: flex; align-items: center; gap: var(--s4);
  padding: 14px var(--s6);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.page-head { flex: 1; min-width: 0; }
.page-head h2 {
  font-size: var(--f-xl); font-weight: 700;
  letter-spacing: -.3px; line-height: 1.3;
}
.page-head p {
  font-size: var(--f-sm); color: var(--text-3);
  margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.top-actions { display: flex; align-items: center; gap: var(--s2); flex: none; }

.view { padding: var(--s5) var(--s6) 56px; max-width: 1560px; width: 100%; }

.hamburger { display: none; }

/* ---------- 用户 ---------- */
.user { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: var(--s2);
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: box-shadow var(--e-1), border-color var(--e-1);
}
.user-btn:hover { box-shadow: var(--sh-2); border-color: var(--brand-b); }
.user-av {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--grad); color: #fff;
  display: grid; place-items: center;
  font-size: var(--f-xs); font-weight: 600;
}
.user-name { font-size: var(--f-sm); font-weight: 500; max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  box-shadow: var(--sh-3);
  padding: var(--s2);
  display: none;
}
.user-menu.on { display: block; }
.um-head { padding: var(--s2) var(--s3) var(--s3); border-bottom: 1px solid var(--line-2); margin-bottom: var(--s2); }
.um-head strong { display: block; font-size: var(--f-base); }
.um-head span { font-size: var(--f-xs); color: var(--text-3); }
.um-item {
  display: flex; align-items: center; gap: var(--s2);
  width: 100%; padding: 9px var(--s3);
  border: 0; background: transparent; border-radius: var(--r-2);
  color: var(--text-2); font-size: var(--f-base);
  cursor: pointer; text-align: left;
}
.um-item:hover { background: var(--surface-3); color: var(--text); }
.um-item.danger:hover { background: var(--hot-s); color: var(--hot); }
.um-item svg { width: 16px; height: 16px; }
.um-sep { height: 1px; background: var(--line-2); margin: var(--s2) 0; }

/* ============================ 4. 组件 ============================ */

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  height: 38px; padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--r-2);
  background: var(--surface-3);
  color: var(--text);
  font-size: var(--f-base); font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: background var(--e-1), border-color var(--e-1), transform var(--e-1), box-shadow var(--e-1), color var(--e-1);
  user-select: none;
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:hover { background: var(--line); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--brand); color: #fff;
  box-shadow: var(--sh-brand);
}
.btn-primary:hover { background: var(--brand-h); }
.btn-primary:active { box-shadow: none; }

.btn-outline {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text-2);
}
.btn-outline:hover { border-color: var(--brand-b); color: var(--brand); background: var(--surface); }

.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }

.btn-danger { background: var(--hot); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--hot) 86%, #000); }

.btn-sm { height: 32px; padding: 0 12px; font-size: var(--f-sm); border-radius: var(--r-1); }
.btn-sm svg { width: 14px; height: 14px; }
.btn-block { width: 100%; }

.btn-icon {
  width: 38px; height: 38px; padding: 0; flex: none;
  background: var(--surface);
  border-color: var(--line);
  color: var(--text-2);
}
.btn-icon:hover { color: var(--brand); border-color: var(--brand-b); background: var(--surface); }
.btn-icon.btn-sm { width: 32px; height: 32px; }

/* ---------- 表单 ---------- */
.input, .select, .textarea {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  color: var(--text);
  font-size: var(--f-base);
  transition: border-color var(--e-1), box-shadow var(--e-1);
}
.textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent);
}
.input.err { border-color: var(--hot); }
.input.err:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--hot) 16%, transparent); }
.select {
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398A0B0' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 15px;
  cursor: pointer;
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label {
  font-size: var(--f-sm); font-weight: 500; color: var(--text-2);
  display: flex; align-items: center; gap: 3px;
}
.label .req { color: var(--hot); }
.hint { font-size: var(--f-xs); color: var(--text-3); }

.search {
  position: relative; display: flex; align-items: center;
}
.search > svg {
  position: absolute; left: 11px;
  width: 15px; height: 15px; color: var(--text-3); pointer-events: none;
}
.search .input { padding-left: 33px; }
.search .input[type="search"]::-webkit-search-cancel-button { display: none; }

.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: var(--f-sm); color: var(--text-2); }
.check input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }

/* ---------- 领域 tab ---------- */
.tabs {
  display: flex; align-items: center; gap: var(--s2);
  overflow-x: auto; padding-bottom: 2px;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 14px; flex: none;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-pill);
  color: var(--text-2);
  font-size: var(--f-base); font-weight: 500;
  cursor: pointer;
  transition: all var(--e-1);
}
.tab:hover { border-color: var(--brand-b); color: var(--brand); }
.tab .n { font-size: var(--f-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.tab.on {
  background: var(--text); color: var(--bg);
  border-color: transparent;
  font-weight: 600;
}
.tab.on .n { color: color-mix(in srgb, var(--bg) 70%, transparent); }

/* ---------- 工具条 ---------- */
.toolbar {
  position: sticky; top: 77px; z-index: 20;
  display: flex; flex-direction: column; gap: var(--s3);
  padding: var(--s3) 0 var(--s4);
  background: linear-gradient(var(--bg) 72%, transparent);
  backdrop-filter: blur(6px);
}
.toolbar-row { display: flex; align-items: flex-end; gap: var(--s3); flex-wrap: wrap; }
.toolbar-row .field { flex: 1 1 220px; }
.toolbar-row .sb-actions { display: flex; gap: var(--s2); flex: none; }

/* ---------- 面板 / 卡片 ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  box-shadow: var(--sh-1);
  overflow: hidden;
}

/* ---------- 数据表 ---------- */
.meta-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s3); flex-wrap: wrap;
  padding: var(--s1) 2px var(--s3);
  font-size: var(--f-sm); color: var(--text-3);
}
.meta-row b { color: var(--text); font-variant-numeric: tabular-nums; }
.meta-right { display: flex; align-items: center; gap: var(--s3); }
.meta-right .select { width: auto; height: 32px; font-size: var(--f-sm); }

.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--f-base); }
.tbl thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: var(--f-sm); font-weight: 600;
  text-align: left; white-space: nowrap;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}
.tbl thead th:first-child { border-top-left-radius: var(--r-3); }
.tbl thead th:last-child { border-top-right-radius: var(--r-3); }
.tbl th.num, .tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--brand); }
.tbl th .arrow { opacity: 0; margin-left: 3px; font-size: 10px; }
.tbl th.sortable:hover .arrow { opacity: .35; }
.tbl th.on { color: var(--brand); }
.tbl th.on .arrow { opacity: 1; }

.tbl tbody tr { transition: background var(--e-1); }
.tbl tbody tr:nth-child(even) { background: var(--surface-2); }
.tbl tbody tr:hover { background: var(--brand-s); }
.tbl tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-2);
  color: var(--text-2);
  vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: 0; }

.cell-date { white-space: nowrap; color: var(--text-3); font-variant-numeric: tabular-nums; }
.cell-acct { white-space: nowrap; }
.cell-acct .acct-in {
  display: inline-flex; align-items: center; gap: 7px;
  font-weight: 500; color: var(--text);
}
.mini-av {
  width: 22px; height: 22px; flex: none;
  border-radius: 7px;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600; color: #fff;
  background: var(--grad);
}
.cell-title { min-width: 260px; color: var(--text); }
.cell-title .t {
  display: block;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 46ch;
  cursor: pointer;
}
.cell-title .t:hover { color: var(--brand); text-decoration: underline; }
.cell-title .cat {
  display: inline-block; margin-top: 3px;
  font-size: 11px; color: var(--text-3);
  padding: 0 6px; border-radius: var(--r-1);
  background: var(--surface-3);
  border: 1px solid var(--line-2);
}
.hot { color: var(--hot); font-weight: 700; font-variant-numeric: tabular-nums; }
.num-plain { font-variant-numeric: tabular-nums; }
.anomaly-up { color: var(--hot); font-weight: 600; }

.rowacts { display: flex; gap: 4px; justify-content: flex-end; }
.icon-btn {
  width: 28px; height: 28px; flex: none;
  display: grid; place-items: center;
  border: 0; background: transparent; border-radius: var(--r-1);
  color: var(--text-3); cursor: pointer;
  transition: all var(--e-1);
}
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.star.on { color: #F5A623; }
.icon-btn.del:hover { background: var(--hot-s); color: var(--hot); }

/* ---------- 移动端卡片列表 ---------- */
.cards { display: none; flex-direction: column; gap: var(--s3); }
.mcard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  padding: var(--s4);
  box-shadow: var(--sh-1);
}
.mcard-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.mcard-acct { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: var(--f-base); }
.mcard-date { font-size: var(--f-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.mcard-title { margin: 8px 0 10px; font-size: var(--f-md); color: var(--text); line-height: 1.5; }
.mcard-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: var(--s2);
  padding-top: 10px; border-top: 1px dashed var(--line);
}
.mstat { text-align: center; }
.mstat span { display: block; font-size: 11px; color: var(--text-3); margin-bottom: 1px; }
.mstat b { font-size: var(--f-base); font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
.mcard-foot { display: flex; gap: var(--s2); margin-top: var(--s3); }
.mcard-foot .btn { flex: 1; }

/* ---------- 分页 ---------- */
.pager {
  display: flex; align-items: center; justify-content: center;
  gap: var(--s2); flex-wrap: wrap;
  padding: var(--s5) 0 var(--s2);
}
.pg {
  min-width: 34px; height: 34px; padding: 0 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-1);
  color: var(--text-2); font-size: var(--f-sm); font-weight: 500;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: all var(--e-1);
}
.pg:hover:not(:disabled) { border-color: var(--brand-b); color: var(--brand); }
.pg.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pg:disabled { opacity: .4; cursor: not-allowed; }
.pg-dots { color: var(--text-3); padding: 0 2px; }

/* ---------- 对标账号库 ---------- */
.acct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: var(--s4); }
.acct-group {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  box-shadow: var(--sh-1);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.ag-head {
  display: flex; align-items: center; gap: var(--s2);
  padding: 13px var(--s4);
  border-bottom: 1px solid var(--line-2);
  background: var(--surface-2);
}
.ag-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex: none; }
.ag-name { font-size: var(--f-md); font-weight: 600; }
.ag-n {
  font-size: var(--f-xs); color: var(--text-3);
  background: var(--surface-3); border: 1px solid var(--line);
  padding: 0 7px; border-radius: var(--r-pill);
  font-variant-numeric: tabular-nums;
}
.ag-add {
  margin-left: auto;
  border: 0; background: transparent;
  color: var(--text-3); font-size: var(--f-sm);
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 7px; border-radius: var(--r-1);
  cursor: pointer;
}
.ag-add:hover { background: var(--brand-s); color: var(--brand); }
.ag-add svg { width: 13px; height: 13px; }
.ag-body { padding: var(--s3); display: flex; flex-direction: column; gap: 2px; }

.acct {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-2);
  cursor: pointer;
  transition: background var(--e-1);
  position: relative;
}
.acct:hover { background: var(--surface-3); }
.acct-av {
  width: 30px; height: 30px; flex: none;
  border-radius: 9px;
  display: grid; place-items: center;
  font-size: var(--f-xs); font-weight: 600; color: #fff;
}
.acct-main { flex: 1; min-width: 0; }
.acct-name { font-size: var(--f-base); font-weight: 500; color: var(--text); line-height: 1.45; }
.acct-note { font-size: var(--f-xs); color: var(--text-3); line-height: 1.5; margin-top: 1px; }
.acct-act { display: flex; gap: 2px; opacity: 0; transition: opacity var(--e-1); }
.acct:hover .acct-act, .acct:focus-within .acct-act { opacity: 1; }
.ag-empty { padding: var(--s5) var(--s4); text-align: center; font-size: var(--f-sm); color: var(--text-3); }

/* ---------- 空态 / 占位 ---------- */
.empty {
  padding: 64px 24px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: var(--s2);
}
.empty-ico {
  width: 56px; height: 56px; border-radius: 18px;
  display: grid; place-items: center;
  background: var(--brand-s); color: var(--brand);
  margin-bottom: var(--s2);
}
.empty-ico svg { width: 26px; height: 26px; }
.empty h3 { font-size: var(--f-lg); font-weight: 600; }
.empty p { font-size: var(--f-base); color: var(--text-3); max-width: 46ch; line-height: 1.7; }
.empty .btn { margin-top: var(--s3); }

.soon-wrap {
  display: grid; place-items: center;
  padding: 48px 24px 72px;
}
.soon {
  max-width: 620px; width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-4);
  box-shadow: var(--sh-2);
  padding: var(--s10) var(--s8);
  text-align: center;
}
.soon-badge svg { width: 15px; height: 15px; flex: none; }
.soon-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--f-xs); font-weight: 600;
  color: var(--warn);
  background: var(--warn-s);
  padding: 4px 12px; border-radius: var(--r-pill);
  margin-bottom: var(--s5);
}
.soon-ico {
  width: 76px; height: 76px; margin: 0 auto var(--s5);
  border-radius: 24px;
  background: var(--grad);
  display: grid; place-items: center;
  color: #fff;
  box-shadow: var(--sh-brand);
}
.soon-ico svg { width: 34px; height: 34px; }
.soon h3 { font-size: var(--f-2xl); font-weight: 700; letter-spacing: -.4px; }
.soon > p { color: var(--text-3); margin-top: var(--s2); line-height: 1.75; }
.soon-list {
  list-style: none; padding: 0; margin: var(--s6) 0 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--s3); text-align: left;
}
.soon-list li {
  display: flex; gap: 9px;
  padding: 12px 14px;
  background: var(--surface-3);
  border-radius: var(--r-2);
  font-size: var(--f-sm); color: var(--text-2);
  line-height: 1.6;
}
.soon-list li svg { width: 16px; height: 16px; color: var(--brand); flex: none; margin-top: 2px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: var(--z-modal);
  background: color-mix(in srgb, #06070C 62%, transparent);
  backdrop-filter: blur(3px);
  display: none;
  padding: var(--s6);
  overflow-y: auto;
}
.modal-mask.on { display: flex; align-items: flex-start; justify-content: center; }
.modal {
  width: 100%; max-width: 620px;
  margin: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-4);
  box-shadow: var(--sh-3);
  animation: pop var(--e-2) both;
}
.modal.wide { max-width: 780px; }
@keyframes pop {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.m-head {
  display: flex; align-items: flex-start; gap: var(--s3);
  padding: var(--s5) var(--s6) var(--s4);
  border-bottom: 1px solid var(--line-2);
}
.m-head h3 { font-size: var(--f-lg); font-weight: 600; flex: 1; }
.m-head p { font-size: var(--f-sm); color: var(--text-3); margin-top: 2px; }
.m-body { padding: var(--s5) var(--s6); }
.m-foot {
  display: flex; align-items: center; justify-content: flex-end;
  gap: var(--s2);
  padding: var(--s4) var(--s6) var(--s5);
  border-top: 1px solid var(--line-2);
  background: var(--surface-2);
}
.m-foot .left { margin-right: auto; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s4); }
.form-grid .col-2 { grid-column: 1 / -1; }

/* 详情 */
.detail-title { font-size: var(--f-xl); font-weight: 700; line-height: 1.4; }
.detail-tags { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s3); }
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--f-xs); font-weight: 500;
  padding: 3px 10px; border-radius: var(--r-pill);
  background: var(--surface-3); color: var(--text-2);
  border: 1px solid var(--line);
}
.tag.brand { background: var(--brand-s); color: var(--brand); border-color: var(--brand-b); }
.tag.hot { background: var(--hot-s); color: var(--hot); border-color: transparent; }
.detail-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: var(--s3); margin: var(--s5) 0;
}
.dstat {
  background: var(--surface-3);
  border-radius: var(--r-2);
  padding: var(--s3);
  text-align: center;
}
.dstat span { display: block; font-size: var(--f-xs); color: var(--text-3); }
.dstat b { font-size: var(--f-lg); font-variant-numeric: tabular-nums; }
.dl { display: grid; grid-template-columns: 88px 1fr; gap: 10px var(--s4); font-size: var(--f-base); }
.dl dt { color: var(--text-3); font-size: var(--f-sm); padding-top: 1px; }
.dl dd { margin: 0; color: var(--text-2); }

/* ---------- 提示条 ---------- */
.toast-wrap {
  position: fixed; z-index: var(--z-toast);
  left: 50%; bottom: 28px; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: var(--s2);
  align-items: center; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  background: var(--text); color: var(--bg);
  border-radius: var(--r-pill);
  font-size: var(--f-base); font-weight: 500;
  box-shadow: var(--sh-3);
  animation: rise var(--e-2) both;
}
.toast svg { width: 16px; height: 16px; }
.toast.ok svg { color: #6EE7A8; }
.toast.err svg { color: #FF9B9B; }
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 遮罩（移动端侧栏） ---------- */
.scrim {
  display: none;
  position: fixed; inset: 0; z-index: 40;
  background: color-mix(in srgb, #06070C 55%, transparent);
}
.scrim.on { display: block; }

/* ============================ 5. 响应式 ============================ */
@media (max-width: 1180px) {
  .acct-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}

@media (max-width: 1024px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 50;
    transform: translateX(-100%);
    transition: transform var(--e-2);
    box-shadow: var(--sh-3);
  }
  .app.nav-open .sidebar { transform: none; }
  .hamburger { display: inline-flex; }
  .view { padding: var(--s4) var(--s4) 48px; }
  .topbar { padding: 12px var(--s4); }
  .toolbar { top: 73px; }
}

@media (max-width: 860px) {
  .table-wrap { display: none; }
  .cards { display: flex; }
  .form-grid { grid-template-columns: 1fr; }
  .detail-stats { grid-template-columns: repeat(2, 1fr); }
  .page-head p { display: none; }
  .toolbar { position: static; backdrop-filter: none; background: none; }
  .meta-right .select { height: 30px; }
}

@media (max-width: 680px) {
  .topbar { flex-wrap: wrap; row-gap: 10px; padding: 12px var(--s4); }
  .hamburger { order: 0; }
  .page-head { order: 1; }
  .page-head h2 { font-size: var(--f-lg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #btnTheme { order: 2; }
  .user { order: 3; }
  .top-actions { order: 4; flex: 1 0 100%; }
  .top-actions .btn { flex: 1; }
}

@media (max-width: 560px) {
  .topbar { gap: var(--s2); }
  .page-head h2 { font-size: var(--f-lg); }
  .view { padding: var(--s3) var(--s3) 40px; }
  .user-name { display: none; }
  .user-btn { padding: 4px; }
  .toolbar-row .field { flex: 1 1 100%; }
  .toolbar-row .sb-actions { width: 100%; }
  .toolbar-row .sb-actions .btn { flex: 1; }
  .modal-mask { padding: 0; }
  .modal {
    max-width: none; min-height: 100%;
    border-radius: 0; border: 0;
  }
  .m-body { padding: var(--s4); }
  .m-head { padding: var(--s4); }
  .m-foot { padding: var(--s4); }
  .soon { padding: var(--s6) var(--s4); }
  .acct-grid { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dt { margin-top: 8px; }
}

/* ============================ 6. 无障碍 ============================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
@media print {
  .sidebar, .topbar, .toolbar, .rowacts, .pager { display: none !important; }
  body::before { display: none; }
  .panel { box-shadow: none; }
}
