/* ==========================================================================
   Трибунал Русе – админ (CMS). Мобилна обвивка, списък и редакция.
   Зарежда се след site.css и ползва неговите цветови променливи.
   ========================================================================== */

:root {
    --cms-top-h: 60px;
    --cms-tabs-h: 64px;
    --cms-radius: 14px;
    --cms-ok: #1f8a3b;
    --cms-ok-bg: rgba(31, 138, 59, .12);
    --cms-off: #6a6a6a;
    --cms-off-bg: rgba(106, 106, 106, .14);
    --cms-warn: #9a6400;
    --cms-warn-bg: rgba(255, 193, 7, .2);
    --cms-safe-b: env(safe-area-inset-bottom, 0px);
}
:root[data-theme="dark"] {
    --cms-ok: #5fd27f;
    --cms-ok-bg: rgba(95, 210, 127, .14);
    --cms-off: #b0bcc8;
    --cms-off-bg: rgba(176, 188, 200, .14);
    --cms-warn: #ffcf5a;
    --cms-warn-bg: rgba(255, 207, 90, .16);
}

body.cms { background: var(--bg-light); min-height: 100vh; min-height: 100dvh; }
body.cms main { padding-bottom: 2rem; }
.cms svg { flex: none; }
.cms :focus-visible { outline: 3px solid var(--accent-color); outline-offset: 2px; }
.cms input, .cms select, .cms textarea { font-size: 16px; } /* iOS не увеличава при писане */

