/* Стиль «Спокойный». Цвета и размеры — токены на :root; тёмная тема — ниже. */
:root {
  --blue: #2856a8; --blue-soft: #e4ecfa;
  color-scheme: light;
  --font: "Golos Text", system-ui, "Segoe UI", sans-serif;
  --r: 12px; --r-s: 8px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --bg: #edf1f2; --surface: #ffffff; --surface-2: #f3f6f7; --text: #1c2629; --muted: #5d6b70;
  --line: #e1e7e9; --line-2: #c9d3d6; --hover: #f5f8f9;
  --accent: #0f7064; --on-accent: #ffffff; --accent-soft: #e2f2ef; --accent-text: #0c6257;
  --ok: #17754a; --ok-soft: #e1f3ea; --warn: #92580a; --warn-soft: #fbf0db; --danger: #b93a32; --danger-soft: #fae6e4;
  --shadow: 0 1px 2px rgba(20, 40, 45, .05), 0 4px 14px -6px rgba(20, 40, 45, .08);
  --float: 0 22px 48px -16px rgba(20, 40, 45, .3);
  --shade: rgba(20, 40, 45, .38);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #101617; --surface: #172022; --surface-2: #1c2628; --text: #e3eaeb; --muted: #97a6aa;
    --line: #253134; --line-2: #34444a; --hover: #1e292b;
    --accent: #4fc2b1; --on-accent: #0b1414; --accent-soft: #153230; --accent-text: #6fd3c3;
    --blue: #8fb3f2; --blue-soft: #18243a;
    --ok: #5ad196; --ok-soft: #14301f; --warn: #f0bc5e; --warn-soft: #30260f; --danger: #f47c72; --danger-soft: #3a1b19;
    --shadow: 0 1px 0 rgba(255, 255, 255, .02); --float: 0 22px 48px -14px rgba(0, 0, 0, .7); --shade: rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101617; --surface: #172022; --surface-2: #1c2628; --text: #e3eaeb; --muted: #97a6aa;
  --line: #253134; --line-2: #34444a; --hover: #1e292b;
  --accent: #4fc2b1; --on-accent: #0b1414; --accent-soft: #153230; --accent-text: #6fd3c3;
  --ok: #5ad196; --ok-soft: #14301f; --warn: #f0bc5e; --warn-soft: #30260f; --danger: #f47c72; --danger-soft: #3a1b19;
  --shadow: 0 1px 0 rgba(255, 255, 255, .02); --float: 0 22px 48px -14px rgba(0, 0, 0, .7); --shade: rgba(0, 0, 0, .6);
  --blue: #8fb3f2; --blue-soft: #18243a;
}

/* База */
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 14.5px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--text); }
a { color: var(--accent-text); text-decoration: none; cursor: pointer; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1 { font-size: 26px; font-weight: 600; line-height: 1.15; letter-spacing: -.02em; margin: 0; }
h3 { font-size: 16px; font-weight: 600; line-height: 1.3; letter-spacing: -.02em; margin: 0; }
p { margin: 0; max-width: 70ch; }
.muted { color: var(--muted); }
button { font: inherit; }
input[type=text], input[type=search], select {
  font: inherit; font-size: 14px; min-height: 36px; padding: 6px 11px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-s); transition: border-color .15s, box-shadow .15s;
}
input[type=text]:focus, input[type=search]:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input::placeholder { color: var(--muted); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; }


