/* 덴트모아 대시보드 — 휴대폰 화면을 먼저 생각한 단순한 스타일 */

:root {
  color-scheme: light dark;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f0f3f5;
  --text: #1b2430;
  --muted: #5f6b7a;
  --border: #dde3e8;
  --primary: #0b7a83;
  --primary-strong: #08626a;
  --primary-soft: #e2f3f4;
  --on-primary: #ffffff;
  --danger: #c62828;
  --danger-soft: #fdecea;
  --on-danger: #ffffff;
  --warn: #8a5a00;
  --warn-soft: #fff4dc;
  --ok: #1b7f3b;
  --ok-soft: #e6f4ea;
  --star: #e0a100;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --font: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111518;
    --surface: #1a1f24;
    --surface-2: #232a30;
    --text: #e5e9ed;
    --muted: #9aa5b1;
    --border: #2e363e;
    --primary: #3ec1cb;
    --primary-strong: #66d3db;
    --primary-soft: #16343a;
    --on-primary: #06292d;
    --danger: #ff7a70;
    --danger-soft: #3a1d1b;
    --on-danger: #2a0b09;
    --warn: #f3c46b;
    --warn-soft: #3a2f17;
    --ok: #6fd28e;
    --ok-soft: #173322;
    --star: #ffc93c;
    --shadow: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.35; margin: 0 0 .6em; }
h2 { font-size: 1.08rem; }
h3 { font-size: 1rem; margin-top: 1.2em; }
code { font-size: .92em; background: var(--surface-2); padding: .05em .35em; border-radius: 6px; }
small, .small { font-size: .86rem; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* ───────── 머리글·메뉴 ───────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 10px 16px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.12rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { display: block; }
.logout { margin: 0; }
.link-button {
  background: none; border: 0; padding: 6px 4px; color: var(--muted);
  font: inherit; font-size: .9rem; cursor: pointer;
}
.mainnav {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 8px;
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a {
  flex: 0 0 auto;
  padding: 10px 12px 9px;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.mainnav a:hover { text-decoration: none; color: var(--text); }
.mainnav a.active { color: var(--primary); border-bottom-color: var(--primary); }

.container { max-width: 880px; margin: 0 auto; padding: 16px 16px 40px; }
.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 0 16px 28px; }
.page-title { font-size: 1.3rem; }
.back { margin: 0 0 10px; }

/* ───────── 카드·알림 메시지 ───────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.flashes { margin-bottom: 12px; }
.flash {
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 8px;
  border: 1px solid transparent;
}
.flash ul { margin: 6px 0 0; padding-left: 1.2em; }
.flash-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.flash-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.flash-info { background: var(--primary-soft); color: var(--text); }

.empty { text-align: center; padding: 28px 18px; }
.empty-title { font-weight: 700; font-size: 1.05rem; margin-top: 0; }
.preview { background: var(--primary-soft); border-color: transparent; }
.hint { color: var(--muted); font-size: .88rem; margin: 6px 0 10px; }

/* ───────── 버튼 ───────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn:disabled, .btn.disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-strong); }
.btn-small { min-height: 34px; padding: 5px 10px; font-size: .88rem; }
.btn-block { width: 100%; }
.btn-star.on { color: var(--star); border-color: color-mix(in srgb, var(--star) 50%, var(--border)); }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.button-row form { margin: 0; }

/* ───────── 탭·검색 ───────── */

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 12px;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: .93rem;
}
.tabs a:hover { text-decoration: none; }
.tabs a.active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

details > summary { cursor: pointer; }
.filters > summary { font-weight: 700; }
.filter-form { margin-top: 12px; }
details.sub { border-top: 1px solid var(--border); padding: 8px 0; }
details.sub > summary { font-weight: 600; padding: 2px 0; }
details.sub .checks { margin-top: 8px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 10px 0 4px; }
.pill {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 .5em;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: .78rem;
  text-align: center;
  font-weight: 700;
}
.result-count { color: var(--muted); margin: 4px 2px 10px; font-size: .93rem; }
.result-count strong { color: var(--text); }

/* ───────── 입력 ───────── */

.field { display: block; margin: 10px 0; }
.field-label { display: block; font-weight: 600; margin-bottom: 4px; font-size: .93rem; }
.field-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.field-inline { display: inline-flex; align-items: center; gap: 8px; margin: 6px 0; }
.field-inline .field-label { margin: 0; }
input[type="text"], input[type="search"], input[type="password"], input[type="email"],
input[type="number"], input[type="time"], select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
input:disabled { background: var(--surface-2); color: var(--muted); }
textarea { resize: vertical; }
.input-short { width: 6em; }
.field-inline select { width: auto; }
.narrow-form { max-width: 420px; }

.checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 6px;
  margin: 6px 0 10px;
}
.checks-compact { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
.checks-wide { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.check-desc { display: block; color: var(--muted); font-size: .8rem; font-weight: 400; margin-top: 2px; }
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  font-size: .94rem;
  line-height: 1.3;
}
.check:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.check:has(input:disabled) { opacity: .5; cursor: default; }
.check input { width: 18px; height: 18px; margin: 0; flex: 0 0 auto; accent-color: var(--primary); }
.check-wide { margin: 8px 0; }
.check-strong { font-weight: 700; margin: 8px 0 12px; }
.filter-row .check { display: inline-flex; }
.clear-check { display: inline-flex; align-items: center; gap: 6px; font-size: .86rem; color: var(--muted); margin-top: 4px; }

.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px; }
.section-head h2 { margin: 0; }
.mini-buttons { display: flex; gap: 6px; }

