/* ⚠ 복사본 — 원본은 저장소 맨 위 design/sovasta-ui.css 이다. 여기를 고치지 말고 원본을 고친 뒤 node tools/sync-design.mjs */
/* Sovasta UI — 표준 디자인 v1 (2026-11-17)
 *
 * 원본은 이 파일 하나다: design/sovasta-ui.css
 * 각 사이트의 public/sovasta-ui.css 는 node tools/sync-design.mjs 가 복사한 것이다.
 * 사이트 쪽 복사본을 고치지 말 것 — 다음 동기화 때 덮어써지고, --check 가 실패한다.
 *
 * 기준: sova.sovasta.com 의 틀(14px 본문, 종이색 바탕, 1px 선, 진한 초록 한 가지 강조색).
 * 솔루션은 대부분 Sova 가운데 창 안에서 보이므로, 틀과 같은 크기·색·간격이어야 한 회사로 읽힌다.
 * 규칙은 design/DESIGN.md 에 있다.
 *
 * 쓰는 법: 사이트 index.html 에서 자기 styles.css 보다 **먼저** 링크한다.
 *   <link rel="stylesheet" href="/sovasta-ui.css?v=2">
 *   <link rel="stylesheet" href="/styles.css?v=…">
 * 부품 규칙은 :where() 로 감싸 우선순위가 0 이다. 사이트 CSS 가 필요한 곳만 덮을 수 있다.
 * 단, 토큰(:root 의 --*)과 글자 크기 단계는 사이트에서 바꾸지 않는다 (sync-design --check 가 본다).
 */

:root {
  /* 색 — Sova 틀에서 그대로 가져왔다 */
  --ui-bg: #fafbfc;
  --ui-surface: #ffffff;
  --ui-sunken: #f3f6f6;
  --ui-ink: #1f3543;
  --ui-muted: #5c6c77;
  --ui-line: #dfe6e7;
  --ui-line-strong: #c9d3d5;
  --ui-brand: #0a5c45;
  --ui-brand-ink: #ffffff;
  --ui-brand-pale: #edf5f1;
  --ui-navy: #163749;
  --ui-gold: #b58328;
  --ui-good: #1a7f45;
  --ui-bad: #b3261e;
  --ui-bad-pale: #fdeceb;
  --ui-warn-pale: #fff6df;
  --ui-warn-ink: #5c4300;
  --ui-focus: color-mix(in srgb, var(--ui-brand) 55%, transparent);

  /* 글자 — 7단계만 쓴다 */
  --ui-font: system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans", "Noto Sans KR", sans-serif;
  --ui-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ui-fs-xs: 11px;
  --ui-fs-sm: 12px;
  --ui-fs-base: 13px;
  --ui-fs-md: 14px;
  --ui-fs-lg: 15px;
  --ui-fs-xl: 17px;
  --ui-fs-2xl: 19px;
  --ui-lh: 1.55;
  --ui-lh-tight: 1.3;

  /* 간격 — 4 의 배수 */
  --ui-s1: 4px; --ui-s2: 8px; --ui-s3: 12px; --ui-s4: 16px; --ui-s5: 20px; --ui-s6: 24px; --ui-s8: 32px;

  /* 모양 */
  --ui-r-sm: 8px;
  --ui-r: 12px;
  --ui-r-pill: 999px;
  --ui-control: 34px;
  --ui-control-sm: 28px;
  --ui-shadow: 0 1px 2px rgba(22, 55, 73, .05);
  --ui-max: 1080px;
  --ui-measure: 60ch;
  --ui-t: 140ms;

  color-scheme: light;
}

/* 손가락으로 누르는 화면에서는 단추를 키운다 */
@media (pointer: coarse) {
  :root { --ui-control: 44px; --ui-control-sm: 40px; }
}

/* 어두운 화면은 사이트가 명시적으로 켤 때만 (Sova 틀이 밝기만 해서, 틀 안에서 혼자 어두워지지 않게) */
:root[data-theme="dark"] {
  --ui-bg: #111a1f; --ui-surface: #17232a; --ui-sunken: #0d1519; --ui-ink: #e4ecef; --ui-muted: #9fb0b8;
  --ui-line: #2a3a42; --ui-line-strong: #3a4e58; --ui-brand: #5fc29c; --ui-brand-ink: #062b20; --ui-brand-pale: #16342b;
  --ui-good: #6fd19a; --ui-bad: #ff8a80; --ui-bad-pale: #3a1d1b; --ui-warn-pale: #3a3018; --ui-warn-ink: #f3dc9b;
  --ui-shadow: none; color-scheme: dark;
}