/* Верхняя полоса */
.top { height: 54px; background: var(--bg); color: var(--text); display: flex; align-items: center; gap: 8px; padding: 0 16px; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; }
.top .burger { display: none; border: 0; background: transparent; color: var(--text); font-size: 20px; cursor: pointer; padding: 4px 8px; border-radius: var(--r-s); }
.top .brand { font-weight: 700; font-size: 16px; letter-spacing: -.02em; color: var(--text); display: flex; align-items: center; gap: 10px; }
.top .brand:hover { text-decoration: none; }
.top .sp { flex: 1; }
.top .ic { position: relative; border: 0; background: transparent; color: var(--text); cursor: pointer; padding: 6px 9px; border-radius: var(--r-s); font-size: 14px; transition: background .15s; }
.top .ic:hover { background: color-mix(in srgb, var(--text) 7%, transparent); }
.top .dot { position: absolute; top: 2px; right: 2px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; min-width: 17px; height: 17px; line-height: 17px; text-align: center; padding: 0 4px; }
.menu-pop { position: absolute; right: 12px; top: 50px; background: var(--surface); border-radius: var(--r); box-shadow: var(--float); padding: 6px; min-width: 220px; display: grid; z-index: 30; }
.menu-pop a { color: var(--text); padding: 8px 11px; border-radius: var(--r-s); }
.menu-pop a:hover { background: var(--hover); text-decoration: none; }
.menu-pop .who { padding: 6px 11px 8px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; }

/* Каркас и боковое меню */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: calc(100vh - 54px); }
aside { background: var(--bg); padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
aside a.it { display: flex; align-items: center; gap: 10px; color: var(--text); padding: 8px 10px; border-radius: var(--r-s); font-size: 14px; transition: background .15s; }
aside a.it:hover { background: color-mix(in srgb, var(--text) 7%, transparent); text-decoration: none; }
aside a.it.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
aside .ico { width: 18px; text-align: center; opacity: .62; }
aside a.it.on .ico { opacity: 1; }
aside .cnt { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 99px; font-size: 11.5px; font-weight: 700; line-height: 19px; text-align: center; font-variant-numeric: tabular-nums; background: var(--warn-soft); color: var(--warn); }
aside .grow { flex: 1; }
aside .upl { font-size: 12.5px; color: var(--muted); padding: 0 10px 10px; }
aside .ctitle { font-weight: 600; font-size: 15px; line-height: 1.25; letter-spacing: -.02em; padding: 10px 12px; margin-bottom: 8px; border-radius: var(--r-s); background: var(--accent); color: var(--on-accent); }
aside .sec { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 14px 10px 4px; }
aside hr { border: 0; border-top: 1px solid var(--line); margin: 8px 6px; }
aside a.it.minor { font-size: 13.5px; color: var(--muted); }
aside .fresh, .tlist .fresh, .fresh { color: var(--ok); font-weight: 600; }
main { padding: 18px 26px 28px 10px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* Заголовки */
.lhead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.lhead .count { color: var(--muted); font-size: 13.5px; }
.lhead .actions { margin-left: auto; display: flex; gap: 8px; }
.ohead { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ohead .backbtn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); display: grid; place-items: center; color: var(--text); font-size: 17px; }
.ohead .backbtn:hover { text-decoration: none; border-color: var(--muted); }
.ohead .badge-ic { width: 44px; height: 44px; border-radius: var(--r-s); background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; font-weight: 700; font-size: 18px; }
.ohead .tt { display: grid; gap: 2px; min-width: 0; }
.ohead .meta { color: var(--muted); font-size: 13px; }
.ohead .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.subh { font-size: 16px; font-weight: 600; letter-spacing: -.02em; margin: 6px 0 -4px; }

/* Вкладки */
.tabs { display: flex; flex-wrap: wrap; gap: 4px 22px; border-bottom: 1px solid var(--line); }
.tabs a { position: relative; padding: 8px 0 10px; color: var(--muted); font-weight: 500; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--text); font-weight: 600; }
.tabs a.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); }
.tabs .n { font-size: 11px; font-weight: 700; line-height: 17px; min-width: 18px; padding: 0 5px; margin-left: 4px; display: inline-block; text-align: center; border-radius: 99px; background: var(--surface-2); color: var(--muted); }

