:root {
  --app-bg: #eef3fb;
  --panel-bg: #ffffff;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --line: #d8e1f0;
  --primary: #2d5ee8;
  --primary-dark: #1f47b8;
  --success-bg: #e8f7ec;
  --success-text: #23724b;
  --error-bg: #ffe9e8;
  --error-text: #b9382c;
  --shadow: 0 18px 40px rgba(47, 76, 155, 0.14);
  --dark: #23262f;
}

* {
  box-sizing: border-box;
}

body.inner-page,
body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

body.inner-page {
  background: linear-gradient(180deg, #edf3ff 0%, #f7f9fc 100%);
  color: var(--text-main);
}

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

.topbar {
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
}

.topbar-inner {
  width: min(1680px, calc(100% - 48px));
  margin: 0 auto;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.brand-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-title strong {
  font-size: 18px;
  color: var(--dark);
}

.brand-title span {
  font-size: 12px;
  color: var(--text-muted);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 32px;
  margin-left: auto;
  font-size: 15px;
}

.main-nav a {
  position: relative;
  padding: 20px 0;
  color: #4b5563;
  transition: color 0.2s;
}

.main-nav a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: transparent;
  transition: background 0.2s;
}

.main-nav a.active {
  color: var(--primary);
  font-weight: 600;
}

.main-nav a.active::after {
  background: var(--primary);
}

.main-nav a:hover {
  color: var(--primary);
}

.account-menu {
  position: relative;
  margin-left: 24px;
}

.account-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  font-size: 14px;
  color: #374151;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.account-toggle:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.08);
}

.account-toggle .arrow {
  opacity: 0.5;
  transition: transform 0.2s;
}

.account-menu:hover .account-toggle .arrow {
  transform: rotate(180deg);
}

.account-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 148px;
  padding: 6px 0;
  margin: 0;
  list-style: none;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  z-index: 30;
}

.account-dropdown li a {
  display: block;
  padding: 10px 16px;
  font-size: 14px;
  color: #374151;
}

.account-dropdown li a:hover {
  background: #f3f6ff;
  color: var(--primary);
}

.account-menu:hover .account-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.page-shell {
  width: min(1280px, calc(100% - 40px));
  margin: 28px auto 48px;
}

