/* ==========================================================================
   后台样式（登录页 + 项目管理）
   ========================================================================== */

:root {
  --paper: #f4f2ee;
  --card: #ffffff;
  --ink: #17181b;
  --ink-soft: #494a4d;
  --muted: #7d7b74;
  --line: rgba(23, 24, 27, 0.12);
  --line-strong: rgba(23, 24, 27, 0.2);
  --accent: #b8451f;
  --accent-soft: #f6e8e0;
  --danger: #b3261e;
  --ok: #1f7a54;
  --dark: #16171a;
  --radius: 14px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun",
    Georgia, serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, Menlo, monospace;
  --shadow: 0 24px 48px -32px rgba(23, 24, 27, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.25;
}

p {
  margin: 0;
}

button,
input,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

.mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--ink);
  position: relative;
  flex: 0 0 auto;
}

.mark::after {
  content: "";
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid #f7f5f0;
}

.kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ---------------- 登录页 ---------------- */

.login-body {
  min-height: 100vh;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
  min-height: 100vh;
}

.login-aside {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 44px 52px;
  background: var(--dark);
  color: rgba(255, 255, 255, 0.72);
  overflow: hidden;
}

.login-aside::before {
  content: "";
  position: absolute;
  width: 520px;
  height: 520px;
  right: -180px;
  top: -160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(184, 69, 31, 0.5), transparent 62%);
  pointer-events: none;
}

.login-aside::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 56px 56px;
  pointer-events: none;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 85%);
}

.login-brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.85);
}

.login-brand .mark {
  background: rgba(255, 255, 255, 0.12);
}

.login-quote {
  position: relative;
  margin: auto 0;
  padding: 40px 0;
}

.login-quote h1 {
  font-size: clamp(34px, 4vw, 52px);
  color: #fff;
  letter-spacing: -0.02em;
}

.login-quote h1 span {
  color: var(--accent);
}

.login-quote p {
  margin-top: 18px;
  max-width: 26em;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
}

.login-points {
  position: relative;
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
}

.login-points li {
  padding-left: 18px;
  position: relative;
}

.login-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.login-main {
  display: grid;
  place-items: center;
  padding: 40px 24px;
}

.login-card {
  width: 100%;
  max-width: 372px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-card h2 {
  font-size: 28px;
}

.login-hint {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: -6px;
}

.login-hint code {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(23, 24, 27, 0.06);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > span,
.field-label {
  font-size: 12.5px;
  color: var(--ink-soft);
  font-weight: 500;
}

.field-label em {
  color: var(--accent);
  font-style: normal;
}

.field input,
.field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--card);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(23, 24, 27, 0.07);
}

.field input::placeholder,
.field textarea::placeholder {
  color: #a8a6a0;
}

.form-error {
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(179, 38, 30, 0.08);
  color: var(--danger);
  font-size: 12.5px;
}

/* 密码框：右侧「显示 / 隐藏」 */

.pass-wrap {
  position: relative;
}

.pass-wrap input {
  padding-right: 62px;
}

.pass-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.pass-toggle:hover {
  background: rgba(23, 24, 27, 0.06);
  color: var(--ink);
}

.submit-btn {
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.submit-btn:hover {
  opacity: 0.9;
}

.submit-btn:active {
  transform: translateY(1px);
}

.submit-btn:disabled {
  opacity: 0.55;
  cursor: progress;
}

.back-link {
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  padding-top: 4px;
}

.back-link:hover {
  color: var(--ink);
}

@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}

.login-card.shake {
  animation: shake 0.45s ease both;
}

/* ---------------- 后台框架 ---------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(244, 242, 238, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.topbar-title {
  font-weight: 600;
  font-size: 14px;
}

.topbar-tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.ghost-link:hover {
  color: var(--accent);
}

.whoami {
  padding-left: 16px;
  border-left: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.ghost-btn:hover {
  background: #fff;
  border-color: var(--ink);
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 9px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.primary-btn:hover {
  opacity: 0.92;
}

.primary-btn:active {
  transform: translateY(1px);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.primary-btn .plus {
  font-size: 16px;
  line-height: 1;
}

.admin-main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.admin-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.admin-head h1 {
  margin-top: 8px;
  font-size: 32px;
}

.sub {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 34px 0 12px;
  font-size: 12px;
  color: var(--muted);
}

.list-count {
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

/* ---------------- 项目行 ---------------- */

