:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-soft: #fbfaf7;
  --line: #e4e1da;
  --text: #202124;
  --muted: #6b6a66;
  --accent: #286f6c;
  --accent-soft: #e6f1ef;
  --accent-strong: #1d5654;
  --danger: #b43b32;
  --danger-soft: #f7e2df;
  --warn: #9a6a15;
  --warn-soft: #f7edd4;
  --ok: #2d7a46;
  --ok-soft: #e1f0e6;
  --info: #345f9f;
  --info-soft: #e5ecf7;
  --shadow: 0 1px 2px rgba(34, 34, 34, 0.05);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

button, input, select, textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
  padding: 7px 12px;
  cursor: pointer;
}
button:hover { background: #f0eee8; }
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
button.primary:hover { background: var(--accent-strong); }
button.danger {
  background: var(--danger-soft);
  border-color: transparent;
  color: var(--danger);
}
button.ghost { background: transparent; }
button.icon {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
}
textarea {
  resize: vertical;
  line-height: 1.55;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(40, 111, 108, .12);
}
label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 22px;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.brand {
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
}
.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 9px 11px;
  border-radius: 6px;
}
.nav a:hover { background: #f0eee8; color: var(--text); }
.nav a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.spacer { flex: 1; }
.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.page {
  flex: 1;
  padding: 18px 22px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #f6f5f1 0%, #ece8df 100%);
}
.login-panel {
  width: min(420px, calc(100vw - 36px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(38, 37, 34, .08);
  padding: 28px;
}
.login-panel h1 {
  margin: 0 0 6px;
  font-size: 22px;
}
.login-panel p {
  margin: 0 0 22px;
  color: var(--muted);
}
.login-panel form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-panel .primary {
  margin-top: 4px;
  height: 38px;
}
.login-foot {
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
}

.ledger-layout {
  --left-pane-width: minmax(320px, 31%);
  display: grid;
  grid-template-columns: var(--left-pane-width) 10px minmax(420px, 1fr);
  gap: 8px;
  height: calc(100vh - 94px);
  min-height: 620px;
}
.left-pane, .right-pane, .table-pane, .dashboard-pane, .admin-pane, .help-pane {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.left-pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.right-pane {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.pane-resizer {
  width: 10px;
  min-width: 10px;
  cursor: col-resize;
  position: relative;
  border-radius: 8px;
}
.pane-resizer::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 4px;
  width: 2px;
  border-radius: 999px;
  background: #d5d1c7;
}
.pane-resizer:hover::before,
body.resizing-panes .pane-resizer::before {
  background: var(--accent);
}
body.resizing-panes {
  cursor: col-resize;
  user-select: none;
}
.filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}
.filters .wide { grid-column: 1 / -1; }
.toggle-row {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.chip-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.chip-toggle.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: #b8d5d1;
}

.project-list {
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.project-card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 11px 12px;
  cursor: pointer;
}
.project-card:hover { border-color: #abc9c5; }
.project-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(40, 111, 108, .08);
}
.project-title-row {
  display: flex;
  gap: 7px;
  align-items: center;
  margin-bottom: 6px;
}
.project-subject {
  min-width: 0;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-meta {
  color: var(--muted);
  font-size: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot.red { background: var(--danger); }
.dot.yellow { background: #d59a24; }

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 2px 8px;
  min-height: 21px;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}
.pill.status-待推进 { background: #ece9e2; color: #5f5b51; }
.pill.status-对方处理中 { background: var(--info-soft); color: var(--info); }
.pill.status-已完成 { background: var(--ok-soft); color: var(--ok); }
.pill.status-已关闭 { background: var(--warn-soft); color: var(--warn); }
.pill.priority-紧急 { background: var(--danger-soft); color: var(--danger); }
.pill.priority-一般 { background: #eeeeea; color: var(--muted); }
.pill.priority-低 { background: #f4f3ef; color: #85837d; }
.pill.escalate { background: var(--warn-soft); color: var(--warn); }

.detail-header {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}
.detail-title-line {
  display: flex;
  align-items: center;
  gap: 10px;
}
.detail-title-line h2 {
  margin: 0;
  flex: 1;
  font-size: 19px;
  min-width: 0;
}
.detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.meta-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(6, minmax(90px, 1fr));
  gap: 8px;
}
.meta-cell {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  min-width: 0;
}
.meta-cell .label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}
.meta-cell .value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 22px;
}
.timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.event-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px 14px;
}
.event-top {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}
.event-top .spacer { flex: 1 1 auto; min-width: 0; }
.event-progress {
  margin-top: 9px;
  line-height: 1.65;
  white-space: pre-wrap;
}
.event-target {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}
.event-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.inline-form, .modal-form {
  display: grid;
  gap: 10px;
}
.inline-form {
  margin-top: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-soft);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
}
.form-grid .wide { grid-column: 1 / -1; }
.form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 260px;
  color: var(--muted);
  text-align: center;
}

.table-pane, .dashboard-pane, .admin-pane, .help-pane {
  min-height: calc(100vh - 94px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.page-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.page-head h1 {
  margin: 0;
  font-size: 18px;
}
.page-head .spacer { flex: 1; }
.table-filters {
  display: grid;
  grid-template-columns: 1.2fr repeat(4, minmax(130px, .7fr)) auto;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.table-wrap {
  overflow: auto;
  flex: 1;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
}
th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #edece7;
  color: #44413a;
  font-size: 12px;
  white-space: nowrap;
}
td {
  background: #fff;
}
tr:hover td { background: #f9f8f4; }
.progress-cell {
  max-width: 420px;
  min-width: 260px;
  line-height: 1.5;
}
.subject-cell {
  min-width: 220px;
  font-weight: 600;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 16px;
}
.stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 13px 14px;
}
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 4px; }
.dashboard-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  overflow: auto;
  padding: 0 16px 16px;
}
.section {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}
.section-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.section-head h2 { margin: 0; font-size: 15px; }
.profile-panel {
  padding: 12px;
  background: #fff;
  border-top: 1px solid var(--line);
}
.profile-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
.profile-metric {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
}
.profile-metric .name { color: var(--muted); font-size: 12px; }
.profile-metric .value { margin-top: 5px; font-weight: 700; }

.admin-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 14px;
  padding: 14px;
  overflow: auto;
}

.help-content {
  overflow-y: auto;
  padding: 18px 22px 28px;
  max-width: 1120px;
}
.help-hero {
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 14px;
}
.help-card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 14px 16px;
}
.help-card h2,
.help-section h2 {
  margin: 0 0 10px;
  font-size: 16px;
}
.help-card p,
.help-section p {
  margin: 6px 0;
  line-height: 1.7;
}
.help-section {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  margin-top: 14px;
}
.help-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.help-step {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.help-step h3 {
  margin: 0 0 8px;
  font-size: 14px;
}
.help-list {
  margin: 8px 0 0;
  padding-left: 18px;
  line-height: 1.75;
}
.help-kv {
  display: grid;
  grid-template-columns: 160px 1fr;
  border: 1px solid var(--line);
  border-bottom: none;
  margin-top: 10px;
}
.help-kv > div {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
}
.help-kv > div:nth-child(odd) {
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 600;
}
.help-note {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  padding: 10px 12px;
  border-radius: 6px;
  margin-top: 10px;
  line-height: 1.7;
}
.admin-form-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}
.admin-form-panel h2 {
  margin: 0 0 12px;
  font-size: 15px;
}

