/* =========================================================
   粉笺 · 笔记 —— 女生专用 · 二次元粉嫩风
   配色：樱粉 / 奶白 / 淡紫 / 薄荷，糖果渐变 + 樱花飘落
   ========================================================= */
:root {
  --sakura-50:  #fff8fc;
  --sakura-100: #ffeaf5;
  --sakura-200: #ffd2e9;
  --sakura-300: #ffb5dc;
  --sakura-400: #ff93c9;
  --sakura-500: #ff6fb4;
  --sakura-600: #f754a3;
  --sakura-700: #e23a8b;
  --lilac:      #d9a7f5;   /* 淡紫点缀 */
  --mint:       #a8efdc;   /* 薄荷点缀 */
  --cream:      #fff9fb;
  --ink:        #59404f;
  --ink-soft:   #b58a9e;
  --white:      #ffffff;
  --danger:     #ff6b81;
  --radius:     22px;
  --shadow:     0 8px 26px rgba(255, 111, 180, .12);
  --shadow-hover: 0 16px 38px rgba(255, 111, 180, .20);
  --grad:       linear-gradient(135deg, #ff9ccb 0%, #ff6fb4 55%, #f754a3 100%);
  --grad-lilac: linear-gradient(135deg, #ffb8de 0%, #e4a9f7 100%);
  --font: "PingFang SC","Microsoft YaHei","Hiragino Sans","Helvetica Neue",Arial,sans-serif;
}

* { box-sizing: border-box; }
/* 保证 hidden 属性始终生效，避免被 display:flex 等样式覆盖导致弹窗常显 */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1200px 640px at 85% -12%, var(--sakura-200) 0%, transparent 55%),
    radial-gradient(900px 520px at -12% 108%, var(--sakura-100) 0%, transparent 50%),
    radial-gradient(700px 480px at 50% 120%, #fff0fa 0%, transparent 60%),
    linear-gradient(180deg, var(--sakura-50) 0%, #fff6fc 40%, var(--sakura-50) 100%);
  overflow-x: hidden;
}

/* 背景漂浮小装饰：星星 / 爱心 / 蝴蝶结 */
.bg-deco { position: fixed; pointer-events: none; z-index: 0; font-size: 22px; opacity: .5; user-select: none; }
.bg-deco .spark { position: absolute; animation: floaty 7s ease-in-out infinite; }
.bg-deco .heart  { animation-duration: 8s; animation-delay: -2s; }
.bg-deco .bow    { animation-duration: 9s; animation-delay: -4s; }
@keyframes floaty {
  0%,100% { transform: translateY(0) rotate(0deg); opacity:.4; }
  50%     { transform: translateY(-22px) rotate(12deg); opacity:.75; }
}

a { color: var(--sakura-600); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
.muted { color: var(--ink-soft); }

/* 自定义滚动条（可爱圆润） */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--sakura-200); border-radius: 20px; }
::-webkit-scrollbar-thumb:hover { background: var(--sakura-300); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 通用按钮（糖果 Q 弹） ---------- */
.btn {
  border: none; border-radius: 15px;
  padding: 10px 20px; font-size: 14px; font-weight: 700; letter-spacing: .3px;
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), box-shadow .18s ease, filter .18s ease;
  display: inline-flex; align-items: center; gap: 7px;
}
.btn:hover { transform: translateY(-2px) scale(1.02); filter: brightness(1.04); }
.btn:active { transform: translateY(0) scale(.96); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary {
  color: #fff; background: var(--grad);
  box-shadow: 0 8px 18px rgba(255,111,180,.34), inset 0 1px 0 rgba(255,255,255,.45);
}
.btn-primary:hover { box-shadow: 0 12px 24px rgba(255,111,180,.42); }
.btn-ghost { color: var(--sakura-700); background: var(--sakura-100); }
.btn-ghost:hover { background: var(--sakura-200); }
.btn-danger { color: #fff; background: linear-gradient(135deg,#ff8fa3,#ff6b81); }
.btn-block { width: 100%; justify-content: center; }

/* ---------- 登录页 ---------- */
.login-body { display: flex; align-items: center; justify-content: center; padding: 26px; min-height: 100vh; position: relative; z-index: 1; }
/* 前台访问密码：半透明模糊背景（备用独立登录页） */
body.mosaic-bg { background-color: #ffe0ef; }
body.mosaic-bg::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(160deg, rgba(255,143,192,.35), rgba(207,155,255,.30), rgba(255,184,222,.35));
  opacity: .5;
}
body.mosaic-bg .login-card { position: relative; z-index: 1; }
.login-card {
  width: 392px; max-width: 100%;
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,250,252,.96));
  border-radius: 26px; padding: 38px 34px 30px;
  box-shadow: 0 24px 60px rgba(255,111,180,.22), inset 0 0 0 1px rgba(255,178,218,.6);
  position: relative;
  animation: card-in .5s cubic-bezier(.34,1.56,.64,1);
}
@keyframes card-in { from { transform: translateY(24px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
/* 卡片顶部蝴蝶结小徽章 */
.login-card::before {
  content: "🎀"; position: absolute; top: -20px; right: 26px;
  font-size: 34px; filter: drop-shadow(0 4px 8px rgba(255,111,180,.3));
  animation: wiggle 3.4s ease-in-out infinite;
}
@keyframes wiggle { 0%,100% { transform: rotate(-8deg);} 50% { transform: rotate(10deg);} }

.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand .brand-icon {
  width: 66px; height: 66px; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; color: #fff; border-radius: 20px;
  background: var(--grad); box-shadow: 0 12px 24px rgba(255,111,180,.38), inset 0 2px 0 rgba(255,255,255,.5);
  position: relative;
}
.login-brand .brand-icon::after { /* 腮红 */
  content: ""; position: absolute; width: 12px; height: 7px; border-radius: 50%;
  background: rgba(255,255,255,.55); left: 10px; top: 14px;
}
.login-brand h1 {
  margin: 0 0 6px; font-size: 23px; font-weight: 800; color: var(--sakura-600);
  letter-spacing: 1px;
}
.login-brand p { margin: 0; font-size: 13px; color: var(--ink-soft); letter-spacing: .5px; }
.login-card .field { margin-bottom: 16px; }
.login-card .field label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; font-weight: 700; letter-spacing: .5px; }
.login-card .field input {
  width: 100%; padding: 12px 16px; font-size: 14px;
  border: 2px solid var(--sakura-200); border-radius: 15px; outline: none;
  background: var(--cream); color: var(--ink);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.login-card .field input:focus { border-color: var(--sakura-400); background: #fff; box-shadow: 0 0 0 4px rgba(255,111,180,.14); }
.login-msg { min-height: 20px; margin: 12px 0 0; font-size: 13px; text-align: center; color: var(--danger); }
.login-foot { margin: 18px 0 0; font-size: 12px; color: var(--ink-soft); text-align: center; }
.login-foot code { background: var(--sakura-100); padding: 2px 7px; border-radius: 8px; color: var(--sakura-700); font-weight: 600; }

/* ---------- 前台顶栏（毛玻璃 + 波浪底） ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: saturate(180%) blur(12px);
  background: rgba(255,255,255,.72);
  border-bottom: 1px solid var(--sakura-100);
  box-shadow: 0 4px 20px rgba(255,111,180,.06);
}
.topbar-inner {
  max-width: 1100px; margin: 0 auto; padding: 13px 20px;
  display: flex; align-items: center; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon {
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  font-size: 19px; color: #fff; border-radius: 12px;
  background: var(--grad); box-shadow: 0 6px 14px rgba(255,111,180,.35);
  position: relative;
}
.brand-icon::after { content:""; position:absolute; width:7px;height:4px;border-radius:50%;background:rgba(255,255,255,.55);left:7px;top:9px; }
.brand-text { font-size: 18px; font-weight: 800; color: var(--sakura-600); cursor: pointer; letter-spacing: 1px; }

.search-wrap { position: relative; flex: 1; max-width: 420px; }
.search-wrap input {
  width: 100%; padding: 11px 42px 11px 40px; font-size: 14px;
  border: 2px solid var(--sakura-200); border-radius: 30px; outline: none;
  background: #fff; color: var(--ink); transition: all .18s ease;
  box-shadow: inset 0 2px 6px rgba(255,111,180,.06);
}
.search-wrap input:focus { border-color: var(--sakura-400); box-shadow: 0 0 0 4px rgba(255,111,180,.13); }
.search-wrap input::placeholder { color: var(--sakura-300); }
.search-ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; stroke: var(--sakura-400); fill: none; stroke-width: 2.4; stroke-linecap: round; }
.search-clear {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 25px; height: 25px; border: none; border-radius: 50%;
  background: var(--sakura-100); color: var(--sakura-600); font-size: 15px; line-height: 1;
  display: none; align-items: center; justify-content: center;
}
.top-actions { display: flex; align-items: center; gap: 9px; margin-left: auto; }

/* ---------- 筛选区 ---------- */
.filters {
  max-width: 1100px; margin: 20px auto 8px; padding: 0 20px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.chips { display: flex; gap: 9px; flex-wrap: wrap; }
.chip {
  border: 1.5px solid var(--sakura-200); background: #fff; color: var(--sakura-600);
  padding: 7px 15px; border-radius: 22px; font-size: 13px; font-weight: 700;
  transition: all .18s ease; box-shadow: 0 3px 8px rgba(255,111,180,.08);
}
.chip:hover { background: var(--sakura-100); transform: translateY(-1px); }
.chip.active {
  background: var(--grad); color: #fff; border-color: transparent;
  box-shadow: 0 6px 14px rgba(255,111,180,.32);
}
.count-badge { margin-left: auto; font-size: 13px; color: var(--ink-soft); background: var(--sakura-100); padding: 5px 13px; border-radius: 18px; font-weight: 600; }
.lock-hint { margin: 8px 2px 0; padding: 9px 12px; font-size: 13px; color: #b45309; background: #fff3d6; border: 1px solid #f5d78e; border-radius: 10px; }

/* ---------- 笔记网格（奶油卡片 · 二次元） ---------- */
.notes-grid {
  max-width: 1100px; margin: 18px auto 70px; padding: 0 20px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px;
}
.note-card {
  background: linear-gradient(180deg, #fff 0%, var(--cream) 100%);
  border-radius: var(--radius); padding: 20px 20px 16px;
  border: 1.5px solid var(--sakura-100);
  box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s ease;
  position: relative; overflow: hidden;
}
/* 卡片顶角小花装饰 */
.note-card::before {
  content: "🌸"; position: absolute; right: 12px; top: 10px;
  font-size: 16px; opacity: .55; transition: transform .3s ease;
}
.note-card:hover { transform: translateY(-4px) scale(1.01); box-shadow: var(--shadow-hover); }
.note-card:hover::before { transform: rotate(20deg) scale(1.2); opacity: .9; }
.note-card.pinned { border-color: var(--sakura-300); background: linear-gradient(180deg, #fff, var(--sakura-50)); }
.note-card-head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.note-cat {
  font-size: 12px; font-weight: 800; color: var(--sakura-600);
  background: color-mix(in srgb, var(--cat) 16%, #fff);
  padding: 4px 12px; border-radius: 20px; letter-spacing: .3px;
  border: 1px solid color-mix(in srgb, var(--cat) 30%, transparent);
}
.pin-badge { font-size: 12px; color: var(--sakura-500); font-weight: 700; }
.note-title { margin: 0 0 9px; font-size: 17px; color: var(--ink); line-height: 1.45; font-weight: 800; }
.note-content {
  font-size: 13.5px; color: var(--ink-soft); line-height: 1.75;
  white-space: pre-wrap; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.note-tags { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 11px; }
.tag {
  border: none; background: var(--sakura-100); color: var(--sakura-700);
  padding: 4px 11px; border-radius: 16px; font-size: 12px; font-weight: 700;
  transition: all .15s ease;
}
.tag:hover { background: var(--sakura-200); transform: scale(1.04); }
.note-foot { margin-top: auto; padding-top: 13px; display: flex; align-items: center; justify-content: space-between; }
.note-foot time { font-size: 12px; color: var(--ink-soft); }
.note-ops { display: flex; gap: 6px; opacity: 0; transition: opacity .18s ease; }
.note-card:hover .note-ops { opacity: 1; }
.op {
  border: none; background: var(--sakura-100); color: var(--sakura-600);
  width: 30px; height: 30px; border-radius: 9px; font-size: 13px;
  transition: all .15s ease;
}
.op:hover { background: var(--sakura-200); transform: translateY(-1px); }
.op.del:hover { background: #ffe4e6; color: var(--danger); }

/* ---------- 空状态 ---------- */
.empty-state { max-width: 1100px; margin: 70px auto; text-align: center; padding: 0 20px; }
.empty-ico { font-size: 58px; opacity: .55; animation: floaty 4s ease-in-out infinite; }
.empty-state p { color: var(--ink-soft); margin: 14px 0 20px; font-size: 15px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(255,200,225,.32); backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: linear-gradient(180deg, #fff, var(--cream));
  border-radius: 22px; box-shadow: 0 30px 70px rgba(255,111,180,.25);
  width: 100%; max-width: 640px; animation: pop .22s cubic-bezier(.34,1.56,.64,1);
  border: 1px solid var(--sakura-100);
}
@keyframes pop { from { transform: translateY(16px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 17px 22px; border-bottom: 1px solid var(--sakura-100); }
.modal-head h2 { margin: 0; font-size: 17px; color: var(--sakura-600); font-weight: 800; letter-spacing: .5px; }
.modal-close { border: none; background: var(--sakura-100); color: var(--sakura-600); width: 32px; height: 32px; border-radius: 10px; font-size: 20px; line-height: 1; transition: all .15s ease; }
.modal-close:hover { background: var(--sakura-200); transform: rotate(90deg); }
.editor-fields { padding: 20px 22px; display: flex; flex-direction: column; gap: 13px; }
.input-title { border: none; outline: none; font-size: 19px; font-weight: 800; color: var(--ink); background: transparent; border-bottom: 2px dashed var(--sakura-200); padding-bottom: 8px; }
.input-title:focus { border-bottom-color: var(--sakura-400); }
.editor-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.editor-meta select, .editor-meta input[type=text] {
  border: 2px solid var(--sakura-200); border-radius: 12px; padding: 8px 11px; font-size: 13px; outline: none; background: var(--cream); color: var(--ink);
}
.editor-meta select:focus, .editor-meta input[type=text]:focus { border-color: var(--sakura-400); }
.editor-meta input[type=text] { flex: 1; min-width: 160px; }
.pill-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-soft); cursor: pointer; font-weight: 600; }
.pill-check input { accent-color: var(--sakura-500); width: 16px; height: 16px; }
.editor-fields textarea {
  min-height: 250px; resize: vertical; border: 2px solid var(--sakura-200); border-radius: 15px;
  padding: 13px 16px; font-size: 14px; line-height: 1.75; outline: none; background: var(--cream);
  transition: border-color .18s ease, background .18s ease;
}
.editor-fields textarea:focus { border-color: var(--sakura-400); background: #fff; box-shadow: 0 0 0 4px rgba(255,111,180,.10); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.editor-imgbar { display: flex; align-items: center; gap: 12px; padding: 0 2px 2px; flex-wrap: wrap; }
.editor-imgbar .muted { font-size: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 15px 22px; border-top: 1px solid var(--sakura-100); }
.confirm-modal { max-width: 420px; padding: 26px; }
.confirm-modal h2 { margin: 0 0 10px; font-size: 18px; color: var(--ink); }
.confirm-modal p { color: var(--ink-soft); margin: 0 0 20px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translate(-50%, 20px);
  background: linear-gradient(135deg, var(--sakura-500), var(--sakura-600));
  color: #fff; padding: 12px 22px; border-radius: 16px;
  font-size: 14px; font-weight: 600; opacity: 0; transition: all .3s ease; z-index: 90;
  box-shadow: 0 12px 30px rgba(255,111,180,.4);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: linear-gradient(135deg,#ff8fa3,#ff6b81); }
.toast.ok { background: var(--grad); }

/* =========================================================
   后台布局（简洁 · 素净）
   ========================================================= */
.admin-body { display: block; }
.admin-body canvas { opacity: .4; }
.admin-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex-shrink: 0;
  background: #ffffff;
  border-right: 1px solid #eee2e8;
  display: flex; flex-direction: column;
  transition: width .25s ease;
  position: sticky; top: 0; height: 100vh;
  overflow: hidden;
}
.admin-layout.collapsed .sidebar { width: 84px; }
.side-brand {
  display: flex; align-items: center; gap: 10px; padding: 18px 18px;
  font-weight: 800; color: var(--sakura-600); font-size: 15px; white-space: nowrap;
  border-bottom: 1px solid #f0e6ea;
}
.side-logo { width: 20px; height: 20px; border-radius: 6px; background: var(--grad); flex-shrink: 0; }
.side-nav { flex: 1; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  border: none; background: transparent; color: var(--ink); font-size: 14px; font-weight: 600;
  padding: 10px 12px; border-radius: 9px; white-space: nowrap; text-align: left;
  transition: background .15s ease, color .15s ease;
}
.nav-ico { width: 19px; height: 19px; flex-shrink: 0; color: var(--sakura-500); }
.nav-ico svg { width: 19px; height: 19px; display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-item:hover { background: var(--sakura-50); color: var(--sakura-600); }
.nav-item.active { background: var(--grad); color: #fff; }
.nav-item.active .nav-ico { color: #fff; }
.nav-txt { transition: opacity .2s ease; }
.admin-layout.collapsed .nav-txt,
.admin-layout.collapsed .side-brand-text,
.admin-layout.collapsed .side-user .nav-txt { opacity: 0; width: 0; display: none; }
.admin-layout.collapsed .nav-item { justify-content: center; padding: 12px 0; }
.admin-layout.collapsed .nav-item .nav-ico { color: var(--sakura-500); }
.admin-layout.collapsed .nav-item.active .nav-ico { color: #fff; }
.admin-layout.collapsed .side-brand { justify-content: center; padding: 18px 0; }
.admin-layout.collapsed .side-logo { width: 15px; height: 15px; }
.side-foot { padding: 10px; border-top: 1px solid #f0e6ea; display: flex; flex-direction: column; gap: 2px; }
.side-user { padding: 10px 12px; font-size: 13px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
.side-foot a.nav-item { text-decoration: none; }
.admin-layout.collapsed .side-foot a.nav-item,
.admin-layout.collapsed .side-user { justify-content: center; padding: 10px 0; }

.admin-main { flex: 1; min-width: 0; }
.admin-topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 24px; background: #fff;
  border-bottom: 1px solid #eee2e8; position: sticky; top: 0; z-index: 15;
}
.side-toggle {
  border: 1px solid #eee2e8; background: #fff; color: var(--ink-soft);
  width: 34px; height: 34px; border-radius: 8px; font-size: 16px; line-height: 1;
  transition: all .15s ease;
}
.side-toggle:hover { color: var(--sakura-600); border-color: var(--sakura-200); }
.panel-title { margin: 0; font-size: 17px; color: var(--ink); font-weight: 700; }
.topbar-user { margin-left: auto; font-size: 13px; color: var(--ink-soft); }

.panel { max-width: 980px; margin: 0 auto; padding: 24px; }
.card {
  background: #fff; border: 1px solid #eee2e8; border-radius: 12px;
  padding: 20px; margin-bottom: 18px;
}
.card h3 { margin: 0 0 14px; font-size: 15px; color: var(--ink); font-weight: 700; }

/* 统计卡片 */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
  background: #fff; border: 1px solid #eee2e8; border-radius: 12px;
  padding: 18px; text-align: center;
}
.stat-card p { margin: 0 0 2px; font-size: 28px; font-weight: 800; color: var(--ink); }
.stat-card small { color: var(--ink-soft); font-size: 12px; }

/* 最近更新 */
.recent-list { display: flex; flex-direction: column; }
.recent-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 8px; border-radius: 8px; }
.recent-item:hover { background: var(--sakura-50); }
.recent-title { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-item time { font-size: 12px; color: var(--ink-soft); }

/* 工具栏 */
.card-toolbar { display: flex; gap: 12px; margin-bottom: 14px; align-items: center; }
.input-search { flex: 1; max-width: 320px; padding: 10px 14px; border: 1px solid #e6d5dd; border-radius: 8px; outline: none; font-size: 14px; background: #fff; color: var(--ink); }
.input-search:focus { border-color: var(--sakura-400); }

/* 表格 */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; padding: 10px 12px; color: var(--ink-soft); font-weight: 600; border-bottom: 1px solid #eee2e8; white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid #f4eef1; vertical-align: middle; }
.tbl tr:hover td { background: #fdf9fb; }
.td-title { font-weight: 600; color: var(--ink); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-tags { max-width: 200px; }
.ta-r { text-align: right; }
.ta-c { text-align: center; }
.mini-tag { background: var(--sakura-50); color: var(--sakura-700); border-radius: 6px; padding: 2px 8px; font-size: 11px; margin-right: 4px; font-weight: 600; }
.mini-tag.pin { background: var(--sakura-100); color: var(--sakura-700); }
/* 简洁文字操作按钮（后台） */
.mini-btn {
  border: 1px solid #e6d5dd; background: #fff; color: var(--ink-soft);
  padding: 4px 10px; border-radius: 7px; font-size: 12px; font-weight: 600; cursor: pointer;
  margin-left: 4px; transition: all .15s ease;
}
.mini-btn:hover { border-color: var(--sakura-400); color: var(--sakura-600); }
.mini-btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.cat-pill { font-size: 12px; font-weight: 700; color: var(--sakura-600); background: color-mix(in srgb, var(--cat) 16%, #fff); padding: 3px 10px; border-radius: 6px; border: 1px solid color-mix(in srgb, var(--cat) 30%, transparent); }
.state { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 6px; }
.state.on { background: #e8f7ee; color: #1f9d55; }
.state.off { background: #fdecec; color: var(--danger); }

/* 分类管理 */
.cat-add { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; }
.cat-add input[type=text] { flex: 1; padding: 10px 12px; border: 1px solid #e6d5dd; border-radius: 8px; outline: none; background: #fff; color: var(--ink); }
.cat-add input[type=text]:focus { border-color: var(--sakura-400); }
.cat-add input[type=password] { width: 150px; padding: 10px 12px; border: 1px solid #e6d5dd; border-radius: 8px; outline: none; background: #fff; color: var(--ink); }
.cat-add input[type=password]:focus { border-color: var(--sakura-400); }
.cat-add input[type=color] { width: 44px; height: 38px; border: 1px solid #eee2e8; border-radius: 8px; padding: 2px; background: #fff; cursor: pointer; }
.cat-list { display: flex; flex-direction: column; gap: 8px; }
.cat-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid #eee2e8; border-radius: 10px; background: #fff; }
.cat-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.cat-name-input { border: 1px solid transparent; background: transparent; font-size: 14px; font-weight: 600; color: var(--ink); padding: 6px 8px; border-radius: 6px; outline: none; flex: 1; }
.cat-name-input:focus { border-color: #e6d5dd; background: #fff; }
.cat-pw-input { width: 130px; border: 1px solid #eee2e8; background: #fff; font-size: 13px; color: var(--ink); padding: 6px 8px; border-radius: 6px; outline: none; }
.cat-pw-input:focus { border-color: var(--sakura-400); }
/* 分类密码弹窗输入框 */
.modal.editor-modal input[type=password] { width: 100%; padding: 12px 14px; border: 1px solid #e6d5dd; border-radius: 10px; outline: none; background: #fff; color: var(--ink); font-size: 14px; }
.modal.editor-modal input[type=password]:focus { border-color: var(--sakura-400); box-shadow: 0 0 0 3px rgba(255,143,192,.15); }
.cat-color-input { width: 34px; height: 30px; border: 1px solid #eee2e8; border-radius: 6px; padding: 2px; background: #fff; cursor: pointer; }
.cat-count { font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.cat-ops { display: flex; gap: 6px; }

/* 表单 */
.form-row { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.form-row label { width: 92px; font-size: 14px; color: var(--ink-soft); font-weight: 600; }
.form-row input[type=text], .form-row input[type=password] {
  flex: 1; max-width: 320px; padding: 10px 12px; border: 1px solid #e6d5dd; border-radius: 8px;
  outline: none; background: #fff; font-size: 14px; color: var(--ink);
}
.form-row input:focus { border-color: var(--sakura-400); }

/* =========================================================
   前台笔记本（手账）样式
   ========================================================= */
body.notebook {
  background-image:
    radial-gradient(rgba(255,111,180,.11) 1.4px, transparent 1.5px),
    linear-gradient(180deg, var(--sakura-50) 0%, #fff6fc 45%, var(--sakura-50) 100%);
  background-size: 26px 26px, 100% 100%;
}
body.notebook .notes-grid { margin-top: 24px; }
/* 笔记卡片 → 笔记本内页纸：横线 + 左侧页边红线 */
body.notebook .note-card {
  background:
    repeating-linear-gradient(0deg, transparent 0 25px, rgba(255,111,180,.10) 25px 26px),
    #ffffff;
  padding-left: 34px;
  box-shadow: 0 10px 30px rgba(255,111,180,.15);
}
body.notebook .note-card::after {
  content: ""; position: absolute; left: 24px; top: 10px; bottom: 10px; width: 2px;
  background: rgba(255,111,180,.22); border-radius: 2px;
}
body.notebook .note-card-head { padding-left: 6px; }
body.notebook .note-title { padding-left: 6px; }
body.notebook .note-content { padding-left: 6px; }
/* 笔记内图片：半透明样式显示 */
.note-content img.note-img, .bc-body img.note-img {
  max-width: 100%; height: auto; border-radius: 8px; opacity: .5;
  margin: 6px 0; display: block; box-shadow: 0 4px 14px rgba(255,111,180,.14);
  transition: opacity .2s ease;
}
.note-card .note-content img.note-img { max-height: 120px; object-fit: cover; }
.note-card .note-content img.note-img:hover, .bc-body img.note-img:hover { opacity: .8; }
body.notebook .note-tags { padding-left: 6px; }
body.notebook .note-foot { padding-left: 6px; }
/* 编辑器 → 横线稿纸 */
body.notebook .editor-fields textarea {
  background:
    repeating-linear-gradient(0deg, transparent 0 24px, rgba(255,111,180,.13) 24px 25px),
    #fff9fc;
  line-height: 25px;
}

/* =========================================================
   翻书阅读器
   ========================================================= */
.reader {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(255, 214, 234, .34); backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center; padding: 26px;
}
.book {
  position: relative; width: 780px; max-width: 96vw;
  height: min(560px, 80vh);
  perspective: 1800px;
}
.book-page {
  position: absolute; inset: 0;
  border-radius: 10px 18px 18px 10px;
  backface-visibility: hidden;
  overflow: hidden;
}
.book-content {
  background:
    repeating-linear-gradient(0deg, transparent 0 27px, rgba(255,111,180,.09) 27px 28px),
    #fffafc;
  box-shadow: 0 20px 60px rgba(255,111,180,.20);
  padding: 40px 58px 34px 54px;
  overflow-y: auto;
}
.book-content::after { /* 书脊投影 */
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 26px;
  background: linear-gradient(90deg, rgba(180,90,140,.10), transparent);
}
.bc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.book-content h2 { margin: 0 0 12px; font-size: 25px; color: var(--ink); line-height: 1.4; }
.bc-meta { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 20px; }
.bc-body { font-size: 15px; line-height: 28px; color: var(--ink); white-space: pre-wrap; }
.bc-tags { margin-top: 26px; display: flex; gap: 8px; flex-wrap: wrap; }

.book-cover {
  background: linear-gradient(135deg, #ffb8de 0%, #ff6fb4 60%, #f754a3 100%);
  color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 40px; cursor: pointer;
  transform-origin: left center; z-index: 2;
  box-shadow: 0 20px 60px rgba(255,111,180,.35);
}
.book-cover::after { /* 书脊 */
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 18px;
  background: linear-gradient(90deg, rgba(0,0,0,.22), rgba(0,0,0,.05));
}
.book-cover .cover-emo { font-size: 46px; margin-bottom: 12px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.2)); }
.book-cover h2 { margin: 0 0 10px; font-size: 24px; color: #fff; line-height: 1.4; }
.cover-cat { background: rgba(255,255,255,.28); padding: 5px 16px; border-radius: 20px; font-size: 13px; }

/* 打开：封面翻开（缓慢） */
.book.open .book-cover { animation: openBook 1.6s cubic-bezier(.22,.9,.28,1) forwards; pointer-events: none; }
@keyframes openBook { to { transform: rotateY(-165deg); } }
/* 关闭：封面缓慢合上 */
.book.closing .book-cover { animation: closeBook .9s cubic-bezier(.4,0,.7,.4) forwards; pointer-events: none; }
@keyframes closeBook { from { transform: rotateY(-165deg); } to { transform: rotateY(0deg); } }
/* 关闭：整本书缓慢缩小移动到来源卡片 */
.reader.hide { background: rgba(255,214,234,0); transition: background .6s ease; }
.reader.hide .book { transition: transform .9s cubic-bezier(.5,.05,.7,.3), opacity .6s ease; opacity: 0; }

.reader-close {
  position: fixed; top: 24px; right: 28px; z-index: 85;
  border: none; background: #fff; color: var(--sakura-600);
  width: 44px; height: 44px; border-radius: 50%; font-size: 22px; line-height: 1; cursor: pointer;
  box-shadow: 0 10px 26px rgba(255,111,180,.28);
  transition: transform .18s ease;
}
.reader-close:hover { transform: rotate(90deg); }

/* =========================================================
   访问密码遮罩（半透明马赛克，能模糊看到下方笔记）
   ========================================================= */
.visit-lock {
  position: fixed; inset: 0; z-index: 95;
  display: none; align-items: center; justify-content: center; padding: 22px;
  background: rgba(255, 214, 234, .38);
  backdrop-filter: blur(6px);
  transition: opacity .5s ease, visibility .5s ease;
}
.visit-lock-card {
  position: relative; z-index: 1;
  width: 340px; max-width: 92vw;
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--sakura-100); border-radius: 16px;
  padding: 30px 28px; text-align: center;
  box-shadow: 0 20px 60px rgba(255,111,180,.3);
}
.visit-lock-card .login-brand { margin-bottom: 16px; }
.visit-lock-card h2 { margin: 10px 0 4px; font-size: 20px; color: var(--ink); }
.visit-lock-card .muted { font-size: 12.5px; }
.visit-lock-card input[type=password] {
  width: 100%; box-sizing: border-box; padding: 12px 14px; margin: 6px 0 12px;
  border: 2px solid var(--sakura-200); border-radius: 12px; outline: none;
  background: var(--cream); font-size: 14px; color: var(--ink);
}
.visit-lock-card input:focus { border-color: var(--sakura-400); background: #fff; box-shadow: 0 0 0 4px rgba(255,111,180,.12); }
.visit-lock.gone { opacity: 0; visibility: hidden; pointer-events: none; }

/* =========================================================
   加载动画（粉 · 双环旋转）
   ========================================================= */
.loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 90px 0; }
.loading-spinner {
  position: relative; width: 54px; height: 54px; border-radius: 50%;
  border: 4px solid var(--sakura-200);
  border-top-color: var(--sakura-500);
  animation: spin .9s linear infinite;
}
.loading-spinner::before {
  content: ""; position: absolute; inset: 9px; border-radius: 50%;
  border: 3px solid var(--lilac);
  border-right-color: transparent;
  animation: spin 1.3s linear infinite reverse;
}
.loading-spinner::after { /* 中心小点 */
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 8px; height: 8px; border-radius: 50%; background: var(--sakura-400);
  animation: pulse 1s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { transform: scale(1); opacity:.6; } 50% { transform: scale(1.6); opacity:1; } }
.loading p { color: var(--ink-soft); font-size: 13px; letter-spacing: .5px; animation: fadePulse 1.4s ease-in-out infinite; }
@keyframes fadePulse { 0%,100% { opacity:.5; } 50% { opacity:1; } }

/* 后台手机端抽屉遮罩 */
.sidebar-mask { display: none; position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,.28); }
/* 遮罩显示时锁定页面滚动 */
body.visit-locked { overflow: hidden; }

/* ---------- 响应式（手机适配） ---------- */
@media (max-width: 720px) {
  .topbar-inner { flex-wrap: wrap; gap: 10px; }
  .top-actions { gap: 8px; }
  .search-wrap { order: 3; max-width: 100%; flex-basis: 100%; }
  .notes-grid { grid-template-columns: 1fr; }
  .filters .chips { flex-wrap: wrap; }
  /* 前台顶部 & 卡片 */
  .brand-text { font-size: 15px; }
  .note-card { padding: 14px 16px 14px 28px; border-radius: 14px; }
  .note-title { font-size: 16px; }
  .note-content { font-size: 13px; line-height: 22px; }
  .note-ops .op { width: 30px; height: 30px; font-size: 15px; }
  /* 后台：侧边栏改为抽屉 */
  .sidebar { position: fixed; z-index: 40; transform: translateX(-100%); width: 244px; top: 0; left: 0; height: 100vh; transition: transform .25s ease; }
  .admin-layout.collapsed .sidebar,
  .admin-layout .sidebar { width: 244px; }
  .admin-layout.mobile-open .sidebar,
  .admin-layout.mobile-open.collapsed .sidebar { transform: translateX(0); }
  .side-toggle { position: relative; z-index: 41; }
  /* 遮罩仅在侧边栏抽屉打开时显示，平时必须隐藏，避免挡住主区点击 */
  .admin-layout.mobile-open .sidebar-mask { display: block; }
  /* 后台花瓣在手机端隐藏，避免兼容性黑屏/耗电 */
  .admin-body canvas { display: none; }
  .admin-topbar { padding: 12px 14px; }
  .panel { padding: 16px; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .card-toolbar { flex-direction: column; align-items: stretch; }
  .input-search { max-width: 100%; }
  .form-row { flex-direction: column; align-items: stretch; }
  .form-row label { width: auto; }
  /* 前台阅读器 / 弹窗 / 遮罩 */
  .book { height: 66vh; }
  .book-content { padding: 26px 22px 22px; }
  .book-cover .cover-emo { font-size: 34px; }
  .book-cover h2 { font-size: 18px; }
  .book-content h2 { font-size: 19px; }
  .bc-body { font-size: 13.5px; line-height: 24px; }
  .reader { padding: 14px; }
  .modal.editor-modal { max-width: 94vw; }
  .visit-lock { padding: 16px; }
  .visit-lock-card, .login-card { width: 88vw; max-width: 400px; padding: 24px 20px; }
  /* 兜底：手机端后台显式给浅粉底色，避免任何透明层显示异常 */
  .admin-body { background: #fff5f9; }
  .admin-layout, .admin-main { background: #fff5f9; }
  .panel { background: transparent; }
}
