:root {
  color-scheme: light;
  --ink: #12221e;
  --muted: #60706b;
  --subtle: #8a9893;
  --line: #dfe7e3;
  --line-strong: #cbd8d2;
  --surface: #ffffff;
  --surface-soft: #f4f7f5;
  --canvas: #eef3f0;
  --forest: #123f35;
  --forest-2: #1d5b4b;
  --mint: #8de8c0;
  --mint-deep: #36b889;
  --lime: #d9f567;
  --amber: #f3b960;
  --red: #d76662;
  --shadow: 0 14px 40px rgba(22, 52, 43, 0.07);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 12px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% -10%, rgba(141, 232, 192, 0.22), transparent 32rem),
    var(--canvas);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button, select { font: inherit; }

button, a, select { -webkit-tap-highlight-color: transparent; }

button:focus-visible, a:focus-visible, select:focus-visible {
  outline: 3px solid rgba(54, 184, 137, 0.35);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 14px;
  color: #fff;
  background: var(--forest);
  border-radius: 8px;
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  background: var(--forest);
  color: #fff;
}

.header-inner,
.nav-inner,
.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.header-inner {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 13px;
  color: var(--forest);
  background: var(--lime);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -.08em;
}

.brand strong,
.brand small { display: block; }
.brand strong { font-size: 18px; letter-spacing: -.02em; }
.brand small { margin-top: 1px; color: rgba(255,255,255,.62); font-size: 12px; }

.sync-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  color: rgba(255,255,255,.78);
  background: rgba(255,255,255,.06);
  font-size: 12px;
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(243,185,96,.13);
}

.sync-state.is-online .sync-dot { background: var(--mint); box-shadow: 0 0 0 4px rgba(141,232,192,.13); }
.sync-state.is-stale .sync-dot { background: var(--red); box-shadow: 0 0 0 4px rgba(215,102,98,.13); }

.section-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
}

.nav-inner { display: flex; gap: 6px; min-height: 58px; align-items: stretch; }

.nav-tab {
  position: relative;
  min-width: 90px;
  padding: 0 16px;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}

.nav-tab::after {
  content: "";
  position: absolute;
  right: 16px;
  bottom: -1px;
  left: 16px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--mint-deep);
  transform: scaleX(0);
  transition: transform .18s ease;
}

.nav-tab:hover { color: var(--forest); }
.nav-tab.is-active { color: var(--forest); }
.nav-tab.is-active::after { transform: scaleX(1); }

.page-shell { padding: 28px 0 30px; }

.control-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(135px, 190px)) 1fr;
  align-items: end;
  gap: 12px;
  margin-bottom: 34px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,.72);
  box-shadow: 0 6px 24px rgba(22,52,43,.035);
}

