:root {
  color-scheme: dark;
  --bg: #111;
  --panel: #181818;
  --panel-raised: #202020;
  --line: #2b2b2b;
  --text: #f3f3f3;
  --muted: #898989;
  --white: #fff;
  --soft: #d3d3d3;
  font-family: "DM Sans", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
.loading-screen { min-height: 100vh; display: grid; place-content: center; color: var(--muted); }
.brand-mark { color: var(--white); font: 800 22px Manrope, sans-serif; letter-spacing: -.08em; }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.brand { display: flex; align-items: center; }
.eyebrow { color: #a7a7a7; text-transform: uppercase; letter-spacing: .24em; font-size: 10px; font-weight: 700; }
h1, h2, h3, p { margin-top: 0; }
.login-panel { width: min(100%, 410px); padding: 38px; border: 1px solid var(--line); background: var(--panel); }
.login-brand { margin-bottom: 32px; color: var(--white); font: 800 30px Manrope, sans-serif; letter-spacing: -.08em; text-align: center; }
.login-form { width: min(100%, 370px); }
.login-form h2 { margin: 0 0 24px; font: 600 23px Manrope, sans-serif; letter-spacing: -.05em; text-align: center; }
.login-error { margin: 16px 0 0; color: #d3a6a6; font-size: 11px; line-height: 1.6; }
.login-note { margin: 22px 0 0; color: #888; font-size: 11px; line-height: 1.6; }
.field { display: grid; gap: 8px; margin: 17px 0; }
.field label { color: #b7b7b7; font-size: 12px; font-weight: 600; }
.field input, .field textarea, .field select { width: 100%; padding: 13px 14px; border: 1px solid #333; border-radius: 2px; outline: 0; background: #171717; color: var(--text); transition: border-color .2s, background .2s; }
.field textarea { min-height: 125px; resize: vertical; line-height: 1.65; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: #858585; background: #1b1b1b; }
.field input::placeholder, .field textarea::placeholder { color: #666; }
.field input[type="file"] { padding: 10px; color: #999; font-size: 11px; }
.field input[type="file"]::file-selector-button { margin-right: 10px; padding: 7px 10px; border: 1px solid #444; background: #222; color: #ddd; cursor: pointer; }
.button { min-height: 42px; padding: 0 17px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 1px solid transparent; border-radius: 2px; cursor: pointer; font-size: 12px; font-weight: 700; transition: background .18s, border-color .18s, transform .18s; }
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--white); color: #111; }
.button-primary:hover { background: #d9d9d9; }
.button-outline { border-color: #393939; background: transparent; color: var(--soft); }
.button-outline:hover { border-color: #777; background: #1a1a1a; }
.button-full { width: 100%; margin-top: 8px; min-height: 47px; }
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 3; width: 258px; display: flex; flex-direction: column; padding: 28px 20px 20px; border-right: 1px solid var(--line); background: #141414; }
.sidebar .brand { padding: 0 6px 31px; }
.nav-caption { padding: 17px 10px 10px; color: #707070; font-size: 9px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; }
.nav-item { width: 100%; min-height: 42px; display: flex; align-items: center; gap: 11px; padding: 0 11px; border: 0; border-radius: 2px; background: transparent; color: #a6a6a6; text-align: left; cursor: pointer; font-size: 12px; }
.nav-item:hover, .nav-item.active { background: #222; color: #fff; }
.nav-icon { width: 18px; text-align: center; color: #aaa; font-size: 15px; }
.nav-count { margin-left: auto; color: #777; font-size: 10px; }
.sidebar-bottom { margin-top: auto; }
.sidebar-rule { border: 0; border-top: 1px solid var(--line); margin: 15px 0; }
.profile { display: flex; align-items: center; gap: 11px; padding: 10px 7px; }
.avatar { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid #3b3b3b; border-radius: 50%; background: #222; color: #e7e7e7; font: 700 11px Manrope, sans-serif; text-transform: uppercase; }
.profile-info { min-width: 0; }
.profile-info strong { display: block; overflow: hidden; color: #eee; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.profile-info span { display: block; margin-top: 4px; color: #777; font-size: 10px; }
.logout { width: 100%; justify-content: flex-start; color: #888; }
.main-area { min-height: 100vh; margin-left: 258px; }
.topbar { height: 69px; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 0 clamp(22px, 5vw, 62px); border-bottom: 1px solid var(--line); }
.breadcrumbs { color: #858585; font-size: 11px; }
.breadcrumbs strong { color: #ddd; font-weight: 500; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.content { width: min(100%, 1050px); margin: 0 auto; padding: 45px clamp(22px, 5vw, 62px) 80px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 31px; }
.page-heading h1 { margin: 9px 0 7px; font: 600 clamp(27px, 4vw, 38px)/1.2 Manrope, sans-serif; letter-spacing: -.055em; }
.page-heading p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.section-label { margin: 34px 0 13px; color: #818181; font-size: 10px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.section-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.section-card { min-height: 150px; padding: 21px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; transition: border-color .2s, background .2s; }
.section-card:hover { border-color: #555; background: #1c1c1c; }
.card-top { display: flex; justify-content: space-between; align-items: center; }
.section-symbol { color: #bfbfbf; font-size: 18px; }
.count-pill { padding: 5px 8px; border: 1px solid #343434; color: #888; font-size: 9px; }
.section-card h3 { margin: 23px 0 6px; font: 600 16px Manrope, sans-serif; letter-spacing: -.03em; }
.section-card p { margin: 0; color: #858585; font-size: 11px; line-height: 1.6; }
.empty-state { padding: 50px 24px; border: 1px dashed #353535; text-align: center; }
.empty-state h3 { margin-bottom: 8px; font: 600 17px Manrope, sans-serif; }
.empty-state p { margin-bottom: 18px; color: #888; font-size: 12px; }
.topic-list { border-top: 1px solid var(--line); }
.topic-row { display: grid; grid-template-columns: 1fr auto; gap: 15px; align-items: center; padding: 19px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.topic-row-actions { display: flex; align-items: center; gap: 12px; }
.topic-row:hover .topic-title { color: #fff; }
.topic-title { margin-bottom: 6px; color: #e5e5e5; font-size: 13px; font-weight: 600; }
.pin-badge { display: inline-block; margin-right: 5px; padding: 3px 6px; border: 1px solid #444; color: #bbb; font-size: 9px; font-weight: 500; vertical-align: 1px; }
.pin-topic { min-height: 30px; padding: 0 9px; color: #aaa; font-size: 10px; white-space: nowrap; }
.heading-actions { display: flex; align-items: center; gap: 8px; }
.delete-section { color: #aaa; }
.topic-meta { color: #858585; font-size: 10px; }
.topic-replies { color: #888; font-size: 10px; white-space: nowrap; }
.thread-post { margin: 13px 0; padding: 21px; border: 1px solid var(--line); background: var(--panel); }
.post-header { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.post-header strong { font-size: 11px; }
.post-header time { margin-left: auto; color: #777; font-size: 10px; }
.post-content { color: #cecece; font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; white-space: pre-wrap; }
.delete-post { min-height: 30px; margin-left: 8px; padding: 0 9px; color: #999; font-size: 10px; }
.attachment-link { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; margin-top: 16px; padding: 10px 12px; border: 1px solid #353535; color: #dedede; font-size: 11px; overflow-wrap: anywhere; }
.attachment-link:hover { border-color: #777; background: #222; }
.attachment-size { color: #858585; font-size: 10px; white-space: nowrap; }
.reply-form { margin-top: 24px; padding-top: 19px; border-top: 1px solid var(--line); }
.toast { position: fixed; z-index: 20; right: 24px; bottom: 24px; max-width: min(380px, calc(100vw - 48px)); padding: 13px 17px; transform: translateY(15px); border: 1px solid #444; background: #202020; color: #eee; opacity: 0; pointer-events: none; transition: .2s; font-size: 12px; }
.toast.visible { transform: translateY(0); opacity: 1; }
.modal { width: min(480px, calc(100vw - 32px)); max-height: min(85vh, 760px); padding: 27px; border: 1px solid #393939; background: #171717; color: var(--text); }
.modal::backdrop { background: #000b; backdrop-filter: blur(3px); }
.modal h2 { margin: 0 0 6px; font: 600 22px Manrope, sans-serif; letter-spacing: -.04em; }
.modal-intro { margin-bottom: 20px; color: #858585; font-size: 11px; line-height: 1.6; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.permission-list { max-height: 160px; overflow: auto; margin: 5px 0 15px; border: 1px solid #303030; }
.permission-option { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-bottom: 1px solid #282828; color: #bbb; font-size: 11px; }
.permission-option:last-child { border-bottom: 0; }
.permission-option input { accent-color: white; }
.users-dialog { min-width: 0; }
.user-list { max-height: min(52vh, 430px); overflow: auto; border: 1px solid #303030; }
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border-bottom: 1px solid #292929; }
.user-row:last-child { border-bottom: 0; }
.user-row-info { min-width: 0; }
.user-row-info strong, .user-row-info span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-row-info strong { color: #e5e5e5; font-size: 12px; }
.user-row-info span, .user-protected { margin-top: 4px; color: #858585; font-size: 10px; }
.user-protected { flex: 0 0 auto; }
.delete-user { min-height: 30px; padding: 0 9px; color: #aaa; font-size: 10px; }
.mobile-menu { display: none; }

@media (max-width: 800px) {
  .login-panel { padding: 30px 24px; }
  .sidebar { width: 220px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); box-shadow: 12px 0 40px #0009; }
  .main-area { margin-left: 0; }
  .mobile-menu { display: inline-flex; }
  .topbar { padding: 0 18px; }
  .content { padding: 34px 20px 60px; }
}
@media (max-width: 520px) {
  .section-grid { grid-template-columns: 1fr; }
  .section-card { min-height: 132px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .top-actions .button { padding: 0 10px; }
  .heading-actions { align-items: flex-start; flex-wrap: wrap; }
  .topic-row-actions { align-items: flex-end; flex-direction: column; gap: 5px; }
}
