/* 아파트 단지 표지 — 칠한 콘크리트 바탕, 단지 표지의 짙은 초록, 마감 경고에만 주황.
   선은 1px 한 가지, 모서리는 4px 한 가지, 큰 숫자는 세 크기(44 · 24 · 15)만 쓴다. */
:root {
  color-scheme: light only;
  --bg: #e3e7e5; --bg-2: #fcfdfc; --bg-3: #eef1ef;
  --line: #c6cecb; --line-soft: #dce1de;
  --text: #16201e; --text-1: var(--text); --text-2: #3d4946; --text-3: #56625f;
  --accent: #0f5c4e; --accent-soft: #dbeae4; --on-accent: #fff;
  --good: #1f6b3d; --good-soft: #e0eee4;
  --warn: #855600; --warn-soft: #f5eacd;
  --hot: #b03a17; --hot-soft: #f8e1d8;
  --signal: #c2471a; --on-signal: #fff;
  --slab: #d3e3dc; --slab-ink: #0f5c4e;
  --near: #f6e0d4; --near-ink: #9e3a14;
  --bar: #0f5c4e; --on-bar: #fff; --on-bar-2: rgb(255 255 255 / .74);
  --scrim: rgb(16 24 22 / .38);
  --lift: 0 10px 28px rgb(16 24 22 / .16), 0 2px 6px rgb(16 24 22 / .08);
  --r: 4px;
  --sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  --num: "Barlow Semi Condensed", var(--sans);
  --n-l: 44px; --n-m: 24px; --n-s: 15px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* .setup의 display:grid가 [hidden]을 덮어쓰는 것을 막는다 */
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  word-break: keep-all; overflow-wrap: anywhere;
}
::selection { background: var(--accent); color: var(--on-accent); }
* { scrollbar-color: var(--line) transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }

