﻿/* ==========================================================================
   项目资料库 · 样式
   桌面：左侧栏 + 内容区
   手机：顶部栏 + 底部标签栏，表格自动变卡片
   ========================================================================== */

:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #fafbfd;
  --border: #e4e8ef;
  --border-strong: #d3d9e4;
  --text: #16202e;
  --muted: #6b7789;
  --muted-2: #93a0b1;
  --accent: #2563eb;
  --accent-ink: #1d4ed8;
  --accent-soft: #eaf1ff;
  --ok: #0f8a5f;
  --ok-soft: #e6f6ef;
  --warn: #b45309;
  --warn-soft: #fef3e2;
  --danger: #c0392b;
  --danger-soft: #fdecea;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
  --sidebar-w: 232px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10141a;
    --surface: #171d25;
    --surface-2: #1c232d;
    --border: #262f3b;
    --border-strong: #33404f;
    --text: #e6ecf4;
    --muted: #93a0b1;
    --muted-2: #7a8798;
    --accent: #5b8cff;
    --accent-ink: #86a9ff;
    --accent-soft: #1b2740;
    --ok: #4bd39b;
    --ok-soft: #16302a;
    --warn: #f0b45c;
    --warn-soft: #33290f;
    --danger: #ff7b6b;
    --danger-soft: #3a1f1c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
