/* Адмінка бота ОВА */
:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1c2433;
  --muted: #5a6476;
  --line: #d9dee7;
  --primary: #1d5bbf;
  --primary-dark: #154593;
  --danger: #b42318;
  --ok-bg: #e7f6ec; --ok: #146c2e;
  --warn-bg: #fff6e0; --warn: #8a5a00;
  --err-bg: #fdecea; --err: #a1190f;
  --tg-chat: #dfe7ef;
  --tg-msg: #ffffff;
  --tg-btn: rgba(32, 72, 112, .12);
  --radius: 10px;
  --focus: 0 0 0 3px rgba(29, 91, 191, .45);
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 1rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--primary); }
a:hover { color: var(--primary-dark); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
h1 { font-size: 1.6rem; margin: .2rem 0 .8rem; }
h2 { font-size: 1.2rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: 0 0 .4rem; }
code { background: #eef1f6; padding: 0 .3em; border-radius: 4px; font-size: .9em; }
pre.json { white-space: pre-wrap; word-break: break-word; max-height: 18rem; overflow: auto; background: #f7f8fb; padding: .5rem; font-size: .8rem; border-radius: 6px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: .5rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.big { font-size: 1.8rem; font-weight: 700; margin: 0; }

/* --- Шапка ---------------------------------------------------------------- */
.top { background: #12305f; color: #fff; position: sticky; top: 0; z-index: 5; }
.top-inner { max-width: 1400px; margin: 0 auto; padding: .5rem 1rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.brand { color: #fff; text-decoration: none; font-weight: 700; white-space: nowrap; display: inline-flex; align-items: center; gap: .5rem; padding: .2rem .4rem .2rem .2rem; border-radius: 8px; }
.brand:hover, .brand:focus-visible { color: #fff; background: rgba(255,255,255,.12); }
.brand-mark { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 8px; background: #2a78d6; font-size: .8rem; letter-spacing: .02em; }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; align-items: center; }
.nav > a, .nav-more > summary { color: #dbe6ff; text-decoration: none; padding: .35rem .7rem; border-radius: 6px; cursor: pointer; }
.nav > a:hover, .nav-more > summary:hover { background: rgba(255,255,255,.12); color: #fff; }
.nav a[aria-current="page"], .nav-more[data-current] > summary { background: rgba(255,255,255,.2); color: #fff; }
.nav-more { position: relative; }
.nav-more > summary { list-style: none; }
.nav-more > summary::after { content: " ▾"; }
.nav-menu { position: absolute; top: 2.2rem; left: 0; background: #fff; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: .35rem; min-width: 16rem; display: flex; flex-direction: column; }
/* Пункти випадаючого меню — темний текст на світлому, і для поточного, і для
   наведеного. Раніше поточний успадковував білий колір верхнього меню й
   зливався з фоном. */
.nav .nav-menu a { color: var(--text); text-decoration: none; padding: .5rem .75rem; border-radius: 6px; }
.nav .nav-menu a:hover, .nav .nav-menu a:focus-visible { background: #eef3fc; color: var(--primary-dark); }
.nav .nav-menu a[aria-current="page"] { background: #e1ecff; color: var(--primary-dark); font-weight: 600; box-shadow: inset 3px 0 0 var(--primary); }
.logout { display: flex; align-items: center; gap: .5rem; margin: 0; }
.who { opacity: .85; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draftbar { background: #e9eef6; color: var(--text); font-size: .95rem; }
.draftbar .top-inner { padding: .35rem 1rem; justify-content: space-between; }
.draftbar-pending { background: #fff3cd; }
.draftbar-error { background: #fbd9d5; }

/* --- Сторінка ------------------------------------------------------------- */
.page { max-width: 1100px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }
.page-wide { max-width: 1400px; }
.page-narrow { max-width: 640px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.card-flat { background: transparent; border-style: dashed; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem; align-items: end; }
.head-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.crumbs { margin: 0 0 .3rem; font-size: .9rem; }
.login { margin-top: 3rem; }

/* --- Повідомлення --------------------------------------------------------- */
.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: .8rem; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-warn { background: var(--warn-bg); color: var(--warn); }
.flash-error { background: var(--err-bg); color: var(--err); }
.box { border-radius: 8px; padding: .7rem 1rem; margin: .8rem 0; }
.box ul { margin: .3rem 0 0; padding-left: 1.2rem; }
.box-error { background: var(--err-bg); color: var(--err); }
.box-warn { background: var(--warn-bg); color: var(--warn); }

/* --- Форми ---------------------------------------------------------------- */
.field { margin-bottom: 1rem; border: 0; padding: 0; }
.field > label, .field > legend { display: block; font-weight: 600; margin-bottom: .3rem; }
fieldset.field { border: 1px solid var(--line); border-radius: 8px; padding: .8rem; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=search], input[type=date], select, textarea {
  width: 100%; font: inherit; color: inherit; background: #fff;
  border: 1px solid #b9c1ce; border-radius: 7px; padding: .5rem .6rem;
}
textarea { resize: vertical; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .92rem; line-height: 1.45; }
input[readonly] { background: #f1f3f7; color: var(--muted); }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; cursor: pointer; }
.check input { width: 1.15rem; height: 1.15rem; }
.help { color: var(--muted); font-size: .875rem; margin: .3rem 0 0; }
.inline { display: flex; gap: .5rem; align-items: center; }
.inline input { flex: 1; }
.stack > * + * { margin-top: .5rem; }
.actions { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-top: 1rem; }
.more > summary { cursor: pointer; font-weight: 600; margin-bottom: .8rem; }
.filters { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin: .6rem 0 1rem; }
.filters input[type=search] { max-width: 22rem; }
.publish { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end; }
.publish .field { flex: 1; min-width: 16rem; margin: 0; }
.inline-form { margin-top: .8rem; }

/* --- Кнопки --------------------------------------------------------------- */
.btn, .row-tools button {
  display: inline-flex; align-items: center; justify-content: center; gap: .3rem;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  border: 1px solid #b9c1ce; background: #fff; color: var(--text);
  padding: .5rem .9rem; border-radius: 7px; min-height: 2.5rem;
}
.btn:hover, .row-tools button:hover { background: #f1f4f9; color: var(--text); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn[disabled], .row-tools button[disabled] { opacity: .45; cursor: not-allowed; }
.btn-small { padding: .25rem .6rem; min-height: 2rem; font-size: .9rem; }
.btn-wide { width: 100%; }
.btn-quiet { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); min-height: 2rem; padding: .2rem .7rem; }
.btn-quiet:hover { background: rgba(255,255,255,.12); color: #fff; }
.btn-danger-quiet { color: var(--danger); border-color: #e8b4ae; }
.btn-danger-quiet:hover { background: var(--err-bg); color: var(--danger); }
.row-tools { white-space: nowrap; }
.row-tools form { display: inline; margin: 0; }
.row-tools button { min-height: 2rem; padding: .15rem .55rem; font-weight: 500; }
.toolbar { display: flex; gap: .3rem; margin-bottom: .3rem; flex-wrap: wrap; }
.toolbar button { font: inherit; border: 1px solid #b9c1ce; background: #fff; border-radius: 6px; padding: .2rem .6rem; cursor: pointer; min-height: 2rem; }
.toolbar button:hover { background: #eef3fc; }

/* --- Таблиці -------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table, .rows { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .5rem .55rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .85rem; color: var(--muted); font-weight: 600; }
.rows th { text-align: left; font-size: .8rem; color: var(--muted); font-weight: 600; padding: 0 .3rem .3rem; }
.rows td { padding: .2rem .3rem; vertical-align: middle; }
.rows input, .rows select { padding: .35rem .45rem; }

/* --- Мітки ---------------------------------------------------------------- */
.tag { display: inline-block; font-size: .75rem; font-weight: 600; padding: .05rem .45rem; border-radius: 999px; background: #e8ecf3; color: #3a4558; vertical-align: middle; }
.tag-menu { background: #e1ecff; color: #1d4fa3; }
.tag-hidden { background: #eceff3; color: #5a6476; }
.tag-error { background: var(--err-bg); color: var(--err); }
.tag-todo { background: var(--warn-bg); color: var(--warn); }
.tag-added { background: var(--ok-bg); color: var(--ok); }
.tag-changed { background: #e1ecff; color: #1d4fa3; }
.tag-removed { background: var(--err-bg); color: var(--err); }
.tag-order { background: #eceff3; color: #3a4558; }
.changes { list-style: none; padding: 0; margin: .4rem 0; }
.changes li { padding: .25rem 0; border-bottom: 1px dashed var(--line); }

/* --- Дерево екранів ------------------------------------------------------- */
.tree, .tree ul { list-style: none; margin: 0; padding-left: 1.3rem; }
.tree { padding-left: 0; }
.tree ul { border-left: 2px solid var(--line); margin-left: .4rem; }
.node { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; padding: .3rem .4rem; border-radius: 6px; }
.node:hover { background: #fff; }
.node-title { font-weight: 600; text-decoration: none; }
.node-id { font-size: .75rem; color: var(--muted); background: transparent; }
.node-add { font-size: .8rem; margin-left: auto; opacity: 0; text-decoration: none; }
.node:hover .node-add, .node-add:focus { opacity: 1; }
li.dim > .node { opacity: .45; }

/* --- Редактор екрана з переглядом ----------------------------------------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1.2rem; align-items: start; }
.editor-preview { position: sticky; top: 7rem; }
.editor-preview h2 { font-size: 1rem; color: var(--muted); }
@media (max-width: 1000px) {
  .editor { grid-template-columns: 1fr; }
  .editor-preview { position: static; }
}

/* --- Telegram -------------------------------------------------------------- */
.tg { background: var(--tg-chat); border-radius: 14px; padding: .8rem; }
.tg-note { background: #fff3cd; color: #6b4a00; border-radius: 8px; padding: .35rem .6rem; font-size: .85rem; margin: 0 0 .5rem; }
.tg-msg { background: var(--tg-msg); border-radius: 12px 12px 12px 4px; padding: .6rem .75rem; white-space: normal; word-wrap: break-word; font-size: .95rem; box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.tg-msg blockquote { border-left: 3px solid #4a90d9; margin: .3rem 0; padding-left: .6rem; }
.tg-msg pre { white-space: pre-wrap; background: #f2f4f7; padding: .4rem; border-radius: 6px; }
.tg-msg .spoiler { background: #c9cfd8; color: transparent; border-radius: 3px; }
.tg-msg .spoiler:hover { color: inherit; background: #e8ebf0; }
.tg-msg .bad-link { color: var(--danger); text-decoration: underline wavy; }
.tg-kb { margin-top: .3rem; display: flex; flex-direction: column; gap: .3rem; }
.tg-row { display: flex; gap: .3rem; }
.tg-btn { flex: 1; display: block; text-align: center; background: var(--tg-btn); color: #17324f; border-radius: 8px; padding: .45rem .5rem; font-size: .9rem; font-weight: 600; text-decoration: none; }
a.tg-btn:hover { background: rgba(32, 72, 112, .2); color: #0f2742; }
.tg-btn-muted { opacity: .75; cursor: default; }
.replykb { background: #eef1f5; border-radius: 12px; padding: .5rem; display: flex; flex-direction: column; gap: .35rem; }
.replykb-row { display: flex; gap: .35rem; }
.replykb-btn { flex: 1; background: #fff; border-radius: 8px; padding: .55rem .4rem; text-align: center; font-size: .9rem; box-shadow: 0 1px 1px rgba(0,0,0,.12); }

/* --- Огляд ------------------------------------------------------------------ */
.status { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; border-radius: 14px; padding: 1rem 1.2rem; margin-bottom: 1rem; background: var(--card); border: 1px solid var(--line); }
.status-body { flex: 1; min-width: 16rem; }
.status-body p { margin: .15rem 0 0; color: var(--muted); }
.status-title { font-size: 1.35rem; margin: 0; }
.status-icon { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 50%; font-size: 1.4rem; font-weight: 800; color: #fff; flex: none; }
.status-good { border-color: #b7e2c0; background: linear-gradient(90deg, #eefaf1, var(--card) 60%); }
.status-good .status-icon { background: #0ca30c; }
.status-warning { border-color: #f3d58a; background: linear-gradient(90deg, #fff7e3, var(--card) 60%); }
.status-warning .status-icon { background: #fab219; color: #0b0b0b; }
.status-critical { border-color: #f0b4ad; background: linear-gradient(90deg, #fdeceb, var(--card) 60%); }
.status-critical .status-icon { background: #d03b3b; }

.kpis { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; }
.kpi { display: flex; flex-direction: column; gap: .15rem; height: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s; }
.kpi:hover { border-color: #86b6ef; transform: translateY(-1px); color: var(--text); }
.kpi-value { font-size: 1.75rem; font-weight: 650; line-height: 1.1; }
.kpi-of { font-size: 1rem; font-weight: 500; color: var(--muted); }
.kpi-label { font-size: .85rem; color: var(--muted); }

.dash { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; align-items: start; }
.dash-side { position: sticky; top: 7rem; display: flex; flex-direction: column; gap: 1rem; }
@media (max-width: 1100px) { .dash { grid-template-columns: 1fr; } .dash-side { position: static; } }

.hero { display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; margin: .2rem 0 1rem; }
.hero-value { font-size: 3.5rem; font-weight: 700; line-height: 1; }
.hero-label { color: var(--muted); max-width: 32rem; }
.done { font-size: 1.1rem; color: var(--ok); }

/* Рейтинг рубрик: одна гама, смуги від одного краю, число на кінці смуги */
.bars { list-style: none; margin: 0 0 .6rem; padding: 0; display: flex; flex-direction: column; gap: .15rem; }
.bar-row { display: grid; grid-template-columns: minmax(9rem, 15rem) 1fr; align-items: center; gap: .75rem; padding: .3rem .4rem; border-radius: 8px; text-decoration: none; color: var(--text); }
.bar-row:hover, .bar-row:focus-visible { background: #f2f6fc; color: var(--text); }
.bar-row:hover .bar, .bar-row:focus-visible .bar { background: #1c5cab; }
.bar-label { font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-plot { display: flex; align-items: center; gap: .45rem; border-left: 1px solid #c3c2b7; min-height: 1.6rem; }
.bar { display: block; height: 16px; width: 0; background: #2a78d6; border-radius: 0 4px 4px 0; transition: width .4s ease; }
.bar-value { font-weight: 600; font-size: .95rem; }
.tooltip { position: fixed; z-index: 20; pointer-events: none; background: #0b0b0b; color: #fff; border-radius: 8px; padding: .45rem .65rem; font-size: .85rem; max-width: 20rem; box-shadow: 0 6px 18px rgba(0,0,0,.2); }
.tooltip strong { display: block; font-size: 1rem; }
.tooltip span { color: #c3c2b7; }

.feed { list-style: none; margin: 0 0 .5rem; padding: 0; }
.feed li { display: flex; gap: .7rem; padding: .45rem 0; border-bottom: 1px solid #eef0f4; }
.feed li:last-child { border-bottom: 0; }
.feed p { margin: 0; }
.avatar { display: grid; place-items: center; flex: none; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: #e1ecff; color: var(--primary-dark); font-weight: 700; }
.avatar-version { border-radius: 8px; background: #eef1f6; color: var(--text); font-size: .85rem; }
.notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.notes li { display: flex; gap: .6rem; font-size: .92rem; }
.note-icon { display: grid; place-items: center; flex: none; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: #fab219; color: #0b0b0b; font-weight: 800; font-size: .85rem; }

/* Макет телефона: те, що люди бачать зараз */
.phone { background: #1b2433; border-radius: 28px; padding: .7rem .55rem .9rem; box-shadow: 0 10px 30px rgba(18,48,95,.18); }
.phone-caption { color: #c9d6ea; font-size: .8rem; text-align: center; margin: 0 0 .5rem; letter-spacing: .02em; }
.phone-screen { background: var(--tg-chat); border-radius: 18px; overflow: hidden; }
.phone-bar { display: flex; align-items: center; gap: .5rem; background: #fff; padding: .55rem .75rem; font-weight: 600; font-size: .9rem; }
.phone-avatar { display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: #2a78d6; color: #fff; font-size: .7rem; }
.phone-chat { padding: .7rem; max-height: 22rem; overflow-y: auto; }
.phone .tg-msg { font-size: .85rem; }
.phone .replykb { border-radius: 0; padding: .45rem; }
.phone .replykb-btn { font-size: .78rem; padding: .45rem .3rem; }

/* --- Дерево екранів: рубрика → картки → список -------------------------------- */
.rubrics { display: flex; flex-direction: column; gap: 1rem; }
.rubric { background: #e9eff8; border-radius: 14px; overflow: hidden; border: 1px solid #cdd9eb; }
.rubric-head { list-style: none; display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; background: #104281; color: #fff; cursor: pointer; }
.rubric-head::-webkit-details-marker { display: none; }
.rubric-chevron { width: .6rem; height: .6rem; border-right: 2px solid #b7d3f6; border-bottom: 2px solid #b7d3f6; transform: rotate(-45deg); transition: transform .15s; flex: none; }
.rubric[open] > .rubric-head .rubric-chevron { transform: rotate(45deg); }
.rubric-name { flex: 1; display: flex; flex-direction: column; }
.rubric-title { color: #fff; font-size: 1.15rem; font-weight: 700; text-decoration: none; align-self: flex-start; }
.rubric-title:hover { color: #fff; text-decoration: underline; }
.rubric-meta { font-size: .85rem; color: #b7d3f6; }
.rubric-todo { color: #ffd98a; font-weight: 600; }
.rubric-err { color: #ffb4ab; font-weight: 600; }
.rubric-off .rubric-head { background: #5a6476; }
.rubric-empty { margin: 0; padding: 1rem; }
.btn-on-dark { background: transparent; color: #fff; border-color: rgba(255,255,255,.45); }
.btn-on-dark:hover { background: rgba(255,255,255,.15); color: #fff; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: .75rem; padding: .9rem; align-items: start; }
.scard { background: #fff; border-radius: 10px; border-top: 4px solid #2a78d6; padding: .7rem .85rem .75rem; box-shadow: 0 1px 2px rgba(16,66,129,.08); }
.scard-head { display: flex; align-items: flex-start; gap: .5rem; }
.scard-title { flex: 1; font-weight: 700; font-size: 1.02rem; text-decoration: none; color: #17324f; }
.scard-title:hover { color: var(--primary); text-decoration: underline; }
.scard-meta { margin: .1rem 0 0; font-size: .78rem; color: var(--muted); }
.scard-meta code { background: transparent; padding: 0; }
.scard-tags { margin: .35rem 0 0; display: flex; flex-wrap: wrap; gap: .25rem; }

.sub { list-style: none; margin: .5rem 0 0; padding: 0; }
.sub .sub { margin: .15rem 0 .1rem .9rem; }
.sub-item { border-left: 2px solid #86b6ef; padding-left: .55rem; margin: .15rem 0; }
.sub-item.lvl-3 { border-left-color: #b7d3f6; }
.sub-item.lvl-4 { border-left-color: #cde2fb; }
.sub-line { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; padding: .1rem 0; }
.sub-title { font-size: .92rem; text-decoration: none; color: #1d3f6e; }
.lvl-3 > .sub-line .sub-title, .lvl-4 > .sub-line .sub-title { font-size: .85rem; color: #3a5374; }
.sub-title:hover { text-decoration: underline; }
.tag-quiet { background: transparent; color: var(--muted); font-weight: 500; padding: 0; }

.add-here { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 6px; text-decoration: none; font-weight: 700; color: var(--primary); opacity: 0; flex: none; }
.add-here:hover { background: #e1ecff; }
.sub-line:hover > .add-here, .add-here:focus-visible, .add-here-visible { opacity: 1; }
@media (hover: none) { .add-here { opacity: 1; } }
.filters-tools { margin-left: auto; display: flex; gap: .4rem; }
.card-warn { border-color: #f3d58a; background: #fffbf0; }
[data-node].dim > .sub-line, [data-node].dim > .scard-head, .rubric.dim > .rubric-head { opacity: .55; }

/* --- Іконки (admin/templates/_icons.html) ----------------------------------- */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav > a, .nav-more > summary, .logout .btn, .toolbar button, .crumbs a, .more-link, .box h3 { display: inline-flex; align-items: center; gap: .4rem; }
.crumbs a { text-decoration: none; }
.more-link .i { width: 1em; height: 1em; }
.status-icon .i { width: 1.7rem; height: 1.7rem; stroke-width: 2.4; }
.note-icon .i { width: .9rem; height: .9rem; stroke-width: 2.6; }
.kpi-icon { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 8px; background: #e1ecff; color: #1d5bbf; margin-bottom: .35rem; }
.kpi-icon .i { width: 1.1rem; height: 1.1rem; }
.help-ok { color: var(--ok); display: flex; gap: .35rem; align-items: flex-start; }
.done { display: flex; align-items: center; gap: .5rem; }
.row-tools button .i, .add-here .i { width: 1rem; height: 1rem; }
.tg-btn .i { width: .85em; height: .85em; }
.btn .i { width: 1.05em; height: 1.05em; }

/* --- Смайли: кнопка біля поля й панель вибору --------------------------------- */
.with-emoji { display: flex; align-items: center; gap: .35rem; width: 100%; }
.with-emoji > input { flex: 1; min-width: 0; }
.with-emoji-area { align-items: flex-start; }
.with-emoji-area > textarea { flex: 1; }
.emoji-btn { flex: none; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border: 1px solid #b9c1ce; border-radius: 7px; background: #fff; color: #5a6476; cursor: pointer; }
.emoji-btn .i { width: 1.2rem; height: 1.2rem; }
.emoji-btn:hover, .emoji-btn[aria-expanded="true"], .toolbar [data-emoji][aria-expanded="true"] { background: #fff6e0; color: #8a5a00; border-color: #f3d58a; }
.rows .emoji-btn { width: 2.1rem; height: 2.1rem; }
.emoji-panel { position: fixed; z-index: 30; width: min(370px, calc(100vw - 16px)); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(18,48,95,.22); padding: .6rem; }
.emoji-top { display: flex; gap: .4rem; align-items: center; }
.emoji-top input { flex: 1; }
.emoji-close { flex: none; display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; }
.emoji-close:hover { background: #f1f4f9; color: var(--text); }
.emoji-tabs { display: flex; gap: .25rem; overflow-x: auto; padding: .5rem 0 .4rem; scrollbar-width: thin; }
.emoji-tab { flex: none; border: 0; background: #f1f4f9; color: var(--text); border-radius: 999px; padding: .25rem .7rem; font: inherit; font-size: .8rem; cursor: pointer; white-space: nowrap; }
.emoji-tab:hover { background: #e1ecff; }
.emoji-tab[aria-selected="true"] { background: var(--primary); color: #fff; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: .15rem; max-height: 15.5rem; overflow-y: auto; }
.emoji-grid button { font-size: 1.4rem; line-height: 1; aspect-ratio: 1; border: 0; background: transparent; border-radius: 8px; cursor: pointer; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.emoji-grid button:hover, .emoji-grid button:focus-visible { background: #eef3fc; }
.emoji-empty { grid-column: 1 / -1; color: var(--muted); font-size: .85rem; padding: .5rem; }
.emoji-hint { margin: .45rem 0 0; font-size: .78rem; color: var(--muted); }

/* --- Модальне вікно підтвердження ------------------------------------------- */
.modal { border: 0; border-radius: 16px; padding: 0; width: min(460px, calc(100vw - 32px)); color: var(--text); background: var(--card); box-shadow: 0 24px 60px rgba(16, 40, 80, .32); }
.modal::backdrop { background: rgba(18, 48, 95, .45); backdrop-filter: blur(2px); }
.modal[open] { animation: modal-in .16s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .modal[open] { animation: none; } }
.modal-body { display: grid; grid-template-columns: auto 1fr; gap: .2rem 1rem; padding: 1.35rem 1.4rem 1.15rem; }
.modal-icon { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 50%; background: #e1ecff; color: var(--primary); }
.modal-icon .i { width: 1.35rem; height: 1.35rem; }
.modal-danger .modal-icon { background: var(--err-bg); color: var(--danger); }
.modal-content h2 { font-size: 1.15rem; line-height: 1.35; margin: .3rem 0 .35rem; }
.modal-text { margin: 0; color: var(--muted); }
.modal-field { margin-top: .75rem; }
.modal-field label { display: block; font-weight: 600; margin-bottom: .3rem; }
.modal-error { color: var(--err); font-size: .875rem; margin: .35rem 0 0; }
.modal-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.2rem; flex-wrap: wrap; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover, .btn-danger:focus-visible { background: #8f1c13; border-color: #8f1c13; color: #fff; }
