/* ============================================================
   杭州柏年项目实施管理系统 - 样式
   ============================================================ */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }

:root {
  --c-bg: #f4f6fb;
  --c-bg-soft: #eef2f7;
  --c-panel: #ffffff;
  --c-text: #1e293b;
  --c-text-soft: #475569;
  --c-muted: #94a3b8;
  --c-border: #e2e8f0;
  --c-border-soft: #eef2f7;
  --c-primary: #2563eb;
  --c-primary-hover: #1d4ed8;
  --c-primary-soft: #eff6ff;
  --c-success: #059669;
  --c-success-soft: #ecfdf5;
  --c-warn: #d97706;
  --c-warn-soft: #fffbeb;
  --c-danger: #dc2626;
  --c-danger-soft: #fef2f2;
  --c-info: #6366f1;
  --c-info-soft: #eef2ff;
  --c-slate-900: #0f172a;
  --c-slate-800: #1e293b;
  --c-slate-700: #334155;
  --c-slate-600: #475569;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 40px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(15, 23, 42, 0.08);
  --t: .18s ease;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI",
    "Helvetica Neue", Roboto, Arial, sans-serif;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-tap-highlight-color: transparent;
  font-size: 15px;
  line-height: 1.55;
}

a { color: var(--c-primary); text-decoration: none; transition: color var(--t); }
a:hover { color: var(--c-primary-hover); text-decoration: none; }