/* Панель инструментов, фильтры */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar .search { flex: 1 1 240px; }
.toolbar .right { margin-left: auto; display: flex; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips a { border: 1px solid var(--line-2); background: var(--surface); color: var(--text); border-radius: 99px; padding: 5px 13px; font-size: 13.5px; font-weight: 500; }
.chips a:hover { text-decoration: none; border-color: var(--muted); }
.chips a.on { background: var(--text); border-color: var(--text); color: var(--bg); }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.filters label { display: grid; gap: 5px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
label.chk { display: flex; gap: 8px; align-items: center; }

/* Кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 6px 15px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); border-radius: var(--r-s); font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: border-color .15s, filter .15s; }
.btn:hover { text-decoration: none; border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.07); border-color: var(--accent); }
.btn.small { min-height: 30px; padding: 3px 11px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: default; }
.icon-btn { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; padding: 3px 7px; border-radius: var(--r-s); }
.icon-btn:hover { color: var(--danger); background: var(--danger-soft); }

/* Карточки, плитки */
.card { background: var(--surface); border-radius: var(--r); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); }
.help { font-size: 13px; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border-radius: var(--r); padding: 16px 18px; color: var(--text); display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); transition: transform .2s var(--ease); }
a.tile:hover { text-decoration: none; transform: translateY(-2px); }
.tile .big { font-size: 32px; font-weight: 600; line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 6px; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 12px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 9px; margin-top: 8px; }
.stats b { color: var(--text); font-weight: 600; }
.tlist { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 8px; margin-top: 2px; }
.tile.addt { border: 1px dashed var(--line-2); box-shadow: none; color: var(--accent-text); align-items: center; justify-content: center; min-height: 140px; font-weight: 500; }

/* Таблицы */
.tw { overflow-x: auto; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: var(--surface); color: var(--muted); font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr.rowlink { cursor: pointer; }
tr.rowlink td { transition: background .12s; }
tr.rowlink:hover td { background: var(--hover); }
td.num { white-space: nowrap; }
td.act { text-align: right; white-space: nowrap; }
td.chk, th.chk { width: 36px; }
.group td { background: var(--surface-2); font-weight: 600; font-size: 13px; }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }

/* Статусы */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 0 9px; border-radius: 99px; font-size: 12.5px; font-weight: 500; line-height: 22px; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }

