/* Земність CMS — стилі за макетом «Земність CMS.dc.html».
   Інлайн-стилі макета винесено в класи: CSP забороняє style-атрибути й інлайн-скрипти. */

@font-face { font-family: 'Mariupol'; src: url('/_cms/fonts/Mariupol-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Mariupol'; src: url('/_cms/fonts/Mariupol-Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Tektur'; src: url('/_cms/fonts/Tektur_SemiCondensed-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Tektur'; src: url('/_cms/fonts/Tektur_SemiCondensed-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

:root {
    --ink: #15140F;
    --paper: #EDE8DD;
    --card: #FBF8F3;
    --white: #fff;
    --muted: #6B6659;
    --muted-2: #8b8577;
    --line: #E2DCCD;
    --orange: #F4791F;
    --orange-soft: #FBD9BC;
    --blue: #1E3FA0;
    --blue-soft: #DFE6F7;
    --blue-field: #F2F5FC;
    --red: #C0390B;
    --red-soft: #FDEBDA;
    --text-2: #3a382f;
    --display: 'Tektur', sans-serif;
    --body: 'Mariupol', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 15px; min-height: 100vh; }
a { color: var(--blue); }
a:hover { color: var(--orange); }
input, textarea, select, button { font-family: inherit; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--blue); outline-offset: -2px; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
::selection { background: var(--orange); color: #fff; }
[hidden] { display: none !important; }
@keyframes zspin { to { transform: rotate(360deg); } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Типографіка й кнопки ---------- */
.kicker { font-family: var(--display); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.h-card { font-family: var(--display); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.btn {
    font-family: var(--display); font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
    background: var(--white); color: var(--ink); border: 2px solid var(--ink); padding: 9px 13px; cursor: pointer;
    text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; line-height: 1.2;
}
.btn:hover { color: var(--ink); background: var(--card); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--primary { font-weight: 700; background: var(--orange); color: #fff; }
.btn--primary:hover { background: #e06a12; color: #fff; }
.btn--blue { font-weight: 700; background: var(--blue); color: #fff; }
.btn--blue:hover { background: #17338a; color: #fff; }
.btn--dark { background: var(--ink); color: #fff; }
.btn--dark:hover { background: #2b2a22; color: #fff; }
.btn--danger { background: var(--red); color: #fff; font-weight: 700; }
.btn--danger:hover { background: #a3300a; color: #fff; }
.btn--danger-outline { background: #fff; border-color: var(--red); color: var(--red); padding: 6px 9px; line-height: 1; }
.btn--soft { background: var(--card); }
.btn--sm { font-size: 11px; padding: 7px 10px; }
.btn--xs { font-size: 11px; padding: 4px 7px; line-height: 1; }
.btn--dashed { border-style: dashed; align-self: flex-start; padding: 11px 15px; }
.btn--lg { font-size: 14px; letter-spacing: .04em; padding: 13px; }
.btn--block { width: 100%; }
.btn--outline-blue { border-color: var(--blue); color: var(--blue); }
.link-btn { background: none; border: none; padding: 0; color: var(--muted); font-size: 13px; cursor: pointer; text-decoration: underline; }

.badge {
    font-family: var(--display); font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
    padding: 3px 6px; border: 2px solid; display: inline-block; line-height: 1.2; white-space: nowrap;
}
.badge--pub { color: #fff; background: var(--blue); border-color: var(--blue); }
.badge--hid { color: var(--muted); background: #fff; border-color: #B4AD9C; }
.badge--noen { color: #fff; background: var(--orange); border-color: var(--orange); }
.badge--feat { color: var(--ink); background: var(--orange-soft); border-color: var(--ink); }
.badge--edit { color: var(--ink); background: #fff; border-color: var(--ink); }
.badge--err { color: #fff; background: var(--red); border-color: var(--red); }
.badge--small { font-size: 9px; padding: 2px 4px; border-width: 0; }

/* ---------- Вхід / запрошення ---------- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--ink); }
.auth__card { width: 100%; max-width: 420px; background: var(--card); border: 2px solid var(--ink); box-shadow: 8px 8px 0 var(--orange); }
.auth__head { padding: 22px 26px; border-bottom: 2px solid var(--ink); display: flex; align-items: center; gap: 12px; }
.auth__head img { width: 30px; height: 30px; }
.auth__brand { font-family: var(--display); font-weight: 700; font-size: 15px; text-transform: uppercase; letter-spacing: .06em; line-height: 1; }
.auth__sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.auth__body { padding: 26px; display: flex; flex-direction: column; gap: 14px; }
.auth__title { font-family: var(--display); font-weight: 700; font-size: 17px; text-transform: uppercase; }
.auth__text { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-2); }
.auth__link { font-size: 13px; text-decoration: none; }
.label {
    display: flex; flex-direction: column; gap: 6px; font-family: var(--display); font-size: 11px;
    text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
}
.input {
    font-family: var(--body); font-size: 15px; padding: 11px 13px; border: 2px solid var(--ink); background: #fff;
    color: var(--ink); width: 100%; text-transform: none; letter-spacing: normal;
}
.alert { font-size: 14px; line-height: 1.5; padding: 11px 13px; border: 2px solid var(--red); background: var(--red-soft); color: var(--ink); }
.alert--ok { border-color: var(--blue); background: var(--blue-field); }
.hint { font-size: 12px; color: var(--muted); line-height: 1.45; }

/* ---------- Каркас застосунку ---------- */
.app { display: flex; min-height: 100vh; }
.side {
    width: 244px; flex: none; background: var(--ink); color: var(--card); display: flex; flex-direction: column;
    border-right: 2px solid var(--ink); position: sticky; top: 0; height: 100vh;
}
.side__brand { padding: 16px 18px; border-bottom: 1px solid #34322a; display: flex; align-items: center; gap: 10px; }
.side__brand img { width: 24px; height: 24px; }
.side__brand span:first-of-type { font-family: var(--display); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.side__cms { margin-left: auto; font-family: var(--display); font-size: 10px; letter-spacing: .1em; color: var(--orange); }
.side__nav { flex: 1; overflow-y: auto; padding: 10px 0 18px; }
.side__group { margin-bottom: 6px; }
.side__label { font-family: var(--display); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: #807a6c; padding: 12px 18px 6px; }
.side__item {
    display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; font-size: 14px; padding: 9px 18px;
    background: transparent; border: none; border-left: 3px solid transparent; color: #c9c5ba; cursor: pointer; text-decoration: none;
}
.side__item:hover { color: #fff; }
.side__item[aria-current="page"] { background: rgba(244, 121, 31, .14); border-left-color: var(--orange); color: #fff; }
.side__count { margin-left: auto; font-family: var(--display); font-size: 10px; background: var(--orange); color: #fff; padding: 2px 6px; }
.side__user { border-top: 1px solid #34322a; padding: 12px 18px; display: flex; align-items: center; gap: 10px; }
.avatar {
    width: 30px; height: 30px; flex: none; background: var(--orange); border: 2px solid var(--card); display: flex;
    align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; font-size: 12px; color: #fff;
}
.side__who { min-width: 0; text-decoration: none; color: var(--card); }
.side__who:hover { color: #fff; }
.side__name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side__role { font-size: 11px; color: #a09889; }
.side__logout {
    margin-left: auto; background: none; border: 1px solid #4a473d; color: #a09889; font-size: 11px; font-family: var(--display);
    letter-spacing: .06em; text-transform: uppercase; padding: 5px 7px; cursor: pointer;
}
.side__logout:hover { color: #fff; border-color: #a09889; }
.scrim { position: fixed; inset: 0; z-index: 110; background: rgba(21, 20, 15, .5); }

.work { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top {
    position: sticky; top: 0; z-index: 80; background: rgba(237, 232, 221, .95); backdrop-filter: blur(8px);
    border-bottom: 2px solid var(--ink); padding: 11px 24px; display: flex; align-items: center; gap: 14px;
}
.burger {
    display: none; flex: none; width: 38px; height: 38px; align-items: center; justify-content: center; background: #fff;
    border: 2px solid var(--ink); cursor: pointer; flex-direction: column; gap: 4px; padding: 0;
}
.burger span { display: block; width: 16px; height: 2px; background: var(--ink); }
.top__title { font-family: var(--display); font-weight: 700; font-size: 15px; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top__crumb { font-family: var(--display); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.top__actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.status {
    display: flex; align-items: center; gap: 8px; font-family: var(--display); font-size: 11px; letter-spacing: .06em;
    text-transform: uppercase; border: 2px solid var(--ink); padding: 7px 11px; background: #fff; color: var(--ink);
}
.status__dot { width: 8px; height: 8px; flex: none; background: var(--blue); }
.status--fail { background: var(--red-soft); color: var(--red); }
.status--fail .status__dot { background: var(--red); }
.status--busy .status__dot { background: var(--orange); animation: zspin 1s linear infinite; }

.banner { background: var(--red-soft); border-bottom: 2px solid var(--ink); padding: 12px 24px; display: flex; align-items: center; gap: 12px; font-size: 14px; flex-wrap: wrap; }
.banner__title { font-family: var(--display); font-weight: 700; color: var(--red); }
.banner__text { color: var(--text-2); }
.banner__details { flex-basis: 100%; }
.banner__details pre { margin: 6px 0 0; font-size: 12px; white-space: pre-wrap; max-height: 160px; overflow: auto; background: #fff; border: 1px solid var(--line); padding: 8px; }
.banner form { margin-left: auto; flex: none; }

.main { flex: 1; padding: 24px 28px 92px; }
.page { max-width: 1080px; display: flex; flex-direction: column; gap: 22px; }
.page--narrow { max-width: 900px; }

.card { background: #fff; border: 2px solid var(--ink); }
.card__head { padding: 14px 18px; border-bottom: 2px solid var(--ink); display: flex; align-items: center; gap: 10px; }
.card__meta { margin-left: auto; font-family: var(--display); font-size: 11px; color: var(--muted); }
.card__body { padding: 18px; }

/* ---------- Огляд ---------- */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.metric { background: #fff; border: 2px solid var(--ink); padding: 16px 18px; }
.metric__label { font-family: var(--display); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.metric__value { font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1; }
.metric__note { font-size: 12px; color: var(--muted); margin-top: 8px; }
.cards { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.attention {
    width: 100%; text-align: left; display: flex; align-items: center; gap: 12px; padding: 13px 18px; border: none;
    border-bottom: 1px solid var(--line); background: #fff; cursor: pointer; text-decoration: none; color: var(--ink);
}
.attention:hover { background: var(--card); color: var(--ink); }
.attention__text { font-size: 14px; min-width: 0; }
.attention__arrow { margin-left: auto; color: var(--muted); font-size: 13px; flex: none; }
.empty-note { padding: 16px 18px; font-size: 14px; color: var(--muted); }
.publish { background: var(--blue); color: #fff; border: 2px solid var(--ink); padding: 18px; }
.publish .kicker { color: #fff; opacity: .75; margin-bottom: 8px; }
.publish__when { font-family: var(--display); font-weight: 700; font-size: 19px; text-transform: uppercase; line-height: 1.1; }
.publish__who { font-size: 13px; margin-top: 8px; opacity: .85; }
.quick { display: flex; flex-direction: column; gap: 9px; margin-top: 14px; }
.quick a { text-align: left; font-size: 14px; background: var(--card); border: 2px solid var(--ink); padding: 11px 13px; color: var(--ink); text-decoration: none; }
.quick a:hover { background: #fff; }

/* ---------- Список колекції ---------- */
.bar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.bar__search { flex: 1; min-width: 160px; font-size: 14px; padding: 10px 12px; border: 2px solid var(--ink); background: #fff; }
.bar__count { font-size: 13px; color: var(--muted); }
.row { display: grid; grid-template-columns: 22px 64px 1fr auto; gap: 14px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fff; }
.row.is-dragging { opacity: .5; }
.row.is-over { box-shadow: inset 0 3px 0 var(--orange); }
.drag { cursor: grab; color: #B4AD9C; font-size: 15px; line-height: 1; letter-spacing: -1px; user-select: none; }
.thumb { width: 64px; height: 44px; border: 2px solid var(--ink); background: var(--blue-soft); object-fit: cover; display: block; }
.thumb--square { height: 64px; }
.row__main { text-align: left; background: none; border: none; padding: 0; cursor: pointer; min-width: 0; text-decoration: none; color: var(--ink); }
.row__title { font-family: var(--display); font-weight: 700; font-size: 15px; line-height: 1.15; margin-bottom: 5px; }
.row__sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.row__meta form { display: inline; }
.empty { background: #fff; border: 2px dashed var(--ink); padding: 52px 26px; text-align: center; }
.empty img { width: 64px; opacity: .18; margin-bottom: 18px; }
.empty__title { font-family: var(--display); font-weight: 700; font-size: 20px; text-transform: uppercase; margin-bottom: 8px; }
.empty__text { margin: 0 auto 20px; max-width: 380px; font-size: 14px; line-height: 1.55; color: var(--muted); }

/* ---------- Редактор ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 268px; gap: 22px; align-items: start; max-width: 1160px; }
.editor__col { min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.langbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.langbar .kicker { font-size: 11px; letter-spacing: .1em; margin-right: auto; }
.tabs { display: flex; border: 2px solid var(--ink); background: #fff; }
.tabs button {
    font-family: var(--display); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; padding: 8px 12px;
    border: none; cursor: pointer; background: #fff; color: var(--ink);
}
.tabs button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.section { background: #fff; border: 2px solid var(--ink); scroll-margin-top: 90px; }
.section__head { padding: 13px 18px; border-bottom: 2px solid var(--ink); display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.section__note { font-size: 12px; color: var(--muted); }
.section__body { padding: 18px; display: flex; flex-direction: column; gap: 18px; }
.field__head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; flex-wrap: wrap; }
.field__label { font-family: var(--display); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink); }
.field__shared { font-family: var(--display); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--blue); border: 1px solid var(--blue); padding: 2px 5px; }
.field__hint { font-size: 12px; color: var(--muted); }
.field__error { font-size: 12px; color: var(--red); margin-top: 5px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.editor[data-lang="uk"] .pair, .editor[data-lang="en"] .pair { grid-template-columns: 1fr; }
.editor[data-lang="uk"] .pair__en, .editor[data-lang="en"] .pair__uk { display: none; }
.pair__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.pair__lang { font-family: var(--display); font-size: 10px; letter-spacing: .1em; color: var(--muted); }
.count { font-family: var(--display); font-size: 10px; letter-spacing: .06em; color: var(--muted-2); }
.count.is-near { color: var(--orange); font-weight: 700; }
.count.is-over { color: var(--red); font-weight: 700; }
.text {
    font-family: var(--body); font-size: 15px; padding: 10px 12px; width: 100%; background: #fff; border: 2px solid var(--ink); color: var(--ink);
}
textarea.text { resize: vertical; line-height: 1.5; }
.text.is-over, .text.is-invalid { background: var(--red-soft); border-color: var(--red); }
.plain { font-family: var(--body); font-size: 15px; padding: 10px 12px; width: 100%; max-width: 520px; background: var(--blue-field); border: 2px solid var(--blue); color: var(--ink); }
.plain.is-invalid { border-color: var(--red); }
.plain--value { font-family: var(--display); font-weight: 700; font-size: 16px; padding: 9px 11px; width: 120px; }
.plain--short { max-width: 200px; }
select.plain { max-width: 320px; }
.toggle { display: flex; align-items: center; gap: 11px; background: none; border: none; padding: 0; cursor: pointer; font-size: 14px; color: var(--ink); }
.toggle__track { width: 46px; height: 26px; flex: none; border: 2px solid var(--ink); background: var(--line); display: flex; align-items: center; justify-content: flex-start; padding: 2px; }
.toggle__knob { display: block; width: 18px; height: 18px; background: var(--ink); }
.toggle[aria-checked="true"] .toggle__track { background: var(--blue); justify-content: flex-end; }
.toggle[aria-checked="true"] .toggle__knob { background: #fff; }
.image { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.image__preview {
    width: 96px; height: 120px; flex: none; border: 2px solid var(--ink); background: var(--blue-soft); display: flex;
    align-items: center; justify-content: center; text-align: center; padding: 0; overflow: hidden;
}
.image__preview--1x1 { height: 96px; }
.image__preview--16x10 { width: 132px; height: 82px; }
.image__preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.image__ratio { font-family: var(--display); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 6px; }
.image__side { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 8px; }
.image__name { font-size: 13px; color: var(--muted); word-break: break-all; }
.image__buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.image__alt { display: flex; flex-direction: column; gap: 5px; font-family: var(--display); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.image__alt .text { font-size: 14px; padding: 9px 11px; text-transform: none; letter-spacing: normal; }
.image__alt .text.is-empty { background: var(--red-soft); border-color: var(--red); }
.pick { border: 2px solid var(--ink); background: var(--card); }
.pick__row { display: flex; align-items: center; gap: 11px; padding: 10px 13px; border-bottom: 1px solid var(--line); }
.pick__box {
    width: 24px; height: 24px; flex: none; border: 2px solid var(--ink); background: #fff; color: #fff; font-family: var(--display);
    font-size: 13px; line-height: 1; cursor: pointer; padding: 0;
}
.pick__box[aria-checked="true"] { background: var(--blue); }
.pick__value { font-family: var(--display); font-weight: 700; font-size: 14px; flex: none; }
.pick__label { font-size: 13px; color: var(--text-2); min-width: 0; }
.pick__move { margin-left: auto; display: flex; gap: 5px; flex: none; }
.pick__foot { padding: 10px 13px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pick__foot .hint { margin-right: auto; }
.rep { display: flex; flex-direction: column; gap: 10px; }
.rep__item { border: 2px solid var(--ink); background: var(--card); }
.rep__head { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.rep__num { font-family: var(--display); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.rep__summary { font-size: 14px; font-weight: 500; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rep__tools { margin-left: auto; display: flex; gap: 5px; flex: none; }
.rep__body { padding: 13px; display: flex; flex-direction: column; gap: 13px; }
.rep__body .field__label { font-size: 10px; color: var(--muted); }
.rep__body .text { font-size: 14px; }
.rail { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 14px; }
.rail__card { background: #fff; border: 2px solid var(--ink); padding: 16px; }
.rail__card .kicker { margin-bottom: 9px; }
.rail__badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.rail__meta { font-size: 13px; color: var(--muted); line-height: 1.5; }
.rail__links { display: flex; flex-direction: column; gap: 8px; }
.rail__links a { font-size: 13px; color: var(--text-2); display: flex; gap: 8px; text-decoration: none; }
.rail__links a::before { content: '→'; color: var(--orange); }

/* ---------- Нижня панель збереження ---------- */
.savebar { position: sticky; bottom: 0; z-index: 70; background: var(--ink); border-top: 2px solid var(--ink); padding: 12px 24px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.savebar__dot { width: 10px; height: 10px; flex: none; background: var(--orange); }
.savebar__text { font-size: 13px; color: var(--card); }
.savebar__actions { margin-left: auto; display: flex; gap: 9px; }
.savebar .btn--ghost { background: transparent; border-color: var(--muted); color: var(--card); }
.savebar .btn--light { background: var(--card); border-color: var(--card); }
.savebar .btn--primary { border-color: var(--orange); }

/* ---------- Медіатека ---------- */
.drop { border: 2px dashed var(--ink); background: #fff; padding: 26px; text-align: center; margin-bottom: 18px; cursor: pointer; display: block; }
.drop.is-over { background: var(--blue-field); border-color: var(--blue); }
.drop__title { font-family: var(--display); font-weight: 700; font-size: 15px; text-transform: uppercase; margin-bottom: 6px; }
.drop__text { font-size: 13px; color: var(--muted); }
.media { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.media__item { background: #fff; border: 2px solid var(--ink); display: flex; flex-direction: column; }
.media__thumb { height: 120px; background: var(--blue-soft); display: block; width: 100%; object-fit: cover; }
.media__thumb--doc { display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; font-size: 22px; color: var(--blue); }
.media__info { padding: 11px 12px; border-top: 2px solid var(--ink); flex: 1; display: flex; flex-direction: column; }
.media__name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media__meta { font-size: 12px; color: var(--muted); margin-top: 5px; }
.media__tags { display: flex; align-items: center; gap: 7px; margin-top: 9px; flex-wrap: wrap; }
.media__usage { font-size: 11px; color: var(--muted); }
.media__actions { margin-top: auto; padding-top: 9px; display: flex; gap: 6px; flex-wrap: wrap; }
.media--pick .media__item { cursor: pointer; }
.media--pick .media__item:hover { box-shadow: 4px 4px 0 var(--orange); }

/* ---------- Історія ---------- */
.hist { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.hist__avatar {
    width: 34px; height: 34px; flex: none; border: 2px solid var(--ink); background: var(--orange-soft); display: flex;
    align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; font-size: 11px;
}
.hist__text { font-size: 14px; line-height: 1.45; }
.hist__when { font-size: 12px; color: var(--muted); margin-top: 4px; }
.hist__tools { margin-left: auto; flex: none; display: flex; gap: 6px; }
.diff { margin: 0; font-family: ui-monospace, 'DejaVu Sans Mono', monospace; font-size: 12px; line-height: 1.55; overflow-x: auto; background: #fff; }
.diff__line { display: block; padding: 0 12px; white-space: pre-wrap; word-break: break-word; }
.diff__line--add { background: #e3f3e1; }
.diff__line--del { background: var(--red-soft); }
.diff__line--gap { color: var(--muted); background: var(--card); }

/* ---------- Користувачі ---------- */
.user { display: grid; grid-template-columns: 40px 1fr auto; gap: 14px; align-items: center; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.user__avatar {
    width: 40px; height: 40px; border: 2px solid var(--ink); background: var(--orange-soft); display: flex; align-items: center;
    justify-content: center; font-family: var(--display); font-weight: 700; font-size: 12px;
}
.user__avatar--off { background: var(--line); }
.user__name { font-family: var(--display); font-weight: 700; font-size: 14px; }
.user__meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.user__tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.user__tools form { display: inline-flex; gap: 6px; align-items: center; }
.user__tools select { font-family: var(--display); font-size: 11px; text-transform: uppercase; border: 2px solid var(--ink); padding: 6px; background: #fff; }
.linkbox { display: flex; gap: 8px; }
.linkbox input { flex: 1; font-family: ui-monospace, monospace; font-size: 12px; }

/* ---------- Діалоги, прев'ю, тости ---------- */
.overlay { position: fixed; inset: 0; z-index: 170; background: rgba(21, 20, 15, .62); display: flex; align-items: center; justify-content: center; padding: 24px; }
.dialog { width: 100%; max-width: 460px; background: var(--card); border: 2px solid var(--ink); box-shadow: 6px 6px 0 var(--red); }
.dialog--wide { max-width: 980px; max-height: calc(100vh - 48px); display: flex; flex-direction: column; box-shadow: 6px 6px 0 var(--orange); }
.dialog--info { box-shadow: 6px 6px 0 var(--orange); }
.dialog__head {
    padding: 13px 20px; background: var(--red); border-bottom: 2px solid var(--ink); font-family: var(--display); font-weight: 700;
    font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: #fff; display: flex; align-items: center;
}
.dialog--wide .dialog__head, .dialog--info .dialog__head { background: var(--ink); }
.dialog__head .btn { margin-left: auto; }
.dialog__body { padding: 24px; overflow: auto; }
.dialog__title { font-family: var(--display); font-weight: 700; font-size: 22px; text-transform: uppercase; margin: 0 0 10px; line-height: 1.05; }
.dialog__text { margin: 0; font-size: 15px; line-height: 1.55; color: var(--text-2); }
.dialog__actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.dialog form { display: flex; flex-direction: column; gap: 14px; }

.preview { position: fixed; inset: 0; z-index: 150; background: rgba(21, 20, 15, .7); display: flex; flex-direction: column; padding: 18px; }
.preview__bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.preview__title { font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--card); }
.preview__seg { display: flex; border: 2px solid var(--card); }
.preview__seg button {
    font-family: var(--display); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; padding: 8px 12px; border: none;
    cursor: pointer; background: var(--card); color: var(--ink);
}
.preview__seg--w button[aria-pressed="true"] { background: var(--orange); color: #fff; }
.preview__seg--l button[aria-pressed="true"] { background: var(--blue); color: #fff; }
.preview__close { margin-left: auto; border-color: var(--card); }
.preview__stage { flex: 1; min-height: 0; display: flex; justify-content: center; }
.preview__frame { width: 1280px; max-width: 100%; height: 100%; border: 2px solid var(--card); background: var(--card); }
.preview__frame[data-w="390"] { width: 390px; }
.preview__frame[data-w="768"] { width: 768px; }
.preview__msg { color: var(--card); font-size: 14px; }

.toast { position: fixed; right: 20px; bottom: 20px; z-index: 190; max-width: 360px; background: var(--ink); border: 2px solid var(--ink); box-shadow: 5px 5px 0 rgba(21, 20, 15, .25); display: flex; }
.toast__stripe { width: 6px; flex: none; background: var(--orange); }
.toast--ok .toast__stripe { background: var(--blue); }
.toast--err .toast__stripe { background: var(--red); }
.toast__body { padding: 14px 16px; }
.toast__title { font-family: var(--display); font-weight: 700; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: #fff; margin-bottom: 6px; }
.toast__text { font-size: 13px; line-height: 1.5; color: #d8d3c7; white-space: pre-line; }
.toast__close { align-self: flex-start; background: none; border: none; color: var(--muted-2); font-size: 17px; line-height: 1; padding: 10px 12px; cursor: pointer; }

.error-page { max-width: 560px; }

/* ---------- Адаптивність (як у макеті) ---------- */
@media (max-width: 1080px) {
    .side { position: fixed; left: 0; top: 0; bottom: 0; z-index: 120; transform: translateX(-100%); transition: transform .18s ease; height: auto; }
    .side[data-open="1"] { transform: translateX(0); }
    .burger { display: flex; }
    .rail { display: none; }
    .editor { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
    .pair { grid-template-columns: 1fr; gap: 10px; }
    .main { padding: 18px 16px 96px; }
    .top { padding: 10px 16px; }
    .status { display: none; }
    .row { grid-template-columns: 56px 1fr; gap: 12px; }
    .row .drag { display: none; }
    .row__meta { grid-column: 2; justify-content: flex-start; }
    .cards { grid-template-columns: 1fr; }
    .metrics { grid-template-columns: 1fr 1fr; }
    .media { grid-template-columns: 1fr 1fr; }
    .bar { flex-wrap: wrap; }
    .rep__head .drag { display: none; }
    .user { grid-template-columns: 40px 1fr; }
    .user__tools { grid-column: 1 / -1; justify-content: flex-start; }
}