.project-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.row {
  display: grid;
  grid-template-columns: 22px 88px minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.row:hover {
  border-color: var(--line-strong);
  box-shadow: 0 14px 30px -26px rgba(23, 24, 27, 0.6);
}

.row.dragging {
  opacity: 0.45;
  border-style: dashed;
}

.row.just-moved {
  animation: rowFlash 0.6s ease;
}

@keyframes rowFlash {
  0% { background: var(--accent-soft); }
  100% { background: var(--card); }
}

.row-handle {
  display: grid;
  place-items: center;
  width: 22px;
  height: 30px;
  color: #b9b7b0;
  cursor: grab;
  touch-action: none;
}

.row-handle:active {
  cursor: grabbing;
}

.row-handle svg {
  width: 12px;
  height: 18px;
}

.row-cover {
  width: 88px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(135deg, #efe7dc, #e3d7c9);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.row-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.row-cover span {
  font-family: var(--font-serif);
  font-size: 20px;
  color: rgba(23, 24, 27, 0.35);
}

.row-main {
  min-width: 0;
}

.row-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 600;
}

.row-title .title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-hidden {
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(23, 24, 27, 0.07);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 400;
  white-space: nowrap;
}

.row-desc {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.row-tags span {
  padding: 1px 7px;
  border-radius: 4px;
  background: rgba(23, 24, 27, 0.055);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-soft);
}

.row-order {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.order-btn {
  width: 26px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}

.order-btn:hover:not(:disabled) {
  border-color: var(--ink);
  color: var(--ink);
}

.order-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.row-actions {
  display: flex;
  gap: 6px;
}

.text-btn {
  height: 30px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.text-btn:hover {
  background: rgba(23, 24, 27, 0.06);
  color: var(--ink);
}

.text-btn.danger:hover {
  background: rgba(179, 38, 30, 0.08);
  color: var(--danger);
}

/* 开关 */

.switch-wrap {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  margin: 0;
  position: relative;
}

.switch-wrap input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: #d6d4cd;
  transition: background 0.2s ease;
  flex: 0 0 auto;
  cursor: pointer;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}

input:checked + .switch {
  background: var(--ok);
}

input:checked + .switch::after {
  transform: translateX(16px);
}

.switch-field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  cursor: pointer;
  user-select: none;
}

.switch-field input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-text {
  font-size: 13px;
}

/* 空状态 */

.list-empty {
  padding: 64px 24px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.55);
}

.empty-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
}

.empty-sub {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------------- 弹窗 ---------------- */

.dialog {
  width: min(620px, calc(100% - 32px));
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 40px 80px -40px rgba(23, 24, 27, 0.55);
}

.dialog::backdrop {
  background: rgba(23, 24, 27, 0.42);
  backdrop-filter: blur(3px);
}

.dialog-form {
  display: flex;
  flex-direction: column;
  max-height: min(88vh, 760px);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  font-size: 20px;
}

.icon-btn {
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.icon-btn:hover {
  background: rgba(23, 24, 27, 0.06);
  color: var(--ink);
}

.dialog-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 24px;
  overflow-y: auto;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.cover-field {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfaf7;
}

.cover-preview {
  width: 132px;
  height: 84px;
  border-radius: 8px;
  overflow: hidden;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #efe7dc, #e3d7c9);
  font-size: 11px;
  color: rgba(23, 24, 27, 0.4);
}

.cover-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.cover-controls input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  outline: none;
}

.cover-controls input:focus {
  border-color: var(--ink);
}

.cover-buttons {
  display: flex;
  gap: 6px;
}

.dialog-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: #fbfaf7;
  border-radius: 0 0 16px 16px;
}

.dialog-hint {
  font-size: 12px;
  color: var(--muted);
  min-height: 16px;
}

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

/* 轻提示 */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 16px);
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--dark);
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 60;
  max-width: calc(100% - 40px);
}

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

.toast.error {
  background: var(--danger);
}

/* ---------------- 响应式 ---------------- */

@media (max-width: 860px) {
  .row {
    grid-template-columns: 20px 72px minmax(0, 1fr) auto;
    gap: 12px;
    padding: 12px 14px;
  }

  .row-order {
    display: none;
  }

  .row-cover {
    width: 72px;
    height: 46px;
  }

  .row-actions {
    grid-column: 3 / -1;
    justify-content: flex-end;
  }
}