button { font: inherit; cursor: pointer; border-radius: var(--r); border: 1px solid transparent; color: inherit; }
button.primary {
  background: var(--accent); color: var(--on-accent); padding: 9px 18px; font-weight: 600;
  transition: background .12s var(--ease);
}
button.primary:hover { background: color-mix(in srgb, var(--accent) 86%, var(--text)); }
.ghost {
  background: var(--bg-2); color: var(--text); border: 1px solid var(--line); padding: 7px 12px;
  font-size: 13px; font-weight: 500; transition: border-color .12s var(--ease), background .12s var(--ease);
}
.ghost:hover { border-color: var(--text-3); background: var(--bg-3); }
button.small { padding: 5px 10px; font-size: 12px; }
a.btnlike { text-decoration: none; display: inline-flex; align-items: center; }
input, select {
  font: inherit; background: var(--bg-2); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; width: 100%;
  font-variant-numeric: tabular-nums;
}
input::placeholder { color: var(--text-3); }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.hint { font-weight: 400; color: var(--text-3); font-size: 12px; }
.lead { color: var(--text-2); }
.lead.small { font-size: 13px; }
.fineprint { font-size: 12px; color: var(--text-3); }
code { background: var(--bg-3); padding: 1px 5px; border-radius: var(--r); font-size: 12px; }
mark { background: color-mix(in srgb, var(--signal) 22%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }

/* ── 인증키 화면 (로컬 서버 전용) ─────────────── */
.setup { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.setup-card { width: min(560px, 100%); background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); padding: 32px; }
.setup-card h1 { font-size: 22px; margin-bottom: 8px; }
.steps { color: var(--text-2); padding-left: 20px; line-height: 2; font-size: 13px; margin: 18px 0; }
.setup-card .field { margin: 18px 0 14px; }
.msg { min-height: 20px; font-size: 13px; margin: 10px 0; }
.msg.err { color: var(--hot); }
.msg.ok { color: var(--good); }
.msg.warn { padding: 11px 13px; background: var(--hot-soft); border-radius: var(--r); line-height: 1.55; color: var(--text-2); }
.msg.warn b { color: var(--text); }

/* ── 상단바 ────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  padding: 0 24px; height: 60px; background: var(--bar); color: var(--on-bar);
}
.topbar .ghost { background: transparent; color: var(--on-bar); border-color: rgb(255 255 255 / .32); }
.topbar .ghost:hover { background: rgb(255 255 255 / .1); border-color: rgb(255 255 255 / .6); }
.topbar :focus-visible { outline-color: var(--on-bar); }
.brand { display: flex; gap: 10px; align-items: center; flex: none; }
.logo { display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--r); background: rgb(255 255 255 / .14); color: var(--on-bar); }
.logo svg { width: 20px; height: 20px; }
.topbar h1 { font-size: 15.5px; white-space: nowrap; }
.status { margin: 1px 0 0; font-size: 11.5px; color: var(--on-bar-2); white-space: nowrap; }
.searchbar { flex: 1; max-width: 560px; display: flex; gap: 6px; align-items: center; }
.searchbar input { height: 38px; padding: 0 12px; background: rgb(255 255 255 / .13); border-color: transparent; color: var(--on-bar); }
.searchbar input::placeholder { color: var(--on-bar-2); }
.searchbar input:focus { background: var(--bg-2); color: var(--text); border-color: transparent; box-shadow: none; }
.searchbar input:focus::placeholder { color: var(--text-3); }
.topbar-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; margin-left: auto; }
.topbar-actions button, .topbar-actions .btnlike { white-space: nowrap; height: 34px; }
@media (max-width: 1100px) { #btnRefresh, #repoLink { display: none; } }
@media (max-width: 900px) {
  .topbar { position: static; height: auto; flex-wrap: wrap; gap: 10px 12px; padding: 10px 16px; }
  .searchbar { order: 3; flex: 1 1 100%; max-width: none; }
  .topbar-actions { margin-left: auto; }
}
@media (max-width: 560px) {
  .brand { flex: 1 1 100%; }
  .topbar-actions { width: 100%; margin: 0; }
  .topbar-actions button { flex: 1 1 0; min-width: 0; padding: 0 8px; }
}

/* ── 레이아웃 ──────────────────────────────── */
.layout > * { min-width: 0; }
.layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); gap: 28px; padding: 22px 24px; align-items: start; max-width: 1480px; margin: 0 auto; }
.rail { position: sticky; top: 82px; display: flex; flex-direction: column; gap: 0; max-height: calc(100dvh - 104px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding-right: 4px; }
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 18px; padding: 16px; }
  .rail { position: static !important; max-height: none !important; overflow: visible !important; padding: 0; }
}
.filter-group { padding: 14px 0; border-top: 1px solid var(--line); }
.filter-group h2 { font-size: 12px; font-weight: 600; color: var(--text-3); margin-bottom: 9px; }
.rail-body { display: flex; flex-direction: column; }
.rail-body > .toggle { padding: 5px 0; }
.rail-body > .toggle:first-of-type { border-top: 1px solid var(--line); padding-top: 14px; }
.rail-body > #fReset { align-self: flex-start; margin: 12px 0 4px; }
.rail-toggle { display: none; }
@media (max-width: 900px) {
  .rail-toggle { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 10px; }
  .rail-toggle::after { content: ''; width: 6px; height: 6px; border-right: 1.75px solid currentColor; border-bottom: 1.75px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .12s var(--ease); }
  .rail-toggle[aria-expanded="true"] { background: var(--bg-3); border-color: var(--text-3); }
  .rail-toggle[aria-expanded="true"]::after { transform: translateY(2px) rotate(-135deg); }
  .rail:not(.open) .rail-body { display: none; }
  .filter-group.region { padding-bottom: 0; }
}
#fRegion.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
#fRegion.seg .chip { border-radius: 0; text-align: center; padding: 7px 0; font-size: 13px; }
#fRegion.seg .chip:first-child { border-radius: var(--r) 0 0 var(--r); }
#fRegion.seg .chip:last-child { border-radius: 0 var(--r) var(--r) 0; margin-left: -1px; }
#fRegion.seg .chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); position: relative; }
#fRegion.seg .chip.on + .chip.on { border-left-color: color-mix(in srgb, var(--on-accent) 55%, var(--accent)); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chips.scroll { max-height: 172px; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
.chip {
  font-size: 12.5px; padding: 4px 9px; border-radius: var(--r);
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text-2);
  transition: border-color .12s var(--ease), background .12s var(--ease), color .12s var(--ease);
}
.chip:hover { border-color: var(--text-3); color: var(--text); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip .hint { color: inherit; opacity: .8; }
.toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.toggle input { width: 15px; }

/* 내 가점 — 한 줄 요약. 조건이 없으면 넣으라는 안내만 */
.me-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin-bottom: 14px; }
.me-empty { margin: 0 0 10px; font-size: 13px; color: var(--text-2); }
.me-line { display: flex; align-items: baseline; gap: 6px; font-size: 13px; color: var(--text-2); }
.me-line b { font: 700 var(--n-m)/1 var(--num); color: var(--accent); font-variant-numeric: tabular-nums; }
.me-sub { font-size: 12px; color: var(--text-3); margin-top: 4px; font-variant-numeric: tabular-nums; }

