/* ============================================================
   АДМИНКА — вариант «Б»: верхнее меню, мягкий синий с логотипа УГП РКИ
   (тёмно-синий венка #243090, смягчённый; голубой ленты #006CB4 — для подсветки).
   Свои классы с приставкой ad-, чтобы стили сайта не пролезали внутрь.
   Правило простоты: одна главная (синяя) кнопка на экране, правка — в окне по центру.
   ============================================================ */
.ad, .ad-modal-wrap {
	--acc: #34509F;
	--acc-d: #283F86;
	--tint: #ECF0FA;
	--ink: #172033;
	--ink-2: #3D4762;
	--mut: #66708A;
	--line: #E3E8F0;
	--line-2: #D5DCE8;
	--bg: #F2F5FA;
	--card: #FFFFFF;
	--ok: #17794D;   --ok-bg: #E3F7EE;
	--warn: #8A5300; --warn-bg: #FFF1D9;
	--bad: #C4302B;  --bad-bg: #FFEDEC;
	--r: 12px;
	--f: "Manrope", "Segoe UI", system-ui, sans-serif;
	font-family: var(--f);
	color: var(--ink);
	font-size: 14px;
	line-height: 1.5;
	font-variant-numeric: tabular-nums;
}

/* режим админки: страница сайта уходит, остаётся чистый фон */
body.is-admin { background: #F2F5FA; padding: 0; }
body.is-admin .page-frame { width: auto; max-width: none; border: 0; border-radius: 0; box-shadow: none; background: transparent; overflow: visible; padding: 0; }

.ad *, .ad-modal-wrap * { box-sizing: border-box; }
.ad a { color: inherit; text-decoration: none; }
.ad svg, .ad a svg, .ad button svg, .ad-modal-wrap svg, .ad-modal-wrap button svg { width: 18px; height: 18px; flex: none; }
.ad h1, .ad h2, .ad h3, .ad-modal-wrap h2 { font-family: var(--f); text-wrap: balance; }
.ad code, .ad-modal-wrap code { font-family: "JetBrains Mono", Consolas, monospace; font-size: 13px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; }

/* ── верхняя полоса ─────────────────────────────────────────── */
.ad-bar {
	position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
	background: var(--card); border-bottom: 1px solid var(--line);
	display: flex; align-items: center; gap: 18px; height: 64px; padding: 0 24px;
}
.ad-logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 15px; white-space: nowrap; }
.ad-logo img { width: 38px; height: 38px; border-radius: 50%; object-fit: contain; background: #fff; }
.ad-logo small { display: block; font-size: 12px; font-weight: 600; color: var(--mut); }
.ad-tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.ad-tabs::-webkit-scrollbar { display: none; }
.ad-tab { padding: 8px 11px; border-radius: 10px; font-weight: 700; font-size: 14px; color: #4B5570; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; transition: background .15s, color .15s; }
.ad-tab:hover { background: var(--bg); color: var(--ink); }
.ad-tab.on { background: var(--tint); color: var(--acc-d); }
.ad-tab .ad-num { background: var(--bad); color: #fff; font-size: 11px; font-weight: 800; border-radius: 999px; padding: 0 6px; line-height: 18px; }
.ad-who { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--mut); white-space: nowrap; }
.ad-ava { width: 34px; height: 34px; border-radius: 50%; background: #DFE5F5; color: var(--acc-d); font-weight: 800; display: grid; place-items: center; }

/* ── страница ───────────────────────────────────────────────── */
.ad-page { max-width: 1280px; margin: 0 auto; padding: 28px 28px 60px; display: grid; gap: 20px; }
.ad-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.ad-head h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.ad-head p { margin: 4px 0 0; color: var(--mut); font-size: 14px; max-width: 70ch; }
.ad-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── кнопки ─────────────────────────────────────────────────── */
.ad-b {
	height: 40px; padding: 0 18px; border-radius: var(--r); border: 1px solid transparent;
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	font: 700 14px/1 var(--f); cursor: pointer; white-space: nowrap;
	transition: background .15s, border-color .15s, box-shadow .15s, transform .08s;
}
.ad-b:active:not([disabled]) { transform: translateY(1px); }
.ad-b:focus-visible { outline: 3px solid rgba(52,80,159,.3); outline-offset: 2px; }
.ad-b[disabled] { opacity: .5; cursor: default; }
.ad-b--p { background: var(--acc); color: #fff; box-shadow: 0 6px 16px -8px rgba(52,80,159,.55); }
.ad-b--p:hover:not([disabled]) { background: var(--acc-d); }
.ad-b--s { background: #fff; color: var(--ink); border-color: var(--line-2); }
.ad-b--s:hover:not([disabled]) { border-color: #B7C3D9; background: #FAFBFD; }
.ad-b--g { background: transparent; color: #4B5570; }
.ad-b--g:hover:not([disabled]) { background: #EEF2F8; }
.ad-b--d { background: var(--bad-bg); color: var(--bad); }
.ad-b--d:hover:not([disabled]) { background: #FFE0DE; }
.ad-b--dd { background: var(--bad); color: #fff; }
.ad-b--dd:hover:not([disabled]) { background: #A72520; }
.ad-b--sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.ad-b--ico { width: 34px; padding: 0; }

/* ── плитки с цифрами ───────────────────────────────────────── */
.ad-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.ad-stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: grid; gap: 2px; text-align: left; font-family: var(--f); color: var(--ink); }
button.ad-stat { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
button.ad-stat:hover { border-color: #B7C3D9; box-shadow: 0 6px 18px -12px rgba(20,40,90,.35); }
.ad-stat.on { border-color: var(--acc); box-shadow: 0 0 0 1px var(--acc) inset; }
.ad-stat span { font-size: 12.5px; color: var(--mut); font-weight: 700; }
.ad-stat b { font-size: 26px; font-weight: 800; line-height: 1.2; }
.ad-stat small { font-size: 13px; color: var(--mut); font-weight: 600; }
.ad-stat.warn b { color: var(--bad); }

/* ── панель со списком ──────────────────────────────────────── */
.ad-panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.ad-tools { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ad-seg { display: inline-flex; background: #EEF2F8; border-radius: 12px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.ad-seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 9px; font: 700 13px var(--f); color: #59637C; cursor: pointer; white-space: nowrap; }
.ad-seg button:hover { color: var(--ink); }
.ad-seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(20,40,90,.16); }
.ad-search { flex: 1; min-width: 200px; position: relative; }
.ad-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #8A93A8; }
.ad-search input { width: 100%; height: 40px; border-radius: var(--r); border: 1px solid var(--line-2); padding: 0 12px 0 40px; font: 500 14px var(--f); color: var(--ink); background: #fff; }
.ad-search input:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px rgba(52,80,159,.14); }
.ad-scroll { overflow-x: auto; }
.ad-table { width: 100%; border-collapse: collapse; }
.ad-table th { text-align: left; font-size: 12.5px; font-weight: 700; color: var(--mut); padding: 11px 16px; background: #FAFBFD; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ad-table td { padding: 13px 16px; border-bottom: 1px solid #EEF1F6; font-size: 14px; vertical-align: middle; }
.ad-table tr:last-child td { border-bottom: 0; }
.ad-table tbody tr:hover td { background: #FAFBFE; }
.ad-table td.id { color: #98A1B5; width: 56px; }
.ad-table td.act { text-align: right; white-space: nowrap; width: 1%; }
.ad-table td.act > * + * { margin-left: 6px; }
.ad-table .sub { display: block; color: var(--mut); font-size: 12.5px; margin-top: 1px; }
.ad-table .clip { max-width: 460px; }
.ad-foot { padding: 12px 16px; color: var(--mut); font-size: 13px; border-top: 1px solid var(--line); background: #FAFBFD; }
.ad-empty { padding: 46px 20px; text-align: center; color: var(--mut); display: grid; gap: 12px; justify-items: center; }
.ad-empty b { color: var(--ink); font-size: 16px; }

/* ── метки ──────────────────────────────────────────────────── */
.ad-tag { display: inline-flex; align-items: center; font-size: 12.5px; font-weight: 700; padding: 4px 10px; border-radius: 8px; white-space: nowrap; }
.ad-tag.t1 { background: #E6EEF8; color: #0A5A96; } .ad-tag.t2 { background: #E3F7EE; color: #17694A; }
.ad-tag.t3 { background: #F2EAFB; color: #6234A0; } .ad-tag.t4 { background: #FFF1D9; color: #8A5300; } .ad-tag.t5 { background: #FFE9E7; color: #A8322A; }
.ad-tag.ok { background: var(--ok-bg); color: var(--ok); } .ad-tag.warn { background: var(--warn-bg); color: var(--warn); }
.ad-tag.off { background: #EEF1F6; color: var(--mut); } .ad-tag.bad { background: var(--bad-bg); color: var(--bad); }
.ad-tag.d1 { background: #FFF4D6; color: #8A5A00; } .ad-tag.d2 { background: #EEF1F6; color: #4B5570; } .ad-tag.d3 { background: #FBE9DC; color: #7A3F1D; }
.ad-lvl { display: inline-grid; place-items: center; min-width: 36px; height: 26px; padding: 0 8px; border-radius: 8px; background: var(--tint); color: var(--acc-d); font-weight: 800; font-size: 13px; }
.ad-bar-mini { width: 120px; height: 8px; border-radius: 99px; background: #EEF1F6; overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 8px; }
.ad-bar-mini i { display: block; height: 100%; background: var(--acc); border-radius: 99px; }

/* ── карточки (справка, обращения, настройки) ───────────────── */
.ad-cards { display: grid; gap: 12px; }
.ad-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; display: grid; gap: 10px; }
.ad-card.new { border-color: #F2C77A; box-shadow: inset 4px 0 0 #F0A52F; }
.ad-card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ad-card-head b { font-size: 15px; }
.ad-card-head .sp { flex: 1; }
.ad-card .meta { color: var(--mut); font-size: 13px; }
.ad-card .text { white-space: pre-wrap; color: var(--ink-2); }
.ad-card textarea { width: 100%; }

/* ── поля форм ──────────────────────────────────────────────── */
.ad-f { display: grid; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.ad-f .hint { font-weight: 500; color: var(--mut); font-size: 12.5px; }
.ad-in {
	width: 100%; min-height: 42px; border: 1px solid var(--line-2); border-radius: var(--r);
	padding: 9px 12px; font: 500 14px/1.45 var(--f); color: var(--ink); background: #fff;
	transition: border-color .15s, box-shadow .15s;
}
textarea.ad-in { resize: vertical; min-height: 84px; }
select.ad-in { cursor: pointer; }
.ad-in:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px rgba(52,80,159,.14); }
.ad-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.ad-switch { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 14px; color: var(--ink); cursor: pointer; }
.ad-switch input { appearance: none; width: 44px; height: 26px; border-radius: 99px; background: #CDD5E3; position: relative; cursor: pointer; transition: background .15s; flex: none; margin: 0; }
.ad-switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.ad-switch input:checked { background: var(--acc); }
.ad-switch input:checked::after { transform: translateX(18px); }
.ad-switch input:focus-visible { outline: 3px solid rgba(52,80,159,.3); outline-offset: 2px; }
.ad-switch span small { display: block; font-weight: 500; color: var(--mut); font-size: 12.5px; }
.ad-err { background: var(--bad-bg); color: var(--bad); border-radius: 10px; padding: 9px 12px; font-size: 13px; font-weight: 600; }
.ad-err[hidden] { display: none; }

/* ── окно правки по центру ──────────────────────────────────── */
.ad-modal-wrap {
	position: fixed; inset: 0; z-index: 70; background: rgba(23,32,51,.38);
	display: grid; place-items: center; padding: 30px 16px; overflow-y: auto;
	animation: ad-fade .15s ease;
}
.ad-modal {
	width: min(620px, 100%); background: #fff; border-radius: 20px;
	box-shadow: 0 30px 80px -20px rgba(15,25,60,.45);
	display: grid; gap: 16px; padding: 24px 26px; animation: ad-pop .18s ease;
}
.ad-modal.wide { width: min(760px, 100%); }
.ad-modal.small { width: min(440px, 100%); }
.ad-mhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ad-mhead h2 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.ad-mhead p { margin: 3px 0 0; font-size: 13px; color: var(--mut); }
.ad-mfoot { display: flex; gap: 10px; align-items: center; padding-top: 4px; flex-wrap: wrap; }
.ad-mfoot .sp { flex: 1; }
.ad-kv { display: grid; grid-template-columns: 90px 1fr; gap: 10px 14px; align-items: center; background: var(--bg); border-radius: 14px; padding: 16px; font-size: 14px; }
.ad-kv dt { color: var(--mut); font-weight: 600; } .ad-kv dd { margin: 0; }
@keyframes ad-fade { from { opacity: 0; } }
@keyframes ad-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .ad-modal-wrap, .ad-modal { animation: none; } .ad-b, .ad-tab { transition: none; } }

/* ── ответы в редакторе задания ─────────────────────────────── */
.ad-answers { display: grid; gap: 8px; }
.ad-answers-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.ad-answers-head b { font-size: 13px; color: var(--ink-2); }
.ad-answers-head span { font-size: 12.5px; color: var(--mut); }
.ad-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ad-opt { display: flex; align-items: center; gap: 8px; border: 1.5px solid #E1E6EF; border-radius: var(--r); padding: 4px 6px 4px 8px; background: #fff; transition: border-color .15s, background .15s; }
.ad-opt.ok { border-color: var(--acc); background: #F3F6FC; }
.ad-opt input.ad-plain { flex: 1; border: 0; background: transparent; font: 600 14px var(--f); color: var(--ink); padding: 6px 2px; min-width: 0; }
.ad-opt input.ad-plain:focus { outline: none; }
.ad-mark { width: 24px; height: 24px; border-radius: 7px; border: 2px solid #C6CFDF; background: #fff; display: grid; place-items: center; cursor: pointer; flex: none; padding: 0; }
.ad-mark.round { border-radius: 50%; }
.ad-opt.ok .ad-mark { background: var(--acc); border-color: var(--acc); }
.ad-opt.ok .ad-mark::after { content: ""; width: 10px; height: 5px; border: 2.5px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.ad-x { width: 30px; height: 30px; border-radius: 8px; border: 0; background: transparent; color: #98A1B5; cursor: pointer; display: grid; place-items: center; flex: none; padding: 0; }
.ad-x:hover:not([disabled]) { background: var(--bad-bg); color: var(--bad); }
.ad-x[disabled] { opacity: .3; cursor: default; }
.ad-x svg { width: 16px !important; height: 16px !important; }
.ad-row { display: flex; align-items: center; gap: 8px; }
.ad-row .ad-in { flex: 1; }
.ad-row .n { width: 26px; height: 26px; border-radius: 8px; background: var(--tint); color: var(--acc-d); font-weight: 800; font-size: 13px; display: grid; place-items: center; flex: none; }
.ad-row .dash { color: var(--mut); font-weight: 700; }
.ad-add { justify-self: start; }

@media (max-width: 760px) {
	.ad-bar { padding: 0 14px; gap: 12px; }
	.ad-logo span, .ad-who span { display: none; }
	.ad-page { padding: 18px 14px 40px; }
	.ad-opts { grid-template-columns: 1fr; }
}