@media (max-width: 720px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-aside {
    display: none;
  }

  .login-main {
    min-height: 100vh;
    background: var(--paper);
  }

  .topbar-inner {
    height: 58px;
    padding: 0 16px;
  }

  .topbar-title,
  .whoami {
    display: none;
  }

  .admin-main {
    padding: 28px 16px 64px;
  }

  .admin-head h1 {
    font-size: 26px;
  }

  .admin-head .primary-btn {
    width: 100%;
    justify-content: center;
  }

  .list-toolbar {
    margin-top: 26px;
  }

  .list-tip {
    display: none;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .dialog-body {
    padding: 16px;
  }

  .dialog-head,
  .dialog-foot {
    padding: 14px 16px;
  }

  .cover-field {
    flex-direction: column;
  }

  .cover-preview {
    width: 100%;
    height: 120px;
  }

  .row {
    grid-template-columns: 18px 64px minmax(0, 1fr);
    gap: 10px;
  }

  .row-cover {
    width: 64px;
    height: 42px;
  }

  .row > .switch-wrap {
    grid-column: 2 / -1;
    justify-self: end;
    margin-bottom: 4px;
  }

  .row-actions {
    grid-column: 1 / -1;
  }
}

/* ---------------- 后台 Tab ---------------- */

.admin-tabs {
  display: flex;
  gap: 4px;
  width: fit-content;
  margin-bottom: 22px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}

.admin-tab {
  height: 34px;
  padding: 0 18px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.admin-tab:hover {
  background: rgba(23, 24, 27, 0.05);
  color: var(--ink);
}

.admin-tab.is-active {
  background: var(--ink);
  color: #fff;
}

/* ---------------- 个人信息 ---------------- */

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 860px;
  padding: 22px 24px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

.profile-form .field input,
.profile-form .field textarea {
  background: #fff;
}

.profile-form textarea {
  min-height: 96px;
}

.fact-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 10px;
}

.fact-row input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  outline: none;
}

.fact-row input:focus {
  border-color: var(--ink);
}

.avatar-preview {
  width: 84px;
  height: 84px;
  border-radius: 50%;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}

.group-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.form-hint {
  min-height: 18px;
  margin: 0;
  font-size: 12.5px;
  color: var(--danger);
}

/* 个人信息表单底部：提示在左，保存按钮在右，和卡片同宽 */
.profile-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 4px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.profile-foot .form-hint {
  flex: 1;
}

@media (max-width: 640px) {
  .fact-row {
    grid-template-columns: 1fr;
  }

  .admin-tabs {
    width: 100%;
  }

  .admin-tab {
    flex: 1;
  }
}

/* ---------------- Markdown 正文输入 ---------------- */

.field-tip {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.65;
  color: var(--muted);
}

.md-input {
  min-height: 320px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.7;
}

/* ---------------- 笔记编辑页 ---------------- */

.editor-main {
  max-width: 900px;
  padding-top: 44px;
  padding-bottom: 100px;
}

.editor-head {
  margin-bottom: 24px;
}

.editor-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.editor-form .md-input {
  min-height: 420px;
}

.editor-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 4px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

/* 取消是链接，需要和「保存」等高，文字才真正居中 */
.editor-foot .ghost-btn {
  height: 40px;
}

.editor-foot .dialog-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

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

@media (max-width: 640px) {
  .editor-main {
    padding-top: 28px;
  }
  .editor-form {
    padding: 18px;
  }
  .editor-form .md-input {
    min-height: 300px;
  }
}

/* ---------------- 后台笔记搜索 ---------------- */

.admin-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 240px;
  max-width: 340px;
}

