:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --line: #e3e6eb;
  --text: #1c2330;
  --muted: #6a7384;
  --accent: #1f6feb;
  --accent-ink: #ffffff;
  --accent-soft: #e8f0fe;
  --danger: #c93a3a;
  --danger-soft: #fdecec;
  --warn: #9a6400;
  --ok: #1e7f4f;
  --star: #b7791f;
  --star-soft: #fff6e0;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1218;
    --surface: #171b23;
    --line: #2a303b;
    --text: #e6e9ef;
    --muted: #96a0b2;
    --accent: #5b9bff;
    --accent-ink: #0b1220;
    --accent-soft: #1c2a44;
    --danger: #ff7b7b;
    --danger-soft: #3a1f22;
    --warn: #e0b04d;
    --ok: #57c793;
    --star: #f2c14e;
    --star-soft: #3a3020;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
        "Pretendard", "Malgun Gothic", "Noto Sans KR", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
h1 { font-size: 1.35rem; margin: 18px 0 12px; }
h2 { font-size: 1.05rem; margin: 0 0 10px; }
.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); font-weight: normal; }

/* 머리 */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-in { display: flex; align-items: center; justify-content: space-between; height: 54px; gap: 12px; }
.brand { font-weight: 700; font-size: 1.05rem; color: var(--text); display: flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
       box-shadow: 0 0 0 4px var(--accent-soft); }
.top-nav { display: flex; align-items: center; gap: 14px; }
.top-nav a { color: var(--muted); }
.top-nav a.on { color: var(--text); font-weight: 600; }
.top-nav form { margin: 0; }

/* 버튼 · 입력 */
button {
  font: inherit; cursor: pointer; border-radius: 8px; padding: 7px 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  min-height: 36px; white-space: nowrap;
}
button:hover { border-color: var(--muted); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.ghost { color: var(--muted); }
button.star { color: var(--star); border-color: var(--star); }
button.link { border: 0; background: none; color: var(--muted); padding: 0; min-height: 0; }
input, textarea, select {
  font: inherit; width: 100%; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
textarea { resize: vertical; }
label { display: block; font-weight: 600; }
label input, label textarea, label select { display: block; margin-top: 6px; font-weight: normal; }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin-right: 14px; font-weight: normal; }
label.inline input { width: auto; margin: 0; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; margin-bottom: 6px; }

/* 알림 줄 */
.flash { padding: 10px 12px; border-radius: 8px; margin: 14px 0 0; background: var(--accent-soft); }
.flash.error { background: var(--danger-soft); color: var(--danger); }
.bad { color: var(--danger); }
.warn { color: var(--warn); display: block; font-size: .9em; }
.ok { color: var(--ok); }

/* 수집 상태 */
.status {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 16px 0 10px; padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.status form { margin: 0; flex-shrink: 0; }
.status-text { color: var(--muted); font-size: .92em; }
.spin { display: inline-block; width: 12px; height: 12px; border-radius: 50%;
        border: 2px solid var(--line); border-top-color: var(--accent);
        animation: spin 1s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 탭 · 검색 */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex-shrink: 0; padding: 7px 12px; border-radius: 999px; color: var(--muted);
  background: var(--surface); border: 1px solid var(--line); white-space: nowrap;
}
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.tabs .n { font-size: .85em; opacity: .75; margin-left: 2px; }
.search { display: flex; gap: 8px; margin: 12px 0; }
.search input { flex: 1; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* 공고 카드 */
.list { display: grid; gap: 12px; padding-bottom: 40px; }
.bid {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px;
}
.bid.urgent { border-left: 4px solid var(--danger); }
.bid.starred { background: linear-gradient(0deg, var(--surface), var(--surface)) padding-box; box-shadow: inset 0 0 0 1px var(--star); }
.bid-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.dday { font-weight: 700; font-size: .85em; color: var(--accent); }
.urgent .dday { color: var(--danger); }
.chip { font-size: .78em; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--text); }
.chip.soft { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.chip.mark-interested, .chip.mark-applied { background: var(--star-soft); color: var(--star); font-weight: 600; }
.chip.mark-pass { background: var(--danger-soft); color: var(--danger); }
.chip.mark-seen { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.bid h2 { font-size: 1.02rem; line-height: 1.45; margin: 0 0 4px; word-break: keep-all; overflow-wrap: anywhere; }
.bid h2 a { color: var(--text); }
.org { margin: 0 0 8px; color: var(--muted); font-size: .92em; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; margin: 0 0 8px; font-size: .9em; }
.facts div { display: flex; gap: 8px; min-width: 0; }
.facts dt { color: var(--muted); flex-shrink: 0; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.why { margin: 0 0 8px; font-size: .88em; color: var(--danger); }
.bid-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.kw { margin: 0; font-size: .82em; color: var(--muted); }
.tag { display: inline-block; padding: 1px 7px; margin: 0 4px 2px 0; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); }
.no { font-variant-numeric: tabular-nums; }
.actions { display: flex; gap: 6px; margin: 0; }
.memo { margin-top: 8px; font-size: .9em; }
.memo summary { cursor: pointer; color: var(--muted); }
.memo form { display: flex; gap: 8px; margin-top: 6px; align-items: flex-start; }

/* 설정 */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 14px 0; }
.card.narrow { max-width: 380px; margin: 60px auto; }
.stack { display: grid; gap: 14px; }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.row-inline { display: flex; gap: 8px; }
.row-inline select { width: auto; }
.short input { max-width: 140px; }
.help { color: var(--muted); font-size: .9em; margin: 0; }
.checks { list-style: none; padding: 0; margin: 0 0 8px; }
.checks li { padding: 3px 0; }
.checks li.ok::before { content: '● '; color: var(--ok); }
.checks li.bad::before { content: '● '; color: var(--danger); }
.checks li.muted::before { content: '○ '; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .88em; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }

@media (max-width: 600px) {
  .status { flex-direction: column; align-items: stretch; }
  .status form button { width: 100%; }
  .facts { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; }
  .bid-foot { flex-direction: column; align-items: stretch; }
  .actions button { flex: 1; }
}
