:root {
    --page-bg: #ffffff;
    --card-bg: #f8f8f8;
    --header-bg: #1a1a1a;
    --section-nav-bg: #2e2e2e;
    --text: #1a1a1a;
    --muted: #666666;
    --line: #d0d0d0;
    --line-strong: #999999;
    --row-hover: #f0f0f0;
    --row-active: #e8e8e8;
    --thread-step: 20px;
    --thread-map-indent: 8px;
    --radius: 3px;
}

*[hidden] {
    display: none !important;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    background: var(--page-bg);
    color: var(--text);
    font-family: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
}

html {
    font-size: 17px;
}

body {
    font-size: 0.875rem;
}

a {
    color: #1a1a1a;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.topic-list,
.post-thread,
.breadcrumb,
.metric,
.message-table,
.message-row,
.message-meta-grid,
.message-body-text,
.post-head,
.post-body,
.snippet,
.attachment-list,
.branch-summary,
.page-head .muted,
time {
    font-family: "IBM Plex Mono", "Courier New", monospace;
}

.muted {
    color: var(--muted);
}

.tiny {
    font-size: 0.8rem;
}

.bbs-header {
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid #101010;
}

.bbs-header-inner {
    background: var(--header-bg);
    color: #fff;
    max-width: 1240px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
}

.forum-id-block {
    display: grid;
    gap: 1px;
}

.bbs-logo {
    color: #ffffff;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 700;
    font-size: 0.94rem;
}

.bbs-logo:hover {
    text-decoration: none;
    color: #ffffff;
}

.bbs-tagline {
    margin: 0;
    color: #c2c2c2;
    font-size: 0.75rem;
    font-family: "IBM Plex Mono", "Courier New", monospace;
}

.bbs-tagline strong {
    color: #ffffff;
    font-weight: 600;
}

.nav-toggle {
    margin-left: auto;
    display: none;
}

.bbs-nav {
    margin-left: auto;
    display: flex;
    gap: 0;
    border: 1px solid #585858;
    background: #323232;
}

.bbs-nav a {
    color: #efefef;
    text-transform: uppercase;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-decoration: none;
    padding: 5px 9px;
    border-right: 1px solid #585858;
}

.bbs-nav a:last-child {
    border-right: 0;
}

.bbs-nav a.active,
.bbs-nav a:hover {
    color: #111;
    background: #f2f2f2;
}

.bbs-context-row {
    border-top: 1px solid #2d2d2d;
    border-bottom: 1px solid var(--line);
    background: #f4f4f4;
}

.bbs-context-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 6px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.context-copy {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-family: "IBM Plex Mono", "Courier New", monospace;
}

.bbs-section-row {
    border-bottom: 1px solid var(--line-strong);
    background: var(--section-nav-bg);
}

.bbs-section-inner {
    max-width: 1240px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0 16px;
    overflow-x: auto;
}

.section-tab {
    color: #ececec;
    text-decoration: none;
    padding: 7px 10px;
    border-right: 1px solid #535353;
    white-space: nowrap;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}

.section-tab:hover,
.section-tab.active {
    color: #111;
    background: #f1f1f1;
}

.bbs-main {
    max-width: 1240px;
    margin: 16px auto 30px;
    padding: 0 24px;
}

.page-head {
    margin-bottom: 12px;
    border: 1px solid var(--line);
    background: #fcfcfc;
    padding: 9px 11px;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.page-head h1 {
    margin: 0;
    font-size: 1.14rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.page-head p {
    margin: 4px 0 0;
}

.breadcrumb {
    margin-bottom: 4px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: 10px 12px;
    margin-bottom: 10px;
}

.card h2 {
    margin: 0 0 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--line);
    font-size: 0.86rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.section-head h2 {
    margin: 0;
    border: 0;
    padding: 0;
}

.category-grid {
    display: grid;
    gap: 8px;
}

.category-card {
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: 10px 12px;
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr auto;
}

.category-main h2 {
    margin: 0;
    border: 0;
    padding: 0;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.97rem;
}

.category-main p {
    margin: 4px 0 0;
    font-size: 0.86rem;
}

.stats-row {
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-width: 350px;
    font-family: "IBM Plex Mono", "Courier New", monospace;
}

.stats-row div {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: #f9f9f9;
}

.stat-link {
    display: block;
    padding: 6px;
    text-decoration: none;
    color: inherit;
}

.stat-link:hover {
    text-decoration: none;
    background: #efefef;
}

.stats-row dt {
    font-size: 0.66rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stats-row dd {
    margin: 2px 0 0;
    font-size: 0.88rem;
    font-weight: 700;
}

.latest-row {
    border-top: 1px dotted var(--line-strong);
    padding-top: 6px;
    grid-column: 1 / -1;
    font-size: 0.8rem;
    font-family: "IBM Plex Mono", "Courier New", monospace;
}

.latest-row .latest-link {
    display: inline-block;
    color: inherit;
    text-decoration: none;
}

.latest-row .latest-link:hover {
    text-decoration: underline;
}

.message-table {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.unread-read-all-actions {
    padding: 2px 4px 10px;
}

.message-table-head,
.message-row {
    display: grid;
    grid-template-columns: 100px 120px 180px minmax(280px, 1fr) 210px;
    gap: 10px;
    align-items: start;
    padding: 8px 10px;
}

.message-table-head.unread-table-head,
.message-row.unread-message-row {
    grid-template-columns: 120px 180px 200px 170px 200px;
}

.message-table-head {
    background: #ececec;
    border-bottom: 1px solid var(--line-strong);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-family: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
    font-weight: 700;
}

.message-row {
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.message-row:last-child {
    border-bottom: 0;
}

.message-row:hover {
    background: var(--row-hover);
}

.message-row.is-read {
    color: #555;
}

.message-row.is-unread {
    border-left: 3px solid #1a1a1a;
    padding-left: 7px;
    background: var(--row-active);
}

.col-num,
.col-date,
.col-from,
.col-to,
.col-status {
    font-size: 0.82rem;
}

.col-num {
    text-align: right;
}

.col-num a {
    text-decoration: none;
}

.col-subject h3 {
    margin: 0 0 2px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: "IBM Plex Mono", "Courier New", monospace;
}

.col-subject p {
    margin: 0;
}

.col-status {
    display: grid;
    gap: 4px;
    justify-items: start;
    padding-right: 16px;
}

.unread-pill {
    border: 1px solid #1a1a1a;
    border-radius: var(--radius);
    background: #1a1a1a;
    color: #ffffff;
    padding: 2px 8px;
    text-transform: uppercase;
    font-size: 11px;
    line-height: 1;
    letter-spacing: 0.04em;
    font-family: "IBM Plex Mono", "Courier New", monospace;
}

.topic-list {
    display: grid;
    gap: 0;
}

.topic-row {
    border: 1px solid var(--line);
    border-top: 0;
    padding: 8px 9px;
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 10px;
    background: #fff;
}

.topic-row:first-child {
    border-top: 1px solid var(--line);
}

.topic-row.has-unread {
    border-left: 3px solid #1a1a1a;
    padding-left: 7px;
    background: var(--row-active);
}

.topic-row h3 {
    margin: 0 0 4px;
    font-size: 0.93rem;
}

.topic-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 4px;
}

.topic-row-meta {
    display: grid;
    align-content: start;
    justify-items: end;
    gap: 4px;
    text-align: right;
}

.metric {
    font-size: 0.82rem;
}

.text-link {
    font-size: 0.8rem;
}

.chip {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    padding: 1px 6px;
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: #f2f2f2;
    color: #444;
    font-family: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
}

.chip-announce {
    background: #ececec;
    border-color: #8f8f8f;
    color: #222;
}

.chip-inactive {
    background: #f1f1f1;
    border-color: #b8b8b8;
    color: #666;
}

.read-pill {
    border: 1px solid #d0d0d0;
    border-radius: var(--radius);
    background: #e8e8e8;
    color: #888;
    padding: 2px 8px;
    text-transform: uppercase;
    font-size: 11px;
    line-height: 1;
    letter-spacing: 0.04em;
    font-family: "IBM Plex Mono", "Courier New", monospace;
}

.read-pill-me {
    border-color: #a9bfdc;
    background: #d9e6f5;
    color: #224468;
}

.read-pill-to {
    border-color: #9cbf9f;
    background: #d9ecd9;
    color: #205029;
}

.read-pill-slot {
    display: inline-block;
    min-width: 52px;
    min-height: 16px;
}

.message-number-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.to-read-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding-right: 14px;
}

.to-read-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.to-read-line .read-pill {
    flex-shrink: 0;
    margin-right: 2px;
}

.to-read-toggle {
    appearance: none;
    border: 0;
    padding: 0;
    margin: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    text-align: left;
    font: inherit;
}

.to-read-toggle[disabled] {
    cursor: default;
    color: var(--muted);
}

.to-read-toggle-arrow {
    display: inline-block;
    font-size: 0.74rem;
    transition: transform 0.15s ease;
}

.to-read-toggle[aria-expanded="true"] .to-read-toggle-arrow {
    transform: rotate(90deg);
}

.to-read-panel {
    margin-top: 5px;
}

.to-read-panel[hidden] {
    display: none;
}

.category-recipient-list {
    margin-top: 4px;
}

.recipient-read-cell {
    display: block;
}

.recipient-all-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.recipient-name {
    font-weight: 600;
}

.recipient-pill {
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 2px 8px;
    margin-left: 10px;
    text-transform: uppercase;
    font-size: 11px;
    line-height: 1;
    letter-spacing: 0.04em;
    font-family: "IBM Plex Mono", "Courier New", monospace;
}

.recipient-pill.is-read {
    border-color: #1d7d4d;
    background: #2b9a62;
    color: #fff;
}

.recipient-pill.is-unread {
    border-color: #9d3f2e;
    background: #bd513c;
    color: #fff;
}

.recipient-pill.is-all {
    border-color: #1f4f8a;
    background: #2d6ab3;
    color: #fff;
}

.recipient-expand-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: inherit;
    padding: 0;
    margin: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font: inherit;
}

.recipient-expand-arrow {
    font-size: 0.8rem;
    transition: transform 0.15s ease;
}

.recipient-expand-btn[aria-expanded="true"] .recipient-expand-arrow {
    transform: rotate(90deg);
}

.recipient-all-list {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fbfbfb;
    padding: 5px 7px;
    display: block;
    list-style: none;
    margin: 0;
    max-height: 180px;
    overflow: auto;
}

.recipient-all-list[hidden] {
    display: none;
}

.recipient-all-row {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    font-size: 0.81rem;
    line-height: 1.35;
}

.recipient-all-row + .recipient-all-row {
    margin-top: 2px;
}

.recipient-all-mark {
    color: #7d7d7d;
}

.recipient-all-row.has-read .recipient-all-mark {
    color: #2b9a62;
    font-weight: 700;
}

.message-view-card {
    background: #fff;
    overflow-anchor: none;
}

.message-view-card .post-body {
    margin-top: 1.2em;
    margin-bottom: 1.2em;
}

.message-view-card .attachment-list {
    margin-bottom: 1.2em;
}

.message-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.message-title-main {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.message-meta-grid {
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 14px;
    font-size: 0.84rem;
}

.message-meta-grid div {
    display: flex;
    gap: 6px;
}

.message-meta-grid div[hidden] {
    display: none !important;
}

.message-meta-grid dt {
    color: var(--muted);
    min-width: 62px;
}

.message-meta-grid dd {
    margin: 0;
}

.message-meta-grid .read-slot {
    justify-self: end;
    grid-column: 1 / -1;
}

.root-message-meta {
    grid-template-columns: 1fr;
}

.root-message-meta .read-slot {
    justify-self: start;
}

.message-body-text {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: "IBM Plex Mono", "Courier New", monospace;
    font-size: 0.9rem;
    line-height: 1.2;
}

.message-footer-row {
    margin-top: 0;
    padding-top: 8px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.message-reply-summary .btn {
    font-size: 0.68rem;
    padding: 4px 8px;
}

.message-reply-summary {
    display: grid;
    gap: 5px;
    flex: 1 1 auto;
    min-width: 0;
}

.message-footer-right {
    display: grid;
    gap: 0;
    justify-items: end;
    align-content: start;
    flex: 0 0 auto;
}

.message-thread-nav,
.message-primary-actions {
    justify-content: flex-end;
}

.message-primary-actions {
    margin-top: 14px;
}

.read-all-status {
    margin-top: 2px;
}

.topic-unread-marked-inline {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 4px 8px;
    background: #f5f5f5;
    color: var(--muted);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.thread-map-shell {
    display: grid;
    gap: 4px;
}

.thread-map-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    padding: 6px 8px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: #f4f4f4;
    color: var(--muted);
    font-family: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
}

.thread-map-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid #b3b3b3;
    border-radius: var(--radius);
    background: #ffffff;
    padding: 3px 6px;
    color: #2a2a2a;
}

.thread-map-legend .thread-map-current-mark {
    margin-right: 0;
}

.thread-map-legend .thread-map-read-pill {
    margin-left: 0;
}

.thread-map-legend-equals {
    font-weight: 700;
    color: #4a4a4a;
}

.thread-map {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    padding: 6px 6px 6px 2px;
    max-height: 220px;
    overflow: auto;
}

.thread-map-list,
.thread-map-children {
    list-style: none;
    margin: 0;
    padding-left: 0;
}

.thread-map-children {
    margin-left: var(--thread-map-indent);
    padding-left: var(--thread-map-indent);
    border-left: 1px solid var(--line);
}

.thread-map-item {
    position: relative;
    margin: 3px 0;
}

.thread-map-children > .thread-map-item::before {
    content: "";
    position: absolute;
    left: calc(var(--thread-map-indent) * -1);
    top: 12px;
    width: var(--thread-map-indent);
    border-top: 1px solid var(--line);
}

.thread-map-link {
    appearance: none;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fdfdfd;
    color: inherit;
    cursor: pointer;
    padding: 5px;
    display: grid;
    grid-template-columns: minmax(90px, max-content) minmax(0, 1fr) minmax(0, 1fr) max-content;
    gap: 8px;
    align-items: center;
    text-align: left;
    font: inherit;
    font-family: "IBM Plex Mono", "Courier New", monospace;
    font-size: 0.76rem;
    line-height: 1.35;
}

.thread-map-link:hover {
    background: var(--row-hover);
}

.thread-map-item.is-current .thread-map-link {
    border-color: var(--line-strong);
    background: #ececec;
}

.thread-map-item.is-unread .thread-map-link {
    border-left: 3px solid #1a1a1a;
    padding-left: 4px;
}

.thread-map-num {
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    white-space: normal;
}

.thread-map-current-mark {
    display: inline-block;
    margin-right: 6px;
    font-weight: 700;
}

.thread-map-from,
.thread-map-to,
.thread-map-date {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    min-width: 0;
    overflow-wrap: anywhere;
}

.thread-map-to {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-right: 6px;
}

.thread-map-to-name {
    min-width: 0;
    overflow-wrap: anywhere;
}

.thread-map-date {
    justify-self: end;
    text-align: right;
}

.thread-map-read-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    padding: 0;
    border: 0;
    background: transparent;
    font-size: 0.86rem;
    line-height: 1;
    letter-spacing: 0;
    white-space: nowrap;
}

.post-thread {
    display: grid;
    gap: 0;
    position: relative;
}

.post-card {
    position: relative;
    border-bottom: 1px solid var(--line);
    padding: 8px 0;
}

.post-thread > .post-card:first-child {
    border-top: 1px solid var(--line);
}

.post-card.starter {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    padding: 8px;
}

.post-card.is-unread {
    border-left: 3px solid #1a1a1a;
    padding-left: 5px;
    background: var(--row-active);
}

.post-card.is-read {
    background: #fff;
}

.post-head,
.post-body,
.post-actions,
.branch-summary,
.attachment-list {
    margin: 0;
}

.post-thread .post-card > .post-head,
.post-thread .post-card > .post-body,
.post-thread .post-card > .post-actions,
.post-thread .post-card > .branch-summary,
.post-thread .post-card > .attachment-list {
    margin-left: calc(min(var(--thread-depth, 1), 3) * var(--thread-step) + 8px);
}

.post-head {
    display: grid;
    gap: 4px;
    margin-bottom: 6px;
    font-size: 0.86rem;
}

.post-head-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.post-head-title strong {
    font-size: 0.9rem;
}

.post-meta-grid {
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
    font-size: 0.82rem;
}

.post-meta-grid div {
    display: flex;
    gap: 6px;
}

.post-meta-grid dt {
    color: var(--muted);
    min-width: 62px;
}

.post-meta-grid dd {
    margin: 0;
}

.post-body {
    font-size: 0.88rem;
    line-height: 1.2;
}

.post-actions {
    display: flex;
    gap: 6px;
    margin-top: 7px;
    flex-wrap: wrap;
}

.post-actions .btn {
    font-size: 0.72rem;
    padding: 4px 8px;
}

.branch-summary {
    margin-top: 7px;
    padding: 6px 8px;
    border-left: 3px solid var(--line);
    background: #fafafa;
    font-size: 0.8rem;
    display: grid;
    gap: 3px;
}

.child-posts {
    margin-top: 6px;
}

.child-posts[hidden] {
    display: none;
}

.reply-index-shell {
    margin-top: 8px;
}

.reply-index-panel {
    margin-top: 6px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #ffffff;
    padding: 6px 8px;
}

.reply-index-panel[hidden] {
    display: none;
}

.reply-index-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 4px;
}

.reply-index-list li {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    padding: 3px 0;
    border-bottom: 1px dotted var(--line);
}

.reply-index-list li:last-child {
    border-bottom: 0;
}

.reply-index-link {
    font-family: "IBM Plex Mono", "Courier New", monospace;
    font-weight: 600;
}

.reply-preview-table {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: #fff;
    overflow-anchor: none;
}

.reply-preview-head,
.reply-preview-row {
    display: grid;
    grid-template-columns: 110px 180px 180px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 7px 10px;
}

.reply-preview-head {
    background: #ececec;
    border-bottom: 1px solid var(--line-strong);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-family: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
    font-weight: 700;
}

.reply-preview-body {
    display: grid;
}

.reply-preview-row {
    appearance: none;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: #fff;
    color: inherit;
    text-align: left;
    cursor: pointer;
    width: 100%;
}

.reply-preview-row:last-child {
    border-bottom: 0;
}

.reply-preview-row:hover {
    background: var(--row-hover);
}

.reply-col-num {
    font-family: "IBM Plex Mono", "Courier New", monospace;
    font-weight: 600;
}

.reply-col-preview {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.reply-preview-empty {
    padding: 8px 10px;
}

.reply-map-toggle {
    appearance: none;
    border: 0;
    padding: 0;
    margin: 0;
    background: transparent;
    color: #1a1a1a;
    cursor: pointer;
    font: inherit;
    font-size: 0.8rem;
    text-decoration: underline;
}

.reply-map-toggle[disabled] {
    text-decoration: none;
    cursor: default;
    color: var(--muted);
}

.reply-map-toggle .reply-map-arrow {
    display: inline-block;
    margin-left: 6px;
    font-size: 0.74rem;
    transition: transform 0.15s ease;
}

.reply-map-toggle[aria-expanded="true"] .reply-map-arrow {
    transform: rotate(90deg);
}

.reply-map-inline-wrap {
    margin-top: 5px;
}

.message-row-map {
    grid-column: 1 / -1;
}

.message-row-map .reply-map-inline-wrap {
    margin-top: 0;
}

.message-row-map .thread-map {
    margin-top: 6px;
}

.post-thread .post-card[data-depth]:not([data-depth="0"])::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: calc(min(var(--thread-depth, 1), 3) * var(--thread-step));
    border-left: 2px solid var(--line);
    pointer-events: none;
}

.attachment-list {
    margin-top: 8px;
    display: grid;
    gap: 5px;
}

.attachment-list-label {
    font-size: 0.78rem;
    color: var(--muted);
    font-family: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
}

.attachment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    padding: 5px 7px;
    font-size: 0.79rem;
}

.attachment-file-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1 1 auto;
}

