/* 입찰레이더 — 공통 토큰 + 기본 부품 (랜딩·결제·관리자·약관 페이지와 앱이 같이 쓴다. 앱 전용 화면은 app.css)
   톤: 무채색 다크 우선 + 라이트. 색은 분야(데이터)에서만 나온다. 테마는 html[data-theme] 가 정한다(js/theme.js, head 인라인 스크립트). */

/* ── 토큰 ─────────────────────────────────────────────── */
/* 09-liquid-glass-and-screen-layout.md §4 — 그대로 옮김 */
:root {
  --inset-top: env(safe-area-inset-top);
  --inset-bottom: env(safe-area-inset-bottom);
  --tabbar-h: 56px; /* house default */
  --content-pad-top: calc(var(--inset-top) + 8px);
  --content-pad-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
}
:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
}
:root {
  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 20px;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Apple SD Gothic Neo', 'Pretendard', 'Noto Sans KR', 'Malgun Gothic', system-ui, sans-serif;
  --fs-s: 13px;
  --fs-m: 15px;
  --fs-l: 17px;
  --fs-xl: 22px;
  --fs-hero: clamp(28px, 6vw, 34px);
  --control-h: 44px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --ease: var(--ease-drawer);
  --dur-fast: 160ms;
  --dur-pop: 180ms;
  --dur-sheet: 320ms;
  --dur-exit: 200ms;
}
/* 다크(기본) — JS 가 없어도 다크로 시작한다 */
:root, html[data-theme='dark'] {
  color-scheme: dark;
  --bg: #19191b; --bg-side: #202022; --bg-pane: #1e1e20; --bg-elev: #2a2a2c;
  --line: rgba(255, 255, 255, 0.09); --line-2: rgba(255, 255, 255, 0.16);
  --fg: #f5f5f7; --fg-2: rgba(235, 235, 245, 0.62); --fg-3: rgba(235, 235, 245, 0.42);
  --red: #ff453a; --green: #30d158; --blue: #0a84ff; --star: #ffd60a; --warn: #ffb340;
  --fill: rgba(120, 120, 128, 0.24); --fill-2: rgba(120, 120, 128, 0.4);
  --seg-sel: #636366; --btn-bg: #f5f5f7; --btn-fg: #111;
  --pill-l: 76%; --pill-a: 0.2;
  --glass: rgba(28, 28, 30, 0.6); --glass-edge: rgba(255, 255, 255, 0.12);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
html[data-theme='light'] {
  color-scheme: light;
  --bg: #ffffff; --bg-side: #f5f5f7; --bg-pane: #fafafa; --bg-elev: #ffffff;
  --line: rgba(0, 0, 0, 0.08); --line-2: rgba(0, 0, 0, 0.16);
  --fg: #1d1d1f; --fg-2: rgba(60, 60, 67, 0.78); --fg-3: rgba(60, 60, 67, 0.6);
  --red: #ff3b30; --green: #1f9d47; --blue: #007aff; --star: #c79a00; --warn: #b25000;
  --fill: rgba(120, 120, 128, 0.12); --fill-2: rgba(120, 120, 128, 0.22);
  --seg-sel: #ffffff; --btn-bg: #1d1d1f; --btn-fg: #ffffff;
  --pill-l: 22%; --pill-a: 0.14;
  --glass: rgba(255, 255, 255, 0.6); --glass-edge: rgba(255, 255, 255, 0.4);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
/* 스크립트가 막힌 환경: OS 설정이 라이트면 라이트 */
@media (prefers-color-scheme: light) {
  html:not([data-theme]) {
    color-scheme: light;
    --bg: #ffffff; --bg-side: #f5f5f7; --bg-pane: #fafafa; --bg-elev: #ffffff;
    --line: rgba(0, 0, 0, 0.08); --line-2: rgba(0, 0, 0, 0.16);
    --fg: #1d1d1f; --fg-2: rgba(60, 60, 67, 0.78); --fg-3: rgba(60, 60, 67, 0.6);
    --red: #ff3b30; --green: #1f9d47; --blue: #007aff; --star: #c79a00; --warn: #b25000;
    --fill: rgba(120, 120, 128, 0.12); --fill-2: rgba(120, 120, 128, 0.22);
    --seg-sel: #ffffff; --btn-bg: #1d1d1f; --btn-fg: #ffffff;
    --pill-l: 22%; --pill-a: 0.14;
    --glass: rgba(255, 255, 255, 0.6); --glass-edge: rgba(255, 255, 255, 0.4);
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  }
}
/* 예전 이름 별칭 — 결제·관리자·랜딩 스크립트가 아직 이 이름을 쓴다 */
:root {
  --surface: var(--bg-elev);
  --surface-2: var(--fill);
  --accent: var(--btn-bg);
  --accent-fg: var(--btn-fg);
  --focus: var(--blue);
  --danger: var(--red);
  --ok: var(--green);
}

/* ── WebView/브라우저 공통 ───────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { overscroll-behavior: none; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; scrollbar-width: none; background: var(--bg); }
html::-webkit-scrollbar, body::-webkit-scrollbar, *::-webkit-scrollbar { display: none; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 var(--fs-m)/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
button, [role='tab'], nav a, .chip, .seg button, .tabbar a, .tabbar button, .icon-btn {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
a { color: inherit; }
img, svg { max-width: 100%; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── 레이아웃 ────────────────────────────────────────── */
.wrap { width: min(100% - var(--space-5), 1080px); margin-inline: auto; }
.page { padding-top: var(--content-pad-top); padding-bottom: var(--space-7); }
.stack > * + * { margin-top: var(--space-4); }
.row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.muted { color: var(--fg-2); }
.faint { color: var(--fg-2); font-size: var(--fs-s); }
.small { font-size: var(--fs-s); }
.num { font-variant-numeric: tabular-nums; }
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: var(--bg-side); }
}
@media (prefers-contrast: more) { .glass { background: var(--bg); } }
@media (prefers-reduced-transparency: reduce) { .glass { background: var(--bg-side); -webkit-backdrop-filter: none; backdrop-filter: none; } }