/* ───────── 바탕 ───────── */
:where(*, *::before, *::after) { box-sizing: border-box; }
:where(html, body) { margin: 0; overflow-x: hidden; }
:where(body) {
  background: var(--ui-bg); color: var(--ui-ink);
  font-family: var(--ui-font); font-size: var(--ui-fs-base); line-height: var(--ui-lh);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; min-height: 100vh;
}
:where(button, input, select, textarea) { font: inherit; color: inherit; }
:where(:lang(ko)) { word-break: keep-all; overflow-wrap: break-word; }
:where(img, svg, video) { max-width: 100%; }
:where(a) { color: var(--ui-brand); text-underline-offset: 2px; }
:where(a:hover) { text-decoration-thickness: 2px; }
:where(h1, h2, h3, h4) { line-height: var(--ui-lh-tight); color: var(--ui-ink); letter-spacing: -.005em; }
:where(h1) { font-size: var(--ui-fs-2xl); font-weight: 600; margin: 0 0 var(--ui-s2); }
:where(h2) { font-size: var(--ui-fs-lg); font-weight: 600; margin: 0 0 var(--ui-s3); }
:where(h3) { font-size: var(--ui-fs-md); font-weight: 600; margin: var(--ui-s4) 0 var(--ui-s2); }
:where(h4) { font-size: var(--ui-fs-base); font-weight: 700; margin: var(--ui-s3) 0 var(--ui-s1); }
:where(p) { margin: 0 0 var(--ui-s3); }
:where(p, li) { max-width: var(--ui-measure); text-wrap: pretty; }
:where(h1, h2, h3) { text-wrap: balance; }
:where(ul, ol) { margin: 0 0 var(--ui-s3); padding-inline-start: 20px; }
:where(li + li) { margin-top: var(--ui-s1); }
:where(small, .small) { font-size: var(--ui-fs-sm); }
:where(code, kbd, .mono) { font-family: var(--ui-mono); font-size: .92em; overflow-wrap: anywhere; }
:where(pre) { font-family: var(--ui-mono); font-size: var(--ui-fs-sm); white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; padding: var(--ui-s3); border-radius: var(--ui-r-sm); background: var(--ui-sunken); border: 1px solid var(--ui-line); }
:where(hr) { border: 0; border-top: 1px solid var(--ui-line); margin: var(--ui-s4) 0; }
:where(:focus-visible) { outline: 2px solid var(--ui-focus); outline-offset: 2px; }
:where(details > summary) { cursor: pointer; font-weight: 600; }
:where(::selection) { background: color-mix(in srgb, var(--ui-brand) 22%, transparent); }

:where(.muted) { color: var(--ui-muted); }
:where(.good, .ok) { color: var(--ui-good); }
:where(.bad, .err) { color: var(--ui-bad); }
:where(.center) { text-align: center; }
:where(.sr) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:where(.skip) { position: absolute; inset-inline-start: var(--ui-s4); top: var(--ui-s2); transform: translateY(-200%); z-index: 100; background: var(--ui-surface); padding: var(--ui-s2) var(--ui-s3); border-radius: var(--ui-r-sm); }
:where(.skip:focus) { transform: none; }
:where(.boot) { padding: 40px var(--ui-s4); text-align: center; color: var(--ui-muted); }

/* ───────── 머리 · 메뉴 ───────── */
:where(.top) {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--ui-s3); flex-wrap: wrap;
  padding: var(--ui-s2) var(--ui-s4); min-height: 52px;
  background: color-mix(in srgb, var(--ui-surface) 94%, transparent); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--ui-line);
}
:where(.brand) { display: inline-flex; align-items: center; gap: var(--ui-s2); color: var(--ui-ink); text-decoration: none; font-size: var(--ui-fs-md); font-weight: 600; white-space: nowrap; }
:where(.brand img) { width: 24px; height: 24px; border-radius: 6px; }
:where(.brand b) { font-weight: 750; }
:where(.top-r) { margin-inline-start: auto; display: flex; align-items: center; gap: var(--ui-s2); flex-wrap: wrap; }

/* 탭 메뉴 — <nav class="tabs"><a class="tab on" aria-current="page"> (class 가 없어도 a 면 탭으로 보인다) */
:where(.tabs) {
  display: flex; gap: 2px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
  padding: 0 12px; border-bottom: 1px solid var(--ui-line); background: var(--ui-bg);
}
:where(.tabs)::-webkit-scrollbar { display: none; }
:where(.tabs > a, .tab) {
  position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 13px;
  color: var(--ui-muted); text-decoration: none; font-size: var(--ui-fs-sm); font-weight: 500; white-space: nowrap;
  background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; margin-bottom: -1px; font-family: inherit; cursor: pointer; transition: color var(--ui-t);
}
:where(.tabs > a:hover, .tab:hover) { color: var(--ui-ink); }
:where(.tabs > a.on, .tabs > a[aria-current="page"], .tab.on) { font-weight: 600; color: var(--ui-brand); border-bottom-color: var(--ui-brand); }

