:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #16181d;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #1e4fd8;
  --brand-soft: #eef2ff;
  --in: #0f8a5f;
  --out: #c0392b;
  --radius: 12px;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
    "PingFang SC", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 16px; margin: 0; }

.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; }
.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 56px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand { color: var(--ink); font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }

.topnav { display: flex; align-items: center; gap: 18px; }
.topnav > a { color: var(--muted); font-size: 14px; }
.topnav > a:hover { color: var(--ink); text-decoration: none; }
.topnav form { margin: 0; }

.who { display: flex; flex-direction: column; line-height: 1.2; font-size: 13px; }
.who em { font-style: normal; color: var(--muted); font-size: 11px; }

/* ---------- 布局 ---------- */
.page { max-width: 1080px; margin: 0 auto; padding: 28px 20px 72px; }
.page-center {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 56px);
  max-width: none;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.section-title { font-size: 13px; color: var(--muted); font-weight: 600; margin: 24px 0 10px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  overflow-x: auto;
}

.empty { text-align: center; color: var(--muted); padding: 28px 0; }
.empty h1 { font-size: 20px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }

.kv {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 8px 12px;
  margin: 14px 0 20px;
  align-items: start;
}
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; }

/* ---------- 登录 ---------- */
.login-card {
  width: min(380px, 92vw);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 12px 40px rgba(16, 24, 40, 0.07);
}
.login-card h1 { font-size: 20px; }
.login-card .stack { margin-top: 18px; }