/* ── 상단 바 (정적 페이지) ───────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 30;
  padding-top: var(--inset-top);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; gap: var(--space-3); min-height: 52px; }
.brand { flex: 0 0 auto; white-space: nowrap; display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 700; font-size: var(--fs-l); text-decoration: none; letter-spacing: -0.02em; }
.brand svg { width: 20px; height: 20px; color: var(--red); }
.topnav { margin-left: auto; display: flex; align-items: center; gap: var(--space-1); justify-content: flex-end; }
.topnav a:not(.btn), .topnav button.link { text-decoration: none; color: var(--fg-2); font-size: var(--fs-m); padding: 0 var(--space-3); border-radius: var(--radius-s); background: none; border: 0; cursor: pointer; min-height: 40px; display: inline-flex; align-items: center; }
.topnav a:not(.btn):hover, .topnav button.link:hover { color: var(--fg); background: var(--fill); }
.topnav a.only-wide { display: none; }
@media (min-width: 720px) { .topnav a.only-wide { display: inline-flex; } }
.topnav .btn { white-space: nowrap; }
.icon-btn {
  width: 44px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-m); border: 0; background: transparent; color: var(--fg-2); cursor: pointer; font-size: 18px;
  transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
@media (hover: hover) { .icon-btn:hover { background: var(--fill); color: var(--fg); } }
.icon-btn:active { transform: scale(0.92); }
.theme-btn .ti { display: none; }
.theme-btn .ti svg { width: 20px; height: 20px; }
html[data-theme-pref='system'] .theme-btn .ti-system,
html[data-theme-pref='light'] .theme-btn .ti-light,
html[data-theme-pref='dark'] .theme-btn .ti-dark { display: inline-flex; }
html:not([data-theme-pref]) .theme-btn .ti-system { display: inline-flex; }

/* ── 버튼/칩/배지 ────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--control-h); padding: 0 var(--space-4);
  border-radius: var(--radius-m); border: 0;
  background: var(--fill); color: var(--fg); font-weight: 600; font-size: var(--fs-m);
  cursor: pointer; text-decoration: none;
  transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--btn-bg); color: var(--btn-fg); }
.btn.block { width: 100%; }
.btn.kakao { background: #fee500; color: #191919; }
.btn.google { background: #fff; color: #1d1d1f; box-shadow: inset 0 0 0 1px var(--line-2); }
.btn.sm { min-height: 36px; padding: 0 var(--space-3); font-size: var(--fs-s); border-radius: 10px; }
.btn.danger { color: var(--red); }
.btn[disabled], .btn[aria-disabled='true'] { opacity: 0.4; cursor: not-allowed; transform: none; pointer-events: none; }
.btn.ghost { background: transparent; }
.link { background: none; border: 0; padding: 4px 6px; border-radius: 6px; color: var(--blue); font-size: var(--fs-s); font-weight: 500; cursor: pointer; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 var(--space-3);
  border-radius: 999px; border: 1px solid var(--line-2);
  background: transparent; color: var(--fg); font-size: var(--fs-s); font-weight: 500;
  cursor: pointer; white-space: nowrap; flex: 0 0 auto;
  transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.chip:active { transform: scale(0.96); }
.chip[aria-pressed='true'], .chip.on { background: var(--fg); color: var(--bg); border-color: transparent; }
.chip .dot, .tagdot { width: 8px; height: 8px; border-radius: 50%; background: hsl(var(--h, 0) var(--s, 0%) 58%); flex: 0 0 auto; }
.chip .cnt { opacity: 0.6; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 var(--space-2); border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--fill); color: var(--fg-2); white-space: nowrap; }
.badge.ok { background: rgba(48, 209, 88, 0.16); color: var(--green); }
.badge.warn { background: rgba(255, 179, 64, 0.18); color: var(--warn); }
.badge.kind { background: var(--fill); }
.tagpill { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-s); color: var(--fg-2); }

.seg { display: inline-flex; padding: 2px; background: var(--fill); border-radius: 9px; gap: 0; }
.seg button { border: 0; background: transparent; min-height: 32px; padding: 0 var(--space-3); border-radius: 7px; font-size: var(--fs-s); font-weight: 500; color: var(--fg); cursor: pointer; }
.seg button[aria-selected='true'], .seg button[aria-checked='true'] { background: var(--seg-sel); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); }

/* ── 폼 ──────────────────────────────────────────────── */
label.field { display: block; }
label.field > span { display: block; font-size: var(--fs-s); color: var(--fg-2); margin-bottom: var(--space-1); font-weight: 600; }
input[type='text'], input[type='search'], input[type='number'], input[type='tel'], select, textarea {
  width: 100%; min-height: var(--control-h); padding: 0 var(--space-3);
  border-radius: var(--radius-m); border: 0; background: var(--fill); color: var(--fg);
  font: inherit; font-size: 16px; /* iOS 확대 방지 */
}
input[type='checkbox'] { accent-color: var(--btn-bg); }
textarea { padding: var(--space-3); min-height: 88px; }
input::placeholder { color: var(--fg-3); }
input[type='search']::-webkit-search-decoration, input[type='search']::-webkit-search-cancel-button { -webkit-appearance: none; }
.hint { font-size: var(--fs-s); color: var(--fg-2); margin-top: var(--space-1); }
.err { color: var(--red); font-size: var(--fs-s); margin-top: var(--space-2); }