code { font-family: ui-monospace, Consolas, monospace; background: var(--surface-2);
       border: 1px solid var(--border); padding: 1px 6px; border-radius: 6px; font-size: .88em; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.clip { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ============================ 登录 ============================ */
.login {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 460px at 15% -10%, rgba(37, 99, 235, .12), transparent 60%),
    radial-gradient(700px 380px at 110% 110%, rgba(15, 138, 95, .10), transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 28px 24px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-logo {
  width: 52px; height: 52px; margin: 0 auto 14px;
  display: grid; place-items: center;
  border-radius: 15px;
  background: linear-gradient(135deg, #2563eb, #1e40af);
  color: #fff; font-size: 22px; font-weight: 700;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .35);
}
.login-card h1 { font-size: 21px; }
.login-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.login-card .field { text-align: left; margin: 22px 0 16px; }
.login-hint { color: var(--muted-2); font-size: 12px; margin-top: 16px; line-height: 1.5; }
.form-err { color: var(--danger); font-size: 13px; min-height: 20px; margin-top: 10px; }

/* ============================ 布局 ============================ */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand .logo {
  width: 34px; height: 34px; flex: 0 0 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb, #1e40af);
  color: #fff; font-weight: 700; font-size: 16px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text b { font-size: 14.5px; }
.brand-text small { color: var(--muted-2); font-size: 11px; letter-spacing: .04em; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item svg { width: 18px; height: 18px; flex: 0 0 18px; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }

.sidebar-foot { margin-top: auto; padding: 12px 6px 0; border-top: 1px solid var(--border); }
.storage-mini { font-size: 12px; color: var(--muted); }
.storage-mini b { color: var(--text); font-size: 13px; }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 26px 12px;
  max-width: 1200px; width: 100%; margin: 0 auto;
}
.topbar h1 { font-size: 20px; flex: 1 1 auto; }
.topbar-actions { display: flex; gap: 8px; }

.view {
  flex: 1 1 auto;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 6px 26px 40px;
}

/* ============================ 按钮/表单 ============================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 14px; font-weight: 550;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .06s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn .ico { width: 16px; height: 16px; }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 1px 2px rgba(37, 99, 235, .3);
}
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { color: var(--danger); border-color: var(--border-strong); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }

.icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; color: var(--muted); font-weight: 550; }
input[type="text"], input[type="password"], input[type="number"], input[type="search"],
select, textarea {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 84px; padding: 10px 12px; line-height: 1.55; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ============================ 卡片/统计 ============================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  min-width: 0;
}
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h3 { font-size: 15px; flex: 1 1 auto; }
.card-head .card-sub { font-size: 12.5px; color: var(--muted); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 168px), 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  box-shadow: var(--shadow);
}
.stat-label { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 27px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; line-height: 1.15; }
.stat-value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.stat-hint { font-size: 12px; color: var(--muted-2); margin-top: 4px; }

.cols { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 16px; align-items: start; }
@media (max-width: 980px) { .cols { grid-template-columns: minmax(0, 1fr); } }

.bar-row { display: grid; grid-template-columns: 84px minmax(0, 1fr) 46px; align-items: center; gap: 10px; margin-bottom: 10px; }
.bar-label { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--border); }
.bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), #60a5fa); }
.bar-value { font-size: 12.5px; color: var(--muted); text-align: right; }

/* ---------------- 资金关键指标 ---------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpi-grid.four { grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); margin-bottom: 8px; }
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.kpi-label { font-size: 12.5px; color: var(--muted); }
.kpi-value {
  font-size: 24px; font-weight: 700; letter-spacing: -.02em;
  margin-top: 6px; line-height: 1.2;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}
.kpi-value.sm { font-size: 19px; }
.kpi-value small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.kpi-value.neg { color: var(--warn); }
.kpi-value.over { color: var(--danger); }
.kpi-value.pos { color: var(--ok); }
.kpi-hint { font-size: 12px; color: var(--muted-2); margin-top: 4px; line-height: 1.4; }

/* ---------------- 进度条 ---------------- */
.progress-line { margin: 14px 0 2px; }
.progress-head {
  display: flex; align-items: baseline; gap: 10px;
  font-size: 13px; color: var(--muted); margin-bottom: 6px;
  flex-wrap: wrap;
}
.progress-head b { font-size: 15px; color: var(--text); }
.pbar {
  height: 9px; border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
}
.pbar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #60a5fa);
  border-radius: 99px;
  transition: width .25s;
}
.pbar-mini {
  height: 5px; border-radius: 99px; background: var(--surface-2);
  border: 1px solid var(--border); overflow: hidden; margin: 2px 0 6px;
}
.pbar-mini .pbar-fill { background: linear-gradient(90deg, var(--accent), #93c5fd); }

/* ---------------- 支付节点编辑 ---------------- */
.ms-head, .ms-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) 86px 82px 34px;
  gap: 8px; align-items: center;
}
.ms-head { font-size: 12px; color: var(--muted-2); padding: 0 0 6px; }
.ms-row { margin-bottom: 8px; }
.ms-row input { height: 34px; font-size: 13px; }
.ms-row .icon-btn { width: 30px; height: 30px; font-size: 13px; color: var(--muted-2); }
.ms-row .icon-btn:hover { color: var(--danger); background: var(--danger-soft); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.applied-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; }

/* ---------------- 模板卡片 ---------------- */
.tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 10px;
}
.tpl-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: var(--surface-2);
  min-width: 0;
}
.tpl-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.tpl-head b { font-size: 14px; }
.tpl-meta { font-size: 12px; color: var(--muted); line-height: 1.6; word-break: break-word; }

/* ---------------- 支付比例方案 ---------------- */
.plan-head {
  display: flex; align-items: center; gap: 8px;
  margin-top: 16px; padding-top: 14px;
  border-top: 1px dashed var(--border);
  flex-wrap: wrap;
}
.plan-title { font-size: 13px; color: var(--muted); }
.plan-desc { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; line-height: 1.5; }
.plan-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: 10px;
  margin-top: 10px;
}
.plan-step {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 10px 12px;
  min-width: 0;
}
.plan-step.done { border-color: transparent; background: var(--ok-soft); }
.plan-step.active { border-color: var(--accent); background: var(--accent-soft); }
.plan-step.todo { opacity: .9; }
.plan-step.done .ps-meta .st { color: var(--ok); font-weight: 600; }
.plan-step.active .ps-meta .st { color: var(--accent-ink); font-weight: 600; }
.plan-step.todo .ps-meta .st { color: var(--muted-2); }
.badge-stage { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.ps-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.ps-no { font-size: 11.5px; color: var(--muted); }
.ps-head b { font-size: 16px; }
.ps-amount { font-size: 13.5px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.ps-meta { font-size: 11.5px; color: var(--muted-2); margin-top: 2px; }


/* ============================ 徽标 ============================ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 21px; padding: 0 8px;
  border-radius: 99px;
  font-size: 11.5px; font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.badge-accent { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.badge-ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.badge-warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.badge-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }

/* ============================ 工具栏/筛选 ============================ */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.search {
  position: relative; flex: 1 1 260px; min-width: 180px;
}
.search input { padding-left: 34px; }
.search svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--muted-2); pointer-events: none;
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  height: 32px; padding: 0 12px;
  display: inline-flex; align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 99px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px; font-weight: 550;
  cursor: pointer;
  font-family: inherit;
}
.chip:hover { border-color: var(--accent); color: var(--accent-ink); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ============================ 项目树 ============================ */
.level-block + .level-block { margin-top: 14px; }
.level-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  box-shadow: var(--shadow);
}
.level-head .caret { color: var(--muted-2); transition: transform .18s; font-size: 12px; }
.level-head.collapsed .caret { transform: rotate(-90deg); }
.level-name { font-weight: 650; font-size: 14.5px; flex: 1 1 auto; }
.level-meta { font-size: 12.5px; color: var(--muted); }

.year-group { margin: 8px 0 0 14px; padding-left: 14px; border-left: 2px solid var(--border); }
.year-head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 4px;
  font-size: 13px; color: var(--muted); font-weight: 600;
}
.year-head .y { color: var(--text); font-size: 13.5px; }

