:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --panel-muted: #fbfcfd;
  --text: #171717;
  --text-strong: #0f172a;
  --muted: #6b7280;
  --muted-strong: #4b5563;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --accent: #0f766e;
  --accent-soft: #ccfbf1;
  --accent-weak: #f0fdfa;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --amber: #b45309;
  --amber-soft: #fffbeb;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --green: #15803d;
  --green-soft: #f0fdf4;
  --shadow: 0 10px 28px rgba(15, 23, 42, .05);
  --shadow-soft: 0 1px 2px rgba(15, 23, 42, .04);
  --radius: 8px;
  --radius-lg: 12px;
  --sidebar: 276px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  background: #fbfcfd;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  padding: 8px 10px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
}

.brand-logo svg {
  width: 100%;
  height: 100%;
}

.brand h1 {
  margin: 0 0 6px;
  font-size: 22px;
  line-height: 1.2;
  font-weight: 780;
}

.brand p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.nav button {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: #374151;
  padding: 9px 10px;
  text-align: left;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 8px;
}

.nav button:hover {
  background: #f3f4f6;
}

.nav button.active {
  background: #ecfdf5;
  color: #064e3b;
  font-weight: 700;
}

.nav .mark {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
  font-size: 12px;
  color: var(--muted);
  background: #fff;
}

.nav button.active .mark {
  border-color: #99f6e4;
  color: var(--accent);
  background: var(--accent-soft);
}

.nav .count {
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: #f3f4f6;
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 12px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  font-size: 12px;
  line-height: 1.65;
  color: var(--muted);
}

.main {
  min-width: 0;
  padding: 18px 20px 30px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.page-title h2 {
  margin: 0 0 6px;
  font-size: 23px;
  line-height: 1.25;
}

.page-title p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.time-widget {
  min-width: 190px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 7px 10px;
  text-align: right;
  box-shadow: var(--shadow-soft);
}

.time-widget .clock {
  font-size: 20px;
  line-height: 1.1;
  font-weight: 820;
  font-variant-numeric: tabular-nums;
}

.time-widget .date {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: var(--radius);
  padding: 8px 11px;
  color: #374151;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  font-weight: 680;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.btn:hover {
  border-color: #9ca3af;
  background: #f9fafb;
}

.btn:focus-visible,
.mini-btn:focus-visible,
.tab:focus-visible,
.task-stat:focus-visible,
.project-filter-card:focus-visible,
.metric-link:focus-visible {
  outline: 3px solid rgba(15, 118, 110, .18);
  outline-offset: 2px;
  border-color: var(--accent);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(15, 118, 110, .22);
}

.btn .icon {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border-radius: 5px;
  background: #eef2f7;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.btn.primary .icon {
  background: rgba(255,255,255,.2);
  color: #fff;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.toolbar.dense {
  align-items: stretch;
}

.filter-toolbar {
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  padding: 10px;
  box-shadow: var(--shadow-soft);
}

.search {
  flex: 1 1 320px;
  position: relative;
}

.search::before {
  content: "⌕";
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-52%);
  color: #94a3b8;
  font-size: 14px;
  pointer-events: none;
}

.search input,
.control select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  padding: 8px 11px;
  color: #111827;
  outline: none;
}

.search input {
  padding-left: 31px;
}

.search input:focus,
.control select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
}

.controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.control {
  min-width: 150px;
}

.control.project-control {
  min-width: 170px;
}

