:root {
    color-scheme: dark;
    --bg: #08090b;
    --surface: #111216;
    --surface-2: #15171c;
    --surface-hover: #1a1c22;
    --field: #0d0e12;
    --line: #282b32;
    --line-strong: #3a3e48;
    --text: #f2f3f5;
    --muted: #a7adb7;
    --muted-2: #77808d;
    --red: #d93643;
    --red-hover: #ee4a56;
    --red-soft: rgba(217, 54, 67, 0.12);
    --red-line: rgba(217, 54, 67, 0.42);
    --danger: #ff6470;
    --ok: #49c98f;
    --warn: #e7bd64;
    --radius-lg: 16px;
    --radius: 12px;
    --radius-sm: 9px;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
a:hover { color: #fff; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
img, video, audio, iframe { max-width: 100%; }
::selection { background: rgba(217, 54, 67, 0.44); color: #fff; }

.site-shell {
    width: min(1120px, calc(100% - 32px));
    min-height: 100vh;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    padding: 14px 0;
    background: rgba(8, 9, 11, 0.98);
    border-bottom: 1px solid var(--line);
}

.brand {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.brand-mark {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    display: block;
    border-radius: 10px;
    background: var(--field);
    border: 1px solid var(--line);
}
.brand-copy { min-width: 0; }
.brand-copy strong {
    display: block;
    font-size: 0.98rem;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.main-nav {
    justify-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 0;
}
.main-nav a,
.text-action {
    color: var(--muted);
    padding: 8px 10px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 750;
    white-space: nowrap;
    transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}
.main-nav a.active,
.main-nav a:hover,
.text-action:hover {
    color: #fff;
    background: var(--surface-hover);
}
.text-action.primary { color: #ff7380; }
.text-action.primary:hover { color: #fff; background: var(--red-soft); }
.text-action.danger, .link-button.danger { color: #ff9aa3; }
.link-actions { gap: 4px; }

.account-box {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
}
.user-chip {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 7px 10px;
    background: var(--surface);
}
.mobile-nav-toggle { display: none; }

.content-wrap {
    flex: 1;
    padding: 22px 0 36px;
}
.footer {
    padding: 18px 0 28px;
    color: var(--muted-2);
    font-size: 0.84rem;
    border-top: 1px solid var(--line);
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}
.interactive-card {
    cursor: pointer;
    transition: background-color 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
.interactive-card:hover,
.interactive-card:focus-visible {
    background: var(--surface-hover);
    border-color: var(--line-strong);
    box-shadow: 0 0 0 1px rgba(255,255,255,0.02);
    outline: none;
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 18px 0;
    margin-bottom: 14px;
}
.panel.page-head { padding: 20px; }
.home-head, .compact-head { padding-top: 10px; padding-bottom: 14px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 5px 0 0; }

h1, h2, h3 {
    margin-top: 0;
    color: #fff;
    letter-spacing: -0.035em;
}
h1 { font-size: clamp(1.45rem, 3vw, 2.1rem); }
h2 { font-size: 1.12rem; }
p { line-height: 1.68; }
.muted { color: var(--muted); }
.small-text { font-size: 0.88rem; }
.center { text-align: center; }
.eyebrow {
    margin: 0 0 8px;
    color: var(--red);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.layout-2col {
    display: grid;
    grid-template-columns: 272px minmax(0, 1fr);
    align-items: start;
    gap: 18px;
}
.layout-2col.compact { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); }
.layout-2col > .panel { padding: 20px; }
.sidebar {
    position: sticky;
    top: 84px;
    padding: 18px;
}
.sidebar h2, .panel h2 { margin-bottom: 12px; }
.post-feed { display: grid; gap: 10px; min-width: 0; }

.post-card {
    display: block;
    padding: 20px;
    min-width: 0;
    color: inherit;
}
.post-card h2 {
    margin: 9px 0 9px;
    font-size: 1.23rem;
    overflow-wrap: anywhere;
}
.post-card p {
    margin: 0;
    color: var(--muted);
    overflow-wrap: anywhere;
}
.post-card-footer, .post-meta, .action-row, .section-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
}
.post-card-footer {
    justify-content: space-between;
    margin-top: 13px;
    color: var(--muted-2);
    font-size: 0.9rem;
    font-weight: 700;
}
.category-heading a,
.markdown-body a,
.muted a,
.notice-panel a { color: #ff7b85; }
.post-meta {
    color: var(--muted-2);
    font-size: 0.86rem;
}
.post-meta span {
    display: inline-flex;
    align-items: center;
    min-width: 0;
}
.post-meta span:first-child {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #f2f3f5;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    padding: 3px 8px;
    background: var(--field);
}
.post-meta span:first-child::before {
    content: "";
    width: 6px;
    height: 6px;
    margin-right: 6px;
    border-radius: 999px;
    background: var(--red);
}
.post-meta span:not(:first-child)::before {
    content: "·";
    margin-right: 9px;
    color: var(--muted-2);
}

.search-form, .stack-form, .comment-form, .upload-form {
    display: grid;
    gap: 12px;
}
.label-text {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-weight: 700;
    font-size: 0.9rem;
}
input, textarea, select {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    padding: 12px 13px;
    color: var(--text);
    background: var(--field);
    outline: none;
}
textarea {
    resize: vertical;
    line-height: 1.6;
}
input::placeholder, textarea::placeholder { color: #6f7682; }
input:focus, textarea:focus, select:focus {
    border-color: var(--red-line);
    box-shadow: 0 0 0 3px rgba(217, 54, 67, 0.12);
}
select option { background: var(--surface); color: var(--text); }

.btn, button.btn, a.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    padding: 9px 13px;
    min-height: 38px;
    color: #fff;
    background: var(--surface-2);
    font-weight: 800;
    font-size: 0.9rem;
    line-height: 1;
    white-space: nowrap;
    transition: background-color 0.14s ease, border-color 0.14s ease;
}
.btn:not(.ghost):not(.danger) { border-color: var(--red-line); }
.btn:hover { color: #fff; background: var(--surface-hover); border-color: var(--line-strong); }
.btn:not(.ghost):not(.danger):hover { border-color: var(--red); }
.btn.ghost { color: var(--text); background: transparent; border-color: var(--line-strong); }
.btn.danger { background: transparent; border-color: rgba(255, 100, 112, 0.42); color: #ff9aa3; }
.btn.danger:hover { background: rgba(255, 100, 112, 0.11); }
.btn.small { min-height: 31px; padding: 7px 10px; font-size: 0.8rem; }
.btn.large { min-height: 44px; padding: 12px 18px; }
.btn.full { width: 100%; }
.link-button {
    border: 0;
    padding: 0;
    color: #ff7b85;
    background: transparent;
    font-weight: 800;
}
.inline-form { display: inline; margin: 0; }

.category-list { display: grid; gap: 8px; margin-top: 16px; }
.category-list.wide { margin-top: 0; }
.category-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.category-heading h2 { margin: 0; }
.category-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--muted);
    background: var(--field);
    transition: background-color 0.14s ease, border-color 0.14s ease;
}
.category-pill:hover, .category-pill.selected {
    color: #fff;
    border-color: var(--line-strong);
    background: var(--surface-2);
}
.category-pill.selected { box-shadow: inset 3px 0 0 var(--red); }
.category-pill span {
    flex: 0 0 auto;
    color: var(--muted-2);
    font-size: 0.84rem;
}

.auth-card {
    width: min(430px, 100%);
    margin: 0 auto;
    padding: 26px;
}
.auth-card.wide-card { width: min(760px, 100%); }
.centered-page .content-wrap {
    display: grid;
    place-items: start center;
    padding-top: 9vh;
}
.form-errors {
    width: min(760px, 100%);
    margin: 0 auto 14px;
    padding: 12px 14px;
    border: 1px solid rgba(255,100,112,0.42);
    border-radius: var(--radius);
    color: #ffb0b8;
    background: rgba(255,100,112,0.1);
}
.form-errors p { margin: 0; }
.flash-stack {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}
.flash {
    padding: 10px 13px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    background: var(--surface-2);
}
.flash.success { border-color: rgba(73,201,143,0.42); color: #adf7d3; }
.flash.error { border-color: rgba(255,100,112,0.5); color: #ffb0b8; }
.flash.warning { border-color: rgba(231,189,100,0.45); color: #ffe0a1; }

.post-view {
    padding: 28px;
    min-width: 0;
}
.post-view h1 {
    margin: 12px 0 12px;
    overflow-wrap: anywhere;
}
.markdown-body {
    color: var(--text);
    overflow-wrap: anywhere;
}
.markdown-body p,
.markdown-body li { line-height: 1.76; }
.markdown-body h1,
.markdown-body h2,
.markdown-body h3 { margin: 1.4em 0 0.65em; }
.markdown-body img {
    display: block;
    max-height: 720px;
    margin: 16px auto;
    border-radius: var(--radius);
    border: 1px solid var(--line);
}
.markdown-body a { text-decoration: underline; text-underline-offset: 3px; }
.markdown-body blockquote {
    margin: 16px 0;
    padding: 12px 14px;
    border-left: 3px solid var(--red);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: #ffd0d5;
    background: var(--red-soft);
}
.markdown-body code {
    padding: 2px 5px;
    border-radius: 6px;
    background: #050608;
    border: 1px solid var(--line);
}
.code-block {
    overflow: auto;
    padding: 14px;
    border-radius: var(--radius);
    background: #050608;
    border: 1px solid var(--line);
}
.code-block code { padding: 0; border: 0; }
.comments {
    margin-top: 16px;
    padding: 22px;
}
.comment-form {
    grid-template-columns: 1fr auto;
    align-items: end;
    margin-bottom: 18px;
}
.comment-form textarea { grid-column: 1 / -1; }
.comment-list { display: grid; gap: 10px; }
.comment-item {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
    background: var(--field);
}
.comment-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted);
    font-size: 0.88rem;
}
.comment-item p {
    margin: 8px 0;
    overflow-wrap: anywhere;
}
.action-row.subtle { font-size: 0.88rem; color: var(--muted); }

.editor-form { padding: 22px; }
.form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(170px, 0.65fr) minmax(0, 1fr);
    gap: 12px;
    margin-bottom: 14px;
}
.editor {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--field);
}
.editor-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 9px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
}
.editor-toolbar button,
.toolbar-upload {
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    padding: 7px 9px;
    color: var(--text);
    background: #0f1014;
    font-size: 0.86rem;
    font-weight: 750;
}
.editor-toolbar button:hover,
.toolbar-upload:hover { border-color: var(--line-strong); background: var(--surface-hover); }
.toolbar-upload input { display: none; }
.editor textarea {
    min-height: 460px;
    border: 0;
    border-radius: 0;
    background: var(--field);
}
.editor-preview {
    min-height: 460px;
    padding: 20px;
    border-top: 1px solid var(--line);
    background: var(--field);
}

.upload-panel, .file-panel, .notice-panel, .chat-panel {
    padding: 22px;
    margin-bottom: 18px;
}
.upload-form {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}
.dropzone {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    min-height: 62px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    padding: 14px;
    color: var(--muted);
    background: var(--field);
}
.dropzone:hover { background: var(--surface-2); }
.dropzone span { flex: 0 0 auto; color: var(--text); font-weight: 800; }
.dropzone input {
    min-width: 0;
    border: 0;
    padding: 0;
    background: transparent;
}
.section-head { justify-content: space-between; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.file-list { display: grid; gap: 9px; }
.file-row {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--field);
}
.file-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    border: 1px solid var(--line-strong);
    color: #f0f1f3;
    background: var(--surface-2);
    font-size: 0.72rem;
    font-weight: 900;
    overflow: hidden;
}
.file-main { min-width: 0; }
.file-main strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-main span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.86rem;
    overflow-wrap: anywhere;
}
.file-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}
.doc-preview {
    overflow: hidden;
    min-height: 64vh;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
}
.doc-preview iframe {
    width: 100%;
    height: 74vh;
    border: 0;
    background: #fff;
}
.image-preview {
    display: grid;
    place-items: center;
    padding: 16px;
}
.image-preview img {
    max-width: 100%;
    max-height: 74vh;
    border-radius: var(--radius);
}
.text-preview {
    padding: 18px;
    overflow: auto;
}
.text-preview pre {
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    line-height: 1.65;
}
.media-preview {
    display: grid;
    place-items: center;
    padding: 18px;
}
.media-preview video,
.media-preview audio { width: min(920px, 100%); }
.unsupported {
    display: grid;
    place-items: center;
    padding: 36px;
    min-height: 240px;
    text-align: center;
}
.preview-help { margin: 12px 2px 0; }
.empty-state, .error-panel { padding: 26px; }

.chat-panel { display: grid; gap: 12px; }
.chat-log {
    height: min(64vh, 680px);
    min-height: 380px;
    overflow: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--field);
}
.chat-message {
    width: fit-content;
    max-width: min(760px, 88%);
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-2);
    overflow-wrap: anywhere;
}
.chat-message:hover { border-color: var(--line-strong); }
.chat-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    color: var(--muted);
    font-size: 0.82rem;
    margin-bottom: 6px;
}
.chat-meta strong { color: #fff; }
.chat-message p {
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    line-height: 1.56;
}
.chat-attachments {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}
.chat-file-card {
    min-width: min(480px, 100%);
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--field);
}
.chat-file-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 10px;
}
.chat-file-info {
    min-width: 0;
    display: grid;
    gap: 2px;
}
.chat-file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 800;
}
.chat-file-meta {
    color: var(--muted-2);
    font-size: 0.78rem;
}
.chat-file-actions {
    flex: 0 0 auto;
    display: flex;
    gap: 7px;
}
.chat-file-actions a {
    color: #ff858e;
    font-size: 0.82rem;
    font-weight: 800;
}
.chat-file-actions a:hover { color: #fff; }
.chat-file-preview {
    border-top: 1px solid var(--line);
    background: #090a0d;
}
.chat-thumb-link {
    display: block;
    padding: 8px;
}
.chat-thumb {
    display: block;
    max-width: 100%;
    max-height: 260px;
    border-radius: 9px;
    object-fit: contain;
    background: #050608;
}
.chat-pdf-preview iframe,
.chat-text-preview iframe {
    display: block;
    width: 100%;
    height: 260px;
    border: 0;
    background: #fff;
}
.chat-doc-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px;
    color: var(--muted);
    font-size: 0.88rem;
}
.chat-doc-preview a { color: #ff858e; font-weight: 800; }
.chat-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 10px;
}
.chat-form textarea {
    min-height: 44px;
    max-height: 160px;
    resize: none;
}
.chat-tools {
    display: flex;
    align-items: end;
    gap: 8px;
}
.file-mini {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    max-width: 210px;
    padding: 9px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--text);
    background: transparent;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}