/* ===== Buttons ===== */
button, .btn {
  background: var(--c-primary);
  color: #fff;
  border: 1px solid var(--c-primary);
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  transition: background var(--t), border-color var(--t), transform var(--t), box-shadow var(--t);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  margin-right: 0; /* 容器自管 gap */
}
button:hover, .btn:hover { background: var(--c-primary-hover); border-color: var(--c-primary-hover); }
button:active, .btn:active { transform: translateY(1px); }
button[disabled], .btn[disabled] { background: #cbd5e1; border-color: #cbd5e1; cursor: not-allowed; opacity: .8; }
button.ghost, .btn.ghost { background: #fff; color: var(--c-primary); border-color: #cbd5e1; }
button.ghost:hover, .btn.ghost:hover { background: var(--c-primary-soft); border-color: var(--c-primary); color: var(--c-primary-hover); }
button.danger, .btn.danger { background: var(--c-danger); border-color: var(--c-danger); }

/* 按钮组：让多个按钮横向排开、有间隔 */
.actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.actions > * + * { margin-left: 0; } /* 防止重复 gap */

/* 表格里的操作列 */
table .actions-cell { white-space: nowrap; }
table .actions-cell .small { margin-right: 6px; }
table .actions-cell .small:last-child { margin-right: 0; }
button.danger:hover, .btn.danger:hover { background: #b91c1c; border-color: #b91c1c; }
button.danger.ghost { background: #fff; color: var(--c-danger); border-color: #fecaca; }
button.danger.ghost:hover { background: var(--c-danger-soft); border-color: var(--c-danger); }
button.small, .btn.small { padding: 6px 12px; font-size: 13.5px; border-radius: 5px; margin-right: 0; }

/* ===== Inputs ===== */
input, select, textarea {
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 15px;
  width: 100%;
  background: #fff;
  color: var(--c-text);
  transition: border-color var(--t), box-shadow var(--t);
  font-family: inherit;
}
input:hover, select:hover, textarea:hover { border-color: #c7d2fe; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}
textarea { resize: vertical; min-height: 64px; }

label.field { display: block; margin-bottom: 14px; }
label.field > span {
  display: block;
  font-size: 14px;
  color: var(--c-text-soft);
  margin-bottom: 6px;
  font-weight: 500;
}

/* ===== Tables ===== */
table.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--c-border-soft);
}
table.tbl th, table.tbl td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--c-border-soft);
  vertical-align: middle;
  font-size: 14.5px;
}
table.tbl th {
  background: #f8fafc;
  color: var(--c-slate-600);
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: .02em;
  text-transform: uppercase;
}
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr { transition: background var(--t); }
table.tbl tbody tr:hover { background: #f8fafc; }
table.tbl.clickable tbody tr { cursor: pointer; transition: background var(--t), transform var(--t); }
table.tbl.clickable tbody tr:hover { background: #eff6ff; }
table.tbl.clickable tbody tr:active { transform: translateY(1px); }

/* ===== Status pills ===== */
.status {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}
.status.planning { background: var(--c-info-soft); color: #4338ca; }
.status.in_progress { background: var(--c-warn-soft); color: #b45309; }
.status.completed { background: var(--c-success-soft); color: #047857; }
.status.pending { background: var(--c-info-soft); color: #4338ca; }
.status.submitted { background: var(--c-warn-soft); color: #b45309; }
.status.rejected { background: var(--c-danger-soft); color: #b91c1c; }

/* ===== Layout (sidebar + content) ===== */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: #cbd5e1;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: 2px 0 12px rgba(15, 23, 42, .06);
}
.sidebar-brand {
  padding: 18px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar-brand h1 {
  font-size: 16px;
  color: #fff;
  margin: 0 0 4px;
  font-weight: 600;
  letter-spacing: .02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-brand h1::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #60a5fa, #2563eb);
  box-shadow: 0 0 8px rgba(96, 165, 250, .6);
}
.sidebar-brand p {
  margin: 0;
  font-size: 12.5px;
  color: #64748b;
  letter-spacing: .04em;
}

.sidebar-menu { flex: 1; padding: 10px 8px; overflow-y: auto; }
.menu-item {
  padding: 10px 14px;
  margin: 2px 0;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 14.5px;
  color: #cbd5e1;
  transition: background var(--t), color var(--t), transform var(--t);
  display: flex;
  align-items: center;
  gap: 10px;
}
.menu-item:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}
.menu-item.active {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, .3);
}

.sidebar-user {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 14px 16px;
  background: rgba(0, 0, 0, .15);
}
.sidebar-user .label { font-size: 12px; color: #64748b; margin-bottom: 4px; }
.sidebar-user .name { color: #fff; font-weight: 600; font-size: 15px; line-height: 1.3; word-break: break-all; }
.sidebar-user .role { color: #94a3b8; font-size: 13px; margin-top: 2px; }
.sidebar-user .actions { display: flex; gap: 6px; margin-top: 12px; }

/* ===== Content ===== */
.content { flex: 1; padding: 26px 30px 60px; min-width: 0; }
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 10px;
}
.page-header h2 {
  margin: 0;
  font-size: 23px;
  font-weight: 600;
  color: var(--c-slate-900);
}
.page-header .muted { margin-top: 4px; }

.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 18px;
}
.toolbar > .grow { flex: 1; }
.toolbar input, .toolbar select { max-width: 280px; }

/* ===== Cards ===== */
.card {
  background: #fff;
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
  border: 1px solid var(--c-border-soft);
}
.card.soft { background: #f8fafc; border-color: transparent; box-shadow: none; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
}
.card-head h3 { margin: 0; font-size: 16px; font-weight: 600; color: var(--c-slate-900); }

/* ===== Stats ===== */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  background: #fff;
  padding: 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--c-border-soft);
  position: relative;
  overflow: hidden;
  transition: transform var(--t), box-shadow var(--t);
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent, var(--c-primary));
}
.stat .label { color: var(--c-text-soft); font-size: 14px; margin-bottom: 6px; }
.stat .value { font-size: 27px; font-weight: 700; color: var(--c-slate-900); line-height: 1.2; }

/* ===== KV editor rows ===== */
.kv-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; flex-wrap: wrap; }
.kv-row > input.k { flex: 1; min-width: 160px; }
.kv-row > .vt { width: 140px; }
.kv-row > button { white-space: nowrap; }

/* ===== Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  animation: modal-fade .18s ease;
}
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
.modal .panel {
  background: #fff;
  width: 600px;
  max-width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-pop .22s cubic-bezier(.2,.7,.3,1.2);
}
@keyframes modal-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal .panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--c-border-soft);
  background: #fbfcfd;
  flex-shrink: 0;
}
.modal .panel-header h3 { margin: 0; font-size: 17px; font-weight: 600; color: var(--c-slate-900); }
.modal .panel-close {
  background: transparent;
  color: var(--c-muted);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  padding: 0;
  font-size: 19px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t), color var(--t);
}
.modal .panel-close:hover { background: var(--c-danger-soft); color: var(--c-danger); }
.modal .panel-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.modal .actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 22px;
  border-top: 1px solid var(--c-border-soft);
  background: #fbfcfd;
  flex-shrink: 0;
}

/* ===== Image Lightbox ===== */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .82);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: modal-fade .18s ease;
}
.lightbox .lb-body {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 96vw;
  max-height: 82vh;
}
.lightbox img {
  display: block;
  max-width: 96vw;
  max-height: 82vh;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .4);
  background: #fff;
  object-fit: contain;
}
.lightbox .lb-tools {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #f1f5f9;
  font-size: 14px;
  max-width: 96vw;
}
.lightbox .lb-tools .lb-name {
  max-width: 50vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #cbd5e1;
}
.lightbox .lb-close {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .15);
  font-size: 23px;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t), color var(--t);
}
.lightbox .lb-close:hover { background: var(--c-danger); border-color: var(--c-danger); color: #fff; }

.thumb-btn {
  cursor: zoom-in;
  border: none;
  padding: 0;
  background: transparent;
  display: inline-block;
}
.thumb-btn:hover img { transform: scale(1.05); }

/* ===== Toast ===== */
#toast {
  position: fixed;
  left: 50%;
  top: 24px;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
#toast > div {
  background: var(--c-slate-900);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
  animation: toast-in .25s ease;
  max-width: 80vw;
}
#toast > div.err { background: var(--c-danger); }
#toast > div.success { background: var(--c-success); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ===== Misc ===== */
.thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--c-border);
  transition: transform var(--t), box-shadow var(--t);
}
.thumb.large { width: 160px; height: 160px; }
.thumb:hover { transform: scale(1.05); box-shadow: 0 4px 14px rgba(15, 23, 42, .15); }
.file-link { color: var(--c-primary); word-break: break-all; }
.file-link:hover { text-decoration: underline; }