/* «Требует внимания», сообщения, выбор */
details.att > summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; }
details.att > summary::-webkit-details-marker { display: none; }
details.att > summary .chev { margin-left: auto; color: var(--muted); transition: transform .15s; }
details.att:not([open]) > summary .chev { transform: rotate(-90deg); }
.alert { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.alert .badge { min-width: 124px; }
.alert > a:last-child { margin-left: auto; font-size: 13.5px; font-weight: 500; }
.flash { background: var(--ok-soft); color: var(--ok); border-radius: var(--r); padding: 10px 14px; font-size: 13.5px; font-weight: 500; }
.selbar { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: var(--r); padding: 8px 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 20px; font-size: 14px; margin: 0; align-items: center; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* Панель записи */
.shade { position: fixed; inset: 0; background: var(--shade); z-index: 40; animation: fade .2s ease-out; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%); padding-top: env(safe-area-inset-top, 0px); background: var(--surface); z-index: 41; display: flex; flex-direction: column; box-shadow: var(--float); border-radius: var(--r) 0 0 var(--r); animation: slide .3s var(--ease); }
.drawer .dh { display: flex; align-items: center; gap: 10px; padding: 16px 18px 8px 20px; }
.drawer .dh h2 { font-size: 19px; font-weight: 600; letter-spacing: -.02em; margin: 0; flex: 1; }
.drawer .dh .close { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; border-radius: var(--r-s); font-size: 16px; }
.drawer .dh .close:hover { color: var(--text); background: var(--hover); }
.drawer .db { flex: 1; padding: 6px 20px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.drawer .db .card { background: var(--surface-2); box-shadow: none; }
.drawer .df { padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface-2); display: flex; gap: 8px; flex-wrap: wrap; }
.tree { display: grid; gap: 0; }
.tree .cls { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.tree .cls > label:first-child { width: 90px; font-weight: 500; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* Телефон */
@media (max-width: 800px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  aside#side { position: fixed; z-index: 35; top: 0; bottom: 0; left: 0; width: 260px; overflow-y: auto; transform: translateX(-105%); visibility: hidden; box-shadow: var(--float); padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
  aside#side.open { transform: none; visibility: visible; }
  .top .burger { display: inline-block; }
  .top .who-name { display: none; }
  main { padding: 16px 16px 48px; }
  h1 { font-size: 22px; }
  .ohead .badge-ic { display: none; }
  th, td { padding: 11px 10px; }
  .tile .big { font-size: 28px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid:has(.stats) { grid-template-columns: minmax(0, 1fr); }
  .grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .alert .badge { min-width: 0; }
  .alert > a:last-child { margin-left: 0; }
  .drawer { border-radius: 0; }
}
@media (prefers-reduced-motion: no-preference) { aside { transition: transform .2s var(--ease), visibility .2s; } }
@media (prefers-reduced-motion: reduce) { .drawer, .shade { animation: none; } a.tile:hover { transform: none; } }

/* ================= Дополнения для сервиса (то, чего нет в прототипе) ================= */
[hidden] { display: none !important; }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
.i.s { width: 15px; height: 15px; vertical-align: -3px; }
aside .ico { display: inline-flex; }
.top .brand .logo { width: 28px; height: 28px; border-radius: var(--r-s); background: var(--accent); color: var(--on-accent); display: grid; place-items: center; }
.top .brand .logo .i { width: 16px; height: 16px; }
.top .ic { display: inline-flex; align-items: center; gap: 6px; }
.menu-pop button { all: unset; box-sizing: border-box; padding: 8px 11px; border-radius: var(--r-s); cursor: pointer; color: var(--text); }
.menu-pop button:hover { background: var(--hover); }
.menu-pop form { display: grid; }
.imp-bar { background: var(--warn-soft); color: var(--warn); padding: 6px 16px; font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.imp-bar form { margin-left: auto; }

/* Поля ввода и формы */
input[type=password], input[type=number], input[type=email], input[type=date], input[type=datetime-local], input[type=time], textarea {
  font: inherit; font-size: 14px; min-height: 36px; padding: 6px 11px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-s); transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 72px; width: 100%; resize: vertical; }
input[type=password]:focus, input[type=number]:focus, input[type=email]:focus, input[type=date]:focus, input[type=datetime-local]:focus, input[type=time]:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
input[readonly] { background: var(--surface-2); }
.form { display: grid; gap: 4px; max-width: 560px; }
/* fieldset.plain — обёртка для режима «только просмотр»: внутри та же сетка, что и у формы */
.form fieldset.plain { display: grid; gap: 4px; }
.form > label, .form > fieldset.plain > label, .lbl { font-size: 12.5px; font-weight: 500; color: var(--muted); margin-top: 10px; }
.form > label:first-child, .form > fieldset.plain > label:first-child { margin-top: 0; }
.form > label.chk, .form > fieldset.plain > label.chk { color: var(--text); font-size: 14px; font-weight: 400; }
.form input[type=text], .form input[type=password], .form input[type=email], .form input[type=number],
.form input[type=date], .form input[type=time], .form input[type=datetime-local], .form select, .form textarea { width: 100%; }
.form .row { margin-top: 14px; }
.kv input[type=text], .kv input[type=email], .kv input[type=password], .kv select, .kv textarea { width: 100%; max-width: 420px; }
.err { color: var(--danger); font-size: 13px; }
.w-auto { width: auto !important; }
.num-in { width: 76px !important; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.danger-fill { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
.btn.link { border: 0; background: transparent; color: var(--accent-text); padding: 0; min-height: 0; }
form.inline { display: inline; }
.between { justify-content: space-between; }
.grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; align-items: start; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
pre { margin: 0; font: 12.5px/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace; background: var(--surface-2); padding: 12px 14px; border-radius: var(--r-s); overflow-x: auto; white-space: pre-wrap; word-break: break-word; }
.badge.line { background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text); }
.badge.plain::before { display: none; }
.zero { color: var(--line-2); }
.nowrap { white-space: nowrap; }
.mt { margin-top: 6px; }

/* Сообщения */
.flashes { display: flex; flex-direction: column; gap: 8px; }
.flash { cursor: pointer; transition: opacity .5s; }
.flash.flash-error { background: var(--danger-soft); color: var(--danger); }
.flash.flash-warn { background: var(--warn-soft); color: var(--warn); }
.flash.flash-info { background: var(--accent-soft); color: var(--accent-text); }
.flash.hide { opacity: 0; }
.secret { background: var(--warn-soft); color: var(--warn); border-radius: var(--r); padding: 12px 14px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.secret input { font-family: ui-monospace, Consolas, monospace; font-weight: 600; width: 220px; }

/* Выпадающие меню (<details class="dropdown">) */
details.dropdown { position: relative; }
details.dropdown > summary { list-style: none; }
details.dropdown > summary::-webkit-details-marker { display: none; }
details.dropdown .menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; background: var(--surface); border-radius: var(--r); box-shadow: var(--float); padding: 6px; min-width: 220px; display: grid; }
details.dropdown .menu a { color: var(--text); padding: 8px 11px; border-radius: var(--r-s); }
details.dropdown .menu a:hover { background: var(--hover); text-decoration: none; }

/* Фильтры таблицы */
.filters-panel { display: none; }
.filters-panel.open { display: flex; }
details.multi { position: relative; }
details.multi > summary { list-style: none; min-height: 36px; padding: 7px 30px 6px 11px; border: 1px solid var(--line-2); border-radius: var(--r-s); background: var(--surface); cursor: pointer; color: var(--text); font-size: 14px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; }
details.multi > summary::after { content: "▾"; position: absolute; right: 11px; color: var(--muted); }
details.multi > summary::-webkit-details-marker { display: none; }
details.multi .opts { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; min-width: 100%; max-height: 300px; overflow: auto; background: var(--surface); border-radius: var(--r); box-shadow: var(--float); padding: 8px; display: grid; gap: 4px; }
details.multi .opts label { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 14px; font-weight: 400; }
.pager { display: flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: wrap; font-size: 13.5px; }

/* Ячейки, быстрая правка */
td .sub { display: block; font-size: 12.5px; color: var(--muted); }
.inline-edit { display: flex; align-items: center; gap: 6px; }
.inline-edit input[type=text], .inline-edit select { min-height: 30px; padding: 3px 8px; font-size: 13.5px; }
.inline-status { font-size: 12px; min-width: 12px; color: var(--muted); }
.inline-status.ok { color: var(--ok); }
.inline-status.err { color: var(--danger); font-weight: 700; }
tr.changed > td:first-child, .dirty-item.changed { box-shadow: inset 3px 0 0 var(--warn); }
tr.forgotten td { opacity: .45; text-decoration: line-through; }
tr.forgotten td.act { opacity: 1; text-decoration: none; }

/* Настройки: таблицы полей и сопоставления */
table.settings td, table.settings th { padding: 8px 10px; }
table.settings input[type=text], table.settings select { min-height: 32px; padding: 4px 8px; font-size: 13.5px; }
table.settings td.c, table.settings th.c { text-align: center; }
tbody.collapsed tr[data-map-row] { display: none; }
tr.sub-hidden { display: none; }
.group-head td { background: var(--surface-2); cursor: pointer; font-weight: 600; font-size: 13px; }
.levels-list { display: grid; gap: 6px; margin: 4px 0; }
.level-row { display: flex; gap: 8px; align-items: center; }
.level-num { width: 22px; color: var(--muted); font-size: 13px; }

/* Дерево доступа (вложенные списки) */
ul.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-left: 22px; }
.tree li { padding: 3px 0; }
.tree label { display: inline-flex; gap: 8px; align-items: center; }

/* Окно подтверждения */
.modal-back { position: fixed; inset: 0; background: var(--shade); z-index: 60; display: grid; place-items: center; padding: 16px; animation: fade .2s ease-out; }
.modal { background: var(--surface); border-radius: var(--r); box-shadow: var(--float); padding: 20px; max-width: 440px; width: 100%; display: grid; gap: 16px; }
.modal-text { font-size: 14.5px; white-space: pre-line; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* Вход, первый запуск, ошибки */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth .card { width: 100%; max-width: 380px; padding: 24px; gap: 14px; }
.auth .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.auth .brand .logo { width: 28px; height: 28px; border-radius: var(--r-s); background: var(--accent); color: var(--on-accent); display: grid; place-items: center; }

/* Панель (запись, вебхук, создание) — содержимое приходит с сервера */
.drawer form .kv input, .drawer form .kv select, .drawer form .kv textarea { max-width: none; }
.drawer-loading { color: var(--muted); padding: 30px 20px; }

/* Таблица записей на телефоне — карточками */
@media (max-width: 800px) {
  table.cards thead { display: none; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  table.cards td { border: 0; padding: 3px 0; display: flex; gap: 10px; }
  table.cards td::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; min-width: 96px; flex: none; }
  table.cards td:empty { display: none; }
  .cols { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kv dd { margin-bottom: 8px; }
}

/* График заявок на главной админа */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.bar { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.bar span { display: block; width: 100%; min-height: 2px; background: var(--accent); opacity: .8; border-radius: 3px 3px 0 0; }
.bar:hover span { opacity: 1; }
.shell.noside { grid-template-columns: minmax(0, 1fr); }
.shell.noside main { padding-left: 26px; }
.drawer .db .df { margin: auto -20px -24px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface-2); position: sticky; bottom: -24px; }
.drawer .db form.form { max-width: none; }

/* Акт удаления: документ для печати */
.act-doc { max-width: 760px; gap: 14px; }
.act-table { border-collapse: collapse; }
.act-table th { text-transform: none; letter-spacing: 0; font-size: 13.5px; color: var(--muted); font-weight: 500; width: 46%; white-space: normal; }
.act-signs { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-top: 24px; }
.backbtn-link { font-size: 13.5px; }
@media print { .top, aside, .no-print, .flashes, .imp-bar { display: none !important; } .shell { display: block; } main { padding: 0; } body { background: #fff; color: #000; } .card { box-shadow: none; } }

/* Ссылки сортировки в шапке таблицы — цветом шапки */
th a { color: inherit; }
th a:hover { color: var(--text); text-decoration: none; }
@media (max-width: 800px) { .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .tabs a { white-space: nowrap; } }

/* ---------- Правки, этап 1 ---------- */
/* Сообщения — поверх страницы, ничего не сдвигают */
.toasts { position: fixed; top: calc(62px + env(safe-area-inset-top, 0px)); right: 16px; z-index: 70; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toasts .flash { pointer-events: auto; box-shadow: var(--float); animation: slide .3s var(--ease); }
/* Уведомления у колокольчика */
.menu-pop.notif { min-width: 320px; max-width: min(440px, calc(100vw - 24px)); max-height: 70vh; overflow-y: auto; right: 60px; }
.menu-pop.notif a { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 13.5px; }
.menu-pop.notif .empty { padding: 14px 11px; }
/* Тема: видна иконка той темы, на которую переключит кнопка */
.th-sun { display: none; }
:root[data-theme="dark"] .th-sun { display: inline-flex; }
:root[data-theme="dark"] .th-moon { display: none; }
.theme-corner { position: fixed; top: 12px; right: 12px; }
.auth .ic { border: 0; background: transparent; color: var(--text); cursor: pointer; padding: 6px 9px; border-radius: var(--r-s); }
/* «Поле — значение»: одинаковая высота строк с текстом и с полями ввода */
/* строки с текстом — той же высоты, что строки с полями ввода (36px) */
.kv > dt, .kv > dd:not(:has(input, select, textarea)) { padding: 7px 0; }
.kv > dd > .row { margin: 0; }
/* Заголовок вкладок с кнопками справа (таблица: «+ Запись», «Скачать») */
.tabs-row { display: flex; align-items: flex-end; gap: 8px 16px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tabs-row .tabs { border-bottom: 0; flex: 1; }
.tabs-row .actions { display: flex; gap: 8px; padding-bottom: 6px; }
/* Быстрые фильтры: «Запомнить отбор» — такая же «пилюля», пунктиром */
.chips { align-items: center; }
.chips .chip-add > summary { list-style: none; border: 1px dashed var(--line-2); border-radius: 99px; padding: 5px 13px; font-size: 13.5px; font-weight: 500; color: var(--accent-text); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.chips .chip-add > summary::-webkit-details-marker { display: none; }
.chips .chip-add .menu { left: 0; right: auto; gap: 8px; }
/* Фильтр по периоду: одна группа «поле даты + с/по + быстрые периоды» */
.period { grid-column: 1 / -1; display: grid; gap: 8px; }
.period .row { gap: 8px; }
.period .lbl { margin: 0; }
/* Карточки настроек: заголовок + пояснение */
.card > h3 + .help { margin-top: -4px; }

/* Таблица полей: компактнее, чтобы помещалась без прокрутки */
#fields-body input[type=text] { width: 170px; }
#fields-body select { width: 140px; }
#fields-body textarea { min-width: 150px !important; width: 150px; }

/* Таблица полей: ручка перетаскивания, строка «+ Поле», значение по умолчанию */
.drag{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border:0;background:none;color:var(--muted);cursor:grab;border-radius:6px;touch-action:none}
.drag:hover,.drag:focus-visible{color:var(--text);background:var(--hover)}
tr.dragging{opacity:.6;background:var(--hover)}
tr.dragging .drag{cursor:grabbing}
table.settings tfoot td{padding:0;border-top:1px dashed var(--line)}
.add-row{display:flex;align-items:center;gap:6px;width:100%;padding:10px 12px;border:0;background:none;color:var(--muted);font:inherit;cursor:pointer;text-align:left}
.add-row:hover,.add-row:focus-visible{color:var(--accent-text);background:var(--hover)}
input.dflt{min-width:150px;margin-top:4px}
ul.changes{margin:0;padding-left:18px}
ul.changes li{margin:3px 0}

/* Быстрая правка в ячейке занимает только свою ширину — клик правее открывает запись */
.inline-edit.compact { display: inline-flex; }
/* Цветные метки вариантов списка */
.pill { display: inline-flex; align-items: center; padding: 0 9px; border-radius: 99px; font-size: 13px; font-weight: 500; line-height: 22px; white-space: nowrap; border: 0; background: var(--surface-2); color: var(--text); font-family: inherit; }
.c-gray { background: var(--surface-2); color: var(--muted); }
.c-teal { background: var(--accent-soft); color: var(--accent-text); }
.c-green { background: var(--ok-soft); color: var(--ok); }
.c-yellow { background: var(--warn-soft); color: var(--warn); }
.c-red { background: var(--danger-soft); color: var(--danger); }
.c-blue { background: var(--blue-soft); color: var(--blue); }
select.pill-select[class*=" c-"] { border-color: transparent; font-weight: 500; }
/* Цвет — только у самого поля; раскрытый список вариантов — обычный */
select.pill-select option { background: var(--surface); color: var(--text); font-weight: 400; }
.val-colors { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.val-colors .pill { cursor: pointer; box-shadow: inset 0 0 0 1px var(--line-2); }
.val-colors .pill[class*=" c-"] { box-shadow: none; }
.color-pop { position: absolute; z-index: 60; display: flex; gap: 6px; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-s); box-shadow: var(--float); }
.color-pop[hidden] { display: none; }
.swatch { width: 24px; height: 24px; border-radius: 99px; border: 1px solid var(--line-2); cursor: pointer; padding: 0; }
.swatch.none { background: var(--surface); color: var(--muted); font-size: 12px; }
.swatch[class*=" c-"] { border-color: transparent; background: currentColor; }
label.chk.small { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* Замки и «появились новые записи» */
fieldset.plain { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.plain[disabled] { opacity: .75; }
.pulse-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 14px; border-radius: var(--r-s); background: var(--accent-soft); color: var(--accent-text); font-size: 14px; }
.pulse-bar[hidden] { display: none; }
.row-lock { display: inline-flex; margin-left: 6px; color: var(--warn); vertical-align: middle; }
.row-lock[hidden] { display: none; }

/* Капча на входе */
.captcha-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.captcha-row img { border-radius: var(--r-s); border: 1px solid var(--line); background: #f3f6f7; }

/* Длинные значения (куки, ссылки) переносятся, а не вылезают за карточку */
.kv dd { overflow-wrap: anywhere; min-width: 0; }
.kv dt { max-width: 260px; overflow-wrap: anywhere; }
.revert-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }

.export-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; padding: 10px 2px 0; font-size: 14px; }