.file-mini:hover { background: var(--surface-2); }
.file-mini span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-mini input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

@media (max-width: 920px) {
    .site-shell { width: min(100% - 24px, 1120px); }
    .topbar {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 10px;
    }
    .mobile-nav-toggle {
        display: inline-flex;
        justify-self: end;
        border: 1px solid var(--line);
        background: var(--surface);
        color: var(--text);
        border-radius: 999px;
        padding: 8px 12px;
        font-weight: 800;
    }
    .main-nav,
    .account-box {
        display: none;
        grid-column: 1 / -1;
        justify-self: stretch;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    .main-nav.open,
    .account-box.open { display: flex; }
    .layout-2col,
    .layout-2col.compact { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .form-grid,
    .upload-form,
    .comment-form,
    .chat-form { grid-template-columns: 1fr; }
    .page-head { align-items: flex-start; flex-direction: column; }
    .chat-tools { justify-content: space-between; }
    .chat-message { max-width: 96%; }
}

@media (max-width: 560px) {
    .site-shell { width: min(100% - 18px, 1120px); }
    .content-wrap { padding-top: 14px; }
    .brand-mark { width: 32px; height: 32px; border-radius: 9px; }
    .page-head,
    .sidebar,
    .post-card,
    .post-view,
    .comments,
    .auth-card,
    .editor-form,
    .upload-panel,
    .file-panel,
    .notice-panel,
    .chat-panel,
    .layout-2col > .panel { padding: 16px; }
    .file-row { grid-template-columns: 46px minmax(0, 1fr); }
    .file-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }
    .chat-log { min-height: 340px; }
    .chat-file-card { min-width: 0; width: 100%; }
    .chat-file-top { align-items: flex-start; flex-direction: column; }
    .chat-file-actions { flex-wrap: wrap; }
    .chat-tools { align-items: stretch; }
    .file-mini { max-width: none; flex: 1 1 auto; }
    .btn { flex: 0 0 auto; }
}

.compact-head {
    padding-left: 2px;
    padding-right: 2px;
    border: 0;
    box-shadow: none;
    background: transparent;
}
.link-actions { gap: 12px; }
.text-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    color: var(--muted);
    font-weight: 800;
    font-size: 0.9rem;
    line-height: 1;
    border-bottom: 1px solid transparent;
}
.text-action:hover {
    color: #fff;
    border-bottom-color: var(--line-strong);
}
.text-action.primary {
    color: #fff;
}
.text-action.primary::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--red);
}
.link-button.danger {
    color: #ff9ba4;
}
.link-button.danger:hover {
    color: #fff;
}