.project-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 10px; }
.project-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color .15s, transform .1s, box-shadow .15s;
}
.project-card:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(16,24,40,.08); }
.project-card .pname { font-weight: 600; font-size: 14.5px; line-height: 1.45; }
.project-card .pmeta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }

/* ============================ 表格 ============================ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-weight: 600; font-size: 12px; color: var(--muted);
  padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table .fname { font-weight: 550; word-break: break-word; }
.table .docno { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; color: var(--accent-ink); white-space: nowrap; }
.table .content-cell { color: var(--muted); font-size: 12.5px; max-width: 380px; }

/* 手机：表格转卡片 */
@media (max-width: 760px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    margin-bottom: 10px;
    padding: 12px;
    box-shadow: var(--shadow);
  }
  .table td { border: none; padding: 5px 0; }
  .table td::before {
    content: attr(data-label);
    display: block;
    font-size: 11.5px;
    color: var(--muted-2);
    margin-bottom: 2px;
    line-height: 1.3;
  }
  .table td[data-label=""] { padding-top: 10px; }
  .table td[data-label=""]::before { display: none; }
  .table .content-cell { max-width: none; }
  .table td .row { flex-wrap: wrap; }
  .table tr:hover { background: var(--surface); }

  /* 手机上外层卡片让位给行卡片，避免"卡片套卡片" */
  .table-card {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  .table-card .card-head { padding: 0 2px 8px; }
}