.attachment-download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: #f8f8f8;
    color: inherit;
    text-decoration: none;
    font-size: 0.84rem;
    line-height: 1;
    flex: 0 0 auto;
}

.attachment-download-btn:hover {
    background: #ededed;
}

.attachment-file-link {
    color: inherit;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.attachment-file-link:hover {
    text-decoration: underline;
}

.attachment-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.attachment-downloaded-pill {
    display: inline-flex;
    align-items: center;
    border: 1px solid #9cbf9f;
    border-radius: var(--radius);
    background: #d9ecd9;
    color: #205029;
    padding: 1px 6px;
    font-size: 0.66rem;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-family: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
}

.search-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.search-grid .inline-options {
    grid-column: 1 / -1;
}

.snippet {
    margin-top: 4px;
    font-size: 0.83rem;
    line-height: 1.45;
}

.stack-form {
    display: grid;
    gap: 10px;
}

.stack-form label {
    display: grid;
    gap: 5px;
    font-size: 0.88rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="search"],
textarea,
select {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: #fff;
    padding: 8px 9px;
    color: var(--text);
    font: inherit;
}

textarea {
    resize: vertical;
    min-height: 6.4em;
    font-family: "IBM Plex Mono", "Courier New", monospace;
}

input:focus,
textarea:focus,
select:focus,
button:focus {
    outline: 2px solid #111;
    outline-offset: 1px;
}

.inline-options {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.btn {
    appearance: none;
    border: 1px solid #999;
    border-radius: var(--radius);
    padding: 6px 9px;
    font-family: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.2;
    cursor: pointer;
    background: #fff;
    color: #1a1a1a;
}

.btn:hover {
    background: #333;
    color: #fff;
    border-color: #333;
    text-decoration: none;
}

.btn-primary {
    background: #1a1a1a;
    color: #fff;
    border-color: #1a1a1a;
}

.btn-primary:hover {
    background: #333;
    border-color: #333;
}

.compose-toggle {
    min-width: 110px;
}

.compose-panel {
    border-top: 1px solid var(--line);
    padding-top: 10px;
}

.compose-panel[hidden] {
    display: none;
}

.reply-widget {
    position: fixed;
    left: calc(100vw - 536px);
    top: calc(100vh - 436px);
    width: min(520px, calc(100vw - 32px));
    height: min(420px, calc(100vh - 32px));
    min-width: 360px;
    min-height: 300px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    resize: both;
    z-index: 120;
    background: #fff;
}

.reply-widget[hidden] {
    display: none;
}

.reply-widget-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 11px;
    border-bottom: 1px solid var(--line);
    background: #f6f6f6;
    cursor: grab;
    user-select: none;
}

.reply-widget.is-dragging .reply-widget-head {
    cursor: grabbing;
}

.reply-widget-title {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.reply-widget-title h2 {
    margin: 0;
    padding: 0;
    border-bottom: 0;
    font-size: 0.82rem;
}

.reply-widget-title .tiny {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reply-widget-actions {
    margin-left: auto;
    justify-content: flex-end;
    gap: 6px;
}

.reply-widget-actions .btn {
    font-size: 0.66rem;
    padding: 4px 7px;
}

.reply-widget-body {
    padding: 10px 12px;
    overflow: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.reply-widget-body[hidden] {
    display: none;
}

.reply-widget .stack-form {
    height: 100%;
}

.reply-widget .stack-form textarea {
    min-height: 8.5em;
}

.reply-widget.is-collapsed {
    height: auto;
    min-height: 0;
    resize: none;
}

.reply-widget.is-collapsed .reply-widget-head {
    border-bottom: 0;
}

.reply-widget.is-collapsed .reply-widget-body {
    display: none;
}

.floating-reply-cta {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 16px;
    z-index: 118;
    border: 1px solid #3b5f86;
    border-radius: 10px;
    background: #d9e6f5;
    color: #1f4265;
    box-shadow: 0 7px 18px rgba(0, 0, 0, 0.22);
    font-family: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
    font-size: 0.87rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 10px 14px;
    cursor: pointer;
    user-select: none;
}

.floating-reply-cta:hover {
    background: #c5d9ee;
    border-color: #2e4c6d;
}

.floating-reply-cta.is-dragging {
    cursor: grabbing;
}

.floating-reply-cta[hidden] {
    display: none;
}

body.modal-open {
    overflow: hidden;
}

.lightbox-modal {
    position: fixed;
    inset: 0;
    z-index: 140;
    display: grid;
    place-items: center;
    padding: 12px;
}

.lightbox-modal[hidden] {
    display: none;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.lightbox-dialog {
    position: relative;
    z-index: 1;
    width: min(560px, 96vw);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.28);
    padding: 12px;
}

.lightbox-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.lightbox-head h3 {
    margin: 0;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mark-all-dialog {
    width: min(760px, 96vw);
}

.mark-all-results {
    margin-top: 8px;
    max-height: min(62vh, 540px);
    overflow: auto;
}

.mark-all-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.mark-all-item {
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 3px;
}

.mark-all-item:last-child {
    border-bottom: 0;
}

.post-confirm-grid {
    margin: 10px 0 0;
    padding: 0;
    display: grid;
    gap: 4px 12px;
    grid-template-columns: 1fr;
    font-family: "IBM Plex Mono", "Courier New", monospace;
    font-size: 0.82rem;
}

.post-confirm-grid div {
    display: flex;
    gap: 6px;
}

.post-confirm-grid dt {
    color: var(--muted);
    min-width: 86px;
}

.post-confirm-grid dd {
    margin: 0;
}

.alert {
    border-radius: var(--radius);
    padding: 8px 10px;
    border: 1px solid transparent;
    margin-bottom: 10px;
}

.alert-error {
    background: #f8efef;
    border-color: #cfa7a7;
    color: #7a2222;
}

.alert-success {
    background: #eef8ef;
    border-color: #9fc8a0;
    color: #215b28;
}

.admin-section-form {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 9px;
    margin-bottom: 9px;
    background: #fcfcfc;
}

.admin-section-form:last-child {
    margin-bottom: 0;
}

.admin-section-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.admin-user-list {
    display: grid;
    gap: 8px;
}

.admin-user-row {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    padding: 8px 9px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, #f4f4f4 0%, #ffffff 100%);
}

.login-shell {
    width: min(96vw, 460px);
}

.login-card {
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: 18px;
}

.login-card h1 {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.new-messages-hero {
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    padding: 14px 14px 12px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #f7f8fa 0%, #ffffff 48%, #eef3fb 100%);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.new-messages-eyebrow {
    margin: 0 0 4px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-size: 0.68rem;
    color: #4a5869;
    font-weight: 700;
    font-family: "IBM Plex Mono", "Courier New", monospace;
}

.new-messages-hero h1 {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.25;
}

.new-messages-subtitle {
    margin: 6px 0 0;
    color: #415061;
    max-width: 70ch;
    font-size: 0.84rem;
}

.new-messages-banner {
    margin-top: 12px;
    border-radius: var(--radius);
    padding: 10px 11px;
    border: 1px solid;
    font-size: 0.84rem;
    line-height: 1.4;
}

.new-messages-banner.is-alert {
    border-color: #124b8a;
    background: #e8f2ff;
    color: #13345d;
}

.new-messages-banner.is-clear {
    border-color: #2f6f48;
    background: #eaf9ef;
    color: #244935;
}

.new-messages-actions {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.new-messages-dismiss-form {
    margin: 0;
}

.new-message-section {
    padding: 11px 12px;
}

.new-message-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.new-message-section-head h2 {
    margin: 0;
    border: 0;
    padding: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.new-message-count {
    min-width: 34px;
    padding: 2px 9px;
    border: 1px solid #6a7f97;
    border-radius: var(--radius);
    background: #e7edf6;
    color: #21384f;
    text-align: center;
    font-weight: 700;
    font-family: "IBM Plex Mono", "Courier New", monospace;
}

.new-message-list {
    display: grid;
    gap: 8px;
}

.new-message-item {
    display: block;
    border: 1px solid var(--line);
    border-left: 4px solid #1f4f8a;
    border-radius: var(--radius);
    background: #ffffff;
    text-decoration: none;
    color: inherit;
    padding: 9px 10px;
    transition: background-color 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.new-message-item:hover {
    text-decoration: none;
    background: #f5f9ff;
    border-color: #8faad0;
    box-shadow: 0 1px 3px rgba(18, 72, 132, 0.18);
}

.new-message-item:focus-visible {
    outline: 2px solid #174e8b;
    outline-offset: 2px;
}

.new-message-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-family: "IBM Plex Mono", "Courier New", monospace;
}

.new-message-topic {
    margin: 6px 0 0;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.35;
}

.new-message-meta {
    margin: 4px 0 0;
}

.new-message-preview {
    margin: 6px 0 0;
    font-family: "IBM Plex Mono", "Courier New", monospace;
    font-size: 0.8rem;
    color: #2f3e4f;
    line-height: 1.4;
}

.bbs-global-tooltip {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1400;
    max-width: min(320px, calc(100vw - 16px));
    padding: 6px 9px;
    border: 1px solid #16283a;
    border-radius: var(--radius);
    background: #1d3249;
    color: #f7fbff;
    font-size: 0.74rem;
    line-height: 1.35;
    letter-spacing: 0.01em;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.22);
    pointer-events: none;
    opacity: 0;
    transform: translateY(2px);
    transition: opacity 0.12s ease, transform 0.12s ease;
}

.bbs-global-tooltip.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .bbs-global-tooltip {
        transition: none;
    }
}

@media (max-width: 1024px) {
    .message-table-head,
    .message-row {
        grid-template-columns: 90px 110px 160px minmax(220px, 1fr) 180px;
    }

    .message-table-head.unread-table-head,
    .message-row.unread-message-row {
        grid-template-columns: 100px 150px 170px 150px 170px;
    }

    .reply-widget {
        position: static;
        left: auto;
        top: auto;
        width: 100%;
        height: auto;
        min-width: 0;
        min-height: 0;
        max-width: none;
        max-height: none;
        resize: none;
        margin-top: 10px;
        z-index: auto;
    }

    .reply-widget-head {
        cursor: default;
    }

    .reply-widget-title .tiny {
        white-space: normal;
    }

    .floating-reply-cta {
        left: 50%;
        transform: translateX(-50%);
        bottom: 10px;
        padding: 9px 13px;
        font-size: 0.82rem;
    }
}

@media (max-width: 920px) {
    .category-card {
        grid-template-columns: 1fr;
    }

    .stats-row {
        min-width: 0;
    }

    .search-grid {
        grid-template-columns: 1fr;
    }

    .admin-section-grid {
        grid-template-columns: 1fr;
    }

    .admin-user-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .message-table-head {
        display: none;
    }

    .message-row {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .new-message-item-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .col-num {
        text-align: left;
    }

    .topic-row {
        grid-template-columns: 1fr;
    }

    .topic-row-meta {
        justify-items: start;
        text-align: left;
    }

    .message-footer-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .message-footer-right {
        width: 100%;
        justify-items: start;
        gap: 8px;
    }

    .message-thread-nav,
    .message-primary-actions {
        justify-content: flex-start;
    }

    .message-primary-actions {
        margin-top: 0;
    }

    .reply-preview-head {
        display: none;
    }

    .reply-preview-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .reply-col-preview {
        white-space: nowrap;
    }

    .thread-map-link {
        grid-template-columns: 1fr;
        gap: 2px;
    }
}

@media (max-width: 768px) {
    :root {
        --thread-step: 14px;
        --thread-map-indent: 6px;
    }

    .bbs-header-inner {
        flex-wrap: wrap;
    }

    .nav-toggle {
        display: inline-flex;
        margin-left: auto;
        border: 1px solid #999;
        border-radius: var(--radius);
        padding: 6px 9px;
        background: #fff;
        color: #111;
        font-size: 0.75rem;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }

    .bbs-nav {
        width: 100%;
        display: none;
        flex-direction: column;
        border: 1px solid #555;
    }

    .bbs-nav a {
        border-right: 0;
        border-top: 1px solid #555;
    }

    .bbs-nav a:first-child {
        border-top: 0;
    }

    .bbs-nav.open {
        display: flex;
    }

    .bbs-main {
        padding: 0 10px;
        margin-top: 10px;
    }

    .new-messages-hero {
        padding: 11px 10px 10px;
    }

    .new-messages-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .new-messages-actions .btn {
        text-align: center;
    }

    .new-messages-dismiss-form {
        width: 100%;
    }

    .new-messages-dismiss-form .btn {
        width: 100%;
    }

    .bbs-context-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .context-copy {
        flex-wrap: wrap;
        gap: 8px;
    }

    .message-meta-grid {
        grid-template-columns: 1fr;
    }

    .post-confirm-grid {
        grid-template-columns: 1fr;
    }

    .post-thread .post-card > .post-head,
    .post-thread .post-card > .post-body,
    .post-thread .post-card > .post-actions,
    .post-thread .post-card > .branch-summary,
    .post-thread .post-card > .attachment-list {
        margin-left: calc(min(var(--thread-depth, 1), 3) * var(--thread-step) + 7px);
    }
}