/* compact-v5-20260622: deliberately flat, compact, and cache-busted */
:root {
    --bg: #0a0a0b;
    --surface: #101012;
    --surface-2: #141416;
    --surface-hover: #19191c;
    --field: #0f0f11;
    --line: #242428;
    --line-strong: #34343a;
    --text: #eeeeef;
    --muted: #a2a3a9;
    --muted-2: #777981;
    --red: #e0444e;
    --red-hover: #ee535d;
    --red-soft: rgba(224, 68, 78, 0.10);
    --red-line: rgba(224, 68, 78, 0.38);
    --radius-lg: 14px;
    --radius: 11px;
    --radius-sm: 8px;
}
body { background: var(--bg); }
.site-shell { width: min(1040px, calc(100% - 36px)); }
.topbar {
    min-height: 58px;
    padding: 10px 0;
    gap: 16px;
    background: rgba(10,10,11,.98);
    border-bottom: 1px solid #202024;
}
.brand { gap: 9px; }
.brand-mark {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 8px;
    background: transparent;
}
.brand-copy strong { font-size: .95rem; font-weight: 780; letter-spacing: -.01em; }
.main-nav { gap: 16px; }
.main-nav a {
    padding: 7px 0 8px;
    border-radius: 0;
    border-bottom: 1px solid transparent;
    background: transparent !important;
    font-size: .9rem;
    font-weight: 680;
}
.main-nav a:hover { color: #fff; border-bottom-color: var(--line-strong); }
.main-nav a.active { color: #fff; border-bottom-color: var(--red); }
.user-chip {
    padding: 5px 0;
    border: 0;
    background: transparent;
    color: var(--muted);
}
.content-wrap { padding: 24px 0 38px; }
.footer { padding: 16px 0 24px; border-top-color: #202024; }
.panel {
    background: var(--surface);
    border-color: var(--line);
    border-radius: var(--radius);
    box-shadow: none !important;
}
.home-top {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0 18px;
    border-bottom: 1px solid #202024;
    margin-bottom: 16px;
}
.home-top h1 { margin: 0; font-size: clamp(1.34rem, 2.4vw, 1.72rem); font-weight: 760; }
.home-top p { margin: 5px 0 0; color: var(--muted-2); font-size: .9rem; line-height: 1.4; }
.home-tools {
    padding: 13px;
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
}
.home-search {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    gap: 8px;
}
.home-search input[type="search"] {
    height: 40px;
    padding: 0 12px;
    border-radius: 9px;
    background: var(--field);
}
.search-submit {
    min-width: 64px;
    height: 40px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    color: var(--text);
    background: var(--surface-2);
    font-weight: 720;
}
.search-submit:hover { background: var(--surface-hover); border-color: var(--line-strong); }
.category-strip {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}
.category-chip, .category-manage {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 5px 9px;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--muted);
    background: transparent;
    font-size: .85rem;
    font-weight: 680;
    max-width: 220px;
}
.category-chip span { color: var(--muted-2); font-size: .78rem; }
.category-chip:hover, .category-manage:hover {
    color: #fff;
    background: var(--surface-hover);
    border-color: var(--line);
}
.category-chip.selected {
    color: #fff;
    background: var(--red-soft);
    border-color: var(--red-line);
}
.category-manage { margin-left: auto; color: #d3d4d8; }
.list-feed { display: grid; gap: 8px; }
.post-list-item {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    align-items: center;
    gap: 18px;
    padding: 16px 17px;
    border-radius: 12px;
    background: #101012;
}
.interactive-card {
    transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.interactive-card:hover,
.interactive-card:focus-visible {
    background: #17171a;
    border-color: #36363c;
    box-shadow: none;
    outline: none;
}
.post-card-main { min-width: 0; }
.post-card h2 {
    margin: 7px 0 6px;
    font-size: 1.08rem;
    font-weight: 720;
    line-height: 1.35;
}
.post-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.post-card-aside {
    color: var(--muted-2);
    font-size: .84rem;
    white-space: nowrap;
}
.post-card-aside span {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px 9px;
}
.post-meta {
    gap: 7px;
    color: var(--muted-2);
    font-size: .8rem;
}
.post-meta span:first-child {
    max-width: 180px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #dfe0e4;
    font-weight: 700;
}
.post-meta span:first-child::before {
    width: 5px;
    height: 5px;
    margin-right: 6px;
    background: var(--red);
}
.post-meta span:not(:first-child)::before { color: #55575f; }
.page-head.compact-head {
    padding: 8px 0 16px;
    margin-bottom: 14px;
    border-bottom: 1px solid #202024;
    background: transparent;
}
.page-head.compact-head h1 { font-size: clamp(1.28rem, 2.2vw, 1.65rem); }
.btn, button.btn, a.btn, .file-mini {
    border-radius: 9px;
    border-color: var(--line-strong);
    background: var(--surface-2);
    box-shadow: none;
    font-weight: 720;
}
.btn:not(.ghost):not(.danger) { border-color: var(--line-strong); }
.btn:hover, .file-mini:hover { background: var(--surface-hover); border-color: #3d3d43; }
.btn.ghost { background: transparent; }
.text-action {
    padding: 6px 0;
    border-radius: 0;
    border-bottom: 1px solid transparent;
    background: transparent !important;
    font-weight: 720;
}
.text-action:hover { border-bottom-color: var(--line-strong); }
.text-action.primary { color: #fff; }
.text-action.primary::before { background: var(--red); }
.sidebar { top: 72px; }
.layout-2col { grid-template-columns: 248px minmax(0,1fr); }
.layout-2col > .panel, .sidebar, .post-view, .comments, .editor-form, .upload-panel, .file-panel, .notice-panel, .chat-panel { padding: 18px; }
input, textarea, select {
    border-radius: 9px;
    background: var(--field);
    border-color: var(--line);
}
input:focus, textarea:focus, select:focus {
    border-color: var(--line-strong);
    box-shadow: 0 0 0 3px rgba(255,255,255,.035);
}
.file-row {
    grid-template-columns: 50px minmax(0,1fr) auto;
    padding: 12px 14px;
    border-radius: 12px;
}
.file-icon {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    background: #151518;
}
.file-main strong { font-weight: 720; }
.chat-panel { gap: 10px; }
.chat-log {
    border-radius: 12px;
    background: #0e0e10;
    padding: 10px;
}
.chat-message {
    border-radius: 12px;
    background: #151518;
    border-color: #28282d;
}
.chat-form textarea { min-height: 42px; }
.chat-file-card { border-radius: 10px; }
.chat-file-actions a { color: #d9d9dd; }
.chat-file-actions a:hover { color: #fff; }
.dropzone { border-radius: 10px; background: #0f0f11; }
.dropzone:hover { background: #17171a; }
.empty-state.compact-empty { padding: 22px; }
.mobile-nav-toggle { border-radius: 9px; }
@media (max-width: 920px) {
    .main-nav { gap: 8px; }
    .main-nav.open { padding: 6px 0 2px; }
    .home-top { align-items: flex-start; flex-direction: column; }
    .category-manage { margin-left: 0; }
}
@media (max-width: 620px) {
    .site-shell { width: min(100% - 18px, 1040px); }
    .home-search { grid-template-columns: 1fr; }
    .search-submit { width: 100%; }
    .post-list-item { grid-template-columns: 1fr; gap: 10px; padding: 15px; }
    .post-card-aside { justify-self: start; }
    .file-row { grid-template-columns: 42px minmax(0,1fr); }
    .file-actions { grid-column: 1 / -1; justify-content: flex-start; }
    .chat-file-card { min-width: 0; }
}

/* AI summary admin */
.ai-status-panel,
.ai-filter-panel,
.ai-file-panel { padding: 18px; margin-bottom: 14px; }
.status-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--field);
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 750;
}
.status-pill::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--muted-2);
}
.status-pill.ok::before { background: var(--ok); }
.status-pill.bad::before { background: var(--danger); }
.ai-file-head { align-items: center; }
.ai-file-list { display: grid; gap: 8px; }
.ai-file-row {
    display: grid;
    grid-template-columns: auto 42px minmax(0,1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-2);
    min-width: 0;
}
.ai-file-row input { width: 17px; height: 17px; accent-color: var(--red); }
.ai-file-main { min-width: 0; display: grid; gap: 3px; }
.ai-file-main strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ai-file-main span {
    color: var(--muted);
    font-size: 0.86rem;
    overflow-wrap: anywhere;
}
.ai-file-mode {
    color: var(--muted);
    padding: 5px 8px;
    border-radius: 999px;
    background: var(--field);
    border: 1px solid var(--line);
    font-size: 0.8rem;
    white-space: nowrap;
}
@media (max-width: 720px) {
    .ai-file-row { grid-template-columns: auto 38px minmax(0,1fr); }
    .ai-file-mode { grid-column: 3 / -1; justify-self: start; }
    .ai-file-head { align-items: flex-start; gap: 12px; flex-direction: column; }
}