.progress-bar {
  height: 8px;
  background: var(--c-border-soft);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
  transition: width .4s ease;
}

.boot { padding: 80px 20px; text-align: center; color: var(--c-muted); }

/* ===== Login ===== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 20% 20%, rgba(37, 99, 235, .35), transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(99, 102, 241, .35), transparent 45%),
    linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
}
.login-card {
  background: #fff;
  padding: 36px 32px;
  border-radius: var(--radius-lg);
  width: 380px;
  max-width: 100%;
  box-shadow: 0 25px 60px rgba(0, 0, 0, .25);
}
.login-card .brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 21px;
  margin-bottom: 18px;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .35);
}
.login-card h1 { margin: 0 0 4px; font-size: 21px; color: var(--c-slate-900); }
.login-card > p { margin: 0 0 24px; color: var(--c-muted); font-size: 14px; }
.login-card button { width: 100%; padding: 10px; margin-top: 4px; }
.login-card .hint { margin-top: 16px; text-align: center; }

/* ===== Utilities ===== */
.row { display: flex; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.muted { color: var(--c-muted); font-size: 13px; }
.danger-text { color: var(--c-danger); }
.empty-state {
  text-align: center;
  padding: 36px 16px;
  color: var(--c-muted);
}
.empty-state .icon { font-size: 33px; margin-bottom: 8px; opacity: .5; }

/* ===== Pagination ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 14px;
  padding: 4px 0;
  flex-wrap: wrap;
}
.pagination .page-info {
  color: var(--c-muted);
  font-size: 14px;
  margin-right: auto;
  padding: 0 8px;
}
.pagination .page-info b { color: var(--c-text); font-weight: 600; }
.pagination button {
  min-width: 34px;
  padding: 6px 10px;
  font-size: 14px;
}
.pagination button[disabled] {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: var(--c-muted);
  cursor: not-allowed;
}
.pagination .page-jumper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--c-text-soft);
  font-size: 14px;
}
.pagination .page-jumper input {
  width: 60px;
  padding: 6px 8px;
  text-align: center;
}

/* Log specific */
.log-action-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 500;
  background: var(--c-primary-soft);
  color: var(--c-primary-hover);
}
.log-action-tag.success { background: var(--c-success-soft); color: #047857; }
.log-action-tag.warn { background: var(--c-warn-soft); color: #b45309; }
.log-action-tag.danger { background: var(--c-danger-soft); color: var(--c-danger); }
.log-status-ok { color: #047857; }
.log-status-fail { color: var(--c-danger); }

/* ===== Project Detail Header — 紧凑版 ===== */
.project-head { padding: 14px 18px; }
.project-head .ph-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.project-head .ph-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--c-primary), #6366f1);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
}
.project-head .ph-title {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.project-head .ph-title h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  color: var(--c-slate-900);
  line-height: 1.3;
}
.project-head .ph-title .ph-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  font-size: 13.5px;
  color: var(--c-text-soft);
}
.project-head .ph-title .ph-contract {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.project-head .ph-title .ph-contract code {
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--c-text);
  font-family: inherit;
}
.project-head .ph-title .ph-desc-inline {
  color: var(--c-text-soft);
  white-space: pre-wrap;
  line-height: 1.55;
  word-break: break-word;
}
.project-head .ph-status { flex-shrink: 0; }
.project-head .ph-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px 18px;
  margin: 0;
  padding: 8px 12px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid var(--c-border-soft);
}
.project-head .ph-grid .field-mini label {
  font-size: 12px;
  color: var(--c-muted);
  display: block;
  margin-bottom: 2px;
  letter-spacing: .02em;
}
.project-head .ph-grid .field-mini span {
  font-size: 14px;
  color: var(--c-text);
  font-weight: 500;
  word-break: break-word;
  line-height: 1.4;
}
.project-head .ph-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.project-head .ph-progress .bar { flex: 1; min-width: 200px; }
.project-head .ph-progress .meta {
  font-size: 13px;
  color: var(--c-text-soft);
  white-space: nowrap;
}
.project-head .ph-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== Node Item Filler（节点详情内联填值） ===== */
.node-item {
  background: #f8fafc;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--c-border-soft);
  margin-bottom: 10px;
}
.node-item .ni-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 14.5px;
}
.node-item .ni-head .ni-key {
  font-weight: 600;
  color: var(--c-slate-900);
}
.node-item .ni-head .ni-type {
  font-size: 12px;
  color: var(--c-muted);
  padding: 1px 6px;
  background: #eef2f7;
  border-radius: 4px;
}
.node-item .ni-head .ni-state {
  margin-left: auto;
  font-size: 13px;
}
.node-item .ni-input textarea,
.node-item .ni-input input[type="file"] {
  width: 100%;
}
.node-item .ni-input .ni-current {
  margin-top: 8px;
  font-size: 13px;
  color: var(--c-text-soft);
  background: #fff;
  border-radius: 6px;
  padding: 6px 10px;
  border: 1px dashed var(--c-border);
  word-break: break-word;
  white-space: pre-wrap;
}
.node-item .ni-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}
.node-item .ni-saved {
  font-size: 13px;
  color: #047857;
}

