/* waitfor — design spec v1.0
   Dense board layout: 13px UI, 34px rows, hairline rules, radius 0 (controls 2px),
   one amber accent for comment counts, current location and the primary action. */

:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131416; --surface: #1a1b1e; --surface-2: #212328;
  --line: #2b2d33; --line-strong: #3c3f47;
  --text: #e4e4e1; --text-2: #a4a6ab; --text-3: #83868e; --visited: #8c8798;
  --accent: #e9a23b; --accent-text: #1a1308; --accent-bg: #2e2416;
  --menubar: #1f2126; --menubar-text: #c9cbd0; --menubar-hover: #2a2d33;
  --danger: #ef6b5f; --danger-bg: #3a1d1a; --success: #5db97f; --success-bg: #17301f; --warning: #d9b84a; --warning-bg: #332b12;
  --focus: #e9a23b; --field: #131416;
  --shadow: 0 6px 16px rgba(0, 0, 0, .45);
  --selection: rgba(233, 162, 59, .33);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eceef1; --surface: #ffffff; --surface-2: #f5f6f8;
  --line: #e1e4e8; --line-strong: #b9bfc7;
  --text: #1b1e22; --text-2: #545a62; --text-3: #6b717a; --visited: #7a6e8c;
  --accent: #b4580a; --accent-text: #ffffff; --accent-bg: #fcf1e4;
  --menubar: #2a323d; --menubar-text: #e3e7ec; --menubar-hover: #36404c;
  --danger: #c5352b; --danger-bg: #fcecea; --success: #24834a; --success-bg: #e7f5ec; --warning: #946b00; --warning-bg: #fbf3dc;
  --focus: #b4580a; --field: #ffffff;
  --shadow: 0 6px 16px rgba(20, 30, 40, .14);
  --selection: rgba(180, 88, 10, .2);
}

/* ── Base ─────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
:root[data-theme="dark"] body { -webkit-font-smoothing: antialiased; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 13px/20px -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", "Noto Sans KR", "Segoe UI", Roboto, sans-serif;
  word-break: keep-all; overflow-wrap: anywhere;
}
::selection { background: var(--selection); }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; margin: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
h1, h2, h3, p, dl, dd, ol, ul, fieldset { margin: 0; padding: 0; }
ol, ul { list-style: none; }
fieldset { border: 0; }
mark { background: var(--accent-bg); color: var(--accent); font-weight: 700; padding: 0; }
code, .mono { font-family: ui-monospace, "D2Coding", Consolas, "SF Mono", monospace; font-size: 12px; }
summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1132px; margin: 0 auto; padding: 0 16px; }
.grow { flex: 1 1 auto; }
.muted { color: var(--text-3); }
.small { font-size: 12px; font-weight: 400; }
.accent { color: var(--accent); }
.link-accent { color: var(--accent); font-weight: 600; }
.unknown { color: var(--text-3); }
.zero { color: var(--text-3); }
.icon { flex: none; fill: currentColor; vertical-align: -1px; }

/* ── Controls ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 28px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 2px;
  background: var(--surface-2); color: var(--text); font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap; cursor: pointer;
}
.btn:hover { background: var(--line); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-lg { height: 34px; padding: 0 16px; font-size: 13px; font-weight: 700; }
.btn-sm { height: 24px; padding: 0 8px; font-size: 11px; }
.btn-block { display: flex; width: 100%; height: 34px; }
.btn-tall { height: 40px; font-size: 14px; background: var(--surface); }
.btn-tall:hover { background: var(--surface-2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-text { display: inline-flex; align-items: center; min-height: 28px; padding: 0; border: 0; background: none; color: var(--text-2); font-size: 12px; cursor: pointer; }
.btn-text:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

.input {
  height: 30px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 2px;
  background: var(--field); color: var(--text); font-size: 13px; min-width: 0;
}
.input:focus { border-color: var(--accent); outline: none; }
.input::placeholder { color: var(--text-3); }
textarea.input { height: auto; padding: 8px; resize: vertical; line-height: 22px; }
select.input { padding-right: 4px; }
.num { text-align: right; }
input.num { text-align: right; }

.badge { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 2px; font-size: 11px; font-weight: 600; line-height: 1; white-space: nowrap; vertical-align: 1px; }
.badge-neutral { color: var(--text-2); background: var(--surface-2); }
.badge-success { color: var(--success); background: var(--success-bg); }
.badge-warning { color: var(--warning); background: var(--warning-bg); }
.badge-danger { color: var(--danger); background: var(--danger-bg); }
.badge-accent { color: var(--accent); background: var(--accent-bg); }

.flash { display: flex; align-items: center; min-height: 36px; padding: 8px 12px; border-left: 3px solid; font-size: 13px; }
.flash-success { color: var(--success); background: var(--success-bg); }
.flash-warning { color: var(--warning); background: var(--warning-bg); }
.flash-danger { color: var(--danger); background: var(--danger-bg); }

.search-form { display: flex; gap: 4px; }
.search-form .input { flex: 1 1 auto; }
.search-form .btn { height: 30px; }

/* ── Top bar ──────────────────────────────────────────── */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; height: 48px; }
.logo { display: block; color: var(--text); }
.logo svg, .footer-mark svg { display: block; width: auto; height: 28px; fill: currentColor; }
.logo .dot, .footer-mark .dot { fill: var(--accent); }
.top-search { margin-left: 32px; }
.top-search .input { width: 240px; flex: none; }
.util { display: flex; align-items: center; gap: 12px; margin-left: auto; font-size: 12px; color: var(--text-2); }
.util .strong { font-size: 13px; font-weight: 600; color: var(--text); }
.util .nick { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.util .admin-link { color: var(--accent); font-weight: 600; }
.util .need-nick { color: var(--warning); font-weight: 600; }
.util form { display: contents; }
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 0; background: none; color: var(--text-2); cursor: pointer; }
.theme-toggle:hover { color: var(--text); }
.theme-toggle .icon-moon, :root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }
.m-menu { display: none; }