.times { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-width: 440px; }

.save-bar {
  position: sticky;
  bottom: 0;
  padding: 10px 0 14px;
  background: linear-gradient(to bottom, transparent, var(--bg) 35%);
}

/* 지역 고르기 */
.region-list { display: grid; gap: 6px; margin-bottom: 10px; }
.sido { border: 1px solid var(--border); border-radius: 10px; padding: 6px 8px; }
.sido .check { border: 0; background: none; padding: 4px 2px; font-weight: 600; }
.sido details > summary { color: var(--muted); font-size: .9rem; padding: 2px 4px 4px; }
.sido details .check { font-weight: 400; border: 1px solid var(--border); padding: 6px 8px; }
.sido details .check:has(input:checked) { background: var(--primary-soft); border-color: var(--primary); }
.count { color: var(--primary); font-weight: 700; }
.region-summary { font-size: .9rem; color: var(--primary); font-weight: 600; min-height: 1.2em; margin: 4px 0; }

/* ───────── 공고 카드 ───────── */

.posting-list { display: grid; gap: 0; }
.posting { transition: opacity .2s; }
.posting.is-hidden { opacity: .55; }
.posting-head { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.posting-title { font-size: 1.02rem; margin: 0 0 4px; }
.posting-title a { color: var(--text); }
.posting-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--muted); font-size: .9rem; margin-bottom: 6px; }
.posting-meta .inst { color: var(--text); font-weight: 600; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 0; margin: 0 0 8px; }
.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-size: .8rem;
  line-height: 1.6;
  white-space: nowrap;
}
.tag-inst { background: var(--primary-soft); color: var(--primary-strong); font-weight: 600; }
.tag-spec { font-weight: 600; }
.tag-hint { background: transparent; border: 1px dashed var(--border); color: var(--muted); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.summary { margin: 0 0 8px; padding-left: 1.1em; color: var(--text); font-size: .92rem; }
.summary li { margin: 1px 0; }
.summary-numbered { padding-left: 1.4em; }
.dups { font-size: .86rem; color: var(--muted); margin: 0 0 8px; }
.posting-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.when { color: var(--muted); font-size: .86rem; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.actions form { margin: 0; }

.badge {
  flex: 0 0 auto;
  display: inline-block;
  padding: 2px 9px;
  border-radius: 8px;
  font-size: .8rem;
  font-weight: 700;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--text);
}
.badge:hover { text-decoration: none; }
.badge-urgent { background: var(--danger); color: var(--on-danger); }
.badge-dday { background: var(--primary-soft); color: var(--primary-strong); }
.badge-passed { background: var(--surface-2); color: var(--muted); }
.badge-open { background: var(--surface-2); color: var(--muted); font-weight: 600; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-star { background: var(--warn-soft); color: var(--star); }

.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin: 16px 0; }
.pager-info { color: var(--muted); }

/* ───────── 상세 ───────── */

.detail-title { font-size: 1.2rem; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.meta { display: grid; grid-template-columns: 6.5em 1fr; gap: 4px 10px; margin: 0 0 12px; font-size: .94rem; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; }
.body-text { white-space: pre-wrap; word-break: break-word; font-size: .95rem; line-height: 1.7; }
.ev q { display: inline-block; background: var(--surface-2); border-radius: 6px; padding: 0 6px; margin: 1px 4px 1px 0; font-size: .86rem; }
.ev q::before, .ev q::after { content: "“"; color: var(--muted); }
.ev q::after { content: "”"; }
.result-ok { color: var(--ok); font-weight: 700; }
.result-no { color: var(--danger); font-weight: 700; }
.reasons { margin-top: 0; }
.plain-list { margin: 0; padding-left: 1.1em; }

/* ───────── 표 ───────── */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; vertical-align: top; padding: 8px 8px; border-bottom: 1px solid var(--border); }
.table thead th { color: var(--muted); font-weight: 600; font-size: .84rem; }
.table tbody th { font-weight: 600; white-space: nowrap; }

@media (max-width: 599px) {
  /* 좁은 화면에서는 분류 근거 표를 줄마다 카드처럼 */
  .evidence thead { display: none; }
  .evidence tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--border); }
  .evidence th, .evidence td { display: block; border: 0; padding: 2px 0; }
  .evidence tbody th { color: var(--muted); font-size: .84rem; }
}