/* ---------- Горна лента ---------- */
header.cms-top {
    position: sticky; top: 0; z-index: 900;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    box-shadow: none;
    padding-top: env(safe-area-inset-top, 0px);
}
.cms-top-in {
    max-width: 1200px; margin: 0 auto; height: var(--cms-top-h);
    display: flex; align-items: center; gap: .5rem; padding: 0 1rem;
}
.cms-brand { display: flex; align-items: center; gap: .6rem; color: var(--text-primary); font-weight: 700; margin-right: .75rem; min-width: 0; }
.cms-brand:hover { color: var(--text-primary); }
.cms-logo {
    width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
    background: var(--primary-color); color: #fff; font-family: Georgia, 'Times New Roman', serif; font-size: 1.2rem;
}
:root[data-theme="dark"] .cms-logo { color: #10202f; }
.cms-brand b { display: block; font-size: 1.05rem; line-height: 1.1; }
.cms-brand small { display: block; font-weight: 500; font-size: .75rem; color: var(--text-light); line-height: 1.2; }

.cms-nav { display: flex; align-items: center; gap: .25rem; flex: 1; }
.cms-nav a, .cms-drop > summary {
    display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; padding: 0 .85rem;
    border-radius: 10px; color: var(--text-secondary); font-weight: 600; font-size: .95rem; cursor: pointer;
}
.cms-nav a:hover, .cms-drop > summary:hover { background: var(--bg-light); color: var(--text-primary); }
.cms-nav a[aria-current="page"] { color: var(--primary-color); background: var(--bg-light); }
.cms-nav svg, .cms-drop svg { width: 18px; height: 18px; }
.cms-new {
    display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: 0 1.1rem; border-radius: 10px;
    background: var(--success-color); color: #fff !important; font-weight: 700; white-space: nowrap;
}
.cms-new:hover { filter: brightness(.95); }
.cms-new svg { width: 18px; height: 18px; }

.cms-drop { position: relative; }
.cms-drop > summary { list-style: none; }
.cms-drop > summary::-webkit-details-marker { display: none; }
.cms-drop[open] > summary { background: var(--bg-light); color: var(--text-primary); }
.cms-drop-menu {
    position: absolute; right: 0; top: calc(100% + 6px); min-width: 240px; z-index: 950;
    background: var(--bg-white); border: 1px solid var(--border-color); border-radius: 12px; box-shadow: var(--shadow-lg);
    padding: .4rem; display: flex; flex-direction: column;
}
.cms-nav .cms-drop-menu { left: 0; right: auto; }
.cms-drop-menu a, .cms-drop-menu button {
    display: flex; align-items: center; gap: .6rem; min-height: 44px; padding: 0 .75rem; border-radius: 8px;
    color: var(--text-primary); font: inherit; font-weight: 500; background: none; border: 0; text-align: left; cursor: pointer; width: 100%;
}
.cms-drop-menu a:hover, .cms-drop-menu button:hover { background: var(--bg-light); }
.cms-drop-menu hr { border: 0; border-top: 1px solid var(--border-color); margin: .35rem 0; }
.cms-drop-menu .cms-danger { color: var(--danger-color); }
.cms-drop-label { font-size: .75rem; font-weight: 700; color: var(--text-light); text-transform: uppercase; letter-spacing: .04em; padding: .5rem .75rem .25rem; }
.cms-user > summary { gap: .5rem; }
.cms-avatar {
    width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .9rem;
    background: var(--bg-gray); color: var(--primary-color); text-transform: uppercase;
}
.cms-top-right { display: flex; align-items: center; gap: .5rem; margin-left: auto; }

/* Бутон „назад“ в лентата (на форми) */
.cms-back {
    display: none; width: 44px; height: 44px; border-radius: 10px; place-items: center; color: var(--text-primary); margin-left: -.5rem;
}
.cms-back svg { width: 24px; height: 24px; }

/* ---------- Долна лента (телефон) ---------- */
.cms-tabs { display: none; }
@media (max-width: 860px) {
    :root { --cms-top-h: 56px; }
    .cms-nav, .cms-top-right .cms-new, .cms-top-right .cms-drop { display: none; }
    .cms-tabs {
        display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
        background: var(--bg-white); border-top: 1px solid var(--border-color);
        padding: 0 .25rem var(--cms-safe-b);
        box-shadow: 0 -4px 16px rgba(0, 0, 0, .06);
    }
    .cms-tabs a, .cms-tabs button {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
        height: var(--cms-tabs-h); color: var(--text-light); font: inherit; font-size: .72rem; font-weight: 600;
        background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent;
    }
    .cms-tabs svg { width: 24px; height: 24px; }
    .cms-tabs [aria-current="page"] { color: var(--primary-color); }
    .cms-tabs .cms-tab-new span.cms-plus {
        width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; margin-top: -18px;
        background: var(--success-color); color: #fff; box-shadow: 0 6px 16px rgba(40, 167, 69, .4);
    }
    .cms-tabs .cms-tab-new span.cms-plus svg { width: 28px; height: 28px; }
    .cms-tabs .cms-tab-new { color: var(--text-primary); }
    body.cms main { padding-bottom: calc(var(--cms-tabs-h) + var(--cms-safe-b) + 1.5rem); }
    /* На форми долната лента се сменя с лентата за запис */
    body.cms-form .cms-tabs { display: none; }
    body.cms-form main { padding-bottom: 0; }
    body.cms-form .cms-back { display: grid; }
    body.cms-form .cms-brand small { display: none; }
}

/* ---------- Менюто на телефона (лист отдолу) ---------- */
.cms-sheet {
    border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 560px; max-height: 85vh;
    background: var(--bg-white); color: var(--text-primary); border-radius: 20px 20px 0 0;
    padding-bottom: var(--cms-safe-b);
}
.cms-sheet::backdrop { background: rgba(0, 0, 0, .5); }
.cms-sheet[open] { animation: cmsUp .22s ease-out; }
@keyframes cmsUp { from { transform: translateY(40px); opacity: .4; } }
.cms-sheet-head { display: flex; align-items: center; gap: .75rem; padding: 1rem 1.25rem .5rem; }
.cms-sheet-head b { display: block; font-size: 1.05rem; }
.cms-sheet-head small { color: var(--text-light); }
.cms-sheet-head form { margin-left: auto; }
.cms-sheet-x { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--bg-light); color: var(--text-primary); font-size: 1.3rem; cursor: pointer; }
.cms-sheet nav { padding: .25rem .75rem 1rem; display: flex; flex-direction: column; }
.cms-sheet nav a, .cms-sheet nav button {
    display: flex; align-items: center; gap: .85rem; min-height: 52px; padding: 0 .75rem; border-radius: 10px;
    color: var(--text-primary); font: inherit; font-size: 1rem; font-weight: 500; background: none; border: 0; width: 100%; text-align: left; cursor: pointer;
}
.cms-sheet nav a:active, .cms-sheet nav button:active { background: var(--bg-light); }
.cms-sheet nav svg { width: 22px; height: 22px; color: var(--text-light); }
.cms-sheet nav hr { border: 0; border-top: 1px solid var(--border-color); margin: .4rem .75rem; }
.cms-sheet .cms-danger, .cms-sheet .cms-danger svg { color: var(--danger-color); }