.admin-strip { background: var(--accent-bg); color: var(--accent); font-size: 11px; font-weight: 700; line-height: 24px; }

/* ── Menu bar ─────────────────────────────────────────── */
.menubar { background: var(--menubar); color: var(--menubar-text); }
.menubar-inner { display: flex; align-items: stretch; height: 38px; }
.menubar-m { display: none; }
.menu-item, .menu-cat > summary { display: flex; align-items: center; height: 38px; padding: 0 12px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.menu-item:first-child { margin-left: -12px; }
.menu-item:hover, .menu-cat > summary:hover, .menu-cat[open] > summary { background: var(--menubar-hover); text-decoration: none; }
.menu-item[aria-current], .menu-cat > summary.is-current { color: #ffffff; box-shadow: inset 0 -2px 0 var(--accent); }
.menu-cat > summary::after { content: "▾"; margin-left: 4px; font-size: 10px; opacity: .6; }
.menu-cat[open] > summary::after { content: "▴"; }
.menu-sep { align-self: center; width: 1px; height: 14px; margin: 0 6px; background: var(--menubar-text); opacity: .25; }
.menu-cat { position: relative; }
.menu-panel {
  position: absolute; top: 38px; left: 0; z-index: 20; min-width: 200px; max-width: 520px; padding: 8px;
  display: grid; grid-template-columns: 1fr;
  background: var(--surface); border: 1px solid var(--line-strong); border-top: 2px solid var(--accent); box-shadow: var(--shadow);
}
.menu-panel.two { grid-template-columns: repeat(2, minmax(180px, 1fr)); width: max-content; }
.menu-panel a { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px; color: var(--text); font-size: 13px; font-weight: 400; white-space: nowrap; }
.menu-panel a:hover { background: var(--surface-2); text-decoration: none; }
.menu-panel a[aria-current] { color: var(--accent); font-weight: 700; }
.menu-write { align-self: center; display: flex; align-items: center; height: 26px; margin-left: auto; padding: 0 12px; border-radius: 2px; background: var(--accent); color: var(--accent-text); font-size: 12px; font-weight: 700; }
.menu-write:hover { filter: brightness(1.08); text-decoration: none; }

/* ── Page layout ──────────────────────────────────────── */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 268px; gap: 16px; align-items: start; padding-top: 12px; padding-bottom: 32px; }
.main, .admin-main { display: grid; gap: 12px; min-width: 0; align-content: start; }
.sidebar { display: grid; gap: 12px; }

.box { background: var(--surface); border: 1px solid var(--line); border-top: 2px solid var(--line-strong); }
.box-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; padding: 0 12px; border-bottom: 1px solid var(--line); }
.box-head h2 { font-size: 13px; font-weight: 700; }
.box-head h2 a:hover { color: var(--text); }
.box-head .more { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.box-head .more:hover { color: var(--text); }
.head-lg { min-height: 44px; padding: 8px 12px; flex-wrap: wrap; }
.head-lg h1 { font-size: 16px; line-height: 24px; font-weight: 700; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.head-lg h1 em { font-style: normal; color: var(--accent); }
.head-lg .search-form .input { width: 200px; }
.head-sub { font-size: 12px; color: var(--text-3); }
.box-body { padding: 12px; }
.box-note { padding: 10px 12px; font-size: 12px; line-height: 18px; color: var(--text-2); border-bottom: 1px solid var(--line); }
.box-note:last-child { border-bottom: 0; border-top: 1px solid var(--line); }
.crumb { font-size: 12px; font-weight: 400; color: var(--text-2); }

/* Sidebar */
.side-note { font-size: 12px; line-height: 18px; color: var(--text-2); margin-bottom: 8px; }
.btn-google .icon { width: 16px; height: 16px; }
.side-warn { display: block; margin: 12px 12px 0; padding: 8px; background: var(--warning-bg); color: var(--warning); font-size: 12px; line-height: 18px; }
.side-warn:hover { text-decoration: none; }
.side-links { padding: 6px 12px; display: grid; grid-template-columns: 1fr 1fr; }
.side-links a { display: flex; align-items: center; height: 28px; font-size: 12px; color: var(--text-2); }
.side-links a:hover { color: var(--text); }
.side-links a.accent { color: var(--accent); font-weight: 600; }
.side-foot { display: flex; justify-content: flex-end; padding: 0 12px 4px; }
.side-search { display: none; }
.side-boards { max-height: 640px; overflow-y: auto; }
.side-group { padding: 8px 0 6px; }
.side-group + .side-group { border-top: 1px solid var(--line); }
.side-group h3 { padding: 0 12px 4px; font-size: 11px; line-height: 16px; font-weight: 700; color: var(--text-3); }
.side-group ul { display: grid; grid-template-columns: 1fr 1fr; }
.side-group a { display: block; height: 26px; line-height: 26px; padding: 0 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.side-group a:hover { color: var(--text); }
.side-group a[aria-current] { color: var(--accent); font-weight: 700; box-shadow: inset 2px 0 0 var(--accent); }

/* Footer */
.footer { border-top: 1px solid var(--line); background: var(--bg); color: var(--text-3); font-size: 11px; }
.footer-inner { display: flex; align-items: center; gap: 12px; height: 64px; }
.footer-mark { margin-right: 8px; color: var(--text-2); }
.footer-mark svg { height: 20px; }
.footer a:hover { color: var(--text-2); }
.footer-copy { margin-left: auto; }

/* ── Post list table ──────────────────────────────────── */
.list, .grid-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.box > .list, .box > .grid-table { border-bottom: 1px solid var(--line-strong); }
.list .w-no { width: 64px; } .list .w-board { width: 96px; } .list .w-author { width: 112px; } .list .w-date { width: 56px; }
.list-boards .w-author { width: 104px; }
.list thead th, .grid-table thead th { height: 32px; padding: 0 8px; background: var(--surface-2); border-bottom: 1px solid var(--line-strong); color: var(--text-3); font-size: 11px; font-weight: 600; }
.list td { height: 34px; padding: 0 8px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list tbody tr:last-child td { border-bottom: 0; }
.list tbody tr:hover { background: var(--surface-2); }
.list tbody tr:hover .title { text-decoration: underline; text-underline-offset: 3px; }
.list .c-no, .list .c-date { text-align: center; color: var(--text-3); font-variant-numeric: tabular-nums; }
.list .c-no { font-size: 12px; }
.list .c-board a { color: var(--text-2); }
.list .c-board a:hover { color: var(--text); }
.list .c-title { font-size: 13px; color: var(--text); }
.list .c-cmt { display: none; }
.title-line { display: flex; align-items: center; gap: 4px; min-width: 0; }
.title-line .title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title-line .icon { color: var(--text-3); }
a.title:visited { color: var(--visited); }
.cmt { flex: none; color: var(--accent); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.m-meta { display: none; }
.list tr[aria-current] { background: var(--accent-bg); }
.list tr[aria-current] .title { font-weight: 700; }
.current-mark { color: var(--accent); font-size: 11px; font-weight: 700; }
.list .list-empty td, .grid-table .list-empty td { height: 160px; text-align: center; white-space: normal; font-size: 13px; color: var(--text-2); }
.list-empty small { display: block; margin-top: 4px; font-size: 12px; color: var(--text-3); }
.list-empty .btn, .list-empty .link-accent { margin-top: 8px; }
.list tr.tall td { height: 48px; }
.sub { display: block; font-size: 11px; line-height: 16px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.one-line { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.list-foot { display: grid; justify-items: center; gap: 12px; padding: 12px; }
.list-search .input { width: 220px; }
.pager { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 2px; padding: 12px; }
.list-foot .pager { padding: 0; }
.pager a, .pager strong { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 2px; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.pager a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.pager strong { background: var(--accent); color: var(--accent-text); font-weight: 700; }

/* Board head */
.board-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 10px; border-bottom: 1px solid var(--line); }
.board-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.board-title h1 { font-size: 16px; line-height: 24px; font-weight: 700; }
.board-title h1 a:hover { text-decoration: none; }
.board-title p { flex-basis: 100%; margin-top: 4px; font-size: 12px; line-height: 18px; color: var(--text-2); }
.board-closed { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.search-band { display: flex; align-items: center; justify-content: space-between; height: 36px; padding: 0 12px; background: var(--accent-bg); border-bottom: 1px solid var(--line); }
.search-band em { font-style: normal; font-weight: 700; color: var(--accent); }
.search-band a { font-size: 12px; color: var(--text-2); }

/* Home */
.box-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.board-box { min-height: 218px; }
.mini-list li { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-bottom: 1px solid var(--line); }
.mini-list li:last-child { border-bottom: 0; }
.mini-list .title-line { flex: 1 1 auto; }
.mini-list time { flex: none; width: 44px; text-align: right; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.mini-empty { display: flex; align-items: center; justify-content: center; height: 180px; font-size: 12px; color: var(--text-3); }
.directory-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); border-bottom: 1px solid var(--line); scroll-margin-top: 12px; }
.directory-row:last-child { border-bottom: 0; }
.directory-row h3 { padding: 8px 12px; font-size: 12px; line-height: 24px; font-weight: 700; color: var(--text-2); }
.directory-row p { padding: 8px 12px 8px 0; line-height: 24px; }
.directory-row a + a::before { content: "·"; margin: 0 6px; color: var(--text-3); display: inline-block; text-decoration: none; }

/* Board finder */
.grid-table .w-finder-name { width: 220px; } .grid-table .w-finder-cat { width: 96px; }
.grid-table td { height: 40px; padding: 0 8px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid-table tbody tr:hover { background: var(--surface-2); }
.finder-name { font-size: 13px !important; font-weight: 600; color: var(--text) !important; }

/* ── Post view ────────────────────────────────────────── */
.post-head { padding: 12px 16px 0; }
.post-board { display: inline-block; height: 20px; font-size: 12px; color: var(--text-2); }
.post-board:hover { color: var(--accent); text-decoration: none; }
.post-head h1 { margin: 4px 0 8px; font-size: 18px; line-height: 26px; font-weight: 700; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px; min-height: 32px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--text-2); }
.meta-left { display: flex; align-items: center; flex-wrap: wrap; }
.meta-left > * + *::before { content: "·"; margin: 0 6px; color: var(--text-3); }
.meta-nick { font-size: 13px; font-weight: 600; color: var(--text); }
.meta-left time, .meta-no { font-variant-numeric: tabular-nums; }
.meta-no { color: var(--text-3); }
.meta-cmt b { color: var(--accent); }
.meta-sep { width: 1px; height: 12px; background: var(--line-strong); }
.post-meta details[open], .c-head details[open] { flex-basis: 100%; order: 10; }
.post-meta details[open] > summary, .c-head details[open] > summary { font-weight: 700; color: var(--text); }
.post-body { padding: 24px 16px; font-size: 15px; line-height: 27px; white-space: pre-wrap; min-height: 160px; }
.auto-link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.post-video { padding: 0 16px 24px; }
.post-embed { margin: 16px 0; }
.post-video iframe, .post-embed iframe { display: block; width: 100%; max-width: 720px; aspect-ratio: 16 / 9; border: 0; background: #000; }
.post-images { display: grid; gap: 12px; padding: 0 16px 24px; justify-items: start; }
.post-images img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); }
.post-foot { display: flex; justify-content: center; align-items: center; gap: 8px; height: 48px; border-top: 1px solid var(--line); }

.confirm-band { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 -16px; padding: 8px 16px; font-size: 13px; }
.c-head .confirm-band { margin: 6px 0 4px; }
.band-danger { background: var(--danger-bg); color: var(--danger); }
.band-neutral { background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--text); }
.reasons { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.radios { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; min-height: 30px; }
.reasons label, .radios label, .check { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.confirm-band .input { flex: 1 1 260px; }
.band-actions { display: flex; gap: 8px; }

/* Comments */
.box-head h2 .accent { font-weight: 700; }
.c-empty { display: flex; align-items: center; justify-content: center; height: 64px; color: var(--text-3); }
.c-item { padding: 10px 16px; border-bottom: 1px solid var(--line); scroll-margin-top: 12px; }
.c-head { display: flex; align-items: center; flex-wrap: wrap; gap: 0 8px; min-height: 20px; font-size: 12px; color: var(--text-3); }
.c-head .btn-text { min-height: 20px; font-size: 11px; }
.c-nick { font-size: 13px; font-weight: 600; color: var(--text); }
.c-head time { font-variant-numeric: tabular-nums; }
.c-body { margin-top: 4px; font-size: 14px; line-height: 22px; white-space: pre-wrap; }
.c-deleted { font-size: 13px; color: var(--text-3); }
.c-reply { margin: 10px -16px -10px 12px; padding: 10px 16px 10px 16px; background: var(--surface-2); border-top: 1px solid var(--line); scroll-margin-top: 12px; }
.c-reply + .c-reply { margin-top: 10px; }
.c-reply:last-child { margin-bottom: -10px; }
.c-reply .icon { color: var(--text-3); }
.reply-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; margin: 6px 0 4px; }
.reply-form textarea { height: 64px; font-size: 14px; }
.c-more { display: flex; justify-content: center; padding: 12px; border-bottom: 1px solid var(--line); }
.c-form { padding: 12px 16px 16px; }
.c-form textarea { width: 100%; height: 88px; font-size: 14px; }
.c-form-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.c-form-foot .btn { height: 30px; margin-left: auto; }
.char-count { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.char-count.near { color: var(--warning); } .char-count.full { color: var(--danger); }
.c-login { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 64px; padding: 12px; background: var(--surface-2); color: var(--text-2); }
.c-login a { color: var(--accent); font-weight: 600; }

/* ── Forms (write, admin) ─────────────────────────────── */
.form-row { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.form-rows .form-row { grid-template-columns: 96px minmax(0, 1fr); }
.form-row > label, .form-row > .label { padding-top: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.form-field { display: grid; gap: 4px; min-width: 0; }
.form-field .input { width: 100%; }
.form-field.with-count { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.form-field .char-count.right { justify-self: end; }
.input-lg { height: 34px; font-size: 14px; }
textarea.body-input { height: 400px; font-size: 15px; line-height: 27px !important; padding: 12px !important; }
.hint { font-size: 12px; line-height: 18px; color: var(--text-3); }
.hint-inline { margin-left: 6px; font-size: 12px; color: var(--text-3); }
.file-input { font-size: 12px; color: var(--text-2); }
.file-input::file-selector-button { height: 28px; margin-right: 8px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 2px; background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.upload-status { font-size: 12px; color: var(--warning); }
.form-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; min-height: 56px; padding: 10px 16px; }
.write-form .form-foot { border-top: 0; }
.section-title { padding: 16px 16px 4px; font-size: 13px; font-weight: 700; }
.static { display: flex; align-items: center; height: 30px; color: var(--text-2); }
.field-line { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.inline-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.inline-fields { display: flex; align-items: center; gap: 6px; }

/* Login */
.login-body { width: 360px; max-width: 100%; margin: 0 auto; padding: 32px 0; display: grid; gap: 16px; }
.login-note { font-size: 12px; line-height: 18px; color: var(--text-2); }
.login-note a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

/* Dashboard, profile */
.info-list { padding: 4px 0; }
.info-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 12px; min-height: 40px; padding: 6px 16px; border-bottom: 1px solid var(--line); }
.info-row:last-child { border-bottom: 0; }
.info-row dt { font-size: 13px; font-weight: 600; color: var(--text-2); }
.info-form { align-items: start; padding-top: 10px; padding-bottom: 10px; }
.info-form dt { padding-top: 6px; }
.info-form .input { width: 220px; }
.info-form .hint { margin-top: 4px; }
.badges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.profile-head { align-items: flex-start; }
.profile-head .head-sub { margin-top: 2px; }
.tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 4px; }
.tabs a { display: flex; align-items: center; gap: 4px; height: 36px; padding: 0 12px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a[aria-current] { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.tabs small { font-size: 12px; font-weight: 400; color: var(--text-3); }

/* Policy documents */
.doc { padding: 24px 16px 32px; max-width: 712px; }
.doc h1 { font-size: 18px; line-height: 26px; }
.doc h2 { margin: 24px 0 8px; font-size: 14px; line-height: 22px; }
.doc p { font-size: 14px; line-height: 24px; }
.doc a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* Errors */
.error-box { padding: 48px 16px; }
.error-code { font-size: 13px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.error-box h1 { margin-top: 2px; font-size: 18px; line-height: 26px; }
.error-text { margin-top: 8px; color: var(--text-2); }
.error-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }

/* ── Admin ────────────────────────────────────────────── */
.admin-layout { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 16px; align-items: start; padding-top: 12px; padding-bottom: 32px; }
.admin-nav { position: sticky; top: 12px; background: var(--surface); border: 1px solid var(--line); border-top: 2px solid var(--line-strong); padding-bottom: 6px; }
.admin-nav h2 { padding: 12px 12px 4px; font-size: 11px; font-weight: 700; color: var(--text-3); }
.admin-nav a { display: flex; align-items: center; justify-content: space-between; height: 32px; padding: 0 12px; font-size: 13px; color: var(--text); }
.admin-nav a:hover { background: var(--surface-2); text-decoration: none; }
.admin-nav a[aria-current] { background: var(--accent-bg); color: var(--accent); font-weight: 700; box-shadow: inset 3px 0 0 var(--accent); }
.admin-nav .admin-back { margin-top: 6px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-2); }
.head-links { display: flex; gap: 12px; font-size: 12px; color: var(--text-2); }
.head-links a:hover { color: var(--text); }

.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 44px; padding: 7px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.filter-label { margin-left: 8px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.filter-bar > .filter-label:first-child { margin-left: 0; }
.segments { display: inline-flex; }
.segments a { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 12px; color: var(--text-2); }
.segments a + a { margin-left: -1px; }
.segments a:first-child { border-radius: 2px 0 0 2px; } .segments a:last-child { border-radius: 0 2px 2px 0; }
.segments a:hover { color: var(--text); text-decoration: none; }
.segments a[aria-current] { position: relative; background: var(--accent-bg); border-color: var(--accent); color: var(--accent); font-weight: 700; }

.table-scroll { overflow-x: auto; }
.admin-table { width: 100%; min-width: 720px; border-collapse: collapse; table-layout: fixed; font-size: 12px; font-variant-numeric: tabular-nums; }
.admin-table thead th { height: 32px; padding: 0 8px; text-align: left; background: var(--surface-2); border-bottom: 1px solid var(--line-strong); color: var(--text-3); font-size: 11px; font-weight: 600; white-space: nowrap; }
.admin-table th.num, .admin-table td.num { text-align: right; }
.admin-table .center { text-align: center; }
.admin-table .right { text-align: right; }
.admin-table td, .admin-table tbody th { height: 36px; padding: 4px 8px; border-bottom: 1px solid var(--line); color: var(--text); text-align: left; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-table tbody tr:hover > * { background: var(--surface-2); }
.admin-table td.mono { color: var(--text-3); }
.admin-table .strong { font-weight: 600; }
.admin-table .links { text-align: right; }
.admin-table .links a + a::before { content: "·"; margin: 0 6px; color: var(--text-3); display: inline-block; }
.admin-table .empty-row td { height: 96px; text-align: center; color: var(--text-2); white-space: normal; }
.admin-table .is-muted td, .admin-table .is-muted a { color: var(--text-3); }
.admin-table tr.tall td { height: auto; min-height: 52px; padding-top: 8px; padding-bottom: 8px; vertical-align: top; white-space: normal; }
.admin-table .ellipsis, .block.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-table .block { display: block; }
.admin-table .clamp-2 { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.admin-table .stack { display: table-cell; text-align: right; }
.admin-table .stack > * { margin: 0 0 4px 4px; }
.admin-table .strong-danger { color: var(--danger); font-weight: 700; }
.admin-table .is-done td { color: var(--text-2); }
.admin-table .sub-row td { height: 24px; padding-top: 0; font-size: 11px; color: var(--text-3); border-bottom: 1px solid var(--line); }
.admin-table .w-48 { width: 48px; } .admin-table .w-56 { width: 56px; } .admin-table .w-64 { width: 64px; } .admin-table .w-72 { width: 72px; }
.admin-table .w-80 { width: 80px; } .admin-table .w-88 { width: 88px; } .admin-table .w-96 { width: 96px; } .admin-table .w-104 { width: 104px; }
.admin-table .w-112 { width: 112px; } .admin-table .w-140 { width: 140px; } .admin-table .w-160 { width: 160px; } .admin-table .w-180 { width: 180px; }
.input.w-72 { width: 72px; } .input.w-140 { width: 140px; } .input.w-160 { width: 160px; } .input.w-180 { width: 180px; } .input.w-200 { width: 200px; } .input.w-240 { width: 240px; }

/* A row action opens the confirm row right below (or below the reason sub-row). */
.row-action { display: inline-block; }
.row-action[open] > summary { box-shadow: inset 0 0 0 1px currentColor; }
.admin-table .action-row { display: none; }
.admin-table tr:has(details.row-action[open]) + tr.action-row,
.admin-table tr:has(details.row-action[open]) + tr.sub-row + tr.action-row { display: table-row; }
.admin-table .action-row td { height: auto; padding: 8px 12px; white-space: normal; }
.admin-table .action-row:hover > * { background: inherit; }
.action-row.band-danger td { background: var(--danger-bg); color: var(--danger); }
.action-row.band-neutral td { background: var(--surface-2); }
.action-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.action-form .input { width: 360px; max-width: 100%; }
.action-text { font-size: 13px; }
.danger-text { color: var(--danger); }
.confirm > summary { display: inline-flex; }
.confirm .action-form { margin-top: 8px; padding: 8px 12px; }

.new-board > summary { display: inline-flex; }
.new-board[open] { flex-basis: 100%; order: 3; }
.panel-form { display: grid; gap: 10px; margin: 8px -12px -8px; padding: 12px; background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line-strong); }
.panel-form label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.panel-form .grow { flex: 1 1 300px; }
.panel-form .grow .input { width: 100%; }
.prefixed { display: inline-flex; align-items: center; gap: 4px; font-weight: 400; color: var(--text-3); }

.danger-zone { border-top-color: var(--danger); }
.danger-zone .box-head h2 { color: var(--danger); }
.danger-body { display: grid; gap: 8px; padding: 12px; }
.danger-body p { color: var(--text-2); }

.limits-table tbody th { font-weight: 600; }
.unit { font-size: 13px; color: var(--text-2); }
.metric-single { display: flex; align-items: baseline; gap: 6px; padding: 12px; }
.metric-value { font-size: 20px; line-height: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }

.stats-table .total-row > * { background: var(--surface-2); font-weight: 700; }
.stats-table th a.sorted { color: var(--text); }
.stats-table thead a:hover { color: var(--text); }
.spark { display: block; }
.spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: round; }
.metrics { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.metrics > div { min-height: 72px; padding: 12px; border-right: 1px solid var(--line); }
.metrics > div:last-child { border-right: 0; }
.metrics dt { font-size: 12px; color: var(--text-2); }
.metric-change { font-size: 11px; color: var(--text-3); }
.metric-change.up-good { color: var(--success); } .metric-change.up-bad { color: var(--danger); }
.daily-table td.is-max { background: var(--accent-bg); }

/* ── ≤ 980: sidebar drops below ───────────────────────── */
@media (max-width: 980px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side-search { display: block; }
  .admin-layout { grid-template-columns: minmax(0, 1fr); }
  .admin-nav { position: static; display: flex; overflow-x: auto; padding: 0; border-top-width: 1px; }
  .admin-nav h2 { display: none; }
  .admin-nav a { flex: none; height: 40px; }
  .admin-nav .admin-back { margin: 0 0 0 auto; border-top: 0; }
  .admin-nav a[aria-current] { box-shadow: inset 0 -2px 0 var(--accent); }
}

/* ── ≤ 720: mobile ────────────────────────────────────── */
@media (max-width: 720px) {
  .wrap { padding: 0 12px; }
  .topbar-inner { height: 44px; }
  .m-menu { display: block; margin-left: -12px; }
  .m-menu > summary { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; color: var(--text); }
  .m-panel { position: absolute; left: 0; right: 0; top: 44px; z-index: 30; max-height: calc(100vh - 44px); overflow-y: auto; background: var(--surface); border-bottom: 1px solid var(--line-strong); box-shadow: var(--shadow); }
  .m-panel .search-form { padding: 12px; border-bottom: 1px solid var(--line); }
  .m-panel .search-form .input { height: 36px; font-size: 16px; }
  .m-panel .search-form .btn { height: 36px; }
  .m-links { display: flex; align-items: center; gap: 16px; padding: 0 12px; min-height: 44px; border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 600; }
  .m-links form { margin-left: auto; }
  .m-panel section { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .m-panel h3 { padding: 0 12px 4px; font-size: 12px; font-weight: 700; color: var(--text-3); }
  .m-boards { display: grid; grid-template-columns: 1fr 1fr; }
  .m-boards a { display: flex; align-items: center; height: 40px; padding: 0 12px; font-size: 14px; }
  .m-boards a[aria-current] { color: var(--accent); font-weight: 700; }
  .logo svg { height: 25px; }
  .top-search { display: none; }
  .util .nick { max-width: 8em; }
  .util .admin-link, .util form { display: none; }
  .menubar-inner { display: none; }
  .menubar-m { display: flex; height: 36px; overflow-x: auto; scrollbar-width: none; }
  .menubar-m::-webkit-scrollbar { display: none; }
  .menubar-m a { flex: none; display: flex; align-items: center; padding: 0 12px; font-size: 13px; font-weight: 600; }
  .menubar-m a:first-child { margin-left: -12px; }
  .menubar-m a[aria-current] { color: #ffffff; box-shadow: inset 0 -2px 0 var(--accent); }
  .layout, .admin-layout { padding: 8px 0 24px; gap: 8px; }
  .main, .admin-main { gap: 8px; }
  .sidebar { display: none; }
  .box { border-left: 0; border-right: 0; }
  .input { font-size: 16px; }

  .footer-inner { flex-wrap: wrap; justify-content: center; height: auto; padding: 16px 12px; gap: 6px 12px; }
  .footer-copy { margin-left: 0; flex-basis: 100%; text-align: center; }

  .head-lg .search-form, .head-lg .search-form .input { width: 100%; }

  /* List rows become two-line blocks with a comment column. */
  .list colgroup, .list thead, .list .c-no, .list .c-board, .list .c-author, .list .c-date { display: none; }
  .list, .list tbody { display: block; }
  .list tr { display: grid; grid-template-columns: minmax(0, 1fr) 44px; align-items: center; min-height: 56px; border-bottom: 1px solid var(--line); }
  .list tbody tr:last-child { border-bottom: 0; }
  .list td { height: auto; border: 0; }
  .list .c-title { padding: 10px 12px; white-space: normal; }
  .list .title-line .title { font-size: 14px; line-height: 20px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .list .title-line .cmt { display: none; }
  .list .m-meta { display: block; margin-top: 2px; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .list .m-meta b { margin-right: 6px; color: var(--accent); font-weight: 600; }
  .list .c-cmt { display: grid; justify-items: center; padding: 0; text-align: center; }
  .list .c-cmt b { font-size: 13px; font-weight: 700; color: var(--accent); }
  .list .c-cmt small { font-size: 9px; line-height: 10px; color: var(--text-3); }
  .list .list-empty { display: block; }
  .list .list-empty td { display: block; height: auto; padding: 48px 12px; }
  .list tr.tall { min-height: 56px; }
  .list-search, .list-search .input { width: 100%; }
  .list-search .input { height: 36px; }
  .pager .pager-first, .pager .pager-far { display: none; }

  .board-head { align-items: flex-start; }
  .board-title p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .board-head .btn { height: 30px; }

  .box-grid { grid-template-columns: minmax(0, 1fr); }
  .board-box { min-height: 0; }
  .mini-list li:nth-child(n + 5) { display: none; }
  .directory-row { grid-template-columns: minmax(0, 1fr); }
  .directory-row h3 { padding-bottom: 0; }
  .directory-row p { padding: 0 12px 8px; }
  .grid-table colgroup, .grid-table thead { display: none; }
  .grid-table, .grid-table tbody, .grid-table tr { display: block; }
  .grid-table tr { padding: 8px 12px; min-height: 52px; border-bottom: 1px solid var(--line); }
  .grid-table td { display: inline; height: auto; padding: 0; border: 0; white-space: normal; }
  .grid-table .finder-name { display: block; }
  .grid-table .finder-desc::before { content: " · "; }

  .post-head, .post-body, .post-video, .post-images { padding-left: 12px; padding-right: 12px; }
  .post-head h1 { font-size: 17px; }
  .meta-left { flex-basis: 100%; }
  .post-meta { padding-bottom: 4px; }
  .post-images { margin: 0 -12px; padding-left: 0; padding-right: 0; }
  .post-images img { border-left: 0; border-right: 0; }
  .confirm-band { margin: 0 -12px; padding: 8px 12px; }
  .reasons { flex-direction: column; width: 100%; }
  .reasons label { min-height: 40px; }
  .c-item { padding-left: 12px; padding-right: 12px; }
  .c-reply { margin-left: 4px; margin-right: -12px; padding-left: 12px; padding-right: 12px; }
  .c-head .btn-text { min-height: 32px; }
  .c-form { padding-left: 12px; padding-right: 12px; }

  .form-row, .form-rows .form-row { grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 10px 12px; }
  .form-row > label, .form-row > .label { padding-top: 0; font-size: 12px; }
  textarea.body-input { height: 300px; }
  .write-form .form-foot { padding: 12px; }
  .write-form .form-foot .btn { flex: 1 1 50%; height: 44px; }
  .info-row { grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 8px 12px; }
  .info-form .input { flex: 1 1 auto; width: auto; }
  .login-body { padding: 24px 12px; }
  .doc { padding: 16px 12px; }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metrics > div:nth-child(3n) { border-right: 0; }
  .metrics > div:nth-child(-n + 3) { border-bottom: 1px solid var(--line); }
}

@media print {
  .topbar, .menubar, .sidebar, .c-form, .c-login, .admin-nav, .admin-strip, .footer, .post-foot { display: none !important; }
  .layout { display: block; }
  :root { --bg: #fff; --surface: #fff; --text: #000; --text-2: #333; --text-3: #555; --line: #ccc; --line-strong: #999; }
}
