:root {
    --bg: #f7f9fd;
    --sidebar: rgba(248, 250, 252, .92);
    --line: #e4eaf2;
    --text: #0f172a;
    --heading: #020617;
    --muted: #475569;
    --blue: #e8f1ff;
    --green: #dcfce7;
    --yellow: #fef3c7;
    --red: #fee2e2;
    --button: #e0f2fe;
    --button-strong: #bfdbfe;
    --accent: #2563eb;
    --shadow: 0 18px 45px rgba(15, 23, 42, .06);
    --soft-shadow: 0 8px 24px rgba(15, 23, 42, .05);
}
* { box-sizing: border-box; }
html {
    max-width: 100%;
    overflow-x: hidden;
}
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: radial-gradient(circle at top right, #eef6ff 0, transparent 34%), var(--bg);
    color: var(--text);
    font-size: 17px;
    font-weight: 400;
    line-height: 1.45;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    max-width: 100%;
    overflow-x: hidden;
}
a { color: #1d4ed8; text-decoration: none; }
img,
svg,
canvas,
video {
    max-width: 100%;
}
h1, h2, h3 {
    color: var(--heading);
    text-rendering: optimizeLegibility;
}
h1 { font-weight: 800; }
h2, h3 { font-weight: 700; }
.layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: 100vh; width: 100%; max-width: 100vw; overflow-x: hidden; }
.sidebar { background: var(--sidebar); border-right: 1px solid var(--line); padding: 22px 16px; overflow-y: auto; min-width: 0; }
.brand { font-size: 24px; font-weight: 800; margin-bottom: 18px; letter-spacing: 0; display: flex; align-items: center; gap: 10px; color: var(--heading); }
.brand-mark { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 12px; background: #dbeafe; box-shadow: inset 0 0 0 1px #bfdbfe; }
.menu { display: grid; gap: 4px; }
.menu a { color: var(--text); padding: 10px 12px; border-radius: 10px; display: flex; align-items: center; gap: 10px; font-weight: 600; }
.menu a.active, .menu a:hover { background: var(--blue); color: #1d4ed8; box-shadow: inset 0 0 0 1px #dbeafe; }
.menu a.active .icon-badge,
.menu a:hover .icon-badge {
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .12), 0 8px 16px rgba(37, 99, 235, .08);
}
.menu-icon { width: 22px; height: 22px; display: inline-grid; place-items: center; color: #4b6b9d; }
.country-list { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 16px; }
.country-list h2 { font-size: 18px; margin: 0 0 10px; }
.tree-level { background: rgba(255, 255, 255, .72); border: 1px solid var(--line); border-radius: 10px; padding: 8px; margin-bottom: 7px; }
.tree-level summary { cursor: pointer; font-weight: 700; }
.tree-level.nested { margin: 8px 0 0 10px; background: #f8fafc; }
.tree-level.nested summary a { display: inline-flex; align-items: center; gap: 7px; color: var(--text); }
.country-flag,
.flag {
    display: inline-grid;
    place-items: center;
    width: 26px;
    min-width: 26px;
    height: 24px;
    font-size: 18px;
    line-height: 1;
}

.brand-mark .icon-svg {
    width: 20px;
    height: 20px;
    color: #2563eb;
}

.user-pill-icon {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: #eff6ff;
    color: #2563eb;
}

.user-pill-icon .icon-svg {
    width: 17px;
    height: 17px;
}

.icon-badge {
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    line-height: 1;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .58);
}

.icon-svg {
    display: block;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-menu {
    width: 34px;
    height: 34px;
}

.icon-menu .icon-svg {
    width: 18px;
    height: 18px;
}

.icon-sm {
    width: 32px;
    height: 32px;
}

.icon-sm .icon-svg {
    width: 17px;
    height: 17px;
}

.icon-md {
    width: 40px;
    height: 40px;
}

.icon-md .icon-svg {
    width: 20px;
    height: 20px;
}

.icon-lg {
    width: 52px;
    height: 52px;
}

.icon-lg .icon-svg {
    width: 23px;
    height: 23px;
}

.icon-region {
    width: 50px;
    height: 50px;
}

.icon-region .icon-svg {
    width: 24px;
    height: 24px;
}

.icon-blue { background: #e0f2fe; color: #0284c7; }
.icon-purple { background: #ede9fe; color: #7c3aed; }
.icon-green { background: #dcfce7; color: #16a34a; }
.icon-orange { background: #ffedd5; color: #ea580c; }
.icon-red { background: #fee2e2; color: #dc2626; }
.icon-yellow { background: #fef3c7; color: #b7791f; }
.icon-slate { background: #f1f5f9; color: #475569; }
.icon-europe { background: #dbeafe; color: #2563eb; }
.icon-asia { background: #ede9fe; color: #7c3aed; }
.icon-north-america { background: #cffafe; color: #0891b2; }
.icon-south-america { background: #dcfce7; color: #16a34a; }
.icon-africa { background: #ffedd5; color: #ea580c; }
.icon-middle-east { background: #fef3c7; color: #b7791f; }
.icon-oceania { background: #e0f2fe; color: #0284c7; }
.icon-russia { background: #eef2ff; color: #2563eb; }
.icon-world { background: #e2e8f0; color: #475569; }
.icon-other { background: #f1f5f9; color: #475569; }
.tree-level ul { margin: 8px 0 0 20px; padding: 0; }
.tree-level p { margin: 7px 0 0; }
.small-text { font-size: 15px; }
.content { padding: 28px; min-width: 0; width: 100%; max-width: 100%; overflow-x: hidden; }
.top-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: stretch;
    max-width: 100%;
    margin: 0 0 20px;
    padding: 8px;
    overflow: visible;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(248, 251, 255, .94));
    box-shadow: 0 12px 30px rgba(15, 23, 42, .05);
}
.top-nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    flex: 1 1 108px;
    min-width: 0;
    min-height: 38px;
    padding: 8px 9px;
    border: 1px solid #dbe6f3;
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    font-size: 15px;
    font-weight: 700;
    white-space: normal;
    text-align: center;
    box-shadow: 0 6px 15px rgba(15, 23, 42, .035);
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, color .15s ease;
}
.top-nav-link:hover {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
    box-shadow: 0 8px 18px rgba(37, 99, 235, .08);
}
.top-nav-link.active {
    border-color: #93c5fd;
    background: #dbeafe;
    color: #1d4ed8;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .12), 0 10px 22px rgba(37, 99, 235, .12);
}
.top-nav-icon {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    color: #2563eb;
}
.top-nav-icon .icon-svg {
    width: 18px;
    height: 18px;
}
.page-header { margin-bottom: 18px; }
.page-header h1 { font-size: 32px; line-height: 1.15; margin: 0 0 6px; color: var(--heading); font-weight: 800; }
.page-header p { margin: 0; color: var(--muted); max-width: 900px; }
.panel { border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 16px; margin-bottom: 16px; box-shadow: var(--soft-shadow); min-width: 0; max-width: 100%; }
.warning-panel { background: #fffbeb; border-color: #fde68a; }
.status-strip { min-height: 72px; display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; background: #fff; }
.badge { display: inline-block; border-radius: 999px; padding: 3px 8px; font-size: 14px; line-height: 1.2; }
.badge.warn { background: var(--yellow); border: 1px solid #fde68a; }
.actions-row { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin-bottom: 16px; }
.button, .small-button { border: 1px solid #b7d7ef; background: var(--button); color: var(--text); border-radius: 8px; padding: 8px 12px; font-size: 16px; cursor: pointer; display: inline-block; }
.button.primary { background: var(--button-strong); font-weight: 700; }
.button:disabled { opacity: .55; cursor: not-allowed; }
.small-button { font-size: 14px; padding: 6px 9px; }
.small-button.danger { background: var(--red); border-color: #fecaca; }
.form-panel { display: grid; gap: 10px; max-width: 980px; }
.form-panel label { font-weight: 700; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px; font: inherit; background: #fff; }
textarea { resize: vertical; }
.table-wrap { min-width: 0; max-width: 100%; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; min-width: 860px; max-width: none; }
.table-wrap table { width: max-content; min-width: 100%; }
.table-panel {
    overflow: hidden;
}
.bulk-table-panel {
    overflow: visible;
}
.table-scroll {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}
.table-scroll table {
    width: 100%;
    min-width: 1200px;
}
.table-scroll .data-table {
    max-width: none;
    min-width: 1080px;
}
.countries-table {
    min-width: 1200px;
}
.table-scroll .messages-table,
.messages-table {
    min-width: 980px;
}
.table-scroll .ai-spam-table,
.ai-spam-table {
    min-width: 900px;
}
.table-scroll .deleted-table,
.deleted-table {
    min-width: 980px;
}
th, td { border-bottom: 1px solid var(--line); padding: 9px 10px; text-align: left; vertical-align: top; }
th { background: #f8fafc; font-size: 15px; }
.bulk-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 0 12px;
}
.bulk-action-bar {
    position: sticky;
    top: 12px;
    z-index: 20;
    margin: -2px -2px 12px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 12px 28px rgba(15, 23, 42, .08);
    backdrop-filter: none;
}
.bulk-table-panel.has-floating-bulk {
    padding-top: calc(var(--bulk-bar-height, 0px) + 14px);
}
.bulk-action-bar.is-floating {
    position: fixed;
    top: var(--bulk-fixed-top, 92px);
    left: var(--bulk-fixed-left, 320px);
    width: var(--bulk-fixed-width, calc(100vw - 340px));
    max-width: calc(100vw - var(--bulk-fixed-left, 320px) - 18px);
    margin: 0;
    padding: 10px;
    z-index: 900;
}
.bulk-action-placeholder {
    flex: 0 0 auto;
    width: 100%;
    margin-bottom: 12px;
}
.bulk-action-bar .small-button:disabled {
    cursor: not-allowed;
    opacity: .48;
}
.bulk-actions span {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
    margin-right: 4px;
}
.bulk-actions strong {
    color: var(--text);
}
.select-cell {
    width: 38px;
    min-width: 38px;
    text-align: center;
}
.bulk-checkbox {
    width: 17px;
    height: 17px;
    accent-color: #2563eb;
}
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; min-width: 260px; }
.row-actions form { display: inline; }
.table-wrap .row-actions,
.table-scroll .row-actions { min-width: 220px; max-width: 300px; }
.table-wrap .row-actions form,
.table-scroll .row-actions form { display: flex; flex-wrap: wrap; gap: 6px; }
.message-text { max-width: min(420px, 34vw); white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.message-cell {
    width: clamp(320px, 30vw, 520px);
    min-width: 300px;
    max-width: 520px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.message-preview {
    display: -webkit-box;
    max-width: 520px;
    max-height: 4.35em;
    overflow: hidden;
    line-height: 1.45;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
}
.message-details {
    margin-top: 7px;
}
.message-details summary {
    display: inline-flex;
    cursor: pointer;
    color: #1d4ed8;
    font-size: 14px;
    font-weight: 700;
}
.message-details-body {
    margin-top: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8fafc;
}
.message-details-body h3 {
    margin: 0 0 8px;
    font-size: 15px;
}
.message-full {
    max-width: 760px;
    margin: 0 0 10px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.technical-details {
    display: grid;
    gap: 6px;
    margin: 0;
}
.technical-details div {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 10px;
}
.technical-details dt {
    color: var(--muted);
    font-weight: 700;
}
.technical-details dd {
    margin: 0;
    overflow-wrap: anywhere;
}
.technical-details dd span {
    color: var(--muted);
    font-size: 13px;
}
.datetime-cell {
    min-width: 118px;
    white-space: nowrap;
}
.place-cell,
.author-cell {
    min-width: 132px;
    max-width: 180px;
}
.place-cell strong,
.author-cell strong {
    display: block;
}
.place-cell small,
.author-cell small {
    display: block;
    color: var(--muted);
    margin-top: 2px;
}
.rules-cell {
    max-width: 260px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    font-size: 13px;
    color: var(--muted);
}
.risk-cell {
    width: 64px;
    min-width: 58px;
    white-space: nowrap;
}
.verdict-cell {
    width: 112px;
    min-width: 96px;
}
.reason-cell {
    width: clamp(140px, 16vw, 240px);
    min-width: 132px;
    max-width: 240px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.deleted-by-cell {
    width: 120px;
    min-width: 108px;
    overflow-wrap: anywhere;
}
.actions-cell {
    width: 132px;
    min-width: 118px;
    max-width: 150px;
}
.messages-table .compact-actions-cell {
    width: 130px;
    min-width: 120px;
    max-width: 140px;
}
.action-menu {
    width: 118px;
}
.action-menu summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 118px;
    border: 1px solid #b7d7ef;
    background: var(--button);
    color: var(--text);
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    list-style: none;
}
.action-menu summary::-webkit-details-marker {
    display: none;
}
.action-menu-body {
    display: grid;
    gap: 6px;
    width: 190px;
    margin-top: 8px;
}
.action-menu-body form {
    display: grid;
    gap: 6px;
}
.action-menu-body .small-button {
    width: 100%;
    text-align: left;
    white-space: normal;
}
.table-scroll .small-button {
    white-space: nowrap;
}
.table-scroll .action-menu-body .small-button {
    white-space: normal;
}
.action-menu-divider {
    height: 1px;
    margin: 4px 0;
    background: var(--line);
}
.feedback-button {
    background: #eef6ff;
    border-color: #bfdbfe;
}
.model-picker-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.model-picker-row input[type="search"] {
    flex: 1 1 420px;
    min-width: min(100%, 320px);
}
.model-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0;
}
.model-filter {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f8fafc;
    color: var(--text);
    padding: 7px 11px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}
.model-filter.active,
.model-filter:hover {
    border-color: #93c5fd;
    background: #dbeafe;
    color: #1d4ed8;
}
.model-choice-list {
    display: grid;
    gap: 8px;
    max-height: 360px;
    overflow-y: auto;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #f8fafc;
}
.model-choice {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
}
.model-choice:hover {
    border-color: #93c5fd;
    background: #f8fbff;
}
.model-choice.selected {
    border-color: #60a5fa;
    background: #eff6ff;
    box-shadow: inset 0 0 0 1px #bfdbfe;
}
.model-choice span {
    display: grid;
    gap: 3px;
    min-width: 0;
}
.model-choice strong {
    font-size: 15px;
    font-weight: 700;
}
.model-choice small {
    color: var(--muted);
    font-size: 13px;
    overflow-wrap: anywhere;
}
.model-choice em {
    flex: 0 0 auto;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    padding: 5px 8px;
    font-size: 13px;
    font-style: normal;
    font-weight: 700;
}
.model-choice.current em {
    background: #dcfce7;
    color: #166534;
}
.model-choice.is-hidden {
    display: none;
}
.model-empty {
    margin: 0;
    padding: 14px;
    color: var(--muted);
    font-weight: 700;
    text-align: center;
}
.model-picker-note {
    margin-top: 10px;
}
.empty, .muted { color: var(--muted); }
.notice {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 14px;
    background: #fff;
    box-shadow: var(--soft-shadow);
    font-weight: 700;
}
.notice.success {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}
.notice.error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}
.notice a {
    margin-left: 8px;
}
.recommendation-cell {
    min-width: 150px;
}
.recommendation-cell form {
    margin: 0;
}
.recommendation-cell .small-button {
    white-space: normal;
    text-align: center;
}
.soft-badge.danger {
    background: #fee2e2;
    color: #991b1b;
}
.spam-category-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}
.spam-category-strip span {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f8fafc;
    color: var(--muted);
    padding: 6px 10px;
    font-size: 14px;
}
.spam-category-strip b {
    color: var(--text);
}
.result-grid, .detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.detail-grid span { display: block; color: var(--muted); margin-bottom: 4px; }
.detail-grid strong { font-size: 20px; word-break: break-word; }
.helper-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
    margin: 12px 0 4px;
}
.helper-grid p {
    margin: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8fafc;
    color: var(--muted);
    font-size: 14px;
}
.region-refresh-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-top: 12px; }
.region-refresh-card { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; padding: 10px; }
.region-refresh-card a { font-weight: 700; color: var(--text); }
.region-refresh-card span { color: var(--muted); font-size: 14px; }
.region-refresh-card button { grid-column: 1 / -1; justify-self: start; margin-top: 4px; }
.filters { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.filters input, .filters select { max-width: 260px; }
.two-columns { grid-template-columns: minmax(0, 1fr) minmax(280px, 420px); align-items: start; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; margin: 7px 0; }
.check input { width: auto; }
.nested { margin-left: 22px; font-size: 15px; color: var(--muted); }
.recipient-block { padding: 9px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; }
.preview-box { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #f8fafc; }
.preview-box h2 { margin: 0 0 8px; font-size: 19px; }
.preview-box strong { display: block; margin-bottom: 8px; }
.plain-list { padding-left: 22px; }
.note { background: var(--yellow); border: 1px solid #fde68a; padding: 12px; border-radius: 8px; }
pre { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow-x: auto; }
@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
    .content { padding: 20px; }
    .two-columns { grid-template-columns: 1fr; }
    .page-header h1 { font-size: 28px; }
}

/* App layout */
.sidebar-toggle {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1000;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid #b7d7ef;
    background: #e0f2fe;
    color: #1f2933;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 15px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .08);
}

.sidebar-toggle .icon-svg {
    width: 18px;
    height: 18px;
    color: #2563eb;
}

.brand {
    margin-top: 40px;
}

.layout {
    transition: grid-template-columns .18s ease;
}

.layout.sidebar-collapsed {
    grid-template-columns: 0 minmax(0, 1fr);
}

.layout.sidebar-collapsed .sidebar {
    transform: translateX(-110%);
    visibility: hidden;
    pointer-events: none;
    padding-left: 0;
    padding-right: 0;
    border-right: 0;
    overflow: hidden;
}

.layout.sidebar-collapsed .content {
    padding-left: 60px;
}

.posting-page-header {
    margin-bottom: 14px;
}

.posting-form-v3 {
    max-width: none;
}

.posting-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(420px, 44vw);
    gap: 18px;
    align-items: start;
}

.posting-compose-card,
.posting-recipients-card {
    margin-bottom: 0;
}

.posting-compose-card {
    display: grid;
    gap: 14px;
}

.posting-compose-card label {
    font-weight: 700;
}

.posting-preview-inside h2,
.posting-section-head h2 {
    margin: 0 0 5px;
    font-size: 22px;
    font-weight: 700;
    color: var(--heading);
}

.posting-preview {
    min-height: 150px;
    white-space: pre-wrap;
}

.posting-actions {
    margin-bottom: 0;
}

.posting-recipients-card {
    display: flex;
    flex-direction: column;
}

.posting-section-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.selected-counter {
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f8fafc;
    padding: 6px 10px;
    font-size: 14px;
    color: var(--muted);
    white-space: nowrap;
}

.recipient-toolbar {
    display: grid;
    grid-template-columns: minmax(200px, 1fr) auto auto auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.select-all-row {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: #f8fafc;
    font-weight: 700;
    margin: 0 0 10px;
}

.recipient-tree {
    flex: 1;
    min-height: 300px;
    max-height: 620px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.recipient-region {
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
}

.recipient-region:last-child {
    border-bottom: 0;
}

.recipient-region > summary {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-weight: 700;
    font-size: 18px;
}

.recipient-region-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0;
}

.recipient-country {
    border: 1px solid var(--line);
    border-radius: 9px;
    margin: 8px 0 0;
    background: #f8fafc;
}

.recipient-country > summary {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 8px 10px;
}

.country-label {
    margin: 0;
    font-weight: 700;
    color: var(--text);
}

.recipient-count {
    color: var(--muted);
    font-size: 14px;
    white-space: nowrap;
}

.recipient-cities {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    gap: 4px 12px;
    padding: 4px 12px 12px 34px;
}

.city-label {
    margin: 4px 0;
    font-size: 15px;
}

.recipient-empty {
    padding: 0 12px 12px 34px;
}

@media (max-width: 1150px) {
    .posting-workspace {
        grid-template-columns: 1fr;
    }

    .posting-recipients-card {
        position: static;
        max-height: none;
    }

    .recipient-tree {
        max-height: 520px;
    }

    .recipient-toolbar {
        grid-template-columns: 1fr 1fr;
    }
}


/* Posting recipients */
.country-summary-title {
    font-weight: 700;
    color: var(--text);
}

.recipient-country-body {
    padding: 4px 12px 12px 34px;
}

.common-chat-label {
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    border-radius: 8px;
    padding: 7px 9px;
    margin: 4px 0 8px;
    font-weight: 700;
}

.common-chat-disabled {
    border: 1px dashed var(--line);
    background: #f8fafc;
    color: var(--muted);
    border-radius: 8px;
    padding: 7px 9px;
    margin: 4px 0 8px;
    font-size: 15px;
}

.recipient-country-body .recipient-cities {
    padding-left: 0;
}


/* Posting recipients UI */
.country-bulk-label {
    margin: 0;
    font-weight: 700;
    color: var(--text);
}

.country-bulk-label input {
    margin-right: 4px;
}

.country-bulk-label input:disabled + span {
    color: var(--muted);
}

.history-text,
.history-result {
    margin-top: 10px;
}

.history-text strong,
.history-result strong {
    display: block;
    margin-bottom: 4px;
}

.posting-compose-card,
.posting-recipients-card {
    min-width: 0;
}

.history-item,
.history-text,
.history-result,
.history-item pre,
.posting-preview,
.preview-box {
    max-width: 100%;
    min-width: 0;
}

.history-item pre,
.history-text pre,
.history-result pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    overflow-x: auto;
}

/* Dashboard */
.dashboard-hero {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 22px;
}

.dashboard-hero h1 {
    margin: 0 0 6px;
    font-size: 34px;
    font-weight: 800;
    color: var(--heading);
    letter-spacing: 0;
}

.dashboard-hero p,
.card-head p {
    margin: 0;
    color: var(--muted);
}

.dashboard-user-pill {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .86);
    border-radius: 14px;
    padding: 10px 13px;
    box-shadow: var(--soft-shadow);
}

.dashboard-hero-side {
    display: grid;
    justify-items: end;
    gap: 10px;
    width: min(340px, 34vw);
    min-width: 0;
}

.openrouter-compact-card {
    width: 100%;
    max-width: 340px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, .9);
    box-shadow: var(--soft-shadow);
    padding: 12px 14px;
}

.openrouter-compact-card h2 {
    margin: 0 0 8px;
    color: var(--heading);
    font-size: 16px;
    line-height: 1.2;
    font-weight: 800;
}

.openrouter-compact-card dl {
    display: grid;
    gap: 5px;
    margin: 0;
}

.openrouter-compact-card div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.openrouter-compact-card dt,
.openrouter-compact-card dd {
    margin: 0;
    font-size: 13px;
    line-height: 1.25;
}

.openrouter-compact-card dt {
    color: var(--muted);
    font-weight: 600;
}

.openrouter-compact-card dd {
    color: var(--text);
    font-weight: 700;
    text-align: right;
    overflow-wrap: anywhere;
}

.dashboard-kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.dashboard-kpi-card,
.dashboard-card,
.region-tile {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .92);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.dashboard-kpi-card {
    min-height: 112px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--text);
    min-width: 0;
}

.dashboard-kpi-card span {
    min-width: 0;
}

.dashboard-kpi-card small,
.spam-kpi small,
.activity-row small,
.send-row small,
.attention-row small,
.region-tile small,
.region-country-row small,
.spam-country-row small {
    display: block;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.dashboard-kpi-card strong {
    display: block;
    margin: 5px 0 2px;
    font-size: 24px;
    font-weight: 700;
    color: var(--heading);
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.dashboard-kpi-card em,
.region-tile em {
    color: var(--muted);
    font-size: 14px;
    font-style: normal;
}

.dashboard-kpi-card .icon-badge {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .68), 0 10px 24px rgba(15, 23, 42, .04);
}

.dashboard-main-grid {
    display: grid;
    grid-template-columns: 1.05fr 1.1fr minmax(320px, .9fr);
    gap: 16px;
    margin-bottom: 16px;
}

.dashboard-card {
    padding: 18px;
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.card-head h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--heading);
    line-height: 1.25;
    letter-spacing: 0;
}

.card-head a,
.mini-link {
    color: #2563eb;
    font-size: 14px;
    font-weight: 700;
}

.system-list,
.attention-list,
.send-list,
.activity-list,
.spam-country-list {
    display: grid;
    gap: 8px;
}

.system-row,
.attention-row,
.send-row,
.activity-row,
.spam-country-row,
.region-country-row {
    display: grid;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-size: 16px;
}

.system-row > span,
.attention-row strong,
.send-row strong,
.activity-row strong,
.spam-country-row strong,
.region-country-row strong {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
}

.system-row {
    grid-template-columns: 34px 1fr auto;
    border-bottom: 1px solid var(--line);
    padding: 9px 0;
}

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

.soft-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.soft-badge.ok {
    background: #dcfce7;
    color: #15803d;
}

.soft-badge.warn {
    background: #fef3c7;
    color: #92400e;
}

.system-note {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.system-note span {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 8px;
    border-radius: 999px;
    background: #22c55e;
}

.attention-row {
    grid-template-columns: 34px 1fr auto;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
}

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

.send-row {
    grid-template-columns: 34px 1fr auto;
    border-bottom: 1px solid var(--line);
    padding: 9px 0;
}

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

.send-meta {
    text-align: right;
}

.empty-state {
    margin: 0;
    color: var(--muted);
    border: 1px dashed var(--line);
    background: #f8fafc;
    border-radius: 12px;
    padding: 18px;
}

.spam-dashboard {
    margin-bottom: 16px;
}

.spam-kpi-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(120px, 1fr));
    gap: 12px;
}

.spam-kpi {
    min-height: 118px;
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 14px;
    color: var(--text);
    background: #fff;
}

.spam-kpi .icon-badge {
    margin-bottom: 10px;
}

.spam-kpi strong {
    display: block;
    margin-top: 6px;
    font-size: 24px;
    font-weight: 800;
    color: var(--heading);
}

.dashboard-lower-grid {
    display: grid;
    grid-template-columns: minmax(0, .9fr) minmax(360px, .7fr);
    gap: 16px;
    margin-bottom: 16px;
}

.activity-row {
    grid-template-columns: 34px 1fr auto;
    border-bottom: 1px solid var(--line);
    padding: 9px 0;
}

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

.activity-row time {
    color: var(--muted);
    font-size: 14px;
    text-align: right;
}

.spam-country-row {
    grid-template-columns: 34px 1fr auto;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
}

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

.spam-country-meta {
    text-align: right;
}

.spam-country-meta b {
    color: #dc2626;
    font-weight: 800;
}

.region-overview {
    margin-bottom: 0;
}

.region-tile-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(220px, 1fr));
    gap: 12px;
}

.region-tile {
    overflow: hidden;
}

.region-tile summary {
    list-style: none;
    display: grid;
    grid-template-columns: 56px 1fr auto 16px;
    gap: 12px;
    align-items: center;
    padding: 14px;
    cursor: pointer;
}

.region-tile summary::-webkit-details-marker {
    display: none;
}

.region-tile summary > b {
    font-size: 22px;
    font-weight: 800;
    color: var(--heading);
}

.region-tile summary > i {
    color: var(--muted);
    font-size: 24px;
    font-style: normal;
    transition: transform .18s ease;
}

.region-tile[open] summary > i {
    transform: rotate(90deg);
}

.region-panel {
    border-top: 1px solid var(--line);
    background: #fbfdff;
    padding: 8px 12px 12px;
}

.region-country-row {
    grid-template-columns: 34px 1fr auto;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
}

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

.region-country-row > span:last-child {
    text-align: right;
}

@media (max-width: 1350px) {
    .dashboard-kpi-grid {
        grid-template-columns: repeat(3, minmax(180px, 1fr));
    }

    .dashboard-main-grid,
    .dashboard-lower-grid {
        grid-template-columns: 1fr;
    }

    .spam-kpi-grid,
    .region-tile-grid {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }
}

@media (max-width: 1440px) {
    body {
        font-size: 16px;
    }

    .layout {
        grid-template-columns: 260px minmax(0, 1fr);
    }

    .content {
        padding: 22px;
    }

    .sidebar {
        padding-left: 14px;
        padding-right: 12px;
    }

    .top-nav {
        gap: 7px;
        padding: 7px;
    }

    .top-nav-link {
        flex: 1 1 96px;
        min-height: 36px;
        padding: 7px 7px;
        font-size: 13px;
    }

    .top-nav-icon {
        width: 18px;
        height: 18px;
    }

    .top-nav-icon .icon-svg {
        width: 15px;
        height: 15px;
    }

    .dashboard-hero {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
    }

    .dashboard-hero-side {
        width: 100%;
        min-width: 0;
    }

    .dashboard-kpi-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .dashboard-kpi-card {
        min-height: 96px;
        padding: 14px;
    }

    .dashboard-kpi-card strong {
        font-size: 22px;
    }

    .openrouter-compact-card div {
        grid-template-columns: minmax(0, 1fr);
        gap: 2px;
    }

    .openrouter-compact-card dd {
        text-align: left;
    }

    .bulk-actions {
        gap: 6px;
    }

    .bulk-actions .small-button {
        padding: 6px 8px;
        font-size: 13px;
    }

    .table-scroll .messages-table,
    .messages-table {
        min-width: 940px;
    }

    .table-scroll .ai-spam-table,
    .ai-spam-table {
        min-width: 900px;
    }

    .table-scroll .deleted-table,
    .deleted-table {
        min-width: 900px;
    }

    .message-cell {
        width: clamp(280px, 28vw, 460px);
        min-width: 260px;
        max-width: 460px;
    }

    .message-preview {
        max-width: 460px;
        max-height: 3.9em;
        line-height: 1.3;
        -webkit-line-clamp: 3;
        line-clamp: 3;
    }

    th,
    td {
        padding: 8px 8px;
    }
}

@media (max-width: 1440px) {
    .messages-table,
    .ai-spam-table,
    .deleted-table,
    .table-scroll .messages-table,
    .table-scroll .ai-spam-table,
    .table-scroll .deleted-table {
        display: block;
        width: 100%;
        min-width: 0 !important;
    }

    .messages-table thead,
    .ai-spam-table thead,
    .deleted-table thead {
        display: none;
    }

    .messages-table tbody,
    .ai-spam-table tbody,
    .deleted-table tbody {
        display: grid;
        gap: 12px;
    }

    .messages-table tr,
    .ai-spam-table tr,
    .deleted-table tr {
        display: grid;
        grid-template-columns: 32px minmax(0, 1fr) 124px;
        gap: 6px 10px;
        align-items: start;
        width: 100%;
        padding: 12px;
        border: 1px solid var(--line);
        border-radius: 14px;
        background: #fff;
        box-shadow: 0 8px 20px rgba(15, 23, 42, .045);
    }

    .messages-table td,
    .ai-spam-table td,
    .deleted-table td {
        min-width: 0;
        max-width: 100%;
        padding: 0;
        border-bottom: 0;
    }

    .messages-table .select-cell,
    .ai-spam-table .select-cell,
    .deleted-table .select-cell {
        grid-column: 1;
        grid-row: 1 / span 3;
        width: 32px;
        min-width: 32px;
        padding-top: 2px;
    }

    .messages-table .datetime-cell,
    .ai-spam-table .datetime-cell,
    .deleted-table .datetime-cell {
        grid-column: 2;
        grid-row: 1;
        min-width: 0;
        color: var(--muted);
        font-size: 13px;
        white-space: normal;
    }

    .messages-table .place-cell,
    .ai-spam-table .place-cell,
    .deleted-table .place-cell {
        grid-column: 2;
        grid-row: 2;
        min-width: 0;
        max-width: none;
    }

    .messages-table .author-cell,
    .ai-spam-table .author-cell,
    .deleted-table .author-cell {
        grid-column: 2;
        grid-row: 3;
        min-width: 0;
        max-width: none;
    }

    .messages-table .message-cell,
    .ai-spam-table .message-cell,
    .deleted-table .message-cell {
        grid-column: 1 / -1;
        grid-row: 4;
        width: 100%;
        min-width: 0;
        max-width: none;
        padding-top: 4px;
    }

    .messages-table .message-preview,
    .ai-spam-table .message-preview,
    .deleted-table .message-preview {
        max-width: none;
    }

    .messages-table td[data-label="Статус"] {
        grid-column: 2;
        grid-row: 5;
        font-weight: 700;
    }

    .ai-spam-table .risk-cell {
        grid-column: 2;
        grid-row: 5;
        width: auto;
        min-width: 0;
        font-weight: 800;
    }

    .ai-spam-table .verdict-cell {
        grid-column: 2;
        grid-row: 6;
        width: auto;
        min-width: 0;
    }

    .deleted-table .reason-cell {
        grid-column: 2;
        grid-row: 5;
        width: auto;
        min-width: 0;
        max-width: none;
    }

    .deleted-table .deleted-by-cell {
        grid-column: 3;
        grid-row: 1;
        justify-self: end;
        width: auto;
        min-width: 0;
        max-width: 118px;
        color: var(--muted);
        font-size: 13px;
    }

    .messages-table .actions-cell,
    .ai-spam-table .actions-cell,
    .messages-table .compact-actions-cell,
    .ai-spam-table .compact-actions-cell {
        grid-column: 3;
        grid-row: 1 / span 3;
        justify-self: end;
        width: 118px;
        min-width: 118px;
        max-width: 118px;
    }

    .messages-table .action-menu,
    .messages-table .action-menu summary,
    .ai-spam-table .action-menu,
    .ai-spam-table .action-menu summary {
        width: 108px;
    }
}

@media (max-width: 1280px) {
    .layout {
        grid-template-columns: 240px minmax(0, 1fr);
    }

    .layout.sidebar-collapsed .content {
        padding-left: 54px;
    }

    .content {
        padding: 18px;
    }

    .brand {
        font-size: 21px;
    }

    .tree-level {
        padding: 7px;
    }

    .page-header h1 {
        font-size: 28px;
    }

    .top-nav-link {
        flex-basis: 88px;
        gap: 5px;
        font-size: 12px;
    }

    .top-nav-icon {
        width: 18px;
        height: 18px;
    }

    .top-nav-icon .icon-svg {
        width: 15px;
        height: 15px;
    }

    .panel {
        padding: 14px;
    }

    .table-scroll .messages-table,
    .messages-table {
        min-width: 880px;
    }

    .table-scroll .ai-spam-table,
    .ai-spam-table {
        min-width: 860px;
    }

    .table-scroll .deleted-table,
    .deleted-table {
        min-width: 820px;
    }

    .datetime-cell {
        min-width: 100px;
        white-space: normal;
    }

    .place-cell,
    .author-cell {
        min-width: 104px;
        max-width: 132px;
    }

    .message-cell {
        width: clamp(200px, 24vw, 360px);
        min-width: 200px;
        max-width: 360px;
    }

    .message-preview {
        max-width: 360px;
    }

    .risk-cell {
        width: 56px;
        min-width: 52px;
    }

    .verdict-cell {
        width: 92px;
        min-width: 86px;
    }

    .reason-cell {
        width: 138px;
        min-width: 126px;
        max-width: 148px;
    }

    .actions-cell,
    .messages-table .compact-actions-cell {
        width: 118px;
        min-width: 112px;
        max-width: 124px;
    }

    .action-menu,
    .action-menu summary {
        width: 108px;
    }

    .action-menu-body {
        width: 180px;
    }
}

@media (max-width: 1100px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        max-height: 34vh;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .layout.sidebar-collapsed .content,
    .content {
        padding: 16px;
    }

    .bulk-action-bar.is-floating {
        left: 12px;
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
    }

    .bulk-actions .small-button {
        flex: 1 1 160px;
        white-space: normal;
    }

    .bulk-actions span {
        flex: 1 0 100%;
    }

    .table-scroll .messages-table,
    .messages-table {
        min-width: 820px;
    }

    .table-scroll .ai-spam-table,
    .ai-spam-table {
        min-width: 860px;
    }

    .table-scroll .deleted-table,
    .deleted-table {
        min-width: 0;
    }

    .message-cell {
        min-width: 190px;
        max-width: 320px;
    }

    .message-preview {
        max-width: 320px;
    }

    .reason-cell {
        min-width: 120px;
        max-width: 140px;
    }

    .technical-details div {
        grid-template-columns: 1fr;
        gap: 2px;
    }
}

@media (max-width: 760px) {
    .top-nav {
        overflow-x: visible;
    }

    .top-nav-link {
        flex: 1 1 120px;
        white-space: normal;
    }

    .dashboard-hero {
        display: block;
    }

    .dashboard-hero-side {
        width: 100%;
        justify-items: start;
        margin-top: 12px;
    }

    .dashboard-user-pill,
    .openrouter-compact-card {
        max-width: 340px;
    }

    .dashboard-kpi-grid,
    .spam-kpi-grid,
    .region-tile-grid {
        grid-template-columns: 1fr;
    }

    .system-row,
    .attention-row,
    .send-row,
    .activity-row,
    .spam-country-row,
    .region-country-row {
        grid-template-columns: 30px 1fr;
    }

    .send-meta,
    .activity-row time,
    .spam-country-meta,
    .region-country-row > span:last-child {
        grid-column: 2;
        text-align: left;
    }
}
