:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --ink: #17212b;
  --ink-soft: #40505d;
  --muted: #758391;
  --line: #dce3e8;
  --line-strong: #cbd5dc;
  --coral: #d95745;
  --coral-soft: #fff0ed;
  --teal: #087f83;
  --teal-soft: #e8f7f6;
  --gold: #b7791f;
  --gold-soft: #fff6df;
  --blue: #3568b8;
  --danger: #b93847;
  --shadow: 0 8px 24px rgba(23, 33, 43, .06);
  --radius: 6px;
  --max: 1440px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Aptos", "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 15px; line-height: 1.5; }
button, a { font: inherit; }
a { color: inherit; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 20; padding: 10px 14px; background: var(--ink); color: #fff; border-radius: 4px; text-decoration: none; }
.skip-link:focus { top: 12px; }

.topbar { position: sticky; top: 0; z-index: 10; border-bottom: 1px solid rgba(203, 213, 220, .9); background: rgba(244, 246, 248, .96); backdrop-filter: blur(10px); }
.topbar-inner { width: min(100% - 40px, var(--max)); min-height: 68px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: .01em; }
.brand img { display: block; width: 126px; height: auto; filter: brightness(.34); }
.brand span { padding-left: 12px; border-left: 1px solid var(--line-strong); color: var(--muted); font-size: 13px; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.sync-state { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 4px var(--teal-soft); }
.sync-state.is-error .sync-dot { background: var(--danger); box-shadow: 0 0 0 4px #fdecef; }
.sync-state.is-busy .sync-dot { background: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft); }
.refresh-button { min-height: 42px; display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface); color: var(--ink); cursor: pointer; box-shadow: 0 2px 4px rgba(23, 33, 43, .04); transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.refresh-button:hover { border-color: var(--coral); background: var(--coral-soft); }
.refresh-button:active { transform: translateY(1px); }
.refresh-button:disabled { cursor: wait; opacity: .62; }
.refresh-button svg { width: 17px; height: 17px; }

.page-shell { width: min(100% - 40px, var(--max)); margin: 0 auto; padding: 30px 0 44px; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(390px, 470px); gap: 34px; align-items: stretch; padding: 28px 0 30px; }
.hero-copy { padding: 18px 0 8px; }
.eyebrow, .section-index { margin: 0; color: var(--coral); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.hero h1 { margin: 12px 0 8px; font-size: clamp(40px, 5vw, 74px); line-height: .98; letter-spacing: -.035em; }
.hero-subtitle { max-width: 560px; margin: 0; color: var(--ink-soft); font-size: 18px; }
.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 22px; color: var(--muted); font-size: 12px; }
.hero-meta a { display: inline-flex; align-items: center; gap: 4px; color: var(--blue); font-weight: 700; text-decoration: none; }
.hero-meta a:hover { text-decoration: underline; }
.hero-meta svg { width: 14px; height: 14px; }
.current-focus { min-height: 228px; padding: 22px 24px; border: 1px solid #263844; border-radius: var(--radius); background: #1f2d36; color: #fff; box-shadow: var(--shadow); }
.focus-heading { display: flex; align-items: center; gap: 10px; color: #c8d3d8; font-size: 12px; }
.focus-heading strong { color: #fff; font-size: 24px; }
.focus-asof { margin-left: auto; color: #a9bbc4; font-size: 11px; }
.focus-rate { display: flex; align-items: baseline; gap: 12px; padding: 16px 0 18px; border-bottom: 1px solid rgba(255,255,255,.16); }
.focus-rate strong { color: #ffd2aa; font-size: 62px; line-height: .95; font-variant-numeric: tabular-nums; }
.focus-rate span { color: #c8d3d8; font-size: 13px; }
.focus-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding-top: 18px; }
.focus-metrics div { min-width: 0; }
.focus-metrics span { display: block; color: #a9bbc4; font-size: 11px; }
.focus-metrics strong { display: block; margin-top: 3px; color: #fff; font-size: 18px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.section-nav { display: flex; gap: 26px; align-items: center; border-bottom: 1px solid var(--line); }
.section-nav-link { min-height: 46px; display: inline-flex; align-items: center; border-bottom: 2px solid transparent; color: var(--muted); font-size: 13px; font-weight: 700; text-decoration: none; }
.section-nav-link:hover, .section-nav-link.is-active { color: var(--ink); border-bottom-color: var(--coral); }
.dashboard-section { scroll-margin-top: 84px; padding-top: 48px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.section-heading h2 { margin: 6px 0 0; font-size: 29px; line-height: 1.15; letter-spacing: -.025em; }
.section-heading-current h2 { display: flex; gap: 9px; align-items: baseline; }
.section-note { margin: 0 0 4px; color: var(--muted); font-size: 12px; }
.pace-badge { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--muted); font-size: 12px; }
.pace-badge svg { width: 16px; height: 16px; color: var(--teal); }
.pace-badge strong { color: var(--ink); }
.pace-badge.is-alert { border-color: #ecc98d; background: var(--gold-soft); }
.pace-badge.is-alert svg, .pace-badge.is-alert strong { color: var(--gold); }

.metric-grid { display: grid; gap: 10px; }
.metric-grid-five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.metric-grid-six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.metric-card { min-width: 0; min-height: 130px; padding: 17px 17px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.metric-card.is-highlight { border-color: #e8b2a9; background: var(--coral-soft); }
.metric-card.is-alert { border-color: #ecc98d; background: var(--gold-soft); }
.metric-card-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-card-label svg { width: 15px; height: 15px; color: var(--coral); }
.metric-card-value { display: block; margin-top: 13px; overflow-wrap: anywhere; color: var(--ink); font-size: clamp(22px, 2.4vw, 31px); line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.metric-card.is-highlight .metric-card-value { color: var(--coral); }
.metric-card.is-alert .metric-card-value { color: var(--gold); }
.metric-card-foot { display: block; margin-top: 12px; color: var(--muted); font-size: 11px; }

.annual-grid, .current-grid, .team-grid { display: grid; gap: 14px; margin-top: 14px; }
.annual-grid, .current-grid { grid-template-columns: minmax(0, 1.6fr) minmax(320px, .8fr); }
.team-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.chart-panel { padding: 19px 20px 14px; }
.panel-heading { min-height: 30px; display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.panel-heading h3 { margin: 0; color: var(--ink); font-size: 16px; line-height: 1.25; }
.panel-heading p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.panel-heading > svg { width: 19px; height: 19px; color: var(--teal); }
.panel-heading > span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.legend-inline { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 8px; height: 8px; display: inline-block; border-radius: 50%; }
.legend-dot.actual { background: var(--coral); margin-left: 4px; }
.legend-dot.target { background: var(--line-strong); }
.chart { width: 100%; min-height: 280px; margin-top: 12px; }
.chart-tall { min-height: 338px; }
.chart-short { min-height: 190px; }
.metric-callout { color: var(--ink) !important; font-size: 17px !important; font-weight: 800; font-variant-numeric: tabular-nums; }
.churn-panel { padding: 19px 20px 16px; }
.churn-summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.churn-summary-item { padding: 8px 9px; background: var(--surface-soft); }
.churn-summary-item span { display: block; color: var(--muted); font-size: 11px; }
.churn-summary-item strong { display: block; margin-top: 2px; color: var(--danger); font-size: 18px; font-variant-numeric: tabular-nums; }

.gap-panel { padding: 19px 20px 16px; }
.gap-list { display: grid; gap: 12px; margin-top: 17px; }
.gap-item { min-width: 0; }
.gap-item-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.gap-item-name { min-width: 0; overflow: hidden; color: var(--ink); font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.gap-item-value { flex: 0 0 auto; color: var(--danger); font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.gap-item-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; color: var(--muted); font-size: 10px; }
.progress-track { height: 6px; margin-top: 6px; overflow: hidden; border-radius: 4px; background: #edf1f3; }
.progress-fill { height: 100%; border-radius: inherit; background: var(--coral); }

.project-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 28px 0 14px; }
.project-section-heading h3 { margin: 0; color: var(--ink); font-size: 19px; line-height: 1.25; }
.project-section-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.project-count { flex: 0 0 auto; color: var(--muted); font-size: 12px; font-weight: 700; }
.project-trend-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.project-card { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.project-card-head { display: flex; align-items: start; justify-content: space-between; gap: 10px; min-height: 42px; }
.project-card-title { min-width: 0; }
.project-card-name { margin: 0; overflow: hidden; color: var(--ink); font-size: 14px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.project-card-meta { margin: 4px 0 0; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.project-card-status { flex: 0 0 auto; padding: 3px 6px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); font-size: 10px; font-weight: 800; }
.project-card-status.alert { border-color: #ecc98d; background: var(--gold-soft); color: var(--gold); }
.project-card-status.done { border-color: #acd9d7; background: var(--teal-soft); color: var(--teal); }
.project-card-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; margin-top: 12px; }
.project-card-metric { min-width: 0; padding: 8px 7px; background: var(--surface-soft); }
.project-card-metric span { display: block; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.project-card-metric strong { display: block; margin-top: 3px; overflow: hidden; color: var(--ink); font-size: 12px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.project-card-metric.is-task strong { color: var(--blue); }
.project-card-metric.is-alert strong { color: var(--gold); }
.project-chart-legend { display: flex; align-items: center; gap: 12px; margin-top: 10px; color: var(--muted); font-size: 10px; }
.project-chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.mini-legend-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; }
.mini-legend-dot.actual { background: var(--teal); }
.mini-legend-dot.required { background: var(--gold); }
.project-mini-chart { width: 100%; height: 132px; min-height: 132px; margin-top: 3px; }

.team-panel { padding: 19px 20px 16px; }
.team-list { display: grid; gap: 14px; margin-top: 20px; }
.team-row { display: grid; grid-template-columns: 88px minmax(0, 1fr) 145px; align-items: center; gap: 12px; }
.team-name { overflow: hidden; color: var(--ink-soft); font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.team-track { height: 9px; overflow: hidden; border-radius: 5px; background: #edf1f3; }
.team-fill { height: 100%; border-radius: inherit; background: var(--teal); }
.team-row:nth-child(2n) .team-fill { background: var(--blue); }
.team-values { color: var(--ink); font-size: 10px; line-height: 1.25; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.team-values strong { font-size: 13px; }
.team-values-detail { display: block; color: var(--muted); }
.team-empty { padding: 18px 0; color: var(--muted); font-size: 13px; }

.dashboard-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 56px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 30; max-width: min(420px, calc(100% - 44px)); padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface); color: var(--ink); box-shadow: 0 12px 30px rgba(23,33,43,.14); opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .18s ease, transform .18s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

button:focus-visible, a:focus-visible { outline: 3px solid rgba(53, 104, 184, .42); outline-offset: 3px; }

@media (max-width: 1100px) {
  .hero { grid-template-columns: minmax(0, 1fr) minmax(340px, 420px); gap: 22px; }
  .metric-grid-five { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metric-grid-six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .project-trend-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .topbar-inner, .page-shell { width: min(100% - 28px, 680px); }
  .hero { grid-template-columns: 1fr; padding-top: 16px; }
  .hero-copy { padding-top: 4px; }
  .current-focus { min-height: 0; }
  .annual-grid, .current-grid, .team-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: start; flex-direction: column; gap: 8px; }
  .section-note { margin: 0; }
  .section-heading-current { flex-direction: row; align-items: center; justify-content: space-between; }
  .panel-large .chart-tall { min-height: 300px; }
}

@media (max-width: 560px) {
  .topbar-inner, .page-shell { width: min(100% - 20px, 460px); }
  .topbar-inner { min-height: 60px; }
  .brand img { width: 105px; }
  .brand span { display: none; }
  .sync-state { display: none; }
  .refresh-button { min-height: 40px; padding: 0 11px; }
  .hero { gap: 18px; padding-top: 12px; }
  .hero h1 { font-size: 43px; }
  .hero-subtitle { font-size: 16px; }
  .hero-meta { align-items: flex-start; flex-direction: column; gap: 6px; }
  .current-focus { padding: 18px 16px; }
  .focus-asof { max-width: 100px; text-align: right; }
  .focus-rate strong { font-size: 52px; }
  .focus-metrics { gap: 8px; }
  .focus-metrics strong { font-size: 15px; }
  .section-nav { gap: 20px; overflow-x: auto; }
  .section-nav-link { flex: 0 0 auto; }
  .dashboard-section { padding-top: 38px; }
  .section-heading-current { align-items: flex-start; flex-direction: column; }
  .section-heading-current h2 { font-size: 24px; }
  .metric-grid-five, .metric-grid-six { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .metric-card { min-height: 122px; padding: 14px 12px 12px; }
  .metric-card-value { margin-top: 11px; font-size: 23px; }
  .metric-card-foot { margin-top: 9px; }
  .chart-panel, .churn-panel, .gap-panel, .team-panel { padding: 15px 12px 12px; }
  .chart-tall { min-height: 275px; }
  .chart-short { min-height: 180px; }
  .panel-heading h3 { font-size: 14px; }
  .legend-inline { font-size: 10px; }
  .team-row { grid-template-columns: 70px minmax(0, 1fr) 112px; gap: 8px; }
  .project-section-heading { align-items: flex-start; flex-direction: column; gap: 6px; }
  .project-trend-grid { grid-template-columns: 1fr; }
  .project-card { padding: 14px 12px; }
  .project-card-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-footer { align-items: flex-start; flex-direction: column; gap: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
