/* Админка «Мигрант24»: крупный читаемый интерфейс для неопытного администратора (§3.1 п. 11). */
:root {
  --bg: #f4f6f9; --card: #fff; --fg: #1d2330; --muted: #5b6475; --line: #d5dae3;
  --accent: #1f5fa8; --accent-fg: #fff; --ok: #2e7d32; --warn: #a15c00; --warn-bg: #fff4d6;
  --error: #b3261e; --error-bg: #fdecea; --notice-bg: #e8f1fb;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 18px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 28px; margin: 8px 0 16px; }
h2 { font-size: 22px; }
.page { max-width: 1100px; margin: 0 auto; padding: 16px; }
.page.wide { max-width: 1500px; }

.env-banner { background: #ffd54f; color: #3d2c00; font-weight: 700; text-align: center; padding: 8px 16px; font-size: 17px; }
.topbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; background: #fff; border-bottom: 1px solid var(--line); padding: 8px 16px; }
.brand { font-weight: 700; font-size: 20px; text-decoration: none; color: var(--fg); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav a { padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--fg); }
.nav a.active, .nav a:hover { background: var(--notice-bg); color: var(--accent); }
.logout { display: flex; align-items: center; gap: 8px; margin: 0; }
.who { color: var(--muted); }

.card { background: var(--card); padding: 16px 20px; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.08); margin: 12px 0; }
label { display: block; margin: 8px 0; }
label.check { display: inline-flex; gap: 8px; align-items: center; margin-right: 16px; }
input, select, textarea { font: inherit; padding: 10px 12px; border: 1px solid #b9c0cc; border-radius: 8px; background: #fff; color: var(--fg); }
input:not([type=checkbox]):not([type=radio]), textarea { width: 100%; }
label > input, label > select, label > textarea { display: block; margin-top: 4px; }
label.check > input { margin: 0; width: 20px; height: 20px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 12px 0; }
legend { font-weight: 600; padding: 0 6px; }

button, a.big { font: inherit; padding: 10px 18px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-fg); cursor: pointer; margin: 4px 0; text-decoration: none; display: inline-block; }
button:hover { filter: brightness(1.08); }
button.secondary { background: #e3e7ee; color: var(--fg); }
button.danger { background: var(--error); }
button.small { padding: 6px 12px; font-size: 16px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #f2a900; outline-offset: 2px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
form.inline { display: inline; margin: 0; }

.big-buttons { display: flex; gap: 16px; flex-wrap: wrap; margin: 24px 0; }
.big-buttons form { margin: 0; }
a.big, button.big { font-size: 24px; padding: 28px 40px; min-width: 240px; display: inline-flex; align-items: center; justify-content: center; text-align: center; border-radius: 14px; margin: 0; }
.stats { list-style: none; padding: 0; display: flex; gap: 24px; flex-wrap: wrap; }

.notice { background: var(--notice-bg); padding: 12px 16px; border-radius: 8px; }
.error { color: var(--error); font-weight: 600; }
div.error, p.error[role=alert] { background: var(--error-bg); padding: 12px 16px; border-radius: 8px; }
.warning { color: var(--warn); background: var(--warn-bg); padding: 8px 12px; border-radius: 8px; }
.hint { color: #4a5263; }
.help { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: #e3e7ee; color: var(--fg); font-size: 14px; font-weight: 700; cursor: help; vertical-align: middle; }

.help.open::after { content: attr(data-tip); position: absolute; left: 50%; top: 28px; transform: translateX(-50%); z-index: 40; width: max-content; max-width: 320px; background: #1d2330; color: #fff; font-weight: 400; font-size: 15px; line-height: 1.4; padding: 8px 12px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,.25); white-space: normal; text-align: left; }
.legend { margin-top: 8px; }
.action-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; background: #fff; border-top: 2px solid var(--line); box-shadow: 0 -4px 14px rgba(0,0,0,.08); padding: 10px 24px; }
.page.wide { padding-bottom: 110px; } /* место под нижней панелью статьи */
.action-bar .spacer { flex: 1; }
.action-bar button { font-size: 19px; padding: 12px 22px; margin: 0; }
.action-bar .badge { font-size: 17px; padding: 4px 12px; }
.danger-zone { margin-top: 32px; border: 1px solid #f1c3bf; }
.danger-zone h2 { margin-top: 0; font-size: 20px; }
.langs-sum { display: flex; flex-wrap: wrap; gap: 4px; }
.lang-none { background: #f1f2f4; color: #4a5263; }
details > summary.as-button { display: inline-block; padding: 8px 14px; border-radius: 8px; background: #e3e7ee; font-size: 17px; margin-top: 8px; list-style: none; }
details > summary.as-button::-webkit-details-marker { display: none; }
details[open] > summary.as-button { background: var(--notice-bg); }
.nav a.nav-help { background: #fff4d6; color: #7a4a00; font-weight: 700; }
.howto { font-size: 16px; font-weight: 400; margin-left: 8px; white-space: nowrap; }
.howto::before { content: "?"; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-right: 4px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 13px; font-weight: 700; }
h2.step { font-size: 20px; margin: 20px 0 4px; color: var(--accent); }
.start-here { border-left: 6px solid var(--accent); }
.start-here h2 { margin-top: 0; }
.help-index ol { columns: 2; column-gap: 32px; margin: 0; }
.help-step h2 { margin-top: 0; }
details.help-step > summary { cursor: pointer; list-style: none; }
details.help-step > summary h2 { display: inline; color: var(--accent); }
details.help-step > summary::before { content: "▸ "; color: var(--accent); font-size: 20px; }
details.help-step[open] > summary::before { content: "▾ "; }
.help-step { scroll-margin-top: 12px; }
@media (max-width: 800px) { .help-index ol { columns: 1; } }
.langs-grid { display: grid; grid-template-columns: repeat(2, max-content); gap: 2px 4px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; background: #fff; padding: 12px; border-radius: 12px; }
.filters label { margin: 0; }
table.list { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; }
table.list th, table.list td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.list th { background: #eef1f6; font-size: 16px; }
table.list tr[draggable=true] { cursor: grab; }
td.order { white-space: nowrap; }
td.snippet { color: var(--muted); font-size: 16px; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; background: #e3e7ee; font-size: 16px; }
.badge-published { background: #dff3e1; color: var(--ok); }
.badge-draft { background: #eceff3; color: var(--muted); }
.lang { display: inline-block; font-size: 15px; padding: 1px 6px; margin: 1px; border-radius: 6px; font-weight: 600; }
.lang-ok { background: #dff3e1; color: var(--ok); }
.lang-missing { background: #f1f2f4; color: #8a919e; }
.lang-review { background: var(--warn-bg); color: var(--warn); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 16px; }
details.cat > summary, details > summary { cursor: pointer; padding: 4px 0; }

/* Страница статьи */
#error { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 60; width: min(760px, 94vw); box-shadow: 0 8px 28px rgba(0,0,0,.25); border: 2px solid var(--error); }
#error .close-error { position: absolute; top: 6px; right: 8px; background: transparent; color: var(--error); font-size: 22px; padding: 0 8px; margin: 0; }
.article-head .status-line { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.save-state { color: var(--muted); }
.save-state.warn { color: var(--warn); font-weight: 600; }
.vis.ok { color: var(--ok); }
.vis.no { color: var(--error); }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 24px; align-items: start; }
@media (max-width: 1100px) { .editor-layout { grid-template-columns: 1fr; } }
.common { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
.common .countries { grid-column: 1 / -1; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 16px; }
.tab { background: #e3e7ee; color: var(--fg); }
.tab[aria-selected=true] { background: var(--accent); color: #fff; }
.tab { display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 1.25; padding: 8px 16px; }
.tab small { font-size: 14px; opacity: .9; }
.tab[data-state=missing] small { color: inherit; }
.how-langs { background: #eef4fb; border-left: 6px solid var(--accent); margin: 8px 0; }
.field-label { font-weight: 600; margin-top: 12px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.small-hint { font-size: 16px; margin: 2px 0 6px; }
.editor-sticky { position: sticky; top: 0; z-index: 5; }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; background: #eef1f6; border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; }
.tb-group { display: inline-flex; gap: 4px; flex-wrap: wrap; padding-right: 8px; border-right: 1px solid var(--line); }
.tb-group:last-child { border-right: 0; }
button.tb { background: #fff; color: var(--fg); border: 1px solid #b9c0cc; padding: 8px 12px; font-size: 17px; margin: 0; }
button.tb.more { background: var(--notice-bg); color: var(--accent); font-weight: 600; }
.toolbar-extra { border-radius: 0; border-top: 1px dashed var(--line); background: #f6f8fb; }
button.tb.b { font-weight: 800; } button.tb.i { font-style: italic; } button.tb.u { text-decoration: underline; }
button.tb.danger { background: var(--error-bg); color: var(--error); }
select.tb { font-size: 17px; padding: 8px 10px; }
.image-panel button.danger { margin-left: auto; }
.image-panel { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px; background: var(--warn-bg); border: 1px solid var(--line); border-bottom: 0; box-shadow: 0 4px 8px rgba(0,0,0,.08); }
.image-panel .image-field { display: flex; flex-direction: column; flex: 1 1 240px; margin: 0; font-size: 14px; color: var(--muted); }
.image-panel .image-field input { width: 100%; margin-top: 2px; }
.editor-host .ProseMirror { min-height: 320px; background: #fff; border: 1px solid #b9c0cc; border-radius: 0 0 8px 8px; padding: 16px; outline: none; }
.editor-host .ProseMirror:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(31,95,168,.2); }
.editor-host .ProseMirror p.is-editor-empty:first-child::before { content: attr(data-placeholder); color: #9aa1ad; float: left; height: 0; pointer-events: none; }
.editor-host figure { margin: 12px 0; }
.editor-host figure img { max-width: 100%; }
.editor-host figure[data-size=small] img { width: 33%; }
.editor-host figure[data-size=medium] img { width: 50%; }
.editor-host figure[data-align=center] { text-align: center; }
.editor-host figure[data-align=right] { text-align: right; }
.editor-host figure[data-type=video] { border: 2px dashed #9aa1ad; border-radius: 8px; padding: 6px; background: #f4f6f9; }
.editor-host figure[data-type=video]::before { content: "▶ Видео (чтобы удалить — нажмите на рамку и клавишу Delete)"; display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.editor-host figure[data-type=video] iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; background: #000; }
.editor-host .ProseMirror-selectednode { outline: 3px solid #f2a900; }
.editor-host a[href^="tel:"] { background: #e8f5e9; border-radius: 4px; padding: 0 3px; }
.cover { margin-top: 12px; }
.cover-img { display: block; max-width: 240px; max-height: 160px; border-radius: 8px; margin: 8px 0; }
.preview-col { position: sticky; top: 8px; }
.phone { width: 380px; height: 760px; border: 10px solid #1d2330; border-radius: 36px; background: #fff; overflow: hidden; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.phone-screen { height: 100%; overflow-y: auto; }
dialog { border: 0; border-radius: 12px; padding: 24px; width: min(560px, 92vw); box-shadow: 0 10px 40px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(0,0,0,.4); }
.ask-form h2 { margin-top: 0; }
.ask-form textarea { min-height: 90px; }
.ask-error:empty { display: none; }