/* 하위 메뉴 (알약) */
:where(.subtabs, .seg) { display: flex; flex-wrap: wrap; gap: var(--ui-s1); margin: 0 0 var(--ui-s4); }
:where(.subtabs > a, .subtabs > button, .seg > button) {
  display: inline-flex; align-items: center; min-height: var(--ui-control-sm); padding: 0 var(--ui-s3);
  border: 1px solid var(--ui-line); border-radius: var(--ui-r-pill); background: var(--ui-surface);
  color: var(--ui-ink); text-decoration: none; font-size: var(--ui-fs-sm); font-weight: 600; cursor: pointer;
}
:where(.subtabs > .on, .seg > .on, .subtabs > [aria-current="page"]) { background: var(--ui-brand-pale); border-color: color-mix(in srgb, var(--ui-brand) 40%, transparent); color: var(--ui-brand); }

/* ───────── 바깥 틀 ───────── */
:where(main, .wrap) { display: grid; gap: var(--ui-s4); max-width: var(--ui-max); margin: 0 auto; padding: var(--ui-s5) var(--ui-s4) var(--ui-s8); min-width: 0; }
:where(main:focus, .wrap:focus) { outline: none; }
:where(.foot) {
  display: flex; flex-wrap: wrap; gap: var(--ui-s2) var(--ui-s3); justify-content: center; align-items: center;
  padding: var(--ui-s5) var(--ui-s4) var(--ui-s8); border-top: 1px solid var(--ui-line);
  color: var(--ui-muted); font-size: var(--ui-fs-sm);
}
:where(.foot a) { color: inherit; }
:where(.foot select) { width: auto; min-height: var(--ui-control-sm); font-size: var(--ui-fs-sm); }
:where(.lang) { display: inline-flex; margin: 0; }