/* ── 카드/섹션 ───────────────────────────────────────── */
.card { background: var(--fill); border-radius: var(--radius-l); padding: var(--space-5); }
.card.tight { padding: var(--space-4); border-radius: var(--radius-m); }
.divider { height: 1px; background: var(--line); border: 0; margin: var(--space-4) 0; }
.kv { display: grid; grid-template-columns: 7.5em 1fr; gap: var(--space-2) var(--space-3); font-size: var(--fs-m); }
.kv dt { color: var(--fg-2); }
.kv dd { margin: 0; min-width: 0; }

/* ── 상태 화면 (loading / empty / error) ──────────────── */
.state { text-align: center; padding: var(--space-7) var(--space-4); color: var(--fg-2); }
.state h3 { font-size: var(--fs-l); color: var(--fg); margin-bottom: var(--space-2); }
.state .btn { margin-top: var(--space-4); }
.spinner { width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--fg-2); animation: spin 0.8s linear infinite; margin: 0 auto var(--space-3); }
@keyframes spin { to { transform: rotate(360deg); } }
.skel { background: var(--fill); border-radius: var(--radius-s); animation: sk 1.2s ease-in-out infinite; }
@keyframes sk { 50% { opacity: 0.5; } }

/* ── 공고 행 (랜딩 샘플) ─────────────────────────────── */
.bids { display: flex; flex-direction: column; }
.bid {
  display: grid; grid-template-columns: 1fr auto; gap: var(--space-1) var(--space-3);
  width: 100%; text-align: left;
  padding: var(--space-3) 0 var(--space-3) var(--space-3); background: transparent;
  border-top: 1px solid var(--line);
  border-left: 4px solid hsl(var(--h, 0) var(--s, 0%) 58%);
}
.bid:first-child { border-top: 0; }
.bid .t { font-weight: 500; font-size: var(--fs-m); line-height: 1.4; }
.bid .m { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); align-items: center; font-size: var(--fs-s); color: var(--fg-2); }

