:root {
  --bg: #eef2f7;
  --panel: #ffffff;
  --line: #d9e1ec;
  --text: #1f2a37;
  --muted: #6b7280;
  --brand: #0b5fd7;
  --brand-2: #1f8f6f;
  --accent: #f48c06;
  --danger: #d64545;
  --warning: #cc8b00;
  --success: #1f8f6f;
  --info: #0b5fd7;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 24px 56px rgba(15, 23, 42, 0.15);
  --radius: 22px;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", "Microsoft YaHei", sans-serif; background: linear-gradient(180deg, #f7f8fb 0%, var(--bg) 100%); color: var(--text); }
a { color: inherit; }
button, input, textarea { font: inherit; }

.login-body { min-height: 100vh; display: grid; place-items: center; padding: 32px; }
.login-shell { width: min(1100px, 100%); display: grid; grid-template-columns: 1.2fr 0.9fr; gap: 28px; }
.login-hero, .login-card, .panel, .sidebar, .content-shell { background: var(--panel); border: 1px solid rgba(10, 60, 110, 0.08); box-shadow: var(--shadow); }
.login-hero { padding: 40px; border-radius: 32px; background: radial-gradient(circle at top left, rgba(244,140,6,0.18), transparent 45%), linear-gradient(135deg, #fefefe, #edf5ff); }
.login-hero h1 { font-size: 42px; line-height: 1.1; margin: 18px 0 12px; }
.login-hero p { color: var(--muted); max-width: 520px; }
.hero-points { margin: 28px 0 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.hero-points li { padding: 14px 16px; border-radius: 16px; background: rgba(11,95,215,0.06); }
.brand-chip { display: inline-flex; padding: 8px 14px; border-radius: 999px; background: rgba(31,143,111,0.10); color: var(--brand-2); font-weight: 700; }
.login-card { padding: 32px; border-radius: 28px; align-self: center; }
.login-card h2 { margin: 0 0 8px; }
.login-form { display: grid; gap: 16px; margin-top: 24px; }
.login-form label { display: grid; gap: 8px; }
.login-form span, .label { color: var(--muted); font-size: 13px; }
input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: #fbfcfe; font-size: 13px; box-sizing: border-box; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11,95,215,0.12); }
textarea { resize: vertical; }

.admin-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar-backdrop { display: none; }
.mobile-menu-btn { display: none; }
.sidebar { padding: 16px; display: flex; flex-direction: column; gap: 14px; border-radius: 0 22px 22px 0; background: linear-gradient(180deg, #0b1f45, #14376d); color: #fff; }
.sidebar-brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: linear-gradient(135deg, #f48c06, #f94144); font-weight: 800; font-size: 14px; }
.sidebar-brand span { display: block; color: rgba(255,255,255,0.7); font-size: 12px; margin-top: 4px; }
.sidebar-nav { display: grid; gap: 10px; }
.nav-item { border: 0; background: rgba(255,255,255,0.06); color: #fff; border-radius: 10px; padding: 10px 14px; text-align: left; cursor: pointer; font-size: 14px; transition: background 0.15s; }
.nav-item:hover { background: rgba(255,255,255,0.12); }
.nav-item.active { background: linear-gradient(135deg, rgba(244,140,6,0.95), rgba(249,65,68,0.95)); }
.sidebar-footer { margin-top: auto; color: rgba(255,255,255,0.7); display: grid; gap: 6px; }

.content-shell { padding: 18px 22px; background: transparent; box-shadow: none; border: none; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.topbar h1 { margin: 0; font-size: 22px; font-weight: 700; }
.topbar p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.page { display: none; gap: 14px; }
.page.active { display: grid; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-card { padding: 14px 16px; border-radius: 14px; background: var(--panel); border: 1px solid rgba(10, 60, 110, 0.08); box-shadow: 0 2px 8px rgba(15,23,42,0.04); display: grid; gap: 4px; }
.stat-card strong { font-size: 24px; font-weight: 700; }
.stat-card span, .muted { color: var(--muted); font-size: 12px; }
.stat-card small, .muted.compact { color: var(--muted); font-size: 11px; }
.panel { padding: 14px 18px; border-radius: 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; font-size: 16px; font-weight: 700; }
.two-column { display: grid; grid-template-columns: 1.25fr 0.95fr; gap: 18px; }
.two-column.narrow-right { grid-template-columns: 1.15fr 0.85fr; }
.project-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-bottom: 1px solid #eef2f7; transition: background 0.15s; }
.project-row:last-child { border-bottom: 0; }
.project-row > div:first-child { flex: 1; min-width: 0; }
.project-row.clickable { cursor: pointer; border-radius: 10px; }
.project-row.clickable:hover { background: rgba(11,95,215,0.06); }
.project-row strong { font-size: 14px; font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-row small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-row .tag { flex-shrink: 0; white-space: nowrap; }
.progress-wrap { min-width: 180px; display: grid; gap: 8px; }
.progress-bar { height: 9px; border-radius: 999px; background: #e8eef7; overflow: hidden; }
.progress-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #1f8f6f, #0b5fd7); }
.risk-list { display: grid; gap: 14px; }
.risk-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-radius: 10px; cursor: pointer; transition: filter 0.15s; }
.risk-item:hover { filter: brightness(0.95); }
.risk-item.pass { background: rgba(31,143,111,0.10); }
.risk-item.warning { background: rgba(244,140,6,0.12); }
.risk-item.danger { background: rgba(214,69,69,0.12); }
.data-table { width: 100%; border-collapse: collapse; table-layout: auto; }
.data-table th, .data-table td { padding: 10px 12px; border-bottom: 1px solid #edf1f7; text-align: left; vertical-align: middle; font-size: 13px; }
.data-table th { white-space: nowrap; font-weight: 600; color: #334155; background: #f8fafc; font-size: 12px; letter-spacing: 0.02em; }
.data-table td { word-break: normal; }
.data-table td .toolbar-row { flex-wrap: nowrap; gap: 6px; }
.data-table td .toolbar-row button { white-space: nowrap; }
.data-table tr:hover td { background: rgba(11,95,215,0.03); }
.assignment-list, .review-list { display: grid; gap: 0; border: 1px solid #eef2f7; border-radius: 12px; overflow: hidden; background: #fff; }
.assignment-list:empty, .review-list:empty { border: 0; }
.review-list { gap: 12px; border: 0; background: transparent; }
.assignment-card, .review-card { padding: 16px; border: 1px solid #e5ebf4; border-radius: 18px; background: #fbfcff; cursor: pointer; }
.assignment-card.selected, .review-card.selected { border-color: rgba(11,95,215,0.45); background: rgba(11,95,215,0.05); }
.assignment-card span, .assignment-card small, .review-card small, .review-card p { display: block; color: var(--muted); margin-top: 6px; }
.detail-stack { display: grid; gap: 16px; }
.detail-stack.split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.detail-stack strong { display: block; margin-top: 6px; }
.review-layout { display: grid; grid-template-columns: 0.95fr 1.25fr; gap: 18px; }
.photo-compare-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.photo-box { display: grid; gap: 8px; }
.photo-placeholder { min-height: 160px; border-radius: 18px; background: linear-gradient(135deg, #dce8ff, #f9fbff); border: 1px dashed #aac2ee; display: grid; place-items: center; font-weight: 700; color: #2457aa; }
.photo-placeholder.alt { background: linear-gradient(135deg, #fff1d8, #fff9ef); border-color: #efc37a; color: #b56a00; }
.alert { margin-top: 18px; padding: 16px 18px; border-radius: 16px; }
.danger-box { background: rgba(214,69,69,0.10); color: #7d1820; }
.textarea-field { display: grid; gap: 8px; margin-top: 18px; }
.action-row { margin-top: 18px; display: flex; gap: 12px; justify-content: flex-end; }
.review-card-top { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.tag { display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.tag.green { background: rgba(31,143,111,0.12); color: #176e57; }
.tag.blue { background: rgba(11,95,215,0.10); color: #0b5fd7; }
.tag.orange, .tag.yellow { background: rgba(244,140,6,0.12); color: #a86400; }
.tag.red { background: rgba(214,69,69,0.12); color: #b12631; }
.primary-btn, .ghost-btn, .danger-btn, .link-btn { border: 0; cursor: pointer; transition: filter 0.15s, transform 0.05s; }
.primary-btn, .ghost-btn, .danger-btn { padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: 13px; white-space: nowrap; }
.primary-btn:hover, .ghost-btn:hover, .danger-btn:hover { filter: brightness(1.05); }
.primary-btn:active, .ghost-btn:active, .danger-btn:active { transform: translateY(1px); }
.primary-btn { background: linear-gradient(135deg, #0b5fd7, #2a87f3); color: #fff; }
.ghost-btn { background: rgba(11,95,215,0.08); color: #0b5fd7; }
.danger-btn { background: linear-gradient(135deg, #c8343f, #e05a63); color: #fff; }
.warn-btn { background: linear-gradient(135deg, #d97706, #f59e0b); color: #fff; }
.link-btn { background: transparent; color: #0b5fd7; padding: 0; }
.wide { width: 100%; }

@media (max-width: 1080px) {
  .login-shell, .review-layout, .two-column, .two-column.narrow-right, .stats-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { border-radius: 0 0 28px 28px; }
  .topbar { flex-direction: column; }
  .topbar-actions, .action-row { width: 100%; flex-wrap: wrap; }
  .detail-stack.split, .photo-compare-grid { grid-template-columns: 1fr; }
}

.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid #eef2f7; }
/* 列表限高：加框约束长记录 */
.table-wrap.table-scroll { max-height: calc(100vh - 260px); min-height: 300px; overflow-y: auto; }
.assignment-list.assignment-list-scroll { max-height: calc(100vh - 320px); min-height: 260px; overflow-y: auto; }
/* 让表头在滚动时保持可见 */
.table-wrap.table-scroll table { position: relative; }
.table-wrap.table-scroll thead th { position: sticky; top: 0; z-index: 2; }

/* ── 项目管理左右分栏 ── */
.project-split {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.project-list-panel { position: sticky; top: 14px; height: calc(100vh - 100px); display: flex; flex-direction: column; overflow: hidden; }
/* 项目详情栏：固定高度 + 内部滚动，跟审批中心右栏一致 */
/* v1.0.277 Round 8：整个 panel 改可滚动（user 反馈"项目详情无法滚动"）。
   原设计 panel overflow:hidden + task list 独立滚动 — 加照片 grid 后 #projectDetail 撑爆被截断。
   改：panel 整体 overflow-y:auto + 内层去独立滚动 → user 一个滚动条看完元数据+progress+照片+task list */
.project-detail-panel {
  position: sticky; top: 14px;
  max-height: calc(100vh - 100px);
  display: flex; flex-direction: column;
  overflow-y: auto;
  padding: 14px 0 0 0;
  scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent;
}
.project-detail-panel::-webkit-scrollbar { width: 8px; }
.project-detail-panel::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.project-detail-panel::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.project-detail-panel > .panel-head { padding: 0 16px; flex-shrink: 0; }
.project-detail-panel > #projectDetail { padding: 0 16px 10px; flex-shrink: 0; }
.project-detail-panel > #projectTaskList {
  /* 不再独立滚动，由外层 panel 统一滚动 */
  flex: 0 0 auto;
  padding: 0 14px 14px;
  border-top: 1px solid #eef2f7; padding-top: 10px;
}
.project-detail-panel > #projectTaskList::-webkit-scrollbar { width: 8px; }
.project-detail-panel > #projectTaskList::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.project-detail-panel > #projectTaskList::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.project-list-panel .filter-pills { margin: 6px 0 8px; flex-shrink: 0; gap: 4px; }
.project-list-panel .filter-pill { padding: 3px 8px; font-size: 11px; }
.project-list-items {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  border: 1px solid #e5ebf4;
  border-radius: 8px;
  padding: 6px;
  background: #f8fafc;   /* 凹槽灰底，视觉上像滚动容器 */
  scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent;
  box-shadow: inset 0 1px 3px rgba(15,23,42,0.03);
  /* 覆盖 .assignment-list 的 grid 布局，改成 flex column 避免 card 被 stretch */
  display: flex !important;
  flex-direction: column;
  gap: 0;
}
.project-list-items::-webkit-scrollbar { width: 6px; }
.project-list-items::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.project-list-items::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.project-list-footer { flex-shrink: 0; padding: 6px 4px 0; font-size: 11px; color: var(--muted); text-align: right; }

/* 项目列表 card 紧凑（原来 ~90px → ~60px） */
.project-list-items .assignment-card {
  padding: 8px 12px !important;
  margin-bottom: 6px !important;
  background: #fff !important;
  border: 1px solid #eef2f7 !important;
  border-radius: 8px !important;
}
.project-list-items .assignment-card:last-child { margin-bottom: 0 !important; }
.project-list-items .assignment-card.selected {
  border-color: rgba(11,95,215,0.4) !important;
  background: rgba(11,95,215,0.04) !important;
  box-shadow: inset 3px 0 0 #0b5fd7;
}
.project-list-items .project-card-head { margin-bottom: 2px; }
.project-list-items .project-card-head strong { font-size: 13px; }
.project-list-items .assignment-card span { font-size: 11px; margin-top: 1px; }
.project-list-items .assignment-card small { font-size: 10px; margin-top: 2px; }
.project-list-items .assignment-card { padding: 12px 14px; border-radius: 10px; margin-bottom: 8px; border: 1px solid #e5ebf4; background: #fbfcff; cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.project-list-items .assignment-card:last-child { margin-bottom: 0; }
.project-list-items .assignment-card:hover { background: #f0f6ff; }
.project-list-items .assignment-card.selected { border-color: rgba(11,95,215,0.55); background: rgba(11,95,215,0.08); }
.project-list-items .assignment-card .project-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.project-list-items .assignment-card strong { font-size: 13px; font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-list-items .assignment-card span { font-size: 12px; color: var(--muted); margin-top: 0; }
.project-list-items .assignment-card small { font-size: 11px; color: #94a3b8; margin-top: 4px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-detail-panel .detail-stack { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 6px 16px; }
.project-detail-panel .detail-stack > div { padding: 4px 0; border-bottom: 1px dashed #eef2f7; min-width: 0; }
.project-detail-panel .detail-stack > div.span-2 { grid-column: 1 / -1; }
.project-detail-panel .detail-stack .label { font-size: 11px; color: var(--muted); display: block; margin-bottom: 1px; }
.project-detail-panel .detail-stack strong { font-size: 13px; font-weight: 600; margin-top: 0; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-detail-panel .detail-stack > div.span-2 strong { white-space: normal; }  /* 说明字段允许换行 */

@media (max-width: 1100px) {
  .project-detail-panel .detail-stack { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 900px) {
  .project-split { grid-template-columns: 1fr; }
  .project-list-panel { position: static; max-height: 320px; }
}

/* ── 侧栏收起 ── */
.sidebar-brand { position: relative; }
.sidebar-collapse-btn {
  margin-left: auto;
  width: 28px; height: 28px;
  border: 1px solid rgba(255,255,255,0.15); background: rgba(255,255,255,0.08);
  color: #fff; cursor: pointer; border-radius: 6px;
  font-size: 14px; line-height: 1; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.sidebar-collapse-btn:hover { background: rgba(255,255,255,0.18); }
.nav-item { display: flex; align-items: center; gap: 10px; }
.nav-icon { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 20px; font-size: 15px; }
.nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 收起状态 */
.admin-shell.sidebar-collapsed { grid-template-columns: 64px 1fr; }
.sidebar.collapsed { padding: 16px 6px; }
.sidebar.collapsed .brand-text { display: none; }
.sidebar.collapsed .brand-mark { margin: 0 auto; }
.sidebar.collapsed .sidebar-collapse-btn { position: absolute; top: 0; right: -10px; transform: rotate(180deg); background: #0b5fd7; border-color: #0b5fd7; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px 8px; gap: 0; }
.sidebar.collapsed .nav-label { display: none; }
.sidebar.collapsed .sidebar-footer { display: none; }

/* ── 审批中心：tab 栏 ── */
.review-tabbar {
  display: flex; gap: 6px; margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0;
}
.review-tab {
  background: transparent; border: none; padding: 8px 14px;
  font-size: 14px; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  display: inline-flex; align-items: center; gap: 6px;
}
.review-tab:hover { color: var(--text); }
.review-tab.active {
  color: var(--brand); border-bottom-color: var(--brand); font-weight: 600;
}

/* ── 审批中心：已打回未重提 ── */
.returned-list { display: flex; flex-direction: column; gap: 10px; padding: 6px 0; }
.returned-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px; border-radius: 10px;
  background: #fff; border: 1px solid var(--line);
  border-left-width: 4px;
}
.returned-row.urgency-red    { border-left-color: #d64545; background: #fff7f7; }
.returned-row.urgency-yellow { border-left-color: #e0a200; background: #fffbf0; }
.returned-row.urgency-grey   { border-left-color: #cbd5e1; }
.returned-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.returned-title { font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.returned-title .muted { color: var(--muted); }
.returned-meta {
  display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted);
}
.returned-days {
  font-weight: 600;
}
.urgency-red    .returned-days { color: #b12631; }
.urgency-yellow .returned-days { color: #a86400; }
.urgency-grey   .returned-days { color: var(--muted); }
.returned-comment {
  font-size: 12px; padding: 6px 10px;
  background: rgba(214,69,69,0.06); border-radius: 6px; color: #7a1e26;
}
.returned-actions { display: flex; align-items: center; }

/* ── 审批中心：左树 + 右任务表 ── */
.review-split {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.review-tree-panel {
  position: sticky; top: 14px;
  height: calc(100vh - 100px);
  display: flex; flex-direction: column;
  overflow: hidden;
  padding: 12px;
}
/* 右栏：整体加框 + 单层滚动（A 方案） */
.review-detail-panel {
  position: sticky; top: 14px;
  height: calc(100vh - 100px);
  display: flex; flex-direction: column;
  overflow: hidden;
  padding: 12px 0 0 0;
}
.review-detail-panel .panel-head { padding: 0 16px; flex-shrink: 0; }
.review-detail-panel .batch-bar {
  flex-shrink: 0;
  margin: 8px 14px 10px 14px;
}
.review-detail-panel .review-task-list {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 0 14px 14px 14px;
  border-top: 1px solid #eef2f7;
  padding-top: 10px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.review-detail-panel .review-task-list::-webkit-scrollbar { width: 8px; }
.review-detail-panel .review-task-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.review-detail-panel .review-task-list::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.review-detail-panel #reviewEmpty { margin: 0 14px 14px; }
.review-tree-panel .panel-head { margin-bottom: 8px; flex-shrink: 0; }
.tree-search {
  padding: 6px 10px; font-size: 12px; margin-bottom: 8px; flex-shrink: 0;
  border-radius: 8px; border: 1px solid #e5e7eb;
}
.review-tree {
  flex: 1; min-height: 0; overflow-y: auto;
  font-size: 13px;
}
.tree-project {
  margin-bottom: 4px;
}
.tree-project-head {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 8px; border-radius: 6px; cursor: pointer;
  color: #0f172a; font-weight: 600;
  transition: background 0.12s;
}
.tree-project-head:hover { background: rgba(11,95,215,0.06); }
.tree-arrow {
  display: inline-block; width: 14px; font-size: 10px; color: #94a3b8;
  transition: transform 0.15s;
}
.tree-project.expanded > .tree-project-head .tree-arrow { transform: rotate(90deg); }
.tree-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-badge {
  flex-shrink: 0;
  min-width: 22px; height: 20px; padding: 0 7px;
  border-radius: 10px; background: #f1f5f9; color: #64748b;
  font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.tree-badge.hot { background: rgba(244,140,6,0.15); color: #b45309; }
.tree-templates {
  display: none; padding-left: 18px;
  border-left: 1px dashed #e5e7eb; margin-left: 10px;
}
.tree-project.expanded > .tree-templates { display: block; }
.tree-template-item {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px; border-radius: 6px; cursor: pointer;
  color: #475569; font-weight: 500;
  margin: 2px 0;
  position: relative;
  transition: background 0.12s, color 0.12s;
}
.tree-template-item:hover { background: rgba(11,95,215,0.05); color: #0f172a; }
.tree-template-item.active {
  background: rgba(11,95,215,0.1); color: #0b5fd7; font-weight: 600;
}
.tree-template-item.active::before {
  content: ''; position: absolute; left: -11px; top: 6px; bottom: 6px;
  width: 3px; border-radius: 2px; background: #0b5fd7;
}
/* 三级树：实例节点 */
.tree-template { margin-bottom: 2px; }
.tree-template-head .tree-arrow { font-size: 9px; }
.tree-arrow.invisible { visibility: hidden; }
.tree-instances { display: none; padding-left: 18px; border-left: 1px dashed #e5e7eb; margin-left: 10px; }
.tree-template.expanded > .tree-instances { display: block; }
.tree-instance-item {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px; border-radius: 5px; cursor: pointer;
  color: #64748b; font-size: 12px; font-weight: 500;
  margin: 1px 0; position: relative;
  transition: background 0.12s, color 0.12s;
}
.tree-instance-item:hover { background: rgba(11,95,215,0.05); color: #0f172a; }
.tree-instance-item.active {
  background: rgba(11,95,215,0.1); color: #0b5fd7; font-weight: 600;
}
.tree-instance-item.active::before {
  content: ''; position: absolute; left: -11px; top: 4px; bottom: 4px;
  width: 3px; border-radius: 2px; background: #0b5fd7;
}
/* 项目节点选中态 */
.tree-project-head.active { background: rgba(11,95,215,0.08); color: #0b5fd7; }

/* 视图切换按钮（卡片 / Excel） */
.view-switch { display: inline-flex; border: 1px solid #d1d5db; border-radius: 6px; overflow: hidden; height: 26px; }
.view-switch-btn { border: 0; padding: 2px 10px; background: #fff; color: #475569; font-size: 12px; cursor: pointer; display: inline-flex; align-items: center; }
.view-switch-btn:not(:first-child) { border-left: 1px solid #d1d5db; }
.view-switch-btn:hover { background: #f1f5f9; }
.view-switch-btn.active { background: #0b5fd7; color: #fff; }

/* Excel 视图在审批中心内显示时，sheet 之间用黑边+小间距 */
.review-task-list .excel-report-sheet {
  padding: 0;
  background: #fff;
  border: 1px solid #000;
  margin-bottom: 14px;
}
.review-task-list .excel-report-sheet:last-child { margin-bottom: 0; }
.review-task-list .excel-report-title { font-size: 18px; margin: 8px 0 10px; padding: 0 12px; }
.review-task-list .excel-report-meta { margin-bottom: 0; }

/* 每任务行内的审批条（Excel 视图） */
.excel-sheet-approve {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: #f5f5f5;
  border-top: 1px solid #000;
}
.excel-sheet-approve textarea {
  flex: 1; min-height: 30px; max-height: 60px; padding: 4px 8px;
  font-family: inherit; font-size: 12px;
  border: 1px solid #b0b0b0; border-radius: 0;
  resize: vertical;
}
.excel-sheet-approve .primary-btn.sm,
.excel-sheet-approve .danger-btn.sm { flex-shrink: 0; }

/* Right task table */
.batch-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; background: #f8fafc;
  border: 1px solid #e5e7eb; border-radius: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.batch-check { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; }
.batch-check input { width: auto; }
.review-task-list {
  display: flex; flex-direction: column; gap: 8px;
}
.review-task-row {
  border: 1px solid #e5e7eb; border-radius: 10px; background: #fff;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
  flex-shrink: 0;  /* 阻止在 flex column 容器里被压缩 */
}
.review-task-row.expanded { border-color: rgba(11,95,215,0.4); box-shadow: 0 2px 8px rgba(11,95,215,0.08); }
.review-task-row-head {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto auto;
  gap: 10px; align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.12s;
}
.review-task-row-head:hover { background: #f8fafc; }
.review-task-row-head input[type=checkbox] { width: auto; margin: 0; cursor: pointer; }
.review-task-row-head .rt-title { font-weight: 600; font-size: 13px; color: #0f172a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-task-row-head .rt-title small { font-weight: 400; color: #64748b; margin-left: 6px; font-size: 11px; }
.review-task-row-head .rt-meta { font-size: 12px; color: #64748b; white-space: nowrap; }
.review-task-row-head .rt-meta strong { color: #0f172a; font-weight: 500; }
.review-task-row-head .rt-ai { font-size: 11px; padding: 3px 8px; border-radius: 10px; background: #f1f5f9; color: #475569; }
.review-task-row-head .rt-ai.warning { background: rgba(244,140,6,0.12); color: #a16207; }
.review-task-row-head .rt-ai.risk { background: rgba(214,69,69,0.12); color: #b12631; }
.review-task-row-head .rt-ai.pass { background: rgba(31,143,111,0.12); color: #166534; }
.review-task-row-head .rt-expand {
  background: none; border: 1px solid #e5e7eb; border-radius: 6px;
  padding: 4px 10px; font-size: 12px; cursor: pointer; color: #475569;
}
.review-task-row-head .rt-expand:hover { border-color: #0b5fd7; color: #0b5fd7; }
.review-task-row-body {
  display: none;
  padding: 14px; border-top: 1px solid #eef2f7; background: #fbfcfe;
}
.review-task-row.expanded .review-task-row-body { display: block; }
.review-task-row-body .detail-stack { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px 16px; margin-bottom: 12px; }
.review-task-row-body .detail-stack .label { font-size: 11px; color: var(--muted); display: block; }
.review-task-row-body .detail-stack strong { font-size: 13px; margin-top: 2px; display: block; }
.review-task-row-body .alert { margin: 0 0 12px 0; padding: 10px 14px; border-radius: 8px; font-size: 13px; }
/* 展开体内照片网格：一行 4 个，自然高度（单层滚动由右栏外层处理） */
.review-task-row-body .photo-slot-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 4px;
  gap: 10px;
}
.review-task-row-body .photo-slot-grid .photo-box { font-size: 12px; }
.review-task-row-body .photo-slot-grid .photo-thumb { aspect-ratio: 4/3; object-fit: cover; padding: 4px; border-radius: 6px; }
.review-task-row-body .photo-slot-grid .slot-action-row { display: flex; gap: 4px; margin-top: 4px; }
.review-task-row-body .photo-slot-grid .slot-action { padding: 3px 8px; font-size: 11px; flex: 1; border-radius: 4px; border: 1px solid #e2e8f0; background: #fff; cursor: pointer; }
.review-task-row-body .photo-slot-grid .slot-action.active.approved { background: #d1fae5; color: #065f46; border-color: #065f46; }
.review-task-row-body .photo-slot-grid .slot-action.active.rejected { background: #fee2e2; color: #991b1b; border-color: #991b1b; }
.review-task-row-body .photo-slot-grid .slot-action.active.false-positive { background: #fef3c7; color: #92400e; border-color: #92400e; }

.review-task-row-body .textarea-field { margin-top: 14px; }
.review-task-row-body .action-row { margin-top: 0; gap: 8px; }
.review-task-row-body .action-row .ghost-btn,
.review-task-row-body .action-row .danger-btn,
.review-task-row-body .action-row .primary-btn { padding: 6px 14px; font-size: 13px; }
.review-task-row-body .row-quick-links {
  display: flex; gap: 6px; flex-shrink: 0;
}
.review-task-row-body .row-quick-links .ghost-btn.sm { padding: 4px 8px; font-size: 13px; }

/* 紧凑元信息单行 */
.review-task-row-body .row-meta-line {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  margin-bottom: 8px;
  padding: 6px 10px; background: #f8fafc; border-radius: 6px;
  font-size: 12px; color: #334155;
  flex-wrap: wrap;
}
.review-task-row-body .row-meta-chain {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0;
}
.review-task-row-body .row-meta-chain .dot { color: #cbd5e1; font-weight: 400; }
.review-task-row-body .row-meta-chain strong { color: #0f172a; font-weight: 600; }
.review-task-row-body .row-meta-chain .tag { font-size: 11px; padding: 1px 8px; }
/* pass 系统提示：一行小绿条 */
.review-task-row-body .sys-tip-pass {
  padding: 6px 12px; margin: 0 0 10px 0;
  background: #f0fdf4; color: #166534;
  border-radius: 6px; font-size: 12px; font-weight: 500;
}

/* 照片可点击提示 */
.review-task-row-body .photo-thumb.rt-zoomable { cursor: zoom-in; transition: transform 0.15s, box-shadow 0.15s; }
.review-task-row-body .photo-thumb.rt-zoomable:hover { transform: scale(1.02); box-shadow: 0 4px 12px rgba(15,23,42,0.18); }

/* ═══════════════ 槽位照片灯箱 ═══════════════ */
.rt-lightbox {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0, 0, 0, 0.92);
  display: flex; align-items: center; justify-content: center;
  animation: rt-lb-fade-in 0.15s ease;
}
.rt-lightbox.hidden { display: none !important; }

/* v1.0.278d 修：review_report.html 的 .lightbox 之前完全没 CSS（user 反馈"点击照片不弹预览"根因）
   CSS .hidden 移除后 lightbox div 没 position:fixed 在 body 流内不可见。
   mirror .rt-lightbox 同款样式 */
.lightbox {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0, 0, 0, 0.92);
  display: flex; align-items: center; justify-content: center;
  animation: rt-lb-fade-in 0.15s ease;
}
.lightbox.hidden { display: none !important; }
.lightbox-inner {
  position: relative;
  width: 92vw; height: 92vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.lightbox-image {
  max-width: 100%; max-height: calc(92vh - 100px);
  object-fit: contain;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  background: #1f2937;
  border-radius: 4px;
  cursor: zoom-in;
}
.lightbox-close {
  position: absolute; top: 0; right: 0;
  width: 44px; height: 44px;
  border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.1); color: #fff;
  font-size: 22px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  z-index: 10;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.22); }
.lightbox-caption {
  position: absolute; bottom: 50px; left: 0; right: 0;
  text-align: center; color: #fff; font-size: 13px;
  background: rgba(0, 0, 0, 0.5);
  padding: 8px;
}
@keyframes rt-lb-fade-in { from { opacity: 0; } to { opacity: 1; } }

.rt-lightbox-inner {
  position: relative;
  width: 92vw; height: 92vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}

.rt-lightbox-img {
  max-width: 100%; max-height: calc(92vh - 100px);
  object-fit: contain;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  background: #1f2937;
  border-radius: 4px;
}

.rt-lightbox-close {
  position: absolute; top: 0; right: 0;
  width: 44px; height: 44px;
  border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.1); color: #fff;
  font-size: 20px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.rt-lightbox-close:hover { background: rgba(255, 255, 255, 0.22); }

.rt-lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.1); color: #fff;
  border: 0; font-size: 30px; line-height: 1;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.15s;
}
.rt-lightbox-nav:hover { background: rgba(255, 255, 255, 0.22); }
.rt-lightbox-prev { left: 0; }
.rt-lightbox-next { right: 0; }
.rt-lightbox-prev:hover { transform: translateY(-50%) translateX(-3px); }
.rt-lightbox-next:hover { transform: translateY(-50%) translateX(3px); }

.rt-lightbox-footer {
  margin-top: 16px; padding: 10px 18px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(4px);
  border-radius: 10px;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  color: #fff;
}
.rt-lightbox-caption {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px;
}
.rt-lightbox-caption strong { color: #fff; font-size: 15px; }
.rt-lightbox-caption .muted { color: rgba(255, 255, 255, 0.65); }

.rt-lightbox-actions {
  display: flex; gap: 8px;
}
.rt-lightbox-actions .slot-action {
  padding: 6px 16px; font-size: 13px; font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08); color: #fff;
  border-radius: 6px; cursor: pointer;
  transition: all 0.15s;
}
.rt-lightbox-actions .slot-action:hover { background: rgba(255, 255, 255, 0.2); }
.rt-lightbox-actions .slot-action.active.approved { background: #16a34a; border-color: #16a34a; color: #fff; }
.rt-lightbox-actions .slot-action.active.rejected { background: #dc2626; border-color: #dc2626; color: #fff; }
.rt-lightbox-actions .slot-action.active.false-positive { background: #d97706; border-color: #d97706; color: #fff; }

@media (max-width: 900px) {
  .rt-lightbox-nav { width: 40px; height: 40px; font-size: 22px; }
  .rt-lightbox-footer { padding: 8px 12px; gap: 12px; }
}

/* 底部 sticky 审批操作条：滚动时常驻可见 */
.review-task-row-body .row-action-sticky {
  position: sticky; bottom: -14px;
  margin: 14px -14px -14px -14px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(6px);
  border-top: 1px solid #e5e7eb;
  display: flex; align-items: center; gap: 10px;
  z-index: 3;
}
.review-task-row-body .row-action-sticky .row-comment { flex: 1; min-height: 32px; resize: none; }
.review-task-row-body .row-action-sticky .btn-group { display: flex; gap: 6px; flex-shrink: 0; }

@media (max-width: 1400px) {
  .review-task-row-body .photo-slot-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .review-task-row-body .photo-slot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .review-split { grid-template-columns: 1fr; }
  .review-tree-panel { position: static; max-height: 260px; }
  .review-task-row-head { grid-template-columns: auto 1fr auto auto; }
  .review-task-row-head .rt-meta { display: none; }
  .review-task-row-body .detail-stack { grid-template-columns: 1fr 1fr; }
}

/* ── 子页面切换 tab ── */
.subnav { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid #e5e7eb; padding: 0 4px; }
.subnav-btn {
  background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 8px 14px; font-size: 13px; font-weight: 500;
  color: #64748b; cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}
.subnav-btn:hover { color: #206bc4; }
.subnav-btn.active { color: #206bc4; border-bottom-color: #206bc4; font-weight: 600; }
.subpage { display: none; }
.subpage.active { display: block; }
.toolbar-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.compact-row { padding: 12px 0; }
.stack-list { display: grid; gap: 12px; }
.empty-state { padding: 18px; border-radius: 16px; background: #f7f9fc; color: var(--muted); border: 1px dashed var(--line); }
.project-task-head { margin-top: 22px; }
.photo-slot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.photo-card { align-content: start; }
.photo-thumb { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; padding: 10px; background: #fff; border-radius: 18px; border: 1px solid #dbe5f2; background: #f6f8fb; }
.photo-meta { color: var(--muted); line-height: 1.4; }
.hidden { display: none !important; }
.form-error { border-radius: 14px; padding: 12px 14px; background: rgba(214,69,69,0.12); color: #8f1c26; }

@media (max-width: 860px) {
  .photo-slot-grid { grid-template-columns: 1fr; }
}

.review-photo-slot {
  border-width: 1px;
  border-style: solid;
  border-color: #dbe5f2;
  padding: 14px;
  border-radius: 22px;
  background: #fff;
}

.review-photo-slot.green {
  border-color: rgba(31,143,111,0.35);
}

.review-photo-slot.red {
  border-color: rgba(214,69,69,0.35);
}

.review-photo-slot.blue {
  border-color: rgba(11,95,215,0.32);
}

.review-photo-slot.orange {
  border-color: rgba(244,140,6,0.35);
}

.slot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.photo-report-frame {
  min-height: 240px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(180deg, #f7f9fc 0%, #ffffff 100%);
  border: 1px solid #dbe5f2;
}

.slot-action-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.slot-action {
  border: 1px solid #d6e0ee;
  border-radius: 12px;
  background: #f8fbff;
  color: #47617f;
  font-weight: 700;
  padding: 10px 8px;
  cursor: pointer;
}

.slot-action.active.approved {
  background: rgba(31,143,111,0.12);
  border-color: rgba(31,143,111,0.35);
  color: #176e57;
}

.slot-action.active.rejected {
  background: rgba(214,69,69,0.12);
  border-color: rgba(214,69,69,0.35);
  color: #a32731;
}

.slot-action.active.false-positive {
  background: rgba(11,95,215,0.10);
  border-color: rgba(11,95,215,0.32);
  color: #0b5fd7;
}

.slot-issue-list {
  display: grid;
  gap: 8px;
}

.slot-issue {
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
}

.slot-issue.red {
  background: rgba(214,69,69,0.12);
  color: #8d1e27;
}

.slot-issue.orange {
  background: rgba(244,140,6,0.12);
  color: #9c6200;
}

.slot-issue.neutral {
  background: #f5f7fb;
  color: #5d6a7a;
}


.report-topbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.history-shell {
  max-width: 1200px;
}

.history-list {
  display: grid;
  gap: 14px;
}

.history-card {
  border: 1px solid #dbe5f2;
  border-radius: 20px;
  padding: 18px;
  background: #fbfcff;
  display: grid;
  gap: 12px;
}

.history-card.selected {
  border-color: rgba(11,95,215,0.45);
  background: rgba(11,95,215,0.05);
}

.history-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.history-card-top small {
  display: block;
  color: var(--muted);
  margin-top: 6px;
}

.history-comment {
  color: #465568;
  line-height: 1.6;
  padding: 12px 14px;
  border-radius: 16px;
  background: #f5f7fb;
}

.history-actions {
  display: flex;
  justify-content: flex-end;
}
/* ═══════════════════════════════════════════════════════════ */
/* Excel 审批报告视图 — 仿 Memoria Fotográfica 真实 Excel 版式  */
/* ═══════════════════════════════════════════════════════════ */

.excel-report-shell {
  font-family: 'Calibri', 'Arial', 'Microsoft YaHei', 'PingFang SC', sans-serif;
}
.report-body {
  background: #f1f1f1;  /* Excel 背景灰 */
}
/* 左右各留 15% 边距（窄屏时自动压缩到 4%） */
.report-shell.excel-report-shell {
  background: #fff;
  padding: 24px 28px;
  border: 0;
  border-radius: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  margin: 14px 15%;
  max-width: none;
}
@media (max-width: 1200px) {
  .report-shell.excel-report-shell { margin: 14px 4%; }
}
@media (max-width: 800px) {
  .report-shell.excel-report-shell { margin: 10px 8px; padding: 14px 12px; }
}
.report-topbar {
  border-bottom: 1px solid #d0d0d0;
  padding-bottom: 12px; margin-bottom: 16px;
}
.report-topbar h1 { font-family: inherit; font-size: 18px; font-weight: 700; }
.report-topbar p { font-family: inherit; font-size: 12px; color: #555; }

.excel-report {
  padding: 0;
  border-radius: 0;
  background: #fff;
  border: 0;
  box-shadow: none;
}

.excel-report-title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin: 8px 0 14px 0;
  color: #000;
  letter-spacing: 0.5px;
}

.excel-report-meta-table,
.excel-report-grid-table,
.excel-report-meta,
.excel-report-grid {
  width: 100%;
  border-collapse: collapse;
  font-family: inherit;
  margin-bottom: 10px;
}

.excel-report-meta-table th,
.excel-report-meta-table td,
.excel-report-grid-table th,
.excel-report-grid-table td,
.excel-report-meta th,
.excel-report-meta td,
.excel-report-grid th,
.excel-report-grid td {
  border: 1px solid #000;   /* Excel 实线黑边 */
  padding: 6px 10px;
  vertical-align: middle;
  font-size: 13px;
  line-height: 1.45;
  color: #000;
}

.excel-report-meta-table th,
.excel-report-meta th,
.excel-report-grid-table thead th,
.excel-report-grid thead th {
  background: #d9d9d9;      /* Excel 灰色表头 */
  font-weight: 700;
  text-align: center;
  font-size: 12px;
  padding: 6px 10px;
}

.grid-col-no { width: 80px; }
.grid-col-coord { width: 160px; }
.grid-col-meter { width: 100px; }
.grid-col-photos { text-align: center; }

.grid-instance-cell,
.grid-coord-cell,
.grid-meter-cell {
  background: #fff;
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
  vertical-align: middle !important;
}

.grid-instance-cell strong {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  font-weight: 700;
}

.grid-photo-cell {
  padding: 10px !important;
}

.report-notice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.report-notice-body {
  display: grid;
  gap: 8px;
  color: #7b1d24;
  line-height: 1.6;
}

.excel-report-photo-grid {
  display: grid;
  gap: 8px;
}

.excel-report-photo-grid.cols-1 { grid-template-columns: 1fr; }
.excel-report-photo-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.excel-report-photo-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.excel-report-photo-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* 多 sheet 模式：项目/模板报告 */
#reportSheetsContainer { display: flex; flex-direction: column; gap: 14px; }
#reportSheetsContainer .excel-report-sheet {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #fff;
  page-break-after: always;
}
#reportSheetsContainer .report-group-title {
  font-family: 'Calibri', 'Arial', 'Microsoft YaHei', sans-serif;
  font-size: 14px; font-weight: 700; color: #000;
  margin: 8px 0 0 0;
  padding: 6px 10px;
  background: #d9d9d9;       /* Excel 合并单元格样式 */
  border: 1px solid #000;
  border-radius: 0;
  border-left: 1px solid #000;
}
#reportSheetsContainer .report-group-title .muted { color: #555; font-weight: 400; font-size: 12px; }

.excel-report-photo-card.placeholder {
  background: transparent; border: 0; min-height: 0;
}
.excel-report-photo-card.placeholder .excel-report-photo-frame,
.excel-report-photo-card.placeholder .excel-report-photo-caption,
.excel-report-photo-card.placeholder .excel-report-photo-meta,
.excel-report-photo-card.placeholder .excel-report-issues { display: none; }

/* 4 列照片 + 行对齐：让同行卡片的每个分区（照片/标签/状态/文件名/按钮）都在同一水平线 */
.excel-report-photo-grid {
  align-items: stretch;           /* 让同行 card 等高 */
}
.excel-report-photo-card {
  display: grid;
  /* 固定行结构：照片区 / 黄标签 / 状态 / 文件名 / 按钮 / 问题 */
  grid-template-rows: 260px auto auto auto auto 1fr;
  gap: 0;
  border: 1px solid #000;
  background: #fff;
}

.excel-report-photo-frame {
  height: 260px;                  /* 固定高度，使横图/竖图都在同一高度内 contain */
  padding: 4px;
  border: 0;
  border-bottom: 1px solid #000;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.report-photo-button {
  border: 0; padding: 0; background: transparent; cursor: zoom-in;
  width: 100%; height: 100%;
  display: grid; place-items: center;
}

.report-photo-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

/* 施工前/中/后/细节 黄色色块标签 — 固定高度，同行对齐 */
.excel-report-photo-caption {
  background: #ffc000;
  color: #000;
  font-weight: 700;
  font-size: 13px;
  text-align: center;
  padding: 0 10px;
  border-bottom: 1px solid #000;
  height: 34px;
  line-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 状态 + 文件名信息 — 固定高度，同行对齐 */
.excel-report-photo-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  color: #000;
  font-size: 10px;
  padding: 4px 8px;
  background: #f5f5f5;
  border-bottom: 1px solid #d0d0d0;
  min-height: 48px;
  word-break: break-all;
}
.excel-report-photo-meta .tag { font-size: 10px; padding: 1px 6px; background: transparent; border: 1px solid currentColor; }

.excel-report-issues {
  padding: 4px 8px;
  font-size: 11px;
  min-height: 32px;              /* 同行对齐 */
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.report-issue-item { color: #333; padding: 1px 0; font-size: 11px; line-height: 1.3; }
.report-issue-item.rejected { color: #c00000; }
.excel-report-slot-actions {
  padding: 4px 6px; display: flex; gap: 2px;
  border-top: 1px solid #d0d0d0;
  height: 30px;                  /* 固定高度同行对齐 */
  box-sizing: border-box;
}
.excel-report-slot-actions .slot-action { flex: 1; font-size: 11px; padding: 3px 6px; border: 1px solid #b0b0b0; background: #f5f5f5; cursor: pointer; }
.excel-report-slot-actions .slot-action.active.approved { background: #c6efce; border-color: #006100; color: #006100; }
.excel-report-slot-actions .slot-action.active.rejected { background: #ffc7ce; border-color: #9c0006; color: #9c0006; }
.excel-report-slot-actions .slot-action.active.false-positive { background: #ffeb9c; border-color: #9c5700; color: #9c5700; }

.report-system-notice {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid #000;
  background: #fff5ea;
  font-size: 12px;
  color: #000;
}
.report-notice-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 4px;
}
.report-notice-head strong { font-size: 13px; color: #000; }
.report-notice-body { color: #c00000; font-size: 12px; line-height: 1.5; }

.excel-report-issues {
  display: grid;
  gap: 8px;
}

/* OTDR 附件区块（审批报告页） */
.report-attachments {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #94a3b8;
  background: #f8fafc;
  border-radius: 6px;
}
.report-attach-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px; font-size: 13px;
}
.report-attach-list { display: flex; flex-direction: column; gap: 8px; }
.attach-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 10px; background: #fff; border: 1px solid #e5e7eb; border-radius: 6px;
}
.attach-icon { font-size: 18px; line-height: 1; }
.attach-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.attach-name { font-size: 13px; font-weight: 600; word-break: break-all; }
.attach-meta { font-size: 11px; color: var(--muted); }
.attach-pdf-iframe { border: 1px solid #ddd; margin-top: 6px; }
.attach-preview-details summary {
  cursor: pointer; font-size: 11px; color: var(--brand);
  padding: 4px 0; user-select: none;
}

/* 项目级批量指派横条 */
.bulk-assign-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; margin-bottom: 8px;
  background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 8px;
}
.bulk-bar-icon { font-size: 18px; }
.bulk-bar-text { flex: 1; font-size: 13px; font-weight: 600; color: #065f46; }

/* 任务分组折叠 */
.task-group {
  margin-bottom: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}
.task-group-head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: #f8fafc;
  border-radius: 8px 8px 0 0;
  border-bottom: 1px solid #e5e7eb;
}
.task-group.collapsed .task-group-head {
  border-bottom: none; border-radius: 8px;
}
.group-toggle {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: transparent; border: none; padding: 4px;
  text-align: left; cursor: pointer; font-size: 13px;
}
.group-toggle .caret { font-size: 10px; color: #64748b; width: 10px; }
.group-toggle .group-name { font-weight: 700; flex: 1; }
.group-toggle .group-count {
  font-size: 11px; font-weight: 700;
  background: #e0f2fe; color: #0369a1;
  padding: 2px 8px; border-radius: 999px;
}
.group-bulk-assign-btn {
  font-size: 12px !important; padding: 4px 10px !important;
}
.task-group-body { padding: 4px; }

/* 批量指派对话框 */
.bulk-mode-row {
  display: flex; gap: 12px; margin-bottom: 10px;
  padding: 8px; background: #f8fafc; border-radius: 6px;
}
.mode-radio { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.mode-radio input { width: auto !important; }
.bulk-search {
  width: 100%; padding: 8px 10px; border: 1px solid #e5e7eb;
  border-radius: 6px; margin-bottom: 8px; font-size: 13px;
}
.bulk-user-list {
  max-height: 400px; overflow-y: auto;
  border: 1px solid #e5e7eb; border-radius: 6px; padding: 4px;
}
.bulk-user-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: 4px; cursor: pointer;
  transition: background 0.1s;
}
.bulk-user-row:hover { background: #f1f5f9; }
.bulk-user-row input { width: auto !important; }
.bulk-user-name { display: flex; flex-direction: column; gap: 2px; }
.bulk-user-name strong { font-size: 13px; }
.bulk-user-name small { font-size: 11px; color: var(--muted); }

/* 项目卡片：迷你进度条 + 日期行 */
.project-progress-mini {
  display: flex; align-items: center; gap: 8px; margin-top: 6px;
}
.pb-track {
  flex: 1; height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden;
}
.pb-fill {
  height: 100%; background: linear-gradient(90deg, #22c55e, #16a34a);
  transition: width 0.3s ease;
}
.pb-label { font-size: 11px; color: var(--muted); font-weight: 600; }
.project-date-line {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; color: var(--muted); margin-top: 4px; gap: 8px;
}
.tag.sm { font-size: 10px; padding: 1px 6px; }

/* 项目详情：进度卡片 */
.project-progress-card {
  background: #f8fafc; border: 1px solid #cbd5e1; border-radius: 8px;
  padding: 12px 14px; margin-top: 4px;
}
.pp-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.pp-item { display: flex; flex-direction: column; gap: 6px; }
.pp-label { font-size: 12px; font-weight: 600; color: var(--text); }
.pp-bar-wrap { display: flex; flex-direction: column; gap: 4px; }
.pp-bar {
  height: 10px; background: #e2e8f0; border-radius: 5px; overflow: hidden;
}
.pp-bar-fill {
  height: 100%; background: linear-gradient(90deg, #22c55e, #16a34a);
  transition: width 0.4s ease;
}
.pp-bar-fill.time {
  background: linear-gradient(90deg, #3b82f6, #2563eb);
}
.pp-bar-text { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.pp-no-date { font-size: 12px; color: var(--muted); font-style: italic; }
.pp-delay-row {
  margin-top: 8px; font-size: 13px; font-weight: 600;
  padding: 6px 10px; background: #fff; border-radius: 6px;
}

/* 模板编辑对话框：内联 checkbox */
.inline-checkbox {
  display: flex !important; flex-direction: row !important;
  align-items: flex-start !important; gap: 8px;
  padding: 8px 12px; background: #fef9c3; border: 1px solid #f59e0b; border-radius: 6px;
}
.inline-checkbox input[type="checkbox"] {
  width: auto !important; margin-top: 2px;
}
.inline-checkbox > span {
  font-size: 13px; line-height: 1.4;
}

.report-issue-item {
  border-radius: 14px;
  padding: 10px 12px;
  background: #f5f7fb;
  color: #5d6a7a;
  line-height: 1.5;
}

.report-issue-item.rejected {
  background: rgba(214,69,69,0.12);
  color: #8f1c26;
}

@media (max-width: 1200px) {
  .excel-report-photo-grid.cols-4,
  .excel-report-photo-grid.cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .excel-report {
    padding: 18px;
    overflow-x: auto;
  }

  .excel-report-title {
    font-size: 22px;
  }

  .excel-report-photo-grid,
  .excel-report-photo-grid.cols-4,
  .excel-report-photo-grid.cols-3,
  .excel-report-photo-grid.cols-2 {
    grid-template-columns: 1fr;
  }

  .excel-report-photo-frame {
    min-height: 220px;
  }
}
.report-review-panel {
  margin-top: 20px;
  border: 1px solid #dbe5f2;
  border-radius: 20px;
  padding: 20px;
  background: #fbfcff;
  display: grid;
  gap: 14px;
}

.report-review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.report-review-header h2 {
  margin: 0;
  font-size: 20px;
}

.report-review-label {
  color: #607086;
  font-size: 14px;
  font-weight: 600;
}

.report-review-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.excel-report-slot-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}.admin-form { display: grid; gap: 16px; }
.form-grid { display: grid; gap: 14px; }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid label, .checkbox-label { display: grid; gap: 8px; }
.form-grid select { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: #fbfcfe; font-size: 13px; box-sizing: border-box; }
.form-grid label span { font-size: 12px; color: #475569; font-weight: 500; }
.form-grid { gap: 12px; }
.form-grid label, .checkbox-label { gap: 6px; }
.inline-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.form-inline-message { color: var(--muted); min-height: 22px; }
.form-inline-message.success { color: #176e57; }
.form-inline-message.error { color: #b12631; }
.task-draft-list { display: grid; gap: 14px; }
.task-draft-card { border: 1px solid #dbe5f2; border-radius: 18px; padding: 16px; background: #fbfcff; display: grid; gap: 12px; }
.task-draft-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.nested-head { margin-top: 12px; }
.project-layout { grid-template-columns: 1.1fr 0.9fr; }
.small-btn { padding: 8px 12px; border-radius: 10px; }
@media (max-width: 860px) {
  .form-grid.cols-2, .project-layout { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
}

.project-task-admin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 10px 14px;
  border: 1px solid #e5ebf4;
  border-radius: 10px;
  background: #fbfcff;
  align-items: center;
}

.project-task-admin-main {
  display: grid;
  gap: 2px;
  min-width: 0;  /* 关键：允许子元素省略号 */
}
.project-task-admin-main strong {
  font-size: 13px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: block; min-width: 0;
}
.project-task-admin-main small {
  color: var(--muted); font-size: 11px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: block;
}

.project-task-admin-controls {
  display: flex; gap: 8px; align-items: flex-end;
  flex-shrink: 0;
}

.inline-field {
  display: grid;
  gap: 3px;
  min-width: 110px;
}
.inline-field span { font-size: 11px; color: var(--muted); }
.inline-field select { padding: 5px 8px; font-size: 12px; }

.small-btn {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  white-space: nowrap;
}
.ghost-btn.sm, .primary-btn.sm, .danger-btn.sm {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .project-task-admin-row {
    grid-template-columns: 1fr;
  }

  .project-task-admin-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-task-admin-controls .small-btn {
    grid-column: 1 / -1;
  }
}
.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-pill {
  border: 1px solid #d6e0ee;
  background: #f7faff;
  color: #47617f;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
}

.filter-pill.active {
  background: linear-gradient(135deg, rgba(11,95,215,0.12), rgba(42,135,243,0.18));
  color: #0b5fd7;
  border-color: rgba(11,95,215,0.32);
}

.pending-users-panel {
  margin-bottom: 18px;
  display: grid;
  gap: 12px;
}

.pending-user-list {
  display: grid;
  gap: 12px;
}

.pending-user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(244,140,6,0.08);
  border: 1px solid rgba(244,140,6,0.18);
}

.pending-user-meta {
  display: grid;
  gap: 6px;
}

.pending-user-meta small {
  color: var(--muted);
}

.project-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

@media (max-width: 860px) {
  .pending-user-card {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ── Modal ── */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,0.55); }
.modal-dialog { position: relative; background: #fff; border-radius: 14px; box-shadow: 0 20px 48px rgba(15,23,42,0.18); width: min(720px, 92vw); max-height: 88vh; display: flex; flex-direction: column; }
.modal-dialog.large { width: min(960px, 94vw); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid #e2e8f0; }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid #e2e8f0; align-items: center; }
.icon-btn { background: none; border: none; font-size: 18px; cursor: pointer; color: #64748b; padding: 4px 8px; }
.icon-btn:hover { color: #0f172a; }

/* ── Progress bar ── */
.progress-wrap { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.progress-bar { flex: 1; height: 10px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #3b82f6, #2563eb); transition: width 0.3s ease; border-radius: 999px; }
.progress-percent { font-size: 13px; font-weight: 700; color: #2563eb; min-width: 42px; text-align: right; }

/* ── File drop ── */
.file-drop { display: flex; flex-direction: column; gap: 6px; border: 2px dashed #cbd5e1; border-radius: 10px; padding: 24px; text-align: center; cursor: pointer; transition: border-color 0.15s; }
.file-drop:hover { border-color: #2563eb; background: #f8fafc; }
.file-drop span { font-size: 13px; color: #64748b; }

/* ── Chip list ── */
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: rgba(59,130,246,0.12); color: #1d4ed8; font-size: 12px; font-weight: 600; border: 1px solid rgba(59,130,246,0.3); }
.chip .chip-close { cursor: pointer; opacity: 0.6; }
.chip .chip-close:hover { opacity: 1; }

/* ── User pick list ── */
.user-pick-list { max-height: 300px; overflow-y: auto; border: 1px solid #e2e8f0; border-radius: 8px; margin-top: 8px; }
.user-pick-item { padding: 8px 12px; cursor: pointer; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #f1f5f9; }
.user-pick-item:last-child { border-bottom: none; }
.user-pick-item:hover { background: #f8fafc; }
.user-pick-item.selected { background: rgba(59,130,246,0.08); }
.user-pick-item input[type=checkbox] { margin: 0; }

/* ── Task tree ── */
.task-tree { max-height: 400px; overflow-y: auto; border: 1px solid #e2e8f0; border-radius: 8px; margin-top: 8px; padding: 8px; }
.task-group { margin-bottom: 8px; }
.task-group-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: #f1f5f9; border-radius: 6px; cursor: pointer; user-select: none; }
.task-group-head:hover { background: #e2e8f0; }
.task-group-head.has-selection { background: rgba(59,130,246,0.1); }
.task-group-head input[type=checkbox] { margin: 0; width: 16px; height: 16px; cursor: pointer; }
.task-group-title { flex: 1; font-weight: 700; font-size: 13px; }
.task-group-count { padding: 2px 8px; background: #cbd5e1; border-radius: 999px; font-size: 11px; font-weight: 600; }
.task-group-count.has-sel { background: rgba(59,130,246,0.25); color: #1d4ed8; }
.task-group-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px 4px 32px; }
.task-chip { padding: 4px 10px; border-radius: 6px; background: #f1f5f9; font-size: 12px; font-weight: 600; cursor: pointer; border: 1px solid #e2e8f0; user-select: none; }
.task-chip:hover { background: #e2e8f0; }
.task-chip.selected { background: rgba(59,130,246,0.15); color: #1d4ed8; border-color: rgba(59,130,246,0.4); }

/* ── Misc ── */
.section-title { font-size: 14px; margin: 0 0 10px 0; font-weight: 700; color: #0f172a; }
.full-width { width: 100%; padding: 8px 10px; border: 1px solid #e2e8f0; border-radius: 6px; font-size: 13px; box-sizing: border-box; }
.scroll-max { max-height: 400px; overflow-y: auto; }
.data-table.compact td, .data-table.compact th { padding: 4px 8px; font-size: 12px; }
.checkbox-label { display: flex; align-items: center; gap: 6px; }
.admin-only.hidden-role { display: none; }

/* ── Sample image grid ── */
.sample-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 8px; }
.sample-slot { border: 2px dashed #cbd5e1; border-radius: 8px; aspect-ratio: 4/3; display: flex; flex-direction: column; overflow: hidden; position: relative; cursor: pointer; background: #f8fafc; transition: border-color 0.15s; }
.sample-slot:hover { border-color: #2563eb; }
.sample-slot.has-image { border-style: solid; border-color: #e2e8f0; cursor: default; }
.sample-slot .slot-label { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.65); color: white; font-size: 11px; padding: 4px 8px; font-weight: 600; }
.sample-slot .placeholder { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 13px; color: #64748b; text-align: center; padding: 10px; }
.sample-slot img { width: 100%; height: 100%; object-fit: cover; }
.sample-slot .delete-btn { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.65); color: white; border: none; border-radius: 12px; width: 22px; height: 22px; cursor: pointer; font-size: 12px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.sample-slot .delete-btn:hover { background: rgba(239,68,68,0.9); }

/* ── Template list ── */
.template-card { border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px; margin-bottom: 8px; background: white; }
.template-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.template-card-head h3 { margin: 0; font-size: 15px; }
.template-thumb-row { display: flex; gap: 6px; margin-top: 6px; overflow-x: auto; }
.template-thumb-row img { width: 60px; height: 60px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════ */
/* 响应式设计 - 完整覆盖                                        */
/* ═══════════════════════════════════════════════════════════ */

/* ── 平板 (768-1279px) ── */
@media (max-width: 1279px) {
  .admin-shell { grid-template-columns: 200px minmax(0, 1fr) !important; }
  .sidebar { padding: 12px; }
  .sidebar-brand strong { font-size: 15px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .two-column { grid-template-columns: 1fr; gap: 12px; }
  .two-column.narrow-right { grid-template-columns: 1fr; }
  .form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
  .modal-dialog.large { width: min(800px, 96vw); }
}

/* ── 手机 (<768px) ── */
@media (max-width: 767px) {
  /* 侧栏抽屉化 */
  .admin-shell { grid-template-columns: 1fr; position: relative; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 240px; z-index: 90;
    transform: translateX(-100%); transition: transform 0.25s ease;
    box-shadow: 2px 0 12px rgba(0,0,0,0.15);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 89; display: none;
  }
  .sidebar.open ~ .sidebar-backdrop,
  body.sidebar-open .sidebar-backdrop { display: block; }
  .content-shell { margin-left: 0; }
  .mobile-menu-btn { display: flex; }

  /* Topbar 紧凑 */
  .topbar { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
  .topbar h1 { font-size: 16px; }
  .topbar p { display: none; }
  .topbar-actions { width: 100%; justify-content: flex-end; }

  /* 栅格单列化 */
  .stats-grid { grid-template-columns: 1fr; gap: 8px; }
  .two-column { grid-template-columns: 1fr !important; gap: 10px; }
  .two-column.narrow-right { grid-template-columns: 1fr !important; }
  .form-grid.cols-2 { grid-template-columns: 1fr; gap: 8px; }
  .span-2 { grid-column: 1 / -1; }

  /* Panel padding 缩小 */
  .panel { padding: 12px; }
  .panel-head { flex-wrap: wrap; gap: 8px; }
  .panel-head h2 { font-size: 15px; }

  /* 数据表格 → 卡片化 */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 6px 4px; }
  .data-table.compact td, .data-table.compact th { padding: 4px 3px; font-size: 11px; }

  /* 模态框全屏 */
  .modal-dialog { width: 100vw !important; max-width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; margin: 0; }
  .modal-dialog.large { width: 100vw !important; }
  .modal-head { padding: 10px 14px; position: sticky; top: 0; background: white; z-index: 2; }
  .modal-body { padding: 12px; }
  .modal-foot { padding: 10px 12px; flex-wrap: wrap; }
  .modal-foot button { flex: 1; min-width: 100px; }

  /* 按钮触摸友好 */
  button, .primary-btn, .ghost-btn, .danger-btn {
    min-height: 40px; padding: 8px 14px;
    font-size: 13px;
  }
  button.sm, .primary-btn.sm, .ghost-btn.sm { min-height: 32px; padding: 4px 10px; font-size: 12px; }
  .icon-btn { min-width: 40px; min-height: 40px; }

  /* 输入框触摸友好 */
  input[type=text], input[type=password], input[type=email], input[type=tel], input[type=date], input[type=number], input:not([type]),
  textarea, select {
    min-height: 40px; font-size: 14px; padding: 8px 10px;
  }
  label span { font-size: 12px; }

  /* Toolbar row 换行 */
  .toolbar-row { flex-wrap: wrap; gap: 6px; }

  /* Task tree / batch assign 双栏变上下 */
  #batchAssignModal .form-grid.cols-2 { grid-template-columns: 1fr; }
  .task-tree { max-height: 260px; }
  .user-pick-list { max-height: 240px; }

  /* Sample image grid */
  .sample-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }

  /* Login 页面 */
  .login-shell { grid-template-columns: 1fr !important; padding: 16px; }
  .login-hero { display: none; }
}

/* ── 超小屏 (<480px) ── */
@media (max-width: 479px) {
  .topbar-actions { gap: 4px; }
  .topbar-actions button, .topbar-actions .tag { font-size: 11px; padding: 4px 8px; }
  .modal-head h2 { font-size: 14px; }
  .sample-grid { grid-template-columns: 1fr; }
  .template-thumb-row img { width: 48px; height: 48px; }
}

/* Sample photo overlay in review center */
.sample-overlay {
  position: absolute; top: 6px; right: 6px;
  width: 48px; height: 48px; object-fit: cover;
  border-radius: 6px; cursor: pointer;
  border: 2px solid #22c55e;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: transform 0.15s;
  background: white;
}
.sample-overlay:hover { transform: scale(2.2); z-index: 10; border-color: #16a34a; }

@media (max-width: 767px) {
  .sample-overlay { width: 40px; height: 40px; }
}

/* 汉堡菜单按钮（默认隐藏，窄屏显示） */
.mobile-menu-btn {
  display: none;
  align-items: center; justify-content: center;
  background: none; border: none; padding: 8px;
  font-size: 20px; cursor: pointer;
  color: #0f172a;
  min-width: 40px; min-height: 40px;
}

/* ═══════════════════════════════════════════════════════════ */
/* Phase 2: Toast + Loading + 深色模式                          */
/* ═══════════════════════════════════════════════════════════ */

/* ── Toast ── */
.toast-container {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 999;
  display: flex; flex-direction: column; gap: 10px;
  max-width: 90vw;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 10px;
  min-width: 280px;
  max-width: 420px;
  padding: 12px 14px;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  animation: toast-slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-size: 13.5px;
  line-height: 1.45;
}
.toast.leaving { animation: toast-slide-out 0.25s ease forwards; }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--info); }
.toast-icon { flex-shrink: 0; font-size: 18px; margin-top: -1px; }
.toast-body { flex: 1; color: var(--text); }
.toast-close { background: none; border: none; cursor: pointer; color: var(--muted); padding: 2px; margin-top: -2px; }
.toast-close:hover { color: var(--text); }

@keyframes toast-slide-in {
  from { opacity: 0; transform: translateX(100%) scale(0.96); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toast-slide-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(100%) scale(0.96); }
}

/* ── Loading spinner ── */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(37, 99, 235, 0.2);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}
.spinner.lg { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(255, 255, 255, 0.6); backdrop-filter: blur(2px);
  z-index: 200;
  display: none; align-items: center; justify-content: center;
}
.loading-overlay.active { display: flex; }
.loading-overlay .panel { padding: 24px 28px; display: flex; align-items: center; gap: 12px; }

/* ── 深色模式：整页切换 [data-theme="dark"] ── */
html[data-theme="dark"] {
  color-scheme: dark;
}
html[data-theme="dark"] body { background: #0b1220; color: #e2e8f0; }
html[data-theme="dark"] {
  --bg: #0b1220;
  --panel: #141d2e;
  --line: #2a3447;
  --line-strong: #3b4962;
  --text: #e2e8f0;
  --text-2: #cbd5e1;
  --muted: #94a3b8;
  --brand: #60a5fa;
  --brand-50: rgba(96, 165, 250, 0.12);
  --brand-100: rgba(96, 165, 250, 0.18);
  --brand-600: #60a5fa;
  --brand-700: #93c5fd;
  --brand-2: #38bdf8;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow:    0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}
html[data-theme="dark"] .login-body {
  background: linear-gradient(135deg, #0b1220 0%, #1e293b 100%);
}
html[data-theme="dark"] .login-hero,
html[data-theme="dark"] .login-card,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .modal-dialog,
html[data-theme="dark"] .toast,
html[data-theme="dark"] .assignment-card,
html[data-theme="dark"] .review-card {
  background: var(--panel) !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
}
html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
  background: #1e293b !important;
  color: var(--text) !important;
  border-color: var(--line-strong) !important;
}
html[data-theme="dark"] .data-table th {
  background: #0f1829 !important;
  color: var(--text-2) !important;
}
html[data-theme="dark"] .data-table tr:hover td { background: rgba(96, 165, 250, 0.08); }
html[data-theme="dark"] .nav-item { color: var(--text-2) !important; }
html[data-theme="dark"] .nav-item.active { background: var(--brand) !important; color: #0b1220 !important; }
html[data-theme="dark"] .nav-item:hover { background: rgba(96, 165, 250, 0.12) !important; color: var(--brand) !important; }
html[data-theme="dark"] .brand-mark { background: var(--brand) !important; color: #0b1220; }
html[data-theme="dark"] .hero-points li { background: rgba(96, 165, 250, 0.1) !important; }
html[data-theme="dark"] .primary-btn { background: var(--brand) !important; color: #0b1220 !important; border-color: var(--brand) !important; }
html[data-theme="dark"] .ghost-btn { background: var(--panel) !important; color: var(--text) !important; border-color: var(--line-strong) !important; }
html[data-theme="dark"] .ghost-btn:hover { background: rgba(96, 165, 250, 0.08) !important; color: var(--brand) !important; }
html[data-theme="dark"] .tag.blue { background: rgba(96, 165, 250, 0.15); color: var(--brand); }
html[data-theme="dark"] .tag.green { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
html[data-theme="dark"] .tag.orange { background: rgba(251, 146, 60, 0.15); color: #fb923c; }
html[data-theme="dark"] .tag.red { background: rgba(248, 113, 113, 0.15); color: #f87171; }
html[data-theme="dark"] .loading-overlay { background: rgba(11, 18, 32, 0.7); }

/* ── Customer Management (P5a CR-06) ── */
.customer-split {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.cust-tree-panel {
  position: sticky; top: 14px;
  height: calc(100vh - 130px);
  display: flex; flex-direction: column;
  overflow: hidden;
  padding: 12px;
}
.cust-detail-panel {
  position: sticky; top: 14px;
  max-height: calc(100vh - 130px);
  overflow-y: auto;
  padding: 14px;
  scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent;
}
.cust-tree {
  flex: 1; min-height: 0; overflow-y: auto;
  font-size: 13px;
  scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent;
}
.cust-node {
  margin-bottom: 2px;
}
.cust-node-head {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 8px; border-radius: 6px; cursor: pointer;
  transition: background 0.12s;
}
.cust-node-head:hover { background: rgba(11,95,215,0.07); }
.cust-node-head.selected { background: rgba(11,95,215,0.12); font-weight: 600; }
.cust-node-children { padding-left: 18px; display: none; }
.cust-node.expanded > .cust-node-children { display: block; }
.cust-node.expanded > .cust-node-head .tree-arrow { transform: rotate(90deg); }
.cust-type-chip {
  font-size: 10px; padding: 1px 5px; border-radius: 4px; flex-shrink: 0;
  background: #f1f5f9; color: #64748b; font-weight: 600;
}
.cust-type-chip.operator { background: #dbeafe; color: #1d4ed8; }
.cust-type-chip.subcontractor { background: #fef3c7; color: #92400e; }
.cust-type-chip.internal { background: #ede9fe; color: #5b21b6; }
.cust-type-chip.direct { background: #dcfce7; color: #166534; }

/* Customer detail right panel */
.cust-info-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 6px 16px; margin-bottom: 16px;
}
.cust-info-grid > div { padding: 4px 0; border-bottom: 1px dashed #eef2f7; min-width: 0; }
.cust-info-grid .label { font-size: 11px; color: var(--muted); display: block; margin-bottom: 1px; }
.cust-info-grid strong { font-size: 13px; font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cust-proj-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: 6px;
  font-size: 12px; border: 1px solid #eef2f7;
  margin-bottom: 4px; background: #fafafa;
}
.cust-proj-row:hover { background: #f1f5f9; }
.cust-proj-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.cust-proj-code { color: var(--muted); font-size: 11px; flex-shrink: 0; }
.cust-proj-move { flex-shrink: 0; font-size: 11px; padding: 2px 7px; }
@media (max-width: 900px) {
  .customer-split { grid-template-columns: 1fr; }
  .cust-tree-panel { position: static; max-height: 260px; }
  .cust-info-grid { grid-template-columns: 1fr 1fr; }
}
