/* 공씩 화면. 하늘색 테마(사용자 결정 2026-11-12, PROJECT.md 4절), 마감 임박만 빨강, 기기 기본 글꼴.
   데스크톱: 왼쪽 고정 사이드바(제목·필터) + 오른쪽 목록(좌우 꽉 채움) + 아래 고정 푸터(출처). 좁은 화면: 위 검색줄, 필터는 아래에서 올라오는 창 */
:root {
  color-scheme: light dark;
  --bg: #eef5fb; --panel: #ffffff; --side: #e2eef9; --fg: #16324a; --fg2: #3d5a73; --muted: #6b8499;
  --line: #cfe0ef; --line2: #e3eef7; --input: #b9d2e8; --tag: #dcebf8; --tag-fg: #22577f;
  --on: #4a90c8; --on-fg: #ffffff; --brand: #2f74ad; --hover: #f3f9fe; --row-hover: #e3f0fb;
  --accent: #c62828; --scroll: #b9d2e8; --side-w: 290px; --foot-h: 0px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1923; --panel: #142330; --side: #11202c; --fg: #e3eef8; --fg2: #b4c8d9; --muted: #8aa3b8;
    --line: #23394c; --line2: #1b2e3e; --input: #33506a; --tag: #1d3448; --tag-fg: #a9d1f2;
    --on: #6fb0e3; --on-fg: #0e1923; --brand: #8cc4ef; --hover: #182a39; --row-hover: #1d3447;
    --accent: #ff8a80; --scroll: #33506a;
  }
}
* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 4px; } ::-webkit-scrollbar-track { background: transparent; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font-family: system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; font-size: 15px; line-height: 1.6; }
a { color: var(--fg); } a:hover { color: var(--brand); }
button, input, select { font: inherit; color: var(--fg); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* 사이드바 */
.side { position: fixed; top: 0; left: 0; bottom: 0; width: var(--side-w); overflow-y: auto; background: var(--side); border-right: 1px solid var(--line); padding: 16px 20px 12px; display: flex; flex-direction: column; gap: 14px; }
.brand-box { display: flex; align-items: baseline; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.brand { font-size: 24px; font-weight: 800; color: var(--brand); text-decoration: none; letter-spacing: -0.01em; }
.sub { font-size: 14px; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, legend { font-size: 13px; font-weight: 600; color: var(--fg2); }
fieldset { border: 0; margin: 0; padding: 0; }
legend { padding: 0; margin-bottom: 6px; display: flex; align-items: center; gap: 4px; }
input[type=search] { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--input); border-radius: 8px; background: var(--panel); font-size: 14px; outline-color: var(--on); }
.chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.grid3 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.grid3 .chip { height: 30px; font-size: 12.5px; }
.chip, .pill { height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--input); background: var(--panel); font-size: 13px; cursor: pointer; }
.grid3 .chip { border-radius: 8px; padding: 0; }
.chip:hover, .pill:hover { border-color: var(--on); }
.chip[aria-pressed=true], .pill[aria-pressed=true] { background: var(--on); border-color: var(--on); color: var(--on-fg); }
.help { border: 0; background: none; padding: 0 2px; color: var(--muted); cursor: pointer; font-size: 13px; }
.help-dl { margin: 12px 0 0; }
.help-dl dt { font-weight: 700; color: var(--brand); margin-top: 12px; }
.help-dl dt:first-child { margin-top: 0; }
.help-dl dd { margin: 2px 0 0; color: var(--fg2); }
.f-actions { display: none; align-items: center; justify-content: space-between; }
.close-f, .m-reset { display: none; }
.reset { height: 28px; padding: 0 12px; border: 1px solid var(--input); border-radius: 8px; background: var(--panel); color: var(--fg2); cursor: pointer; font-size: 13px; }
.reset:hover { border-color: var(--on); color: var(--brand); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.m-meta { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); margin-top: 12px; }
.menu-btn { display: none; }
.m-btns { margin: 14px 0 0; }
.m-btns .foot-btn { flex: 1; height: 44px; }
.m-src-h { margin: 18px 0 6px; font-size: 13px; color: var(--fg2); }
#mmenu .src-t { font-size: 12px; }
.visits { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; font-variant-numeric: tabular-nums; }
.vs-h { font-weight: 600; color: var(--fg2); }
.vs-k { color: var(--muted); }
.vs-i span:last-child { color: var(--fg); font-weight: 600; }
.ver { margin: 0; display: flex; align-items: center; flex-wrap: wrap; }
.ver-btn { padding: 2px 0; border: 0; background: none; color: var(--fg2); font-size: 12px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.ver-btn:hover { color: var(--brand); }
.ver-d { white-space: pre; font-variant-numeric: tabular-nums; }

/* 목록 */
.main { margin-left: var(--side-w); padding: 16px 24px calc(var(--foot-h) + 14px); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.m-head { display: none; }
.count-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.count { margin: 0; font-size: 13px; color: var(--fg2); }
.count strong { color: var(--brand); font-size: 15px; }
.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.toggles .pill { height: 34px; border-radius: 8px; font-size: 13px; }
.m-bar { display: none; }
.table-box { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-box th { text-align: left; padding: 9px 10px; font-weight: 600; font-size: 12px; color: var(--fg2); background: var(--tag); border-bottom: 1px solid var(--line); }
.table-box th:first-child, .table-box td:first-child { padding-left: 16px; }
.table-box td { padding: 6px 10px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.table-box tbody tr { height: var(--row-h, auto); }
.tcell { line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.table-box tbody tr { transition: background-color .12s; cursor: pointer; }
.table-box tbody tr:hover { background: var(--row-hover); box-shadow: inset 3px 0 0 var(--on); }
.table-box tbody tr:hover .title { color: var(--brand); }
.table-box tbody tr:focus-visible { outline: 2px solid var(--on); outline-offset: -2px; background: var(--row-hover); }
.table-box tr:last-child td { border-bottom: 0; }
/* 지역·시작일·마감일: 오른쪽 끝에 같은 폭으로 붙임 */
.c-org { width: 22%; } .c-rg, .c-d, .c-end { width: 88px; }
.table-box th.c-rg, .table-box th.c-d, .table-box th.c-end, td.c-rg, td.c-d, td.c-end { text-align: center; padding-left: 4px; padding-right: 4px; }
.table-box th.c-end, td.c-end { padding-right: 12px; }
td.c-end, td.c-d { color: var(--fg2); }
.title { text-decoration: none; }
.org { display: flex; flex-direction: column; margin-top: 2px; line-height: 1.45; }
.org-up { font-size: 11.5px; color: var(--muted); }
.org-main { font-weight: 600; color: var(--fg); }
/* 기관 구분 뱃지: 정사각형·두 줄, 사이드바 필터(단추)와 표 첫 칸이 같은 모양 */
.kb { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 48px; height: 48px; padding: 0; border-radius: 8px; background: var(--tag); color: var(--tag-fg); border: 1px solid transparent; font-size: 11.5px; font-weight: 600; line-height: 1.3; text-align: center; letter-spacing: -0.02em; word-break: keep-all; }
/* 기관 구분 색: 공무원·교육 계열(남색·청록·초록), 공공기관 계열(보라·호박·자주). 빨강은 마감 임박 전용 */
.k0 { --kc-bg: #dfe7fb; --kc-fg: #233f8f; } .k1 { --kc-bg: #d4eff2; --kc-fg: #0f6470; } .k2 { --kc-bg: #dff2dc; --kc-fg: #2f6b22; }
.k3 { --kc-bg: #ebe3f8; --kc-fg: #5a3b98; } .k4 { --kc-bg: #fbefd6; --kc-fg: #835410; } .k5 { --kc-bg: #f8e1ee; --kc-fg: #8c2a62; }
@media (prefers-color-scheme: dark) {
  .k0 { --kc-bg: #22305a; --kc-fg: #bccaf6; } .k1 { --kc-bg: #143f45; --kc-fg: #a4e1e8; } .k2 { --kc-bg: #1f3d1c; --kc-fg: #b5e3a8; }
  .k3 { --kc-bg: #36285a; --kc-fg: #d6c7f4; } .k4 { --kc-bg: #4a3612; --kc-fg: #f2d49a; } .k5 { --kc-bg: #4d1f39; --kc-fg: #f3bcd9; }
}
.kb[class*=" k"], .tag[class*=" k"] { background: var(--kc-bg); color: var(--kc-fg); }
.kb-btn { width: 100%; height: 52px; font-size: 12.5px; cursor: pointer; background: var(--panel); color: var(--muted); border-color: var(--input); }
.kb-btn[aria-pressed=false] { background: var(--panel); color: var(--muted); border-color: var(--input); }
.kb-btn[aria-pressed=true] { background: var(--kc-bg); color: var(--kc-fg); border-color: var(--kc-fg); box-shadow: inset 0 0 0 1px var(--kc-fg); }
.kb-btn:hover { border-color: var(--kc-fg); }
.c-k { width: 72px; }
.table-box td.c-k { padding-right: 0; }
.table-box .kb { width: min(48px, calc(var(--row-h, 60px) - 10px)); height: min(48px, calc(var(--row-h, 60px) - 10px)); font-size: 11px; }
.table-box td.c-end, .table-box td.c-d, .table-box td.c-rg { line-height: 1.4; }
.tag { display: inline-block; padding: 0 7px; border-radius: 4px; background: var(--tag); color: var(--tag-fg); font-size: 12px; }
.table-box .tag { font-size: 11px; padding: 0 6px; }
.new { display: inline-block; margin-left: 4px; padding: 0 5px; border: 1px solid var(--on); border-radius: 4px; color: var(--brand); font-size: 10.5px; font-weight: 600; line-height: 1.5; vertical-align: 1px; }
.dd { font-weight: 700; color: var(--fg); }
.dd.urgent { color: var(--accent); }

.cards { display: none; flex-direction: column; gap: 10px; }
.card { display: block; text-decoration: none; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.card-1 { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fg2); }
.card-1 .who { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-2 { margin-top: 6px; font-size: 15px; font-weight: 600; color: var(--fg); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-3 { margin-top: 6px; font-size: 13px; color: var(--fg2); }

.empty { margin: 24px 0; text-align: center; color: var(--muted); }
.pager { align-self: center; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: center; }
.pager a, .pager span { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; padding: 0 6px; border-radius: 8px; text-decoration: none; font-size: 14px; }
.pager a:hover { background: var(--tag); }
.pager a[aria-current=page] { background: var(--on); color: var(--on-fg); font-weight: 600; }
.pager .gap, .pager .off { color: var(--muted); }

/* 아래 고정 푸터: 본문(목록)과 같은 넓이, 출처와 갱신일(농축협정보검색기와 같은 표) */
.foot { position: fixed; left: var(--side-w); right: 0; bottom: 0; z-index: 5; background: var(--panel); border-top: 1px solid var(--line); padding: 6px 24px; font-size: 12px; color: var(--muted); }
.src-line { margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src-line b { color: var(--fg2); margin-right: 6px; }
.src-line a { color: var(--muted); }
.src-sep { margin: 0 4px; }
.src-t { width: auto; border-collapse: collapse; font-size: 12px; }
.src-t th, .src-t td { padding: 2px 16px 2px 0; text-align: left; vertical-align: top; }
.src-t th { font-weight: 600; color: var(--fg2); white-space: nowrap; }
.src-t td:first-child, .src-t td:last-child { white-space: nowrap; }
.src-t td:last-child, .src-t th:last-child { padding-right: 0; font-variant-numeric: tabular-nums; }
.src-t a { color: var(--muted); }
.foot { display: flex; align-items: center; gap: 16px; }
.foot-btns { margin-left: auto; display: flex; gap: 8px; }
.foot-btn { display: inline-flex; align-items: center; justify-content: center; height: 30px; padding: 0 16px; border: 1px solid var(--input); border-radius: 4px; background: var(--panel); color: var(--fg2); font-size: 13px; text-decoration: none; white-space: nowrap; }
.foot-btn:hover { border-color: var(--on); color: var(--brand); background: var(--hover); }

/* 팝업: 개인정보처리방침(메인 원본을 배포 때 넣은 /privacy 본문), 문의(메인 문의 게시판을 틀로) */
dialog.dlg { border: 1px solid var(--line); border-radius: 14px; padding: 0; width: 100%; max-width: min(640px, calc(100vw - 32px)); background: var(--panel); color: var(--fg); box-shadow: 0 10px 40px rgba(0,0,0,.2); }
dialog.dlg::backdrop { background: rgba(10, 30, 50, .45); }
.dlg-in { padding: 16px 22px 22px; max-height: min(80vh, 680px); overflow-y: auto; font-size: 14px; line-height: 1.7; }
.dlg-top { display: flex; align-items: center; justify-content: space-between; position: sticky; top: -16px; background: var(--panel); padding-top: 4px; }
.dlg-top h2 { margin: 0; font-size: 18px; color: var(--brand); }
.dlg-x { border: 0; background: none; font-size: 24px; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px 8px; min-width: 44px; min-height: 44px; }
.privacy-body h2 { margin: 16px 0 6px; font-size: 15px; }
.privacy-body ul { padding-left: 20px; }
dialog.contact { max-width: min(960px, calc(100vw - 32px)); overflow: hidden; }
.contact-frame { display: block; width: 100%; height: min(80vh, 680px); border: 0; background: var(--panel); }
.contact-x { position: absolute; top: 4px; right: 4px; z-index: 1; }
.cl-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 12px 0 0; }
.cl-tab { flex: 0 0 auto; height: 34px; padding: 0 14px; border: 1px solid var(--input); border-radius: 17px; background: var(--panel); color: var(--fg2); font-size: 13px; cursor: pointer; font-variant-numeric: tabular-nums; }
.cl-tab.on { background: var(--on); border-color: var(--on); color: var(--on-fg); font-weight: 600; }
.changelog { list-style: none; margin: 10px 0 0; padding: 0; }
.changelog > li { padding: 10px 0; border-top: 1px solid var(--line); }
.changelog > li:first-child { border-top: 0; }
.cl-h { font-weight: 600; }
.cl-items { margin: 4px 0 0; padding-left: 18px; color: var(--fg2); }
.cl-empty { margin: 14px 0 0; color: var(--muted); }
/* /privacy 주소로 직접 열었을 때 */
body.doc { background: var(--bg); }
.doc-in { max-width: 760px; margin: 0 auto; padding: 32px 20px 48px; line-height: 1.75; }
.doc-in h1 { color: var(--brand); font-size: 24px; }

/* 낮은 화면(노트북 등): 사이드바가 스크롤 없이 들어가게 더 촘촘하게 */
@media (max-height: 760px) and (min-width: 901px) {
  .side { gap: 10px; padding-top: 12px; }
  .brand { font-size: 21px; }
  input[type=search] { height: 34px; }
  .kb-btn { height: 46px; font-size: 12px; }
  .grid3 .chip { height: 27px; }
  .toggles .pill { height: 30px; }
  .side-links, .side-foot { padding-top: 8px; }
  .table-box td { padding-top: 4px; padding-bottom: 4px; }
  .tcell { line-height: 1.38; }
  .org { line-height: 1.32; margin-top: 0; }
  .org-up { font-size: 11px; }
}

/* 좁은 화면 */
@media (max-width: 900px) {
  .side { display: none; }
  .side.open { display: flex; position: fixed; inset: auto 0 0 0; width: auto; max-height: 85vh; z-index: 10; border-radius: 14px 14px 0 0; border-right: 0; box-shadow: 0 -8px 24px rgba(0,0,0,.25); }
  .side .brand-box, .side .field, .side .side-foot { display: none; }
  .chips { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
  .kb-btn { width: 100%; height: auto; aspect-ratio: 1; font-size: 11px; letter-spacing: -0.04em; }
  .grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid3 .chip { height: 34px; }
  .f-actions { display: flex; }
  .m-reset { display: inline-block; }
  .close-f { display: inline-block; height: 44px; padding: 0 18px; border: 1px solid var(--on); border-radius: 8px; background: var(--on); color: var(--on-fg); cursor: pointer; }
  .main { margin-left: 0; padding: 0 14px 16px; }
  .m-head { display: flex; flex-direction: column; gap: 10px; margin: 0 -14px; padding: 12px 14px; background: var(--side); border-bottom: 1px solid var(--line); }
  .m-brand { display: flex; align-items: baseline; gap: 10px; }
  .m-search { display: flex; gap: 8px; }
  .m-search input { height: 44px; font-size: 15px; }
  .filter-btn { height: 44px; padding: 0 14px; border: 1px solid var(--on); border-radius: 8px; background: var(--on); color: var(--on-fg); display: flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; flex-shrink: 0; }
  .side .f-sort { display: none; }
  .m-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .m-bar .toggles { display: flex; align-items: center; gap: 6px; }
  .m-bar .pill { height: 34px; padding: 0 12px; border-radius: 17px; }
  .m-bar .count { margin: 0; }
  .table-box { display: none; }
  .cards { display: flex; }
  .pager a, .pager span { min-width: 44px; height: 44px; }
  /* 푸터는 숨기고 출처·방문 수·업데이트·문의·개인정보처리방침은 ☰ 메뉴 창으로 */
  .foot { display: none; }
  .menu-btn { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex-shrink: 0; border: 1px solid var(--input); border-radius: 8px; background: var(--panel); color: var(--fg2); cursor: pointer; }
  #mmenu .src-t thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  #mmenu .src-t, #mmenu .src-t tbody { display: block; }
  #mmenu .src-t tr { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
  #mmenu .src-t tr:last-child { border-bottom: 0; }
  #mmenu .src-t td { display: block; padding: 0; white-space: normal !important; }
  #mmenu .src-t td:nth-child(n+2) { grid-column: 2; }
}
