/* 柠汐公共留言 · 全局样式 */
:root {
  --blue: #056de8;
  --blue-dark: #0457bc;
  --bg: #f4f6f8;
  --card: #fff;
  --text: #121212;
  --text-2: #444;
  --text-3: #8590a6;
  --line: #ebedf0;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(18, 18, 18, .05);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
[hidden] { display: none !important; }

/* ---------------- 顶栏 ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  box-shadow: 0 1px 3px rgba(18, 18, 18, .08);
}

.header-inner {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
  width: 100%;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  flex-shrink: 0;
}

.logo-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #056de8, #4f9dff);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
}

.logo-text {
  font-size: 17px;
  letter-spacing: .3px;
}

.nav {
  display: flex;
  gap: 22px;
  margin-left: 6px;
}

.nav-link {
  color: var(--text-2);
  font-size: 15px;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  transition: color .15s;
}

.nav-link:hover { color: var(--blue); }

.nav-link.active {
  color: var(--blue);
  font-weight: 600;
  border-color: var(--blue);
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-area { display: flex; align-items: center; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.user-chip .user-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  font-size: 11px;
  color: var(--blue);
  background: #e8f2ff;
  border-radius: 3px;
  padding: 1px 5px;
  line-height: 1.5;
  white-space: nowrap;
}

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 8px 14px;
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
  background: #fff;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}

.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.btn-ghost { background: #fff; border-color: #d3d8e0; color: var(--text-2); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn-ghost:disabled { opacity: .5; cursor: not-allowed; }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; margin-top: 10px; }

.link-btn {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 13px;
  padding: 0;
}

.link-btn:hover { color: var(--blue); }

/* ---------------- 布局 ---------------- */
.layout {
  max-width: 1032px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 296px;
  gap: 16px;
  align-items: start;
}

.main-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.side-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 72px;
}

.card {
  background: var(--card);
  border: 1px solid #f0f1f4;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #f2f3f5;
}

.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-sub { font-size: 12px; color: var(--text-3); }

.title-dot {
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: var(--blue);
  display: inline-block;
}