/* ── 콘텐츠 ────────────────────────────────── */
.banner { background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--bg-2)); color: var(--text); padding: 10px 14px; border-radius: var(--r); font-size: 13px; margin-bottom: 14px; }

/* 코너 탭 — 이름과 건수만, 고른 탭은 아래 초록 줄 */
.corners { display: flex; flex-wrap: wrap; gap: 0 2px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.corner-tab {
  display: flex; align-items: baseline; gap: 6px; background: none; border: 0; border-radius: 0;
  color: var(--text-2); padding: 9px 11px 10px; font-size: 13.5px; white-space: nowrap;
  box-shadow: inset 0 -2px 0 transparent; transition: color .12s var(--ease), box-shadow .12s var(--ease);
}
.corner-tab:hover { color: var(--text); box-shadow: inset 0 -2px 0 var(--line); }
.corner-tab.on { color: var(--text); font-weight: 700; box-shadow: inset 0 -2px 0 var(--accent); }
.corner-tab .n { font: 600 var(--n-s)/1 var(--num); color: var(--text-3); font-variant-numeric: tabular-nums; }
.corner-tab.on .n { color: var(--accent); }
.corner-tab.empty { color: var(--text-3); opacity: .6; }
@media (max-width: 900px) {
  .corners { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 10px; padding: 0 12px; }
}
.corner-desc { margin: 0 0 14px; font-size: 12.5px; color: var(--text-3); }

/* 요약 줄과 목록·지도 전환 */
.viewbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; flex-wrap: wrap; }
.viewbar .summary { margin: 0; }
.view-seg { display: inline-flex; flex: none; }
.view-seg button { background: var(--bg-2); border: 1px solid var(--line); color: var(--text-2); padding: 5px 14px; font-size: 13px; border-radius: 0; }
.view-seg button:first-child { border-radius: var(--r) 0 0 var(--r); }
.view-seg button:last-child { border-radius: 0 var(--r) var(--r) 0; margin-left: -1px; }
.view-seg button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; position: relative; }

