/* =====================================================================
   admin/css/admin.css
   fbtest.top 管理后台样式

   设计取向：克制的信息密度优先布局。数据管理后台的核心是让人快速
   定位与修改字段，因此使用中性灰阶配色 + 单一强调色，避免装饰性
   渐变干扰对数据的判读。
   ===================================================================== */

/* ---------- 设计令牌 ---------- */
:root {
  /* 强调色沿用 Facebook 蓝，与客户端视觉保持一致 */
  --accent: #1877f2;
  --accent-hover: #166fe5;
  --accent-soft: #e7f0fe;

  --success: #1a7f37;
  --success-soft: #e6f4ea;
  --warning: #9a6700;
  --warning-soft: #fff8e5;
  --danger: #cf222e;
  --danger-soft: #ffebe9;
  --info: #0969da;
  --info-soft: #ddf4ff;

  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-alt: #fbfcfd;
  --border: #d8dee4;
  --border-strong: #b8c0c8;

  --text: #1c1e21;
  --text-muted: #656d76;
  --text-subtle: #8b949e;

  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 2px rgba(27, 31, 36, 0.075);
  --shadow-md: 0 3px 8px rgba(27, 31, 36, 0.1);
  --shadow-lg: 0 12px 32px rgba(27, 31, 36, 0.16);

  --sidebar-w: 248px;
  --topbar-h: 60px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

/* 深色模式 —— 跟随系统 */
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #4493f8;
    --accent-hover: #58a6ff;
    --accent-soft: #16283e;

    --success: #3fb950;
    --success-soft: #12261e;
    --warning: #d29922;
    --warning-soft: #272115;
    --danger: #f85149;
    --danger-soft: #2d1315;
    --info: #58a6ff;
    --info-soft: #0d2d4d;

    --bg: #0d1117;
    --surface: #161b22;
    --surface-alt: #1c2128;
    --border: #30363d;
    --border-strong: #444c56;

    --text: #e6edf3;
    --text-muted: #9198a1;
    --text-subtle: #6e7681;

    --shadow-sm: 0 1px 2px rgba(1, 4, 9, 0.4);
    --shadow-md: 0 3px 8px rgba(1, 4, 9, 0.5);
    --shadow-lg: 0 12px 32px rgba(1, 4, 9, 0.7);
  }
}

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 600; }
p { margin: 0; }
code {
  font-family: var(--mono);
  font-size: 0.875em;
  padding: 0.15em 0.4em;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* 焦点可见性 —— 键盘导航必须能看清当前位置 */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* 屏幕阅读器专用 */
.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;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 12px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus { top: 12px; }

.is-hidden { display: none !important; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 50;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.sidebar__logo {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 20px;
  flex-shrink: 0;
}

.sidebar__title { display: block; font-size: 14px; }
.sidebar__domain {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--mono);
}

.sidebar__footer {
  margin-top: auto;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}
.sidebar__footer code {
  display: block;
  margin-top: 4px;
  font-size: 10.5px;
  word-break: break-all;
}

/* 导航 */
.nav { list-style: none; margin: 0; padding: 10px 0; }
.nav__group + .nav__group { margin-top: 4px; }

.nav__group-title {
  padding: 10px 18px 5px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

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

.nav__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  color: var(--text);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background 0.12s, color 0.12s;
}
.nav__link:hover { background: var(--surface-alt); }
.nav__link--active {
  background: var(--accent-soft);
  border-left-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.nav__icon {
  width: 18px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
}

.nav-scrim { display: none; }

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* 顶栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--topbar-h);
  padding: 0 20px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.topbar__toggle {
  display: none;
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 16px;
  color: var(--text);
}

.topbar__heading { font-size: 17px; margin-right: auto; }

/* 账号切换器 */
.switcher { display: flex; align-items: center; gap: 10px; }
.switcher__label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
.switcher__control {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.switcher__select {
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  max-width: 240px;
  cursor: pointer;
}
.switcher__select:focus { outline: none; }
.switcher__empty { font-size: 12px; color: var(--warning); }

/* 顶栏登录用户区 */
.topbar__account {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 12px;
  margin-left: 4px;
  border-left: 1px solid var(--border);
}
.topbar__user {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.content { padding: 20px; max-width: 1180px; width: 100%; }

/* ---------- 面板 ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  margin-bottom: 18px;
}
.panel--hero { padding: 0; overflow: hidden; }

.panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.panel__title { font-size: 16px; }
.panel__subtitle {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.panel__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.panel__empty {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}
.two-col > .panel { margin-bottom: 0; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn--ghost {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn--ghost:hover:not(:disabled) { background: var(--surface-alt); }

.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover:not(:disabled) { filter: brightness(0.92); }

.btn--danger-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--danger);
}
.btn--danger-ghost:hover:not(:disabled) {
  background: var(--danger-soft);
  border-color: var(--danger);
}

.btn--sm { padding: 5px 10px; font-size: 12px; }

/* ---------- 表格 ---------- */
.table-scroll { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-alt);
  white-space: nowrap;
}
.table tbody tr:hover { background: var(--surface-alt); }
.table__row--active { background: var(--accent-soft); }
.table__row--active:hover { background: var(--accent-soft); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

.cell-identity { display: flex; align-items: center; gap: 10px; }
.cell-actions { display: flex; gap: 6px; justify-content: flex-end; }
.cell-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ---------- 头像与徽章 ---------- */
.avatar {
  width: var(--size, 40px);
  height: var(--size, 40px);
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.avatar--placeholder {
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: calc(var(--size, 40px) * 0.4);
}

.badge {
  display: inline-block;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  vertical-align: middle;
}
.badge--neutral { background: var(--surface-alt); color: var(--text-muted); border: 1px solid var(--border); }
.badge--info { background: var(--info-soft); color: var(--info); }
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--warning { background: var(--warning-soft); color: var(--warning); }
.badge--error { background: var(--danger-soft); color: var(--danger); }

/* ---------- 表单 ---------- */
.form-grid { display: flex; flex-direction: column; gap: 18px; }

.fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0;
  background: var(--surface-alt);
}
.fieldset__legend {
  padding: 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }

.field--inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.field__label {
  display: block;
  margin-bottom: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}
.field__label--inline { margin-bottom: 0; font-weight: 500; }
.field__required { color: var(--danger); }

.field__input {
  width: 100%;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.field__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field__input--area { resize: vertical; min-height: 68px; line-height: 1.5; }
.field__input[type="color"] { height: 36px; padding: 3px; cursor: pointer; }

.field__checkbox {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.field__hint {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.45;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.form-actions {
  display: flex;
  gap: 10px;
  padding-top: 4px;
  flex-wrap: wrap;
}
.form-note {
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--text-muted);
  background: var(--info-soft);
  border-left: 3px solid var(--info);
  border-radius: var(--radius-sm);
  line-height: 1.5;
}

.upload-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -6px 0 14px;
  flex-wrap: wrap;
}
.upload-inline__status { font-size: 12px; color: var(--text-muted); }

/* ---------- 指标编辑 ---------- */
.metric-group {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}
.metric-group:last-child { margin-bottom: 0; }
.metric-group__title {
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--accent);
}

/* ---------- 标签页 ---------- */
.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab {
  padding: 9px 16px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab--active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- 统计卡片 ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.stat-card {
  padding: 14px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.stat-card--warning { border-color: var(--warning); background: var(--warning-soft); }
.stat-card__label {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.stat-card__value {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.stat-card__change { margin-top: 4px; font-size: 12px; font-weight: 600; }
.stat-card__change.is-positive { color: var(--success); }
.stat-card__change.is-neutral { color: var(--text-muted); }

/* 状态卡片 */
.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.status-card {
  padding: 14px;
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius);
  background: var(--surface-alt);
}
.status-card--success { border-left-color: var(--success); }
.status-card--warning { border-left-color: var(--warning); }
.status-card--error { border-left-color: var(--danger); }
.status-card--neutral { border-left-color: var(--border-strong); }
.status-card__label { font-size: 11.5px; color: var(--text-muted); }
.status-card__value { font-size: 16px; font-weight: 700; margin: 4px 0; }
.status-card__detail {
  font-size: 11.5px;
  color: var(--text-muted);
  word-break: break-word;
  line-height: 1.45;
}

/* 自检列表 */
.check-list { list-style: none; margin: 0; padding: 0; }
.check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.check-item:last-child { border-bottom: 0; }
.check-item__mark {
  display: grid;
  place-items: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.check-item--pass .check-item__mark { background: var(--success-soft); color: var(--success); }
.check-item--fail .check-item__mark { background: var(--danger-soft); color: var(--danger); }
.check-item__detail {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  word-break: break-word;
}

/* 操作卡片 */
.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.action-card {
  padding: 16px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.action-card h3 { font-size: 14px; }
.action-card p { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }
.action-card__warn { color: var(--danger) !important; font-weight: 600; }
.action-card__note { color: var(--success) !important; }
.action-card__hint { font-size: 11.5px !important; font-style: italic; }
.action-card .btn { margin-top: auto; align-self: flex-start; }

/* ---------- Hero ---------- */
.hero { position: relative; }
.hero__cover {
  height: 130px;
  background: linear-gradient(120deg, var(--accent), #4267b2);
  background-size: cover;
  background-position: center;
}
.hero__identity {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  padding: 0 20px 18px;
  margin-top: -34px;
}
.hero__identity .avatar {
  border: 3px solid var(--surface);
  box-shadow: var(--shadow-md);
}
.hero__name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 19px;
  flex-wrap: wrap;
}
.hero__meta { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.hero__id { margin-top: 4px; }

/* ---------- 帖子列表 ---------- */
.post-list { list-style: none; margin: 0; padding: 0; }
.post-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
  margin-bottom: 12px;
}
.post-card:last-child { margin-bottom: 0; }

.post-card__head { display: flex; align-items: flex-start; gap: 12px; }
.post-card__meta { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.post-card__meta strong { font-size: 14px; }
.post-card__time {
  flex-basis: 100%;
  font-size: 12px;
  color: var(--text-muted);
}
.post-card__body {
  margin: 12px 0;
  font-size: 13.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.post-card__media {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.post-card__media img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.post-card__video { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }

.post-card__stats {
  display: flex;
  gap: 20px;
  margin: 0;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.post-card__stats dt { font-size: 11px; color: var(--text-muted); }
.post-card__stats dd {
  margin: 1px 0 0;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.post-card__reactions { margin-top: 8px; font-size: 12px; color: var(--text-muted); }

/* ---------- 评论管理 ---------- */
.comment-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  max-height: 340px;
  overflow-y: auto;
}

/* 嵌套回复：左侧引导线表达层级，避免只靠缩进 */
.comment-list--nested {
  margin: 8px 0 0 26px;
  padding-left: 12px;
  border-left: 2px solid var(--border);
  max-height: none;
  overflow: visible;
}

.comment-item {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: 8px;
}
.comment-item:last-child { margin-bottom: 0; }
.comment-item--reply { background: var(--surface-alt); padding: 8px 10px; }

.comment-item__head {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  flex-wrap: wrap;
}

.comment-item__meta {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.comment-item__meta strong { font-size: 13px; }
.comment-item__time,
.comment-item__likes {
  font-size: 11.5px;
  color: var(--text-muted);
}

.comment-item__body {
  margin: 7px 0 0;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
/* 内联编辑态下取消 pre-wrap，交给 textarea 自身处理 */
.comment-item__body[data-editing="1"] { white-space: normal; }

.comment-item__id {
  display: inline-block;
  margin-top: 6px;
  font-size: 10px;
  color: var(--text-subtle);
}


/* ---------- 通知列表 ---------- */
.group-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.group-heading:first-of-type { margin-top: 0; }
.group-heading__count {
  padding: 1px 7px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
}

.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  background: var(--surface);
}
.notif-item--unread { background: var(--accent-soft); border-color: var(--accent); }

.notif-item__avatar { position: relative; flex-shrink: 0; }
.notif-item__badge {
  position: absolute;
  right: -2px; bottom: -2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--badge-color, var(--accent));
  border: 2px solid var(--surface);
}
.notif-item__body { flex: 1; min-width: 0; }
.notif-item__text { font-size: 13.5px; line-height: 1.5; word-break: break-word; }
.notif-item__text b { font-weight: 600; }
.notif-item__meta {
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

/* ---------- 卡片网格 ---------- */
.tile-grid {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.tile-grid--wide { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }

.tile {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-alt);
}
.tile__media {
  display: grid;
  place-items: center;
  height: 96px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative;
}
.tile__media--tall { height: 150px; }
.tile__media img { width: 100%; height: 100%; object-fit: cover; }
.tile__icon { font-size: 26px; color: #fff; opacity: 0.9; }
.tile__play {
  position: absolute;
  right: 6px; bottom: 6px;
  padding: 1px 6px;
  font-size: 11px;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 4px;
}

.tile__body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.tile__title { font-size: 13px; }
.tile__sub { font-size: 11.5px; color: var(--text-muted); }
.tile__id { font-size: 10px; align-self: flex-start; }
.tile__actions {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--border);
}
.tile__actions .btn { flex: 1; }

/* ---------- 详情列表 ---------- */
.info-list { margin: 0; display: grid; gap: 10px; }
.info-list > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.info-list > div:last-child { border-bottom: 0; padding-bottom: 0; }
.info-list dt { font-size: 12.5px; color: var(--text-muted); }
.info-list dd {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  text-align: right;
  word-break: break-word;
}

.latest-post { display: flex; gap: 14px; align-items: flex-start; }
.latest-post__thumb {
  width: 96px; height: 96px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.latest-post__thumb--empty { background: var(--surface-alt); }
.latest-post__stats { margin: 0; display: grid; gap: 7px; flex: 1; }
.latest-post__stats > div { display: flex; justify-content: space-between; gap: 10px; }
.latest-post__stats dt { font-size: 12px; color: var(--text-muted); }
.latest-post__stats dd { margin: 0; font-size: 13px; font-weight: 600; }

.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 状态视图 ---------- */
.state-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 44px 20px;
  text-align: center;
  color: var(--text-muted);
}
.state-view h3 { font-size: 15px; color: var(--text); }
.state-view p { font-size: 13px; max-width: 460px; line-height: 1.6; }
.state-view--error h3 { color: var(--danger); }

.spinner {
  width: 26px; height: 26px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Toast ---------- */
.toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(400px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.18s ease-out;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: none; }
}
.toast--leaving { opacity: 0; transform: translateX(16px); transition: all 0.2s; }

.toast--success { border-left-color: var(--success); }
.toast--error { border-left-color: var(--danger); }
.toast--warning { border-left-color: var(--warning); }
.toast--info { border-left-color: var(--info); }

.toast__icon {
  display: grid;
  place-items: center;
  width: 19px; height: 19px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.toast--success .toast__icon { background: var(--success-soft); color: var(--success); }
.toast--error .toast__icon { background: var(--danger-soft); color: var(--danger); }
.toast--warning .toast__icon { background: var(--warning-soft); color: var(--warning); }
.toast--info .toast__icon { background: var(--info-soft); color: var(--info); }

.toast__body {
  flex: 1;
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.toast__close {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
}
.toast__close:hover { color: var(--text); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(27, 31, 36, 0.55);
  backdrop-filter: blur(2px);
  animation: fade-in 0.14s;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%;
  max-width: 620px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.18s ease-out;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(-10px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.modal__title { font-size: 15.5px; }
.modal__close {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.modal__close:hover { color: var(--text); }

.modal__body { padding: 18px; overflow-y: auto; flex: 1; }
.modal__message { font-size: 13.5px; line-height: 1.65; white-space: pre-wrap; }

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease-out;
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: none; }

  .nav-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(27, 31, 36, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
  }
  body.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }

  .main { margin-left: 0; }
  .topbar__toggle { display: grid; place-items: center; }
  .topbar { padding: 0 14px; gap: 10px; }
  .topbar__heading { font-size: 15px; }
  .switcher__label { display: none; }
  /* 窄屏隐藏用户名文本，仅保留退出按钮 */
  .topbar__user { display: none; }
  .topbar__account { padding-left: 8px; }
  .switcher__select { max-width: 150px; font-size: 12px; }
  .content { padding: 14px; }
  .panel { padding: 14px; border-radius: var(--radius); }
  .table-scroll { margin: 0 -14px; padding: 0 14px; }
}

@media (max-width: 560px) {
  .field-row { grid-template-columns: 1fr; }
  .cell-actions { flex-direction: column; }
  .post-card__stats { gap: 14px; }
  .modal { max-width: 100%; }
  .modal__footer { flex-direction: column-reverse; }
  .modal__footer .btn { width: 100%; }
  .toast-stack { left: 12px; right: 12px; max-width: none; }
  .hero__identity { flex-direction: column; align-items: flex-start; }
}

/* 打印时隐藏交互元素 */
@media print {
  .sidebar, .topbar, .nav-scrim, .toast-stack, .btn, .cell-actions { display: none !important; }
  .main { margin-left: 0; }
  .panel { break-inside: avoid; box-shadow: none; }
}
