/* moybb - ЕДИНАЯ мобильная версия всех форумов (31.10.2026, C8). Один вид на любом форуме, без CSS и картинок компьютерных тем.
   Ориентиры: XenForo 2.3, Discourse, Flarum, Invision, phpBB 3.3 prosilver. Правила дизайна - /root/forum-mobile/DESIGN.md.
   Разметка: forum/mobile_ui.php (mx_*) + обычная разметка страниц (формы, профиль, поиск) - её приводит к общему виду этот файл. */

:root {
  --bg: #F3F4F6; --card: #FFFFFF; --ink: #16181D; --ink2: #3B414B; --mute: #6B7280; --line: #E6E8EC; --line2: #F0F1F4;
  --accent: #2563EB; --accent-ink: #FFFFFF; --accent-soft: #EBF1FE; --accent-dark: #1D4ED8;
  --pin: #B45309; --pin-soft: #FEF3E2; --ok: #15803D; --ok-soft: #E8F6EC; --err: #C62828; --err-soft: #FDECEC;
  --field: #FFFFFF; --field-line: #D3D7DE; --r: 14px; --r-s: 10px;
  --link: #2563EB; --pin-row: #FFFBF3; --sunk: var(--sunk); --quote: #F6F8FB; --hdr1: #FFFFFF; --hdr2: #FFFFFF; --hdr-ink: #16181D; --strip: #2563EB; --bgtop: #F3F4F6;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
html.mx-open { overflow: hidden; }
body.mx { margin: 0; min-width: 320px; background: linear-gradient(var(--bgtop), var(--bg) 300px) no-repeat, var(--bg); color: var(--ink); font: 400 16px/1.5 var(--font); overflow-wrap: anywhere; -webkit-tap-highlight-color: rgba(37,99,235,.12); }
body.mx a { color: var(--link); text-decoration: none; }
body.mx img { max-width: 100%; height: auto; border: 0; }
body.mx small { font-size: 13px; }
body.mx font[color] { color: inherit; }
body.mx table { border-collapse: collapse; border-spacing: 0; }
body.mx td, body.mx th { background: none !important; border-color: var(--line); }
.mx-i { display: block; flex: none; }

/* ---------- шапка ---------- */
.mx-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 2px; height: 56px; padding: 0 6px; padding-top: env(safe-area-inset-top); background: linear-gradient(90deg, var(--hdr1), var(--hdr2)); border-bottom: 3px solid var(--strip); box-shadow: 0 1px 6px rgba(0,0,0,.12); color: var(--hdr-ink); }
.mx-brand { flex: 1 1 auto; min-width: 0; padding: 0 6px; color: var(--hdr-ink) !important; font-size: 18px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mx-hbtn { position: relative; flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: 0; padding: 0; border: 0; border-radius: 12px; background: none; color: var(--ink2) !important; cursor: pointer; font: inherit; }
.mx-hbtn:active { background: rgba(127,127,127,.22); }
.mx-top .mx-hbtn { color: var(--hdr-ink) !important; }
.mx-me .mx-ava { box-shadow: 0 0 0 2px var(--hdr-ink); }
.mx-dot { position: absolute; top: 9px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: #FF3B30; box-shadow: 0 0 0 2px var(--hdr1); }

/* ---------- выдвижное меню ---------- */
.mx-scrim { position: fixed; inset: 0; z-index: 40; background: rgba(15,18,25,.42); }
.mx-scrim[hidden] { display: none; }
.mx-drawer { position: fixed; top: 0; bottom: 0; left: 0; z-index: 50; width: min(320px, 86vw); overflow-y: auto; background: var(--card); box-shadow: 8px 0 32px rgba(0,0,0,.18); transform: translateX(-104%); transition: transform .22s ease; padding-bottom: 24px; }
html.mx-open .mx-drawer { transform: none; }
.mx-dtop { display: flex; align-items: center; height: 56px; padding: 0 6px 0 18px; border-bottom: 1px solid var(--line); }
.mx-dname { flex: 1; min-width: 0; font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mx-dme { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.mx-dme b { display: block; font-size: 16px; }
.mx-dme small { display: block; color: var(--mute); line-height: 1.4; }
.mx-dnav { padding: 8px; border-bottom: 1px solid var(--line); }
.mx-dl { display: flex; align-items: center; gap: 14px; min-height: 48px; padding: 0 12px; border-radius: 10px; color: var(--ink) !important; font-size: 16px; font-weight: 500; }
.mx-dl .mx-i { color: var(--mute); }
.mx-dl span:first-of-type { flex: 1; }
.mx-dl:active { background: var(--line2); }
.mx-badge { flex: none; min-width: 24px; padding: 1px 8px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 700; text-align: center; }
.mx-dfoot { display: flex; flex-direction: column; gap: 4px; padding: 14px 20px; font-size: 14px; }

/* ---------- страница ---------- */
.mx-main { max-width: 760px; margin: 0 auto; padding: 12px 12px 28px; }
.mx-main h1 { margin: 6px 4px 12px; font-size: 22px; line-height: 1.25; font-weight: 700; letter-spacing: -.015em; color: var(--ink); }
.mx-main h2, .mx-main h3 { font-size: 17px; line-height: 1.3; margin: 18px 4px 8px; }
.mx-main p { margin: 10px 4px; }
.mx-back { display: inline-flex; align-items: center; gap: 2px; min-height: 36px; margin: 0 0 2px -4px; padding: 0 10px 0 2px; border-radius: 10px; color: var(--mute) !important; font-size: 14px; font-weight: 600; max-width: 100%; }
.mx-back span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mx-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.mx-empty { padding: 20px 16px; color: var(--mute); text-align: center; }
.mx-block { margin: 0 0 18px; }
.mx-bh { margin: 4px 6px 8px !important; font-size: 13px !important; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); }

/* аватары */
.mx-ava { display: inline-flex; flex: none; align-items: center; justify-content: center; overflow: hidden; border-radius: 50%; background: var(--line2); color: #fff; font-weight: 700; line-height: 1; vertical-align: middle; }
.mx-ava img { display: block; width: 100% !important; height: 100% !important; max-width: none; object-fit: cover; }
.mx-ava32 { width: 32px; height: 32px; font-size: 14px; }
.mx-ava40 { width: 40px; height: 40px; font-size: 17px; }
.mx-ava48 { width: 48px; height: 48px; font-size: 20px; }
.mx-ava96 { width: 96px; height: 96px; font-size: 40px; }
.mx-l0 { background: #C2410C; } .mx-l1 { background: #A16207; } .mx-l2 { background: #15803D; } .mx-l3 { background: #0E7490; }
.mx-l4 { background: #1D4ED8; } .mx-l5 { background: #6D28D9; } .mx-l6 { background: #BE185D; } .mx-l7 { background: #475569; }
.mx-ava[class*="mx-l"] { color: #FFFFFF; }

/* ---------- главная: разделы ---------- */
.mx-sec { display: flex; gap: 12px; padding: 14px 14px 14px 12px; border-top: 1px solid var(--line2); }
.mx-sec:first-child { border-top: 0; }
.mx-sic { flex: none; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent) !important; }
.mx-sec.is-unread .mx-sic { background: var(--accent); color: var(--accent-ink) !important; }
.mx-sbody { flex: 1; min-width: 0; }
.mx-stitle { color: var(--ink) !important; font-size: 16.5px; font-weight: 600; line-height: 1.3; }
.mx-sec.is-unread .mx-stitle { font-weight: 700; }
.mx-new { display: inline-block; margin-left: 4px; padding: 0 7px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; line-height: 18px; vertical-align: 2px; }
.mx-sdesc { margin-top: 2px; color: var(--ink2); font-size: 14px; line-height: 1.45; }
.mx-smods { margin-top: 3px; color: var(--mute); font-size: 13px; }
.mx-smods small { font-size: 13px; }
.mx-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; color: var(--mute); font-size: 13px; }
.mx-meta b { color: var(--ink2); font-weight: 600; }
.mx-slast { display: flex; flex-direction: column; margin-top: 8px; padding: 8px 10px; border-radius: var(--r-s); background: var(--bg); line-height: 1.35; }
.mx-slt { color: var(--ink) !important; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mx-sla { color: var(--mute); font-size: 12.5px; margin-top: 2px; }

/* статистика */
.mx-stats { padding: 14px; font-size: 14px; color: var(--ink2); }
.mx-sgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.mx-sgrid div { padding: 10px 4px; border-radius: var(--r-s); background: var(--bg); text-align: center; }
.mx-sgrid b { display: block; font-size: 18px; color: var(--ink); }
.mx-sgrid span { font-size: 12px; color: var(--mute); }
.mx-srow { padding: 6px 2px 0; line-height: 1.5; }
.mx-on { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: #22C55E; vertical-align: 1px; }

/* ---------- список тем ---------- */
.mx-shead { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 12px; }
.mx-shead h1 { flex: 1; min-width: 0; margin: 4px 4px 0 !important; }
.mx-sintro { margin: -6px 4px 12px; color: var(--mute); font-size: 14px; }
.mx-btn, body.mx input[type=submit], body.mx input[type=button], body.mx button.button, body.mx .button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px; border: 1px solid transparent; border-radius: 12px; background: var(--accent); color: var(--accent-ink) !important; font: 600 15px/1 var(--font); cursor: pointer; -webkit-appearance: none; appearance: none; text-decoration: none; white-space: nowrap; }
.mx-btn:active, body.mx input[type=submit]:active { background: var(--accent-dark); }
body.mx input[name=preview], body.mx .mx-btn2 { background: var(--card); color: var(--ink2) !important; border-color: var(--field-line); }
.mx-btn.mx-new-topic { flex: none; padding: 0 14px 0 12px; }
.mx-note { margin: 0 0 12px; padding: 12px 14px; border-radius: var(--r-s); background: var(--accent-soft); color: var(--ink2); font-size: 14px; }
.mx-note a { font-weight: 600; }
.mx-trow { position: relative; display: flex; gap: 12px; padding: 13px 14px 12px 12px; border-top: 1px solid var(--line2); }
.mx-trow:first-child { border-top: 0; }
.mx-trow.is-pinned { background: var(--pin-row); }
.mx-trow.is-pinned + .mx-trow:not(.is-pinned) { border-top: 6px solid var(--bg); }
.mx-tchk { display: flex; align-items: center; margin: -13px 0 -12px -12px; padding: 0 0 0 12px; }
.mx-tchk input { width: 22px; height: 22px; accent-color: var(--accent); }
.mx-tava { flex: none; }
.mx-tmain { flex: 1; min-width: 0; }
.mx-flags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 4px; }
.mx-flag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px 1px 6px; border-radius: 6px; font-size: 12px; font-weight: 700; line-height: 20px; }
.mx-fpin { background: var(--pin-soft); color: var(--pin); }
.mx-flock { background: var(--line2); color: var(--mute); }
.mx-ttitle { display: block; color: var(--ink) !important; font-size: 16px; font-weight: 500; line-height: 1.35; }
.mx-trow.is-unread .mx-ttitle { font-weight: 700; }
.mx-udot { display: inline-block; width: 9px; height: 9px; margin: 0 7px 1px 0; border-radius: 50%; background: var(--accent); vertical-align: middle; }
.mx-tsec { margin-top: 2px; font-size: 13px; }
.mx-tsec a { color: var(--mute) !important; }
.mx-tmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; margin-top: 4px; color: var(--mute); font-size: 13px; line-height: 1.4; }
.mx-tby { color: var(--ink2); font-weight: 600; }
.mx-tlast { display: inline-flex; align-items: center; gap: 4px; }
.mx-tstat { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin-top: 6px; color: var(--mute); font-size: 13px; }
.mx-tstat > span { display: inline-flex; align-items: center; gap: 5px; }
.mx-tstat b { color: var(--ink2); font-weight: 600; }
.mx-tonew { margin-left: auto; padding: 2px 10px; border-radius: 8px; background: var(--accent-soft); color: var(--link) !important; font-weight: 600; font-size: 13px; }
.mx-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 12px 6px; color: var(--mute); font-size: 13px; }
.mx-legend span { display: inline-flex; align-items: center; gap: 6px; }
.mx-legend .mx-udot { margin: 0; }

/* ---------- тема ---------- */
.mx-thead { margin: 0 0 12px; }
.mx-thead h1 { margin-bottom: 6px; }
.mx-tinfo { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 4px; color: var(--mute); font-size: 13px; }
.mx-tinfo > span { display: inline-flex; align-items: center; gap: 5px; }
.mx-main .topic-views-line { margin: -6px 4px 14px; color: var(--mute); font-size: 13px; }
.mx-banned { color: var(--err); font-weight: 600; }
.mx-stub { color: var(--mute); }
.mx-post { margin: 0 0 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.mx-post:target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mx-ph { display: flex; align-items: center; gap: 11px; padding: 12px 12px 0 14px; }
.mx-ph .mod-check { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }
.mx-pwho { flex: 1; min-width: 0; }
.mx-pname { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; line-height: 1.3; }
.mx-pname .post-name { color: var(--ink) !important; font-weight: 700; font-size: 15.5px; }
.mx-ocq img { vertical-align: middle; }
.mx-role { padding: 0 7px; border-radius: 6px; font-size: 11.5px; font-weight: 700; line-height: 19px; }
.mx-radm { background: #FDECEC; color: #B42318; }
.mx-rmod { background: #E8F6EC; color: #157A3B; }
.mx-rai { background: #F1EBFD; color: #6B3FC4; }
.mx-pmeta { display: flex; flex-wrap: wrap; gap: 0 10px; color: var(--mute); font-size: 12.5px; line-height: 1.5; }
.mx-pmeta a { color: var(--err) !important; }
.mx-pbody a { color: var(--link); }
.mx-pnum { align-self: flex-start; padding: 2px 6px; margin-top: -2px; color: var(--mute) !important; font-size: 13px; font-weight: 600; }
.mx-pbody { padding: 10px 16px 14px; font-size: 16px; line-height: 1.6; color: var(--ink); }
.mx-pbody img { height: auto !important; }
.mx-pbody .bb-image { display: inline-block; }
.mx-pbody blockquote, .mx-pbody .bb-quote, .mx-pbody table.bb-quote { display: block; margin: 8px 0 12px; padding: 8px 12px; border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; background: var(--quote); font-size: 15px; color: var(--ink2); }
.mx-pbody table { display: block; max-width: 100%; overflow-x: auto; }
.mx-pbody pre, .mx-pbody code { max-width: 100%; overflow-x: auto; white-space: pre-wrap; font-size: 14px; }
.mx-pbody .post-signature { display: block; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--mute); font-size: 13px; }
.mx-pbody .post-edited { display: block; margin-top: 10px; color: var(--mute); font-size: 12.5px; }
.mx-pbody .post-edited + br, .mx-pbody br + br + .post-edited { display: none; }
.mx-pbody > table:has(td.rule), .mx-pbody td.rule { display: none; }
.mx-pbody .fo-line { margin-top: 10px !important; font-size: 13px; }
.mx-pbody .fo-line a { color: var(--mute) !important; }
.mx-pact { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px 6px 6px; border-top: 1px solid var(--line2); }
.mx-pa, .mx-pact input.mod-delete { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: none; color: var(--mute) !important; font: 600 14px/1 var(--font); cursor: pointer; }
.mx-pa:active { background: var(--line2); color: var(--ink) !important; }
.mx-pact input.mod-delete { min-height: 44px !important; padding: 0 12px !important; color: var(--err) !important; background: none !important; border: 0 !important; }
.mx-pa.mx-danger { color: var(--err) !important; }
.post-attachments { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.post-attachments small b { display: inline-flex; align-items: center; gap: 6px; color: var(--mute); font-weight: 600; font-size: 13px; }
.post-attachments br { display: none; }
.post-attachments > small, .post-attachments > b, .post-attachments > strong { display: block; margin-bottom: 2px; }
.post-attachments a { display: inline-block; margin: 8px 8px 0 0; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); vertical-align: top; }
.post-attachments img { display: block; max-height: 160px; width: auto !important; }

/* опрос */
.topic-poll { margin: 0 0 12px; }
.topic-poll > table.bb-poll, .mx-pbody table.bb-poll { display: block; width: 100% !important; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
table.bb-poll > tbody, table.bb-poll > tbody > tr, table.bb-poll > tbody > tr > td, table.bb-poll > tbody > tr > td > table, table.bb-poll > tbody > tr > td > table > tbody, table.bb-poll > tbody > tr > td > table > tbody > tr, table.bb-poll > tbody > tr > td > table > tbody > tr > td { display: block; width: auto !important; }
td.bb-poll-head { padding: 14px 16px 4px !important; font-size: 16px; }
td.bb-poll-head b { display: block; }
td.bb-poll-head small { color: var(--mute); }
td.bb-poll-body { padding: 6px 16px 14px !important; }
table.bb-poll-results { display: block; width: 100% !important; }
table.bb-poll-results tbody { display: block; }
table.bb-poll-results tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 8px 0; }
table.bb-poll-results td { display: block; width: auto !important; padding: 0 !important; }
table.bb-poll-results td.bb-poll-label { grid-column: 1; font-size: 15px; }
table.bb-poll-results td.bb-poll-count { grid-column: 2; grid-row: 1; color: var(--mute); font-size: 13px; font-weight: 600; white-space: nowrap; }
table.bb-poll-results td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; height: 8px; border-radius: 4px; background: var(--line2) !important; overflow: hidden; }
table.bb-poll-results td:nth-child(2) table { display: block; height: 8px; }
table.bb-poll-results td:nth-child(2) table tbody, table.bb-poll-results td:nth-child(2) table tr { display: block; height: 8px; }
table.bb-poll-results td.bb-poll-bar { display: block; height: 8px; border-radius: 4px; background: var(--accent) !important; font-size: 0; }
.bb-poll-foot { margin: 8px 0 0 !important; color: var(--mute); font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.bb-poll-foot small { font-size: 13px; }
form.bb-poll-form table, form.bb-poll-form tbody { display: block; }
form.bb-poll-form tr { display: flex; align-items: center; gap: 10px; min-height: 44px; border-bottom: 1px solid var(--line2); }
form.bb-poll-form td { display: block; padding: 0 !important; }
form.bb-poll-form label { display: block; padding: 10px 0; font-size: 15px; }
.bb-poll-radio { width: 20px; height: 20px; accent-color: var(--accent); }
.poll-manage { margin: -4px 6px 12px !important; font-size: 13px; }

/* липкая «Ответить» */
.mx-replybar { position: sticky; bottom: 0; z-index: 20; display: flex; justify-content: flex-end; gap: 8px; margin: 14px -12px -28px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 38%); transition: opacity .15s; pointer-events: none; }
.mx-replybar a { pointer-events: auto; box-shadow: 0 4px 14px rgba(0,0,0,.28); padding: 0 22px 0 18px; border-radius: 24px; min-height: 48px; font-size: 16px; }
.mx-replybar.is-hidden { opacity: 0; visibility: hidden; }
.mx-tfoot { display: flex; justify-content: space-between; gap: 10px; margin: 12px 4px 0; font-size: 14px; }

/* ---------- формы (ответ, тема, правка, вход, профиль, поиск) ---------- */
body.mx input[type=text], body.mx input[type=password], body.mx input[type=email], body.mx input[type=search], body.mx input[type=url], body.mx input:not([type]), body.mx select, body.mx textarea {
  width: 100%; max-width: 100%; min-height: 46px; margin: 0; padding: 10px 12px; border: 1px solid var(--field-line); border-radius: 10px; background: var(--field) !important; color: var(--ink) !important; font: 400 16px/1.4 var(--font); -webkit-appearance: none; appearance: none; box-shadow: none; }
body.mx textarea { min-height: 180px; resize: vertical; line-height: 1.5; }
body.mx select { padding-right: 34px; background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236B7280' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 12px center !important; }
body.mx input:focus, body.mx textarea:focus, body.mx select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
body.mx input[type=checkbox], body.mx input[type=radio] { width: 20px; height: 20px; margin: 0 8px 0 0; vertical-align: -4px; accent-color: var(--accent); }
body.mx input[type=file] { display: block; width: 100%; max-width: 100%; min-height: 44px; padding: 6px; border: 1px dashed var(--field-line); border-radius: 10px; font: 14px var(--font); }
body.mx input[type=file]::file-selector-button { margin-right: 10px; padding: 8px 12px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font: 600 14px var(--font); }
body.mx label { cursor: pointer; }

/* старые обёртки форм и карточек (table.post …) - в карточку */
.mx-main table.post, .mx-main table.post > tbody, .mx-main table.post > tbody > tr, .mx-main table.post > tbody > tr > td, .mx-main table.post > tbody > tr > td > table, .mx-main table.post > tbody > tr > td > table > tbody, .mx-main table.post > tbody > tr > td > table > tbody > tr, .mx-main table.post > tbody > tr > td > table > tbody > tr > td { display: block; width: auto !important; }
.mx-main table.post { margin: 0 0 14px; background: var(--card) !important; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.mx-main table.post td.post-bar { padding: 14px 16px 0 !important; font-size: 17px; color: var(--ink); }
.mx-main table.post td.post-bar b { font-weight: 700; }
.mx-main table.post td.post-bar small { display: block; margin-top: 2px; color: var(--mute); font-size: 13px; }
.mx-main table.post td.post-body { padding: 12px 16px 16px !important; }
.mx-main td.form-error, .mx-main .form-error { margin: 0 0 12px; padding: 12px 14px !important; border-radius: var(--r-s); background: var(--err-soft) !important; color: var(--err); font-size: 14px; }
.mx-main table.post td.form-error { margin: 12px 16px 0; }
.mx-main .form-ok { padding: 12px 14px; border-radius: var(--r-s); background: var(--ok-soft); color: var(--ok); font-size: 14px; }
.mx-main td.form-preview { margin: 12px 16px 0; border: 1px dashed var(--field-line); border-radius: var(--r-s); }
.mx-main .form-rules { display: block; margin-top: 12px; color: var(--mute); font-size: 12.5px; line-height: 1.5; }
.mx-main table.post form > p { margin: 14px 0 0; }
.mx-main table.post form > p:has(input[type=submit]) { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.mx-main table.post form > p:has(input[type=submit]) a { margin-left: auto; padding: 0 6px; font-weight: 600; }
.mx-main table.post form > p b { display: block; margin-bottom: 6px; font-size: 14px; color: var(--ink2); }
.mx-main table.form-table, .mx-main table.form-table tbody, .mx-main table.form-table tr, .mx-main table.form-table td { display: block; width: auto !important; padding: 0 !important; }
.mx-main table.form-table tr { margin: 0 0 14px; }
.mx-main table.form-table td:first-child b { display: block; margin-bottom: 6px; font-size: 14px; color: var(--ink2); }
.mx-main table.form-table td small { display: block; margin-top: 4px; color: var(--mute); }
.mx-main table.form-table input[type=submit] { width: 100%; }
.mx-main table.attach-fields, .mx-main table.poll-fields, .mx-main table.attach-fields > tbody, .mx-main table.poll-fields > tbody, .mx-main table.attach-fields > tbody > tr, .mx-main table.poll-fields > tbody > tr, .mx-main table.attach-fields > tbody > tr > td, .mx-main table.poll-fields > tbody > tr > td { display: block; width: auto !important; }
.mx-main table.attach-fields, .mx-main table.poll-fields { margin: 14px 0 0; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--sunk) !important; }
.mx-main table.attach-fields td.post-bar, .mx-main table.poll-fields td.post-bar { padding: 0 0 8px !important; font-size: 15px; }
.mx-main table.attach-fields td.post-bar small, .mx-main table.poll-fields td.post-bar small { display: inline; margin-left: 6px; color: var(--mute); font-size: 13px; }
.mx-main table.attach-fields td, .mx-main table.poll-fields td { padding: 0 !important; }
.mx-main table.attach-fields small, .mx-main table.poll-fields small { display: block; margin-top: 6px; color: var(--mute); font-size: 12.5px; line-height: 1.45; }
.mx-main table.attach-fields + br, .mx-main table.poll-fields + br { display: none; }
.mx-main table.attach-rows, .mx-main table.attach-rows tbody, .mx-main table.attach-rows tr, .mx-main table.attach-rows td { display: block; height: auto !important; white-space: normal !important; }
.mx-main table.attach-rows tr + tr { margin-top: 8px; }
.mx-main table.poll-fields p { margin: 8px 0; }
.mx-main table.poll-fields textarea { min-height: 120px; }
/* правка: прикреплённые - крошечная миниатюра и «удалить» */
.mx-main table.attach-list, .mx-main table.attach-list tbody { display: block; }
.mx-main table.attach-list tr { display: flex; align-items: center; gap: 12px; padding: 8px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--card); }
.mx-main table.attach-list tr:has(td[colspan]) { display: block; height: 8px; padding: 0; border: 0; background: none; }
.mx-main table.attach-list tr:has(td[colspan]) * { display: none; }
.mx-main table.attach-list td { display: block; width: auto !important; padding: 0 !important; }
.mx-main td.attach-mini-cell { flex: none; }
.mx-main td.attach-mini-cell img { display: block; max-width: 72px; max-height: 54px; width: auto !important; height: auto !important; border-radius: 6px; }
.mx-main td.attach-mini-info { flex: 1; min-width: 0; }
.mx-main td.attach-mini-info small { color: var(--mute); }
.mx-main td.attach-mini-info br { display: none; }
.mx-main td.attach-mini-info label { display: inline-flex !important; align-items: center; min-height: 36px; margin-top: 2px; color: var(--err); font-weight: 600; font-size: 14px; }

/* редактор (admin/editor.php): рамка-таблица 700px -> поле с панелью кнопок сверху */
.mx-main table.ed, .mx-main table.ed > tbody, .mx-main table.ed > tbody > tr, .mx-main table.ed > tbody > tr > td, .mx-main table.ed > tbody > tr > td > table, .mx-main table.ed > tbody > tr > td > table > tbody, .mx-main table.ed > tbody > tr > td > table > tbody > tr { display: block; width: auto !important; }
.mx-main table.ed { margin: 0; border: 1px solid var(--field-line); border-radius: 12px; overflow: hidden; background: var(--field) !important; }
.mx-main table.ed:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mx-main table.ed td { display: block; padding: 0 !important; }
.mx-main td.ed-bar { display: flex !important; flex-wrap: nowrap; align-items: center; gap: 0; overflow-x: auto; padding: 4px 6px !important; border-bottom: 1px solid var(--line); background: var(--sunk) !important; scrollbar-width: none; }
.mx-main td.ed-bar::-webkit-scrollbar { display: none; }
.mx-main a.ed-btn { display: inline-flex !important; flex: none; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 8px; }
.mx-main a.ed-btn img { mix-blend-mode: multiply; filter: grayscale(1) contrast(1.25); }
.mx-main a.ed-btn:active { background: var(--line2); }
.mx-main img.ed-sep, .mx-main table.ed-tools, .mx-main td.ed-hint, .mx-main td.ed-lbl { display: none !important; }
.mx-main .ed-smiles { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; overflow-x: auto; padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--mute); scrollbar-width: none; white-space: nowrap; }
.mx-main .ed-smiles img { flex: none; }
.mx-main table.ed textarea { display: block; border: 0 !important; border-radius: 0; box-shadow: none !important; min-height: 200px; }
/* подписи полей формы: без лишней пустой строки между подписью и полем */
.mx-main table.post form p > b + br, .mx-main table.post p > b:first-child + br { display: none; }
.mx-main table.post form p > b:first-child { display: block; margin-bottom: 6px; font-size: 14px; color: var(--ink2); }
/* поиск: подписи над полями */
.mx-main form.search-form { margin: 0 0 16px; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.mx-main table.search-box, .mx-main table.search-box tbody, .mx-main table.search-box tr, .mx-main table.search-box td { display: block; width: auto !important; padding: 0 !important; }
.mx-main table.search-box tr { margin: 0 0 14px; }
.mx-main table.search-box tr:last-child { margin: 0; }
.mx-main td.search-label b { display: block; margin-bottom: 6px; font-size: 14px; color: var(--ink2); }
.mx-main table.search-box label { display: inline-block; padding: 6px 0; }
.mx-main table.search-box input[type=submit] { width: 100%; }
/* профиль */
.mx-prof { padding: 18px 16px 16px; }
.mx-prof-top { display: flex; align-items: center; gap: 16px; }
.mx-prof-id { min-width: 0; }
.mx-prof-id h1 { margin: 0 0 6px !important; font-size: 22px; }
.mx-prof-sub { margin-top: 6px; color: var(--mute); font-size: 13px; }
.mx-sgrid2 { grid-template-columns: 1fr 1fr; margin: 16px 0 6px; }
.mx-dl2 { margin: 8px 0 0; }
.mx-dl2 > div { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line2); font-size: 14px; }
.mx-dl2 dt { flex: none; width: 104px; color: var(--mute); }
.mx-dl2 dd { flex: 1; min-width: 0; margin: 0; color: var(--ink); }
.mx-prof-sec { padding: 12px 0 2px; border-top: 1px solid var(--line2); font-size: 15px; }
.mx-prof-h { margin-bottom: 4px; color: var(--mute); font-size: 13px; font-weight: 600; }
.mx-prof-sec .post-signature { color: var(--ink2); font-size: 14px; }
.mx-prof-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.mx-prof-acts .mx-btn { flex: 1 1 auto; padding: 0 14px; }
.mx-main .mod-box, .mx-main table.mod-box { display: block; margin-top: 14px; }

/* страницы с таблицами (поиск, профиль, участники) - в одну колонку */
.mx-main table.forum-table { display: block; width: 100% !important; background: var(--card); border: 1px solid var(--line) !important; border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; margin: 0 0 14px; }
.mx-main table.forum-table > tbody { display: block; }
.mx-main table.forum-table tr { display: block; padding: 12px 14px; border-top: 1px solid var(--line2); }
.mx-main table.forum-table tr:first-child { border-top: 0; }
.mx-main table.forum-table tr:has(> th) { display: none; }
.mx-main table.forum-table td { display: block; width: auto !important; padding: 0 !important; border: 0 !important; font-size: 14px; color: var(--ink2); }
.mx-main table.forum-table td + td { margin-top: 4px; }
.mx-main table.forum-table td:first-child a { font-size: 15.5px; font-weight: 600; color: var(--ink) !important; }
.mx-main table.forum-table td small { color: var(--mute); }
.mx-main table.forum-table img.topic-icon { display: none; }
.mx-main .m-lbl { display: inline !important; color: var(--mute); }

/* прочее */
.mx-main .crumbs { display: none; }
.mx-main .forum-legend { color: var(--mute); font-size: 13px; }
.mx-main .form-login { margin: 14px 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); box-shadow: var(--shadow); font-size: 15px; text-align: center; }
.mx-main .topic-closed-note { display: inline-flex; padding: 6px 12px; border-radius: 8px; background: var(--line2); color: var(--mute); font-size: 14px; }
.mx-main hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.mx-main ul, .mx-main ol { padding-left: 22px; }
.banner-top, .banner-bottom { margin: 0 0 14px; text-align: center; overflow: hidden; }
.banner-bottom { margin: 16px 0 0; }

/* подвал */
.mx-foot { padding: 20px 16px calc(28px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--card); color: var(--mute); font-size: 13px; text-align: center; }
.mx-sub { margin-bottom: 10px; }
.mx-copy { margin-bottom: 6px; }
.mx-flinks { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 18px; }
.mx-foot a { color: var(--mute) !important; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.top-counter { margin-top: 10px; }
.mx-main table.search-box label { display: inline; padding: 0; line-height: 44px; }
.mx-main table.poll-fields p > b:first-child { display: inline; }
.mx-main table.poll-fields p > b:first-child + br { display: inline; }
/* редактор в тёмных темах: кнопки-картинки видны только на светлой полосе */
.mx-main td.ed-bar { background: #F3F4F6 !important; }

/* текст на заливке акцентом - всегда --accent-ink (AA 4.5:1, считает gen_mx.py) */
body.mx .mx-btn:not(.mx-btn2), body.mx input[type=submit]:not([name=preview]):not(.mx-btn2):not(.mod-delete), body.mx input[type=button], body.mx button.button, body.mx .mx-new, body.mx .mx-badge, body.mx .mx-sec.is-unread .mx-sic { color: var(--accent-ink) !important; background-color: var(--accent) !important; }
body.mx .mx-btn2, body.mx input[name=preview] { color: var(--ink) !important; background-color: var(--card) !important; border-color: var(--field-line) !important; }
body.mx .mx-pact input.mod-delete { color: var(--err) !important; background: none !important; }