.toast-wrap {
  position: fixed;
  right: 18px;
  top: 72px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  min-width: 220px;
  max-width: 380px;
  border-radius: 8px;
  padding: 10px 12px;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.14);
  background: #3f3d38;
}
.toast.ok { background: var(--ok); }
.toast.err { background: var(--danger); }

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(28, 27, 24, .38);
  z-index: 100;
}
.modal {
  position: fixed;
  z-index: 101;
  width: min(720px, calc(100vw - 36px));
  max-height: calc(100vh - 70px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 18px 60px rgba(0,0,0,.18);
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
.modal-head {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-head h2 {
  margin: 0;
  font-size: 16px;
}
.modal-body {
  padding: 16px;
  overflow-y: auto;
}

@media (max-width: 1050px) {
  .ledger-layout {
    --left-pane-width: 360px;
    grid-template-columns: var(--left-pane-width) 10px minmax(420px, 1fr);
  }
  .meta-grid { grid-template-columns: repeat(3, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .profile-grid { grid-template-columns: repeat(2, 1fr); }
  .table-filters { grid-template-columns: 1fr 1fr; }
  .admin-layout { grid-template-columns: 1fr; }
  .help-hero,
  .help-steps { grid-template-columns: 1fr; }
}

/* ===== 贡献 / 科目 / 榜单模块样式 ===== */

.contrib-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  margin-top: 12px;
}
.contrib-side {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.contrib-side .section-title {
  font-size: 14px;
  margin: 0 0 8px;
  color: var(--muted);
}
.contrib-main {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.contrib-subject-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 8px;
}
.contrib-subject-card .cs-title { font-weight: 600; }
.contrib-subject-card .cs-meta { font-size: 12px; margin: 4px 0 8px; }
.scope-tabs { display: inline-flex; gap: 4px; }
.contrib-scope-tab {
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  font-size: 13px;
}
.contrib-scope-tab.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}
.status-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 12px;
  border: 1px solid var(--line);
}
.st-pending   { background: var(--warn-soft);   color: var(--warn);   border-color: var(--warn); }
.st-approved  { background: var(--ok-soft);     color: var(--ok);     border-color: var(--ok); }
.st-rejected  { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.st-draft     { background: var(--surface-soft); color: var(--muted); }
.st-published { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent); }
.st-archived  { background: var(--surface-soft); color: var(--muted); }
.kv { display: inline-block; margin-right: 8px; font-size: 12px; color: var(--muted); }

.field-edit-row {
  display: grid;
  grid-template-columns: 1.3fr 1.3fr 0.8fr 1.5fr auto auto 0.4fr;
  gap: 6px;
  margin-bottom: 6px;
  align-items: center;
}
.field-edit-row input,
.field-edit-row select { padding: 5px 6px; }
.field-edit-row label.inline { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.field-edit-row label.inline input { width: auto; }

.req { color: var(--danger); margin-left: 2px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; }
.row-2 > label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  min-width: 0;
}
.row-2 > label input,
.row-2 > label select,
.row-2 > label textarea {
  width: 100%;
  box-sizing: border-box;
}

.rank { font-weight: 700; text-align: center; width: 50px; }
.rank-1 { color: #c89200; }
.rank-2 { color: #8a8a8a; }
.rank-3 { color: #a06b3a; }

.lbs-head { display: flex; justify-content: space-between; padding: 6px 0; }
.lbs-table { width: 100%; }
.lbs-table td { padding: 4px 8px; }

@media (max-width: 1100px) {
  .contrib-layout { grid-template-columns: 1fr; }
  .field-edit-row { grid-template-columns: 1fr 1fr; }
}

.cs-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.cs-template-link { font-size: 12px; color: var(--muted); text-decoration: underline; }
.cs-template-link:hover { color: var(--accent); }
.cs-import { font-size: 13px; }

/* ===== 手机端自适应 ===== */

.nav-toggle {
  display: none;
  width: 36px;
  height: 36px;
  padding: 0;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  position: relative;
}
.nav-toggle:hover { background: #f0eee8; }
.nav-toggle::before,
.nav-toggle::after,
.nav-toggle > span {
  content: "";
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.nav-toggle::before { top: 11px; }
.nav-toggle > span { top: 17px; }
.nav-toggle::after { bottom: 11px; }

.nav-drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(28, 27, 24, .42);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 82vw;
  background: var(--surface);
  z-index: 91;
  transform: translateX(-100%);
  transition: transform .22s ease;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  box-shadow: 4px 0 24px rgba(0, 0, 0, .12);
  overflow-y: auto;
}
.nav-drawer-head {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}
.nav-drawer-head .name { font-weight: 700; font-size: 15px; }
.nav-drawer-head .role { color: var(--muted); font-size: 12px; margin-top: 2px; }
.nav-drawer-nav {
  display: flex;
  flex-direction: column;
  padding: 8px 6px;
  gap: 2px;
}
.nav-drawer-nav a {
  color: var(--text);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
}
.nav-drawer-nav a:hover { background: #f0eee8; }
.nav-drawer-nav a.active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}
.nav-drawer-foot {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface-soft);
}
.nav-drawer-foot button {
  width: 100%;
  height: 38px;
}
body.nav-open { overflow: hidden; }
body.nav-open .nav-drawer { transform: translateX(0); }
body.nav-open .nav-drawer-mask {
  opacity: 1;
  pointer-events: auto;
}

.mobile-back {
  display: none;
  align-items: center;
  gap: 4px;
  margin-bottom: 10px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  width: fit-content;
}
.mobile-back:hover { background: #f0eee8; color: var(--text); }
.mobile-back::before { content: "‹"; font-size: 16px; line-height: 1; }

@media (max-width: 760px) {
  body { font-size: 14px; }

  .nav-toggle { display: inline-flex; }

  .topbar {
    height: 52px;
    padding: 0 10px;
    gap: 8px;
  }
  .brand { font-size: 15px; }
  .topbar .nav { display: none; }
  .top-actions { gap: 6px; margin-left: auto; }
  .user-menu { gap: 4px; }
  .user-menu > span { display: none; }
  .user-menu button { padding: 6px 9px; font-size: 12px; }

  .page { padding: 10px; }

  /* 档案库：列表 / 详情 切单栏 */
  .ledger-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
    min-height: 0;
    gap: 0;
  }
  .pane-resizer { display: none; }
  .left-pane,
  .right-pane { border-radius: 8px; }
  body:not(.mobile-detail) .right-pane { display: none; }
  body.mobile-detail .left-pane { display: none; }
  .mobile-back { display: inline-flex; }

  .left-pane .filters { padding: 10px; gap: 6px; }
  .project-list { padding: 8px; gap: 6px; }
  .project-card { padding: 10px; }

  .detail-header { padding: 12px 12px 10px; }
  .detail-title-line { flex-wrap: wrap; gap: 6px; }
  .detail-title-line h2 { font-size: 17px; }
  .detail-body { padding: 12px 12px 18px; }
  .meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .meta-cell { padding: 6px 8px; }

  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: 1; }

  .stats-grid { grid-template-columns: 1fr 1fr; padding: 10px; gap: 8px; }
  .stat { padding: 10px 12px; }
  .stat .value { font-size: 22px; }
  .profile-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .profile-metric { padding: 8px; }
  .profile-metric .value { font-size: 16px; }

  .filters { grid-template-columns: 1fr; }
  .table-filters { grid-template-columns: 1fr; padding: 10px; }

  .page-head { padding: 10px 12px; gap: 8px; }
  .page-head h1 { font-size: 16px; }

  .admin-layout { grid-template-columns: 1fr; padding: 10px; gap: 10px; }
  .admin-form-panel { padding: 10px; }

  .help-content { padding: 12px; }
  .help-kv { grid-template-columns: 1fr; }
  .help-kv > div { padding: 8px 10px; }
  .help-section,
  .help-card { padding: 12px; }

  .contrib-layout { grid-template-columns: 1fr; gap: 10px; margin-top: 8px; }
  .contrib-side { padding: 10px; }
  .contrib-main { padding: 10px; }
  .field-edit-row { grid-template-columns: 1fr; gap: 4px; }

  .login-panel { padding: 22px; }
  .login-panel h1 { font-size: 19px; }

  /* 模态：全屏 */
  .modal {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    transform: none;
    left: 0;
    top: 0;
  }
  .modal-mask { display: none; }
  .modal-body { padding: 14px; }
  .modal-head { padding: 12px 14px; }

  /* Toast：底部居中 */
  .toast-wrap {
    top: auto;
    bottom: 14px;
    right: 12px;
    left: 12px;
    align-items: stretch;
  }
  .toast { max-width: 100%; min-width: 0; }

  /* 响应式表：转卡片视图 */
  table.responsive-table { width: 100%; }
  table.responsive-table thead { display: none; }
  table.responsive-table,
  table.responsive-table tbody,
  table.responsive-table tr,
  table.responsive-table td {
    display: block;
    width: 100%;
  }
  table.responsive-table tbody { display: block; }
  table.responsive-table tr {
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 6px 10px;
  }
  table.responsive-table td {
    border: none;
    padding: 5px 0;
    background: transparent;
    display: flex;
    gap: 8px;
    align-items: baseline;
  }
  table.responsive-table tr:hover td { background: transparent; }
  table.responsive-table td::before {
    content: attr(data-label);
    flex: 0 0 5.5em;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
  }
  table.responsive-table td.subject-cell,
  table.responsive-table td.progress-cell {
    display: block;
    white-space: normal;
  }
  table.responsive-table td.subject-cell::before,
  table.responsive-table td.progress-cell::before {
    display: block;
    margin-bottom: 4px;
    flex: none;
  }
  table.responsive-table td.subject-cell { font-weight: 600; font-size: 15px; }
  table.responsive-table td.progress-cell {
    background: var(--surface-soft);
    border-radius: 6px;
    padding: 8px 10px;
    margin-top: 4px;
    line-height: 1.6;
  }
  table.responsive-table tr:hover td.progress-cell { background: var(--surface-soft); }
}

@media (max-width: 420px) {
  .topbar .user-menu button { padding: 6px 7px; }
  .topbar .user-menu #btn-change-pw { display: none; }
  .stats-grid { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
  .login-panel { padding: 18px; }
  .topbar .top-actions button { padding: 6px 9px; font-size: 12px; }
}

/* ===== 贡献填报字段展示美化 ===== */
.cv-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.cv-item { background: var(--surface-soft); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; display: inline-flex; flex-direction: column; gap: 1px; min-width: 80px; }
.cv-label { font-size: 10px; color: var(--muted); }
.cv-value { font-size: 13px; font-weight: 600; color: var(--text); }
@media (max-width: 760px) {
  .cv-grid { flex-direction: column; }
  .cv-item { min-width: 0; }
}

/* ===== 策略组合模块 ===== */

.pf-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  flex: 1;
  overflow: hidden;
  padding: 14px;
}
.pf-side {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-y: auto;
  padding: 10px;
}
.pf-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pf-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  cursor: pointer;
  background: #fff;
}
.pf-card:hover { border-color: #abc9c5; }
.pf-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(40, 111, 108, .08);
}
.pf-card-title { font-weight: 650; font-size: 15px; margin-bottom: 4px; }
.pf-card-meta { color: var(--muted); font-size: 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.pf-card-pnl { margin-top: 6px; }
.pf-detail {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.pf-pnl-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.pf-pnl-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
}
.pf-pnl-item .label { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.pf-pnl-item .value { font-size: 20px; font-weight: 700; }
.pnl-up { color: var(--danger); }
.pnl-down { color: var(--ok); }
.pf-position-info { font-size: 12px; color: var(--muted); margin-top: 8px; padding: 6px 10px; background: var(--surface-soft); border-radius: 6px; display: inline-block; }
.pf-trade-toolbar { border-bottom: 1px solid var(--line); }
.pf-trade-wrap { overflow: auto; flex: 1; }
.pf-trade-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pf-trade-table th, .pf-trade-table td {
  border-bottom: 1px solid var(--line);
  padding: 7px 8px;
  text-align: left;
  white-space: nowrap;
}
.pf-trade-table th {
  position: sticky;
  top: 0;
  background: #edece7;
  font-size: 12px;
  color: #44413a;
  z-index: 1;
}
.pf-trade-table td { background: #fff; }
.pf-trade-table tr:hover td { background: #f9f8f4; }
.pf-reason-cell { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.direction-看多 { color: var(--danger); font-weight: 600; }
.direction-看空 { color: var(--ok); font-weight: 600; }
.pill.status-active { background: var(--ok-soft); color: var(--ok); }
.pill.status-archived { background: var(--surface-soft); color: var(--muted); }
.pill.bond-tag { background: var(--info-soft); color: var(--info); font-size: 10px; padding: 1px 5px; margin-left: 4px; }
.tr-like { background: none; border: none; cursor: pointer; font-size: 16px; padding: 2px 4px; vertical-align: middle; }
.like-count { font-size: 12px; color: var(--muted); vertical-align: middle; }
.readonly-field { opacity: 0.7; }
.readonly-field .auto-field {
  background: #f0f0f0;
  color: #666;
  border-color: #ddd;
  cursor: not-allowed;
}
.readonly-field textarea.auto-field {
  background: #f0f0f0;
  color: #666;
  border-color: #ddd;
  cursor: not-allowed;
  resize: none;
}

@media (max-width: 1100px) {
  .pf-layout { grid-template-columns: 1fr; }
  .pf-pnl-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
  .pf-layout { padding: 10px; gap: 10px; }
  .pf-pnl-grid { grid-template-columns: 1fr; }
  .pf-trade-table { font-size: 12px; }
  .pf-trade-table th, .pf-trade-table td { padding: 5px 6px; }
}

/* ===== 榜单展开详情 ===== */
.lb-clickable { cursor: pointer; }
.lb-clickable:hover td { background: #f0eee8; }
.lb-expand-icon { text-align: center; color: var(--muted); font-size: 11px; }
.lb-detail-row td { padding: 0 !important; background: var(--surface-soft); }
.lb-detail-inner { padding: 10px 16px; display: flex; flex-direction: column; gap: 8px; }
.lb-detail-card { background: #fff; border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; }
.lb-detail-head { display: flex; gap: 8px; align-items: center; font-size: 12px; margin-bottom: 6px; }
.lb-detail-subject { font-weight: 600; }
.lb-detail-body { display: flex; flex-wrap: wrap; gap: 4px; }
.lb-dv-item { display: inline-flex; flex-direction: column; gap: 1px; background: var(--surface-soft); border-radius: 5px; padding: 3px 7px; }
.lb-dv-label { font-size: 10px; color: var(--muted); }
.lb-dv-value { font-size: 13px; font-weight: 600; }

/* ========== 阶段6：我的项目 ========== */
.mine-page { max-width: 1000px; margin: 0 auto; padding: 20px; }
.stats-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.stats-row .stat-card { flex: 1; min-width: 120px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; text-align: center; }
.stats-row .stat-card .num { font-size: 28px; font-weight: 700; }
.stats-row .stat-card .lbl { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stats-row .stat-card.danger .num { color: var(--danger); }
.stats-row .stat-card.warn .num { color: var(--warn); }

.tab-bar { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 2px solid var(--line); }
.tab-bar .tab { padding: 8px 16px; cursor: pointer; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tab-bar .tab.active { color: inherit; font-weight: 600; border-bottom-color: var(--danger); }

.mine-card { cursor: pointer; display: flex; align-items: center; gap: 12px; }
.mine-card .card-main { flex: 1; }
.mine-card.overdue { border-left: 3px solid var(--danger); }
.btn-close-mini { white-space: nowrap; flex-shrink: 0; }

/* badge on nav */
.badge { display: inline-block; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 8px; margin-left: 4px; vertical-align: super; }

/* ========== 阶段6：看板颜色 ========== */
.team-group-header { background: var(--surface-soft); }
.team-group-header td { padding: 8px 12px !important; font-size: 13px; }
.cell-danger { background: var(--danger-soft) !important; color: var(--danger) !important; font-weight: 600; }
.cell-warn { background: var(--warn-soft) !important; color: var(--warn) !important; }
.cell-muted { background: #f0f0f0 !important; color: var(--muted) !important; }
.cell-green { color: #2a7a2a !important; font-weight: 600; }
.cell-red { color: var(--danger) !important; font-weight: 600; }
.cell-orange { color: var(--warn) !important; font-weight: 600; }

/* ========== 通知模块 ========== */
.bell-btn { position: relative; background: none; border: none; font-size: 18px; cursor: pointer; padding: 4px 8px; line-height: 1; }
.bell-btn .badge { position: absolute; top: -2px; right: -2px; font-size: 9px; padding: 1px 4px; min-width: 14px; text-align: center; }
.notif-panel { position: fixed; width: 380px; max-height: 480px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.12); z-index: 1100; display: flex; flex-direction: column; overflow: hidden; }
.notif-panel .notif-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.notif-panel .notif-head strong { font-size: 14px; }
.notif-panel .notif-head .notif-read-all { font-size: 12px; color: var(--muted); cursor: pointer; background: none; border: none; text-decoration: underline; }
.notif-panel .notif-body { flex: 1; overflow-y: auto; }
.notif-panel .notif-item { padding: 12px 14px; cursor: pointer; border-bottom: 1px solid var(--line); }
.notif-panel .notif-item:last-child { border-bottom: none; }
.notif-panel .notif-item:hover { background: var(--surface-soft); }
.notif-panel .notif-item.unread { background: #f0f7ff; }
.notif-panel .notif-item .notif-msg { font-size: 13px; line-height: 1.4; }
.notif-panel .notif-item .notif-meta { font-size: 11px; color: var(--muted); margin-top: 4px; }
.notif-panel .notif-empty { padding: 40px 14px; text-align: center; color: var(--muted); font-size: 13px; }

/* ========== 我的项目 - 操作按钮 ========== */
.mine-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
.btn-assign-mini, .btn-urge-mini { white-space: nowrap; flex-shrink: 0; padding: 4px 10px; font-size: 12px; border-radius: 4px; cursor: pointer; background: var(--surface-soft); border: 1px solid var(--line); color: inherit; }
.btn-assign-mini:hover, .btn-urge-mini:hover { background: #eee; }

/* checkbox label in modal */
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.checkbox-label input[type=checkbox] { width: auto; margin: 0; }

/* user autocomplete */
.user-autocomplete { position: relative; }
.user-autocomplete input { width: 100%; box-sizing: border-box; }
.ua-dropdown { position: absolute; top: 100%; left: 0; right: 0; z-index: 100; background: #fff; border: 1px solid var(--line); border-top: none; max-height: 240px; overflow-y: auto; display: none; border-radius: 0 0 6px 6px; box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.ua-dropdown.visible { display: block; }
.ua-item { padding: 8px 12px; cursor: pointer; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.ua-item:hover { background: var(--accent-bg); }
.ua-item .ua-sub { font-size: 11px; color: #999; }

/* multi-user select */
.multi-user-select { position: relative; border: 1px solid var(--line); border-radius: 6px; padding: 4px 4px 0 4px; background: #fff; min-height: 36px; cursor: text; }
.multi-user-select .mu-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.multi-user-select .mu-tag { display: inline-flex; align-items: center; gap: 3px; background: var(--accent-soft); color: var(--accent-strong); font-size: 12px; border-radius: 4px; padding: 2px 6px; }
.multi-user-select .mu-tag-remove { cursor: pointer; font-size: 14px; line-height: 1; color: var(--accent); margin-left: 2px; }
.multi-user-select .mu-tag-remove:hover { color: var(--danger); }
.multi-user-select input { border: none; outline: none; flex: 1; min-width: 80px; padding: 4px 6px; font-size: 13px; background: transparent; width: auto; box-sizing: border-box; display: inline-block; }
.multi-user-select .ua-dropdown { position: absolute; top: 100%; left: -1px; right: -1px; }

/* sortable table headers */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { background: #e2e0d8; }
.sort-indicator { display: inline-block; width: 16px; margin-left: 4px; font-size: 11px; color: #999; }
th.sort-asc .sort-indicator::after { content: "▲"; color: var(--accent); }
th.sort-desc .sort-indicator::after { content: "▼"; color: var(--accent); }
th.sortable .sort-indicator::after { content: "⇅"; color: #ccc; }

/* batch-lookup result bar */
.batch-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--info-soft); border-radius: 6px; margin-bottom: 8px; font-size: 13px; }
.batch-bar .back-link { cursor: pointer; text-decoration: underline; color: var(--accent); }

/* ===== 主体额度 ===== */
.row-forbidden { background: #fde8e8 !important; }
.row-forbidden td { background: transparent !important; }
tr.row-forbidden:hover td { background: #fcd5d5 !important; }
.row-reduce-only { background: #f3e8fa !important; }
.row-reduce-only td { background: transparent !important; }
tr.row-reduce-only:hover td { background: #eddaf7 !important; }

/* ===== 策略提案 ===== */
.proposal-scroll { padding: 16px; max-width: 900px; margin: 0 auto; }
.proposal-banner {
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid #ead9a8;
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 14px;
  font-size: 14px;
}
.proposal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.proposal-card.prop-need-vote { border-color: var(--warn); border-width: 2px; }
.pill.prop-public-pill { background: var(--info-soft); color: var(--info); }
.prop-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prop-title { font-size: 16px; font-weight: 600; }
.prop-meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
.prop-content { white-space: pre-wrap; margin: 10px 0; font-size: 14px; line-height: 1.6; }
.prop-vote-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; margin-bottom: 8px; }
.vote-support { background: var(--ok-soft); color: var(--ok); padding: 2px 8px; border-radius: 10px; font-size: 12px; white-space: nowrap; }
.vote-oppose { background: var(--danger-soft); color: var(--danger); padding: 2px 8px; border-radius: 10px; font-size: 12px; white-space: nowrap; }
.prop-votes { border-top: 1px dashed var(--line); padding-top: 8px; font-size: 13px; }
.prop-vote-item { padding: 3px 0; }
.prop-pending { margin-top: 6px; font-size: 13px; }
.prop-vote-box {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.prop-vote-btns { display: flex; gap: 6px; }
.prop-vote-box .prop-comment { flex: 1; min-width: 160px; }
.vote-btn { padding: 5px 14px; font-size: 13px; }
.vote-btn.selected { outline: 2px solid var(--accent); }
.vote-btn.support.selected { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.vote-btn.oppose.selected { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.prop-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.prop-actions button { padding: 4px 10px; font-size: 12px; }
.prop-comments { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.prop-comments-head { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.prop-comment-list { font-size: 13px; }
.prop-comment-item { margin: 6px 0; padding-left: 14px; border-left: 2px solid var(--line); }
.prop-comment-item[data-depth="0"] { padding-left: 0; border-left: none; }
.prop-comment-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prop-comment-head .muted { font-size: 12px; }
.prop-comment-ops { margin-left: auto; display: flex; gap: 4px; }
.prop-comment-ops button {
  padding: 1px 6px; font-size: 12px; line-height: 1.6;
  background: none; border: none; color: var(--accent); cursor: pointer;
}
.prop-comment-ops button:hover { background: none; text-decoration: underline; }
.prop-comment-ops button.danger { color: var(--danger); }
.prop-comment-content { white-space: pre-wrap; word-break: break-word; margin: 3px 0; line-height: 1.5; }
.prop-comment-edit { width: 100%; min-height: 64px; margin: 4px 0; font-size: 13px; }
.prop-comment-edit-actions { display: flex; gap: 6px; }
.prop-comment-edit-actions button { padding: 3px 10px; font-size: 12px; }
.prop-comment-box { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.prop-comment-box .prop-comment-input { flex: 1; min-width: 220px; }