/* 지도 — 구·시마다 건물 하나, 공고가 많을수록 크게 */
.map { margin-bottom: 14px; }
.map-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 10px; align-items: start; }
.map-panel { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 12px 6px; }
.map-panel h3 { font-size: 14px; margin: 0 0 4px 2px; }
.map-panel svg { display: block; width: 100%; height: auto; }
.map .rg { fill: var(--bg-3); stroke: var(--line); stroke-width: 1; cursor: pointer; transition: fill .12s var(--ease); }
.map .rg.has { fill: var(--slab); }
.map .rg:hover { fill: color-mix(in srgb, var(--slab) 60%, var(--accent) 22%); }
.map .rg.on { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2; }
.map .seoul-area { fill: var(--bg-2); stroke: var(--text-3); stroke-width: 1.5; stroke-dasharray: 4 3; pointer-events: none; }
.map .bld { cursor: pointer; }
.map .bld rect { fill: var(--accent); stroke: var(--bg-2); stroke-width: 1.5; }
.map .bld .win { stroke: var(--bg-2); stroke-width: 1.6; stroke-dasharray: 2 3; opacity: .85; }
.map .bld.near rect { fill: var(--near-ink); }
.map .bld.today rect { fill: var(--signal); }
.map .lbl { font: 700 13px var(--num); fill: var(--text); paint-order: stroke; stroke: var(--bg-2); stroke-width: 3.5px; stroke-linejoin: round; cursor: pointer; }
.map { --bld-on: #16201e; --lamp: #ffd34d; }
.map .bld.on rect { fill: var(--bld-on); stroke: var(--lamp); stroke-width: 2; }
.map .bld.on .win { stroke: var(--lamp); opacity: 1; stroke-dasharray: 2.5 2.5; stroke-width: 2; }
.map .lbl.on { fill: var(--accent); font-size: 14px; }
.map .bld:focus { outline: none; }
.map .bld:focus-visible rect { stroke: var(--text); stroke-width: 2.5; }
.map-note { margin: 8px 2px 0; }

/* 내 달력 — 스크랩한 공고의 날짜만. 필터와 목록은 잠시 숨긴다 */
.content[data-view="calendar"] :is(#cards, #empty, .summary, #corners, .corner-desc) { display: none !important; }
.content[data-view="calendar"] .viewbar { justify-content: flex-end; }
.calendar { --due: var(--signal); --paper: var(--warn); --result: var(--accent); --contract: var(--text-2); }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 10px; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-nav h3 { font: 700 var(--n-m)/1 var(--num); min-width: 128px; text-align: center; font-variant-numeric: tabular-nums; }
.cal-nav .ghost.small { height: 30px; display: inline-grid; place-items: center; }
.cal-nav .ic { width: 15px; height: 15px; }
.cal-legend { margin: 0; display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; font-size: 12px; color: var(--text-3); }
.cal-legend i, .ag-row i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; background: var(--due); }
.cal-legend i.paper, .ag-row.paper i { background: var(--paper); }
.cal-legend i.result, .ag-row.result i { background: var(--result); }
.cal-legend i.contract, .ag-row.contract i { background: var(--contract); }
.cal-legend i.start, .ag-row.start i { background: none; border: 1.5px solid var(--text-3); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.cal-w { padding: 7px 8px; font-size: 12px; font-weight: 600; color: var(--text-3); border-bottom: 1px solid var(--line); }
.cal-w:first-child { color: var(--hot); }
.cal-cell { min-height: 104px; padding: 6px; border-top: 1px solid var(--line-soft); border-left: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-cell:nth-child(7n + 1) { border-left: 0; }
.cal-cell:nth-child(-n + 14) { border-top: 0; }
.cal-cell.pad { background: var(--bg-3); }
.cal-cell.past { background: color-mix(in srgb, var(--bg-3) 55%, transparent); }
.cal-cell.past .cal-ev { opacity: .6; }
.cal-d { font: 600 var(--n-s)/1 var(--num); color: var(--text-2); margin: 1px 2px 3px; font-variant-numeric: tabular-nums; }
.cal-cell.sun .cal-d { color: var(--hot); }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-cell.today .cal-d { color: var(--accent); }
.cal-ev {
  display: block; width: 100%; text-align: left; background: var(--bg-3); border: 0; border-radius: 3px; padding: 2px 5px;
  font-size: 11.5px; line-height: 1.45; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; word-break: normal;
}
.cal-ev span { font-weight: 700; color: var(--due); }
.cal-ev.paper span { color: var(--paper); } .cal-ev.result span { color: var(--result); } .cal-ev.contract span { color: var(--contract); } .cal-ev.start span { color: var(--text-3); }
.cal-ev.due { background: color-mix(in srgb, var(--signal) 12%, var(--bg-2)); }
.cal-ev:hover { outline: 1px solid var(--text-3); }
.cal-more { font-size: 11.5px; color: var(--text-3); padding-left: 4px; }
.agenda { margin-top: 18px; }
.agenda > h3 { font-size: 14px; margin-bottom: 6px; display: flex; gap: 8px; align-items: baseline; }
.agenda h4 { margin: 14px 0 6px; font: 700 var(--n-s)/1.2 var(--num); display: flex; gap: 8px; align-items: baseline; }
.ag-row {
  display: grid; grid-template-columns: 12px 116px minmax(0, 1fr); align-items: center; gap: 8px; width: 100%;
  text-align: left; background: var(--bg-2); border: 1px solid var(--line); padding: 9px 12px; margin-top: -1px; border-radius: 0;
}
.ag-row:hover { background: var(--bg-3); }
.ag-row b { font-size: 13px; }
.ag-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--text-2); }
.cal-empty { background: var(--bg-2); border: 1px dashed var(--line); border-radius: var(--r); padding: 48px 20px; text-align: center; }
.cal-empty p { margin: 4px 0; }
@media (max-width: 700px) {
  .cal-cell { min-height: 54px; padding: 4px 3px; }
  .cal-ev { font-size: 0; padding: 0; height: 6px; border-radius: 3px; background: var(--due); }
  .cal-ev.paper { background: var(--paper); } .cal-ev.result { background: var(--result); } .cal-ev.contract { background: var(--contract); } .cal-ev.start { background: var(--line); }
  .cal-ev.due { background: var(--due); }
  .ag-row { grid-template-columns: 12px minmax(0, 1fr); }
  .ag-row span { grid-column: 2; }
}

.cal-nav .ghost.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.cal-sync { margin: 0 0 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.cal-sync h3 { font-size: 14px; margin-bottom: 6px; }
.cal-sync ol { margin: 6px 0 8px; padding-left: 18px; line-height: 1.7; }
.cal-sync .fineprint b { color: var(--text-2); }
.cal-url { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 10px; }
.cal-url input { flex: 1 1 280px; font-size: 12.5px; background: var(--bg-3); }
.cal-url .btnlike { padding: 0 12px; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; font-size: inherit; }

/* 요약 — 타일이 아니라 한 줄 */
.summary { display: flex; gap: 6px 22px; flex-wrap: wrap; align-items: baseline; margin: 0 0 12px; font-size: 13px; color: var(--text-3); }
.stat { display: flex; align-items: baseline; gap: 6px; }
.stat b { font: 700 var(--n-s)/1 var(--num); color: var(--text); font-variant-numeric: tabular-nums; }
.stat.urgent b { color: var(--signal); }

/* ── 공고 행 ───────────────────────────────── */
.cards { display: flex; flex-direction: column; gap: 8px; }
.card {
  position: relative; display: grid; grid-template-columns: 108px minmax(0, 1fr);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r);
  cursor: pointer; overflow: hidden; transition: border-color .12s var(--ease);
}
.card:hover { border-color: var(--text-3); }
.card-open { background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; border-radius: 0; }
.card-open:focus-visible { outline: none; }
.card:has(.card-open:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.drawer-panel:focus { outline: none; }
.card.dim { opacity: .55; }
.card > .body { padding: 13px 14px 12px 18px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
/* 실패한 카드처럼 슬래브 없이 그려진 경우 */
.card:not(:has(> .dday)) { display: block; padding: 14px 18px; }

/* 외벽 숫자 — 이 화면의 서명 */
.dday {
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; padding: 12px 8px;
  background: var(--slab); color: var(--slab-ink); border-right: 1px solid var(--line); text-align: center;
}
.dday b { font: 700 var(--n-l)/.9 var(--num); letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dday b.kr { font: 800 var(--n-l)/1 var(--sans); letter-spacing: -.04em; }
.dday span { font-size: 11.5px; font-weight: 600; letter-spacing: .02em; }
.card.s-today .dday { background: var(--signal); color: var(--on-signal); border-right-color: var(--signal); }
.card.s-near .dday { background: var(--near); color: var(--near-ink); }
.card.s-soon .dday, .card.s-wait .dday, .card.s-notice .dday { background: var(--bg-3); color: var(--text-2); }
.card.s-done .dday { background: var(--bg-3); color: var(--text-3); }
.card.s-done .dday b { text-decoration: line-through; text-decoration-thickness: 2px; }

.card-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "ttl right" "kv kv"; gap: 10px 16px; align-items: start; }
.card-head .ttl { grid-area: ttl; min-width: 0; }
.card-head .kv { grid-area: kv; }
.card-head .right { grid-area: right; }
.ttl .badges { margin-top: 8px; }
.badges:empty { display: none; }
@media (min-width: 1100px) {
  .card-head { grid-template-columns: minmax(0, 1fr) minmax(250px, 34%) auto; grid-template-areas: "ttl kv right"; }
  .card-head .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-left: 16px; border-left: 1px solid var(--line-soft); }
}
.card h3 { font-size: 16px; line-height: 1.35; display: flex; align-items: baseline; gap: 8px; }
.card .where { font-size: 12.5px; color: var(--text-3); margin-top: 3px; }
.card .sub { font-size: 12.5px; color: var(--text-3); margin: 4px 0 0; }
/* 상태 표시 — 같은 칸, 채움은 접수 중, 빈 원은 예정, 그은 원은 마감 */
.mark { flex: none; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--accent); transform: translateY(-1px); }
.mark.live { background: var(--accent); }
.mark.today { background: var(--signal); border-color: var(--signal); }
.mark.done { border-color: var(--text-3); background: linear-gradient(135deg, transparent 42%, var(--text-3) 42% 58%, transparent 58%); }
.mark.wait { border-color: var(--text-3); }
.card-head .right { display: flex; align-items: flex-start; gap: 4px; }
.match { text-align: right; min-width: 44px; }
.match b { display: block; font: 700 var(--n-m)/1 var(--num); font-variant-numeric: tabular-nums; }
.match span { display: block; font-size: 11px; color: var(--text-3); margin-top: 2px; }
.match.hi b { color: var(--accent); }
.match.mid b { color: var(--text); }
.match.lo b { color: var(--text-3); }

.badges { display: flex; flex-wrap: wrap; gap: 4px; }
.badge, .verdict {
  font-size: 12px; line-height: 1.4; padding: 2px 7px; border-radius: var(--r);
  background: transparent; color: var(--text-2); border: 1px solid var(--line);
}
.badge.live { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 600; }
.badge.soon { background: var(--bg-3); color: var(--text-2); border-color: transparent; }
.badge.done { background: var(--bg-3); color: var(--text-3); border-color: transparent; }
.badge.hot { background: var(--hot-soft); color: var(--hot); border-color: transparent; }
.badge.tag { color: var(--text); border-color: var(--line); font-weight: 500; }
.badge.stale { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.verdict.ok    { background: var(--good-soft); color: var(--good); border-color: transparent; }
.verdict.tight { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.verdict.over  { background: var(--hot-soft); color: var(--hot); border-color: transparent; }

.kv { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 16px; font-size: 13px; }
.kv div span { display: block; color: var(--text-3); font-size: 11.5px; }
.kv div b { font-weight: 600; font-variant-numeric: tabular-nums; }
.reasons { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.reason { font-size: 12px; color: var(--text-2); display: inline-flex; align-items: baseline; gap: 5px; }
.reason::before { content: ''; width: 5px; height: 5px; border-radius: 1px; background: var(--accent); transform: translateY(-2px); flex: none; }
.reason.neg { color: var(--text-2); }
.reason.neg::before { background: none; border: 1px solid var(--text-3); }
@media (max-width: 560px) { .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  :root { --n-l: 30px; }
  .card { grid-template-columns: 76px minmax(0, 1fr); }
  .dday { padding: 10px 4px; }
  .dday span { font-size: 11px; }
  .card > .body { padding: 12px; }
  .card h3 { font-size: 15px; }
  .match b { font-size: 20px; }
}

#empty { text-align: center; padding: 64px 20px; color: var(--text-3); border: 1px dashed var(--line); border-radius: var(--r); }

/* 스크랩 — 고르면 별에 동그라미를 친다 */
.star, .share {
  display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0;
  background: none; border: 1px solid transparent; border-radius: 50%; color: var(--text-3);
  transition: color .12s var(--ease), border-color .12s var(--ease), background .12s var(--ease);
}
.star:hover, .share:hover { color: var(--text); background: var(--bg-3); }
.star.on { color: var(--accent); border: 1.5px solid var(--accent); }
.star.on .ic { fill: currentColor; }
.star.pop { animation: circled .26s var(--ease); }
@keyframes circled { from { border-color: transparent; transform: scale(.8); } }
.share.done { color: var(--good); }
@media (prefers-reduced-motion: reduce) { .star.pop { animation: none; } }

/* ── 상세 패널 ─────────────────────────────── */
.drawer, .modal { position: fixed; inset: 0; z-index: 50; }
.drawer-scrim, .modal-scrim { position: absolute; inset: 0; background: var(--scrim); }
.drawer-panel {
  position: absolute; right: 0; top: 0; bottom: 0; width: min(720px, 100%);
  background: var(--bg-2); border-left: 1px solid var(--line); overflow-y: auto; padding: 26px 28px 40px; box-shadow: var(--lift);
  animation: slideIn .2s var(--ease);
}
@keyframes slideIn { from { transform: translateX(32px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .drawer-panel { animation: none; } }
.drawer-panel h2 { font-size: 21px; line-height: 1.35; padding-right: 44px; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.drawer-panel section { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.drawer-panel section > h3 { font-size: 13px; color: var(--text); font-weight: 700; margin-bottom: 10px; }
.close-x {
  position: absolute; right: 18px; top: 18px; display: grid; place-items: center;
  background: var(--bg-2); border: 1px solid var(--line); width: 34px; height: 34px; border-radius: var(--r); color: var(--text-2);
}
.close-x:hover { color: var(--text); border-color: var(--text-3); }

table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 8px 8px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
th { color: var(--text-3); font-weight: 600; font-size: 12px; border-bottom-color: var(--line); }
th:first-child, td:first-child { text-align: left; }
tr.fit td { background: var(--good-soft); }
tr.over td:nth-child(n+4) { color: var(--text-3); }
.tablewrap { overflow-x: auto; }

.timeline { display: flex; flex-direction: column; }
.tl { display: grid; grid-template-columns: 20px 1fr auto; gap: 10px; align-items: start; padding: 7px 0; position: relative; }
.tl::before { content: ''; position: absolute; left: 9px; top: 0; bottom: 0; width: 1px; background: var(--line); }
.tl:first-child::before { top: 14px; } .tl:last-child::before { bottom: calc(100% - 14px); }
.tl .dot { position: relative; width: 10px; height: 10px; border-radius: 50%; background: var(--bg-2); border: 2px solid var(--line); margin-top: 6px; justify-self: center; }
.tl.past .dot { background: var(--text-3); border-color: var(--text-3); }
.tl.now .dot { background: var(--accent); border-color: var(--accent); outline: 2px solid var(--accent-soft); outline-offset: 1px; }
.tl.next .dot { border-color: var(--accent); }
.tl .lbl { font-size: 13.5px; }
.tl .dt { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.tl.now .lbl { font-weight: 700; }
.tl.past .lbl { color: var(--text-3); }

/* 첨부 공고문 */
.files { display: flex; flex-direction: column; gap: 6px; }
.file {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r);
  padding: 9px 12px; color: var(--text); font-size: 13px;
}
.file:hover { border-color: var(--text-3); }
.file .ico { display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); font: 700 11px/1 var(--sans); letter-spacing: .03em; min-width: 44px; }
.file .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .go { margin-left: auto; color: var(--accent); font-size: 12px; white-space: nowrap; display: inline-flex; align-items: center; gap: 3px; }
a .ic, button .ic { width: 15px; height: 15px; }
a:has(> .ic) { display: inline-flex; align-items: center; gap: 3px; }
.file .alt { display: inline-grid; place-items: center; margin-left: 6px; width: 28px; height: 28px; border-radius: var(--r); color: var(--text-3); border: 1px solid var(--line); }
.file .alt .ic { width: 15px; height: 15px; }
.file .alt:hover { color: var(--accent); border-color: var(--accent); }
.file .dupe { color: var(--text-3); font-size: 11.5px; font-weight: 400; }
.rent-note { font-size: 12px; color: var(--text-2); }

/* ── 모달 ──────────────────────────────────── */
.modal-panel {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(640px, calc(100% - 32px)); max-height: 88vh; overflow-y: auto;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); padding: 26px 28px; box-shadow: var(--lift);
}
.modal-panel h2 { font-size: 19px; margin-bottom: 6px; }
fieldset { border: 0; border-top: 1px solid var(--line); padding: 16px 0 4px; margin: 18px 0 0; min-width: 0; }
legend { font-size: 13px; font-weight: 700; color: var(--text); padding: 0 8px 0 0; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .grid3, .grid2 { grid-template-columns: 1fr; } .modal-panel { padding: 20px 18px; } }
.score-out { margin-top: 12px; padding: 11px 13px; background: var(--bg-3); border-radius: var(--r); font-size: 13px; }
.score-out b { font: 700 var(--n-m)/1 var(--num); color: var(--accent); font-variant-numeric: tabular-nums; }
.score-out .sub { display: block; margin-top: 4px; font-size: 12px; color: var(--text-3); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 22px; }
.colhead { margin: 0 0 8px; font-size: 12.5px; font-weight: 700; color: var(--text-2); }

/* 도움말 */
details.help { margin-top: 12px; font-size: 13px; color: var(--text-2); }
details.help summary { cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 500; }
details.help summary, .sources > summary { list-style: none; display: flex; align-items: center; gap: 8px; }
details.help summary::-webkit-details-marker, .sources > summary::-webkit-details-marker { display: none; }
details.help summary::before, .sources > summary::before {
  content: ''; flex: none; width: 6px; height: 6px; border-right: 1.75px solid currentColor; border-bottom: 1.75px solid currentColor;
  transform: rotate(-45deg); transition: transform .12s var(--ease);
}
details[open].help > summary::before, .sources[open] > summary::before { transform: rotate(45deg) translate(-2px, -1px); }
details.help ul { margin: 10px 0 6px; padding-left: 18px; line-height: 1.75; }
details.help li { margin-bottom: 4px; }
details.help b { color: var(--text); }
details.help p { margin: 6px 0 0; font-size: 12.5px; color: var(--text-3); }
details.help table { font-size: 12.5px; }
details.help td { vertical-align: top; text-align: left; white-space: normal; }
details.help th { text-align: left; }

/* 소득 출처 안내 */
.src-guide { margin-top: 10px; padding: 12px 14px; background: var(--bg-3); border-radius: var(--r); font-size: 13px; }
.src-guide dl { display: grid; grid-template-columns: 58px 1fr; gap: 5px 10px; margin: 0; }
.src-guide dt { color: var(--text-3); font-size: 12px; }
.src-guide dd { margin: 0; color: var(--text-2); }
.src-guide dd b { color: var(--text); }
.src-guide .why { margin: 9px 0 0; padding-top: 8px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-3); }
@media (max-width: 560px) { .src-guide dl { grid-template-columns: 1fr; gap: 2px; } .src-guide dt { margin-top: 6px; } }

/* ── 데이터 연결 상태 ───────────────────────── */
.sources { margin-bottom: 14px; font-size: 13px; }
.sources > summary { cursor: pointer; color: var(--text-2); padding: 6px 0; }
.source-list { display: flex; flex-direction: column; gap: 0; margin: 8px 0; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-2); }
.source { display: grid; grid-template-columns: 14px 1fr auto; gap: 10px; align-items: start; padding: 10px 14px; border-top: 1px solid var(--line-soft); }
.source:first-child { border-top: 0; }
.source .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: var(--good); }
.source .dot.idle { background: none; border: 1.5px solid var(--text-3); }
.source .dot.stale { background: var(--warn); }
.source .dot.failed { background: var(--hot); }
.source .nm { font-size: 13px; font-weight: 600; }
.source .use { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.source .org { font-size: 11.5px; color: var(--text-3); }
.source a { font-size: 12px; white-space: nowrap; }
.source.off { background: color-mix(in srgb, var(--warn-soft) 50%, transparent); }
.source-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 4px; }
.source-actions button { font-size: 12.5px; padding: 7px 12px; }

/* ── 사이트 아래 링크, 소개·개인정보 문서 ───── */
.site-foot { padding: 12px 20px 40px; text-align: center; font-size: 12px; color: var(--text-3); }
.site-foot a { color: var(--text-2); }
.doc { max-width: 760px; margin: 28px auto 48px; padding: 32px 40px 40px; line-height: 1.75; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); }
@media (max-width: 560px) { .doc { margin: 0; border: 0; border-radius: 0; padding: 24px 18px 40px; } }
.doc h1 { font-size: 24px; margin: 18px 0 12px; line-height: 1.35; }
.doc h2 { font-size: 16px; margin: 32px 0 8px; }
.doc ul { padding-left: 20px; }
.doc li { margin-bottom: 4px; }
.doc > p:last-child { margin-top: 36px; }
.doc-table { margin: 10px 0; }
.doc-table th, .doc-table td { text-align: left; white-space: normal; vertical-align: top; min-width: 88px; }
.delete-account { margin: 18px 0 0; padding-top: 12px; border-top: 1px solid var(--line-soft); text-align: right; }
#btnDeleteAccount { background: none; border: 0; padding: 4px 2px; font-size: 12px; color: var(--text-3); text-decoration: underline; text-underline-offset: 3px; }
#btnDeleteAccount:hover { color: var(--hot); }
