/* 县委工作协作平台 · 样式
 * 目标：轻量、清晰、政务场合耐看。不用任何前端框架。
 */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --line: #e3e6ea;
  --text: #1b1f24;
  --text-sub: #5c6672;
  --brand: #b01f24;          /* 政务红，克制使用 */
  --brand-soft: #fdf2f2;
  --warn: #b7791f;
  --warn-soft: #fff8e6;
  --danger: #c53030;
  --danger-soft: #fdecec;
  --ok: #276749;
  --ok-soft: #ecf7f1;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-decoration: none; }

.page { max-width: 900px; margin: 0 auto; padding: 0 14px 48px; }

/* 顶栏 */
.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0 12px;
}
.topbar .title { font-size: 17px; font-weight: 600; }
.topbar .who { font-size: 12px; color: var(--text-sub); }

/* 统计卡片 */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.stat {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 10px;
  text-align: center;
  text-decoration: none;
  color: inherit;
}
.stat .num { font-size: 22px; font-weight: 600; line-height: 1.2; }
.stat .lab { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.stat.is-overdue .num { color: var(--danger); }
.stat.is-review .num { color: var(--warn); }
/* 这四个数同时是筛选开关：点中的那个亮出来，再点一下回到全部 */
.stat:active { background: #f2f5f8; }
.stat.is-active { border-color: var(--brand); background: #eef4fb; }
.stat.is-active .lab { color: var(--brand); }
.clear-filter { margin-left: 8px; color: var(--brand); text-decoration: none; }

/* 任务列表 */
.section-title {
  font-size: 13px;
  color: var(--text-sub);
  margin: 18px 0 8px;
  padding-left: 2px;
}

.task {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid transparent;   /* 重要程度用它上色，见文件末 */
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.task:active { background: #fafbfc; }
.task.is-overdue { border-left: 3px solid var(--danger); }

/* 标签**单独一行**：标题再长也挤不散它们，不会出现"紧急"被挤到下一行的情况 */
.task-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 6px 0;
}

.task-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.task-title {
  font-weight: 600;
  font-size: 15px;
  flex: 1 1 auto;
  min-width: 0;
}
.task-meta {
  font-size: 12px;
  color: var(--text-sub);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

/* 标签 */
.tag {
  display: inline-block;
  font-size: 11px;
  line-height: 18px;
  padding: 0 7px;
  border-radius: 9px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.tag.pending_accept { background: #eef1f4; color: #495260; }
.tag.in_progress    { background: var(--brand-soft); color: var(--brand); }
.tag.pending_review { background: var(--warn-soft); color: var(--warn); }
.tag.done           { background: var(--ok-soft); color: var(--ok); }
.tag.cancelled      { background: #eef1f4; color: #8a93a0; }
.tag.overdue        { background: var(--danger-soft); color: var(--danger); }
.tag.rolled         { background: #fff3e0; color: #e65100; }   /* 顺延：橙色 */
.tag.urgent         { background: var(--danger-soft); color: var(--danger); }
.tag.important      { background: var(--warn-soft); color: var(--warn); }

/* 进度条 */
.bar {
  height: 6px;
  background: #eceff3;
  border-radius: 3px;
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: 3px;
}
.bar.is-done > span { background: var(--ok); }
.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.bar-row .bar { flex: 1; }
.bar-row .pct { font-size: 12px; color: var(--text-sub); min-width: 38px; text-align: right; }

/* 空状态 */
.empty {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 36px 16px;
  text-align: center;
  color: var(--text-sub);
  font-size: 14px;
}

/* 时间线 */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative;
  padding: 0 0 16px 18px;
  border-left: 1px solid var(--line);
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
}
.timeline .ev-head {
  font-size: 12px;
  color: var(--text-sub);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.timeline .ev-body { font-size: 14px; margin-top: 2px; white-space: pre-wrap; word-break: break-word; }

/* 提示条 */
.notice {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  color: var(--text-sub);
}
.notice strong { color: var(--text); }

@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- 台账 ---------- */

.quicknav {
  margin-bottom: 12px;
  font-size: 14px;
}
.quicknav a { color: #1a4b8c; }

.daynav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 14px;
}
.daynav-btn { color: #1a4b8c; }
.daynav-now { font-weight: 600; }

/* 台账按周看时，每天一个小标题 */
.day-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 14px 0 8px;
  font-size: 14px;
  font-weight: 600;
}
.day-count {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-sub);
}

/* 台账里每条任务一块：标题 + 属性 + 下面的留痕 */
.led-task {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}
.led-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.led-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 4px;
  font-size: 12px;
  color: var(--text-sub);
}
.led-empty {
  padding: 4px 0;
  font-size: 13px;
  color: var(--text-sub);
}

.entry {
  display: flex;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
}
.entry-time {
  flex: 0 0 42px;
  font-size: 12px;
  color: var(--text-sub);
  padding-top: 2px;
}
.entry-main { flex: 1; min-width: 0; }
.entry-head {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.entry-title { font-weight: 600; font-size: 14px; }
.entry-who {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 4px;
}
.entry-body {
  font-size: 13px;
  margin-top: 6px;
  line-height: 1.55;
  word-break: break-word;
}

.person {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
}
.person-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.person-name { font-weight: 600; }
.person-dept {
  font-size: 12px;
  color: var(--text-sub);
  margin-left: 6px;
}
.person-last { font-size: 12px; color: var(--text-sub); }
.person-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
  text-align: center;
}
.person-grid .n { font-weight: 600; font-size: 15px; }
.person-grid .l { font-size: 11px; color: var(--text-sub); margin-top: 2px; }
.num-warn { color: #c0392b; }

/* 现场影像 */
.entry-wrap { margin-bottom: 8px; }
.entry-wrap .entry { margin-bottom: 0; }

.ev-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.photo-thumb { display: block; width: 108px; text-decoration: none; }
.photo-thumb img {
  display: block;
  width: 108px;
  height: 108px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.photo-thumb span {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: var(--text-sub);
  text-align: center;
}

/* 选完照片的本地预览（浏览器自带的文件框只显示文件名） */
.photo-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.photo-preview img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.photo-meta { margin-bottom: 10px; }
.photo-task { font-weight: 600; font-size: 14px; }
.photo-sub { font-size: 12px; color: var(--text-sub); margin-top: 4px; }
.photo-box {
  background: #0f1216;
  border-radius: 10px;
  overflow: hidden;
}
.photo-box img { display: block; max-width: 100%; margin: 0 auto; }

/* ---------- 自主工作上报 ---------- */
.tag.self { background: #eef4fb; color: #1a4b8c; }
.tag.week { background: #f2f0fb; color: #4b3f8c; }

/* ---------- 工作台：筛选（周次 / 程度 / 责任人） ---------- */
.filters {
  display: flex;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 14px;
}
.filter {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.filter-lab {
  font-size: 11px;
  color: var(--text-sub);
  padding-left: 2px;
}
/* 筛选区的下拉：跟表单里同一套壳，只是收紧一号 */
.pick-sm .op-btn {
  padding: 9px 10px;
  border-color: #cfd7e0;
  background: #fff;
  font-size: 13.5px;
}
.pick-sm .op-arrow { width: 14px; height: 14px; }
.pick-sm .op-panel { max-height: 240px; min-width: max(100%, 132px); }
.pick-sm .op-item { padding: 10px 10px; }
.pick-sm .op-name { font-size: 14px; font-weight: 400; white-space: nowrap; }

/* 手机屏放不下一行四个筛选：两行两列，每个下拉都有足够宽度显示“第47周” */
@media (max-width: 560px) {
  .filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 8px;
  }
}

/* ---------- 重要程度：三档一眼分得出，但绝不整条红 ----------
 * 商量好的口径：要紧的用红、一般的用蓝。做法是：
 * 一个小标签 + 卡片左侧一条竖边 + 极淡的底色，扫一眼就分得出，不刺眼。
 */
.tag.normal { background: #e8f0fb; color: #15508f; }
.tag.important { background: #e08a1e; color: #fff; }
.tag.urgent { background: #c53030; color: #fff; font-weight: 600; }

.task.prio-important { border-left-color: #e08a1e; background: #fffaf3; }
.task.prio-urgent { border-left-color: #c53030; background: #fff6f6; }

.quicknav-sep { color: var(--line); margin: 0 6px; }

/* ---------- 工作台：四个动作按钮（下达任务 / 上报 / 周报 / 台账） ---------- */
.actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.actions.is-four { grid-template-columns: repeat(2, 1fr); }
.actions.is-five { grid-template-columns: repeat(3, 1fr); }
.action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 13px 2px 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(20, 30, 45, .04);
  font-size: 12px;
  color: var(--text);
}
.action:active { background: #f2f5f8; }
.action .ico { color: var(--brand); line-height: 0; }
.action .ico svg { width: 21px; height: 21px; }

/* ---------- 周计划填报 ---------- */
.plan-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px 12px;
  margin-bottom: 10px;
}
.plan-row .field { margin-bottom: 8px; }
.plan-row-side { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.plan-row-side .field { margin-bottom: 0; flex: 1 1 88px; }
.plan-drop {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-sub);
  padding-bottom: 7px;
}

/* ---------- 工作台账 ---------- */
/* 顶部一行小统计：先知道量级，再往下看流水 */
.ledger-summary {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 12px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-sub);
}
.ledger-summary b { color: var(--text); font-size: 15px; }
.ledger-summary .num-warn { color: var(--danger); }

/* 导出范围：选完自动刷新，两个导出按钮跟着这个范围走 */
.range-pick { margin-bottom: 10px; }

/* 一天几十条的时候别一路刷到底：前 10 条直接看，剩下的折起来 */
details.more > summary,
details.overview > summary {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 13px;
  color: #1a4b8c;
  margin-bottom: 10px;
}
details.more > summary { text-align: center; }
details.overview > summary { color: var(--text-sub); margin-top: 10px; }

/* ---------- 导出按钮 ---------- */
.exports {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.export-btn {
  flex: 1;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  color: #1a4b8c;
}

/* ---------- 台账：就地传现场照片 ----------
   收起来放，不挤占台账正文；点开才展开表单。 */
.uploader {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  margin-bottom: 14px;
}
.uploader summary {
  padding: 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: #1a4b8c;
  cursor: pointer;
}
.uploader[open] summary {
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}
.uploader .form {
  background: none;
  border: 0;
  padding: 0 0 14px;
}

.banner {
  background: var(--ok-soft);
  border: 1px solid #cfe8db;
  color: var(--ok);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 14px;
  margin: 10px 0;
}
.banner-warn {
  background: var(--danger-soft);
  border-color: #f3cccc;
  color: var(--danger);
}

.hint {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 14px;
}
.hint strong { color: var(--text); }

.form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 14px;
}
.field { display: block; margin-bottom: 16px; }
.field-label {
  display: block;
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 6px;
}
.field-label i { font-style: normal; color: var(--danger); }
.field-tip { display: block; font-size: 12px; color: var(--text-sub); margin-top: 5px; }

/* 原生 select 兜底：页面上的下拉统一用自绘的 .owner-pick，
   这里把原生控件的系统外观去掉、箭头换成同一枚，免得哪天漏了又不统一 */
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%235c6672' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
}

.form input[type="text"],
.form select,
.form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font: inherit;
  color: var(--text);
  background-color: #fff;
}
.form textarea { resize: vertical; }
.form input[type="file"] { font-size: 13px; }

.radios { display: flex; gap: 16px; flex-wrap: wrap; }
.radio { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.radio input { width: auto; }

.btn {
  display: inline-block;
  border: 0;
  border-radius: 8px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 600;
}
.btn-primary { background: var(--brand); color: #fff; width: 100%; }

/* ---------- 周报 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}

.digest {
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.report-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}
.report-name { font-weight: 600; font-size: 15px; }

.report-body {
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.review-line {
  font-size: 13px;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
  line-height: 1.6;
}

.review-form { margin-top: 10px; }
.review-note {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  margin-bottom: 8px;
}
.review-btns { display: flex; gap: 8px; flex-wrap: wrap; }

.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-primary-sm { background: var(--brand); color: #fff; padding: 8px 14px; font-size: 13px; }
.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-sub);
  padding: 10px 16px;
  font-size: 13px;
  width: 100%;
}

/* ---------- 任务详情页：责任人自己动手的操作区 ----------
   微信插件里卡片按钮点不到，所以"点一下"的操作都放网页上做。 */
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { width: auto; flex: 1; min-width: 96px; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-block { width: 100%; }

.slider {
  width: 100%;
  height: 28px;         /* 手指点得到的触摸高度 */
  margin: 0;
  accent-color: var(--brand);   /* 用原生滑块，各端都稳，不用自己画 */
}
.ticks {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-sub);
}

/* 书记批示在办理过程里要一眼看见 */
.timeline li.is-note {
  background: #fff6f6;
  border-radius: 6px;
  padding: 8px 10px;
}
.timeline li.is-note .ev-head strong { color: var(--brand); }

/* ---------- 进展记录：每条自成一个进度点 ---------- */
.timeline .pct-chip {
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
}

.form input[type="date"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font: inherit;
  color: var(--text);
  background: #fff;
}

.report-edit {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font: inherit;
  font-size: 14px;
  line-height: 1.7;
  resize: vertical;
  margin-bottom: 10px;
}

/* ---------- 责任人下拉（自绘，替代原生 select 的系统弹层） ---------- */
.owner-pick { position: relative; }

.op-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  text-align: left;
}
.op-btn:active { background: #f7f9fb; }
.op-current {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.op-current.op-empty { color: #9aa3ad; }
.op-arrow { flex: none; color: var(--text-sub); transition: transform .15s ease; }
.owner-pick.is-open .op-arrow { transform: rotate(180deg); }

.op-panel {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 30;
  /* 宽度跟着候选文字走，至少和按钮一样宽；不能跟按钮同宽，否则窄按钮里“第47周”会被挤成一列 */
  width: max-content;
  min-width: 100%;
  max-width: min(340px, calc(100vw - 24px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(20, 30, 45, .14);
  max-height: 296px;
  overflow-y: auto;
  padding: 4px;
  -webkit-overflow-scrolling: touch;
}
/* 靠屏幕右边的下拉（责任人、分类）：往左展开，别顶出屏幕 */
.op-panel.is-right { left: auto; right: 0; }
.owner-pick.is-open .op-btn { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.op-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: none;
  border-radius: 8px;
  padding: 9px 10px;
  font: inherit;
  text-align: left;
  color: var(--text);
}
.op-item:active { background: #f2f5f8; }
.op-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.op-name { font-size: 15px; font-weight: 600; }
/* 选项就是普通文字（分类、程度、任务）时别用责任人的粗体大字 */
.op-item.op-plain .op-name { font-size: 14.5px; font-weight: 500; }
.op-domain { font-size: 12px; color: var(--text-sub); }
.op-check { flex: none; color: var(--brand); opacity: 0; }
.op-item[aria-selected="true"] { background: var(--brand-soft); }
.op-item[aria-selected="true"] .op-check { opacity: 1; }

.owner-pick.is-error .op-btn { border-color: var(--danger); }
.op-error { display: block; font-size: 12px; color: var(--danger); margin-top: 5px; }