/* ============================ 列表 ============================ */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item .li-main { flex: 1 1 auto; min-width: 0; }
.list-item .li-title { font-size: 13.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.list-item .li-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.list-item .li-sub.wrap { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.45; }
.file-ico {
  width: 32px; height: 32px; flex: 0 0 32px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 10px; font-weight: 700;
  text-transform: uppercase;
}
.file-ico.pdf { background: var(--danger-soft); color: var(--danger); }
.file-ico.doc { background: var(--accent-soft); color: var(--accent-ink); }

/* ============================ 详情 ============================ */
.detail-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.detail-title { font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.35; }
.detail-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 22px;
}
.kv { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.kv .k { font-size: 12px; color: var(--muted-2); }
.kv .v { font-size: 13.5px; word-break: break-word; }
.kv .v.empty-v { color: var(--muted-2); }

/* ============================ 上传 ============================ */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 40px 20px;
  text-align: center;
  transition: border-color .15s, background .15s;
  cursor: pointer;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .dz-ico {
  width: 52px; height: 52px; margin: 0 auto 12px;
  display: grid; place-items: center;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.dropzone .dz-ico svg { width: 26px; height: 26px; }
.dropzone h3 { font-size: 15.5px; margin-bottom: 4px; }
.dropzone p { color: var(--muted); font-size: 13px; }
.dz-types { margin-top: 12px; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }

.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 14px; display: none; }
.progress.show { display: block; }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

.upload-item {
  display: flex; gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: 10px;
}
.upload-item .u-body { flex: 1 1 auto; min-width: 0; }
.upload-item .u-name { font-weight: 600; font-size: 13.5px; word-break: break-all; }
.upload-item .u-fields { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.upload-item .u-row { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; }
.upload-item .u-row b { color: var(--text); font-weight: 550; flex: 0 0 auto; }

/* ============================ 空状态 ============================ */
.empty { text-align: center; padding: 44px 16px; color: var(--muted); }
.empty-ico { font-size: 30px; margin-bottom: 8px; opacity: .6; }
.empty h4 { font-size: 15px; color: var(--text); margin-bottom: 4px; }
.empty p { font-size: 13px; }

/* ============================ 底部导航（手机） ============================ */
.mobile-nav { display: none; }
@media (max-width: 860px) {
  .sidebar { display: none; }
  .only-mobile { display: grid !important; }
  .topbar { padding: 12px 14px 8px; position: sticky; top: 0; z-index: 20;
            background: color-mix(in srgb, var(--bg) 88%, transparent);
            backdrop-filter: saturate(140%) blur(8px); }
  .topbar h1 { font-size: 17px; }
  .view { padding: 4px 14px calc(84px + env(safe-area-inset-bottom)); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi-grid, .kpi-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; }
  .kpi-value { font-size: 19px; }
  .kpi-value.sm { font-size: 16px; }
  .stat-value { font-size: 22px; }
  .project-list { grid-template-columns: 1fr; }
  .year-group { margin-left: 6px; padding-left: 10px; }
  .detail-title { font-size: 18px; }

  .mobile-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: flex;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: saturate(140%) blur(10px);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .mnav-item {
    flex: 1 1 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    padding: 8px 2px 6px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 550;
    min-height: 52px;
  }
  .mnav-item svg { width: 21px; height: 21px; }
  .mnav-item.active { color: var(--accent-ink); }
  .mnav-item.active svg { transform: translateY(-1px); }
}
.only-mobile { display: none; }

/* 返回按钮：只在手机的项目详情里出现 */
#btn-back { display: none; }
@media (max-width: 860px) {
  #btn-back { display: grid; }
  #btn-back.off { display: none !important; }
  .desktop-only { display: none !important; }
}

/* ============================ 弹窗 ============================ */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(12, 18, 28, .45);
  display: grid; place-items: center;
  padding: 18px;
  animation: fade .16s ease;
}
.modal {
  width: 100%; max-width: 560px;
  max-height: 88vh; overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  animation: pop .18s ease;
}
.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface);
}
.modal-head h3 { flex: 1 1 auto; font-size: 15.5px; }
.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  position: sticky; bottom: 0; background: var(--surface);
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.99) } to { opacity: 1; transform: none } }

/* ============================ 提示条 ============================ */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  z-index: 200;
  max-width: min(92vw, 460px);
  padding: 10px 16px;
  border-radius: 11px;
  background: #16202e;
  color: #fff;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #b3261e; }
.toast.ok { background: #0f6b4b; }
@media (max-width: 860px) { .toast { bottom: calc(76px + env(safe-area-inset-bottom)); } }

/* ============================ 加载 ============================ */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg) } }
.loading-row { display: flex; align-items: center; justify-content: center; gap: 10px;
               padding: 40px; color: var(--muted); font-size: 13px; }

/* ============================ 杂项 ============================ */
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { flex-wrap: wrap; }
.spacer { flex: 1 1 auto; }
.hr { height: 1px; background: var(--border); margin: 14px 0; border: 0; }
.tag-soft { font-size: 12px; color: var(--muted); background: var(--surface-2);
            border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px; }
.file-size { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12.5px; }
.u-name, .fname, .kv .v, .detail-title { overflow-wrap: anywhere; }
a.plain { color: inherit; }
a.plain:hover { color: var(--accent-ink); }

