/* ============================================================
   docs — 前台 UI 样式
   风格：极简 / 白底 / 圆角 / 描边图标 / 浅灰选中态
   ============================================================ */

:root {
  --bg:            #ffffff;
  --bg-main:       #fbfbfc;
  --sidebar:       #ffffff;
  --text:          #18181b;
  --text-2:        #6b6b74;
  --text-3:        #9a9aa2;
  --border:        #ececee;
  --border-soft:   #f1f1f3;
  --border-hover:  #dcdce0;
  --hover:         #f6f6f7;
  --active:        #f1f1f3;
  --accent:        #18181b;
  --on-accent:     #ffffff;
  --card:          #ffffff;
  --float-bg:      rgba(255,255,255,.92);
  --shadow-sm:     0 1px 2px rgba(0,0,0,.04);
  --shadow-md:     0 4px 16px rgba(0,0,0,.06);
  --radius:        10px;
  --radius-lg:     14px;
  --sidebar-w:     272px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
          "PingFang SC", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
}

/* 深色变量：跟随系统（未手动指定浅色时）+ 手动指定深色 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #17171a;
    --bg-main:     #1b1b1f;
    --sidebar:     #161619;
    --text:        #ededf0;
    --text-2:      #9c9ca6;
    --text-3:      #6d6d77;
    --border:      #2a2a30;
    --border-soft: #232328;
    --border-hover:#34343c;
    --hover:       #202026;
    --active:      #26262d;
    --accent:      #ededf0;
    --on-accent:   #161619;
    --card:        #1e1e23;
    --float-bg:    rgba(30,30,35,.92);
    --shadow-md:   0 4px 16px rgba(0,0,0,.3);
  }
}
:root[data-theme="dark"] {
  --bg:          #17171a;
  --bg-main:     #1b1b1f;
  --sidebar:     #161619;
  --text:        #ededf0;
  --text-2:      #9c9ca6;
  --text-3:      #6d6d77;
  --border:      #2a2a30;
  --border-soft: #232328;
  --border-hover:#34343c;
  --hover:       #202026;
  --active:      #26262d;
  --accent:      #ededf0;
  --on-accent:   #161619;
  --card:        #1e1e23;
  --float-bg:    rgba(30,30,35,.92);
  --shadow-md:   0 4px 16px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-main);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}
button { font-family: inherit; cursor: pointer; }
::selection { background: rgba(120,120,130,.22); }

.app { display: flex; height: 100vh; overflow: hidden; }

/* ==================== 侧边栏 ==================== */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 14px 12px 12px;
  transition: margin-left .22s ease;
}
.app.collapsed .sidebar { margin-left: calc(-1 * var(--sidebar-w)); }

.side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 6px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
}
.brand-logo svg { stroke: var(--on-accent) !important; }
.brand-name { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }

/* 搜索框 */
.search-box {
  width: 100%;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px;
  margin-bottom: 16px;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-3);
  text-align: left;
  transition: border-color .15s, background .15s;
}
.search-box:hover { border-color: var(--border-hover); }
.search-ph { flex: 1; font-size: 13.5px; }
.kbd-group { display: flex; gap: 3px; }
kbd {
  font-family: var(--font);
  font-size: 11px; line-height: 1;
  padding: 3px 5px;
  color: var(--text-3);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
}

/* 导航 */
.nav { flex: 1; overflow-y: auto; margin: 0 -2px; }
.nav::-webkit-scrollbar { width: 0; }
.nav-label {
  font-size: 12px; font-weight: 600;
  color: var(--text-3);
  padding: 6px 10px;
  margin-top: 8px;
}
.nav-label:first-child { margin-top: 0; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px;
  margin: 1px 0;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: background .13s, color .13s;
}
.nav-item svg { flex-shrink: 0; color: var(--text-3); transition: color .13s; }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item:hover svg { color: var(--text-2); }
.nav-item.active {
  background: var(--active);
  color: var(--text);
  font-weight: 600;
}
.nav-item.active svg { color: var(--text); }

