/* ФФУ CMS — admin styles in the federation's brand (blue #0057B7, yellow #FFD700, navy #26235B) */
@font-face { font-family: "Geologica"; src: url("fonts/geologica.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "Roboto Slab"; src: url("fonts/roboto-slab-bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
/* flag emoji where the system has none (Windows): Twemoji drawings, CC-BY 4.0 (fonts/LICENSE-TwemojiCountryFlags.md); cms.js
   sets html.flag-font only there */
@font-face { font-family: "Twemoji Country Flags"; src: url("fonts/twemoji-country-flags.woff2") format("woff2"); unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E0063, U+E0065, U+E0067, U+E006C, U+E006E, U+E0073-E0074, U+E0077, U+E007F; font-display: swap; }

:root {
  --blue: #0057b7; --yellow: #ffd700; --navy: #26235b; --red: #c62828; --green: #1b7f3b;
  --ink: #26235b; --ink-2: #55537a; --ink-3: #6e6c8c; --line: #e4e4ed; --line-2: #cdcddb; --paper: #f6f6fa;
  --sans: "Geologica", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --slab: "Roboto Slab", Georgia, serif;
}
html.flag-font { --sans: "Twemoji Country Flags", "Geologica", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --slab: "Twemoji Country Flags", "Roboto Slab", Georgia, serif; }
* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; font: 400 15px/1.55 var(--sans); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-underline-offset: .2em; }
h1, h2 { font-family: var(--slab); font-weight: 700; letter-spacing: .01em; margin: 0; }
h2 { font-size: 18px; margin-bottom: 14px; }
code { font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; background: #fff; padding: 2px 5px; border: 1px solid var(--line); }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.muted { color: var(--ink-3); }
.ok { color: var(--green); }
.error { color: var(--red); margin: 6px 0 0; font-size: 13px; }

/* layout */
body.app { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; background: var(--navy); color: #fff; padding: 20px 14px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 18px; color: #fff; text-decoration: none; font-family: var(--slab); font-size: 18px; letter-spacing: .06em; }
.brand small { display: block; font: 400 12px/1.3 var(--sans); letter-spacing: .02em; color: rgba(255,255,255,.65); }
.nav-group { margin: 18px 10px 6px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--yellow); }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; color: rgba(255,255,255,.85); text-decoration: none; border-left: 3px solid transparent; }
/* what is waiting for the editors (new sign-ups): a yellow count at the end of the menu item */
.nav-badge { flex: none; min-width: 22px; padding: 0 7px; border-radius: 11px; background: var(--yellow); color: var(--navy); font: 600 12px/20px var(--sans); text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.sidebar nav a:hover { color: #fff; background: rgba(255,255,255,.06); }
.sidebar nav a[aria-current] { color: #fff; border-left-color: var(--yellow); background: rgba(255,255,255,.08); }
.sidebar-foot { margin-top: auto; padding: 16px 10px 0; border-top: 1px solid rgba(255,255,255,.14); font-size: 13px; }
.build-status { display: flex; align-items: center; gap: 8px; color: rgba(255,255,255,.75); text-decoration: none; margin-bottom: 10px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.ok { background: #4cd07d; } .dot.bad { background: #ff6b6b; }
.me { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.me a { color: #fff; text-decoration: none; }
.me .link-btn { color: rgba(255,255,255,.75); }
.main { min-width: 0; padding: 0 32px 64px; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 26px 0 18px; }
.topbar h1 { font-size: 26px; line-height: 1.15; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.content { display: grid; gap: 18px; max-width: 1180px; }
body.guest { display: grid; place-items: center; min-height: 100vh; background: var(--navy); }
body.guest .main { padding: 24px; width: 100%; max-width: 420px; }
body.guest .topbar { display: none; }

@media (max-width: 900px) {
  body.app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 0 6px; }
  .sidebar nav ul { display: contents; }
  .nav-group { width: 100%; margin-top: 10px; }
  .main { padding: 0 16px 48px; }
}

/* components */
.card { background: #fff; border: 1px solid var(--line); padding: 22px 24px; }
.card.narrow { max-width: 520px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border: 1.5px solid var(--navy); background: #fff; color: var(--navy); font: 500 14px/1 var(--sans); text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--navy); color: #fff; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--navy); border-color: var(--navy); }
.btn-primary:disabled { opacity: .7; cursor: progress; }
.btn-ghost { border-color: var(--line-2); }
.btn-danger { border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: .2em; }
.icon-btn { min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid var(--line-2); background: #fff; color: var(--navy); font: 500 13px/1 var(--sans); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { border-color: var(--navy); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn.danger:hover { border-color: var(--red); color: var(--red); }
.flash { padding: 12px 16px; border-left: 4px solid var(--green); background: #fff; }
.flash-error { border-left-color: var(--red); color: var(--red); }
.notice { margin: 0; padding: 12px 16px; background: #fff; border-left: 4px solid var(--yellow); color: var(--ink-2); font-size: 14px; }
.badge { display: inline-block; padding: 2px 7px; font-size: 12px; border: 1px solid var(--line-2); color: var(--ink-2); }
.badge-blue { border-color: var(--blue); color: var(--blue); }
.count { display: inline-block; min-width: 22px; padding: 0 6px; margin-left: 6px; font-size: 12px; text-align: center; background: var(--paper); color: var(--ink-2); }
ul.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: 14px; }

/* dashboard */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.tile { display: flex; align-items: center; gap: 12px; padding: 18px; background: #fff; border: 1px solid var(--line); color: var(--navy); text-decoration: none; font-weight: 500; }
.tile:hover { border-color: var(--blue); color: var(--blue); }
.tile .plus { display: grid; place-items: center; width: 32px; height: 32px; background: var(--blue); color: #fff; font-size: 18px; flex-shrink: 0; }
.sections { list-style: none; margin: 0; padding: 0; columns: 3 200px; }
.sections li { padding: 5px 0; break-inside: avoid; }

/* lists */
.list-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.search { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.search input { width: 320px; max-width: 60vw; }
.search select { width: auto; max-width: 220px; }
.search select.is-set { border-color: var(--blue, #0057b7); box-shadow: inset 0 0 0 1px var(--blue, #0057b7); }   /* a filter in use */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table thead th { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; background: #fbfbfd; }
.table tbody tr:hover { background: #fafaff; }
.table td a { text-decoration: none; font-weight: 500; }
.table td a:hover { text-decoration: underline; }
.row-actions { white-space: nowrap; text-align: right; width: 1%; }
.row-actions form { display: inline; }
.row-actions > * { margin-left: 4px; }
.thumb { width: 44px; height: 44px; object-fit: contain; background: var(--paper); display: block; }
.cell-link { white-space: nowrap; }
/* «Новини»: the cover's thumbnail and its switch — shown on the post's page or not */
.cover-cell { display: flex; align-items: center; gap: 10px; }
.cover-cell form { display: contents; }
.switch { position: relative; flex: none; width: 36px; height: 20px; padding: 0; border: 0; border-radius: 10px; background: var(--line-2); cursor: pointer; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch[aria-checked="true"] { background: var(--green); }
.switch[aria-checked="true"]::after { transform: translateX(16px); }
.switch:hover { filter: brightness(.95); }
.switch:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.switch[aria-busy="true"] { opacity: .6; cursor: progress; }
.pager { display: flex; justify-content: space-between; align-items: center; }
.empty-state { padding: 40px; text-align: center; background: #fff; border: 1px dashed var(--line-2); color: var(--ink-3); }

/* forms */
label, legend { display: block; font-size: 13px; font-weight: 500; color: var(--ink-2); margin: 0 0 6px; padding: 0; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line-2); background: #fff; color: var(--ink); font: 15px/1.4 var(--sans); border-radius: 0;
}
input:focus, select:focus, textarea:focus, .rte-area:focus { outline: none; border-color: var(--navy); box-shadow: inset 0 -3px 0 var(--yellow); }
textarea { resize: vertical; }
textarea.code { font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; min-height: 60vh; white-space: pre; tab-size: 2; }
textarea.code.snippet { min-height: 0; font-size: 12px; }
input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
input[type=file] { font: 13px var(--sans); max-width: 100%; }
.req { color: var(--red); }
.help { margin: 6px 0 0; font-size: 13px; color: var(--ink-3); }
.edit-form .fields { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 18px 20px; background: #fff; border: 1px solid var(--line); padding: 24px; }
.field { grid-column: span 6; min-width: 0; margin: 0; border: 0; padding: 0; }
.field.half { grid-column: span 3; }
.field.third { grid-column: span 2; }
.field.has-error input, .field.has-error textarea, .field.has-error select, .field.has-error .rte-area { border-color: var(--red); }
@media (max-width: 700px) { .field.half, .field.third { grid-column: span 6; } .edit-form .fields { padding: 16px; } }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); font-weight: 400; margin: 0 18px 0 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; }
.form-actions.sticky { position: sticky; bottom: 0; z-index: 5; padding: 14px 0; background: linear-gradient(to top, var(--paper) 70%, rgba(246,246,250,0)); }
.danger-zone { margin-top: 8px; padding-top: 18px; border-top: 1px dashed var(--line-2); }

.media { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.media-preview { width: 150px; min-height: 100px; display: grid; place-items: center; background: var(--paper); border: 1px solid var(--line); overflow: hidden; }
.media-field[data-kind="file"] .media-preview { width: auto; min-width: 150px; min-height: 44px; padding: 8px 12px; }
.media-preview img { width: 100%; height: 100%; max-height: 150px; object-fit: contain; }
.media-preview .empty { font-size: 12px; color: var(--ink-3); padding: 8px; text-align: center; }
.media-actions { display: grid; gap: 8px; justify-items: start; }
.file-link { font-weight: 500; word-break: break-all; }

.repeater .rep-head .label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.rep-rows { display: grid; gap: 10px; margin: 8px 0 10px; }
.rep-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 14px; background: var(--paper); border: 1px solid var(--line); }
.rep-fields { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px 16px; }
.rep-tools { display: flex; flex-direction: column; gap: 4px; }

/* rich text */
.rte { position: relative; border: 1px solid var(--line-2); background: #fff; }
.rte-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); background: #fbfbfd; position: sticky; top: 0; z-index: 3; }
.rte-bar button, .ed-ctx button, .ed-pop button { border: 1px solid transparent; background: none; padding: 6px 9px; font: 13px/1 var(--sans); color: var(--navy); cursor: pointer; }
.rte-bar button:hover, .ed-ctx button:hover, .ed-pop button:hover { border-color: var(--line-2); background: #fff; }
.rte-bar button:disabled { opacity: .35; cursor: default; border-color: transparent; background: none; }
.rte-bar button[data-cmd=undo], .rte-bar button[data-cmd=redo] { display: inline-grid; place-items: center; padding: 4px 7px; }
.rte-bar .sep, .ed-ctx .sep { width: 1px; align-self: stretch; background: var(--line-2); margin: 4px; }
.ed-ctx button[aria-pressed=true], .ed-pop button[aria-pressed=true] { background: var(--navy); border-color: var(--navy); color: #fff; }
/* the second row: tools for the selected table, photo, photo block or document */
.ed-ctx { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 3px; padding: 5px 8px; border-bottom: 1px solid var(--line); background: #fff8d6; font-size: 12.5px; color: var(--ink-2); position: sticky; top: 46px; z-index: 2; }
.ed-ctx b { color: var(--navy); margin-right: 6px; font-size: 13px; }
.ed-ctx button { padding: 5px 8px; font-size: 12.5px; background: #fff; border-color: var(--line); }
/* popovers of the toolbar: spacing, table size */
.ed-pop { position: absolute; z-index: 5; min-width: 260px; padding: 12px; background: #fff; border: 1px solid var(--line-2); box-shadow: 0 16px 40px -12px rgba(20, 18, 50, .35); }
.ed-pop-title { margin: 0 0 10px; font-size: 12.5px; color: var(--ink-3); }
.ed-pop-row { display: flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 13px; }
.ed-pop-row > span { width: 108px; flex: none; color: var(--ink-2); }
.ed-pop-row button { border-color: var(--line); }
.ed-tgrid { display: grid; grid-template-columns: repeat(8, 22px); gap: 3px; margin-bottom: 10px; }
.ed-tgrid button { width: 22px; height: 18px; padding: 0; border: 1px solid var(--line-2); background: #fff; }
.ed-tgrid button.on { background: var(--yellow); border-color: var(--navy); }
.ed-check { display: flex; gap: 8px; align-items: center; font-size: 13px; margin-top: 8px; }
.rte-area { min-height: 320px; max-height: 70vh; overflow-y: auto; padding: 16px 18px; font-size: 16px; line-height: 1.65; border: 0; }
.rte-area > * { margin: 0 0 .8em; }
.rte-area::after { content: ""; display: block; clear: both; }
.rte-area h2, .rte-area h3 { font-family: var(--sans); font-weight: 700; line-height: 1.25; }
.rte-area h2 { font-size: 22px; } .rte-area h3 { font-size: 18px; }
.rte-area blockquote { border-left: 3px solid var(--yellow); padding-left: 16px; color: var(--ink-2); }
.rte-area hr { border: 0; height: 1px; background: var(--line-2); margin: 1.4em 0; }
/* spacing as on the site (roughly) */
.rte-area .lh-tight { line-height: 1.35; } .rte-area .lh-loose { line-height: 2.05; }
.rte-area > .sa-0 { margin-bottom: 0; } .rte-area > .sa-s { margin-bottom: .3em; } .rte-area > .sa-l { margin-bottom: 2em; }
.rte-area > .sb-0 { margin-top: 0; } .rte-area > .sb-s { margin-top: .3em; } .rte-area > .sb-l { margin-top: 2em; }
/* photos, photo blocks, documents: selected with a click, edited with the yellow row above */
.rte-area [data-w] { cursor: pointer; outline-offset: 3px; }
.rte-area [data-w]:hover { outline: 2px dashed var(--line-2); }
.rte-area .is-sel { outline: 3px solid var(--blue) !important; }
.rte-area figure { margin: 0 0 .8em; }
.rte-area figure img { max-width: 100%; height: auto; display: block; }
.rte-area figcaption { font-size: 13px; font-style: italic; color: var(--ink-3); margin-top: 4px; cursor: text; }
.rte-area figcaption[contenteditable=true]:empty::before, .rte-area figcaption[contenteditable=true]:has(> br:only-child)::before { content: "Підпис до фото…"; color: var(--line-2); }
.rte-area figure:is(.fig-left, .fig-right, .fig-center) { width: 50%; }
.rte-area figure:is(.fig-left, .fig-right, .fig-center).fig-s { width: 33%; }
.rte-area figure:is(.fig-left, .fig-right, .fig-center).fig-l { width: 70%; }
.rte-area figure.fig-center { margin-inline: auto; }
.rte-area figure.fig-left { float: left; margin: .2em 1.2em .6em 0; }
.rte-area figure.fig-right { float: right; margin: .2em 0 .6em 1.2em; }
.rte-area :is(h2, h3, h4, hr, table, .gallery, p.doc) { clear: both; }
.rte-area .gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.rte-area .gallery.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rte-area .gallery.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.rte-area .gallery:not(.g-2, .g-3, .g-4) > figure:first-child { grid-column: 1 / -1; }
.rte-area .gallery > figure { margin: 0; }
.rte-area .gallery > figure img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.rte-area .gallery.g-nocrop { align-items: start; }
.rte-area .gallery.g-nocrop > figure img { aspect-ratio: auto; }
.rte-area .gallery.g-top > figure img { object-position: 50% 0; }
.rte-area .gallery > figure > figcaption { font-size: 11.5px; margin-top: 2px; }
.rte-area .gallery > figcaption { grid-column: 1 / -1; }
.rte-area .gallery::before { content: "Фотоблок — двічі клацніть, щоб змінити"; grid-column: 1 / -1; font-size: 11.5px; color: var(--ink-3); }
.rte-area p.doc { display: flex; flex-direction: column; gap: 2px; max-width: 34em; padding: 12px 14px 12px 64px; border: 1px solid var(--line); background: var(--paper) no-repeat 14px 50% / 36px 44px; background-image: linear-gradient(var(--blue), var(--blue)); }
.rte-area p.doc a { color: var(--navy); font-weight: 600; text-decoration: none; pointer-events: none; }
.rte-area p.doc a::after { content: attr(href); display: block; font-weight: 400; font-size: 12px; color: var(--ink-3); word-break: break-all; }
.rte-area p.doc.doc-embed::after { content: "PDF показується й на сторінці"; font-size: 12px; color: var(--green); }
/* tables: every line visible while editing; the chosen style shows roughly */
.rte-area table { border-collapse: collapse; width: 100%; font-size: 14px; }
.rte-area table.t-auto { width: auto; }
.rte-area td, .rte-area th { border: 1px dashed var(--line-2); padding: 5px 8px; vertical-align: top; text-align: left; min-width: 40px; }
.rte-area th { font-weight: 700; background: #fbfbfd; }
.rte-area table.t-grid :is(td, th) { border: 1px solid var(--ink-3); }
.rte-area table.t-zebra tbody tr:nth-child(odd) { background: var(--paper); }
.rte-area table.t-compact :is(td, th) { padding-block: 2px; }
.rte-area table .a-c { text-align: center; } .rte-area table .a-r { text-align: right; }
/* the dialogs: a photo block, a document */
.ed-dialog { width: min(860px, 94vw); max-height: 90vh; padding: 22px 24px; border: 0; box-shadow: 0 30px 80px -20px rgba(20, 18, 50, .6); }
.ed-dialog::backdrop { background: rgba(20, 18, 50, .55); }
.ed-dialog h2 { margin-bottom: 4px; }
.ed-dialog fieldset { border: 1px solid var(--line); padding: 10px 14px 12px; margin: 0; }
.ed-dialog legend { font-size: 13px; font-weight: 600; padding: 0 4px; }
.ed-dialog fieldset label { display: flex; gap: 8px; align-items: center; font-size: 14px; margin-top: 6px; }
.ed-dialog fieldset label small { display: block; font-size: 12px; color: var(--ink-3); }   /* a choice's explanation, under it */
.ed-dlg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.ed-dlg-grid--3 { grid-template-columns: 1fr 1.4fr 1fr; }
@media (max-width: 640px) { .ed-dlg-grid, .ed-dlg-grid--3 { grid-template-columns: 1fr; } }
.ed-field { display: grid; gap: 6px; font-size: 14px; margin-top: 10px; }
.ed-dlg-foot { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 18px; }
.ed-dlg-foot .muted { margin-right: auto; }
.ed-gal-items { list-style: none; margin: 14px 0 8px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; max-height: 44vh; overflow-y: auto; }
.ed-gal-item { display: grid; gap: 6px; padding: 6px; border: 1px solid var(--line); background: var(--paper); }
.ed-gal-item img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; display: block; }
.ed-gal-item input { width: 100%; font-size: 13px; padding: 6px 8px; }
.ed-gal-btns { display: flex; gap: 4px; }
.ed-gal-btns button { flex: 1; border: 1px solid var(--line-2); background: #fff; padding: 4px 0; cursor: pointer; }
.ed-doc-file { padding: 10px 12px; background: var(--paper); font-weight: 600; word-break: break-all; }
.ml-doc { display: grid; place-items: center; width: 52px; height: 64px; background: var(--blue); color: #fff; font: 700 12px/1 var(--sans); clip-path: polygon(0 0, 70% 0, 100% 24%, 100% 100%, 0 100%); }
.rte-note { margin: 0; padding: 6px 12px; font-size: 13px; color: var(--ink-3); border-top: 1px solid var(--line); }

/* rankings */
.rk th[scope="row"] { font-size: 13px; font-weight: 500; white-space: nowrap; color: var(--ink-2); width: 1%; }
.rk td { vertical-align: top; }
.rk-cell { display: grid; grid-template-columns: minmax(90px, 1fr) auto; gap: 6px 8px; align-items: center; font-size: 13px; }
.rk-cell .rk-label { padding: 5px 8px; font-size: 13px; }
.rk-cell .rk-link { grid-column: 1 / -1; padding: 5px 8px; font-size: 12px; }
.rk-cell input[type=file] { grid-column: 1 / -1; font-size: 12px; }
.rk-cell .missing { color: var(--red); }
.rk-cell .error { grid-column: 1 / -1; }
.rk-status { white-space: nowrap; }

/* JSON & history */
.file-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.file-tabs a { padding: 6px 10px; background: #fff; border: 1px solid var(--line); text-decoration: none; font-size: 13px; color: var(--navy); }
.file-tabs a[aria-current] { border-color: var(--navy); background: var(--navy); color: #fff; }
.log { white-space: pre-wrap; font: 12px/1.5 ui-monospace, Menlo, monospace; background: var(--paper); padding: 14px; border: 1px solid var(--line); max-height: 50vh; overflow: auto; }

/* login */
.login { display: grid; gap: 4px; padding: 32px; }
.login img { margin-bottom: 12px; }
.login h2 { font-size: 20px; margin: 0; }
.login p { margin: 0 0 12px; }
.login label { margin-top: 10px; }
.login .btn { margin-top: 18px; }
.stack { display: grid; gap: 18px; }

/* ---------- pages: tree list, address preview ---------- */
.icon-btn.text { padding: 0 10px; min-width: 0; }
.row-actions form { display: inline; }
.table.pages td:first-child { min-width: 260px; }
.tree { display: flex; align-items: baseline; gap: 6px; padding-left: calc(var(--depth, 0) * 22px); }
.tree-mark { color: var(--line-2); }
.badge.on { border-color: var(--green); color: var(--green); }
.badge.bad { border-color: var(--red); color: var(--red); }
.badge.wait { border-color: #b8860b; color: #7a5a00; background: #fffbea; }
.badge.off { border-color: var(--line-2); color: var(--ink-3); background: var(--paper); }
.permalink { grid-column: 1 / -1; margin: 0 0 16px; padding: 10px 14px; background: #fff; border: 1px solid var(--line); font-size: 13px; color: var(--ink-3); overflow-wrap: anywhere; }
.permalink strong { color: var(--navy); font-weight: 500; }

/* ---------- page blocks editor ---------- */
.blocks { grid-column: 1 / -1; }
.blk-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.blk-top .label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.blk-list { display: grid; gap: 12px; }
.blk { background: #fff; border: 1px solid var(--line-2); border-left: 3px solid var(--blue); }
.blk.has-error { border-left-color: var(--red); }
.blk.is-dragging { opacity: .45; }
.blk-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: #fbfbfd; border-bottom: 1px solid var(--line); }
.blk-handle { cursor: grab; color: var(--ink-3); font-size: 16px; line-height: 1; padding: 4px 2px; user-select: none; }
.blk-handle:active { cursor: grabbing; }
.blk-name { font-family: var(--slab); font-size: 14px; letter-spacing: .02em; white-space: nowrap; }
.blk-sum { flex: 1; min-width: 0; font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blk-tools { display: flex; gap: 4px; margin-left: auto; }
.blk-body { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px 18px; padding: 16px; }
.blk.is-folded .blk-body { display: none; }
.blk.is-folded .blk-head { border-bottom: 0; }
[data-blk-fold] { font-size: 16px; line-height: 1; }
.blk.is-folded [data-blk-fold] { transform: rotate(-90deg); }
.blk-empty { margin: 4px 0 0; padding: 18px; text-align: center; border: 1px dashed var(--line-2); background: #fff; }
.blk-palette { margin-top: 14px; padding: 14px; background: #fff; border: 1px dashed var(--line-2); }
.blk-palette-title { margin: 0 0 10px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.blk-palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.blk-add { display: grid; gap: 2px; padding: 10px 12px; text-align: left; background: var(--paper); border: 1px solid var(--line); color: var(--navy); font: inherit; cursor: pointer; }
.blk-add strong { font-size: 14px; font-weight: 500; }
.blk-add span { font-size: 12px; line-height: 1.35; color: var(--ink-3); }
.blk-add:hover { border-color: var(--blue); background: #fff; }
.blk-add:hover strong { color: var(--blue); }

/* ---------- menu builder ---------- */
.menu-form .form-actions { gap: 10px; }
.mb { margin-bottom: 16px; }
.mb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.mb-list .mb-list { margin: 6px 0 0 30px; padding-left: 12px; border-left: 2px solid var(--line); }
.mb-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 8px 10px; background: #fff; border: 1px solid var(--line-2); cursor: grab; }
.mb-row.has-error { border-color: var(--red); }
.mb-item.is-hidden > .mb-row { background: var(--paper); }
.mb-item.is-hidden > .mb-row .mb-title { color: var(--ink-3); text-decoration: line-through; }
.mb-item.is-dragging > .mb-row { opacity: .45; }
.mb-row.drop-before { box-shadow: 0 -3px 0 var(--blue); }
.mb-row.drop-after { box-shadow: 0 3px 0 var(--blue); }
.mb-handle { color: var(--ink-3); font-size: 16px; line-height: 1; user-select: none; }
.mb-title { padding: 0; background: none; border: 0; font: 500 15px/1.3 var(--sans); color: var(--navy); cursor: pointer; text-align: left; }
.mb-title:hover { color: var(--blue); text-decoration: underline; }
.mb-link { flex: 1 1 200px; min-width: 0; font-size: 13px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mb-row.has-error .mb-link { color: var(--red); }
.mb-badge { padding: 1px 6px; font-size: 11px; border: 1px solid var(--line-2); color: var(--ink-2); white-space: nowrap; }
.mb-tools { display: flex; gap: 4px; margin-left: auto; }
.mb-edit { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px 18px; margin-top: -1px; padding: 16px; background: #fff; border: 1px solid var(--line-2); border-top: 3px solid var(--yellow); }
.mb-edit .check { display: flex; margin: 4px 0; }
.mb-edit-foot { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.mb-search { position: relative; }
.mb-results { position: absolute; z-index: 5; left: 0; right: 0; top: 66px; max-height: 320px; overflow-y: auto; margin: 0; padding: 4px 0; list-style: none; background: #fff; border: 1px solid var(--line-2); box-shadow: 0 16px 32px -16px rgba(38,35,91,.35); }
.mb-results li.muted { padding: 10px 12px; font-size: 13px; }
.mb-results button { display: grid; gap: 2px; width: 100%; padding: 8px 12px; text-align: left; background: none; border: 0; font: inherit; cursor: pointer; }
.mb-results button:hover, .mb-results button:focus { background: var(--paper); outline: none; }
.mb-results strong { font-weight: 500; font-size: 14px; }
.mb-results span { font-size: 12px; color: var(--ink-3); overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .blk-body, .mb-edit { grid-template-columns: 1fr; }
  .blk-body > .field, .mb-edit > .field { grid-column: 1 / -1; }
  .mb-tools { margin-left: 0; }
}
.error-list { margin: 6px 0 0; padding-left: 20px; }
/* ---------- footer ---------- */
.footer-form .card + .card { margin-top: 16px; }
.footer-form .card > h2 { margin-bottom: 12px; }
.footer-form .field textarea { width: 100%; }
.footer-toggle { margin: 14px 0 0; }
.mb-wrap > [data-mb-add] { margin-top: 4px; }
/* ---------- media library ---------- */
[hidden] { display: none !important; }
.ml-upload { display: grid; gap: 14px; }
.ml-drop { padding: 22px; border: 2px dashed var(--line-2); background: var(--paper); text-align: center; }
.ml-drop p { margin: 0; }
.ml-drop p + p { margin-top: 6px; font-size: 13px; }
.ml-drop.is-over, [data-gallery].is-over { border-color: var(--blue); background: #eef4fc; }
.ml-progress { margin: 0; padding: 0 0 0 20px; font-size: 13px; display: grid; gap: 4px; }
.ml-progress .ok { color: var(--green); } .ml-progress .error { color: var(--red); }
.ml-fetch label { margin-bottom: 6px; }
.ml-fetch-row { display: flex; gap: 8px; }
.ml-fetch-row input { flex: 1; }
.ml-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ml-filters input[type=search][name] { width: 260px; max-width: 60vw; }
.ml-filters select { width: auto; }
.ml-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.ml-card { display: grid; gap: 4px; height: 100%; padding: 8px; background: #fff; border: 1px solid var(--line); color: var(--navy); text-decoration: none; text-align: left; font: inherit; cursor: pointer; width: 100%; }
.ml-card:hover { border-color: var(--blue); }
.ml-card.is-chosen { border-color: var(--blue); box-shadow: inset 0 0 0 2px var(--blue); background: #eef4fc; }
.ml-thumb { aspect-ratio: 4 / 3; display: grid; place-items: center; background: var(--paper); overflow: hidden; }
.ml-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ml-ext, .ml-doc .ml-ext { font: 700 13px/1 var(--sans); letter-spacing: .08em; color: var(--ink-2); border: 1.5px solid var(--line-2); padding: 8px 10px; background: #fff; }
.ml-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml-meta { font-size: 12px; color: var(--ink-3); }
.ml-badge { justify-self: start; font-size: 11px; padding: 1px 6px; border: 1px solid var(--line-2); color: var(--ink-3); background: var(--paper); }
.ml-edit { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.ml-main, .ml-side { display: grid; gap: 18px; min-width: 0; }
.ml-preview { display: grid; justify-items: center; gap: 12px; }
.ml-preview-img { max-width: 100%; max-height: 70vh; object-fit: contain; background: var(--paper); }
.ml-doc { display: inline-flex; align-items: center; gap: 12px; font-weight: 500; }
.ml-actions { margin: 0; }
.ml-info dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; margin: 0; font-size: 14px; }
.ml-info dt { color: var(--ink-3); }
.ml-info dd { margin: 0; overflow-wrap: anywhere; }
.ml-meta.card .field + .field { margin-top: 14px; }
.ml-side .card h2 { margin-bottom: 12px; }
@media (max-width: 1000px) { .ml-edit { grid-template-columns: 1fr; } }
/* crop editor */
.ml-editor h2 { margin-bottom: 12px; }
.ml-tools { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 14px; }
.ml-seg { display: flex; flex-wrap: wrap; gap: 4px; }
.ml-seg [aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.ml-width { display: flex; align-items: center; gap: 8px; margin: 0; }
.ml-width select { width: auto; padding: 5px 8px; }
.ml-stage { text-align: center; background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 16px 16px; padding: 10px; }
.ml-canvas-wrap { position: relative; display: inline-block; vertical-align: top; line-height: 0; touch-action: none; }
.ml-canvas-wrap canvas { display: block; max-width: 100%; }
.ml-crop { position: absolute; border: 2px solid var(--yellow); box-shadow: 0 0 0 9999px rgba(20, 18, 50, .55); cursor: move; touch-action: none; }
.ml-crop:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.ml-canvas-wrap { overflow: hidden; }
.ml-crop span { position: absolute; width: 16px; height: 16px; background: var(--yellow); border: 2px solid var(--navy); }
/* handles sit inside the frame, so they stay visible when the frame touches the picture's edges */
.ml-crop [data-h="nw"] { left: -2px; top: -2px; cursor: nwse-resize; } .ml-crop [data-h="se"] { right: -2px; bottom: -2px; cursor: nwse-resize; }
.ml-crop [data-h="ne"] { right: -2px; top: -2px; cursor: nesw-resize; } .ml-crop [data-h="sw"] { left: -2px; bottom: -2px; cursor: nesw-resize; }
.ml-crop [data-h="n"] { left: calc(50% - 8px); top: -2px; cursor: ns-resize; } .ml-crop [data-h="s"] { left: calc(50% - 8px); bottom: -2px; cursor: ns-resize; }
.ml-crop [data-h="w"] { top: calc(50% - 8px); left: -2px; cursor: ew-resize; } .ml-crop [data-h="e"] { top: calc(50% - 8px); right: -2px; cursor: ew-resize; }
.ml-out { margin: 10px 0 0; }
/* picker */
.ml-picker { width: min(1100px, 94vw); height: min(86vh, 900px); padding: 0; border: 0; box-shadow: 0 30px 80px -20px rgba(20, 18, 50, .6); display: none; overflow: hidden; }
.ml-picker[open] { display: flex; flex-direction: column; }
.ml-picker::backdrop { background: rgba(20, 18, 50, .55); }
.ml-picker-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.ml-picker-head h2 { margin: 0 auto 0 0; }
.ml-picker-head input[type=search][data-q] { width: 260px; max-width: 50vw; }
.ml-picker > .ml-progress { margin: 10px 20px 0 40px; }
.ml-picker-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px; }
.ml-grid--pick { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.ml-picker-foot { display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); background: #fbfbfd; }
.ml-picker-foot [data-hint] { margin-right: auto; font-size: 13px; }
.media-actions .link-btn[data-pick-image] { font-size: 13px; }
/* gallery field */
.gallery-field { grid-column: 1 / -1; }
.gal-grid { list-style: none; margin: 8px 0 10px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gal-item { display: grid; gap: 6px; padding: 6px; background: var(--paper); border: 1px solid var(--line); cursor: grab; }
.gal-item.is-dragging { opacity: .4; }
.gal-img { aspect-ratio: 4 / 3; display: grid; place-items: center; background: #fff; overflow: hidden; }
.gal-img img { width: 100%; height: 100%; object-fit: cover; }
.gal-cap { font-size: 13px !important; padding: 5px 8px !important; }
.gal-tools { display: flex; gap: 4px; justify-content: space-between; }
.gal-tools .icon-btn { min-width: 28px; height: 28px; padding: 0 6px; }
.gal-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.gal-empty { margin: 8px 0; padding: 16px; border: 1px dashed var(--line-2); text-align: center; background: #fff; }
[data-gallery] { border: 1px dashed transparent; }
/* ---------- search in the site's content ---------- */
.cms-search-toggle svg { flex-shrink: 0; }
.cms-search { position: fixed; top: 0; left: 0; right: 0; z-index: 60; }
.cms-search-box { background: #fff; box-shadow: 0 30px 70px -30px rgba(20, 18, 50, .55); }
.cms-search-bar { display: flex; align-items: center; gap: 16px; max-width: 1240px; margin: 0 auto; padding: 18px 32px; color: var(--blue); }
.cms-search-bar svg { width: 28px; height: 28px; flex-shrink: 0; }
.cms-search-bar input[type=search] { flex: 1; min-width: 0; padding: 6px 0 10px; border: 0; border-bottom: 3px solid var(--line); background: none; color: var(--navy); font: 600 clamp(1.3rem, 2.6vw, 2rem)/1.2 var(--sans); box-shadow: none; }
.cms-search-bar input[type=search]:focus { border-bottom-color: var(--yellow); box-shadow: none; }
.cms-search-bar input::-webkit-search-cancel-button { display: none; }
.cms-search-close { width: 40px; height: 40px; }
.cms-search-panel { max-width: 1240px; margin: 0 auto; padding: 0 32px 24px; max-height: calc(100vh - 110px); max-height: calc(100dvh - 110px); overflow-y: auto; overscroll-behavior: contain; }
.cms-search-status { margin: 4px 0 10px; font-size: 13px; color: var(--ink-3); }
.cms-search-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.cms-search-list:empty { display: none; }
.cms-search-list li { display: flex; gap: 12px; align-items: flex-start; border-bottom: 1px solid var(--line); }
.cs-main { flex: 1; min-width: 0; display: grid; gap: 3px; padding: 12px 10px; text-decoration: none; color: var(--navy); }
a.cs-main:hover, a.cs-main:focus-visible { background: var(--paper); outline: none; box-shadow: inset 3px 0 0 var(--yellow); }
.cs-meta { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--blue); }
.cs-title { font-weight: 600; font-size: 15px; line-height: 1.35; }
.cs-snip { font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.cs-site { flex-shrink: 0; padding: 14px 8px; font-size: 12px; white-space: nowrap; }
.cms-search-list mark { background: var(--yellow); color: var(--navy); padding: 0 1px; }
.cms-search-foot { margin-top: 14px; }
.cms-search-foot:empty { display: none; }
.cms-search-backdrop { position: fixed; inset: 0; z-index: 59; background: rgba(20, 18, 50, .45); }
@media (max-width: 700px) { .cms-search-bar, .cms-search-panel { padding-inline: 16px; } .cms-search-list li { flex-direction: column; gap: 0; } .cs-site { padding: 0 10px 12px; } }

/* «Заявки»: the tables of the site's forms, an entry's page, «Пошта (SMTP)» */
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.forms-table td { vertical-align: top; }
.table td.num, .table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.forms-table .sub { display: block; margin-top: 2px; color: var(--ink-3); font-size: 13px; }
.forms-table .sub a { font-weight: 400; }
.forms-table .cell-msg { min-width: 160px; max-width: 280px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink-2); overflow-wrap: anywhere; }
.entry-dl { display: grid; grid-template-columns: minmax(140px, 220px) minmax(0, 1fr); gap: 10px 20px; margin: 0; }
.entry-dl dt { color: var(--ink-3); font-size: 13px; padding-top: 2px; }
.entry-dl dd { margin: 0; overflow-wrap: anywhere; }
.entry-dl dd.message { white-space: pre-wrap; }
.entry-dl .help { margin-top: 4px; }
@media (max-width: 700px) { .entry-dl { grid-template-columns: 1fr; gap: 2px; } .entry-dl dd { margin-bottom: 10px; } }
.card .form-actions form { display: inline; }
.status-form label { margin-bottom: 6px; }
.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline select { width: auto; }