.panel,
.stat-card {
  background: var(--panel-bg);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 28px;
  margin-bottom: 24px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.panel-head h1,
.panel-head h2 {
  margin: 0;
  font-size: 28px;
}

.muted {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

.flash-message {
  padding: 14px 18px;
  border-radius: 16px;
  margin-bottom: 18px;
  font-size: 14px;
}

.flash-success {
  background: var(--success-bg);
  color: var(--success-text);
}

.flash-error {
  background: var(--error-bg);
  color: var(--error-text);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  padding: 24px;
}

.stat-card span {
  display: block;
  color: var(--text-muted);
  font-size: 14px;
}

.stat-card strong {
  display: block;
  margin-top: 12px;
  font-size: 30px;
  color: var(--primary-dark);
}

.stack-form,
.inline-withdraw-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stack-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stack-form span,
.field-label {
  font-size: 14px;
  color: var(--text-muted);
}

.field-label {
  display: block;
  margin-bottom: 8px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  color: var(--text-main);
  background: #fff;
}

textarea {
  resize: vertical;
}

.inline-withdraw-form {
  flex-direction: row;
  align-items: center;
}

.inline-withdraw-form input {
  max-width: 260px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
}

.button.primary {
  background: var(--primary);
  color: #fff;
}

.button.secondary {
  background: #eef3ff;
  color: var(--primary-dark);
}

.panel-actions {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 14px 12px;
  border-bottom: 1px solid #edf2fb;
  text-align: left;
  font-size: 14px;
}

.data-table th {
  color: var(--text-muted);
  font-weight: 600;
}

.users-table-wrap {
  position: relative;
  padding-bottom: 8px;
}

.users-table {
  min-width: 1500px;
}

.users-table th,
.users-table td {
  white-space: nowrap;
}

.users-table .sticky-action-col {
  position: sticky;
  right: 0;
  z-index: 2;
  min-width: 260px;
  background: #fff;
  box-shadow: -12px 0 18px rgba(15, 23, 42, 0.06);
}

.users-table th.sticky-action-col {
  z-index: 3;
}

.simple-pagination {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 20px;
}

.pagination-with-summary {
  justify-content: center;
  padding-top: 16px;
  border-top: 1px solid #edf2fb;
}

.pagination-summary {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 13px;
}

.pagination-summary span {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: #f6f8fc;
}

.pagination-summary strong {
  margin: 0 4px;
  color: var(--primary-dark);
  font-weight: 700;
}

.pagination-pages {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.page-nav {
  padding: 0 14px;
}

.pagination-jump {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--text-muted);
  font-size: 13px;
}

.pagination-jump input {
  width: 58px;
  height: 34px;
  border: 1px solid #e4e9f3;
  border-radius: 999px;
  text-align: center;
  color: var(--text-main);
}

.pagination-jump button {
  height: 34px;
  padding: 0 12px;
  border: none;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
}

.page-pill {
  min-width: 36px;
  height: 36px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eef3ff;
  color: var(--primary-dark);
  text-decoration: none;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}

.page-pill:hover {
  background: #dce6ff;
  transform: translateY(-1px);
}

.page-pill.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 18px rgba(45, 94, 232, 0.18);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
}

.status-open {
  background: #e8f7ec;
  color: #23724b;
}

.status-pending {
  background: #fff4df;
  color: #946200;
}

.status-closed {
  background: #f2f4f7;
  color: #6b7280;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.detail-grid strong {
  display: block;
  margin-bottom: 8px;
}

.help-list {
  padding-left: 18px;
  margin-top: 16px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 18px;
  text-align: center;
  color: var(--text-muted);
  grid-column: 1 / -1;
}

.inline-form {
  display: inline;
}

.login-tip {
  color: var(--text-muted);
  font-size: 13px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 24px;
  width: min(1680px, calc(100% - 40px));
  margin: 28px auto 48px;
}

.admin-sidebar {
  background: #fff;
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
  height: fit-content;
}

.admin-sidebar h2 {
  margin: 0 0 18px;
  font-size: 22px;
}

.admin-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-sidebar a {
  padding: 12px 14px;
  border-radius: 14px;
  background: #f4f7ff;
  color: var(--primary-dark);
}

.admin-sidebar a.active {
  background: var(--primary);
  color: #fff;
}

.action-column,
.reject-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.button.small {
  min-height: 36px;
  padding: 0 16px;
  font-size: 14px;
}

.hero-copy {
  margin-top: 12px;
  font-size: 18px;
  color: rgba(255, 255, 255, 0.88);
}

.is-disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 按钮扩展 */
.button.danger {
  background: #fee2e2;
  color: #b91c1c;
}
.button.danger:hover { background: #fecaca; }

.button.ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--line);
}
.button.ghost:hover { background: #f3f4f6; }

.modal-mask {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.42);
}

.modal-mask.is-open {
  display: flex;
}

.modal-card {
  width: min(520px, 100%);
  max-height: calc(100vh - 48px);
  overflow: hidden;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.18);
}

.modal-title {
  margin: 0;
  padding: 26px 28px 0;
  font-size: 22px;
  line-height: 1.25;
  color: var(--text-main);
}

.modal-subtitle {
  margin: 6px 0 0;
  padding: 0 28px;
  color: #8f9dc1;
  font-size: 14px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 28px 26px;
}

.channel-auth-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 340px;
  margin: 22px 28px 0;
  padding-right: 4px;
  overflow: auto;
}

.channel-auth-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 10px 14px;
  border: 1px solid #dfe7f5;
  border-radius: 10px;
  color: #334155;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.channel-auth-item:hover {
  border-color: #b9c8ee;
  background: #f8fbff;
  box-shadow: 0 6px 18px rgba(47, 76, 155, 0.08);
}

.channel-auth-checkbox {
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  border-radius: 4px;
}