.field { display: grid; gap: 5px; }
.field span { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.field select {
  width: 100%;
  height: 42px;
  padding: 0 36px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
  font-weight: 650;
}

.filter-note { justify-self: end; margin: 0 6px 8px 0; color: var(--muted); font-size: 12px; }

.dashboard-view[hidden], [hidden] { display: none !important; }

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.section-heading h1 {
  margin: 2px 0 4px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.18;
  letter-spacing: -.045em;
}

.section-heading p:not(.eyebrow) { margin: 0; color: var(--muted); }

.eyebrow {
  margin: 0;
  color: var(--mint-deep);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .14em;
}

.goal-chip,
.streak-badge,
.quality-grade {
  flex: 0 0 auto;
  display: grid;
  min-width: 112px;
  padding: 12px 18px;
  border-radius: 14px;
  color: #fff;
  background: var(--forest);
  text-align: right;
}

.goal-chip span,
.streak-badge span,
.quality-grade span { color: rgba(255,255,255,.62); font-size: 10px; font-weight: 800; letter-spacing: .04em; }
.goal-chip strong,
.streak-badge strong,
.quality-grade strong { font-size: 20px; letter-spacing: -.03em; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-card {
  position: relative;
  min-height: 154px;
  overflow: hidden;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.kpi-card--accent { color: #fff; border-color: var(--forest); background: var(--forest); }
.kpi-card--accent::after {
  content: "";
  position: absolute;
  right: -30px;
  bottom: -55px;
  width: 140px;
  height: 140px;
  border: 30px solid rgba(217,245,103,.16);
  border-radius: 50%;
}

.kpi-label { display: block; color: var(--muted); font-size: 12px; font-weight: 750; }
.kpi-card--accent .kpi-label { color: rgba(255,255,255,.66); }
.kpi-value { display: block; margin-top: 14px; font-size: 32px; font-weight: 850; line-height: 1.1; letter-spacing: -.045em; }
.kpi-unit { margin-left: 3px; font-size: 14px; font-weight: 700; letter-spacing: 0; }
.kpi-detail { position: relative; z-index: 1; display: block; margin-top: 10px; color: var(--muted); font-size: 11px; }
.kpi-card--accent .kpi-detail { color: rgba(255,255,255,.62); }

.content-grid,
.chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  gap: 20px;
}

.content-grid--wide { grid-template-columns: minmax(0, 2fr) minmax(280px, .9fr); }
.chart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chart-card--wide { grid-column: 1 / -1; }

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

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel h2 { margin: 3px 0 0; font-size: 18px; letter-spacing: -.025em; }
.panel-caption { color: var(--muted); font-size: 12px; }

.commentary-card {
  display: flex;
  flex-direction: column;
  color: #fff;
  border: 0;
  background:
    linear-gradient(145deg, rgba(255,255,255,.06), transparent 50%),
    var(--forest);
}

.commentary-card .eyebrow { color: var(--lime); }
.commentary-card h2 { font-size: 22px; }
.commentary-copy { margin: 20px 0 26px; color: rgba(255,255,255,.88); font-size: 17px; font-weight: 600; line-height: 1.75; }
.commentary-meta { display: grid; gap: 8px; margin-top: auto; color: rgba(255,255,255,.52); font-size: 10px; }
.commentary-meta span::before { content: "·"; margin-right: 6px; color: var(--lime); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 0 10px 10px; color: var(--subtle); font-size: 10px; font-weight: 800; text-align: left; letter-spacing: .05em; }
td { padding: 14px 10px; border-top: 1px solid var(--line); font-size: 13px; }
.member-cell { display: flex; align-items: center; gap: 10px; min-width: 120px; font-weight: 750; }
.avatar {
  display: grid;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 10px;
  color: var(--forest);
  background: #e5f3ed;
  font-size: 12px;
  font-weight: 900;
}

.progress-cell { min-width: 170px; }
.progress-track { width: 100%; height: 7px; overflow: hidden; border-radius: 99px; background: var(--surface-soft); }
.progress-fill { height: 100%; border-radius: inherit; background: var(--mint-deep); }
.progress-fill.is-complete { background: linear-gradient(90deg, var(--mint-deep), #83d783); }
.count-cell { white-space: nowrap; font-weight: 800; }
.count-cell small { color: var(--subtle); font-weight: 600; }
.status-pill { display: inline-flex; padding: 5px 9px; border-radius: 999px; color: #53635d; background: var(--surface-soft); font-size: 10px; font-weight: 800; white-space: nowrap; }
.status-pill.is-complete { color: #155b44; background: #ddf5e9; }

.metric-summary { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.summary-chip { padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.62); color: var(--muted); font-size: 11px; }
.summary-chip strong { margin-left: 5px; color: var(--forest); font-size: 13px; }

.period-switch {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255,255,255,.72);
}
.period-switch button {
  min-height: 38px;
  padding: 0 13px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}
.period-switch button:hover { color: var(--forest); background: var(--surface-soft); }
.period-switch button.is-active,
.period-switch button[aria-pressed="true"] { color: #fff; background: var(--forest); }

.history-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: -5px 2px 16px;
  color: var(--muted);
  font-size: 11px;
}
.history-kpi-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.history-kpi-grid .kpi-card { min-height: 144px; }
.history-overview-grid { margin-bottom: 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.history-chart-grid { margin-bottom: 20px; }
.coverage-score { color: var(--forest); font-size: 25px; letter-spacing: -.04em; }
.history-member-panel { margin-top: 20px; }
.history-member-panel table { min-width: 820px; }
.history-number-cell { color: #344740; font-weight: 750; white-space: nowrap; }
.history-milestone-cell { min-width: 190px; color: var(--muted); font-size: 11px; }
.state-panel--compact { min-height: 150px; margin-bottom: 20px; }

.chart-frame { position: relative; width: 100%; height: 300px; }
.chart-frame--compact { height: 250px; }
.chart-frame--short { height: 220px; }
.chart-fallback { display: grid; gap: 9px; min-height: 160px; align-content: center; }
.fallback-row { display: grid; grid-template-columns: minmax(60px, 100px) 1fr 36px; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.fallback-track { height: 7px; overflow: hidden; border-radius: 99px; background: var(--surface-soft); }
.fallback-fill { height: 100%; border-radius: inherit; background: var(--mint-deep); }

.insight-card { display: flex; flex-direction: column; }
.insight-list { display: grid; gap: 12px; margin: 20px 0 0; padding: 0; list-style: none; }
.insight-list li { position: relative; padding: 14px 14px 14px 42px; border-radius: 12px; background: var(--surface-soft); color: #43534e; font-size: 13px; }
.insight-list li::before { content: "↗"; position: absolute; top: 14px; left: 15px; color: var(--mint-deep); font-weight: 900; }

.quality-bars { display: grid; gap: 20px; }
.quality-row { display: grid; grid-template-columns: minmax(80px, 120px) 1fr 44px; align-items: center; gap: 12px; }
.quality-row-label { display: grid; color: var(--ink); font-size: 12px; font-weight: 750; }
.quality-row-label small { color: var(--subtle); font-size: 10px; font-weight: 500; }
.quality-track { height: 10px; overflow: hidden; border-radius: 99px; background: var(--surface-soft); }
.quality-fill { height: 100%; border-radius: inherit; background: var(--mint-deep); }
.quality-fill.is-estimated { background: var(--amber); }
.quality-fill.is-missing, .quality-fill.is-error { background: var(--red); }
.quality-value { color: var(--muted); font-size: 11px; font-weight: 800; text-align: right; }

.methodology-card dl { margin: 20px 0 0; }
.methodology-card dl > div { display: grid; grid-template-columns: 90px 1fr; gap: 14px; padding: 13px 0; border-top: 1px solid var(--line); }
.methodology-card dt { font-size: 12px; font-weight: 800; }
.methodology-card dd { margin: 0; color: var(--muted); font-size: 12px; }
.legend-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; vertical-align: 1px; }
.legend-dot--confirmed { background: var(--mint-deep); }
.legend-dot--estimated { background: var(--amber); }
.legend-dot--missing { background: var(--red); }
.method-note { margin: 20px 0 0; padding: 13px; border-radius: 10px; color: var(--muted); background: var(--surface-soft); font-size: 11px; }

.state-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 220px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  text-align: left;
}
.state-panel strong { font-size: 16px; }
.state-panel p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.state-panel--error > span { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 50%; color: #fff; background: var(--red); font-weight: 900; }
.loader { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--mint-deep); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.secondary-button { margin-left: 12px; padding: 9px 13px; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--forest); background: #fff; cursor: pointer; font-size: 12px; font-weight: 750; }
.empty-message { margin: 18px 0 0; padding: 18px; border-radius: 12px; color: var(--muted); background: var(--surface-soft); text-align: center; font-size: 12px; }

.site-footer { display: flex; justify-content: space-between; gap: 18px; margin-top: 28px; padding: 20px 2px 0; border-top: 1px solid var(--line-strong); color: var(--subtle); font-size: 10px; }
.site-footer p { margin: 0; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 900px) {
  .control-bar { grid-template-columns: repeat(3, 1fr); }
  .filter-note { grid-column: 1 / -1; justify-self: start; margin: 0 2px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .history-kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .content-grid, .content-grid--wide { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .header-inner, .nav-inner, .page-shell { width: min(100% - 24px, 1180px); }
  .header-inner { min-height: 78px; }
  .brand small { display: none; }
  .brand-mark { width: 38px; height: 38px; border-radius: 11px; }
  .sync-state { padding: 7px 9px; }
  .nav-inner { width: 100%; overflow-x: auto; padding: 0 12px; }
  .nav-tab { flex: 1 0 auto; min-width: 78px; padding: 0 10px; }
  .page-shell { padding-top: 18px; }
  .control-bar { grid-template-columns: 1fr; gap: 9px; margin-bottom: 26px; }
  .filter-note { grid-column: auto; }
  .section-heading { align-items: flex-start; }
  .history-heading { display: grid; }
  .period-switch { width: 100%; overflow-x: auto; }
  .period-switch button { flex: 1 0 auto; }
  .section-heading h1 { font-size: 30px; }
  .goal-chip, .streak-badge, .quality-grade { min-width: 92px; padding: 10px 13px; }
  .kpi-grid { gap: 10px; }
  .history-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-card { min-height: 132px; padding: 16px; }
  .kpi-value { font-size: 27px; }
  .chart-grid { grid-template-columns: 1fr; }
  .history-overview-grid { grid-template-columns: 1fr; }
  .chart-card--wide { grid-column: auto; }
  .panel { padding: 18px; border-radius: var(--radius-lg); }
  .chart-frame { height: 260px; }
  .chart-frame--compact, .chart-frame--short { height: 220px; }
  .site-footer { display: grid; }
  .history-meta { display: grid; gap: 2px; }
}

@media (max-width: 430px) {
  .brand strong { font-size: 16px; }
  .sync-state #sync-text { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .section-heading { display: grid; }
  .goal-chip, .streak-badge, .quality-grade { justify-self: start; text-align: left; }
  .kpi-grid { grid-template-columns: 1fr; }
  .history-kpi-grid { grid-template-columns: 1fr; }
  .kpi-card { min-height: 118px; }
  .progress-cell { min-width: 130px; }
  .metric-summary { justify-content: flex-start; }
  .methodology-card dl > div { grid-template-columns: 1fr; gap: 4px; }
}

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