.mb-12 { margin-bottom: 12px; }
.mb-14 { margin-bottom: 14px; }
.mt-8 { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }
.mt-14 { margin-top: 14px; }
.align-end { display: flex; align-items: flex-end; }
.textarea-compact { min-height: 80px; }
.muted-note { color: var(--muted); font-size: 12px; line-height: 1.5; }
.section-label {
  margin: 0 0 8px;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 760;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.task-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.task-board .confirm-lane {
  grid-column: 1 / -1;
}

.task-card-actions,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.task-overview {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.task-stat {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
  min-height: 78px;
  display: grid;
  align-content: space-between;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.task-stat:hover,
.task-stat.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .09);
}

.task-stat .k {
  color: var(--muted);
  font-size: 12px;
}

.task-stat .v {
  font-size: 22px;
  line-height: 1.1;
  font-weight: 820;
  margin-top: 6px;
}

.project-filter-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.project-filter-card {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px 12px;
  display: grid;
  gap: 5px;
  text-align: left;
  color: inherit;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.project-filter-card:hover,
.project-filter-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .08);
  background: #fbfefd;
}

.project-filter-card .k {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.project-filter-card .v {
  font-size: 20px;
  line-height: 1.1;
  font-weight: 820;
  font-variant-numeric: tabular-nums;
}

.project-filter-card .hint {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-stat.red .v { color: var(--red); }
.task-stat.amber .v { color: var(--amber); }
.task-stat.blue .v { color: var(--blue); }
.task-stat.green .v { color: var(--green); }

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

.priority-task {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px 12px;
  display: grid;
  gap: 6px;
}

.priority-task:first-child {
  border-color: rgba(220, 38, 38, .26);
  background: linear-gradient(90deg, #fff 0%, #fff 72%, var(--red-soft) 100%);
}

.priority-task.postponed {
  background: #f9fafb;
  border-style: dashed;
}

.priority-task .top {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.task-card-head {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.task-card-head .task-card-meta {
  grid-column: 2 / -1;
}

.task-card-head .item-title {
  min-width: 0;
}

.project-panel {
  border-top: 3px solid rgba(15, 118, 110, .28);
}

.project-panel .panel-header {
  padding-block: 11px;
}

.project-panel .panel-body {
  gap: 9px;
}

.project-group-label {
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: .02em;
}

.task-card {
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.task-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .08);
}

.task-card.compact {
  gap: 8px;
}

.task-card-detail {
  display: grid;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.task-card-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.due-chip {
  display: inline-flex;
  min-height: 22px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--line);
  background: #f9fafb;
  color: #374151;
  white-space: nowrap;
}

.due-chip.red { color: #991b1b; background: #fee2e2; border-color: #fecaca; }
.due-chip.amber { color: #92400e; background: #fef3c7; border-color: #fde68a; }
.due-chip.blue { color: #1d4ed8; background: #dbeafe; border-color: #bfdbfe; }
.due-chip.green { color: #166534; background: #dcfce7; border-color: #bbf7d0; }

.mini-btn {
  min-height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: #374151;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 680;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.mini-btn:hover {
  border-color: #9ca3af;
  background: #f8fafc;
}

.mini-btn.active {
  border-color: var(--accent);
  color: #064e3b;
  background: #ecfdf5;
  font-weight: 700;
}

.note-input,
.split-input {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 7px 9px;
  outline: none;
  background: #fff;
  color: #111827;
}

.note-input:focus,
.split-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
}

.subtasks {
  display: grid;
  gap: 7px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.subtask {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 7px;
  align-items: start;
  color: #374151;
  font-size: 12px;
  line-height: 1.45;
}

.capability {
  border-left: 3px solid var(--accent);
  padding: 9px 10px;
  background: #f0fdfa;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: #134e4a;
  font-size: 12px;
  line-height: 1.55;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
}

.panel.subtle {
  background: var(--panel-muted);
  box-shadow: none;
}

.panel-header {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.panel-header h3 {
  margin: 0 0 4px;
  font-size: 16px;
  line-height: 1.3;
  color: var(--text-strong);
}

.panel-header p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.panel-body {
  padding: 14px 16px 16px;
}

.metric {
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
  min-height: 104px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric .label {
  color: var(--muted);
  font-size: 13px;
}

.metric .value {
  font-size: 28px;
  line-height: 1.1;
  font-weight: 800;
  margin: 10px 0 4px;
  font-variant-numeric: tabular-nums;
}

.metric .hint {
  color: var(--muted);
  font-size: 12px;
}

.metric.red .value { color: var(--red); }
.metric.green .value { color: var(--green); }
.metric.blue .value { color: var(--blue); }
.metric.amber .value { color: var(--amber); }

.dashboard-compact {
  display: grid;
  gap: 12px;
}

.dashboard-compact .metric {
  min-height: 84px;
  padding: 11px 12px;
}

.dashboard-compact .metric .value {
  font-size: 23px;
  margin: 7px 0 2px;
}

.dashboard-compact .panel-header {
  padding: 12px 13px 9px;
}

.dashboard-compact .panel-body {
  padding: 11px 13px 13px;
}

.dashboard-compact .item {
  padding: 8px 9px;
  gap: 5px;
}

.metric-link {
  color: inherit;
  display: flex;
  min-height: 100%;
  width: 100%;
  flex-direction: column;
  justify-content: space-between;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
}

.metric-link:hover .label,
.metric-link:hover .hint {
  color: var(--accent);
}

.ops-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.ops-card {
  min-height: 66px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px 11px;
  display: grid;
  gap: 5px;
}

.ops-card .label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.ops-card .value {
  color: var(--text-strong);
  font-size: 18px;
  line-height: 1.15;
  font-weight: 820;
  font-variant-numeric: tabular-nums;
}

.ops-card .hint {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cockpit-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, .9fr) minmax(280px, .85fr);
  gap: 12px;
  align-items: stretch;
}

.task-line,
.agent-line {
  display: grid;
  gap: 5px;
}

.task-title-line {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.dot.red { background: var(--red); }
.dot.amber { background: #f59e0b; }
.dot.blue { background: var(--blue); }
.dot.green { background: var(--green); }
.dot.gray { background: #9ca3af; }

.timeline.compact {
  gap: 7px;
}

.timeline-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 9px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  background: #fff;
}

.timeline-row.gray { background: #f3f4f6; }
.timeline-row.red { border-color: #fecaca; background: #fef2f2; }
.timeline-row.amber { border-color: #fde68a; background: #fffbeb; }
.timeline-row.white { background: #fff; }

.timeline-row .time {
  font-weight: 820;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.timeline-row .summary {
  font-weight: 720;
  line-height: 1.35;
}

.timeline-row .detail {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  margin-top: 2px;
}

.list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: #fff;
  display: grid;
  gap: 7px;
}

.list.compact-list {
  gap: 6px;
}

.list.compact-list .item {
  border-color: transparent;
  border-bottom-color: var(--line);
  border-radius: 0;
  padding: 8px 2px 9px;
}

.list.compact-list .item:last-child {
  border-bottom-color: transparent;
}

.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.item-title {
  font-weight: 700;
  line-height: 1.4;
}

.item-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.read-task {
  background: #f9fafb;
  border-color: var(--line);
}

.read-task .item-title {
  color: var(--muted);
  text-decoration: line-through;
  opacity: 0.7;
}

.read-task .task-card-detail {
  background: #f9fafb;
}

/* P3 空状态引导 */
.empty-state {
  padding: 36px 20px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: #fafbfc;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.empty-title {
  color: var(--muted-strong);
  font-size: 15px;
  font-weight: 760;
}

.empty-hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  max-width: 380px;
}

.empty-hint code {
  background: #e5e7eb;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.insight-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  padding: 11px 12px;
  display: grid;
  gap: 5px;
  min-width: 0;
}

.insight-card .k {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.insight-card .v {
  color: var(--text-strong);
  font-size: 20px;
  line-height: 1.15;
  font-weight: 820;
  font-variant-numeric: tabular-nums;
}

.insight-card .note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.automation-grid {
  display: grid;
  gap: 10px;
}

.automation-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.automation-card-main {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.automation-card-title {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  font-weight: 760;
  line-height: 1.35;
}

.automation-source {
  max-width: 100%;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
  line-height: 1.2;
}

.badge.high { color: #991b1b; background: #fee2e2; border-color: #fecaca; }
.badge.mid { color: #92400e; background: #fef3c7; border-color: #fde68a; }
.badge.low { color: #166534; background: #dcfce7; border-color: #bbf7d0; }
.badge.todo { color: #1d4ed8; background: #dbeafe; border-color: #bfdbfe; }
.badge.doing { color: #1d4ed8; background: #dbeafe; border-color: #bfdbfe; }
.badge.done { color: #166534; background: #dcfce7; border-color: #bbf7d0; }
.badge.wait { color: #92400e; background: #fef3c7; border-color: #fde68a; }
.badge.neutral { color: #374151; background: #f3f4f6; border-color: #e5e7eb; }

.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  color: #374151;
  font-size: 12px;
  font-weight: 720;
  white-space: nowrap;
  cursor: pointer;
}

.toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle .track {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #e5e7eb;
  transition: background .18s ease, border-color .18s ease;
}

.toggle .track::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .18);
  transition: transform .18s ease;
}

.toggle input:checked + .track {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle input:checked + .track::after {
  transform: translateX(18px);
}

.school-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.school-stat-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 11px;
  display: grid;
  gap: 9px;
  min-width: 0;
}

.school-stat-card.included {
  border-color: #99f6e4;
  background: #f0fdfa;
}

.school-stat-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.school-stat-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.3;
}

.school-stat-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tabs {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 12px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.tab {
  min-height: 34px;
  border: 0;
  background: transparent;
  color: #374151;
  border-radius: 6px;
  padding: 7px 11px;
  font-weight: 680;
}

.tab.active {
  background: #0f766e;
  color: #fff;
  border-color: #0f766e;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.75);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
  font-size: 13px;
}

th,
td {
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-weight: 760;
  position: sticky;
  top: 0;
  z-index: 1;
}

th.sortable {
  cursor: pointer;
}

th.sortable:hover {
  background: #f3f4f6;
}

tr:hover td {
  background: #f8fafc;
}

tbody tr:nth-child(even) td {
  background: #fcfdff;
}

th:first-child,
td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
}

th:first-child {
  z-index: 3;
  background: #f8fafc;
}

tbody td:first-child {
  background: #fff;
  font-weight: 680;
  color: var(--text-strong);
}

tbody tr:nth-child(even) td:first-child {
  background: #fcfdff;
}

tbody tr:hover td:first-child {
  background: #f8fafc;
}

td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.path-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px 12px;
}

.path-main {
  min-width: 0;
}

.path-main strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}

.path-main code {
  display: block;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.datasource-card {
  cursor: pointer;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  display: grid;
  gap: 8px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.datasource-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .07);
}

.datasource-card.expanded {
  background: var(--accent-weak);
  border-color: #99f6e4;
}

.datasource-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.datasource-title {
  color: var(--text-strong);
  font-size: 15px;
  font-weight: 760;
  line-height: 1.35;
}

.datasource-meta,
.datasource-summary,
.datasource-owner {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.datasource-summary {
  color: var(--text);
}

.btn.compact {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 12px;
}

.change-log-list {
  display: grid;
}

.change-log-item {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.change-log-item:last-child {
  border-bottom: 0;
}

.change-log-time {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.change-log-title {
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 760;
  margin-bottom: 2px;
}

.change-log-desc {
  color: var(--text);
  font-size: 12px;
  line-height: 1.55;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 340px;
  border-radius: var(--radius);
  padding: 11px 13px;
  background: #111827;
  color: #fff;
  font-size: 13px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.progress {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  width: var(--pct);
  background: var(--accent);
}

.timeline {
  display: grid;
  gap: 10px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.status-chip {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 9px;
  min-width: 0;
}

.status-chip .k {
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 4px;
}

.status-chip .v {
  font-size: 13px;
  font-weight: 720;
  line-height: 1.35;
}

.team-overview-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.team-overview-chip {
  min-height: 78px;
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.team-overview-chip .k {
  font-size: 13px;
  margin-bottom: 7px;
}

.team-overview-chip .v {
  font-size: 22px;
  line-height: 1.1;
  font-weight: 820;
}

.team-card {
  display: grid;
  gap: 10px;
}

.team-card-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.team-school-title {
  margin: 0 0 4px;
  font-size: 16px;
  line-height: 1.3;
}

.team-leaders {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.team-progress {
  display: grid;
  gap: 6px;
}

.team-progress-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

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

.risk-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px 11px;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: start;
}

.risk-item .risk-title {
  font-weight: 760;
  line-height: 1.35;
}

.risk-item .risk-action {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin-top: 3px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.timeline-item:last-child {
  border-bottom: 0;
}

.timeline-time {
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.empty {
  padding: 26px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, .42);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 30;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 24px 80px rgba(15, 23, 42, .22);
}

.modal-header,
.modal-footer {
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.modal-footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
}

.modal-header h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.modal-header p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.modal-body {
  padding: 15px 16px;
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 12px;
  color: #374151;
  font-weight: 740;
}

.field textarea,
.field input,
.field select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  padding: 9px 10px;
  color: #111827;
  outline: none;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.5;
}

.field textarea:focus,
.field input:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.preview-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  padding: 11px;
  display: grid;
  gap: 8px;
}

.sync-state {
  margin-right: auto;
  color: var(--muted);
  font-size: 12px;
}

.mobile-menu {
  display: none;
}

/* P4 服务连接状态横幅 */
.service-banner {
  padding: 10px 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  color: #991b1b;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.service-banner span:first-child {
  font-weight: 760;
  white-space: nowrap;
}

.service-banner code {
  background: #fee2e2;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
}

@media (max-width: 1080px) {
  .dashboard-compact .metric {
    min-height: 72px;
    padding: 10px 10px;
  }

  .dashboard-compact .metric .value {
    font-size: 20px;
    margin: 5px 0 2px;
  }

  .dashboard-compact .metric .label,
  .dashboard-compact .metric .hint {
    font-size: 11px;
  }

  .cockpit-layout {
    grid-template-columns: 1fr;
  }

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

  .project-filter-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ops-strip,
  .insight-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .task-board {
    grid-template-columns: 1fr;
  }

  .task-board .confirm-lane {
    grid-column: auto;
  }

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

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

  .school-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric {
    min-height: 72px;
    padding: 10px 10px;
  }

  .metric .value {
    font-size: 20px;
    margin: 5px 0 2px;
  }

  .metric .label,
  .metric .hint {
    font-size: 11px;
  }
}

@media (max-width: 820px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    gap: 10px;
  }

  .brand {
    padding: 4px 6px 8px;
    gap: 8px;
  }

  .brand-logo {
    width: 36px;
    height: 36px;
  }

  .brand h1 {
    font-size: 18px;
  }

  .brand p {
    font-size: 11px;
  }

  .mobile-menu {
    display: block;
    width: 100%;
  }

  .nav {
    display: none;
  }

  .nav.open {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }

  .nav button {
    min-height: 36px;
    padding: 7px 8px;
    font-size: 12px;
  }

  .sidebar-footer {
    display: none;
  }

  .main {
    padding: 12px 10px 26px;
    overflow-x: hidden;
  }

  .topbar {
    flex-direction: column;
    gap: 10px;
  }

  .top-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
  }

  .time-widget {
    min-width: unset;
    flex: 0 0 auto;
    padding: 5px 8px;
  }

  .time-widget .clock {
    font-size: 16px;
  }

  .btn {
    min-height: 32px;
    padding: 6px 8px;
    font-size: 12px;
  }

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

  .grid.cols-2,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .task-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .task-stat {
    padding: 8px;
    min-height: 64px;
  }

  .task-stat .v {
    font-size: 18px;
    margin-top: 4px;
  }

  .ops-strip,
  .insight-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .project-filter-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .project-filter-card {
    min-height: 60px;
    padding: 8px 10px;
  }

  .project-filter-card .v {
    font-size: 16px;
  }

  .school-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .team-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .team-overview-chip .v {
    font-size: 18px;
  }

  .automation-card {
    grid-template-columns: 1fr;
  }

  .path-card {
    grid-template-columns: 1fr;
  }

  .path-card .btn {
    justify-content: center;
  }

  .path-card {
    flex-wrap: wrap;
  }

  .path-card .btn,
  .path-card a.btn {
    flex: 1;
    justify-content: center;
  }

  .change-log-item {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  table {
    min-width: 680px;
  }

  .panel-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .panel-header h3 {
    font-size: 14px;
  }

  .panel-header p {
    font-size: 11px;
  }

  .filter-toolbar .search,
  .filter-toolbar .control,
  .filter-toolbar .controls {
    flex: 1 1 100%;
    width: 100%;
  }

  .filter-toolbar .controls .control {
    flex: 1 1 120px;
    min-width: 100px;
  }

  .control {
    min-width: unset;
  }

  .status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .task-card-meta {
    gap: 4px;
  }

  .modal {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 12px 14px;
  }

  .toast {
    right: 10px;
    bottom: 10px;
    left: 10px;
    max-width: unset;
  }

  .cockpit-layout {
    grid-template-columns: 1fr;
  }

  .task-board {
    grid-template-columns: 1fr;
  }

  .task-board .confirm-lane {
    grid-column: auto;
  }

  .timeline-row {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 6px;
    padding: 6px 8px;
  }

  .timeline-row .time {
    font-size: 12px;
  }

  .dashboard-compact .metric {
    min-height: 68px;
    padding: 8px 10px;
  }

  .dashboard-compact .metric .value {
    font-size: 18px;
  }

  .dashboard-compact .metric .label {
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .task-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-filter-strip {
    grid-template-columns: 1fr;
  }

  .school-list {
    grid-template-columns: 1fr;
  }

  .ops-strip,
  .insight-grid {
    grid-template-columns: 1fr;
  }

  .status-grid {
    grid-template-columns: 1fr;
  }

  .team-overview-grid {
    grid-template-columns: 1fr;
  }

  .metric {
    min-height: 72px;
    padding: 10px 12px;
  }

  .metric .value {
    font-size: 20px;
    margin: 5px 0 2px;
  }

  .metric .label,
  .metric .hint {
    font-size: 11px;
  }

  .panel-body {
    padding: 10px 12px;
  }

  .panel-header {
    padding: 10px 12px;
  }

  .panel-header h3 {
    font-size: 13px;
  }

  .panel-header p {
    font-size: 11px;
  }

  .filter-toolbar .controls .control {
    flex: 1 1 100%;
    min-width: 0;
  }

  .top-actions .btn .icon {
    width: 16px;
    height: 16px;
    font-size: 10px;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 10px 12px;
  }

  .metric {
    min-height: 64px;
    padding: 8px 10px;
  }

  .metric .value {
    font-size: 18px;
    margin: 4px 0 2px;
  }

  .metric .label,
  .metric .hint {
    font-size: 10px;
  }
}

/* ─── 配置面板 ─── */

.footer-config-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 8px;
  font-size: 14px;
  cursor: pointer;
  color: var(--muted);
  margin-bottom: var(--space-2);
}

.footer-config-btn:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.config-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3);
  border-bottom: 1px solid var(--line);
}

.config-modal .modal-body {
  padding: var(--space-3);
  max-width: 500px;
  margin: 0 auto;
}

.config-help {
  margin: var(--space-3) 0;
  padding: var(--space-3);
  background: var(--panel-soft);
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.6;
}

.config-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}