/* 第三方单位（设计/监理/施工） */
.party-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.party { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface-2, #f8fafc); font-size: 13px; }
.party b { color: var(--primary); font-weight: 600; }
.party-name { font-weight: 500; }
.party-amount { color: var(--muted); }
.check-line { display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
  color: var(--muted); white-space: nowrap; }
.check-line input { width: auto; }
@media (max-width: 640px) {
  .party { width: 100%; }
}

/* 详情页工具栏：手机上换行，避免按钮被挤出屏幕 */
@media (max-width: 640px) {
  .detail-actions { flex-wrap: wrap; row-gap: 8px; }
  .detail-actions .btn { flex: 0 0 auto; }
}

/* 打印时隐藏详情页操作栏 */
@media print {
  .detail-actions { display: none !important; }
}

/* ---------------- PDF 图片预览 ---------------- */
.pdf-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  max-width: 900px; margin: 0 auto 10px; font-size: 13px; color: var(--muted);
}
.pdf-viewer { max-width: 900px; margin: 0 auto; }
.pdf-page {
  display: block; width: 100%; height: auto; background: #fff;
  border: 1px solid var(--border); border-radius: 6px;
  margin: 0 auto 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

/* ---------------- 手机端：按钮网格化，避免错位 ---------------- */
@media (max-width: 640px) {
  /* 详情页顶部工具栏：两列等宽，最后一个占满 */
  .detail-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px !important;
  }
  .detail-actions .btn {
    width: 100%; min-height: 38px; justify-content: center;
    font-size: 13px;
  }
  .detail-actions .btn:last-child { grid-column: 1 / -1; }

  /* 文件操作按钮：四列等宽，点按区域够大，样式统一 */
  .table td[data-label=""] .row {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px !important;
  }
  .table td[data-label=""] .btn {
    width: 100%; min-height: 36px; justify-content: center;
    font-size: 13px; padding: 0 4px;
  }
  .table td[data-label=""] .btn-ghost {
    border: 1px solid var(--border); background: var(--surface);
  }

  /* 底部固定导航不要压住最后一张卡片 */
  #view { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }

  /* 阅读页工具栏也换成网格 */
  .pdf-bar .btn { min-height: 34px; }
}

/* 第三方单位：标题行 + 一个修改按钮 */
.party-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.party-head .k { font-size: 12px; color: var(--muted-2); }
.party-edit { border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; margin-bottom: 10px; background: var(--surface-2); }
.party-edit:last-child { margin-bottom: 0; }
.badge-muted { background: var(--surface-2); color: var(--muted); }

/* 概览两栏等高，避免错位 */
.overview-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px; align-items: stretch; }
.overview-cols > .card { height: 100%; display: flex; flex-direction: column; }
@media (max-width: 860px) { .overview-cols { grid-template-columns: 1fr; } }

/* 手机端详情工具栏：两列，隐藏用于撑开的 spacer */
@media (max-width: 640px) {
  .detail-actions .spacer { display: none; }
  .detail-actions .btn { min-height: 42px; }
  .detail-actions .desktop-only { display: none !important; }
  .party-edit .form-grid { gap: 8px; }
}

/* 状态页 */
.quota-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.quota-num { font-size: 30px; font-weight: 700; letter-spacing: -.5px; }
.quota-sub { font-size: 12.5px; color: var(--muted); }
.quota-bar { height: 10px; border-radius: 999px; background: var(--surface-2);
  overflow: hidden; margin: 10px 0 16px; }
