:root {
    --maroon: #772432;
    --blue: #004165;
    --text: #1f2328;
    --muted: #5c6670;
    --line: #d8dde3;
    --frame: #a9b3bf;
    --panel: #eef1f5;
    --bg: #ffffff;
    --soft: #f4f6f8;
    --error: #b42318;
    --ok: #1a7f37;
}

* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--blue); }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

.site-header { background: var(--maroon); color: #fff; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; flex-wrap: wrap; }
.site-header a { color: #fff; text-decoration: none; }
.brand { font-weight: 700; font-size: 1.15rem; }
.account-nav { display: flex; align-items: center; gap: 16px; }
.account-nav form { margin: 0; }
.link-button { background: none; border: 0; padding: 0; color: #fff; font: inherit; cursor: pointer; }

main.wrap { padding-top: 24px; padding-bottom: 48px; }
h1 { font-size: 1.6rem; margin: 0 0 16px; }

.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li { padding: 10px 14px; border-radius: 6px; background: var(--soft); border-left: 4px solid var(--blue); }
.messages li.success { border-left-color: var(--ok); }
.messages li.error { border-left-color: var(--error); }

.form-card { max-width: 440px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; }
.field input { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.field .help { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }
.field .help ul { margin: 4px 0 0; padding-left: 18px; }
.errorlist { color: var(--error); list-style: none; padding: 0; margin: 4px 0 0; font-size: 0.9rem; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.button { display: inline-block; background: var(--blue); color: #fff; border: 0; border-radius: 6px; padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.form-links { margin-top: 16px; color: var(--muted); }

/* --- forum --- */
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.forum-bar { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin-bottom: 16px; }
.forum-search { display: flex; gap: 6px; margin-left: auto; }
.forum-search input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; min-width: 0; width: 220px; max-width: 100%; }
.button.small { padding: 6px 12px; }
.crumbs { font-size: 0.9rem; margin-bottom: 8px; color: var(--muted); }
.forum-section h2 { font-size: 1.15rem; margin: 28px 0 10px; padding-left: 10px; border-left: 4px solid var(--maroon); }
.forum-section h2 a { color: var(--text); text-decoration: none; }
.forum-table { width: 100%; border-collapse: separate; border-spacing: 0; margin-bottom: 20px; border: 1px solid var(--frame); border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }
.forum-table th { text-align: left; font-size: 0.85rem; color: var(--text); background: var(--panel); border-bottom: 1px solid var(--frame); padding: 8px 10px; }
.forum-table td { border-bottom: 1px solid var(--line); padding: 10px; vertical-align: top; }
.forum-table tbody tr:last-child td { border-bottom: 0; }
.forum-table tbody tr:nth-child(even) td { background: #fafbfc; }
.forum-table .num { text-align: right; white-space: nowrap; width: 5em; }
.forum-table .last { width: 13em; font-size: 0.875rem; }
.forum-table tbody tr.sticky td { background: #fdf6f7; }
.cat-name, .topic-subject { font-weight: 600; }
.tag { display: inline-block; font-size: 0.75rem; padding: 1px 6px; border-radius: 4px; background: var(--soft); border: 1px solid var(--line); color: var(--muted); vertical-align: middle; }
.tag.warn { color: var(--error); border-color: var(--error); }
.pagination { display: flex; gap: 16px; align-items: center; margin: 12px 0; }
.post { display: grid; grid-template-columns: 170px 1fr; border: 1px solid var(--frame); border-radius: 8px; margin-bottom: 16px; overflow: hidden; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }
.post-first { border-left: 4px solid var(--maroon); }
.post-pending, .post-hidden, .post-deleted { border-style: dashed; opacity: 0.8; }
.post-author { font-size: 0.9rem; overflow-wrap: anywhere; background: var(--panel); border-right: 1px solid var(--frame); padding: 14px; }
.author-name { display: block; font-weight: 600; }
.avatar { width: 72px; height: 72px; object-fit: cover; border-radius: 50%; display: block; margin-bottom: 6px; }
.avatar.large { width: 96px; height: 96px; }
.badge { display: inline-block; font-size: 0.72rem; background: var(--blue); color: #fff; border-radius: 4px; padding: 1px 6px; margin: 2px 2px 0 0; }
.post-main { min-width: 0; padding: 0 16px 14px; }
.post-meta { display: flex; gap: 12px; margin: 0 -16px 12px; padding: 8px 16px; background: #f6f8fa; border-bottom: 1px solid var(--line); }
.post-body { overflow-wrap: anywhere; }
.post-body img { max-width: 100%; height: auto; }
.post-body iframe { max-width: 100%; }
.bb-quote { margin: 8px 0; padding: 8px 12px; border-left: 4px solid var(--line); background: var(--soft); }
.bb-quote-by { font-size: 0.85rem; font-weight: 600; margin-bottom: 4px; }
.bb-code { background: #f6f8fa; border: 1px solid var(--line); border-radius: 6px; padding: 10px; overflow-x: auto; font-size: 0.85rem; }
.bb-table { border-collapse: collapse; margin: 8px 0; }
.bb-table td, .bb-table th { border: 1px solid var(--line); padding: 4px 8px; }
.bb-confidential { border: 1px dashed var(--maroon); padding: 8px; margin: 8px 0; }
.bb-confidential-label { font-size: 0.8rem; color: var(--maroon); font-weight: 600; }
.bb-hidden, .bb-missing { color: var(--muted); font-style: italic; }
.bb-warn { border-left: 4px solid var(--error); padding: 6px 10px; margin: 8px 0; }
.bb-attachment { max-width: 100%; }
.attachments { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.attachments img { max-width: 220px; max-height: 160px; border: 1px solid var(--line); border-radius: 4px; }
.signature { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 8px; font-size: 0.85rem; color: var(--muted); }
.signature img { max-height: 90px; }
.poll { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 14px; }
.poll-bar { background: var(--blue); height: 8px; border-radius: 4px; }
.results li { margin-bottom: 14px; }
.profile-head { display: flex; gap: 16px; align-items: center; }
@media (max-width: 640px) {
    .post { grid-template-columns: 1fr; }
    .post-author { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; border-right: 0; border-bottom: 1px solid var(--frame); padding: 10px 14px; }
    .avatar { width: 40px; height: 40px; margin: 0; }
    .forum-table .last, .forum-table th.last { display: none; }
    .forum-search { margin-left: 0; width: 100%; }
    .forum-search input { flex: 1; }
}

.main-nav { display: flex; gap: 18px; margin-right: auto; margin-left: 24px; }
.main-nav a { font-weight: 600; }

/* --- posting --- */
.title-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 8px; }
.title-row h1 { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions form { margin: 0; }
.actions.bottom { justify-content: flex-end; }
.button.secondary { background: #fff; color: var(--blue); border: 1px solid var(--blue); }
.button.secondary:hover { background: var(--soft); }
.post-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.post-actions form { margin: 0; }
.thanks { color: var(--muted); margin: 10px 0 0; }
.tag.new { background: var(--maroon); color: #fff; border-color: var(--maroon); }
.post-form { max-width: 860px; }
.post-form .field.check { display: flex; align-items: center; gap: 8px; }
.post-form .field.check input { width: auto; }
.post-form .field.check label { margin: 0; font-weight: normal; }
.post-form textarea { width: 100%; font: inherit; }
.post-form .cancel { margin-left: 12px; }
.quick-reply { margin-top: 28px; border-top: 2px solid var(--line); padding-top: 8px; }