/* Бутонът за тема вътре в менютата: да прилича на ред, не на кръгче */
.cms .theme-toggle.cms-theme-row { position: static; width: 100%; height: auto; border-radius: 10px; box-shadow: none; border: 0; justify-content: flex-start; }
.cms .theme-toggle.cms-theme-row .theme-icon { display: none !important; }
.cms-theme-row .cms-theme-ico { display: inline-flex; }

/* ---------- Известия ---------- */
.cms-flash { max-width: 860px; margin: 1rem auto 0; padding: 0 1rem; }
.cms-flash .alert { margin: 0 0 .5rem; border-radius: 12px; }

/* ---------- Страница: общи ---------- */
.cms-page { max-width: 860px; margin: 0 auto; padding: 1.25rem 1rem; }
.cms-page-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.cms-page-head h1 { margin: 0; font-size: 1.75rem; color: var(--text-primary); }
.cms-page-head p { margin: 0; color: var(--text-light); }
.cms-page-head .cms-new { margin-left: auto; }
@media (max-width: 860px) {
    .cms-page { padding: 1rem .875rem; }
    .cms-page-head h1 { font-size: 1.5rem; }
    .cms-page-head .cms-new { display: none; }
}

/* ---------- Списък с публикации ---------- */
.cms-tools { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1rem; }
.cms-search { position: relative; }
.cms-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--text-light); pointer-events: none; }
.cms-search input {
    width: 100%; min-height: 48px; padding: 0 1rem 0 44px; border-radius: 12px;
    border: 1px solid var(--input-border); background: var(--input-bg); color: var(--input-text);
}
.cms-search input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px var(--input-focus-ring); }
.cms-chips { display: flex; gap: .5rem; overflow-x: auto; scrollbar-width: none; margin: 0 -1rem; padding: 0 1rem 2px; -webkit-overflow-scrolling: touch; }
.cms-chips::-webkit-scrollbar { display: none; }
.cms-chip {
    flex: none; display: inline-flex; align-items: center; gap: .4rem; min-height: 40px; padding: 0 1rem; border-radius: 999px;
    border: 1px solid var(--border-color); background: var(--bg-white); color: var(--text-secondary); font-weight: 600; font-size: .9rem; white-space: nowrap;
}
.cms-chip:hover { color: var(--text-primary); border-color: var(--text-light); }
.cms-chip[aria-current="true"] { background: var(--primary-color); border-color: var(--primary-color); color: #fff; }
:root[data-theme="dark"] .cms-chip[aria-current="true"] { color: #10202f; }
.cms-chip em { font-style: normal; font-weight: 700; opacity: .7; }
.cms-section-select {
    min-height: 40px; border-radius: 999px; padding: 0 2.25rem 0 1rem; border: 1px solid var(--border-color);
    background: var(--bg-white); color: var(--text-secondary); font-weight: 600; font-size: .9rem; flex: none;
}

.cms-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .75rem; }
.cms-card {
    position: relative; display: grid; grid-template-columns: 96px 1fr auto; gap: 1rem; align-items: center;
    background: var(--bg-white); border: 1px solid var(--border-color); border-radius: var(--cms-radius); padding: .75rem;
}
.cms-card:hover { border-color: var(--text-light); }
.cms-card:focus-within { border-color: var(--primary-color); }
.cms-thumb {
    width: 96px; height: 72px; border-radius: 10px; overflow: hidden; background: var(--bg-gray);
    display: grid; place-items: center; color: var(--primary-color); font-family: Georgia, serif; font-size: 1.6rem; font-weight: 700;
}
.cms-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cms-card-body { min-width: 0; display: flex; flex-direction: column; gap: .3rem; }
.cms-card h2 { margin: 0; font-size: 1.05rem; line-height: 1.35; color: var(--text-primary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cms-card h2 a { color: inherit; }
.cms-card h2 a::after { content: ''; position: absolute; inset: 0; border-radius: var(--cms-radius); } /* цялата карта отваря редакцията */
.cms-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .6rem; font-size: .85rem; color: var(--text-light); }
.cms-pill { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.cms-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.cms-pill.on { color: var(--cms-ok); background: var(--cms-ok-bg); }
.cms-pill.off { color: var(--cms-off); background: var(--cms-off-bg); }
.cms-pill.warn { color: var(--cms-warn); background: var(--cms-warn-bg); }
.cms-card-actions { position: relative; z-index: 2; display: flex; align-items: center; gap: .25rem; }
.cms-icon-btn {
    width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; border: 0; background: none;
    color: var(--text-secondary); cursor: pointer; list-style: none;
}
.cms-icon-btn::-webkit-details-marker { display: none; }
.cms-icon-btn:hover, details[open] > .cms-icon-btn { background: var(--bg-light); color: var(--text-primary); }
.cms-icon-btn svg { width: 22px; height: 22px; }
.cms-card-actions .cms-drop-menu form { margin: 0; }
.cms-card-actions .cms-drop-menu { min-width: 220px; }

.cms-empty { text-align: center; padding: 3rem 1rem; background: var(--bg-white); border: 1px dashed var(--border-color); border-radius: var(--cms-radius); }
.cms-empty h2 { font-size: 1.2rem; color: var(--text-primary); margin: 0 0 .5rem; }
.cms-empty p { margin: 0 0 1.25rem; }
.cms-more { display: flex; justify-content: center; margin-top: 1.25rem; }
.cms-more a { min-height: 48px; display: inline-flex; align-items: center; padding: 0 1.5rem; border-radius: 12px; border: 1px solid var(--border-color); background: var(--bg-white); font-weight: 600; }

@media (max-width: 600px) {
    .cms-card { grid-template-columns: 72px 1fr auto; gap: .75rem; padding: .625rem; }
    .cms-thumb { width: 72px; height: 72px; }
    .cms-card h2 { font-size: 1rem; }
    .cms-card-actions .cms-act-site { display: none; }
}

/* ==========================================================================
   Форма за публикация (нова и редакция)
   ========================================================================== */
.qp { max-width: 820px; margin: 0 auto; padding: 1.25rem 1rem 140px; display: flex; flex-direction: column; gap: 1.25rem; }
.qp-head h1 { margin: 0; font-size: 1.75rem; color: var(--text-primary); }
.qp-sub { margin: .25rem 0 0; color: var(--text-secondary); }
.qp-stack { display: flex; flex-direction: column; gap: 1.25rem; }
.qp-step { background: var(--bg-white); border: 1px solid var(--border-color); border-radius: var(--cms-radius); padding: 1.25rem; display: flex; flex-direction: column; gap: .75rem; min-width: 0; }
.qp-step h2 { margin: 0; font-size: 1.15rem; display: flex; gap: .6rem; align-items: center; color: var(--text-primary); }
.qp-num { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--primary-color); color: #fff; font-size: 1rem; flex: none; }
:root[data-theme="dark"] .qp-num { color: #10202f; }
.qp-hint { margin: 0; color: var(--text-secondary); font-size: .95rem; }
.qp-step h2 .qp-hint { font-weight: 400; }
.qp label.qp-lbl { font-weight: 600; color: var(--text-primary); }
.qp .form-input { min-height: 48px; border-radius: 10px; }
.qp-title { font-size: 1.2rem !important; font-weight: 600; }
.qp-title::placeholder { color: var(--text-light); font-weight: 400; opacity: 1; }
.qp #editor-container { min-height: 260px; font-size: 1.05rem; background: var(--input-bg); color: var(--input-text); border-radius: 0 0 10px 10px; }
.qp .ql-toolbar { background: var(--bg-light); border-radius: 10px 10px 0 0; }
.qp .ql-toolbar button { width: 36px; height: 36px; }
.qp .ql-editor { min-height: 240px; line-height: 1.6; }
.qp .ql-editor.ql-blank::before { color: var(--text-light); font-style: normal; }
:root[data-theme="dark"] .qp .ql-snow .ql-stroke { stroke: var(--text-secondary); }
:root[data-theme="dark"] .qp .ql-snow .ql-fill { fill: var(--text-secondary); }
.qp-drop { border: 2px dashed var(--border-color); border-radius: 12px; padding: 1.5rem 1rem; text-align: center; cursor: pointer; background: var(--bg-light); }
.qp-drop.over, .qp-drop:hover { border-color: var(--primary-color); }
.qp-drop strong { display: block; font-size: 1.05rem; color: var(--text-primary); }
.qp-drop span { color: var(--text-secondary); font-size: .95rem; }
.qp-drop .qp-drop-touch { display: none; }
@media (hover: none) and (pointer: coarse) {
    .qp-drop .qp-drop-mouse { display: none; }
    .qp-drop .qp-drop-touch { display: block; }
}
.qp-files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.qp-files li { display: grid; grid-template-columns: 52px 1fr auto; gap: .75rem; align-items: center; border: 1px solid var(--border-color); border-radius: 10px; padding: .5rem .5rem .5rem .75rem; background: var(--bg-white); }
.qp-files li.removed { opacity: .5; }
.qp-files li.removed .qp-fname { text-decoration: line-through; }
.qp-thumb { width: 52px; height: 52px; border-radius: 8px; background: var(--bg-gray); display: grid; place-items: center; font-size: .75rem; font-weight: 700; color: var(--primary-color); overflow: hidden; }
.qp-thumb img { width: 100%; height: 100%; object-fit: cover; }
.qp-fname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); }
.qp-fname small { display: block; color: var(--text-secondary); }
.qp-cover { color: var(--accent-color); font-weight: 600; }
.qp-x { background: none; border: 0; color: var(--danger-color); cursor: pointer; font: inherit; font-weight: 600; min-height: 44px; padding: 0 .75rem; border-radius: 8px; }
.qp-x:hover { background: var(--bg-light); }
.qp-x.undo { color: var(--primary-color); }
.qp-group-title { margin: .25rem 0 0; font-size: .85rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-light); }
.qp-where { display: flex; flex-wrap: wrap; gap: .5rem; }
.qp-where input { position: absolute; opacity: 0; pointer-events: none; }
.qp-where label { border: 2px solid var(--border-color); border-radius: 999px; padding: 0 1rem; min-height: 44px; display: inline-flex; align-items: center; cursor: pointer; background: var(--bg-white); color: var(--text-primary); font-weight: 500; }
.qp-where input:checked + label { background: var(--primary-color); border-color: var(--primary-color); color: #fff; }
:root[data-theme="dark"] .qp-where input:checked + label { color: #10202f; }
.qp-where input:focus-visible + label { outline: 3px solid var(--accent-color); }
.qp-extra summary { cursor: pointer; font-weight: 600; color: var(--text-primary); min-height: 44px; display: flex; align-items: center; }
.qp-extra textarea { min-height: 110px; }

/* Превключвател „Видима на сайта“ */
.qp-switch { display: flex; align-items: center; gap: .75rem; cursor: pointer; user-select: none; min-height: 44px; }
.qp-switch input { position: absolute; opacity: 0; pointer-events: none; }
.qp-switch .qp-track { width: 52px; height: 30px; border-radius: 999px; background: var(--bg-gray); position: relative; flex: none; transition: background .2s; border: 1px solid var(--border-color); }
.qp-switch .qp-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.qp-switch input:checked + .qp-track { background: var(--success-color); border-color: var(--success-color); }
.qp-switch input:checked + .qp-track::after { transform: translateX(22px); }
.qp-switch input:focus-visible + .qp-track { outline: 3px solid var(--accent-color); outline-offset: 2px; }
.qp-switch b { display: block; color: var(--text-primary); }
.qp-switch small { display: block; color: var(--text-secondary); font-size: .85rem; }

/* Лента за запис, закрепена отдолу */
.qp-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 920; background: var(--bg-white); border-top: 1px solid var(--border-color); box-shadow: 0 -4px 16px rgba(0,0,0,.08); padding: .75rem 1rem calc(.75rem + var(--cms-safe-b)); }
.qp-bar-in { max-width: 820px; margin: 0 auto; display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.qp-check { flex: 1 1 220px; color: var(--text-secondary); font-size: .95rem; }
.qp-check.ready { color: var(--cms-ok); font-weight: 600; }
.qp-bar .btn { min-height: 48px; justify-content: center; border-radius: 10px; }
.qp-btn-pub { font-size: 1.1rem !important; padding: .75rem 2rem !important; }
@media (max-width: 600px) {
    .qp { padding: 1rem .75rem 170px; gap: 1rem; }
    .qp-head h1 { font-size: 1.5rem; }
    .qp-step { padding: 1rem; border-radius: 12px; }
    .qp-step .qp-where { flex-wrap: nowrap; overflow-x: auto; margin: 0 -1rem; padding: 0 1rem 4px; scrollbar-width: none; }
    .qp-step .qp-where::-webkit-scrollbar { display: none; }
    .qp-step .qp-where label { flex: none; white-space: nowrap; }
    .qp-check { flex-basis: 100%; font-size: .9rem; }
    .qp-bar-in .btn { flex: 1 1 0; padding-left: .75rem; padding-right: .75rem; }
    .qp-btn-pub { font-size: 1.05rem !important; padding: .75rem 1rem !important; flex-grow: 2 !important; }
    .qp #editor-container { min-height: 220px; }
    .qp .ql-editor { min-height: 200px; }
}

.qp-modal { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 1rem; }
.qp-modal[hidden] { display: none; }
.qp-card { background: var(--bg-white); color: var(--text-primary); border-radius: 16px; max-width: 520px; width: 100%; padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.qp-card h3 { margin: 0; font-size: 1.4rem; color: var(--text-primary); }
.qp-card ul { margin: 0; padding-left: 1.25rem; color: var(--text-secondary); }
.qp-card-row { display: flex; gap: .75rem; justify-content: flex-end; flex-wrap: wrap; }
.qp-card-row .btn { min-height: 48px; justify-content: center; border-radius: 10px; }
@media (max-width: 600px) {
    .qp-modal:not(.qp-modal-center) { place-items: end stretch; padding: 0; }
    .qp-modal:not(.qp-modal-center) .qp-card { border-radius: 20px 20px 0 0; max-width: none; padding-bottom: calc(1.5rem + var(--cms-safe-b)); }
    .qp-card-row .btn { flex: 1 1 0; }
}
.qp-busy { text-align: center; }
.qp-spin { width: 48px; height: 48px; border-radius: 50%; border: 5px solid var(--bg-gray); border-top-color: var(--primary-color); margin: 0 auto; animation: qpspin 1s linear infinite; }
@keyframes qpspin { to { transform: rotate(360deg); } }

/* Резултат след публикуване */
.qp-done { max-width: 620px; margin: 2rem auto; background: var(--bg-white); border: 1px solid var(--border-color); border-radius: 16px; padding: 2rem 1.25rem; text-align: center; display: flex; flex-direction: column; gap: 1rem; align-items: center; }
.qp-done h1 { margin: 0; font-size: 1.9rem; color: var(--text-primary); }
.qp-done p { margin: 0; }
.qp-done-icon { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; }
.qp-done-icon svg { width: 40px; height: 40px; }
.qp-done-icon.ok { background: var(--cms-ok-bg); color: var(--cms-ok); }
.qp-done-icon.bad { background: rgba(220, 53, 69, .12); color: var(--danger-color); }
.qp-done-title { font-weight: 600; font-size: 1.1rem; color: var(--text-primary); }
.qp-done-actions { display: flex; gap: .75rem; flex-wrap: wrap; justify-content: center; width: 100%; }
.qp-done-actions .btn { font-size: 1.05rem; padding: .75rem 1.5rem; min-height: 48px; justify-content: center; border-radius: 10px; }
@media (max-width: 600px) {
    .qp-done { margin: 1rem .75rem; }
    .qp-done-actions > * { flex: 1 1 100%; }
    .qp-done-actions form .btn { width: 100%; }
}

/* По-старите екрани (Сигнали, Модерация...) на телефон */
@media (max-width: 860px) {
    body.cms .container { padding: 1rem .875rem; }
    body.cms .table-responsive, body.cms .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    body.cms .btn { min-height: 44px; }
    body.cms h1 { font-size: 1.6rem; }
}
.cms-card:has(details[open]) .cms-card-actions { z-index: 5; }

/* ---------- Вход ---------- */
body.cms-login { display: block; }
.cms-login .login-container { min-height: 100vh; min-height: 100dvh; padding: 1rem; display: grid; place-items: center; }
.cms-login .login-card { width: 100%; max-width: 420px; border-radius: 18px; padding: 2rem 1.5rem; }
.cms-login .login-header { text-align: center; }
.cms-login-logo { width: 56px; height: 56px; font-size: 1.8rem; border-radius: 16px; margin: 0 auto .75rem; }
.cms-login .login-title { font-size: 1.75rem; margin-bottom: .25rem; }
.cms-login .form-input { min-height: 50px; font-size: 16px; border-radius: 10px; padding: 0 .9rem; }
.cms-login .btn-login { width: 100%; min-height: 52px; justify-content: center; font-size: 1.1rem; border-radius: 10px; }
.cms-login .theme-toggle-standalone { top: max(12px, env(safe-area-inset-top)); right: 12px; left: auto; }
@media (max-width: 600px) {
    .cms-login .login-container { place-items: start center; padding-top: 3.5rem; }
    .cms-login .login-card { padding: 1.5rem 1.25rem; box-shadow: none; }
}
.cms-login .theme-toggle-standalone { position: fixed; width: 44px !important; height: 44px; min-height: 44px; padding: 0 !important; margin: 0; justify-content: center; border-radius: 50%; }
.cms-login .theme-toggle-standalone svg { width: 20px; height: 20px; }
.cms-thumb { position: relative; }
.cms-thumb img { position: absolute; inset: 0; }
.theme-toggle svg[hidden] { display: none !important; }
