:root {
  --bg: #f7f8fb;
  --panel: #ffffff;
  --line: #d9dee8;
  --ink: #1b2430;
  --muted: #667085;
  --brand: #1f7a68;
  --brand-dark: #15584c;
  --warn: #b45309;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, textarea { font: inherit; }
button { border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); min-height: 36px; padding: 0 12px; cursor: pointer; }
button:hover { border-color: var(--brand); }
button.primary, .section-title button, menu button[type="submit"] { border-color: var(--brand); background: var(--brand); color: #fff; }

.shell { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; }
.topbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: max(14px, env(safe-area-inset-top)) 18px 12px; border-bottom: 1px solid var(--line); background: #fff; }
.topbar h1 { margin: 0; font-size: 1.25rem; }
.topbar p { margin: 3px 0 0; color: var(--muted); font-size: .9rem; }
.icon-button { width: 40px; padding: 0; font-size: 1.2rem; }

.layout { min-height: 0; display: grid; grid-template-columns: 260px minmax(280px, 420px) minmax(0, 1fr); }
.boards, .posts, .detail { min-height: 0; overflow: auto; padding: 14px; }
.boards, .posts { border-right: 1px solid var(--line); background: #fbfcfe; }
.detail { background: var(--panel); }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.section-title h2 { margin: 0; font-size: 1rem; }

.board-list, .post-list { display: grid; gap: 8px; }
.board-item, .post-item { width: 100%; display: grid; gap: 4px; padding: 11px; text-align: left; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.board-item.active, .post-item.active { border-color: var(--brand); box-shadow: inset 3px 0 0 var(--brand); }
.board-item strong, .post-item strong { overflow-wrap: anywhere; }
.board-item span, .post-item span, .meta { color: var(--muted); font-size: .82rem; }
.post-item p { margin: 0; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.empty-detail { height: 100%; display: grid; place-items: center; color: var(--muted); }
.article { max-width: 860px; margin: 0 auto; display: grid; gap: 18px; }
.article h2 { margin: 0; font-size: 1.45rem; overflow-wrap: anywhere; }
.body { white-space: pre-wrap; line-height: 1.65; overflow-wrap: anywhere; }
.attachment-list, .comment-list { display: grid; gap: 8px; }
.attachment, .comment { padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfe; }
.attachment { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; }
.comment p { margin: 7px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.composer { display: grid; gap: 8px; }
.composer textarea, .dialog-body textarea, .dialog-body input { width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 10px 11px; background: #fff; color: var(--ink); }
.composer textarea:focus, .dialog-body textarea:focus, .dialog-body input:focus { outline: 2px solid color-mix(in srgb, var(--brand), transparent 75%); border-color: var(--brand); }
.file-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.progress { width: 100%; height: 8px; overflow: hidden; border-radius: 999px; background: #e8edf5; }
.progress span { display: block; width: 0; height: 100%; background: var(--brand); transition: width .15s; }
.status { min-height: 20px; color: var(--muted); font-size: .86rem; }
.status.warn { color: var(--warn); }

dialog { width: min(560px, calc(100vw - 28px)); border: 1px solid var(--line); border-radius: 8px; padding: 0; box-shadow: 0 20px 70px #11182744; }
dialog::backdrop { background: #11182766; }
.dialog-body { display: grid; gap: 12px; padding: 18px; }
.dialog-body h2 { margin: 0; font-size: 1.1rem; }
menu { display: flex; justify-content: flex-end; gap: 8px; padding: 0; margin: 4px 0 0; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .boards, .posts { border-right: 0; border-bottom: 1px solid var(--line); max-height: 36dvh; }
  .detail { min-height: 56dvh; }
}