/* ── 푸터/토스트 ─────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--line); padding: var(--space-6) 0 calc(var(--space-6) + env(safe-area-inset-bottom)); font-size: var(--fs-s); color: var(--fg-2); }
.site-footer nav { display: flex; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-3); }
.site-footer nav a { text-decoration: none; font-weight: 600; color: var(--fg); }
.site-footer address { font-style: normal; line-height: 1.7; }

#toast { position: fixed; z-index: 100; left: 50%; bottom: calc(var(--inset-bottom) + var(--space-5)); transform: translate(-50%, 12px); background: var(--fg); color: var(--bg); padding: var(--space-3) var(--space-4); border-radius: var(--radius-m); font-size: var(--fs-m); opacity: 0; pointer-events: none; transition: opacity var(--dur-pop) var(--ease-out), transform var(--dur-pop) var(--ease-out); max-width: calc(100vw - 32px); }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 899px) { body.has-tabbar #toast { bottom: calc(var(--tabbar-h) + var(--inset-bottom) + var(--space-4)); } }

/* ── 랜딩 ────────────────────────────────────────────── */
.hero { padding: var(--space-7) 0 var(--space-6); }
.hero h1 { font-size: var(--fs-hero); line-height: 1.2; letter-spacing: -0.03em; font-weight: 800; max-width: 18em; }
.hero .lead { font-size: var(--fs-l); color: var(--fg-2); margin-top: var(--space-4); max-width: 34em; }
.hero .cta { margin-top: var(--space-5); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-3); margin-top: var(--space-6); }
.stat { background: var(--fill); border-radius: var(--radius-m); padding: var(--space-4); }
.stat b { display: block; font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat span { color: var(--fg-2); font-size: var(--fs-s); }
section.block { padding: var(--space-6) 0; }
section.block > .wrap > h2, section.block > h2 { font-size: var(--fs-xl); margin-bottom: var(--space-4); letter-spacing: -0.02em; }
.grid3 { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.plans { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-items: stretch; }
.plan { display: flex; flex-direction: column; gap: var(--space-3); }
.plan.hl { box-shadow: inset 0 0 0 2px var(--fg); }
.plan .price { font-size: var(--fs-xl); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.plan .price small { font-size: var(--fs-s); font-weight: 500; color: var(--fg-2); }
.plan ul { margin: 0; padding-left: 1.1em; color: var(--fg-2); font-size: var(--fs-m); }
.plan .btn { margin-top: auto; }
.faq details { border-bottom: 1px solid var(--line); padding: var(--space-3) 0; }
.faq summary { cursor: pointer; font-weight: 600; min-height: 36px; display: flex; align-items: center; }
.faq details p { color: var(--fg-2); margin-top: var(--space-2); }

/* ── 법적 문서 ───────────────────────────────────────── */
.doc { max-width: 720px; }
.doc h1 { font-size: var(--fs-xl); margin-bottom: var(--space-2); }
.doc h2 { font-size: var(--fs-l); margin: var(--space-6) 0 var(--space-2); }
.doc p, .doc li { color: var(--fg); }
.doc ul, .doc ol { padding-left: 1.2em; }
.doc table { width: 100%; border-collapse: collapse; font-size: var(--fs-m); margin: var(--space-3) 0; }
.doc th, .doc td { border-bottom: 1px solid var(--line); padding: var(--space-2) var(--space-2); text-align: left; vertical-align: top; }
.doc th { color: var(--fg-2); font-weight: 600; width: 32%; white-space: nowrap; }

/* ── 결제 ────────────────────────────────────────────── */
.planpick { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.planpick button { text-align: left; padding: var(--space-4); border-radius: var(--radius-m); border: 1.5px solid var(--line-2); background: transparent; cursor: pointer; display: flex; flex-direction: column; gap: var(--space-1); transition: border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
.planpick button:active { transform: scale(0.98); }
.planpick button[aria-pressed='true'] { border-color: var(--fg); }
.planpick b { font-size: var(--fs-l); }
.bankbox { background: var(--fill); border-radius: var(--radius-m); padding: var(--space-4); }
.bankbox .big { font-size: var(--fs-xl); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
table.t { width: 100%; border-collapse: collapse; font-size: var(--fs-m); }
table.t th, table.t td { border-bottom: 1px solid var(--line); padding: var(--space-2); text-align: left; vertical-align: middle; white-space: nowrap; }
table.t th { color: var(--fg-2); font-size: var(--fs-s); }
.tablewrap { overflow-x: auto; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── 분야별 SEO 페이지 (/field/*.html — tools/build_seo.py 가 만든다) ─────────── */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font-size: var(--fs-s); color: var(--fg-2); margin-bottom: var(--space-3); }
.crumbs a { text-decoration: none; }
.crumbs a:hover, .crumbs [aria-current] { color: var(--fg); }
.doc .answer { font-size: var(--fs-l); line-height: 1.6; }
.doc .asof { margin-top: var(--space-2); }
.doc .fieldtbl th, .doc .fieldtbl td { width: auto; white-space: normal; vertical-align: middle; }
.doc .fieldtbl th:not(:first-child), .doc .fieldtbl td:not(:first-child) { width: 1%; white-space: nowrap; }
a.chip { text-decoration: none; }