/* ───────── 표면 ───────── */
:where(.card) { background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: var(--ui-r); padding: 18px; box-shadow: var(--ui-shadow); min-width: 0; }
:where(.card > :last-child) { margin-bottom: 0; }
:where(.card .card) { box-shadow: none; background: var(--ui-bg); padding: var(--ui-s4); }
:where(.hero) { padding: var(--ui-s2) 0 0; }
:where(.card.hero) { padding: var(--ui-s5); }
:where(.eyebrow) { margin: 0 0 var(--ui-s2); color: var(--ui-muted); font-size: var(--ui-fs-xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
:where(.lede) { font-size: var(--ui-fs-md); color: var(--ui-muted); max-width: var(--ui-measure); }
:where(.note) { margin: var(--ui-s2) 0 0; color: var(--ui-muted); font-size: var(--ui-fs-sm); }
:where(.empty) { padding: var(--ui-s6) var(--ui-s4); text-align: center; color: var(--ui-muted); border: 1px dashed var(--ui-line-strong); border-radius: var(--ui-r); }

/* 알림 띠 (정보 · 주의 · 경고) — 왼쪽 굵은 띠 대신 옅은 바탕 + 1px 선 */
:where(.banner, .notice) { display: flex; gap: var(--ui-s2) var(--ui-s3); align-items: center; flex-wrap: wrap; padding: var(--ui-s3) var(--ui-s4); border-radius: var(--ui-r-sm); border: 1px solid var(--ui-line); background: var(--ui-sunken); }
:where(.banner.soft, .notice.info) { background: var(--ui-brand-pale); border-color: color-mix(in srgb, var(--ui-brand) 25%, transparent); }
:where(.banner.warn, .notice.warn, .banner:not(.soft):not(.bad)) { background: var(--ui-warn-pale); border-color: color-mix(in srgb, var(--ui-gold) 35%, transparent); color: var(--ui-warn-ink); }
:where(p.warn) { padding: var(--ui-s2) var(--ui-s3); border-radius: var(--ui-r-sm); background: var(--ui-warn-pale); color: var(--ui-warn-ink); border: 1px solid color-mix(in srgb, var(--ui-gold) 35%, transparent); }
:where(.banner.bad, .notice.bad) { background: var(--ui-bad-pale); border-color: color-mix(in srgb, var(--ui-bad) 30%, transparent); color: var(--ui-ink); }

/* ───────── 격자 ───────── */
:where(.row) { display: flex; gap: var(--ui-s2); flex-wrap: wrap; align-items: center; }
:where(.grow) { flex: 1 1 220px; }
:where(.two) { display: grid; gap: var(--ui-s4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
:where(.grid2) { display: grid; gap: var(--ui-s3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
:where(.grid3) { display: grid; gap: var(--ui-s3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
:where(.grid2, .grid3, .two) > :where(.wide) { grid-column: 1 / -1; }
:where(form.grid2, form.grid3) { align-items: end; }
:where(form.grid2, form.grid3) > :where(label) { margin: 0; }

/* ───────── 숫자 칸 ───────── */
:where(.stats) { display: grid; gap: var(--ui-s2); grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr)); margin: 0; }
:where(.stats > div, .stat) { display: grid; gap: 2px; padding: var(--ui-s3) var(--ui-s4); border: 1px solid var(--ui-line); border-radius: var(--ui-r-sm); background: var(--ui-surface); min-width: 0; }
:where(.stats dt, .stats span, .stat span, .stat small) { color: var(--ui-muted); font-size: var(--ui-fs-xs); font-weight: 600; }
:where(.stats dd, .stats b, .stat b) { margin: 0; font-size: var(--ui-fs-xl); font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ui-ink); overflow-wrap: anywhere; }
:where(.stat.hi b) { color: var(--ui-brand); }
:where(.stat.soft) { background: var(--ui-sunken); }

/* ───────── 단추 ───────── */
:where(.btn) {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--ui-control); padding: 0 var(--ui-s4); border: 1px solid var(--ui-brand); border-radius: var(--ui-r-sm);
  background: var(--ui-brand); color: var(--ui-brand-ink); font-size: var(--ui-fs-base); font-weight: 600; line-height: 1.2;
  text-decoration: none; cursor: pointer; white-space: nowrap; transition: background-color var(--ui-t), border-color var(--ui-t);
}
:where(.btn:hover) { background: color-mix(in srgb, var(--ui-brand) 88%, #000); }
:where(.btn.ghost) { background: var(--ui-surface); color: var(--ui-ink); border-color: var(--ui-line-strong); }
:where(.btn.ghost:hover) { background: var(--ui-sunken); }
:where(.btn.danger) { background: var(--ui-surface); color: var(--ui-bad); border-color: color-mix(in srgb, var(--ui-bad) 40%, transparent); }
:where(.btn.sm, .btn.small) { min-height: var(--ui-control-sm); padding: 0 var(--ui-s3); font-size: var(--ui-fs-sm); }
:where(.btn:disabled, .btn[aria-disabled="true"]) { opacity: .5; cursor: not-allowed; }
:where(.linklike) { background: none; border: 0; padding: 0; color: var(--ui-brand); text-decoration: underline; cursor: pointer; }

/* ───────── 입력 ───────── */
:where(label) { display: grid; gap: var(--ui-s1); margin: 0 0 var(--ui-s3); font-size: var(--ui-fs-xs); font-weight: 500; color: var(--ui-muted); min-width: 0; }
:where(label.check) { display: flex; gap: var(--ui-s2); align-items: flex-start; font-weight: 500; font-size: var(--ui-fs-base); }
:where(input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea) {
  width: 100%; min-height: var(--ui-control); padding: 6px var(--ui-s3);
  border: 1px solid var(--ui-line-strong); border-radius: var(--ui-r-sm); background: var(--ui-surface);
  font-size: var(--ui-fs-base); font-weight: 400;
}
:where(textarea) { min-height: 88px; resize: vertical; line-height: 1.5; }
:where(input[type=checkbox], input[type=radio]) { width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--ui-brand); flex: none; }
:where(input::placeholder, textarea::placeholder) { color: color-mix(in srgb, var(--ui-muted) 80%, transparent); }
:where(fieldset) { border: 1px solid var(--ui-line); border-radius: var(--ui-r-sm); padding: var(--ui-s3); margin: 0 0 var(--ui-s3); }
/* 카드 안의 묶음은 테두리 없이 (카드 안의 카드가 되지 않게) */
:where(.card) :where(fieldset) { border: 0; padding: 0; }
:where(.card) :where(legend) { padding: 0; font-weight: 600; margin-bottom: var(--ui-s1); }
:where(legend) { padding: 0 var(--ui-s1); font-size: var(--ui-fs-sm); font-weight: 600; }

/* ───────── 표 ───────── */
:where(.table-wrap) { overflow-x: auto; }
:where(.tbl) { width: 100%; border-collapse: collapse; font-size: var(--ui-fs-sm); font-variant-numeric: tabular-nums; }
:where(.tbl caption) { text-align: start; font-size: var(--ui-fs-base); font-weight: 700; padding-bottom: var(--ui-s2); }
:where(.tbl th) { text-align: start; color: var(--ui-muted); font-size: var(--ui-fs-xs); font-weight: 600; padding: var(--ui-s2) var(--ui-s3); border-bottom: 1px solid var(--ui-line-strong); white-space: nowrap; }
:where(.tbl td) { text-align: start; padding: var(--ui-s2) var(--ui-s3); border-bottom: 1px solid var(--ui-line); vertical-align: top; }
:where(.tbl td.num, .tbl th.num) { text-align: end; }
:where(.tbl tr:last-child td) { border-bottom: 0; }

/* ───────── 작은 표시 ───────── */
:where(.badge, .chip) {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px var(--ui-s2); border-radius: var(--ui-r-pill);
  background: var(--ui-sunken); border: 1px solid var(--ui-line); color: var(--ui-ink);
  font-size: var(--ui-fs-xs); font-weight: 600; line-height: 1.6; vertical-align: middle; white-space: nowrap;
}
:where(.badge.good, .chip.good) { background: color-mix(in srgb, var(--ui-good) 10%, var(--ui-surface)); color: var(--ui-good); border-color: color-mix(in srgb, var(--ui-good) 25%, transparent); }
:where(.badge.bad, .chip.bad, .chip.warn) { background: var(--ui-bad-pale); color: var(--ui-bad); border-color: color-mix(in srgb, var(--ui-bad) 25%, transparent); }
:where(.badge.brand) { background: var(--ui-brand-pale); color: var(--ui-brand); border-color: color-mix(in srgb, var(--ui-brand) 25%, transparent); }
:where(.dot) { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: var(--ui-r-pill); background: var(--ui-bad); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; font-style: normal; }
:where(.bar) { height: 6px; border-radius: var(--ui-r-pill); background: var(--ui-sunken); overflow: hidden; margin: var(--ui-s2) 0; }
:where(.bar > i) { display: block; height: 100%; background: var(--ui-brand); border-radius: inherit; }

/* ───────── 접이식 ───────── */
:where(.acc) { display: grid; gap: var(--ui-s2); }
:where(.acc-i) { border: 1px solid var(--ui-line); border-radius: var(--ui-r-sm); background: var(--ui-surface); }
:where(.acc-h) { width: 100%; display: flex; justify-content: space-between; gap: var(--ui-s2); align-items: center; min-height: 44px; padding: 0 var(--ui-s4); background: none; border: 0; text-align: start; font-weight: 600; cursor: pointer; }
:where(.acc-h)::after { content: "+"; color: var(--ui-muted); font-weight: 400; font-size: var(--ui-fs-lg); }
:where(.acc-i.open .acc-h)::after { content: "−"; }
:where(.acc-b) { display: none; padding: 0 var(--ui-s4) var(--ui-s4); }
:where(.acc-i.open .acc-b) { display: block; }

/* ───────── 토스트 ───────── */
:where(.toast) {
  position: fixed; inset-inline: var(--ui-s4); bottom: var(--ui-s4); z-index: 50; margin: 0 auto; max-width: 480px;
  padding: var(--ui-s3) var(--ui-s4); border-radius: var(--ui-r-sm); background: var(--ui-navy); color: #fff; font-size: var(--ui-fs-sm);
  box-shadow: 0 4px 16px rgba(22, 55, 73, .18); opacity: 0; transform: translateY(8px); transition: opacity var(--ui-t), transform var(--ui-t); pointer-events: none;
}
:where(.toast.show) { opacity: 1; transform: none; }
:where(.toast.bad) { background: var(--ui-bad); }
:where(.toast.good) { background: var(--ui-good); }

@media (prefers-reduced-motion: reduce) {
  :where(*, *::before, *::after) { transition-duration: 0s !important; animation-duration: 0s !important; }
}
@media (max-width: 640px) {
  :where(.top) { padding: var(--ui-s2) var(--ui-s3); }
  :where(.tabs) { padding: 0 var(--ui-s2); }
  :where(main, .wrap) { padding: var(--ui-s4) var(--ui-s3) var(--ui-s6); }
  :where(.card) { padding: var(--ui-s4); }
  :where(h1) { font-size: var(--ui-fs-xl); }   /* 좁은 화면 17px */
}
@media print {
  :where(.top, .tabs, .foot, .toast) { display: none !important; }
  :where(.card) { box-shadow: none; }
}