/* ───────── 상태 ───────── */

.source-list { list-style: none; padding: 0; margin: 0; }
.source-list li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.source-list li:last-child { border-bottom: 0; }
.source-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.status { display: inline-block; font-size: .8rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.st-ok { background: var(--ok-soft); color: var(--ok); }
.st-env { background: var(--primary-soft); color: var(--primary-strong); }
.st-error { background: var(--danger-soft); color: var(--danger); }
.st-warn { background: var(--warn-soft); color: var(--warn); }
.st-running { background: var(--primary-soft); color: var(--primary-strong); }
.log-details summary { font-size: .84rem; color: var(--muted); }
.board-list { list-style: none; padding: 0; margin: 6px 0 0; font-size: .88rem; }
.board-list li { padding: 3px 0; border: 0; }
.log { white-space: pre-wrap; word-break: break-word; font-size: .8rem; background: var(--surface-2); padding: 8px; border-radius: 8px; max-height: 18em; overflow: auto; }

/* ───────── 계정·로그인 ───────── */

.help { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.help > summary { font-weight: 600; color: var(--primary); }
.help ol { padding-left: 1.3em; margin: 10px 0 4px; }
.help li { margin: 4px 0; }
.account-form .field { padding-bottom: 6px; }
.account-form .hint { display: block; margin: 4px 0 0; }
.tests { border-top: 1px dashed var(--border); padding-top: 12px; }
.auth-box { max-width: 460px; margin: 24px auto; padding: 22px 20px; }

/* ───────── 넓은 화면 ───────── */

@media (min-width: 720px) {
  .container { padding-top: 22px; }
  .card { padding: 18px 20px; }
  .times { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: none; }
  .posting-title { font-size: 1.08rem; }
}

/* 보는 사람 (SH·JY) — 위쪽 단추와 공고 카드의 이름 표시 */
.person-switch {
  display: inline-flex; gap: 2px; margin: 0 8px 0 auto; padding: 2px;
  border: 1px solid var(--border); border-radius: 999px;
}
.person-switch form { margin: 0; }
.person-switch button {
  border: 0; background: none; font: inherit; font-size: .88rem; font-weight: 600;
  min-height: 32px; padding: 4px 12px; border-radius: 999px; color: var(--muted); cursor: pointer;
}
.person-switch button.on { background: var(--primary); color: var(--on-primary); }
.tag-person { background: var(--primary); color: var(--on-primary); font-weight: 700; }
.person-tabs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.person-tabs form { margin: 0; }
.group-title { font-size: 1rem; color: var(--muted); margin: 24px 4px 8px; }
.danger-zone { border-color: var(--danger-soft); }
.person-target { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