/* 底部：身份 + 主题切换 + 退出（同一行）*/
.side-foot {
  display: flex; align-items: center;
  gap: 8px;
  padding: 12px 6px 2px;
  margin-top: 8px;
  border-top: 1px solid var(--border-soft);
}
/* 浅色/深色切换（紧凑）*/
.theme-toggle {
  display: flex; gap: 2px;
  padding: 2px;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.tt-opt {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 22px;
  border: none; background: transparent;
  border-radius: 999px;
  color: var(--text-3);
  transition: background .13s, color .13s;
}
.tt-opt:hover { color: var(--text-2); }
.tt-opt.active {
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.role-pill {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--text-2);
}
.role-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #d0d0d4;
}
.role-pill.admin .role-dot { background: #2ecc71; }
.role-pill.admin { color: var(--text); font-weight: 550; }

.icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border: none; background: transparent;
  color: var(--text-3);
  border-radius: 8px;
  transition: background .13s, color .13s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }

/* ==================== 主区域 ==================== */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--sidebar); }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 30px;
  border-bottom: 1px solid var(--border-soft);
}
.only-collapsed { display: none; }
.app.collapsed .only-collapsed { display: flex; }
.top-titles { flex: 1; min-width: 0; }
.top-titles h1 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.01em; }
.top-titles p { margin: 2px 0 0; font-size: 13px; color: var(--text-3); }
.top-actions { display: flex; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 13px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px; font-weight: 550;
  transition: background .13s, border-color .13s;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn.primary:hover { opacity: .88; }
.btn svg { width: 16px; height: 16px; }

.content { flex: 1; overflow-y: auto; padding: 26px 30px 60px; }

/* ---------- 复制卡片网格 ---------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.ccard {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
.ccard:hover { border-color: #dadade; box-shadow: var(--shadow-md); transform: translateY(-1px); }
@media (prefers-color-scheme: dark){ .ccard:hover{ border-color:#3a3a42; } }
.ccard-img { width: 100%; aspect-ratio: 16/10; object-fit: cover; display: block; background: var(--hover); }
.ccard-body { padding: 13px 15px 15px; }
.ccard-title { font-size: 14.5px; font-weight: 600; margin: 0 0 5px; }
.ccard-text { font-size: 13px; color: var(--text-2); margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ccard-copy {
  position: absolute; top: 10px; right: 10px;
  display: flex; align-items: center; gap: 5px;
  padding: 6px 9px;
  font-size: 12px; font-weight: 550;
  background: rgba(255,255,255,.92);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  backdrop-filter: blur(6px);
  opacity: 0; transform: translateY(-2px);
  transition: opacity .15s, transform .15s, background .15s;
}
@media (prefers-color-scheme: dark){ .ccard-copy{ background: rgba(30,30,35,.92); } }
.ccard:hover .ccard-copy { opacity: 1; transform: translateY(0); }
.ccard-copy svg { width: 14px; height: 14px; }
.ccard-copy.done { background: #e8f9ee; border-color: #b7ecc9; color: #1a9e52; opacity: 1; }

/* ---------- 卡片页搜索 ---------- */
.card-search {
  display: flex; align-items: center; gap: 8px;
  max-width: 760px;
  margin-bottom: 16px;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color .15s;
}
.card-search:focus-within { border-color: var(--text-3); }
.card-search svg { color: var(--text-3); flex-shrink: 0; }
.card-search input {
  flex: 1; min-width: 0;
  border: none; background: transparent; outline: none;
  font-family: inherit; font-size: 14px; color: var(--text);
}
.card-search input::placeholder { color: var(--text-3); }

/* ---------- 卡片拖拽排序 ---------- */
.drag-grip {
  flex-shrink: 0; align-self: stretch;
  display: flex; align-items: center; justify-content: center;
  width: 20px; margin: -16px 0 -16px -4px;
  color: var(--text-3);
  cursor: grab;
  opacity: 0;
  transition: opacity .13s, color .13s;
}
.card-row:hover .drag-grip { opacity: 1; }
.drag-grip:hover { color: var(--text-2); }
.drag-grip:active { cursor: grabbing; }
.card-row.dragging { opacity: .45; }

/* 卡片行：内容完整多行显示，不再截断/限高 */
.card-row { align-items: flex-start; cursor: default; }
.card-row .article-meta { padding: 2px 0; }
.card-row .article-meta p {
  white-space: pre-wrap; /* 保留编辑时的换行/排版，长行仍自动换行 */
  overflow: visible;
  text-overflow: clip;
  line-height: 1.65;
  word-break: break-word;
}
/* 复制 + ⋯ 横向排在卡片右上角，与标题同一行 */
.card-row .card-actions {
  flex-direction: row;
  align-items: center;
  gap: 2px;
  padding-top: 0;
}

/* ---------- 文章列表 ---------- */
.article-list { display: flex; flex-direction: column; gap: 4px; max-width: 760px; }
.article-row {
  display: flex; align-items: center; gap: 16px;
  padding: 16px;
  border-radius: 12px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .13s, border-color .13s;
}
.article-row:hover { background: var(--card); border-color: var(--border); }
.article-thumb { width: 72px; height: 56px; border-radius: 9px; object-fit: cover; flex-shrink: 0; background: var(--hover); }
.article-meta { flex: 1; min-width: 0; }
.article-meta h3 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.article-meta p { margin: 0; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.article-date { font-size: 12.5px; color: var(--text-3); flex-shrink: 0; }

/* 复制卡片行 */
.card-copy-img { cursor: pointer; }
.card-actions {
  flex-shrink: 0;
  display: flex; flex-direction: column;
  align-items: flex-end; justify-content: center;
  gap: 10px;
}
.card-copy-btn { flex-shrink: 0; padding: 8px; }
.card-copy-btn svg { width: 16px; height: 16px; display: block; }
.card-copy-btn.done { background: #e8f9ee; border-color: #b7ecc9; color: #1a9e52; }

/* ⋯ 下拉菜单 */
.kebab { position: relative; }
.kebab-pop {
  position: absolute; right: 0; top: calc(100% + 6px);
  min-width: 128px;
  display: flex; flex-direction: column; gap: 2px;
  padding: 5px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  z-index: 30;
}
.kebab-pop[hidden] { display: none; }
.kebab-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 8px 10px;
  border: none; background: transparent;
  border-radius: 7px;
  color: var(--text); font-size: 13.5px; font-family: inherit;
  text-align: left; cursor: pointer;
  transition: background .12s;
}
.kebab-item:hover { background: var(--hover); }
.kebab-item.danger { color: #d04545; }
.kebab-item svg { flex-shrink: 0; }

/* ---------- 图库 ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.gimg { position: relative; margin: 0; border-radius: 12px; }
.gimg img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); cursor: pointer; display: block; transition: transform .12s; }
.gimg img:hover { transform: scale(1.02); }
.gimg-del {
  position: absolute; top: 8px; right: 8px;
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  background: var(--float-bg); border: 1px solid var(--border);
  border-radius: 8px; color: #d04545; backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .15s;
}
.gimg:hover .gimg-del { opacity: 1; }
.gimg-del svg { width: 15px; height: 15px; }
/* 未关联标记 */
.gimg-badge {
  position: absolute; top: 8px; left: 8px;
  padding: 3px 7px; font-size: 11px; font-weight: 600;
  color: #fff; background: #d04545; border-radius: 6px;
  display: none;
}
.gimg.orphan { outline: 2px solid #d04545; outline-offset: 2px; border-radius: 12px; }
.gimg.orphan .gimg-badge { display: block; }

/* 图库检测横幅 */
.gallery-wrap { display: flex; flex-direction: column; gap: 16px; }
.gallery-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 16px; border-radius: 12px;
  font-size: 13.5px; border: 1px solid var(--border);
}
.gallery-bar[hidden] { display: none; }
.gallery-bar.warn { background: rgba(208,69,69,.08); border-color: rgba(208,69,69,.3); color: var(--text); }
.gallery-bar.ok { background: rgba(46,204,113,.08); border-color: rgba(46,204,113,.3); color: var(--text); }
.gallery-bar b { font-weight: 700; }
.gallery-bar .btn { margin-left: auto; }
.btn.danger { background: #d04545; color: #fff; border-color: #d04545; }
.btn.danger:hover { opacity: .9; background: #d04545; }

/* ---------- 占位/空态 ---------- */
.placeholder {
  max-width: 460px; margin: 60px auto; text-align: center;
}
.placeholder .ph-icon {
  width: 52px; height: 52px; margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px; background: var(--hover); color: var(--text-3);
}
.placeholder h2 { font-size: 16px; margin: 0 0 6px; }
.placeholder p { color: var(--text-3); font-size: 13.5px; margin: 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--accent); color: var(--bg);
  padding: 10px 18px; border-radius: 10px;
  font-size: 13.5px; font-weight: 550;
  box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 权限：仅超管可见 ---------- */
.admin-only { display: none !important; }
.app.is-admin .admin-only { display: flex !important; }
.app.is-admin .nav-label.admin-only { display: block !important; }

/* ---------- 卡片删除按钮 ---------- */
.ccard-del {
  position: absolute; top: 10px; left: 10px;
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  background: rgba(255,255,255,.92);
  border: 1px solid var(--border);
  border-radius: 8px; color: #d04545;
  backdrop-filter: blur(6px);
  opacity: 0; transform: translateY(-2px);
  transition: opacity .15s, transform .15s;
}
@media (prefers-color-scheme: dark){ .ccard-del{ background: rgba(30,30,35,.92); } }
.ccard:hover .ccard-del { opacity: 1; transform: translateY(0); }
.ccard-del svg { width: 15px; height: 15px; }
.art-del { color: #d04545; }

/* ---------- 管理面板 ---------- */
.panel { max-width: 620px; display: flex; flex-direction: column; gap: 26px; }
.field label { display: block; font-size: 14px; font-weight: 650; margin-bottom: 6px; }
.field-hint { font-size: 13px; color: var(--text-2); margin: 0 0 12px; line-height: 1.6; }
.field-row { display: flex; gap: 10px; }
.input {
  flex: 1; padding: 9px 12px;
  font-family: inherit; font-size: 14px;
  color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 9px;
  outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--text-3); }
a.btn { text-decoration: none; }

/* ---------- 登录闸门 ---------- */
.gate {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-main);
  padding: 20px;
}
.gate-card {
  width: 100%; max-width: 340px;
  display: flex; flex-direction: column; align-items: stretch;
  text-align: center;
  padding: 34px 30px 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
}
.gate-logo {
  width: 46px; height: 46px; margin: 0 auto 16px;
  border-radius: 12px; background: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.gate-logo svg { stroke: var(--on-accent) !important; }
.gate-card h1 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.gate-sub { margin: 6px 0 20px; font-size: 13.5px; color: var(--text-2); }
.gate-input {
  width: 100%; padding: 11px 14px; margin-bottom: 12px;
  font-family: inherit; font-size: 14.5px;
  color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 10px;
  outline: none; transition: border-color .15s;
}
.gate-input:focus { border-color: var(--text-3); }
.gate-btn { width: 100%; justify-content: center; padding: 11px; }
.gate-err { min-height: 0; margin: 0; font-size: 12.5px; color: #d04545; }
.gate-err:not(:empty) { margin-top: 12px; }
.gate-hint { margin: 4px 0 0; font-size: 12px; color: var(--text-3); line-height: 1.6; }

/* ---------- 卡片工具（编辑/删除）---------- */
.ccard-tools {
  position: absolute; top: 10px; left: 10px;
  display: flex; gap: 6px;
  opacity: 0; transform: translateY(-2px);
  transition: opacity .15s, transform .15s;
}
.ccard:hover .ccard-tools { opacity: 1; transform: translateY(0); }
.ccard-tools button {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  background: rgba(255,255,255,.92);
  border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-2);
  backdrop-filter: blur(6px);
}
@media (prefers-color-scheme: dark){ .ccard-tools button{ background: rgba(30,30,35,.92); } }
.ccard-tools .ccard-del { color: #d04545; }
.ccard-tools button svg { width: 15px; height: 15px; }

.art-tools { display: flex; gap: 2px; flex-shrink: 0; }
.art-tools .art-del { color: #d04545; }

/* ---------- 弹窗 ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.42);
  padding: 24px;
  backdrop-filter: blur(2px);
}
.modal {
  width: 100%; max-width: 460px;
  max-height: 88vh;
  display: flex; flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.modal-wide { max-width: 920px; height: 86vh; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 650; }
.modal-body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--border-soft);
  flex-shrink: 0;
}

/* 编辑器容器 */
.editor-wrap { display: flex; flex-direction: column; gap: 14px; flex: 1; min-height: 0; }
.editor-title { font-size: 16px; font-weight: 600; }
.editor-host { flex: 1; min-height: 320px; }
.reader-host { min-height: 200px; }
.textarea { min-height: 120px; resize: vertical; line-height: 1.6; }

/* 图片选择 */
.img-field { display: flex; align-items: center; gap: 14px; }
.img-preview {
  width: 96px; height: 72px; flex-shrink: 0;
  border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; background: var(--hover);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 12px; text-align: center;
}
.img-preview img { width: 100%; height: 100%; object-fit: cover; }
.img-pick { position: relative; }

/* Toast UI 编辑器嵌进弹窗时去掉多余圆角冲突 */
.toastui-editor-defaultUI { border-radius: 10px; }

/* ---------- 菜单管理 ---------- */
.menu-admin { max-width: 640px; }
.menu-list { display: flex; flex-direction: column; gap: 8px; }
.menu-arow {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.menu-type {
  flex-shrink: 0;
  font-size: 12px; font-weight: 600;
  padding: 3px 8px; border-radius: 6px;
}
.menu-type.cards { background: var(--hover); color: var(--text-2); }
.menu-type.article { background: rgba(43,116,201,.14); color: #3a86e0; }
.menu-aname { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-actions { display: flex; gap: 2px; flex-shrink: 0; }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn:disabled:hover { background: transparent; }

/* 类型选择 */
.type-pick { display: flex; flex-direction: column; gap: 10px; }
.type-opt {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 12px;
  cursor: pointer; transition: border-color .13s, background .13s;
}
.type-opt:hover { background: var(--hover); }
.type-opt input { margin-top: 3px; }
.type-opt > div { display: flex; flex-direction: column; gap: 2px; }
.type-opt b { font-size: 14px; font-weight: 600; }
.type-opt span { font-size: 12.5px; color: var(--text-3); }

/* 内容菜单（卡片/文章）：隐藏顶部标题栏 */
.app.content-view .topbar { display: none; }
.app.content-view .content { padding-top: 34px; }

/* 内容页 + 侧栏收起时的浮动展开按钮 */
.float-expand { display: none; }
.app.collapsed.content-view .float-expand {
  display: flex;
  position: fixed;
  top: 16px; left: 16px;
  z-index: 60;
  width: 34px; height: 34px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.app.collapsed.content-view .content { padding-top: 60px; }

/* 回到顶部按钮（与「新建卡片」同一水平线，水平贴内容列右缘）*/
.back-top {
  display: none;
  position: fixed;
  right: 14px; bottom: 26px;
  z-index: 55;
  width: 38px; height: 38px;
  align-items: center; justify-content: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 50%;
  box-shadow: var(--shadow-md);
  color: var(--text-2);
  transition: color .13s, background .13s;
}
.back-top.show { display: flex; }
.back-top:hover { color: var(--text); background: var(--hover); }

/* 右下角浮动「编辑内容」按钮 */
.fab-edit {
  position: fixed;
  right: 30px; bottom: 26px;
  z-index: 50;
  padding: 10px 16px;
  border-radius: 24px;
  box-shadow: var(--shadow-md);
}

/* 文章类页面阅读区 */
.article-page { max-width: 820px; }
/* 正文默认字体 */
.reader-host .toastui-editor-contents { font-size: 16px; }
.reader-host .toastui-editor-contents p { font-size: 16px; }
/* 正文文字颜色跟随主题（提高深色下的可读性）*/
.reader-host .toastui-editor-contents,
.reader-host .toastui-editor-contents p,
.reader-host .toastui-editor-contents li,
.reader-host .toastui-editor-contents td,
.reader-host .toastui-editor-contents th,
.reader-host .toastui-editor-contents h1,
.reader-host .toastui-editor-contents h2,
.reader-host .toastui-editor-contents h3,
.reader-host .toastui-editor-contents h4,
.reader-host .toastui-editor-contents h5,
.reader-host .toastui-editor-contents h6 { color: var(--text); }

/* 正文图片：限制默认预览尺寸 + 圆角 + 可点击放大 */
.reader-host .toastui-editor-contents img {
  max-width: 100%;
  max-height: 360px;
  width: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  cursor: zoom-in;
  transition: opacity .12s;
}
.reader-host .toastui-editor-contents img:hover { opacity: .92; }

/* 灯箱（点击放大）*/
.lightbox {
  position: fixed; inset: 0; z-index: 400;
  display: flex; align-items: center; justify-content: center;
  padding: 32px;
  background: rgba(0,0,0,.82);
  cursor: zoom-out;
  animation: lb-in .15s ease;
}
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }
.lightbox img {
  max-width: 94vw; max-height: 94vh;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 10px 44px rgba(0,0,0,.5);
}

/* 响应式 */
@media (max-width: 720px) {
  .sidebar { position: fixed; z-index: 40; height: 100vh; box-shadow: var(--shadow-md); }
  .content, .topbar { padding-left: 18px; padding-right: 18px; }
  .modal-wide { height: 92vh; max-width: 100%; }
}
