:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --card-soft: #fbfcff;
  --line: #e4ebf3;
  --line-dark: #d3deea;
  --text: #25364a;
  --muted: #75879b;
  --blue: #527fb8;
  --blue-dark: #315f97;
  --pink: #e86697;
  --pink-soft: #fff0f6;
  --gold: #d99031;
  --green: #3f9f78;
  --red: #cf4d5a;
  --shadow: 0 8px 22px rgba(58, 83, 112, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #f9fbfe 0, var(--bg) 260px);
  color: var(--text);
  font-family:
    "PingFang SC", "Microsoft YaHei", Inter, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.wrap {
  width: min(1160px, calc(100% - 28px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(211, 222, 234, 0.92);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  min-height: 58px;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 142px;
  font-weight: 800;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, #e86697, #527fb8);
  color: #fff;
  box-shadow: 0 8px 16px rgba(82, 127, 184, 0.2);
}

.brand-text {
  font-size: 17px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #5d7084;
  flex: 1;
}

.nav-links a {
  border-radius: 8px;
  padding: 8px 10px;
}

.nav-links a.active,
.nav-links a:hover {
  background: #eef5fd;
  color: var(--blue-dark);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-actions input,
.admin-toolbar input,
.inline-form input,
.inline-form select,
.node-form input,
.settings-grid input,
.settings-grid select,
.settings-grid textarea,
td input,
td select {
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.top-actions input {
  width: 190px;
  background: #f8fbff;
  padding: 8px 10px;
}

.top-actions button,
.profile-actions button,
.submit-btn,
.admin-card-head button,
.admin-toolbar button,
.inline-form button,
.node-form button {
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  padding: 8px 14px;
}

.ghost-action {
  background: #eef5fd !important;
  color: var(--blue-dark) !important;
}

.page {
  padding: 18px 0 48px;
}

.system-banner {
  margin-bottom: 12px;
  border: 1px solid #f1d39b;
  border-radius: 8px;
  background: #fff7e9;
  color: #91611e;
  padding: 10px 12px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  gap: 16px;
  align-items: start;
}

.left-col,
.right-col {
  display: grid;
  gap: 12px;
}

.card,
.admin-card,
.table-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.node-card,
.profile-card,
.side-card,
.footer-card {
  padding: 14px;
}

.section-title,
.side-head,
.admin-card-head,
.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.section-title h3,
.node-card h3,
.side-card h3,
.profile-card h3,
.admin-card h2,
.admin-toolbar h2 {
  margin: 0;
  font-size: 15px;
}

.section-title span,
.side-head a {
  color: var(--muted);
  font-size: 12px;
}

.node-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-top: 12px;
}

.node-cloud button {
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #617286;
  padding: 6px 8px;
}

.node-cloud button:hover,
.node-cloud button.active {
  background: var(--pink-soft);
  color: var(--pink);
}

.topic-card {
  overflow: hidden;
}

.topic-tabs {
  display: flex;
  gap: 4px;
  min-height: 46px;
  align-items: center;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
}

.topic-tabs button {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  padding: 8px 10px;
}

.topic-tabs button.active {
  background: #eef5fd;
  color: var(--blue-dark);
}

.topic-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 46px;
  gap: 10px;
  align-items: center;
  min-height: 68px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 180px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.topic-row:last-of-type {
  border-bottom: 0;
}

.topic-row:hover,
.topic-row.selected {
  background: #fbfdff;
}

.avatar,
.mini-avatar {
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eef4fb;
  color: var(--blue-dark);
  font-weight: 800;
}

.avatar {
  width: 38px;
  height: 38px;
}

.avatar.image {
  background: linear-gradient(135deg, #ffd9e7, #dcecff);
  color: #ca4f83;
}

.topic-main h2 {
  display: block;
  margin: 0 0 6px;
  overflow: hidden;
  color: #203047;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topic-main p {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.topic-main i {
  color: #c2cfdd;
  font-style: normal;
}

.label {
  display: inline-block;
  margin-right: 5px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1;
  padding: 4px 6px;
  vertical-align: 1px;
}

.label.hot {
  background: #fff3df;
  color: #a35f13;
}

.label.muted {
  background: #eef1f6;
  color: #6d7d91;
}

.label.pin {
  background: #ecf8f2;
  color: #328565;
}

.reply-count {
  justify-self: end;
  min-width: 34px;
  border-radius: 999px;
  background: #f3f7fc;
  color: #55728f;
  font-weight: 800;
  text-align: center;
  padding: 7px 9px;
}

.profile-card p,
.side-card p {
  margin: 9px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.intro-box {
  display: grid;
  gap: 5px;
  margin: 12px 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #fff3f8, #f3f8ff);
  color: #596a7d;
  padding: 12px;
}

.intro-box strong {
  color: var(--pink);
}

.profile-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.profile-actions .outline {
  border: 1px solid var(--line-dark);
  background: #fff;
  color: var(--blue-dark);
}

.hot-stack {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.side-empty {
  margin-top: 10px;
  border-radius: 8px;
  background: #f7faff;
  color: var(--muted);
  padding: 12px;
  text-align: center;
}

.hot-stack button {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  column-gap: 8px;
  row-gap: 2px;
  align-items: center;
  border: 0;
  background: transparent;
  color: #34465c;
  padding: 0;
  text-align: left;
}

.hot-stack span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hot-stack small {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
}

.mini-avatar {
  width: 24px;
  height: 24px;
  font-size: 12px;
}

.detail-card strong {
  display: block;
  margin-top: 10px;
  line-height: 1.5;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.stats div {
  border-radius: 8px;
  background: #f7faff;
  padding: 10px 8px;
  text-align: center;
}

.stats strong {
  display: block;
  margin-bottom: 4px;
  color: #203047;
}

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

.admin-page {
  padding: 20px 0 52px;
}

.admin-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 18px;
}

.admin-hero h1 {
  margin: 4px 0 6px;
  font-size: 24px;
  line-height: 1.25;
}

.admin-hero p {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  color: var(--pink);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-api {
  display: grid;
  gap: 4px;
  min-width: 260px;
  border-radius: 8px;
  background: #f7faff;
  padding: 12px;
}

.admin-api span {
  color: var(--muted);
  font-size: 12px;
}

.admin-api strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.toast {
  margin-bottom: 12px;
  border: 1px solid #b8decf;
  border-radius: 8px;
  background: #effaf5;
  color: #247352;
  padding: 10px 12px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.admin-tabs {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 8px;
}

.admin-tabs button {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #53667b;
  font-weight: 700;
  padding: 10px 12px;
  text-align: left;
}

.admin-tabs button.active,
.admin-tabs button:hover {
  background: #eef5fd;
  color: var(--blue-dark);
}

.admin-panel {
  min-width: 0;
}

.admin-section {
  display: grid;
  gap: 12px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 14px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  color: #203047;
  font-size: 24px;
}

.admin-card {
  padding: 14px;
}

.compact-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.compact-list div,
.empty-line {
  border-radius: 8px;
  background: #f7faff;
  padding: 10px 12px;
}

.compact-list span {
  display: block;
  font-weight: 700;
}

.compact-list small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.admin-toolbar input {
  width: min(320px, 100%);
  padding: 9px 10px;
}

.inline-form,
.node-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-form input,
.inline-form select,
.node-form input {
  min-width: 150px;
  padding: 9px 10px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: #5e7186;
  font-size: 12px;
  font-weight: 800;
}

td strong {
  display: block;
  color: #22334a;
}

td small {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  color: var(--muted);
}

td input,
td select {
  width: 100%;
  max-width: 140px;
  padding: 7px 8px;
}

.action-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.action-cell button,
.node-admin-item button,
.text-danger {
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  background: #fff;
  color: #54687d;
  padding: 7px 9px;
}

.text-danger {
  color: var(--red);
}

.empty-table {
  color: var(--muted);
  text-align: center;
}

.node-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.node-admin-item {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 12px;
}

.node-admin-item span {
  color: var(--muted);
  font-size: 12px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 14px;
}

.settings-grid label {
  display: grid;
  gap: 7px;
  color: #405269;
  font-weight: 700;
}

.settings-grid input,
.settings-grid select,
.settings-grid textarea {
  width: 100%;
  padding: 10px 12px;
  resize: vertical;
}

.settings-grid .wide {
  grid-column: 1 / -1;
}

.switch-line {
  display: flex !important;
  flex-direction: row;
  align-items: center;
}

.switch-line input {
  width: auto;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(32, 48, 71, 0.42);
}

.composer {
  width: min(540px, 100%);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(35, 55, 82, 0.28);
  padding: 18px;
}

.composer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.composer h2 {
  margin: 0;
  font-size: 18px;
}

.composer-head button {
  border: 0;
  background: transparent;
  color: var(--muted);
}

.composer label {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  color: #405269;
  font-weight: 700;
}

.composer input,
.composer select,
.composer textarea {
  width: 100%;
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
  resize: vertical;
}

.auth-shell {
  display: grid;
  min-height: calc(100vh - 58px);
  place-items: start center;
  padding: 46px 14px;
}

.auth-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 18px;
}

.auth-brand {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-bottom: 16px;
  text-align: center;
}

.auth-back {
  justify-self: start;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
}

.auth-logo {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #e86697, #527fb8);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
}

.auth-brand h1 {
  margin: 0;
  font-size: 24px;
}

.auth-brand p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 14px;
  border-radius: 8px;
  background: #f3f7fc;
  padding: 5px;
}

.auth-tabs button {
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #617286;
  font-weight: 800;
  padding: 9px 10px;
}

.auth-tabs button.active {
  background: #fff;
  color: var(--blue-dark);
  box-shadow: 0 4px 14px rgba(58, 83, 112, 0.08);
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label {
  display: grid;
  gap: 7px;
  color: #405269;
  font-weight: 700;
}

.auth-form input {
  width: 100%;
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
  padding: 10px 12px;
}

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.auth-check {
  display: flex !important;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 7px !important;
  font-weight: 400 !important;
}

.auth-check input {
  width: auto;
}

.auth-row a {
  color: var(--blue-dark);
}

.auth-message {
  margin: 0;
  border-radius: 8px;
  background: #f7faff;
  color: var(--blue-dark);
  padding: 10px 12px;
  line-height: 1.5;
}

.auth-submit {
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  padding: 11px 14px;
}

.auth-submit:disabled {
  cursor: default;
  opacity: 0.65;
}

.auth-foot {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
  color: var(--muted);
}

.auth-foot button {
  border: 0;
  background: transparent;
  color: var(--pink);
  font-weight: 800;
  padding: 0;
}

@media (max-width: 900px) {
  .content-grid,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-tabs {
    grid-template-columns: repeat(5, 1fr);
  }

  .admin-tabs button {
    text-align: center;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .topbar-inner {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 0;
  }

  .brand,
  .nav-links,
  .top-actions {
    width: 100%;
  }

  .top-actions input {
    flex: 1;
    width: auto;
  }

  .node-cloud {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .node-cloud button {
    flex: 0 0 auto;
  }

  .topic-row {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .reply-count {
    grid-column: 2;
    justify-self: start;
    padding: 4px 9px;
  }

  .topic-main h2 {
    white-space: normal;
  }

  .admin-hero {
    display: grid;
  }

  .admin-api {
    min-width: 0;
  }

  .admin-tabs {
    grid-template-columns: repeat(2, 1fr);
  }

  .metric-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }
}