.quota-fill { height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #6aa8ff); transition: width .3s; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px; }
.stat { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  background: var(--surface-2); }
.stat span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.stat b { font-size: 16px; font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 6px; vertical-align: middle; }
.dot-on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot-off { background: var(--danger, #d9534f); }
@media (max-width: 640px) { .quota-num { font-size: 24px; } }

.page-head-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }

/* 网格内的卡片不要额外上边距（否则两栏会错位） */
.cols > .card + .card,
.overview-cols > .card + .card { margin-top: 0; }

/* 项目卡：进度条与底部信息压到卡片底部，多行/少行都对齐 */
.project-card .pbar-mini { margin-top: auto; }

/* 登录页超时提示 */
.login-timeout {
  margin: 10px 0 0; padding: 8px 10px; border-radius: 8px;
  background: var(--warn-soft, #fff7e6); color: #b45309;
  font-size: 12.5px; line-height: 1.5; text-align: center;
}
.login-timeout.off { display: none; }

/* 列表标题最多两行（长项目名不丢信息） */
.list-item .li-title.clamp2 {
  white-space: normal; overflow: hidden; text-overflow: clip;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  line-height: 1.45;
}
.list-item { align-items: flex-start; }
.list-item .badge { flex: 0 0 auto; margin-top: 1px; }


/* 年度标题与下方项目卡片之间留出间距（原来贴在一起） */
.level-head + .level-body { margin-top: 10px; }
.level-head.collapsed + .level-body { display: none; }

/* 文件表格：窄屏隐藏「建设内容」列，保证标题/项目有足够宽度 */
.table .docno { display: block; max-width: 100%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.table th:nth-child(3), .table td:nth-child(3) { min-width: 160px; max-width: 210px; }

@media (min-width: 861px) and (max-width: 1399px) {
  .table th:nth-child(4), .table td:nth-child(4) { display: none; }
}
@media (min-width: 861px) {
  .table { min-width: 720px; }
  .table th:nth-child(1), .table td:nth-child(1) { width: 116px; max-width: 116px; }
  .table th:nth-child(2), .table td:nth-child(2) { min-width: 190px; }
  .table th:nth-child(5), .table td:nth-child(5) { width: 84px; }
}

/* ==================================================================
   统一版式 v2（2026-11-16）
   目标：一致的间距节奏、卡片等高、更舒展的留白
   ================================================================== */
:root {
  --space-1: 6px;
  --space-2: 10px;
  --space-3: 14px;
  --space-4: 18px;
  --space-5: 24px;
  --card-pad: 20px;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 14px rgba(16, 24, 40, .05);
}

/* ---------- 页面留白 ---------- */
.topbar { padding: 22px 28px 14px; }
.view { padding: 8px 28px 56px; }

/* ---------- 卡片 ---------- */
.card {
  padding: var(--card-pad);
  box-shadow: var(--shadow-card);
  border-radius: 16px;
}
.card-head { margin-bottom: var(--space-4); gap: 12px; }
.card-head h3 { font-size: 15.5px; letter-spacing: -.01em; }

/* ---------- 网格与区块间距 ---------- */
.kpi-grid,
.kpi-grid.four,
.stats-grid {
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.kpi-grid.four { margin-bottom: var(--space-5); }

.cols {
  gap: var(--space-4);
  align-items: stretch;
}
.cols > .card {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.cols > .card > .card-head { flex: 0 0 auto; }

.toolbar { margin-bottom: var(--space-4); }
.note { margin-top: var(--space-3); }
.level-block + .level-block { margin-top: var(--space-4); }
.level-head + .level-body { margin-top: var(--space-3); }

/* ---------- KPI 数字 ---------- */
.kpi { padding: 16px 18px; border-radius: 14px; }
.kpi-value { font-size: 26px; }

/* ---------- 表格 ---------- */
.table-card { padding: 4px 10px; }
.table th { padding: 12px; }
.table td { padding: 14px 12px; }
.table tbody tr:first-child td { padding-top: 10px; }

/* ---------- 列表 ---------- */
.list-item { padding: var(--space-3) 4px; gap: var(--space-3); }

/* ---------- 按钮与输入 ---------- */
.btn { border-radius: 10px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
input[type="text"], input[type="search"], input[type="password"],
input[type="number"], input[type="date"], select, textarea { border-radius: 10px; }

/* ---------- 状态页 ---------- */
.quota-bar { margin: 12px 0 20px; }
.stat-grid { gap: var(--space-3); }
.stat { padding: 12px 14px; border-radius: 12px; }

/* ---------- 移动端 ---------- */
@media (max-width: 860px) {
  .topbar { padding: 14px 14px 10px; }
  .view { padding: 4px 14px 92px; }
  .card { padding: 16px 14px; border-radius: 14px; }
  .kpi-grid, .kpi-grid.four, .stats-grid { gap: 10px; margin-bottom: 16px; }
  .cols { gap: var(--space-3); }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 22px; }
  .card-head { margin-bottom: 12px; }
  .table-card { padding: 4px 6px; }
}

/* 宽屏下文号列放宽，少截断 */
@media (min-width: 1200px) {
  .table th:nth-child(1), .table td:nth-child(1) { width: 150px; max-width: 150px; }
}