/* ---------- 应用卡片 ---------- */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.app-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.app-card:hover {
  text-decoration: none;
  border-color: #c7d2fe;
  box-shadow: 0 6px 20px rgba(30, 79, 216, 0.08);
  transform: translateY(-1px);
}
.app-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 6px;
}
.app-name { font-weight: 600; }
.app-desc { color: var(--muted); font-size: 13px; flex: 1; }
.app-card-admin .app-icon { background: #f3f4f6; color: #374151; }

.badge {
  align-self: flex-start;
  margin-top: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 500;
}
.badge-mini { margin: 0 0 0 6px; padding: 1px 6px; font-size: 11px; }

/* ---------- 链接列表 ---------- */
.link-list { display: grid; gap: 8px; }
.link-list a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
}
.link-list a:hover { border-color: #c7d2fe; text-decoration: none; }
.link-list span { color: var(--muted); font-size: 13px; }

/* ---------- 表格 ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.table th,
.table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table th {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: #fafbfc;
  white-space: nowrap;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafbfc; }
.table-compact td, .table-compact th { padding: 7px 10px; font-size: 13px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { white-space: nowrap; }

.status-bad { color: var(--out); font-weight: 600; }
.status-warn { color: #b45309; }
.path-cell { max-width: 420px; overflow-wrap: anywhere; }
.detail-cell { max-width: 340px; color: var(--muted); overflow-wrap: anywhere; }

.kv-chip {
  display: inline-block;
  margin: 0 6px 4px 0;
  padding: 1px 7px;
  border-radius: 5px;
  background: #f3f4f6;
  font-size: 12px;
  line-height: 1.6;
}
.kv-chip b { margin-right: 4px; color: var(--muted); font-weight: 500; }
.audit-target { max-width: 220px; overflow-wrap: anywhere; }
.audit-detail { max-width: 380px; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- 标签 ---------- */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.tag-in { background: #e7f6ef; color: var(--in); }
.tag-out { background: #fdecea; color: var(--out); }
.tag-admin { background: #eef2ff; color: var(--brand); }
.tag-pending { background: #fef3c7; color: #92400e; }
.tag-voting { background: #dbeafe; color: #1e40af; }
.tag-approved { background: #ffedd5; color: #9a3412; }
.tag-executed { background: #e7f6ef; color: var(--in); }
.tag-rejected { background: #fdecea; color: var(--out); }
.tag-mini { background: #f3f4f6; color: #374151; padding: 1px 6px; border-radius: 5px; font-size: 12px; }

/* ---------- 统计 ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-value.in { color: var(--in); }
.stat-value.out { color: var(--out); }
.stat-sub { font-size: 12px; color: var(--muted); }
.stat-pending { border-color: #fde68a; background: #fffbeb; }
.stat-exec { border-color: #fed7aa; background: #fff7ed; }
a.stat { color: inherit; text-decoration: none; transition: border-color 0.15s, box-shadow 0.15s; }
a.stat:hover {
  border-color: #c7d2fe;
  box-shadow: 0 4px 14px rgba(30, 79, 216, 0.08);
  text-decoration: none;
}

/* ---------- 表单 ---------- */
.stack { display: flex; flex-direction: column; gap: 14px; }

label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }

input, select, textarea {
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  min-height: 38px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(30, 79, 216, 0.12);
}
textarea { resize: vertical; min-height: 76px; }
input[type="file"] { padding: 6px; background: #fafbfc; }

.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}
.form-row > label { flex: 1 1 130px; }
.form-row > button { min-height: 38px; flex: 0 0 auto; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.toolbar-wrap { flex-wrap: wrap; }
.toolbar input, .toolbar select { min-height: 34px; padding: 5px 9px; }
.toolbar input[name="q"], .toolbar input[name="path"] { flex: 1 1 180px; }

.inline-form { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.inline-form input:not([type="hidden"]),
.inline-form select {
  min-height: 30px;
  height: 30px;
  padding: 3px 8px;
  font-size: 13px;
}
.inline-form .btn {
  min-height: 30px;
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
}
.perm-state { font-size: 12px; color: var(--muted); }

.row-menu { display: inline-block; position: relative; }
.row-menu summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
  padding: 2px 6px;
  border-radius: 6px;
  list-style: none;
}
.row-menu summary::-webkit-details-marker { display: none; }
.row-menu summary:hover { background: #f3f4f6; }
.row-menu[open] { z-index: 5; }
.row-menu form { margin-top: 6px; }
.row-menu input { min-height: 30px; padding: 3px 8px; font-size: 13px; width: 130px; }

.masked { letter-spacing: 2px; color: var(--muted); }
.plain-pwd {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 6px;
  padding: 1px 6px;
  color: #9a3412;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; color: var(--muted); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { background: #f9fafb; text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #1a45c0; border-color: #1a45c0; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: #f3f4f6; color: var(--ink); }
.btn-danger { color: var(--out); border-color: #f3d6d2; background: #fff; }
.btn-danger:hover { background: #fdecea; }
.btn-sm { padding: 5px 10px; font-size: 13px; min-height: 30px; }
.btn-xs { padding: 2px 7px; font-size: 12px; min-height: 26px; border-radius: 6px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------- 提示 ---------- */
.alert {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
}
.alert-error { background: #fdecea; color: #a12b1f; border: 1px solid #f5c9c3; }
.alert-ok { background: #e7f6ef; color: #0f6b4a; border: 1px solid #c8ebdc; }
.alert-warn { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }

/* ---------- 流程说明 ---------- */
.guide {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
.guide > summary {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  list-style: none;
}
.guide > summary::-webkit-details-marker { display: none; }
.guide > summary::before { content: "▸ "; }
.guide[open] > summary::before { content: "▾ "; }
.guide[open] > summary { border-bottom: 1px solid var(--line); }
.guide-body { padding: 4px 16px 16px; }
.guide-body h3 { font-size: 14px; margin: 18px 0 8px; }
.guide-body ul,
.guide-body ol { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.75; }
.guide-body li { margin-bottom: 8px; }
.guide-body .table { border: none; }
.guide-body .table th,
.guide-body .table td { font-size: 13px; }
.guide-body .table th:first-child,
.guide-body .table td:first-child { width: 84px; white-space: nowrap; }
.flow-list { list-style: none; padding-left: 0 !important; }
.flow-list li { margin-bottom: 10px; line-height: 1.7; }
.flow-list .tag { display: inline-block; margin-right: 6px; vertical-align: baseline; }
.tag-role { background: #eef2ff; color: var(--brand); }

/* ---------- 流程图 ---------- */
.page-actions { display: flex; align-items: center; gap: 8px; }

.flow { list-style: none; padding: 0; margin: 0 0 24px; }
.flow-node {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}
.flow-no {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
}
.flow-body { flex: 1 1 auto; min-width: 0; }
.flow-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-weight: 600;
  font-size: 15px;
}
.flow-who { font-size: 12px; color: var(--muted); margin: 2px 0 6px; }
.flow-body p { margin: 0 0 4px; font-size: 14px; }
.flow-flag {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
}
.flow-flag-ok { background: #e7f6ef; color: var(--in); }
.flow-branch {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}
.flow-note { font-size: 12px; color: var(--muted); }
.flow-link { position: relative; height: 30px; margin-left: 28px; }
.flow-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 2px;
  height: 22px;
  background: var(--line);
}
.flow-link::after {
  content: "";
  position: absolute;
  left: -4px;
  top: 22px;
  border: 5px solid transparent;
  border-top-color: var(--line);
}
.flow-node.state-pending { border-left-color: #f59e0b; }
.flow-node.state-voting { border-left-color: #3b82f6; }
.flow-node.state-approved { border-left-color: #f97316; }
.flow-node.state-executed { border-left-color: #10b981; }
.flow-node.state-rejected { border-left-color: #ef4444; }

.rule-list { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.8; }
.rule-list li { margin-bottom: 6px; }

/* ---------- 财务表格细节 ---------- */
.rec-title { font-weight: 500; }
a.rec-title { color: var(--ink); }
a.rec-title:hover { color: var(--brand); }
.rec-note { color: var(--muted); font-size: 13px; white-space: pre-wrap; margin-top: 2px; }
.who-cell { white-space: nowrap; }

.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.vote-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  background: #fafbfc;
}
.vote-line { font-size: 13px; }
.vote-bar {
  height: 6px;
  border-radius: 999px;
  background: #e5e7eb;
  margin: 8px 0 10px;
  overflow: hidden;
}
.vote-bar span { display: block; height: 100%; background: var(--brand); }
.vote-actions { display: flex; gap: 8px; }

.vote-start { position: relative; }
.vote-start > summary { list-style: none; cursor: pointer; }
.vote-start > summary::-webkit-details-marker { display: none; }
.vote-start[open] { flex-basis: 100%; }
.vote-start form { margin-top: 12px; max-width: 340px; }

.execute-box {
  display: grid;
  gap: 10px;
  border: 1px solid #fed7aa;
  background: #fff7ed;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
}
.execute-box p { margin: 0; }
.execute-box form { margin: 0; }

.timeline { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; }
.timeline li {
  display: grid;
  grid-template-columns: 140px 80px 96px 1fr;
  gap: 10px;
  font-size: 13px;
  align-items: baseline;
}
.timeline-time { color: var(--muted); font-size: 12px; }
.timeline-actor { font-weight: 500; }
.timeline-action { color: var(--brand); }
.timeline-detail { font-size: 12px; }

.thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.thumbs a { display: block; }
.thumbs img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #f9fafb;
}
.thumbs-edit .thumb-item { position: relative; }
.thumbs-edit img { width: 72px; height: 72px; }
.thumb-item { position: relative; display: inline-block; }
.thumb-del {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: #111827;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.thumb-tag {
  position: absolute;
  bottom: 3px;
  left: 3px;
  background: rgba(17, 24, 39, 0.7);
  color: #fff;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
}

/* ---------- 对话框 ---------- */
.dialog {
  border: none;
  border-radius: 14px;
  padding: 0;
  width: min(600px, 94vw);
  background: var(--card);
  box-shadow: 0 24px 70px rgba(16, 24, 40, 0.22);
  z-index: 100;
}
.dialog::backdrop { background: rgba(17, 24, 39, 0.45); }
.dialog-body { padding: 22px; min-height: 80px; }
.dialog { max-height: 88vh; overflow-y: auto; }

@media (max-width: 720px) {
  .dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    margin: 8px auto;
    border-radius: 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .dialog-body { padding: 16px; }
  .dialog-actions {
    flex-wrap: wrap;
    position: sticky;
    bottom: 0;
    padding: 8px 0 0;
    background: var(--card);
  }
  .dialog-actions .btn { flex: 1 1 auto; }
}
.form-dialog h2 { margin-bottom: 4px; }
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

/* ---------- 分页 ---------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 16px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .topbar { padding: 0 14px; }
  .brand { font-size: 12px; }
  .topnav { gap: 10px; }
  .who em { display: none; }
  .page { padding: 18px 14px 56px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head .btn-ghost { align-self: flex-start; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table th, .table td { padding: 8px 8px; font-size: 13px; }
  .table .rec-note { display: none; }
  .col-operator { display: none; }
  .path-cell, .detail-cell { max-width: 160px; }
  .form-row { flex-direction: column; align-items: stretch; }
  .form-row > label { flex: 1 1 auto; }
  .grid-2 { grid-template-columns: 1fr; }
  .timeline { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .timeline li {
    grid-template-columns: 140px 90px 100px 220px;
    min-width: 560px;
  }

  /* 财务列表在窄屏改成卡片，不再横向滚动 */
  .table-scroll { overflow: visible; }
  #records {
    min-width: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    overflow: visible;
  }
  #records thead { display: none; }
  #records,
  #records tbody { display: block; }
  #records tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "status amount"
      "date   amount"
      "title  title"
      "actions actions";
    gap: 4px 10px;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--card);
  }
  #records tbody tr:hover { background: var(--card); }
  #records td { border: none; padding: 0; }
  #records td.c-status { grid-area: status; }
  #records td.c-amount { grid-area: amount; align-self: start; font-weight: 600; }
  #records td.c-amount::before { content: "−"; color: var(--out); margin-right: 1px; }
  #records td.c-amount[data-dir="in"]::before { content: "+"; color: var(--in); }
  #records td.c-date { grid-area: date; font-size: 12px; color: var(--muted); }
  #records td.c-title { grid-area: title; margin-top: 6px; }
  #records td.c-actions {
    grid-area: actions;
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    margin-top: 8px;
  }
  #records td.c-kind,
  #records td.c-payer,
  #records td.c-payee,
  #records td.c-creator { display: none; }
  #records td.empty { text-align: left; }
  #records tr:has(td.empty) {
    display: block;
    border: none;
    background: transparent;
    padding: 8px 0;
  }
  .actions .btn-xs { padding: 4px 8px; font-size: 12px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 0; justify-content: center; }
  .guide-body { padding: 4px 12px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}


/* ---------- 相册 ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 4px; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--brand); }

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.album-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  overflow: hidden;
}

.folder-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; }
.folder-link { display: flex; flex-direction: column; gap: 2px; color: var(--ink); }
.folder-icon { font-size: 22px; }
.folder-name { font-size: 14px; font-weight: 600; }
.folder-count { font-size: 12px; color: var(--muted); }
.folder-actions { display: flex; gap: 4px; }

.photo-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #f3f4f6;
}
.album-card a { text-decoration: none; }
.photo-link:hover .photo-name { color: var(--brand); }
.photo-name {
  display: block;
  padding: 6px 8px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.photo-card .pick {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 18px;
  height: 18px;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 2;
}
.photo-card:hover .pick,
.photo-card .pick:checked { opacity: 1; }
.photo-card:has(.pick:checked) { outline: 2px solid var(--brand); }

.select-bar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  z-index: 40;
}
.select-bar select { min-height: 30px;padding: 3px 8px; border-radius: 6px; }
.select-bar .btn-ghost { color: #d1d5db; }
.select-bar[hidden] { display: none; }

.upload-progress {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}
.upload-bar { height: 6px; border-radius: 999px; background: #e5e7eb; overflow: hidden; }
.upload-bar span { display: block; width: 0; height: 100%; background: var(--brand); transition: width 0.2s; }
.upload-progress p { margin: 8px 0 0; }

.wall-day { margin-bottom: 22px; }
.wall-date {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 6px;
  font-size: 14px;
}
.wall-date span { font-size: 12px; font-weight: 400; color: var(--muted); }
.wall-more { padding: 10px 0 20px; text-align: center; }

/* 照片墙：正方形紧密拼贴，没有卡片与圆角 */
.wall-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 3px;
}
.wall-cell { position: relative; background: #f3f4f6; }
.wall-cell a { display: block; }
.wall-cell img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

/* 编辑模式：点击 / 框选 / ctrl 点击来复选 */
body.editing .wall-cell a { cursor: crosshair; }
.wall-cell.selected { outline: 3px solid var(--brand); outline-offset: -3px; }
.wall-cell.selected::after {
  content: "✓";
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  line-height: 1;
}
.wall-cell[data-locked="1"] { cursor: default; }
body.editing .wall-cell[data-locked="1"] a { cursor: not-allowed; }
.marquee {
  position: fixed;
  z-index: 60;
  border: 1px solid var(--brand);
  background: rgba(30, 79, 216, 0.12);
  pointer-events: none;
}
.edit-toggle.on { background: var(--brand); border-color: var(--brand); color: #fff; }

.trash-cell-action {
  position: absolute;
  right: 4px;
  bottom: 4px;
  opacity: 1;
}
.trash-cell-action .btn {
  background: rgba(17, 24, 39, 0.72);
  border-color: transparent;
  color: #fff;
}
.trash-cell-action .btn:hover { background: #b91c1c; }

.photo-view { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.photo-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 300px;
  border-radius: 12px;
  background: #0f1115;
  overflow: hidden;
}
.photo-stage img { display: block; max-width: 100%; max-height: 78vh; }
.photo-nav {
  position: absolute;
  top: 50%;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 22px;
  text-decoration: none;
  transform: translateY(-50%);
}
.photo-nav.prev { left: 10px; }
.photo-nav.next { right: 10px; }
.photo-meta {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}
.photo-meta h2 { margin: 14px 0 6px; font-size: 13px; color: var(--muted); }
.photo-meta h2:first-child { margin-top: 0; }
.photo-title { font-size: 20px; word-break: break-all; }

.trash-tree { margin: 0; padding: 0; list-style: none; font-size: 13px; line-height: 2; }

@media (max-width: 720px) {
  .album-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
  .wall-grid { grid-template-columns: repeat(auto-fill, minmax(94px, 1fr)); gap: 2px; }
  .photo-view { grid-template-columns: 1fr; }
  .photo-stage img { max-height: 60vh; }
  .select-bar {
    left: 12px;
    right: 12px;
    width: auto;
    transform: none;
    justify-content: space-between;
  }
  .select-bar select { flex: 1 1 auto; min-width: 0; }
}

/* 文件资源 */
.upload-box {
  margin-top: 12px;
  padding: 18px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.upload-box.is-dragging { background: var(--brand-soft); border-color: var(--brand); }
.upload-drop { cursor: pointer; color: var(--muted); font-size: 14px; }
.upload-track {
  height: 6px;
  margin-top: 10px;
  overflow: hidden;
  background: var(--line);
  border-radius: 999px;
}
.upload-bar { width: 0; height: 100%; background: var(--brand); transition: width .15s; }
.upload-progress { margin-top: 4px; }

.files-dialog {
  min-width: 360px;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(16, 24, 40, .18);
}
.files-dialog::backdrop { background: rgba(16, 24, 40, .35); }
.files-dialog form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 22px;
}
.files-dialog h3 { margin: 0; font-size: 15px; }
.files-dialog input:not([type="radio"]) { width: 100%; }
.files-dialog menu {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin: 0;
  padding: 0;
}

.files-table { table-layout: auto; min-width: 640px; }
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.files-table .c-size { width: 90px; text-align: right; }
.files-table .c-time { width: 160px; white-space: nowrap; }
.files-table .c-act { width: 92px; }
.files-table .c-act {
  width: 36px;
  padding-left: 2px;
  padding-right: 2px;
  text-align: right;
}
.files-table td.c-act .btn { padding: 4px 10px; }

.tree-picker {
  max-height: 320px;
  padding: 6px 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.tree-root,
.tree-children { margin: 0; padding: 0; list-style: none; }
.tree-row {
  display: flex;
  flex-direction: row;
  gap: 6px;
  align-items: center;
  padding: 4px 8px;
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
}
.tree-row:hover { background: #f7f8fa; }
.tree-row.is-blocked { opacity: .4; cursor: not-allowed; }
summary.tree-row { list-style: none; }
summary.tree-row::-webkit-details-marker { display: none; }
summary.tree-row::before {
  content: "▶";
  color: var(--muted);
  font-size: 9px;
  transition: transform .15s;
}
details[open] > summary.tree-row::before { transform: rotate(90deg); }


.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
}
.icon-btn:hover {
  color: var(--brand);
  background: var(--brand-soft);
  border-color: var(--brand);
}
.file-glyph { margin-right: 4px; color: var(--muted); vertical-align: -3px; }

@media (max-width: 720px) {
  .upload-box { padding: 12px; }
  .inline-form { flex-wrap: wrap; }
  .files-dialog { min-width: 0; width: calc(100vw - 32px); }
}

body.editing .files-table tr[data-id] { cursor: pointer; }
body.editing .files-table tr[data-id]:hover { background: #f0f6ff; }
body.editing .files-table tr.selected { background: var(--brand-soft); }
body.editing .files-table .c-act { opacity: .35; pointer-events: none; }

.vote-meter { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.vote-meter-label { flex: 0 0 28px; color: var(--muted); font-size: 12px; }
.vote-meter .vote-bar { flex: 1; }
.vote-bar-agree span { background: var(--in); }
.vote-bar-reject span { background: var(--out); }

.note-body { white-space: pre-wrap; word-break: break-word; }
.attach-box {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
}
.attach-box label { font-size: 12px; color: var(--muted); }

.note-list {
  margin: 8px 0 0;
  padding-left: 18px;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
}
.note-list li { padding: 3px 0; font-size: 13px; }
.note-text { white-space: pre-wrap; word-break: break-word; }
.supplement-box {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
}
.supplement-form { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.supplement-form textarea { width: 100%; }
.supplement-upload { font-size: 12px; color: var(--muted); }
.supplement-form .btn { align-self: flex-start; }

.media-pending {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1;
  color: var(--muted);
  font-size: 12px;
  background: #eef1f5;
  border-radius: 8px;
}
.media-badge {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
}
.wall-cell { position: relative; }
.photo-video { max-width: 100%; max-height: 80vh; border-radius: 10px; background: #000; }