/* ---------------- 每日必读 ---------------- */
.daily-card { background: linear-gradient(180deg, #f6fbff, #fff 46%); }

.daily-list {
  list-style: none;
  margin: 0;
  padding: 6px 18px 12px;
}

.daily-item + .daily-item { border-top: 1px dashed #eef0f3; }

.daily-link {
  display: flex;
  gap: 12px;
  padding: 13px 0;
}

.daily-rank {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: #eef1f5;
  color: #8b95a5;
  font-size: 13px;
  font-weight: 600;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  margin-top: 3px;
}

.rank-1 { background: #ff5a5f; color: #fff; }
.rank-2 { background: #ff8a3d; color: #fff; }
.rank-3 { background: #ffb020; color: #fff; }

.daily-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.daily-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  transition: color .15s;
}

.daily-link:hover .daily-title { color: var(--blue); }

.daily-excerpt {
  font-size: 13px;
  color: #7b8794;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--text-3);
}

/* ---------------- 帖子列表 ---------------- */
.feed-item {
  display: block;
  padding: 16px 18px;
  border-bottom: 1px solid #f2f3f5;
  transition: background .15s;
}

.feed-item:last-child { border-bottom: none; }
.feed-item:hover { background: #fafbfc; }

.feed-title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text);
}

.feed-item:hover .feed-title { color: var(--blue); }

.feed-excerpt {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.65;
  color: #5b6572;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feed-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--text-3);
}

.feed-author {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
}

.feed-end { font-size: 12px; color: #a6aebb; }

/* ---------------- 头像 ---------------- */
.avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #056de8, #54a3ff);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  user-select: none;
}

.avatar.xs { width: 20px; height: 20px; font-size: 11px; }
.avatar.sm { width: 28px; height: 28px; font-size: 13px; }
.avatar.md { width: 36px; height: 36px; font-size: 15px; }
.avatar.lg { width: 48px; height: 48px; font-size: 20px; }

/* ---------------- 右侧卡片 ---------------- */
.account-card,
.notice-card,
.about-card { padding: 16px 18px; }

.account-card h3,
.notice-card h3,
.about-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
}

.notice-card p,
.about-card p {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.7;
  color: #6b7785;
}

.notice-card p:last-child,
.about-card p:last-child { margin-bottom: 0; }

.notice-tip { color: #9aa4b2 !important; }

.account-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.account-name { font-size: 15px; font-weight: 600; }

.account-desc {
  margin: 2px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: #7b8794;
}

.account-btns .btn { margin-top: 8px; }

/* ---------------- 提示 ---------------- */
.placeholder {
  padding: 28px 18px;
  text-align: center;
  color: #9aa4b2;
  font-size: 14px;
}

.placeholder.error { color: #d64545; }

.site-footer {
  max-width: 1032px;
  margin: 0 auto;
  padding: 8px 16px 32px;
  text-align: center;
  font-size: 12px;
  color: #a6aebb;
}

/* ---------------- 弹窗 ---------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(18, 22, 30, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal {
  position: relative;
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, .2);
}

.composer-modal { max-width: 640px; }

.modal h2 { margin: 0 0 6px; font-size: 20px; }

.modal-sub {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.6;
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: #9aa4b2;
  cursor: pointer;
}

.modal-close:hover { color: #444; }

.seg {
  display: flex;
  background: #f2f4f7;
  border-radius: 6px;
  padding: 3px;
  margin-bottom: 16px;
}

.seg button {
  flex: 1;
  border: none;
  background: none;
  padding: 8px;
  border-radius: 5px;
  color: #5b6572;
  font-size: 14px;
  cursor: pointer;
  transition: .15s;
}

.seg button.active {
  background: #fff;
  color: var(--blue);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}

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

.field > span {
  display: block;
  font-size: 13px;
  color: #5b6572;
  margin-bottom: 6px;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid #d7dce3;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.6;
  color: var(--text);
  outline: none;
  resize: vertical;
  transition: border-color .15s, box-shadow .15s;
  background: #fff;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(5, 109, 232, .1);
}

.form-error {
  color: #d64545;
  font-size: 13px;
  min-height: 18px;
  margin: 0 0 10px;
}

.modal-hint {
  margin: 12px 0 0;
  text-align: center;
  font-size: 12px;
  color: #9aa4b2;
}

.composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.counter { font-size: 12px; color: #a6aebb; }

body.modal-open { overflow: hidden; }

.nx-toast {
  position: fixed;
  left: 50%;
  bottom: 48px;
  z-index: 300;
  transform: translate(-50%, 12px);
  max-width: 80vw;
  padding: 10px 18px;
  border-radius: 6px;
  background: rgba(31, 38, 48, .94);
  color: #fff;
  font-size: 14px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}

.nx-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 帖子阅读页 ---------------- */
.post-layout {
  max-width: 1128px;
  grid-template-columns: minmax(0, 1fr) 360px;
}

.article-card { padding: 0 28px 30px; }

.article-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: none;
  background: #f2f4f7;
  color: var(--text-2);
  padding: 7px 14px 7px 9px;
  border-radius: 18px;
  font-size: 13px;
  cursor: pointer;
  transition: .15s;
}

.back-btn:hover { background: #e9edf3; color: var(--blue); }

.article-tag { font-size: 12px; color: var(--text-3); }

.article-title {
  margin: 14px 0 16px;
  font-size: 26px;
  line-height: 1.42;
  font-weight: 700;
  word-break: break-word;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.article-author { font-size: 14px; font-weight: 600; }

.article-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-3);
}

.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0 14px;
  margin-bottom: 20px;
  border-bottom: 1px solid #f2f3f5;
}

.action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #e3e7ec;
  background: #fff;
  border-radius: 18px;
  padding: 6px 14px;
  color: #5b6572;
  font-size: 13px;
  cursor: pointer;
  transition: .15s;
}

.action:hover {
  color: var(--blue);
  border-color: #bcd7fb;
  background: #f5f9ff;
}

.action.active {
  color: var(--blue);
  border-color: #9cc6fa;
  background: #eaf3ff;
}

.article-content {
  font-size: 16px;
  line-height: 1.95;
  color: #1f2328;
  word-break: break-word;
}

.article-content p { margin: 0 0 16px; }
.article-content p:last-child { margin-bottom: 0; }

.article-end {
  margin-top: 34px;
  text-align: center;
  font-size: 13px;
  letter-spacing: 2px;
  color: #b6bec9;
}

.article-error {
  padding: 56px 0 40px;
  text-align: center;
}

.article-error h2 { margin: 0 0 8px; font-size: 20px; }
.article-error p { margin: 0 0 20px; color: var(--text-3); }

/* ---------------- 留言区 ---------------- */
.comments-col {
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 90px);
}

.comments-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: calc(100vh - 90px);
}

.comments-head { padding: 14px 16px; }

.comment-editor {
  padding: 12px 16px;
  border-bottom: 1px solid #f2f3f5;
}

.comment-editor textarea {
  width: 100%;
  border: 1px solid #e1e5eb;
  border-radius: 6px;
  padding: 10px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: #fafbfc;
  outline: none;
  resize: vertical;
  transition: .15s;
}

.comment-editor textarea:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(5, 109, 232, .08);
}

.comment-editor.logged-out textarea,
.comment-editor.logged-out .editor-foot { display: none; }

.editor-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}