.channel-auth-text {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  line-height: 1.3;
}

.channel-auth-text strong {
  font-size: 15px;
  font-weight: 600;
  color: #24324a;
}

.channel-auth-text em {
  font-style: normal;
  font-size: 13px;
  color: #7b8aae;
}

.channel-auth-empty {
  margin: 0;
  padding: 16px;
  border: 1px dashed #dfe7f5;
  border-radius: 10px;
  color: #8f9dc1;
  font-size: 14px;
  text-align: center;
}

/* 徽章 */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-admin  { background: #ede9fe; color: #6d28d9; }
.badge-user   { background: #e0f2fe; color: #0369a1; }
.badge-active { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-banned { background: #fee2e2; color: #b91c1c; }

/* 工具栏 + 搜索 */
.panel-toolbar {
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
}
.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.search-input {
  min-width: 180px;
  max-width: 360px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
}
.search-input:focus { border-color: var(--primary); }
.search-form select {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 14px;
  box-sizing: border-box;
}
.search-form .button {
  white-space: nowrap;
  flex-shrink: 0;
}

/* 操作列 */
.action-cell {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* 可点击的统计卡 */
a.stat-card {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s, transform 0.2s;
}
a.stat-card:hover {
  box-shadow: 0 8px 28px rgba(45,94,232,0.12);
  transform: translateY(-2px);
}

/* 页面标题 */
.page-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 20px;
}

.article-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.article-item {
  display: block;
  padding: 20px 24px;
  background: #f8fafc;
  border-radius: 16px;
  text-decoration: none;
  color: inherit;
  transition: background 0.2s;
}

.article-item:hover {
  background: #f1f5f9;
}

.article-item h3 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 600;
}

.article-item .muted {
  font-size: 13px;
}

/* 文章摘要 */
.article-excerpt {
  margin: 4px 0 10px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* 文章元信息 */
.article-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

/* 草稿徽章 */
.badge-draft { background: #fef3c7; color: #92400e; }

/* 文章详情上下篇导航 */
.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.article-nav-prev,
.article-nav-next {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 45%;
}

.article-nav-next {
  text-align: right;
  margin-left: auto;
}

.article-nav a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
}

.article-nav a:hover {
  text-decoration: underline;
}

/* 富文本内容 */
.rich-text {
  line-height: 1.8;
  font-size: 15px;
}

.rich-text p {
  margin: 0 0 16px;
}

.rich-text h2 {
  margin: 28px 0 12px;
  font-size: 20px;
}

.rich-text h3 {
  margin: 20px 0 10px;
  font-size: 17px;
}

.rich-text ul, .rich-text ol {
  margin: 0 0 16px;
  padding-left: 24px;
}

.rich-text li {
  margin-bottom: 8px;
}

.rich-text img {
  max-width: 100%;
  border-radius: 12px;
}

.rich-text a {
  color: var(--primary);
}

.rich-text blockquote {
  margin: 0 0 16px;
  padding: 12px 20px;
  border-left: 4px solid var(--primary);
  background: #f8fafc;
  border-radius: 0 12px 12px 0;
  color: var(--text-muted);
}

.rich-text code {
  padding: 2px 6px;
  background: #f1f5f9;
  border-radius: 4px;
  font-size: 13px;
}

.rich-text pre {
  padding: 16px;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 12px;
  overflow-x: auto;
  margin: 0 0 16px;
}

.rich-text pre code {
  background: none;
  padding: 0;
  color: inherit;
}

@media (max-width: 960px) {
  .topbar-inner {
    width: calc(100% - 24px);
    flex-wrap: wrap;
    padding: 12px 0;
    gap: 12px;
  }

  .main-nav {
    flex-wrap: wrap;
    gap: 16px;
    margin-left: 0;
    order: 3;
    width: 100%;
  }

  .main-nav a {
    padding: 8px 0;
  }

  .account-menu {
    margin-left: auto;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .inline-withdraw-form {
    flex-direction: column;
    align-items: stretch;
  }
}