.admin-search input {
  width: 100%;
  padding: 9px 14px 9px 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.admin-search input:focus {
  outline: none;
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(23, 24, 27, 0.04);
}

.admin-search input::placeholder {
  color: var(--muted);
}

.admin-search .search-icon {
  position: absolute;
  left: 12px;
  font-size: 14px;
  color: var(--muted);
  pointer-events: none;
}

.project-list.is-filtered .row-handle {
  opacity: 0.25;
  cursor: default;
}

@media (max-width: 640px) {
  .admin-search {
    max-width: none;
  }
}

/* 后台搜索图标尺寸（覆盖字符图标的旧规则） */

.admin-search .search-icon {
  width: 15px;
  height: 15px;
  left: 13px;
  font-size: 0;
  line-height: 0;
}

.admin-search .search-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.admin-search:focus-within .search-icon {
  color: var(--ink);
}

.admin-search input {
  padding-left: 36px;
}

/* ---------------- Markdown 工具栏 / 本页预览 / 语法手册 ---------------- */

.md-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.md-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.md-actions .text-btn {
  height: 28px;
  padding: 0 9px;
  font-size: 12px;
  color: var(--muted);
}

.md-actions .text-btn:hover {
  color: var(--ink);
}

.md-actions .text-btn[aria-pressed="true"] {
  background: rgba(23, 24, 27, 0.07);
  color: var(--ink);
}

/* 本页预览：和输入框同宽的内容区 */
.md-preview {
  min-height: 320px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfaf7;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.85;
  overflow-wrap: break-word;
}

.editor-form .md-preview {
  min-height: 420px;
}

.md-preview > :first-child {
  margin-top: 0;
}

.md-preview h1,
.md-preview h2,
.md-preview h3 {
  margin: 1.5em 0 0.55em;
  line-height: 1.35;
  color: var(--ink);
}

.md-preview h1 { font-size: 24px; }
.md-preview h2 { font-size: 20px; }
.md-preview h3 { font-size: 17px; }

.md-preview p {
  margin: 0 0 1.05em;
}

.md-preview ul,
.md-preview ol {
  margin: 0 0 1.1em;
  padding-left: 1.4em;
}

.md-preview li {
  margin-bottom: 0.4em;
}

.md-preview blockquote {
  margin: 0 0 1.15em;
  padding: 2px 0 2px 15px;
  border-left: 3px solid var(--line-strong);
  color: var(--muted);
}

.md-preview blockquote p {
  margin: 0;
}

.md-preview code {
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(23, 24, 27, 0.07);
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.md-preview pre {
  margin: 0 0 1.15em;
  padding: 14px 16px;
  overflow-x: auto;
  border-radius: 10px;
  background: var(--dark);
  color: #f4f3ef;
}

.md-preview pre code {
  padding: 0;
  background: none;
  color: inherit;
  font-size: 13px;
}

.md-preview a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.md-preview img {
  max-width: 100%;
  margin: 6px 0 1.15em;
  border-radius: 8px;
}

.md-preview hr {
  margin: 1.7em 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.md-preview-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* 语法手册 */
.md-help {
  margin-top: 2px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfaf7;
}

.md-help summary {
  padding: 10px 14px;
  font-size: 12.5px;
  color: var(--ink-soft);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.md-help summary::-webkit-details-marker {
  display: none;
}

.md-help summary::before {
  content: "▸";
  margin-right: 7px;
  color: var(--muted);
}

.md-help[open] summary::before {
  content: "▾";
}

.md-help summary:hover {
  color: var(--ink);
}

.md-help-body {
  padding: 0 14px 14px;
}

/* 语法手册：左边是真实渲染效果，右边是对应写法 */
.md-help-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.md-help-list > li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) auto;
  gap: 12px;
  align-items: center;
  padding: 9px 2px;
  border-bottom: 1px solid var(--line);
}

/* 每行的「复制」按钮：贴右边缘，各行垂直对齐 */
.md-copy {
  align-self: center;
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.md-copy:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.md-copy.is-copied {
  color: var(--accent);
  border-color: var(--accent);
}

.md-help-demo {
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
}

.md-help-demo .demo-h1 {
  margin-right: 8px;
  font-size: 17px;
  font-weight: 600;
}

.md-help-demo .demo-h2 {
  margin-right: 8px;
  font-size: 15px;
  font-weight: 600;
}

.md-help-demo .demo-h3 {
  font-size: 13.5px;
  font-weight: 600;
}

.md-help-demo .demo-list {
  margin: 0;
  padding-left: 17px;
  list-style: disc;
  font-size: 13px;
}

.md-help-demo ol.demo-list {
  list-style: decimal;
}

.md-help-demo .demo-list li {
  margin: 0;
}

.md-help-demo .demo-quote {
  margin: 0;
  padding-left: 10px;
  border-left: 3px solid var(--line-strong);
  color: var(--muted);
  font-size: 12.5px;
}

.md-help-demo > code {
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(23, 24, 27, 0.07);
  font-family: var(--font-mono);
  font-size: 12px;
}

.md-help-demo .demo-pre {
  margin: 0;
  padding: 6px 9px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--dark);
  color: #f4f3ef;
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
}

.md-help-demo .demo-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.md-help-demo .demo-img {
  display: block;
  width: 52px;
  height: 30px;
  border-radius: 5px;
  object-fit: cover;
}

.md-help-demo .demo-hr {
  margin: 5px 0;
  border: 0;
  border-top: 1px solid var(--line-strong);
}

.md-help-demo .demo-paras p {
  margin: 0 0 4px;
  font-size: 13px;
}

.md-help-demo .demo-paras p:last-child {
  margin-bottom: 0;
}

.md-help-code {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.md-help-code code {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(23, 24, 27, 0.07);
  font-family: var(--font-mono);
  font-size: 11.5px;
  overflow-wrap: anywhere;
}

.md-help-code span {
  font-size: 11.5px;
  color: var(--muted);
}

.md-help-tip {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 640px) {
  .profile-foot {
    flex-direction: column;
    align-items: stretch;
  }

  .profile-foot .primary-btn {
    width: 100%;
    justify-content: center;
  }

  .md-preview {
    padding: 16px;
  }

  /* 窄屏：效果独占一行，写法 + 复制按钮在下一行 */
  .md-help-list > li {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 10px;
    align-items: start;
  }

  .md-help-demo {
    grid-column: 1 / -1;
  }
}
