/* Copilot 도입 지표 대시보드 — 외부 글꼴·CDN 없음 */
:root {
  --navy: #0b3a6e;
  --navy-2: #12487f;
  --blue: #1d5fa8;
  --blue-soft: #e7eef8;
  --teal: #0f766e;
  --ink: #18212d;
  --ink-2: #3f4b5b;
  --muted: #566274;
  --line: #d6dee8;
  --line-2: #e6ecf2;
  --bg: #f2f5f9;
  --panel: #ffffff;
  --amber-bg: #fff7e6;
  --amber-line: #d97706;
  --amber-ink: #7a3e06;
  --focus: #1d4ed8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 33, 56, .06), 0 1px 1px rgba(16, 33, 56, .04);
  --c-leading: #0f7a55;
  --c-growing: #2563c9;
  --c-stalled: #c27a0a;
  --c-not_started: #c23b3b;
  --c-hidden: #8a94a3;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Pretendard", system-ui, -apple-system, "Segoe UI", sans-serif;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
h1, h2, h3 { line-height: 1.3; letter-spacing: -0.01em; }
a { color: var(--blue); }
a:hover { color: var(--navy); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 24px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.skip { position: absolute; left: 12px; top: -48px; background: #fff; color: var(--navy); padding: 8px 12px; border-radius: 6px; z-index: 10; font-weight: 700; }
.skip:focus { top: 12px; }

/* 상단 바 */
.topbar { background: var(--navy); color: #fff; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 36px; height: 36px; flex: none; }
.bm-bg { fill: #ffffff; }
.bm-bar { fill: var(--navy); }
.bm-accent { fill: #2f8fd8; }
.brand-org { margin: 0; font-size: 13px; color: #c9d8ea; font-weight: 600; }
.brand-title { margin: 0; font-size: 19px; font-weight: 700; }
.period { display: flex; align-items: center; gap: 4px; background: rgba(255,255,255,.08); padding: 4px; border-radius: 10px; }
.period-label { font-size: 13px; color: #c9d8ea; padding: 0 8px 0 6px; }
.period-btn {
  appearance: none; border: 0; background: transparent; color: #fff; font: inherit; font-size: 14px; font-weight: 600;
  padding: 6px 12px; border-radius: 7px; cursor: pointer; min-width: 52px;
}
.period-btn:hover { background: rgba(255,255,255,.14); }
.period-btn[aria-pressed="true"] { background: #fff; color: var(--navy); }
.period-btn:focus-visible { outline-color: #fff; }

/* 합성 데이터 배너 */
.banner { background: var(--amber-bg); border-bottom: 1px solid #f1c27d; color: var(--amber-ink); }
.banner.real { background: #eef6ff; border-bottom-color: #bcd6f5; color: #173f6d; }
.banner-inner { display: flex; gap: 10px; align-items: flex-start; padding-top: 10px; padding-bottom: 10px; }
.banner p { margin: 0; font-size: 14px; }
.banner-icon { width: 18px; height: 18px; fill: var(--amber-line); flex: none; margin-top: 3px; }
.banner.real .banner-icon { fill: var(--blue); }

main { padding-top: 18px; padding-bottom: 32px; outline: none; }
.status-line { margin: 0 0 4px; font-size: 13px; color: var(--muted); min-height: 1.4em; }
.status-line.error { color: #9b1c1c; font-weight: 600; }
.asof { margin: 0 0 14px; font-size: 13px; color: var(--muted); }

/* 요약 카드 */
.cards { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.card-k { margin: 0; font-size: 13px; color: var(--muted); font-weight: 600; }
.card-v { margin: 2px 0 0; font-size: 26px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.card-s { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.delta { font-weight: 700; font-variant-numeric: tabular-nums; }
.delta.up { color: #0f7a55; }
.delta.down { color: #b42318; }
.delta.flat { color: var(--ink-2); }

/* 패널 */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.grid-2 .panel { margin-bottom: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel h2 { margin: 0; font-size: 17px; color: var(--navy); }
.panel-sub { margin: 0; font-size: 13px; color: var(--muted); }
.panel h3 { font-size: 15px; margin: 0 0 8px; }

/* 퍼널 */
.funnel { display: grid; gap: 10px; }
.f-row { display: grid; grid-template-columns: 132px 1fr 132px; gap: 12px; align-items: center; }
.f-label { font-size: 14px; font-weight: 600; }
.f-track { height: 22px; background: var(--line-2); border-radius: 6px; overflow: hidden; }
.f-fill { height: 100%; background: var(--blue); border-radius: 6px 0 0 6px; min-width: 3px; transition: width .3s ease; }
.f-fill.active { background: #2f7fd0; }
.f-fill.habit { background: var(--teal); }
.f-val { text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; }
.f-val strong { font-size: 15px; }
.f-note { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }
.f-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 0; }
.f-stats > div { border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 12px; background: #fbfcfe; }
.f-stats dt { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.f-stats dd { margin: 0; font-size: 20px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.f-stats dd small { font-size: 13px; font-weight: 600; color: var(--muted); }
.f-hint { margin: 0; font-size: 12px; color: var(--muted); }
.back-link { display: none; appearance: none; border: 0; background: none; padding: 0; margin: 0 0 8px; font: inherit; font-size: 13px; color: var(--blue); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* 상태 분포 */
.dist-bar { display: flex; height: 22px; border-radius: 6px; overflow: hidden; background: var(--line-2); }
.dist-seg { height: 100%; }
.dist-legend { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.dist-legend li { border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; }
.dist-legend .lg-k { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.dist-legend .lg-v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dist-legend .lg-v small { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.dist-table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 13.5px; }
.dist-table caption { text-align: left; font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 4px; }
.dist-table th, .dist-table td { padding: 6px 8px; border-bottom: 1px solid var(--line-2); text-align: left; }
.dist-table thead th { font-size: 12.5px; color: var(--muted); font-weight: 700; background: #f7f9fc; }
.dist-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.dist-table tbody th { font-weight: 600; }
.sw-leading, .seg-leading { background: var(--c-leading); }
.sw-growing, .seg-growing { background: var(--c-growing); }
.sw-stalled, .seg-stalled { background: var(--c-stalled); }
.sw-not_started, .seg-not_started { background: var(--c-not_started); }
.sw-hidden, .seg-hidden { background: repeating-linear-gradient(45deg, #9aa3b0 0 4px, #c3c9d2 4px 8px); }

/* 상태 배지(색만으로 구분하지 않도록 글자 포함) */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 700; border: 1px solid; white-space: nowrap; line-height: 1.6; }
.badge.leading { color: #065f46; background: #e8f7f0; border-color: #8fd3b6; }
.badge.growing { color: #1e3a8a; background: #edf3fd; border-color: #a9c4ef; }
.badge.stalled { color: #7a4204; background: #fff5e3; border-color: #f0c37a; }
.badge.not_started { color: #8f1d1d; background: #fdeeee; border-color: #f0aaaa; }
.badge.hidden { color: #384252; background: #f0f2f5; border-color: #c6ccd5; }
.badge.type { color: var(--navy); background: var(--blue-soft); border-color: #b9cde8; }

/* 인사이트 */
.insights { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.insight { border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 8px; padding: 12px 14px; background: #fff; min-width: 0; }
.insight.t-not_started { border-left-color: var(--c-not_started); }
.insight.t-stalled { border-left-color: var(--c-stalled); }
.insight.t-training_gap { border-left-color: #6d4fc2; }
.insight.t-champion { border-left-color: var(--c-leading); }
.insight-title { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 6px; font-size: 15px; }
.badge.t-not_started { color: #8f1d1d; background: #fdeeee; border-color: #f0aaaa; }
.badge.t-stalled { color: #7a4204; background: #fff5e3; border-color: #f0c37a; }
.badge.t-training_gap { color: #4c1d95; background: #f3effc; border-color: #c8b6ef; }
.badge.t-champion { color: #065f46; background: #e8f7f0; border-color: #8fd3b6; }
.insight-detail { margin: 0 0 8px; font-size: 14px; color: var(--ink-2); }
.insight-action { margin: 0 0 8px; font-size: 14px; background: #f6f8fb; border-radius: 6px; padding: 8px 10px; }
.insight-action strong { color: var(--navy); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.chip { appearance: none; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 2px 10px; font: inherit; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.chip:hover { border-color: var(--blue); color: var(--blue); }
.btn-secondary { appearance: none; border: 1px solid var(--line); background: #fff; color: var(--navy); border-radius: 8px; padding: 6px 14px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-secondary:hover:not(:disabled) { border-color: var(--blue); background: var(--blue-soft); }
.btn-secondary:disabled { color: #9aa3b0; cursor: default; }
#insights-more { margin-top: 12px; }

/* 학교 목록 */
.schools-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; margin-bottom: 8px; }
.field { display: flex; flex-direction: column; gap: 3px; }
.field-grow { flex: 1 1 160px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field select, .field input {
  font: inherit; font-size: 14px; color: var(--ink); background: #fff; border: 1px solid #b9c4d2; border-radius: 7px; padding: 6px 10px; min-height: 36px;
}
.field input { width: 100%; }
.table-count { margin: 4px 0 8px; font-size: 13px; color: var(--muted); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table.schools { width: 100%; border-collapse: collapse; font-size: 14px; }
.schools th, .schools td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: middle; white-space: nowrap; }
.schools thead th { background: #f4f7fb; font-size: 12.5px; color: var(--ink-2); font-weight: 700; position: sticky; top: 0; }
.schools .num { text-align: right; font-variant-numeric: tabular-nums; }
.schools tbody tr:hover { background: #f8fafd; }
.schools tbody tr.selected { background: #eaf2fc; }
.schools tbody tr:last-child td { border-bottom: 0; }
.th-btn { appearance: none; border: 0; background: none; font: inherit; color: inherit; font-weight: 700; cursor: pointer; padding: 0; display: inline-flex; align-items: center; gap: 4px; }
.th-btn::after { content: "↕"; color: #9aa3b0; font-size: 11px; }
th[aria-sort="ascending"] .th-btn::after { content: "▲"; color: var(--navy); }
th[aria-sort="descending"] .th-btn::after { content: "▼"; color: var(--navy); }
.school-btn { appearance: none; border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--navy); cursor: pointer; text-align: left; text-decoration: underline; text-decoration-color: #b9cde8; text-underline-offset: 3px; }
.school-btn:hover { text-decoration-color: var(--navy); }
.rate { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.mini { width: 54px; height: 6px; background: var(--line-2); border-radius: 3px; overflow: hidden; display: inline-block; }
.mini > span { display: block; height: 100%; background: var(--blue); }
.nil { color: #8a94a3; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 10px; font-size: 13px; color: var(--muted); }

/* 상세 */
.detail { border: 1px solid var(--line); border-radius: 10px; padding: 16px; background: #fbfcfe; position: sticky; top: 12px; outline: none; }
.detail h3 { margin: 0 0 2px; font-size: 17px; color: var(--navy); }
.detail-meta { margin: 0 0 10px; font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 0 14px; }
.kv div { background: #fff; border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; }
.kv dt { font-size: 12px; color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.detail h4 { margin: 14px 0 6px; font-size: 14px; color: var(--ink-2); }
.trend svg { width: 100%; height: auto; display: block; }
.trend .grid { stroke: #e3e8ef; stroke-width: 1; }
.trend .axis { fill: #5b6676; font-size: 11px; }
.trend .ref { stroke: #0f7a55; stroke-width: 1; stroke-dasharray: 4 3; }
.trend .ref-label { fill: #0f7a55; font-size: 10.5px; paint-order: stroke; stroke: #fbfcfe; stroke-width: 4px; stroke-linejoin: round; }
.trend .line { fill: none; stroke: var(--blue); stroke-width: 2.4; stroke-linejoin: round; }
.trend .area { fill: rgba(29, 95, 168, .08); }
.trend .dot { fill: #fff; stroke: var(--blue); stroke-width: 2; }
.trend details { margin-top: 6px; font-size: 13px; }
.trend summary { cursor: pointer; color: var(--blue); }
.trend table { border-collapse: collapse; margin-top: 6px; font-size: 12.5px; }
.trend table th, .trend table td { padding: 2px 8px; border-bottom: 1px solid var(--line-2); text-align: left; }
.apps { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.apps li { display: grid; grid-template-columns: 86px 1fr 52px; gap: 8px; align-items: center; font-size: 13px; }
.apps .bar { height: 8px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.apps .bar span { display: block; height: 100%; background: #2f7fd0; }
.apps .v { text-align: right; font-variant-numeric: tabular-nums; }
.recs { margin: 0; padding-left: 18px; font-size: 14px; }
.recs li { margin: 0 0 6px; }
.notice { border: 1px solid #f0c37a; background: #fff8ea; color: #6b3a05; border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; }

/* 개인정보 */
.privacy-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.steps { margin: 0; padding-left: 20px; font-size: 14px; }
.steps li { margin-bottom: 6px; }
.defs { margin: 0; font-size: 14px; display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; }
.defs dt { font-weight: 700; color: var(--ink-2); }
.defs dd { margin: 0; }
.footer { border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 13px; }
.footer p { margin: 0; padding: 14px 0; }

/* 반응형 */
@media (max-width: 1200px) {
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .schools-layout { grid-template-columns: minmax(0, 1fr); }
  .detail { position: static; }
  .back-link { display: inline-block; }
}
@media (max-width: 900px) {
  .grid-2, .privacy-grid, .insights { grid-template-columns: minmax(0, 1fr); }
  .dist-legend { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .wrap { padding: 0 14px; }
  .topbar-inner { padding-top: 10px; padding-bottom: 10px; }
  .brand-title { font-size: 16.5px; }
  .period { width: 100%; justify-content: space-between; }
  .period-label { display: none; }
  .period-btn { flex: 1; min-width: 0; padding: 7px 4px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card { padding: 12px; }
  .card-v { font-size: 22px; }
  .panel { padding: 14px; }
  .f-row { grid-template-columns: 1fr auto; grid-template-areas: "label val" "track track"; gap: 4px 8px; }
  .f-label { grid-area: label; }
  .f-val { grid-area: val; }
  .f-track { grid-area: track; }
  .toolbar .field { flex: 1 1 calc(50% - 6px); }
  .field select { width: 100%; }
  .table-wrap { border: 0; overflow: visible; }
  table.schools, .schools thead, .schools tbody, .schools tr, .schools td { display: block; width: 100%; }
  .schools thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .schools tbody tr { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; padding: 6px 10px; background: #fff; }
  .schools td { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px dashed var(--line-2); padding: 5px 0; white-space: normal; text-align: right; }
  .schools td:last-child { border-bottom: 0; }
  .schools td::before { content: attr(data-label); font-size: 12.5px; color: var(--muted); font-weight: 600; text-align: left; }
  .schools td.td-name { font-size: 15px; }
  .schools td.td-name::before { content: none; }
  .schools .num { text-align: right; }
  .dist-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .defs { grid-template-columns: 1fr; }
  .defs dd { margin-bottom: 6px; }
  .pager { justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .topbar .period, .toolbar, .pager, .skip, #insights-more { display: none !important; }
  body { background: #fff; }
  .panel, .card { box-shadow: none; }
}