.editor-login {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
  font-size: 13px;
  color: var(--text-3);
}

.reply-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  background: #f5f9ff;
  font-size: 12px;
  color: var(--text-3);
}

.reply-hint b { color: var(--blue); }

.comment-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 16px 16px;
}

.comment {
  padding: 12px 0;
  border-bottom: 1px solid #f5f6f8;
}

.comment:last-child { border-bottom: none; }

.comment-head { display: flex; gap: 10px; }

.comment-user { flex: 1; min-width: 0; }

.comment-user-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.comment-time { font-size: 12px; color: #a6aebb; }
.reply-to { font-size: 12px; color: var(--text-3); }

.comment-text {
  margin: 5px 0 6px;
  font-size: 14px;
  line-height: 1.7;
  color: #2b3138;
  word-break: break-word;
}

.comment-ops { display: flex; gap: 14px; }

.op-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
  color: var(--text-3);
  cursor: pointer;
}

.op-btn:hover { color: var(--blue); }
.op-btn.liked { color: var(--blue); font-weight: 600; }

.reply-list {
  margin: 6px 0 0 38px;
  padding-left: 10px;
  border-left: 2px solid #f0f2f5;
}

.is-reply { padding: 8px 0; border-bottom: none; }

/* ---------------- 管理后台 ---------------- */
.admin-wrap {
  max-width: 1128px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.gate-card {
  max-width: 520px;
  margin: 48px auto;
  padding: 44px 24px;
  text-align: center;
}

.gate-card h2 { margin: 0 0 10px; font-size: 20px; }
.gate-card p { margin: 0; color: var(--text-3); font-size: 14px; line-height: 1.8; }

.gate-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.admin-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.admin-head h1 { margin: 0; font-size: 22px; }

.admin-sub { margin: 4px 0 0; font-size: 13px; color: var(--text-3); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.stat-card {
  background: #fff;
  border: 1px solid #f0f1f4;
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
  text-align: center;
}

.stat-value { font-size: 24px; font-weight: 700; color: var(--blue); }
.stat-label { margin-top: 2px; font-size: 12px; color: var(--text-3); }

.admin-card { padding-bottom: 8px; overflow: hidden; }

.admin-tabs { margin: 14px 16px 0; }

.admin-toolbar {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid #f2f3f5;
}

.admin-toolbar input {
  flex: 1;
  min-width: 0;
  border: 1px solid #d7dce3;
  border-radius: 6px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
}

.admin-toolbar input:focus { border-color: var(--blue); }

.admin-toolbar select {
  border: 1px solid #d7dce3;
  border-radius: 6px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 14px;
  background: #fff;
  outline: none;
}

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

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th {
  padding: 10px 12px;
  border-bottom: 1px solid #eef0f3;
  background: #fafbfc;
  color: var(--text-3);
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f5f6f8;
  vertical-align: top;
}

.cell-title {
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #1f2328;
}

.cell-sub {
  max-width: 420px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: #9aa4b2;
}

.mono { font-size: 12px; color: var(--text-3); white-space: nowrap; }

.pill {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
  white-space: nowrap;
}

.pill-live { background: #e8f6ee; color: #1a9c5b; }
.pill-deleted { background: #fdeaea; color: #d64545; }

.ops { display: flex; flex-wrap: wrap; gap: 10px; }

.op-link {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  color: var(--blue);
  cursor: pointer;
}

.op-link.danger { color: #d64545; }
.op-link:hover { text-decoration: underline; }
.op-disabled { color: #c4cad3; }

.table-empty {
  padding: 32px 12px !important;
  text-align: center;
  color: #9aa4b2;
}

.table-empty.error { color: #d64545; }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 14px;
  font-size: 13px;
  color: var(--text-3);
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 960px) {
  .layout,
  .post-layout { grid-template-columns: 1fr; }

  .side-col { position: static; }

  .comments-col { position: static; max-height: none; }
  .comments-card { max-height: none; }
  .comment-list { max-height: 520px; }

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

@media (max-width: 640px) {
  .header-inner { gap: 12px; }
  .logo-text { display: none; }
  .nav { gap: 14px; margin-left: 0; }
  .nav-link { font-size: 14px; }
  .user-name { display: none; }

  .layout { padding: 10px; gap: 10px; }
  .card-head { padding: 14px; }
  .daily-list { padding: 4px 14px 10px; }
  .feed-item { padding: 14px; }
  .article-card { padding: 0 16px 24px; }
  .article-title { font-size: 22px; }
  .article-content { font-size: 15px; }
  .admin-head { flex-direction: column; align-items: flex-start; }
  .admin-toolbar { flex-wrap: wrap; }
  .admin-toolbar input { flex-basis: 100%; }
  .stat-value { font-size: 20px; }
}