/* 视图态：照片行 — 左缩略图，右查看大图 + 下载两按钮 */
.node-item .ni-photo-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.node-item .ni-photo-row .thumb {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--c-border);
}
.node-item .ni-photo-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}
.node-item .ni-photo-actions .small { padding: 4px 10px; font-size: 13px; }
.node-item .ni-photo-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

/* 视图态：文件行 — 文件名 + 下载按钮 */
.node-item .ni-file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
}
.node-item .ni-file-row .ni-file-name {
  flex: 1;
  font-size: 14.5px;
  color: var(--c-text);
  word-break: break-all;
}
.node-item .ni-file-row .small { padding: 4px 10px; font-size: 13px; }

/* 视图态：纯文字展示，去掉任何边框/底色 */
.node-item .ni-view .ni-current {
  font-size: 14.5px;
  color: var(--c-text);
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
}

/* ===== History（紧凑横向 chip） ===== */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid var(--c-border-soft);
  font-size: 14px;
  line-height: 1.5;
}
.history-item .h-time {
  color: var(--c-muted);
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
}
.history-item .h-action {
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 13px;
  background: var(--c-primary-soft);
  color: var(--c-primary-hover);
  flex-shrink: 0;
}
.history-item .h-action.value_updated { background: #ecfeff; color: #0e7490; }
.history-item .h-action.submitted    { background: var(--c-warn-soft); color: #b45309; }
.history-item .h-action.approved     { background: var(--c-success-soft); color: #047857; }
.history-item .h-action.rejected     { background: var(--c-danger-soft); color: #b91c1c; }
.history-item .h-action.withdrawn    { background: var(--c-info-soft); color: #4338ca; }
.history-item .h-user {
  font-weight: 500;
  color: var(--c-slate-900);
  flex-shrink: 0;
}
.history-item .h-notes {
  color: var(--c-text-soft);
  flex: 1;
  word-break: break-word;
}

/* 表单项 view/edit 切换：编辑态显隐 */
.node-item .ni-view[hidden],
.node-item .ni-editor[hidden] { display: none; }
.node-item .ni-view { margin-top: 4px; }
.node-item .ni-editor { margin-top: 4px; }
.node-item .ni-editor textarea,
.node-item .ni-editor input[type="file"] { width: 100%; }

/* Misc */
.card h3 { margin-top: 0; }

/* 返回链接 / 面包屑样式 */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--c-text-soft);
  background: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--c-border);
  text-decoration: none;
  transition: background var(--t), color var(--t), border-color var(--t), box-shadow var(--t);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.back-link:hover {
  background: var(--c-primary-soft);
  color: var(--c-primary-hover);
  border-color: var(--c-primary);
  text-decoration: none;
}
.back-link .back-icon {
  display: inline-flex;
  width: 18px; height: 18px;
  align-items: center; justify-content: center;
  background: var(--c-primary-soft);
  color: var(--c-primary);
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
}

/* 施工日志紧凑表 */
.logs-table th,
.logs-table td { padding: 8px 12px; line-height: 1.5; }
.logs-table tbody tr td:nth-child(3) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 0;
}

/* 施工日志详情弹窗：极简单行 + 紧凑 */
.log-detail { font-size: 14.5px; }
.log-detail .log-detail-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13.5px;
  color: var(--c-muted);
  margin-bottom: 8px;
}
.log-detail .log-detail-head .ld-user {
  color: var(--c-slate-900);
  font-weight: 600;
}
.log-detail .log-detail-head .ld-dot { color: var(--c-border); }
.log-detail .log-detail-head .ld-project {
  color: var(--c-primary);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
}
.log-detail .log-detail-head .ld-project:hover {
  border-bottom-color: var(--c-primary);
}
.log-detail .log-detail-content {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
  color: var(--c-text);
  font-size: 15px;
}
.log-detail .log-detail-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--c-border);
}
.log-detail .log-detail-files .ld-thumb {
  padding: 0;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  background: #f8fafc;
}
.log-detail .log-detail-files .ld-thumb .thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 5px;
  border: 0;
}
.log-detail .log-detail-files .ld-file-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  padding: 4px 0;
}
.log-detail .log-detail-files .ld-filename {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  color: var(--c-text);
  word-break: break-all;
  line-height: 1.4;
}
.log-detail .log-detail-files .ld-dl-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  font-size: 13.5px;
  color: #fff;
  background: var(--c-primary);
  border: 1px solid var(--c-primary);
  border-radius: 5px;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--t), border-color var(--t);
}
.log-detail .log-detail-files .ld-dl-btn:hover {
  background: var(--c-primary-hover);
  border-color: var(--c-primary-hover);
  color: #fff;
  text-decoration: none;
}


/* ===== Responsive ===== */
@media (max-width: 880px) {
  .sidebar { width: 180px; }
  .content { padding: 20px 18px 40px; }
  .modal .panel { width: 100%; }
}

@media (max-width: 640px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    padding: 0;
  }
  .sidebar-brand { padding: 12px 16px; }
  .sidebar-brand p { display: none; }
  .sidebar-menu {
    display: flex;
    overflow-x: auto;
    padding: 6px 8px;
    gap: 4px;
  }
  .sidebar-user { display: none; }
  .menu-item {
    padding: 8px 14px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .content { padding: 14px; }
  .page-header h2 { font-size: 19px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 14px; }
  .stat .value { font-size: 23px; }
  .modal .panel { max-height: 95vh; border-radius: 12px 12px 0 0; align-self: flex-end; }
  .modal { padding: 0; align-items: flex-end; }
  .modal .panel-header { padding: 14px 16px; }
  .modal .panel-body { padding: 16px; }
  .modal .actions { padding: 12px 16px; }
}
