/* 政务：基本样式来自 /diary/diary.css，这里只有政务自己的布局 */
.gov-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; align-items: start; }

/* ---------- 左侧：全部政府 ---------- */
.tree-box { padding: 12px 10px 14px; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; }
.tree-box > summary { display: none; }
.tree-tools { display: flex; justify-content: flex-end; padding: 0 4px; }
.tree-tools:empty { display: none; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { margin-left: 11px; padding-left: 4px; border-left: 1px solid var(--line); }
.tree > li + li { margin-top: 6px; }
.node-row { display: flex; align-items: center; gap: 2px; }
.fold, .fold-space { flex: 0 0 22px; width: 22px; height: 26px; }
.fold {
  padding: 0; border: none; border-radius: 6px; background: transparent;
  color: var(--muted); font-size: 12px; line-height: 26px;
}
.fold:hover { background: var(--track); color: var(--fg); }
.tree .node {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px; border-radius: 8px;
  color: var(--fg); text-decoration: none; font-size: 14px; line-height: 1.4;
}
.tree .node:hover { background: var(--track); }
.tree .node.selected { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tree .lvl-central > .node-row .node { font-weight: 600; font-size: 15px; }
.tree .lvl-day > .node-row .node { font-size: 13.5px; }
.tree .count { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 400; }
.today-mark {
  padding: 0 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent);
  font-size: 11.5px; font-weight: 600; line-height: 1.6;
}
.tree .node.selected .today-mark { background: var(--accent); color: #fff; }

.new-form { display: flex; gap: 6px; margin-top: 12px; }
.new-form input {
  flex: 1; min-width: 0; font: inherit; font-size: 14px;
  padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--fg);
}
.new-form button { flex: 0 0 auto; }
.tree-box .new-form { padding: 12px 4px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.tree-box .new-form input, .tree-box .new-form button { flex: 1 1 100%; }

/* ---------- 右侧：一个政府 ---------- */
.gov-main { min-width: 0; display: flex; flex-direction: column; }
#unit { display: flex; flex-direction: column; gap: 16px; }
.empty p { margin: 0; color: var(--muted); }

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--accent); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs .sep { opacity: 0.6; }

.unit-head { display: flex; align-items: flex-end; gap: 12px; margin-top: -6px; }
.unit-title { flex: 1; min-width: 0; }
.level-tag { margin: 0; color: var(--muted); font-size: 13px; }
.unit-head h2 { margin: 0; font-size: 24px; line-height: 1.3; overflow-wrap: anywhere; }
.today-tag {
  display: inline-block; margin-left: 8px; padding: 0 7px; vertical-align: 4px;
  border-radius: 6px; background: var(--accent-soft); color: var(--accent);
  font-size: 12px; font-weight: 600; line-height: 1.7;
}
.unit-actions { display: flex; gap: 6px; flex: 0 0 auto; }

/* 上级计划 */
.parents h3, .children h3 { margin: 0 0 10px; font-size: 15px; }
.parent-group + .parent-group { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.parent-line { margin: 0 0 6px; display: flex; align-items: center; gap: 8px; }
.level-chip { padding: 0 7px; border-radius: 6px; background: var(--track); color: var(--muted); font-size: 12px; line-height: 1.7; }
.parent-name { color: var(--fg); font-weight: 600; text-decoration: none; }
.parent-name:hover { color: var(--accent); }
.parent-none { margin: 0; }
.parent-plans { margin: 0; padding-left: 22px; }
.parent-plans li + li { margin-top: 4px; }
.parent-plans summary { cursor: pointer; font-size: 15px; }
.parent-plans summary:hover { color: var(--accent); }
.plan-peek { margin: 6px 0 8px; padding: 10px 12px; border-radius: 8px; background: var(--track); font-size: 14px; }
.plan-peek strong { display: block; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.plan-peek div { white-space: pre-wrap; line-height: 1.7; overflow-wrap: anywhere; }
.plan-peek div + strong { margin-top: 8px; }

/* 计划卡片、每一天 */
.section-title { margin: 4px 0 10px; font-size: 15px; }
.plan-list { display: flex; flex-direction: column; gap: 14px; }
.plans-empty { margin: 0 0 4px; }
.add-plan { margin-top: 12px; align-self: flex-start; }
.plans { display: flex; flex-direction: column; }

.plan-card, .day-editor { padding: 16px 20px 12px; }
.plan-card .title { font-size: 18px; margin-bottom: 4px; }
.field-label { display: block; margin-top: 10px; color: var(--muted); font-size: 13px; font-weight: 600; }
.field {
  display: block; width: 100%; min-height: 72px;
  padding: 4px 0 6px; margin: 0;
  border: none; border-bottom: 1px solid var(--line); outline: none; resize: none; overflow: hidden;
  background: transparent; color: var(--fg);
  font: inherit; font-size: 16px; line-height: 1.75;
}
.field:focus { border-bottom-color: var(--accent); }
.field::placeholder { color: var(--muted); opacity: 0.7; }
.day-editor .field { min-height: 140px; }
.plan-card .editor-foot, .day-editor .editor-foot { margin-top: 8px; padding-top: 8px; border-top: none; }

/* 下级 */
.child-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.child {
  display: flex; align-items: baseline; gap: 10px;
  padding: 8px 10px; border-radius: 8px; color: var(--fg); text-decoration: none;
}
.child:hover { background: var(--track); }
.child b { flex: 0 0 auto; font-size: 15px; display: inline-flex; align-items: center; gap: 6px; }
.child-sub { flex: 1; min-width: 0; color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.child-tag { flex: 0 0 auto; font-size: 12px; color: var(--muted); }
.child-tag.done { color: var(--ok); }
.children .new-form { max-width: 420px; }

/* ---------- 窄屏：政府列表收进顶部 ---------- */
@media (max-width: 860px) {
  .gov-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .tree-box { position: static; max-height: none; }
  .tree-box > summary { display: list-item; cursor: pointer; font-weight: 600; font-size: 15px; padding: 2px 4px; }
  .tree-box[open] > summary { margin-bottom: 8px; }
}

@media (max-width: 520px) {
  .unit-head { flex-wrap: wrap; align-items: flex-start; }
  .unit-head h2 { font-size: 21px; }
  .plan-card, .day-editor { padding: 14px 14px 10px; }
  .child { flex-wrap: wrap; row-gap: 2px; }
  .child-sub { flex-basis: 100%; order: 3; }
}
