/* ===== Темы ===== */
:root {
  color-scheme: light;
  --base: #e6eeff;
  --text: #0f172a;
  --muted: #4b5870;
  --line: rgba(15, 23, 42, .09);
  --line-strong: rgba(15, 23, 42, .18);
  --glass-bg: rgba(255, 255, 255, .75);
  --row-bg: rgba(255, 255, 255, .82);
  --glass-border: rgba(15, 23, 42, .10);
  --glass-shadow: 0 24px 56px -12px rgba(37, 65, 165, .22), inset 0 1px 0 #ffffff, inset 0 0 0 1px rgba(255, 255, 255, .65);
  --row-shadow: 0 10px 22px -12px rgba(37, 65, 165, .25), inset 0 1px 0 #ffffff, inset 0 0 0 1px rgba(255, 255, 255, .55);
  --solid: #f4f8ff;
  --input-bg: rgba(255, 255, 255, .90);
  --brand: #0780BF;
  --accent: #066A9E;       /* текст, ссылки */
  --btn: #066A9E;          /* кнопки (белый текст) */
  --yellow: #F6BC07;
  --danger: #dc2626;
  --warn: #c2650a;
  --prio-high: #dc2626; --prio-medium: #8a6d00; --prio-low: #2f855a;
  --star: #e0a800;
  --chip-bg: rgba(255, 255, 255, .82);
  --menu-shadow: 0 10px 28px rgba(15, 23, 42, .18);
  /* Объёмное стекло: заливка светлее сверху, кант светится по верхнему краю и уходит в тень снизу, двойная тень */
  --g-fill: linear-gradient(180deg, rgba(255, 255, 255, .62), rgba(255, 255, 255, .34));
  --g-fill-dense: linear-gradient(180deg, rgba(255, 255, 255, .84), rgba(255, 255, 255, .66));   /* листы с текстом */
  --g-rim: linear-gradient(180deg, rgba(255, 255, 255, .95), rgba(255, 255, 255, .2) 40%, rgba(37, 65, 165, .16));
  --g-depth: inset 0 -2px 6px -2px rgba(37, 65, 165, .12), 0 1px 2px rgba(37, 65, 165, .12), 0 18px 36px -18px rgba(37, 65, 165, .42);
  --g-depth-sm: inset 0 -1px 3px -1px rgba(37, 65, 165, .12), 0 1px 2px rgba(37, 65, 165, .1), 0 8px 18px -10px rgba(37, 65, 165, .32);
  --g-blur: blur(24px) saturate(170%);
  /* Карточка задачи */
  --card-fill: linear-gradient(180deg, rgba(255, 255, 255, .95), rgba(255, 255, 255, .84));
  --card-rim: linear-gradient(180deg, rgba(7, 128, 191, .55), rgba(7, 128, 191, .25));
  --soft: rgba(15, 23, 42, .045);
  --soft-2: rgba(15, 23, 42, .075);
  --ok: #2f855a;
  --attn-bg: rgba(234, 88, 12, .07);
  /* тот же фон, что у body: нужен экрану карточки на телефоне */
  --page-bg:
    radial-gradient(at 15% 0%, rgba(6, 182, 212, .30) 0px, transparent 45%),
    radial-gradient(at 85% 0%, rgba(99, 102, 241, .26) 0px, transparent 45%),
    radial-gradient(at 12% 20%, rgba(6, 182, 212, .36) 0px, transparent 50%),
    radial-gradient(at 88% 18%, rgba(99, 102, 241, .30) 0px, transparent 50%),
    radial-gradient(at 75% 88%, rgba(37, 99, 235, .30) 0px, transparent 54%),
    radial-gradient(at 18% 85%, rgba(56, 189, 248, .28) 0px, transparent 48%);
}
html[data-theme="dark"] {
  color-scheme: dark;
  --base: #0b1222;
  --text: #e6edf6;
  --muted: #9aa9bc;
  --line: rgba(148, 163, 184, .18);
  --line-strong: rgba(148, 163, 184, .32);
  --glass-bg: rgba(15, 23, 42, .74);
  --row-bg: rgba(15, 23, 42, .74);
  --glass-border: rgba(148, 163, 184, .22);
  --glass-shadow: 0 24px 60px -12px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .08);
  --row-shadow: 0 8px 18px -12px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .06);
  --solid: #0f172a;
  --input-bg: rgba(11, 18, 34, .65);
  --accent: #5ec2f0;
  --btn: #0b79b8;
  --danger: #f87171;
  --warn: #fb923c;
  --prio-high: #f87171; --prio-medium: #facc15; --prio-low: #4ade80;
  --star: #F6BC07;
  --chip-bg: rgba(15, 23, 42, .6);
  --menu-shadow: 0 10px 28px rgba(0, 0, 0, .55);
  --g-fill: linear-gradient(180deg, rgba(30, 41, 59, .62), rgba(15, 23, 42, .46));
  --g-fill-dense: linear-gradient(180deg, rgba(30, 41, 59, .8), rgba(15, 23, 42, .7));
  --g-rim: linear-gradient(180deg, rgba(255, 255, 255, .17), rgba(255, 255, 255, .04) 40%, rgba(0, 0, 0, .35));
  --g-depth: inset 0 -2px 6px -2px rgba(0, 0, 0, .45), 0 1px 2px rgba(0, 0, 0, .45), 0 20px 40px -18px rgba(0, 0, 0, .85);
  --g-depth-sm: inset 0 -1px 3px -1px rgba(0, 0, 0, .4), 0 1px 2px rgba(0, 0, 0, .4), 0 10px 20px -10px rgba(0, 0, 0, .7);
  --card-fill: linear-gradient(180deg, rgba(30, 41, 59, .92), rgba(15, 23, 42, .86));
  --card-rim: linear-gradient(180deg, rgba(94, 194, 240, .5), rgba(94, 194, 240, .18));
  --soft: rgba(255, 255, 255, .05);
  --soft-2: rgba(255, 255, 255, .085);
  --ok: #4ade80;
  --attn-bg: rgba(251, 146, 60, .10);
  --page-bg:
    radial-gradient(at 20% 0%, rgba(14, 165, 233, .18) 0px, transparent 45%),
    radial-gradient(at 15% 20%, rgba(14, 165, 233, .22) 0px, transparent 50%),
    radial-gradient(at 85% 15%, rgba(37, 99, 235, .26) 0px, transparent 50%),
    radial-gradient(at 75% 85%, rgba(56, 189, 248, .16) 0px, transparent 55%);
}

/* ===== Фон «Воздушное стекло»: цвет и градиент заданы прямо на body (не через shorthand и не через ::before) ===== */
/* У html своего фона нет: тогда фон body растягивается на всё окно, включая «резинку» при прокрутке за край */
body {
  margin: 0; min-height: 100vh; color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background-color: #e6eeff;
  background-image:
    radial-gradient(at 15% 0%, rgba(6, 182, 212, .30) 0px, transparent 45%),
    radial-gradient(at 85% 0%, rgba(99, 102, 241, .26) 0px, transparent 45%),
    radial-gradient(at 12% 20%, rgba(6, 182, 212, .36) 0px, transparent 50%),
    radial-gradient(at 88% 18%, rgba(99, 102, 241, .30) 0px, transparent 50%),
    radial-gradient(at 75% 88%, rgba(37, 99, 235, .30) 0px, transparent 54%),
    radial-gradient(at 18% 85%, rgba(56, 189, 248, .28) 0px, transparent 48%);
  background-attachment: fixed;
  background-repeat: no-repeat;
}
html[data-theme="dark"] body {
  background-color: #0b1222;
  background-image:
    radial-gradient(at 20% 0%, rgba(14, 165, 233, .18) 0px, transparent 45%),
    radial-gradient(at 15% 20%, rgba(14, 165, 233, .22) 0px, transparent 50%),
    radial-gradient(at 85% 15%, rgba(37, 99, 235, .26) 0px, transparent 50%),
    radial-gradient(at 75% 85%, rgba(56, 189, 248, .16) 0px, transparent 55%);
}
@media print {
  body { background-image: none !important; background-color: #ffffff !important; color: #000; }
  html { background-color: #ffffff !important; }
  .topbar, .theme-toggle, .floating-toggle, .quick-add { display: none !important; }
}

* { box-sizing: border-box; }
[x-cloak] { display: none !important; }
.container { max-width: 960px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.4rem; margin: 0 0 12px; }
.muted { color: var(--muted); }
.error { color: var(--danger); margin: 0 0 12px; }

/* Стеклянные карточки */
.card {
  background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 14px; padding: 20px;
  -webkit-backdrop-filter: blur(22px) saturate(140%); backdrop-filter: blur(22px) saturate(140%);
  box-shadow: var(--glass-shadow);
}
.login { max-width: 360px; margin: 10vh auto 0; text-align: center; }
.login form { text-align: left; }

/* Экраны входа (вход, смена PIN, 2FA, ошибки): лёгкое стекло, как у подсказки passkey */
.card.login {
  padding: 28px 24px 22px; border-radius: 22px;
  background: rgba(255, 255, 255, .36); border-color: rgba(255, 255, 255, .72);
  -webkit-backdrop-filter: blur(28px) saturate(170%); backdrop-filter: blur(28px) saturate(170%);
  box-shadow: 0 30px 70px -24px rgba(37, 65, 165, .38), inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 0 0 1px rgba(255, 255, 255, .35);
  animation: login-in .4s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes login-in { from { opacity: 0; transform: translateY(12px) scale(.985); } }
.login input, .login .emp-trigger {
  background-color: rgba(255, 255, 255, .55); border-color: rgba(15, 23, 42, .12); border-radius: 12px;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, .05);
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.login input:hover, .login .emp-trigger:hover { background-color: rgba(255, 255, 255, .7); }
.login input:focus { outline: none; background-color: rgba(255, 255, 255, .85); border-color: var(--brand); box-shadow: 0 0 0 3px rgba(7, 128, 191, .18); }
.login button.primary { border-radius: 12px; font-weight: 600; box-shadow: 0 10px 22px -10px rgba(6, 106, 158, .7); transition: filter .15s ease, transform .1s ease; }
.login button.primary:hover { filter: brightness(1.08); }
.login button.primary:active { transform: scale(.985); }
html[data-theme="dark"] .login input, html[data-theme="dark"] .login .emp-trigger { background-color: rgba(11, 18, 34, .45); border-color: rgba(148, 163, 184, .24); box-shadow: none; }
html[data-theme="dark"] .login input:hover, html[data-theme="dark"] .login .emp-trigger:hover { background-color: rgba(11, 18, 34, .6); }
html[data-theme="dark"] .login input:focus { background-color: rgba(11, 18, 34, .7); border-color: var(--accent); box-shadow: 0 0 0 3px rgba(94, 194, 240, .2); }
@media (prefers-reduced-motion: reduce) { .card.login { animation: none; } }

label, .field { display: block; margin-bottom: 14px; font-size: .9rem; color: var(--muted); }
.field-label { display: block; }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 12px; font: inherit; color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 8px; background-color: var(--input-bg);
}
select {
  -webkit-appearance: none; appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 20 20' fill='none' stroke='%23546377' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5.5 7.5L10 12l4.5-4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 16px 16px;
}
html[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 20 20' fill='none' stroke='%239aa9bc' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5.5 7.5L10 12l4.5-4.5'/%3E%3C/svg%3E");
}
select:hover:not(:disabled) { border-color: var(--brand); }
select:disabled { opacity: .65; cursor: default; }
select option { background-color: var(--solid); color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
textarea { resize: vertical; }
button { font: inherit; cursor: pointer; }
button.primary { width: 100%; padding: 12px; border: 0; border-radius: 8px; background: var(--btn); color: #fff; }
button.link { border: 0; background: none; color: var(--accent); padding: 8px 0; }
button.danger { border: 0; background: none; color: var(--danger); padding: 8px 0; }

/* Кастомный выбор сотрудника на странице входа */
.emp-select { position: relative; margin-top: 4px; font-size: 1rem; color: var(--text); }
.emp-trigger {
  width: 100%; min-height: 48px; padding: 8px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px solid var(--line-strong); border-radius: 8px; background-color: var(--input-bg); color: var(--text);
  text-align: left; transition: border-color .15s ease, box-shadow .15s ease;
}
.emp-trigger:hover { border-color: var(--brand); }
.emp-trigger:focus-visible, .emp-select.is-open .emp-trigger {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 2px rgba(7, 128, 191, .22);
}
html[data-theme="dark"] .emp-trigger:focus-visible,
html[data-theme="dark"] .emp-select.is-open .emp-trigger {
  box-shadow: 0 0 0 2px rgba(94, 194, 240, .28);
}
.emp-current, .emp-opt-body { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1; }
.emp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.emp-select .role { flex: none; font-size: .7rem; padding: 2px 6px; }
.emp-chevron { flex: none; color: var(--muted); transition: transform .18s ease, color .15s ease; }
.emp-select.is-open .emp-chevron { transform: rotate(180deg); color: var(--brand); }
.emp-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 35;
  max-height: min(368px, 60vh); overflow-y: auto; scrollbar-width: thin; padding: 5px;
  display: flex; flex-direction: column; gap: 2px;
  background: rgba(255, 255, 255, .95); border: 1px solid var(--line-strong); border-radius: 11px;
  -webkit-backdrop-filter: blur(22px) saturate(140%); backdrop-filter: blur(22px) saturate(140%);
  box-shadow: 0 18px 40px -10px rgba(15, 23, 42, .22), 0 4px 12px rgba(15, 23, 42, .08);
  animation: emp-menu-in .14s ease-out;
}
.emp-menu[hidden] { display: none !important; }
html[data-theme="dark"] .emp-menu {
  background: rgba(15, 23, 42, .95); border-color: var(--glass-border);
  box-shadow: 0 20px 44px -10px rgba(0, 0, 0, .68), inset 0 1px 0 rgba(255, 255, 255, .07);
}
@keyframes emp-menu-in {
  from { opacity: 0; transform: translateY(-4px) scale(.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.emp-opt {
  width: 100%; padding: 6px 9px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: left;
  transition: background-color .12s ease;
}
.emp-opt:hover, .emp-opt:focus-visible { outline: none; background: rgba(7, 128, 191, .09); }
.emp-opt.is-selected { background: rgba(7, 128, 191, .14); }
.emp-opt.is-selected .emp-name { font-weight: 600; }
html[data-theme="dark"] .emp-opt:hover,
html[data-theme="dark"] .emp-opt:focus-visible { background: rgba(94, 194, 240, .13); }
html[data-theme="dark"] .emp-opt.is-selected { background: rgba(94, 194, 240, .2); }
.emp-check { flex: none; color: var(--brand); opacity: 0; transition: opacity .12s ease; }
.emp-opt.is-selected .emp-check { opacity: 1; }
html[data-theme="dark"] .emp-check { color: var(--accent); }

/* ===== Шапка: плавающая стеклянная панель ===== */
.topbar {   /* по ширине колонки задач (960 − 2×16), чтобы края совпадали */
  position: sticky; top: 12px; z-index: 20;
  width: calc(100% - 32px); max-width: 928px; margin: 12px auto 0; min-height: 58px;
  display: flex; align-items: center; gap: 12px; padding: 9px 10px 9px 18px; border-radius: 22px;
  transition: background-color .25s ease;
}
.topbar .brand img { height: 34px; }
.topbar.is-scrolled { background-color: rgba(255, 255, 255, .38); }   /* при прокрутке плотнее, задачи под панелью не мешают читать */
html[data-theme="dark"] .topbar.is-scrolled { background-color: rgba(15, 23, 42, .45); }
.topbar .brand { display: flex; align-items: center; flex: none; border-radius: 10px; }
.topbar .brand:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }

/* Меню разделов (только когда пунктов больше одного): таблетки, как фильтры «Все / Сегодня» */
.tb-nav { display: flex; gap: 2px; padding: 3px; margin-left: 6px; border-radius: 999px; background: rgba(15, 23, 42, .05); box-shadow: inset 0 1px 2px rgba(15, 23, 42, .06); }
.tb-nav a { padding: 5px 14px; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: .88rem; white-space: nowrap; transition: color .15s, background-color .15s; }
.tb-nav a:hover { color: var(--text); }
.tb-nav a.active { color: var(--text); font-weight: 600; background: rgba(255, 255, 255, .92); box-shadow: 0 2px 6px rgba(15, 23, 42, .12), inset 0 1px 0 #fff; }
html[data-theme="dark"] .tb-nav { background: rgba(0, 0, 0, .22); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .3); }
html[data-theme="dark"] .tb-nav a.active { background: rgba(148, 163, 184, .2); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08); }

.who { display: flex; gap: 6px; align-items: center; margin: 0 0 0 auto; }
.who form { margin: 0; }

/* Режим работы админа: две иконки, «Админ» горит янтарным */
.modeswitch { display: inline-flex; gap: 2px; margin: 0 4px 0 0; padding: 3px; border-radius: 999px; background: rgba(15, 23, 42, .06); box-shadow: inset 0 1px 2px rgba(15, 23, 42, .08); }
.ms-btn {
  width: 36px; height: 32px; padding: 0; border: 0; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--muted); text-decoration: none; transition: color .15s, background-color .15s, box-shadow .15s;
}
.ms-btn:hover { color: var(--text); }
.ms-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.ms-btn.on { background: #fff; color: var(--accent); box-shadow: 0 2px 6px rgba(15, 23, 42, .15); cursor: default; }
.modeswitch.is-admin .ms-btn.on { background: var(--yellow); color: #5a3d00; box-shadow: 0 2px 8px rgba(246, 188, 7, .45), inset 0 1px 0 rgba(255, 255, 255, .5); }
html[data-theme="dark"] .modeswitch { background: rgba(0, 0, 0, .25); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35); }
html[data-theme="dark"] .ms-btn.on { background: rgba(148, 163, 184, .22); color: var(--accent); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08); }
html[data-theme="dark"] .modeswitch.is-admin .ms-btn.on { background: var(--yellow); color: #3d2900; }
.modeswitch { position: relative; align-items: center; }
.modeswitch form { display: contents; }
.ms-btn.is-open { background: rgba(255, 255, 255, .92); color: var(--accent); box-shadow: 0 2px 6px rgba(15, 23, 42, .15); }
html[data-theme="dark"] .ms-btn.is-open { background: rgba(148, 163, 184, .22); }
/* Включённый режим: щит + сколько минут осталось без действий */
.ms-btn.ms-timer { width: auto; gap: 4px; padding: 0 10px 0 8px; }
.ms-left { font-size: .76rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.modeswitch.is-admin .ms-btn.on.is-expired { background: rgba(15, 23, 42, .08); color: var(--muted); box-shadow: none; cursor: pointer; }

/* Подтверждение режима админа: небольшое окно под щитом и запасная страница */
.unlock-pop {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 45; width: 290px; padding: 14px;
  border-radius: 16px; background: rgba(255, 255, 255, .94); border: 1px solid rgba(255, 255, 255, .85);
  -webkit-backdrop-filter: blur(24px) saturate(170%); backdrop-filter: blur(24px) saturate(170%);
  box-shadow: 0 22px 44px -14px rgba(37, 65, 165, .4), 0 4px 12px rgba(15, 23, 42, .08), inset 0 1px 0 #fff;
  transform-origin: top right;
}
html[data-theme="dark"] .unlock-pop {
  background: rgba(15, 23, 42, .95); border-color: rgba(148, 163, 184, .24);
  box-shadow: 0 22px 48px -12px rgba(0, 0, 0, .75), inset 0 1px 0 rgba(255, 255, 255, .07);
}
.unlock-head { display: flex; flex-direction: column; gap: 1px; margin-bottom: 12px; }
.unlock-head b { font-size: .95rem; }
.unlock-head span { font-size: .78rem; color: var(--muted); }
.unlock-form { margin: 0; }
.unlock-row { display: flex; gap: 6px; }
.unlock .unlock-input { flex: 1; min-width: 0; margin: 0; padding: 9px 12px; border-radius: 10px; font-size: 1rem; letter-spacing: .08em; }
.unlock .unlock-input::placeholder { letter-spacing: 0; }
.pin-mask { -webkit-text-security: disc; }
.unlock-go { flex: none; padding: 0 14px; border: 0; border-radius: 10px; background: var(--btn); color: #fff; font-weight: 600; font-size: .9rem; }
.unlock-pk {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 12px;
  border: 0; border-radius: 10px; background: var(--btn); color: #fff; font-weight: 600; font-size: .9rem;
}
.unlock-pk:not([hidden]) ~ .unlock-form .unlock-go { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1px var(--line-strong); }
.unlock-go:hover, .unlock-pk:hover { filter: brightness(1.08); }
.unlock-or { display: flex; align-items: center; gap: 8px; margin: 10px 0; font-size: .76rem; color: var(--muted); }
.unlock-or::before, .unlock-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.unlock-err { margin: 8px 0 0; font-size: .84rem; color: var(--danger); }
.unlock.is-busy { opacity: .7; }
.unlock-page { max-width: 360px; margin: 48px auto 0; }
.unlock-title { margin: 0 0 4px; font-size: 1.15rem; }
.unlock-sub { margin: 0 0 16px; font-size: .88rem; color: var(--muted); }
@media (max-width: 600px) {
  .unlock-pop { position: fixed; left: 12px; right: 12px; top: 72px; width: auto; }
  .unlock-page { margin-top: 24px; }
}

/* Переключатель темы: круглая кнопка; в шапке без рамки */
.theme-toggle {
  width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .7); background: rgba(255, 255, 255, .45); color: var(--text);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); transition: background-color .15s, color .15s;
}
.theme-toggle:hover { background: rgba(255, 255, 255, .75); }
.theme-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
html[data-theme="dark"] .theme-toggle { border-color: rgba(148, 163, 184, .25); background: rgba(15, 23, 42, .45); }
.topbar .theme-toggle { border-color: transparent; background: transparent; color: var(--muted); -webkit-backdrop-filter: none; backdrop-filter: none; }
.topbar .theme-toggle:hover { color: var(--text); background: rgba(15, 23, 42, .06); }
html[data-theme="dark"] .topbar .theme-toggle:hover { background: rgba(255, 255, 255, .08); }

/* Меню под аватаром: ФИО и роль, «Безопасность», «Выйти» */
.umenu { position: relative; }
.umenu-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px 2px 2px; border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, .55); color: var(--muted); box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .06);
  transition: background-color .15s, color .15s;
}
.umenu-btn:hover, .umenu-btn[aria-expanded="true"] { background: rgba(255, 255, 255, .85); color: var(--text); }
.umenu-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.umenu-btn .av { width: 34px; height: 34px; font-size: .78rem; }
.umenu-chev { transition: transform .2s ease; }
.umenu-btn[aria-expanded="true"] .umenu-chev { transform: rotate(180deg); }
html[data-theme="dark"] .umenu-btn { background: rgba(148, 163, 184, .12); box-shadow: inset 0 0 0 1px rgba(148, 163, 184, .16); }
html[data-theme="dark"] .umenu-btn:hover, html[data-theme="dark"] .umenu-btn[aria-expanded="true"] { background: rgba(148, 163, 184, .22); }
.umenu-pop {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 45; min-width: 230px; padding: 6px;
  border-radius: 16px; background: rgba(255, 255, 255, .92); border: 1px solid rgba(255, 255, 255, .85);
  -webkit-backdrop-filter: blur(24px) saturate(170%); backdrop-filter: blur(24px) saturate(170%);
  box-shadow: 0 22px 44px -14px rgba(37, 65, 165, .4), 0 4px 12px rgba(15, 23, 42, .08), inset 0 1px 0 #fff;
  transform-origin: top right;
}
html[data-theme="dark"] .umenu-pop {
  background: rgba(15, 23, 42, .94); border-color: rgba(148, 163, 184, .24);
  box-shadow: 0 22px 48px -12px rgba(0, 0, 0, .75), inset 0 1px 0 rgba(255, 255, 255, .07);
}
.um-enter { transition: opacity .16s ease-out, transform .16s ease-out; }
.um-leave { transition: opacity .12s ease-in, transform .12s ease-in; }
.um-from { opacity: 0; transform: translateY(-4px) scale(.97); }
.umenu-head { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.umenu-name { font-weight: 600; font-size: .92rem; color: var(--text); }
.umenu-role { font-size: .78rem; color: var(--muted); }
.umenu-item {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 10px;
  background: transparent; color: var(--text); font-size: .9rem; text-decoration: none; text-align: left; transition: background-color .12s;
}
.umenu-item svg { color: var(--muted); flex: none; }
.umenu-item:hover, .umenu-item:focus-visible { outline: none; background: rgba(7, 128, 191, .09); }
.umenu-item.is-danger, .umenu-item.is-danger svg { color: var(--danger); }
.umenu-item.is-danger:hover, .umenu-item.is-danger:focus-visible { background: rgba(220, 38, 38, .08); }
html[data-theme="dark"] .umenu-item:hover, html[data-theme="dark"] .umenu-item:focus-visible { background: rgba(94, 194, 240, .12); }
html[data-theme="dark"] .umenu-item.is-danger:hover { background: rgba(248, 113, 113, .12); }

@media (max-width: 600px) {
  .topbar { top: 8px; width: calc(100% - 16px); margin-top: 8px; min-height: 52px; padding: 7px 8px 7px 12px; gap: 6px; border-radius: 20px; }
  .topbar .brand img { height: 30px; }
  .tb-nav { margin-left: 2px; }
  .tb-nav a { padding: 5px 11px; font-size: .84rem; }
  .who { gap: 2px; }
  .modeswitch { margin-right: 2px; }
  .ms-btn { width: 32px; height: 30px; }
  .umenu-btn .av { width: 32px; height: 32px; }
}
@media (max-width: 360px) {
  .tb-nav a { padding: 5px 8px; }
  .umenu-chev { display: none; }
  .umenu-btn { padding: 2px; }
}
@media (prefers-reduced-motion: reduce) { .topbar, .um-enter, .um-leave, .umenu-chev { transition: none; } }

/* Логотип по теме: полный на широком экране, знак на телефоне */
.brand img, .login-logo { display: none; height: 32px; width: auto; }
html:not([data-theme="dark"]) .brand .logo-full.th-light,
html[data-theme="dark"] .brand .logo-full.th-dark { display: block; }
html:not([data-theme="dark"]) .login-logo.th-light,
html[data-theme="dark"] .login-logo.th-dark { display: block; width: 220px; max-width: 100%; height: auto; margin: 0 auto 4px; }
@media (max-width: 600px) {
  html:not([data-theme="dark"]) .brand .logo-full.th-light,
  html[data-theme="dark"] .brand .logo-full.th-dark { display: none; }
  html:not([data-theme="dark"]) .brand .logo-mark.th-light,
  html[data-theme="dark"] .brand .logo-mark.th-dark { display: block; }
}

/* Переключатель темы */
.theme-toggle .ic-sun { display: none; }
html[data-theme="dark"] .theme-toggle .ic-sun { display: block; }
html[data-theme="dark"] .theme-toggle .ic-moon { display: none; }
.floating-toggle { position: fixed; top: 12px; right: 12px; z-index: 40; }

.tagline { color: var(--muted); margin: 0 0 16px; }
.copy {
  color: var(--muted); font-size: .75rem; margin: 16px 0 0;
  display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap;
}
.pk-inline { display: inline-flex; align-items: center; gap: 6px; }
.pk-inline[hidden] { display: none !important; }
.copy-dot { opacity: .45; }
.pk-mini {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 5px; margin: -2px 0;
  border: 0; border-radius: 5px; background: none; color: var(--muted); opacity: .85;
  font-size: .75rem; line-height: 1.3; transition: color .15s ease, background-color .15s ease, opacity .15s ease;
}
.pk-mini:hover, .pk-mini:focus-visible {
  outline: none; opacity: 1; color: var(--accent); background: rgba(7, 128, 191, .09);
}
html[data-theme="dark"] .pk-mini:hover,
html[data-theme="dark"] .pk-mini:focus-visible { background: rgba(94, 194, 240, .14); }
.pk-error { font-size: .82rem; margin: 10px 0 -6px; }
.error-page .code { font-size: 3rem; font-weight: 700; color: var(--brand); margin: 12px 0 0; line-height: 1; }
.btn-link { display: inline-block; margin-top: 8px; padding: 10px 18px; border-radius: 10px; background: var(--btn); color: #fff; text-decoration: none; font-weight: 600; box-shadow: 0 6px 14px -8px rgba(6, 106, 158, .9); transition: filter .12s, transform .12s; }
.btn-link:hover { filter: brightness(1.08); transform: translateY(-1px); }

/* ===== Мои задачи (секционный лист в духе Things 3) ===== */
.tasks-top { padding: 2px 0 12px; }
.tasks-top .name { font-size: 1.3rem; letter-spacing: -.015em; }
.quick-add {
  margin-bottom: 14px; padding: 0;
  background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 12px;
  -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 8px 22px -12px rgba(37, 65, 165, .18), inset 0 1px 0 rgba(255, 255, 255, .75);
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.quick-add:focus-within {
  background: var(--input-bg); border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(7, 128, 191, .15), 0 10px 24px -12px rgba(37, 65, 165, .22);
}
.qa-line { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 10px; }
.qa-plus {
  width: 24px; height: 24px; border-radius: 7px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(7, 128, 191, .13); color: var(--brand); font-weight: 700; font-size: 1.05rem; line-height: 1;
}
html[data-theme="dark"] .qa-plus { background: rgba(94, 194, 240, .16); color: var(--accent); }
.quick-add input {
  margin: 0; padding: 7px 2px; flex: 1; min-width: 0; border: 0; background: transparent;
  font-size: .98rem; outline: none;
}
.quick-add input:focus { outline: none; }
/* Кнопка «Добавить»: приглушена, пока поле пустое; синяя, как только появился текст.
   На телефоне круглая со стрелкой (как «отправить» в мессенджерах). */
.qa-send {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; margin: 0; padding: 0 8px 0 12px;
  border: 0; border-radius: 9px; background: var(--soft-2); color: var(--muted);
  font-size: .84rem; font-weight: 600; white-space: nowrap; cursor: pointer;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.qa-send:disabled { opacity: .55; cursor: default; }
.qa-send-kbd {
  padding: 0 5px; border-radius: 5px; border: 1px solid currentColor; font: inherit; font-size: .72rem; line-height: 1.35; opacity: .7;
}
.qa-send-ico { display: none; }
.quick-add.has-text .qa-send { background: var(--btn); color: #fff; box-shadow: 0 4px 12px -4px rgba(7, 128, 191, .55); }
.quick-add.has-text .qa-send:hover { filter: brightness(1.08); }
.qa-send:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
/* мягкая подсказка: текст набран, но задача не отправлена */
.qa-send.nudge { animation: qa-nudge 1.1s ease 2; }
@keyframes qa-nudge {
  0%, 100% { box-shadow: 0 4px 12px -4px rgba(7, 128, 191, .55), 0 0 0 0 rgba(7, 128, 191, .45); }
  50% { box-shadow: 0 4px 12px -4px rgba(7, 128, 191, .55), 0 0 0 7px rgba(7, 128, 191, 0); transform: scale(1.04); }
}
@media (prefers-reduced-motion: reduce) { .qa-send.nudge { animation: none; } }
@media (max-width: 600px) {
  .qa-send { width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 50%; }
  .qa-send-label, .qa-send-kbd { display: none; }
  .qa-send-ico { display: block; }
}

/* Чипы под полем ввода: видны, пока поле в фокусе, открыто их меню или что-то уже выбрано */
/* Панель лежит поверх вкладок (position: absolute), поэтому её появление не сдвигает список */
.quick-add { position: relative; z-index: 15; }
.qa-opts {
  display: none; flex-wrap: wrap; align-items: center; gap: 6px; padding: 2px 12px 10px 44px;
  position: absolute; left: -1px; right: -1px; top: calc(100% - 1px);
  background: var(--solid); border: 1px solid var(--brand); border-top: 0; border-radius: 0 0 12px 12px;
  box-shadow: 0 0 0 3px rgba(7, 128, 191, .15), 0 14px 24px -12px rgba(37, 65, 165, .28);
  clip-path: inset(0 -8px -40px -8px);   /* кольцо фокуса только по бокам и снизу, сверху панель срастается с полем */
}
.quick-add:focus-within .qa-opts, .quick-add.menu-open .qa-opts, .quick-add.has-opts .qa-opts, .quick-add.has-text .qa-opts { display: flex; }
.quick-add:focus-within, .quick-add.menu-open, .quick-add.has-opts, .quick-add.has-text {
  background: var(--solid); border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(7, 128, 191, .15), 0 10px 24px -12px rgba(37, 65, 165, .22);
}
.qa-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px;
  border: 1px dashed var(--line-strong); background: transparent; color: var(--muted); font-size: .82rem; white-space: nowrap;
  transition: color .12s ease, border-color .12s ease, background-color .12s ease;
}
.qa-chip:hover, .qa-chip:focus-visible { color: var(--text); border-color: var(--brand); outline: none; }
.qa-chip.is-set { border-style: solid; border-color: transparent; background: rgba(7, 128, 191, .12); color: var(--accent); font-weight: 600; }
.qa-chip.is-high { background: rgba(220, 38, 38, .10); color: var(--prio-high); }
.qa-chip.is-low { background: rgba(47, 133, 90, .10); color: var(--prio-low); }
.qa-chip.is-star { background: rgba(246, 188, 7, .18); color: #8a6200; }
html[data-theme="dark"] .qa-chip.is-set { background: rgba(94, 194, 240, .16); }
html[data-theme="dark"] .qa-chip.is-high { background: rgba(248, 113, 113, .16); }
html[data-theme="dark"] .qa-chip.is-low { background: rgba(74, 222, 128, .14); }
html[data-theme="dark"] .qa-chip.is-star { background: rgba(246, 188, 7, .2); color: #fcd34d; }
.qa-x { margin-left: 2px; padding: 0 2px; opacity: .6; font-weight: 400; }
.qa-x:hover { opacity: 1; }
.qa-hint { margin-left: auto; font-size: .74rem; color: var(--muted); opacity: .8; }
@media (max-width: 600px) { .qa-opts { padding-left: 12px; } .qa-hint { display: none; } }

/* Меню выбора срока и приоритета (общие для чипов и строк) */
.pick-menu {
  position: fixed; z-index: 60; min-width: 230px; display: flex; flex-direction: column; padding: 6px;
  background: var(--solid); border: 1px solid var(--glass-border); border-radius: 12px; box-shadow: var(--menu-shadow);
}
.pick-menu[hidden] { display: none; }
.pick-menu button {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 10px;
  border: 0; border-radius: 8px; background: transparent; color: var(--text); font-size: .88rem; text-align: left;
}
.pick-menu button:hover, .pick-menu button:focus-visible { background: rgba(7, 128, 191, .10); outline: none; }
.pick-menu button.is-current { font-weight: 700; }
.pick-menu small { color: var(--muted); font-size: .78rem; }
.pick-menu hr { width: 100%; margin: 4px 0; border: 0; border-top: 1px solid var(--line); }
.pick-menu .pick-date { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0; padding: 4px 10px; font-size: .84rem; color: var(--muted); }
.pick-menu .pick-date input { width: auto; margin: 0; padding: 5px 8px; font-size: .86rem; }
.pick-menu .pick-clear { color: var(--muted); }
.prio-high-t { color: var(--prio-high); font-weight: 600; }
.prio-low-t { color: var(--prio-low); font-weight: 600; }
@media (max-width: 600px) {   /* на телефоне меню выезжает снизу, пункты крупные */
  .pick-menu { left: 8px !important; right: 8px; top: auto !important; bottom: calc(8px + env(safe-area-inset-bottom)); min-width: 0; padding: 10px; border-radius: 16px; }
  .pick-menu button { padding: 12px; font-size: 1rem; }
}

.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.empty-note { text-align: center; padding: 28px 0; }
.task-list:has(li.task) + .empty-note { display: none; }

.things-sheet, .done-sheet {
  gap: 2px; padding: 10px 10px 12px; border-radius: 14px;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(22px) saturate(140%); backdrop-filter: blur(22px) saturate(140%);
  box-shadow: var(--glass-shadow);
}
.things-sheet:not(:has(li.task)), .done-sheet:not(:has(li.task)) { display: none; }
.sect-head {
  display: flex; align-items: center; gap: 6px; padding: 4px 10px 6px 30px;
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .055em;
  color: var(--muted); user-select: none;
}
.sect-global { color: #9a6b00; }
html[data-theme="dark"] .sect-global { color: #fcd34d; }
.things-sheet .task.is-global + .sect-regular {
  margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line);
}
.sect-num {
  padding: 1px 6px; border-radius: 999px; background: rgba(15, 23, 42, .06);
  color: var(--muted); font-size: .68rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
html[data-theme="dark"] .sect-num { background: rgba(148, 163, 184, .16); }

/* Строки списка */
.task { background: var(--row-bg); border: 1px solid var(--glass-border); border-radius: 10px; box-shadow: var(--row-shadow); }
.task.is-global { border-left: 4px solid var(--yellow); }
/* Только что добавленная строка: подсветка гаснет за 1,2 с после снятия класса */
.things-sheet > .task.fresh { background: rgba(7, 128, 191, .12); box-shadow: inset 3px 0 0 var(--brand); transition: none; }
html[data-theme="dark"] .things-sheet > .task.fresh { background: rgba(94, 194, 240, .14); box-shadow: inset 3px 0 0 var(--accent); }
.things-sheet > .task.fresh-fade { transition: background-color 1.2s ease, box-shadow 1.2s ease; }
.task.expanded { border-color: var(--brand); }
.things-sheet > .task, .done-sheet > .task {
  background: transparent; border: 1px solid transparent; border-radius: 9px; box-shadow: none;
  transition: background-color .13s ease, border-color .13s ease;
}
.things-sheet > .task.is-global { border-left-width: 1px; border-left-color: transparent; }
.things-sheet > .task:not(.expanded):hover, .done-sheet > .task:hover { background: rgba(255, 255, 255, .64); }
html[data-theme="dark"] .things-sheet > .task:not(.expanded):hover,
html[data-theme="dark"] .done-sheet > .task:hover { background: rgba(255, 255, 255, .05); }
/* Раскрытая карточка: плотное стекло с мягкой синей обводкой (градиентная рамка через border-box) и кольцом */
.things-sheet > .task.expanded {
  margin: 6px 2px; border-radius: 14px; border-color: transparent;
  background: var(--card-fill) padding-box, var(--card-rim) border-box;
  box-shadow: 0 0 0 4px rgba(7, 128, 191, .08), var(--g-depth);
}
.things-sheet > .task.sub-open {
  margin: 3px 2px; background: rgba(255, 255, 255, .58); border-color: var(--line-strong);
}
html[data-theme="dark"] .things-sheet > .task.sub-open {
  background: rgba(15, 23, 42, .52); border-color: var(--line);
}
.inline-subs { padding: 2px 12px 10px 38px; border-top: 1px dashed var(--line); }
@media (max-width: 600px) { .inline-subs { padding: 2px 10px 8px 24px; } }
.task-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 10px; padding: 8px 10px 8px 4px; }
.task-check {
  width: 18px; height: 18px; padding: 0; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.6px solid rgba(100, 116, 139, .46); background: transparent; color: transparent;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease, transform .12s ease;
}
.task-check:hover:not(:disabled), .task-check:focus-visible {
  outline: none; border-color: var(--brand); background: rgba(7, 128, 191, .12); color: var(--brand); transform: scale(1.06);
}
.task-check.htmx-request { border-color: #16a34a; background: #16a34a; color: #fff; }
.task-check:disabled { opacity: .35; cursor: default; }
html[data-theme="dark"] .task-check { border-color: rgba(148, 163, 184, .45); }
html[data-theme="dark"] .task-check:hover:not(:disabled),
html[data-theme="dark"] .task-check:focus-visible { border-color: var(--accent); background: rgba(94, 194, 240, .15); color: var(--accent); }
/* Приоритет цветом кружка-галочки: высокий — красный кружок, средний — обычный, низкий — пунктир и бледное название */
.task-check { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
.task-check.p-high { border: 2px solid var(--prio-high); background: rgba(220, 38, 38, .08); }
.task-check.p-low { border-style: dashed; border-color: rgba(100, 116, 139, .5); }
html[data-theme="dark"] .task-check.p-high { border-color: var(--prio-high); background: rgba(248, 113, 113, .12); }
.task-head[data-p="low"] .task-title { color: var(--muted); }
.prio-dot {
  display: inline-block; width: 11px; height: 11px; border-radius: 50%; vertical-align: -1px; flex: none;
  border: 1.6px solid rgba(100, 116, 139, .55); box-sizing: border-box;
}
.prio-dot.p-high { border: 2px solid var(--prio-high); background: rgba(220, 38, 38, .10); }
.prio-dot.p-low { border-style: dashed; }
.done-badge {
  width: 18px; height: 18px; margin-left: 6px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(22, 163, 74, .14); color: #16a34a;
}
html[data-theme="dark"] .done-badge { background: rgba(34, 197, 94, .2); color: #4ade80; }

.task-click {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 5px 12px;
  flex: 1 1 auto; min-width: 0; cursor: pointer;
}
.task-main { display: flex; gap: 7px; align-items: baseline; flex: 1 1 220px; min-width: 0; }
.task-title { font-size: .95rem; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.star { color: var(--star); }
.task-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: .78rem; }
.prio { padding: 2px 6px; border-radius: 5px; font-weight: 600; font-size: .73rem; white-space: nowrap; }
.prio-high { background: rgba(220, 38, 38, .10); color: var(--prio-high); }
.prio-medium { color: var(--prio-medium); }
.prio-low { background: rgba(47, 133, 90, .10); color: var(--prio-low); }
html[data-theme="dark"] .prio-high { background: rgba(248, 113, 113, .16); }
html[data-theme="dark"] .prio-low { background: rgba(74, 222, 128, .14); }
.due { color: var(--muted); padding: 2px 6px; border-radius: 5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Срок и приоритет в строке — кнопки: клик открывает меню выбора */
.task-meta button { margin: 0; border: 0; background: transparent; font: inherit; font-size: inherit; line-height: inherit; cursor: pointer; }
.task-meta button.prio { font-size: .73rem; }
.task-meta button.due { font-size: inherit; }
.task-meta button:hover:not(:disabled), .task-meta button:focus-visible { box-shadow: 0 0 0 1px var(--line-strong); outline: none; }
.task-meta .prio-high { background: rgba(220, 38, 38, .10); }
.task-meta .prio-low { background: rgba(47, 133, 90, .10); }
.task-meta .due.overdue { background: rgba(220, 38, 38, .11); }
.task-meta .due.soon { background: rgba(234, 88, 12, .11); }
html[data-theme="dark"] .task-meta .prio-high, html[data-theme="dark"] .task-meta .due.overdue { background: rgba(248, 113, 113, .16); }
html[data-theme="dark"] .task-meta .prio-low { background: rgba(74, 222, 128, .14); }
html[data-theme="dark"] .task-meta .due.soon { background: rgba(251, 146, 60, .16); }
/* Пустые срок и приоритет: бледные кнопки, видны при наведении на строку (на сенсорных экранах всегда) */
.task-meta button.meta-ghost {
  padding: 1px 6px; border-radius: 5px; color: var(--muted); white-space: nowrap;
  box-shadow: inset 0 0 0 1px var(--line-strong); transition: opacity .14s ease;
}
@media (hover: hover) {
  .task-meta .meta-ghost { opacity: 0; }
  .task-head:hover .meta-ghost, .task-meta .meta-ghost:focus-visible, .task-meta .meta-ghost.keep { opacity: .8; }
}
@media (hover: none) { .task-meta .meta-ghost { opacity: .6; } }
body[data-readonly] .task-meta .meta-ghost { display: none; }
body[data-readonly] .task-meta button { cursor: default; }
.task-meta button:disabled { opacity: 1; }
.due.overdue { background: rgba(220, 38, 38, .11); color: var(--danger); font-weight: 600; }
.due.soon { background: rgba(234, 88, 12, .11); color: var(--warn); font-weight: 600; }
html[data-theme="dark"] .due.overdue { background: rgba(248, 113, 113, .16); }
html[data-theme="dark"] .due.soon { background: rgba(251, 146, 60, .16); }
.progress { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sub-pill {
  flex: none; display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px 3px 7px; border: 0; border-radius: 999px;
  background: rgba(7, 128, 191, .10); color: var(--accent);
  font-size: .77rem; font-weight: 600; transition: background-color .14s ease, transform .12s ease;
}
.sub-pill:hover { background: rgba(7, 128, 191, .17); }
.sub-pill.is-open { background: rgba(7, 128, 191, .18); }
.sub-pill.all-done { background: rgba(22, 163, 74, .14); color: #15803d; }
.sub-pill.all-done:hover { background: rgba(22, 163, 74, .21); }
html[data-theme="dark"] .sub-pill { background: rgba(94, 194, 240, .15); color: var(--accent); }
html[data-theme="dark"] .sub-pill:hover,
html[data-theme="dark"] .sub-pill.is-open { background: rgba(94, 194, 240, .24); }
html[data-theme="dark"] .sub-pill.all-done { background: rgba(34, 197, 94, .22); color: #86efac; }
.sub-ring { transform: rotate(-90deg); flex: none; }
.sub-caret { font-size: .65rem; opacity: .75; margin-left: 1px; }

.sub-ctrl { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.sub-plus-btn {
  width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 1px dashed var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--muted); font-size: .92rem; font-weight: 600; line-height: 1;
  transition: opacity .14s ease, color .14s ease, border-color .14s ease, background-color .14s ease;
}
.sub-plus-btn:hover { color: var(--accent); border-color: var(--brand); background: rgba(7, 128, 191, .10); border-style: solid; }
@media (hover: hover) {
  .sub-plus-btn.hover-only { opacity: 0; }
  .task-head:hover .sub-plus-btn.hover-only, .sub-plus-btn.hover-only:focus-visible { opacity: 1; }
}
body[data-readonly] .sub-plus-btn, body[data-readonly] .sub-head-add { display: none; }

.sub-add-chip {
  flex: none; padding: 2px 8px; border-radius: 999px; border: 1px dashed var(--line-strong);
  background: transparent; color: var(--muted); font-size: .74rem; white-space: nowrap;
  transition: opacity .14s ease, color .14s ease, border-color .14s ease, background-color .14s ease;
}
.sub-add-chip:hover { color: var(--accent); border-color: var(--brand); background: rgba(7, 128, 191, .08); }
@media (hover: hover) {
  .sub-add-chip:not(.is-open) { opacity: 0; }
  .task-head:hover .sub-add-chip:not(.is-open), .sub-add-chip:focus-visible { opacity: 1; }
}
@media (hover: none) { .sub-add-chip:not(.is-open) { opacity: .65; } }
body[data-readonly] .sub-add-chip:not(.is-open) { display: none; }

/* Статусы */
.pill {
  --pill-bg: #e8ecf1; --pill-fg: #3b4652;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border: 0; border-radius: 999px; background: var(--pill-bg); color: var(--pill-fg);
  white-space: nowrap; font-size: .8rem; font-weight: 500; transition: filter .12s ease;
}
.pill:hover { filter: brightness(.97); }
.pill-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; flex: none; }
.pill-in_progress { --pill-bg: #dbeafe; --pill-fg: #1e40af; }
.pill-waiting { --pill-bg: #fef3c7; --pill-fg: #92400e; }
.pill-postponed { --pill-bg: #ede9fe; --pill-fg: #5b21b6; }
.pill-done { --pill-bg: #dcfce7; --pill-fg: #166534; }
.pill-cancelled { --pill-bg: #f1f5f9; --pill-fg: #64748b; }
html[data-theme="dark"] .pill { --pill-bg: rgba(148, 163, 184, .2); --pill-fg: #cbd5e1; }
html[data-theme="dark"] .pill-in_progress { --pill-bg: rgba(59, 130, 246, .25); --pill-fg: #93c5fd; }
html[data-theme="dark"] .pill-waiting { --pill-bg: rgba(245, 158, 11, .22); --pill-fg: #fcd34d; }
html[data-theme="dark"] .pill-postponed { --pill-bg: rgba(139, 92, 246, .26); --pill-fg: #c4b5fd; }
html[data-theme="dark"] .pill-done { --pill-bg: rgba(34, 197, 94, .22); --pill-fg: #86efac; }
html[data-theme="dark"] .pill-cancelled { --pill-bg: rgba(100, 116, 139, .25); --pill-fg: #94a3b8; }

.status-wrap { position: relative; flex: none; }
.status-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; display: flex; flex-direction: column;
  gap: 6px; padding: 8px; background: var(--solid); border: 1px solid var(--glass-border); border-radius: 10px;
  box-shadow: var(--menu-shadow);
}
.status-menu .pill { padding: 8px 14px; text-align: left; }

/* ===== Карточка задачи: чипы свойств, заметка, подзадачи, тихий футер ===== */
/* Содержимое начинается на одной вертикали с названием (после ручки и кружка) */
.card-edit { --ci: 60px; padding: 0 14px 0 var(--ci); }
.task.expanded .task-head { padding-bottom: 4px; }
/* в раскрытой строке срок, значки и прогресс уже есть в карточке */
.task.expanded > .task-head .task-meta, .task.expanded > .task-head .sub-ctrl,
.task.expanded > .task-head .note-ico, .task.expanded > .task-head .task-reason { display: none; }
.head-title-inp {
  display: block; width: 100%; margin: -3px 0; padding: 2px 6px 2px 5px; margin-left: -6px; resize: none; overflow: hidden;
  border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--text);
  font: inherit; font-size: 1.02rem; font-weight: 600; line-height: 1.4; -webkit-line-clamp: unset; cursor: text;
}
.head-title-inp:hover { background: rgba(15, 23, 42, .035); }
.head-title-inp:focus { outline: none; background: var(--input-bg); border-color: var(--line-strong); }
html[data-theme="dark"] .head-title-inp:hover { background: rgba(255, 255, 255, .05); }
.task.expanded .task-tline { width: 100%; }

/* Чипы свойств: один вид. Пустой приглушён на мягкой подложке, заданный белый с рамкой, включённый окрашен. Без пунктира. */
.card-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0 10px; }
.cchip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; margin: 0; padding: 0 11px;
  border: 1px solid transparent; border-radius: 999px; background: var(--soft);
  color: var(--muted); font-size: .8rem; font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: background-color .13s ease, border-color .13s ease, color .13s ease;
}
.cchip:hover { background: var(--soft-2); color: var(--text); }
.cchip:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.cchip.is-set { border-color: var(--line); background: var(--chip-bg); color: var(--text); font-weight: 600; }
.cchip.is-set:hover { border-color: var(--brand); }
.cchip.is-overdue { background: rgba(220, 38, 38, .10); border-color: transparent; color: var(--danger); }
.cchip.is-soon { background: rgba(234, 88, 12, .10); border-color: transparent; color: var(--warn); }
.cchip.is-star { border-color: transparent; background: rgba(246, 188, 7, .18); color: #8a6200; font-weight: 600; }
.cchip.is-star span:first-child { color: var(--star); }
.cchip-flag:hover { color: var(--warn); background: var(--attn-bg); }
.cchip .i-cal, .cchip .i-flag { flex: none; }
html[data-theme="dark"] .cchip.is-overdue { background: rgba(248, 113, 113, .16); }
html[data-theme="dark"] .cchip.is-soon { background: rgba(251, 146, 60, .16); }
html[data-theme="dark"] .cchip.is-star { background: rgba(246, 188, 7, .2); color: #fcd34d; }

/* Небольшие кнопки в стиле чипов (действия флага) */
.mini-btn {
  display: inline-flex; align-items: center; gap: 5px; height: 28px; margin: 0; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--chip-bg);
  color: var(--text); font-size: .8rem; font-weight: 500; white-space: nowrap; cursor: pointer;
}
.mini-btn:hover { border-color: var(--brand); }
.mini-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.mini-btn.is-warn { background: var(--warn); border-color: transparent; color: #fff; font-weight: 600; }
.mini-btn.is-warn:hover { filter: brightness(1.06); }
html[data-theme="dark"] .mini-btn.is-warn { color: #1b1206; }

/* Заметка: видно, что это поле (подложка и значок) */
.card-top-form { margin: 0; }
.note-field { position: relative; }
.note-field-ico { position: absolute; left: 10px; top: 10px; color: var(--muted); display: inline-flex; pointer-events: none; }
.card-note-inp {
  display: block; width: 100%; margin: 0; padding: 7px 30px 7px 32px; resize: none; overflow: hidden; min-height: 0;
  border: 1px solid transparent; border-radius: 10px; background: var(--soft);
  font-size: .9rem; line-height: 1.5; color: var(--text);
}
.card-note-inp::placeholder { color: var(--muted); }
.card-note-inp:hover { background: var(--soft-2); }
.card-note-inp:focus { outline: none; background: var(--input-bg); border-color: var(--line-strong); }
/* Галочка у поля после сохранения (класс ставит app.js на 1,5 с) */
.note-field::after, .sub-form::after {
  content: "✓"; position: absolute; right: 10px; top: 8px; color: var(--ok); font-weight: 700; font-size: .85rem;
  opacity: 0; transition: opacity .2s ease; pointer-events: none;
}
.sub-form { position: relative; }
.sub-form::after { right: auto; left: -14px; top: 6px; }
.just-saved::after { opacity: 1; }

.card-msg { min-height: 0; font-size: .86rem; }
.card-msg:not(:empty) { margin-top: 6px; }
.card-msg.error { color: var(--danger); }

/* Подзадачи в карточке: последней строкой «+ Добавить подзадачу» */
.card-edit .subtasks { margin-top: 10px; padding-top: 8px; border-top: 0; }
.subtasks-head.is-empty { display: none; }
.sub-add-row {
  display: flex; align-items: center; gap: 8px; width: 100%; margin: 2px 0 0; padding: 6px; border: 0; border-radius: 8px;
  background: none; color: var(--muted); font-size: .88rem; text-align: left; cursor: pointer;
}
.sub-add-row:hover { background: var(--soft); color: var(--accent); }
.sub-add-ring {
  width: 17px; height: 17px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px dashed var(--line-strong); border-radius: 50%; font-size: .78rem; line-height: 1;
}

/* Нижняя строка: дата постановки, статус сохранения, действия с подписями */
.card-foot {
  display: flex; align-items: center; gap: 10px;
  margin: 10px -14px 0 calc(-1 * var(--ci)); padding: 6px 10px 6px var(--ci);
  border-top: 1px solid var(--line);
}
.card-created { margin: 0; min-width: 0; }
.card-created-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; margin: 0 0 0 -9px; padding: 0 9px; border: 0; border-radius: 999px;
  background: transparent; font-size: .78rem; color: var(--muted); white-space: nowrap; cursor: pointer;
}
.card-created-btn:hover, .card-created-btn[aria-expanded="true"] { color: var(--text); background: var(--soft); }
.card-created-btn:disabled { cursor: default; }
.save-state { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--muted); white-space: nowrap; }
.save-state:empty { display: none; }
.save-state .ss-spin { width: 13px; height: 13px; flex: none; border: 2px solid var(--line-strong); border-top-color: var(--brand); border-radius: 50%; animation: ss-spin .8s linear infinite; }
.save-state.is-saved { color: var(--ok); }
.save-state.is-error { color: var(--danger); font-weight: 600; }
.save-state .ss-retry { margin: 0; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 500; text-decoration: underline; cursor: pointer; }
@keyframes ss-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .save-state .ss-spin { animation: none; } }
.card-tools { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.tool-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; margin: 0; padding: 0 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); font-size: .8rem; white-space: nowrap; cursor: pointer;
}
.tool-btn:hover, .tool-btn:focus-visible, .tool-btn.is-on { outline: none; color: var(--text); background: var(--soft-2); }
.tool-btn.is-primary { color: var(--accent); font-weight: 600; }
.hist-label-long { display: none; }
.icon-btn {
  width: 32px; height: 32px; margin: 0; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover, .icon-btn:focus-visible, .icon-btn.is-on { outline: none; color: var(--text); background: var(--soft-2); }
.more-wrap { position: relative; }
.more-menu {
  position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 20; min-width: 200px; padding: 6px;
  display: flex; flex-direction: column; background: var(--solid); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--menu-shadow);
}
.more-menu.is-down { bottom: auto; top: calc(100% + 6px); }
.more-menu button {
  margin: 0; padding: 9px 10px; border: 0; border-radius: 8px; background: none; text-align: left;
  color: var(--text); font-size: .88rem; cursor: pointer;
}
.more-menu button:hover, .more-menu button:focus-visible { outline: none; background: rgba(7, 128, 191, .10); }
.more-menu button.is-danger { color: var(--danger); }
.more-menu button.is-danger:hover { background: rgba(220, 38, 38, .08); }
.more-menu hr { width: 100%; margin: 4px 0; border: 0; border-top: 1px solid var(--line); }
/* история открывается кнопкой в футере, своя строка-заголовок не нужна */
.card-edit .history { border-top: 0; margin: 0; padding: 0 0 10px; }
.card-edit .history summary { display: none; }
.card-edit .history[open] { padding-top: 4px; }
/* Панель «‹ Назад» и строка «Удалить задачу» есть только на телефоне */
.card-nav, .card-del-row { display: none; }

/* Телефон: строка в две линии. Сверху название, снизу приоритет, срок, подзадачи и статус (статус прижат вправо).
   .task-click растворяется (display: contents), чтобы его дети встали в общий ряд; клик по названию и сроку работает как раньше. */
@media (max-width: 600px) {
  .task-head { flex-wrap: wrap; row-gap: 4px; column-gap: 6px; }
  .task-click { display: contents; }
  .task-main { order: 1; flex: 1 1 calc(100% - 60px); cursor: pointer; }
  .task-meta { order: 2; margin-left: 38px; }
  .task-meta .mg-label { display: none; }   /* пустые срок и приоритет на телефоне: только значки */
  .task-head > .sub-ctrl, .task-head > .sub-add-chip { order: 3; }
  .task-head > .status-wrap { order: 4; margin-left: auto; }
}

/* Телефон: раскрытая карточка — отдельный экран поверх списка.
   Сверху панель «‹ Назад · статус · ⋯» (position: fixed, вместе со статус-таблеткой из шапки строки).
   Экран следует за видимой областью (--vv-top/--vv-h задаёт app.js по visualViewport), поэтому при клавиатуре панель не уезжает.
   Прокрутка страницы под карточкой заблокирована (html.card-open). Фон фирменный, содержимое в стеклянных блоках. */
@media (max-width: 600px) {
  html.card-open, html.card-open body { overflow: hidden; }
  .things-sheet:has(.task.expanded) { -webkit-backdrop-filter: none; backdrop-filter: none; }
  .things-sheet > .task.expanded, .task.expanded {
    --nav-h: calc(52px + env(safe-area-inset-top));
    position: fixed; left: 0; right: 0; top: var(--vv-top, 0px); height: var(--vv-h, 100dvh); z-index: 30;
    margin: 0; border: 0; border-radius: 0; box-shadow: none; overflow-y: auto; overscroll-behavior: contain;
    padding: calc(var(--nav-h) + 12px) 12px calc(24px + env(safe-area-inset-bottom));
    background-color: var(--base); background-image: var(--page-bg);
  }
  .task.expanded > .task-head {
    flex-wrap: nowrap; align-items: flex-start; gap: 10px; padding: 14px 14px 4px;
    border: 1px solid transparent; border-bottom: 0; border-radius: 16px 16px 0 0;
    background: var(--g-fill-dense) padding-box, var(--g-rim) border-box;
  }
  .task.expanded > .task-head .drag-handle { display: none; }
  .task.expanded > .task-head .task-check { width: 22px; height: 22px; margin-top: 3px; }
  .task.expanded .task-main { flex: 1 1 0; }
  .task.expanded .task-title { -webkit-line-clamp: unset; }
  .task.expanded .head-title-inp { font-size: 1.12rem; }
  /* статус-таблетка встаёт в центр панели */
  .task.expanded > .task-head > .status-wrap {
    position: fixed; z-index: 32; top: calc(var(--vv-top, 0px) + env(safe-area-inset-top) + 11px); left: 50%; transform: translateX(-50%);
    margin: 0; order: 0;
  }
  .task.expanded > .task-head > .status-wrap > .pill { padding: 5px 12px; font-size: .84rem; }
  .task.expanded > .task-head > .status-wrap .status-menu { right: auto; left: 50%; transform: translateX(-50%); }
  .task.expanded.is-saving > .task-head > .status-wrap { visibility: hidden; }

  .card-nav {
    display: flex; align-items: center; gap: 8px; position: fixed; z-index: 31; left: 0; right: 0; top: var(--vv-top, 0px);
    height: var(--nav-h); padding: env(safe-area-inset-top) 6px 0 4px;
    background: var(--g-fill-dense); -webkit-backdrop-filter: var(--g-blur); backdrop-filter: var(--g-blur);
    border-bottom: 1px solid var(--line);
  }
  .card-back {
    display: inline-flex; align-items: center; gap: 0; height: 44px; margin: 0; padding: 0 10px 0 4px; border: 0; background: none;
    color: var(--accent); font-size: 1rem; font-weight: 500; cursor: pointer;
  }
  .card-nav .nav-save { position: absolute; left: 50%; top: calc(env(safe-area-inset-top) + 26px); transform: translate(-50%, -50%); }
  .task.expanded:not(.is-saving) .card-nav .nav-save { display: none; }
  .card-nav .more-wrap { margin-left: auto; }
  .card-nav .icon-btn { width: 44px; height: 44px; }

  .card-edit {
    --ci: 14px; padding: 6px 14px 14px; margin-bottom: 12px;
    border: 1px solid transparent; border-top: 0; border-radius: 0 0 16px 16px;
    background: var(--g-fill-dense) padding-box, var(--g-rim) border-box; box-shadow: var(--g-depth);
  }
  .cchip { height: 34px; padding: 0 13px; font-size: .84rem; }
  .mini-btn { height: 32px; padding: 0 13px; font-size: .84rem; }
  .card-edit .subtasks .sub { padding: 4px 4px; }
  .sub-add-row { padding: 10px 6px; }
  /* нижняя строка: «История изменений» во всю ширину, под ней дата постановки и статус сохранения */
  .card-foot { flex-wrap: wrap; margin: 12px 0 0; padding: 10px 0 0; gap: 6px 10px; }
  .card-foot .card-tools { order: -1; width: 100%; margin: 0; }
  .card-foot .foot-more, .card-foot .card-collapse { display: none; }
  .card-hist-btn { width: 100%; height: 44px; padding: 0 12px; border-radius: 12px; background: var(--soft); color: var(--text); font-size: .92rem; }
  .card-hist-btn .hist-label { display: none; }
  .card-hist-btn .hist-label-long { display: inline; }
  .card-foot .save-state { margin-left: auto; }
  .card-del-row {
    display: block; width: 100%; height: 44px; margin: 10px 0 0; border: 0; border-radius: 12px;
    background: rgba(220, 38, 38, .08); color: var(--danger); font-size: .92rem; font-weight: 600; cursor: pointer;
  }
  .card-msg:not(:empty) { margin-top: 8px; }
}

/* ===== Аватары, плашки ролей, счётчики ===== */
.av {
  --av-bg: #e1f1fa; --av-fg: #066A9E;
  width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; flex: none; font-size: .95rem; background: var(--av-bg); color: var(--av-fg);
}
.av.sm { width: 30px; height: 30px; font-size: .72rem; }
.av.m { --av-bg: #fff1c2; --av-fg: #6d5200; }
.av.a { --av-bg: #066A9E; --av-fg: #fff; }
html[data-theme="dark"] .av { --av-bg: rgba(56, 189, 248, .18); --av-fg: #7dd3fc; }
html[data-theme="dark"] .av.m { --av-bg: rgba(246, 188, 7, .2); --av-fg: #fcd34d; }
html[data-theme="dark"] .av.a { --av-bg: #0b79b8; --av-fg: #fff; }
.role { display: inline-block; padding: 1px 9px; border-radius: 6px; font-size: .75rem; font-weight: 600; vertical-align: middle; }
.role.m2 { background: #fff1c2; color: #6d5200; }
.role.a2 { background: #e1f1fa; color: #066A9E; }
html[data-theme="dark"] .role.m2 { background: rgba(246, 188, 7, .2); color: #fcd34d; }
html[data-theme="dark"] .role.a2 { background: rgba(56, 189, 248, .18); color: #7dd3fc; }
.pagehead { display: flex; align-items: center; gap: 12px; padding: 0 0 14px; flex-wrap: wrap; }
.pagehead .name { font-size: 1.2rem; font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.counts { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.chip { background: var(--chip-bg); border: 1px solid var(--glass-border); border-radius: 8px; padding: 4px 10px; font-size: .8rem; color: var(--muted); }
.chip b { color: var(--text); font-size: 1rem; margin-right: 4px; }
.chip.bad b { color: var(--danger); }

/* ===== Подзадачи (бесшовный чек-лист Things 3) ===== */
.subtasks { margin: 4px 0 2px; padding: 6px 0 0; border-top: 1px dashed var(--line); }
.subtasks.subtasks-inline { margin: 4px 0 0; padding: 2px 0 0; background: transparent; border: 0; border-radius: 0; }
.subtasks-head { display: flex; align-items: center; gap: 10px; padding: 0 0 4px; min-height: 28px; }
.subtasks-head .sub-bar { flex: 0 1 96px; min-width: 32px; margin-right: auto; }
.subtasks-head h4, .sub-head-add { white-space: nowrap; flex: none; }
.sub-head-add {
  margin: 0; padding: 4px 8px; border: 0; border-radius: 7px; background: transparent;
  color: var(--accent); font-size: .8rem; font-weight: 600; cursor: pointer;
}
.sub-head-add:hover { background: rgba(7, 128, 191, .09); }
.subtasks-head.is-empty .sub-head-add { margin-left: -8px; color: var(--muted); font-weight: 500; font-size: .86rem; }
.subtasks-head.is-empty .sub-head-add:hover { color: var(--accent); }
.subtasks-head.is-empty:has(.sub-head-add[style*="none"]) { display: none; }
.subtasks h4 {
  margin: 0; font-size: .74rem; text-transform: uppercase; letter-spacing: .045em;
  color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 6px;
}
.sub-ratio { font-weight: 600; text-transform: none; letter-spacing: 0; opacity: .85; font-variant-numeric: tabular-nums; }
.sub-bar { width: 96px; height: 5px; border-radius: 999px; background: var(--line); overflow: hidden; flex: none; }
.sub-bar span { display: block; height: 100%; border-radius: 999px; background: var(--brand); transition: width .22s ease; }
.sub-bar.all-done span { background: #16a34a; }
html[data-theme="dark"] .sub-bar.all-done span { background: #22c55e; }

.sublist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.sub {
  display: flex; align-items: center; gap: 8px; padding: 2px 6px; border-radius: 8px;
  transition: background-color .12s ease;
}
.sub:hover { background: rgba(255, 255, 255, .65); }
html[data-theme="dark"] .sub:hover { background: rgba(255, 255, 255, .04); }
.sub-check {
  -webkit-appearance: none; appearance: none;
  width: 17px; height: 17px; margin: 0; padding: 0; border-radius: 50%; flex: none;
  border: 1.6px solid rgba(100, 116, 139, .5); background-color: transparent; cursor: pointer;
  transition: border-color .14s ease, background-color .14s ease, transform .12s ease;
}
.sub-check:hover:not(:disabled) { border-color: var(--brand); background-color: rgba(7, 128, 191, .12); transform: scale(1.06); }
.sub-check:checked {
  border-color: #16a34a; background-color: #16a34a;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23ffffff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.2 8.5l3.1 3.1L12.8 4.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center; background-size: 11px 11px;
}
.sub-check:disabled { opacity: .45; cursor: default; }
html[data-theme="dark"] .sub-check { border-color: rgba(148, 163, 184, .48); }
html[data-theme="dark"] .sub-check:hover:not(:disabled) { border-color: var(--accent); background-color: rgba(94, 194, 240, .16); }
html[data-theme="dark"] .sub-check:checked { border-color: #22c55e; background-color: #22c55e; }

.sub-form { display: flex; align-items: center; gap: 6px; flex: 1 1 180px; min-width: 0; margin: 0; }
.sub-title {
  margin: 0; padding: 5px 7px; flex: 1 1 auto; min-width: 0; font-size: .9rem;
  background: transparent; border: 1px solid transparent; border-radius: 6px;
}
.sub-title:focus { background: var(--input-bg); border-color: var(--line-strong); outline: none; }
.sub.done .sub-title { text-decoration: line-through; color: var(--muted); }

.sub-date {
  position: relative; display: inline-flex; align-items: center; margin: 0; padding: 0; flex: none;
  border: 0; border-radius: 6px; background: none; color: inherit; cursor: pointer;
}
.sub-date:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.sub-date-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 6px;
  background: rgba(7, 128, 191, .10); color: var(--accent); font-size: .74rem; font-weight: 500;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
html[data-theme="dark"] .sub-date-chip { background: rgba(94, 194, 240, .15); }
.sub-date-btn {
  width: 24px; height: 24px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted); transition: opacity .13s ease, color .13s ease, background-color .13s ease;
}
.sub-date:hover .sub-date-btn { color: var(--accent); background: var(--chip-bg); }

.sub-del {
  border: 0; background: none; color: var(--muted); font-size: 1.15rem; line-height: 1;
  padding: 3px 6px; border-radius: 6px; flex: none; transition: opacity .13s ease, color .13s ease, background-color .13s ease;
}
.sub-del:hover { color: var(--danger); background: var(--chip-bg); }
@media (hover: hover) {
  .sub-date:not(.has-date) .sub-date-btn, .sub-del { opacity: 0; }
  .sub:hover .sub-date-btn, .sub:focus-within .sub-date-btn,
  .sub:hover .sub-del, .sub:focus-within .sub-del { opacity: 1; }
}
@media (hover: none) {
  .sub-date:not(.has-date) .sub-date-btn, .sub-del { opacity: .55; }
}

.sub-add {
  display: flex; align-items: center; gap: 8px; margin: 3px 0 0; padding: 2px 6px;
  border-radius: 8px; background: var(--input-bg); border: 1px dashed var(--line-strong);
}
.sub-add:focus-within { border-color: var(--brand); border-style: solid; }
.sub-ghost-ring {
  width: 17px; height: 17px; border-radius: 50%; flex: none;
  border: 1.5px dashed rgba(100, 116, 139, .5);
}
html[data-theme="dark"] .sub-ghost-ring { border-color: rgba(148, 163, 184, .45); }
.sub-add input {
  margin: 0; padding: 5px 6px; flex: 1; min-width: 0; border: 0; background: transparent;
  font-size: .88rem; outline: none;
}
.sub-add input:focus { outline: none; }

/* ===== Вкладки, «Сделано», архив ===== */
.tabs {
  display: inline-flex; gap: 2px; flex-wrap: wrap; margin: 0 0 12px; padding: 3px;
  border-radius: 10px; border: 1px solid var(--glass-border); background: rgba(255, 255, 255, .52);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.tabs a {
  padding: 5px 12px; border-radius: 7px; border: 0; background: transparent;
  color: var(--muted); text-decoration: none; font-size: .86rem; font-weight: 500;
  transition: color .14s ease, background-color .14s ease, box-shadow .14s ease;
}
.tabs a:hover { color: var(--text); }
.tabs a.active {
  background: #ffffff; color: var(--text); font-weight: 600;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .10), 0 0 0 1px rgba(15, 23, 42, .04);
}
html[data-theme="dark"] .tabs a.active {
  background: rgba(30, 41, 59, .95); color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .07);
}
.tab-star { color: var(--star); }
.flash { min-height: 0; margin: -8px 0 10px; font-size: .9rem; color: var(--muted); }
.flash.show { animation: flash-out 6s forwards; padding: 8px 12px; border-radius: 8px; background: var(--chip-bg); border: 1px solid var(--glass-border); }
@keyframes flash-out { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
.done-block { margin-top: 18px; }
/* Кнопки-«полосы» «Сделано» и «Архив»: стекло, иконка, бейдж-счётчик, шеврон */
.fold-bar {
  display: flex; align-items: center; gap: 10px; width: 100%; box-sizing: border-box;
  padding: 11px 14px; border-radius: 12px; cursor: pointer; list-style: none;
  color: var(--text); font-weight: 600; font-size: .92rem; text-decoration: none; user-select: none;
  border: 1px solid transparent;
  background: var(--g-fill) padding-box, var(--g-rim) border-box;
  -webkit-backdrop-filter: var(--g-blur); backdrop-filter: var(--g-blur);
  box-shadow: var(--g-depth-sm);
  transition: transform .12s, box-shadow .12s, background .12s;
}
.fold-bar::-webkit-details-marker { display: none; }
.fold-bar:hover { transform: translateY(-1px); box-shadow: var(--g-depth); }
.fold-bar:active { transform: translateY(0); }
.fold-bar:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.fold-ico { flex: none; color: var(--brand); }
.fold-title { flex: 1 1 auto; min-width: 0; }
.fold-count {
  flex: none; min-width: 26px; padding: 1px 9px; border-radius: 999px; text-align: center;
  font-size: .8rem; font-weight: 700; font-variant-numeric: tabular-nums;
  background: rgba(7, 128, 191, .12); color: var(--accent);
}
html[data-theme="dark"] .fold-count { background: rgba(56, 189, 248, .18); color: #7dd3fc; }
.fold-chev { flex: none; color: var(--muted); transition: transform .2s; }
.done-block[open] > .fold-bar .fold-chev { transform: rotate(180deg); }
.fold-link { margin-top: 10px; }
.fold-link:hover .fold-chev { transform: translateX(3px); }
.done-block .task-list { margin-top: 6px; }
.done-row .task-title { color: var(--muted); text-decoration: line-through; }
.done-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.reopen-btn { color: var(--accent); }
.reopen-btn:hover, .reopen-btn:focus-visible { color: var(--accent); background: rgba(7, 128, 191, .12); }
.archive-head { flex-wrap: nowrap; padding-bottom: 4px; }
.archive-sub { margin: 0 0 14px 48px; font-size: .88rem; }
.round-back {
  flex: none; width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent); text-decoration: none;
  border: 1px solid transparent;
  background: var(--g-fill) padding-box, var(--g-rim) border-box;
  box-shadow: var(--g-depth-sm); transition: transform .12s, box-shadow .12s;
}
.round-back:hover { transform: translateX(-2px); box-shadow: var(--g-depth); }
.round-back:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.archive-link { margin: 12px 0 0; font-size: .88rem; }
.archive-link a, .back-link { color: var(--accent); }
.back-link { margin-left: auto; font-size: .9rem; }

/* ===== Перетаскивание ===== */
.tabs-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.tabs-row .tabs { margin: 0; }
.sort-btn {
  display: inline-flex; align-items: center; gap: 5px; font-size: .83rem; padding: 5px 9px;
  border-radius: 8px; color: var(--muted); white-space: nowrap; transition: color .14s ease, background-color .14s ease;
}
.sort-btn:hover { color: var(--accent); background: rgba(7, 128, 191, .08); }
html[data-theme="dark"] .sort-btn:hover { background: rgba(94, 194, 240, .12); }
.drag-handle {
  flex: none; width: 18px; align-self: stretch; display: flex; align-items: center; justify-content: center;
  color: var(--muted); cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none;
  letter-spacing: -2px; font-size: .9rem; border-radius: 5px; transition: opacity .14s ease, color .14s ease;
}
@media (hover: hover) {
  .drag-handle { opacity: 0; }
  .task-head:hover .drag-handle, .drag-handle:focus-visible { opacity: .6; }
}
@media (hover: none) { .drag-handle { opacity: .45; } }
.drag-handle:hover { opacity: 1 !important; color: var(--text); background: var(--chip-bg); }
.task.drag-ghost { opacity: .35; }
.task.drag-chosen { cursor: grabbing; }
.sortable-fallback { opacity: .95; background: var(--input-bg) !important; box-shadow: var(--menu-shadow); z-index: 50; }

/* ===== История изменений ===== */
.history { border-top: 1px dashed var(--line); margin-top: 4px; padding: 6px 0 4px; }
.history summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: .9rem; padding: 6px 0; }
.history-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: .85rem; }
.history-list li { display: flex; flex-wrap: wrap; gap: 2px 8px; }
.h-when { color: var(--muted); white-space: nowrap; }
.h-who { font-weight: 600; }
.h-what { overflow-wrap: anywhere; }

/* ===== Режимы админа ===== */
.actbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 14px; padding: 6px 12px;
  background: #fef3c7; color: #78350f; font-size: .88rem; border-bottom: 1px solid #f59e0b;
}
.actbar.rw { background: #fee2e2; color: #7f1d1d; border-bottom-color: #ef4444; }
.actbar form { margin: 0; }
.actbar button { border: 1px solid currentColor; border-radius: 6px; background: none; color: inherit; padding: 3px 10px; }
html[data-theme="dark"] .actbar { background: #422006; color: #fde68a; border-bottom-color: #b45309; }
html[data-theme="dark"] .actbar.rw { background: #450a0a; color: #fecaca; border-bottom-color: #b91c1c; }

/* ===== Настройки ===== */
.sect { font-size: 1rem; margin: 20px 0 8px; color: var(--muted); font-weight: 600; }
.notice { padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; background: var(--glass-bg); border: 1px solid var(--brand); }
.notice.error { border-color: var(--danger); color: var(--danger); }
.pin { font-size: 1.25rem; letter-spacing: .12em; padding: 2px 8px; background: var(--chip-bg); border-radius: 6px; }
.user-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.user-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 14px; background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 10px; }
.user-row.off { opacity: .6; }
.user-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.user-edit input, .user-edit select { width: auto; margin: 0; padding: 8px 10px; }
.user-edit select { padding-right: 32px; background-position: right 9px center; }
.user-edit label.check { display: flex; align-items: center; gap: 6px; margin: 0; }
.user-edit label.check input { width: auto; }
.user-actions { display: flex; gap: 12px; }
.user-actions form { margin: 0; }

/* ===== Отдел и отчёт ===== */
.table-wrap { overflow-x: auto; background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 10px; }
.dept-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.dept-table th { text-align: left; padding: 8px 12px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.dept-table td { padding: 7px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.dept-table .t-title { min-width: 220px; overflow-wrap: anywhere; }
.dept-table .subrow td { color: var(--muted); font-size: .85rem; }
.dept-table.summary td:not(:first-child), .dept-table.summary th:not(:first-child) { text-align: right; }
.dept-table .total td { font-weight: 700; background: var(--chip-bg); }
.dept-table td.overdue { color: var(--danger); font-weight: 600; }
.dept-filters { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 0 0 12px; }
.dept-filters select, .dept-filters input { width: auto; margin: 0; padding: 8px 10px; }
.dept-filters select { padding-right: 32px; background-position: right 9px center; }
.dept-filters label { display: flex; align-items: center; gap: 6px; margin: 0; }
.dept-filters .btn-link { margin: 0; }

/* ===== Второй шаг ===== */
.steps { padding-left: 1.2rem; color: var(--muted); font-size: .9rem; }
.qr { display: flex; justify-content: center; margin: 12px 0; }
.qr svg { max-width: 220px; height: auto; border-radius: 8px; }
.codes { list-style: none; padding: 0; margin: 12px 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 12px; }
.codes code { font-size: 1.05rem; letter-spacing: .04em; }
.sec-card { padding: 14px 16px; background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 10px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 0; }
.inline-form input { width: auto; margin: 0; padding: 8px; }

.bulk { display: flex; gap: 16px; margin: 0 0 8px; }
.bulk form { margin: 0; }

.alt-login { text-align: center; margin-top: 8px; }
button.secondary { width: 100%; padding: 12px; border: 1px solid var(--btn); border-radius: 8px; background: none; color: var(--accent); }
button.secondary:hover { background: var(--chip-bg); }
.pk-list { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pk-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.pk-list form { margin: 0; }
.tg-num { font-size: 2rem; letter-spacing: .1em; color: var(--accent); }
#tg-wait { margin-top: 10px; }
.notif { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.notif label.check { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--text); }
.notif label.check input { width: auto; margin: 0; }
.b-actions { display: flex; gap: 14px; align-items: center; white-space: nowrap; }
.b-actions form { margin: 0; }
.auto-form { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: flex-end; margin: 8px 0; }
.auto-form label { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.auto-form label.check { flex-direction: row; align-items: center; color: var(--text); }
.auto-form input, .auto-form select { width: auto; margin: 0; padding: 8px 10px; }
.auto-form select { padding-right: 32px; background-position: right 9px center; }
.auto-form label.check input { width: auto; }

.hint { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.hint[hidden] { display: none; }
.hint .btn-link { margin: 0; padding: 6px 14px; }

/* ===== Подсказка passkey: плавающая стеклянная карточка ===== */
.pk-toast {
  position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 25;
  width: 300px; display: flex; align-items: flex-start; gap: 12px; padding: 14px 12px 14px 14px;
  border-radius: 18px; color: var(--text);
  background: rgba(255, 255, 255, .34); border: 1px solid rgba(255, 255, 255, .7);
  -webkit-backdrop-filter: blur(24px) saturate(170%); backdrop-filter: blur(24px) saturate(170%);
  box-shadow: 0 18px 40px -14px rgba(37, 65, 165, .35), inset 0 1px 0 rgba(255, 255, 255, .9);
  animation: pk-in .32s cubic-bezier(.2, .8, .2, 1) both;
}
.pk-toast[hidden] { display: none; }
.pk-toast.is-leaving { animation: pk-out .22s ease-in both; }
@keyframes pk-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes pk-out { to { opacity: 0; transform: translateY(8px) scale(.98); } }
.pk-toast-ic {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: rgba(7, 128, 191, .12); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(7, 128, 191, .14);
}
.pk-toast-body { flex: 1; min-width: 0; }
.pk-toast-title { font-weight: 600; font-size: .92rem; line-height: 1.3; }
.pk-toast-text { font-size: .8rem; color: var(--muted); margin: 2px 0 10px; line-height: 1.35; }
.pk-toast-btn {
  display: inline-block; padding: 5px 14px; border-radius: 999px; font-size: .82rem; font-weight: 600; text-decoration: none;
  color: var(--accent); background: rgba(255, 255, 255, .5); border: 1px solid rgba(7, 128, 191, .32);
  transition: background .15s, border-color .15s;
}
.pk-toast-btn:hover { background: rgba(255, 255, 255, .8); border-color: var(--brand); }
.pk-toast-x {
  flex: none; width: 28px; height: 28px; margin: -4px -2px 0 0; padding: 0; border: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; background: transparent; color: var(--muted); cursor: pointer;
  transition: background .15s, color .15s;
}
.pk-toast-x:hover, .pk-toast-x:focus-visible { background: rgba(15, 23, 42, .07); color: var(--text); outline: none; }
html[data-theme="dark"] .pk-toast-ic { background: rgba(94, 194, 240, .14); box-shadow: inset 0 0 0 1px rgba(94, 194, 240, .2); }
html[data-theme="dark"] .pk-toast-btn { background: rgba(94, 194, 240, .08); border-color: rgba(94, 194, 240, .35); }
html[data-theme="dark"] .pk-toast-btn:hover { background: rgba(94, 194, 240, .16); border-color: var(--accent); }
html[data-theme="dark"] .pk-toast-x:hover, html[data-theme="dark"] .pk-toast-x:focus-visible { background: rgba(255, 255, 255, .08); }
@media (max-width: 600px) {
  .pk-toast { left: 12px; right: 12px; width: auto; bottom: calc(12px + env(safe-area-inset-bottom)); align-items: center; padding: 10px 8px 10px 10px; gap: 10px; }
  .pk-toast-body { display: flex; align-items: center; gap: 10px; }
  .pk-toast-title { flex: 1; }
  .pk-toast-text { display: none; }
  .pk-toast-btn { white-space: nowrap; }
  .pk-toast-x { margin: 0; }
}
/* пока карточка видна, даём списку прокрутиться из-под неё */
body:has(.pk-toast:not([hidden])) .container { padding-bottom: 110px; }
@media (prefers-reduced-motion: reduce) { .pk-toast, .pk-toast.is-leaving { animation: none; } }
@media print { .pk-toast { display: none !important; } }

.inline-form input { flex: 1 1 150px; min-width: 0; }

/* Таблицы «Отдела» и отчёта на телефоне: заголовки переносятся, отступы меньше (сводка помещается без прокрутки) */
@media (max-width: 600px) {
  .dept-table th { white-space: normal; font-size: .74rem; padding: 6px; vertical-align: bottom; }
  .dept-table td { padding: 6px; font-size: .86rem; }
  .dept-table.summary td:first-child { white-space: normal; }
}
@media (max-width: 600px) {
  .dept-table.summary th, .dept-table.summary td { padding: 6px 4px; }
  .dept-table.summary th { font-size: .68rem; }
  .dept-table.summary td { font-size: .82rem; }
  .dept-table.summary td:first-child, .dept-table.summary th:first-child { max-width: 96px; padding-left: 8px; }
}



/* ===== Объёмное стекло: одно для всех стеклянных элементов =====
   Вместо белой рамки кант-градиент (светится сверху, к низу уходит в тень) через border-box,
   заливка светлее сверху, внутренняя тень по нижнему краю и двойная внешняя тень. Цвета в переменных --g-* (свои у тёмной темы). */
.topbar, .pk-toast, .card.login, .tabs, .chip {
  border: 1px solid transparent;
  background: var(--g-fill) padding-box, var(--g-rim) border-box;
  -webkit-backdrop-filter: var(--g-blur); backdrop-filter: var(--g-blur);
  box-shadow: var(--g-depth);
}
.card, .things-sheet, .done-sheet, .table-wrap, .sec-card, .user-row, .quick-add {
  border: 1px solid transparent;
  background: var(--g-fill-dense) padding-box, var(--g-rim) border-box;
  -webkit-backdrop-filter: var(--g-blur); backdrop-filter: var(--g-blur);
  box-shadow: var(--g-depth);
}
.tabs, .chip, .quick-add, .user-row, .sec-card { box-shadow: var(--g-depth-sm); }
.quick-add:focus-within, .quick-add.menu-open, .quick-add.has-opts, .quick-add.has-text {
  background: var(--solid); border-color: var(--brand); border-radius: 12px 12px 0 0;
  box-shadow: 0 0 0 3px rgba(7, 128, 191, .15), var(--g-depth-sm);
}
@media (max-width: 600px) {
  /* карточка задачи на весь экран: без стекла, иначе фон просвечивает */
  .things-sheet:has(.task.expanded) { -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* ===== Флаг «Требуется внимание» и значок примечания ===== */
.task-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 auto; }
.task-tline { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.task-tline .task-title { min-width: 0; }
.note-ico { flex: none; color: var(--muted); opacity: .75; display: inline-flex; transform: translateY(2px); }
.flag-ico { flex: none; color: var(--warn); display: inline-flex; align-self: flex-start; margin-top: 3px; }
.task-reason {
  font-size: .8rem; color: var(--warn); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.things-sheet > .task:has(> .task-head .flag-ico):not(.expanded) { background: rgba(234, 88, 12, .06); }
html[data-theme="dark"] .things-sheet > .task:has(> .task-head .flag-ico):not(.expanded) { background: rgba(251, 146, 60, .08); }
.i-flag { flex: none; }

.status-sep { width: 100%; margin: 2px 0; border: 0; border-top: 1px solid var(--line); }
.status-menu .flag-item {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 0; border-radius: 999px;
  background: rgba(234, 88, 12, .10); color: var(--warn); font-size: .8rem; font-weight: 600; white-space: nowrap; text-align: left;
}
.status-menu .flag-item:hover { background: rgba(234, 88, 12, .17); }
.flag-form { display: flex; flex-direction: column; gap: 6px; width: min(280px, 78vw); margin: 0; }
.flag-form label { margin: 0; font-size: .78rem; color: var(--muted); }
.flag-form input { margin: 0; padding: 7px 10px; font-size: .88rem; }
.flag-submit {
  align-self: flex-start; padding: 6px 12px; border: 0; border-radius: 8px;
  background: var(--warn); color: #fff; font-size: .84rem; font-weight: 600;
}
html[data-theme="dark"] .flag-submit { color: #1b1206; }

/* «Требуется внимание»: полоса слева и лёгкая подложка, без рамки; действия маленькими кнопками */
.attn-box, .attn-panel { position: relative; margin: 0 0 10px; padding: 9px 12px 10px 15px; border-radius: 10px; background: var(--attn-bg); }
.attn-box::before, .attn-panel::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--warn); }
.attn-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.attn-title { display: inline-flex; align-items: center; gap: 6px; color: var(--warn); font-weight: 700; font-size: .82rem; }
.attn-since { color: var(--muted); font-size: .76rem; text-align: right; }
.attn-reason { margin: 4px 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .92rem; }
.attn-form { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 0; }
.attn-form textarea, .attn-form input {
  margin: 0; padding: 7px 10px; font-size: .9rem; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--input-bg);
}
.attn-form textarea:focus, .attn-form input:focus { outline: 2px solid rgba(234, 88, 12, .3); border-color: var(--warn); }
.attn-panel.attn-ask { margin: 0 0 10px; }
.attn-panel.attn-ask .attn-head { margin: 0; }
.attn-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
body[data-readonly] .attn-ask, body[data-readonly] .attn-box .attn-actions, body[data-readonly] .status-menu .status-sep,
body[data-readonly] .status-menu .flag-item, body[data-readonly] .sub-add-row, body[data-readonly] .card-del-row { display: none; }
.dept-reason { margin-top: 2px; font-size: .8rem; color: var(--warn); white-space: pre-wrap; }
.dept-table .flag-ico { margin: 0; vertical-align: -2px; }
.dept-table td.attn-num { color: var(--warn); font-weight: 700; }
.sect-attn { display: flex; align-items: center; gap: 6px; color: var(--warn); }

/* ---- Календарь (datepicker.js): всплывающее окно у кнопок [data-dp] и встроенный в меню «Срок» ---- */
.dp-pop {
  position: fixed; z-index: 60; display: flex; gap: 10px; padding: 8px;
  background: var(--solid); border: 1px solid var(--glass-border); border-radius: 14px; box-shadow: var(--menu-shadow);
}
.dp-pop[hidden] { display: none; }
#due-menu { flex-direction: row; gap: 10px; padding: 8px; }
.dp-side { display: flex; flex-direction: column; gap: 2px; min-width: 176px; padding-right: 8px; border-right: 1px solid var(--line); }
.dp-side button {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0; padding: 8px 10px;
  border: 0; border-radius: 8px; background: transparent; color: var(--text); font-size: .88rem; text-align: left; white-space: nowrap;
}
.dp-side button:hover, .dp-side button:focus-visible { background: rgba(7, 128, 191, .10); outline: none; }
.dp-side small { color: var(--muted); font-size: .76rem; }
.dp-side .dp-clear { margin-top: auto; color: var(--muted); }
.dp-side .dp-clear:hover { color: var(--danger); }

.dp { width: 252px; user-select: none; -webkit-user-select: none; }
.dp .dp-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 4px; }
.dp .dp-title {
  display: inline-flex; margin: 0; padding: 6px 10px; border: 0; border-radius: 8px; background: transparent;
  color: var(--text); font-size: .92rem; font-weight: 600; justify-content: center;
}
.dp .dp-nav {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; margin: 0; padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted);
}
.dp .dp-title:hover, .dp .dp-nav:hover, .dp .dp-title:focus-visible, .dp .dp-nav:focus-visible {
  background: rgba(7, 128, 191, .10); color: var(--accent); outline: none;
}
.dp-row { display: grid; grid-template-columns: repeat(7, 1fr); margin-top: 2px; }
.dp-wd { padding: 3px 0 4px; text-align: center; font-size: .7rem; font-weight: 600; color: var(--muted); }
.dp-wd.is-we { opacity: .65; }
.dp .dp-day {
  display: flex; align-items: center; justify-content: center; height: 34px; margin: 0; padding: 0;
  border: 0; border-radius: 9px; background: transparent; color: var(--text);
  font-size: .86rem; font-weight: 500; font-variant-numeric: tabular-nums; text-align: center; transition: background-color .1s ease;
}
.dp .dp-day.is-we { color: var(--muted); }
.dp .dp-day.is-out { opacity: .42; }
.dp .dp-day:hover:not(:disabled), .dp .dp-day:focus-visible { background: rgba(7, 128, 191, .10); outline: none; }
.dp .dp-day:focus-visible { box-shadow: inset 0 0 0 2px var(--brand); }
.dp .dp-day.is-today { box-shadow: inset 0 0 0 1.5px var(--brand); color: var(--accent); font-weight: 700; }
.dp .dp-day:disabled { opacity: .28; cursor: default; }
/* диапазон и неделя: сплошная полоса, края залиты */
.dp .dp-day.is-in { background: rgba(7, 128, 191, .13); border-radius: 0; }
.dp .dp-day.is-in.is-start { border-radius: 9px 0 0 9px; }
.dp .dp-day.is-in.is-end { border-radius: 0 9px 9px 0; }
.dp .dp-day.is-in.is-start.is-end { border-radius: 9px; }
.dp .dp-day.is-sel, .dp .dp-day.is-sel:hover { background: var(--btn); color: #fff; opacity: 1; }
.dp .dp-day.is-sel.is-today { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .7); }
.dp.is-week .dp-row:not(.dp-wdrow):hover .dp-day:not(.is-sel) { background: rgba(7, 128, 191, .10); border-radius: 0; }
.dp.is-week .dp-row:not(.dp-wdrow):hover .dp-day:first-child { border-radius: 9px 0 0 9px; }
.dp.is-week .dp-row:not(.dp-wdrow):hover .dp-day:last-child { border-radius: 0 9px 9px 0; }

.dp-months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding-top: 4px; }
.dp .dp-month {
  display: flex; align-items: center; justify-content: center; height: 48px; margin: 0; padding: 0;
  border: 0; border-radius: 10px; background: transparent; color: var(--text); font-size: .9rem;
}
.dp .dp-month:hover, .dp .dp-month:focus-visible { background: rgba(7, 128, 191, .10); outline: none; }
.dp .dp-month.is-today { box-shadow: inset 0 0 0 1.5px var(--brand); color: var(--accent); font-weight: 700; }
.dp .dp-month.is-sel { background: var(--btn); color: #fff; }

html[data-theme="dark"] .dp-side button:hover, html[data-theme="dark"] .dp-side button:focus-visible,
html[data-theme="dark"] .dp .dp-title:hover, html[data-theme="dark"] .dp .dp-nav:hover,
html[data-theme="dark"] .dp .dp-day:hover:not(:disabled), html[data-theme="dark"] .dp .dp-day:focus-visible,
html[data-theme="dark"] .dp .dp-month:hover,
html[data-theme="dark"] .dp.is-week .dp-row:not(.dp-wdrow):hover .dp-day:not(.is-sel) { background: rgba(94, 194, 240, .12); }
html[data-theme="dark"] .dp .dp-day.is-in { background: rgba(94, 194, 240, .17); }
html[data-theme="dark"] .dp .dp-day.is-sel, html[data-theme="dark"] .dp .dp-day.is-sel:hover:not(:disabled) { background: var(--btn); color: #fff; }

@media (max-width: 600px) {   /* на телефоне окно выезжает снизу, дни крупнее, быстрые варианты чипами */
  .dp-pop { left: 8px !important; right: 8px; top: auto !important; bottom: calc(8px + env(safe-area-inset-bottom)); flex-direction: column; padding: 12px; border-radius: 18px; }
  #due-menu { flex-direction: column; }
  .dp { width: 100%; }
  .dp .dp-day { height: 42px; font-size: 1rem; }
  .dp .dp-nav { width: 40px; height: 40px; }
  .dp-side { flex-direction: row; flex-wrap: wrap; gap: 6px; min-width: 0; padding: 0 0 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .dp-side button, .pick-menu .dp-side button { padding: 8px 12px; font-size: .9rem; border: 1px solid var(--line); background: var(--chip-bg); border-radius: 999px; }
  .dp-side small { display: none; }
  .dp-side .dp-clear { margin-top: 0; }
}

/* Кнопки-поля с календарём на страницах «Отдел» и «Отчёт» */
.dp-field {
  display: inline-flex; align-items: center; gap: 7px; margin: 0; padding: 8px 12px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--input-bg); color: var(--muted); white-space: nowrap;
}
.dp-field.is-set { color: var(--text); }
.dp-field:hover:not(:disabled), .dp-field[aria-expanded="true"] { border-color: var(--brand); }
.dp-field:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.dp-field svg { color: var(--accent); flex: none; }
.wk-step { display: inline-flex; align-items: center; gap: 4px; }
.wk-nav {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px;
  color: var(--muted); text-decoration: none;
}
.wk-nav:hover { color: var(--accent); background: rgba(7, 128, 191, .10); }

/* ===== Страница «Безопасность»: карточки с иконкой, статусом и кнопками ===== */
.sec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 14px; align-items: start; }
.sec-block { padding: 16px 18px; border-radius: 14px; }
.sec-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sec-title { margin: 0; flex: 1 1 auto; font-size: 1.02rem; font-weight: 700; color: var(--text); }
.sec-ico {
  flex: none; width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent); background: rgba(7, 128, 191, .12);
}
.sec-desc { margin: 0 0 10px; font-size: .92rem; }
.sec-block .muted { font-size: .88rem; }
.sec-actions { display: flex; gap: 8px; margin: 10px 0 0; }
.sec-block .notif { margin-top: 4px; }
.st-badge {
  flex: none; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700;
  background: var(--soft); color: var(--muted);
}
.st-badge.on { background: rgba(47, 133, 90, .15); color: var(--ok); }
html[data-theme="dark"] .st-badge.on { background: rgba(34, 197, 94, .2); color: #4ade80; }
.pk-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pk-list li { padding: 8px 12px; border-radius: 10px; background: var(--soft); }
.btn-main, .btn-soft {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; margin: 0; padding: 9px 16px;
  border: 0; border-radius: 10px; font-weight: 600; font-size: .9rem; text-decoration: none; cursor: pointer;
  transition: filter .12s, background .12s, transform .12s;
}
.btn-main { background: var(--btn); color: #fff; box-shadow: 0 6px 14px -8px rgba(6, 106, 158, .9); }
.btn-main:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-soft { background: rgba(7, 128, 191, .12); color: var(--accent); }
.btn-soft:hover { background: rgba(7, 128, 191, .2); }
.btn-soft.btn-del { background: rgba(220, 38, 38, .10); color: var(--danger); }
.btn-soft.btn-del:hover { background: rgba(220, 38, 38, .18); }
html[data-theme="dark"] .btn-soft { color: #7dd3fc; background: rgba(56, 189, 248, .16); }
html[data-theme="dark"] .btn-soft.btn-del { color: #f87171; background: rgba(248, 113, 113, .15); }
.btn-main:focus-visible, .btn-soft:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ===== Общие доработки страниц настроек ===== */
.btn-sm { padding: 5px 12px; font-size: .84rem; border-radius: 8px; }
.btn-main.btn-danger { background: var(--danger); box-shadow: 0 6px 14px -8px rgba(220, 38, 38, .9); }
.sec-card + .sec-card, .sec-card + .sect { margin-top: 14px; }
.sec-card + .sec-card.sec-block { margin-top: 14px; }
.sect { margin-top: 24px; }
.default-pin { margin-top: 0; }
.bulk.sec-actions { margin: 10px 0 0; }
.user-row { border-radius: 14px; padding: 12px 16px; }
.user-edit input, .user-edit select { border-radius: 10px; }
.user-actions { flex-wrap: wrap; gap: 8px; }
.user-actions .inline-form { margin: 0; flex-wrap: nowrap; }
.user-actions .inline-form input { width: 80px; flex: none; }
.b-actions { gap: 8px; }
.sec-block form + p.muted, .sec-block p + form { margin-top: 8px; }
.auto-form input, .auto-form select, .inline-form input { border-radius: 10px; }

/* ===== «Отдел» и «Отчёт за неделю»: фильтры-панель, аккуратные таблицы ===== */
.sect { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; font-size: 1.02rem; }
.sect.sect-attn { color: var(--warn); }
.sect .fold-count { font-size: .76rem; }
.table-wrap { border-radius: 14px; }
.dept-table th {
  padding: 10px 12px; font-size: .74rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  background: var(--soft); border-bottom: 1px solid var(--line);
}
.dept-table tbody tr:last-child td { border-bottom: 0; }
.dept-table tbody tr:not(.total):hover td { background: rgba(7, 128, 191, .06); }
.dept-table td a { color: var(--accent); font-weight: 600; text-decoration: none; }
.dept-table td a:hover { text-decoration: underline; }
.dept-table .total td { background: rgba(7, 128, 191, .09); border-top: 1px solid var(--line-strong); }
.dept-table.summary td:not(:first-child) { font-variant-numeric: tabular-nums; }
.dept-filters {
  padding: 10px 12px; border-radius: 14px; margin: 0 0 14px;
  border: 1px solid transparent; background: var(--g-fill) padding-box, var(--g-rim) border-box;
  -webkit-backdrop-filter: var(--g-blur); backdrop-filter: var(--g-blur); box-shadow: var(--g-depth-sm);
}
.dept-filters select, .dept-filters input { border-radius: 10px; }
.dept-search { min-width: 200px; flex: 1 1 200px; }
.rep-export { margin: 0; text-decoration: none; }
.dept-filters .rep-export:first-of-type { margin-left: auto; }

/* ===== Редизайн страницы «Безопасность»: одна колонка, свёрнутые формы, тумблеры ===== */
.sec-page { max-width: 720px; margin: 0 auto; padding-bottom: 28px; }
.sec-summary {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 16px;
}
.sec-sum-ico {
  flex: none; width: 40px; height: 40px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(7, 128, 191, .12); color: var(--accent);
}
.sec-summary.is-strong .sec-sum-ico { background: rgba(47, 133, 90, .14); color: var(--ok); }
.sec-summary.is-basic .sec-sum-ico { background: rgba(194, 101, 10, .13); color: var(--warn); }
html[data-theme="dark"] .sec-summary.is-strong .sec-sum-ico { background: rgba(34, 197, 94, .18); color: #4ade80; }
html[data-theme="dark"] .sec-summary.is-basic .sec-sum-ico { background: rgba(251, 146, 60, .18); color: #fb923c; }
.sec-sum-text { min-width: 0; flex: 1; }
.sec-sum-title { font-weight: 700; font-size: .98rem; color: var(--text); line-height: 1.3; }
.sec-sum-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-top: 2px; font-size: .84rem; color: var(--muted);
}
.sec-dot { opacity: .5; }

.sec-group { margin-top: 22px; }
.sec-group-label {
  margin: 0 0 8px 6px; font-size: .74rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.sec-sheet { padding: 0; border-radius: 16px; overflow: hidden; }
.sec-row { padding: 16px 20px; }
.sec-row + .sec-row { border-top: 1px solid var(--line); }
.sec-row-head { display: flex; align-items: flex-start; gap: 14px; }
.sec-row-info { flex: 1 1 auto; min-width: 0; }
.sec-row-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.sec-row-title h3 { margin: 0; font-size: .98rem; font-weight: 700; color: var(--text); line-height: 1.3; }
.sec-row-desc { margin: 4px 0 0; font-size: .86rem; color: var(--muted); line-height: 1.42; }
.sec-row-act { flex: none; display: flex; align-items: center; gap: 6px; padding-top: 2px; }
.sec-row-act[hidden] { display: none; }
.sec-row-act form { margin: 0; }
.sec-row-body { margin: 12px 0 0 50px; }

.sec-pk-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sec-pk-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 12px; background: var(--soft);
}
.sec-pk-ico {
  flex: none; width: 30px; height: 30px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--input-bg); color: var(--muted);
}
.sec-pk-item .pk-info { flex: 1; font-size: .88rem; }
.sec-pk-item .pk-info .muted { font-size: .8rem; }
.sec-pk-item form { margin: 0; }
.sec-empty { margin: 0; font-size: .84rem; }

.sec-drawer {
  margin-top: 10px; padding: 12px 14px; border-radius: 12px;
  background: var(--soft); border: 1px solid var(--line);
}
.sec-drawer input {
  width: 100%; margin: 0; padding: 8px 11px; border-radius: 10px; font-size: .9rem;
}
.sec-drawer-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sec-drawer-row input { flex: 1 1 200px; min-width: 0; }
.sec-drawer-msg { display: block; margin-top: 6px; font-size: .82rem; }
.sec-drawer-msg:empty { display: none; }
.sec-pin-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sec-drawer-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

.btn-ghost, .btn-ghost-del {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; margin: 0;
  padding: 6px 12px; border: 0; border-radius: 8px; background: transparent;
  font-weight: 600; font-size: .84rem; cursor: pointer; text-decoration: none;
  transition: background .12s, color .12s;
}
.btn-ghost { color: var(--muted); }
.btn-ghost:hover { background: var(--soft-2); color: var(--text); }
.btn-ghost-del { color: var(--muted); }
.btn-ghost-del:hover { background: rgba(220, 38, 38, .12); color: var(--danger); }
html[data-theme="dark"] .btn-ghost-del:hover { background: rgba(248, 113, 113, .16); color: #f87171; }
.btn-ghost:focus-visible, .btn-ghost-del:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Уведомления Telegram: тумблеры с автосохранением */
.sec-notif-row { padding-top: 14px; padding-bottom: 14px; }
.sec-notif-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 0 0 10px 50px;
}
.sec-notif-title { font-size: .82rem; font-weight: 700; color: var(--muted); }
.sec-saved {
  font-size: .78rem; font-weight: 600; color: var(--ok);
  padding: 2px 8px; border-radius: 999px; background: rgba(47, 133, 90, .12);
}
html[data-theme="dark"] .sec-saved { background: rgba(34, 197, 94, .18); color: #4ade80; }
.sec-switches { margin-left: 50px; display: flex; flex-direction: column; gap: 2px; }
.sec-switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 9px 10px; margin: 0 -10px; border-radius: 10px; cursor: pointer;
  transition: background .12s, opacity .15s;
}
.sec-switch-row:hover { background: var(--soft); }
.sec-switch-row.is-sub { padding-left: 24px; }
.sec-switch-row.is-dim { opacity: .55; }
.sec-switch-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sec-switch-label { font-size: .9rem; font-weight: 500; color: var(--text); line-height: 1.35; }
.sec-switch-sub { font-size: .78rem; color: var(--muted); line-height: 1.35; }

.sec-switch { position: relative; flex: none; width: 42px; height: 24px; display: inline-block; }
.sec-switch input { position: absolute; opacity: 0; width: 0; height: 0; margin: 0; }
.sec-switch-track {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--line-strong); transition: background .18s ease;
}
.sec-switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .25);
  transition: transform .18s cubic-bezier(.2, .8, .2, 1);
}
.sec-switch input:checked + .sec-switch-track { background: var(--btn); }
.sec-switch input:checked + .sec-switch-track::after { transform: translateX(18px); }
.sec-switch input:focus-visible + .sec-switch-track { outline: 2px solid var(--brand); outline-offset: 2px; }

@media (max-width: 600px) {
  .sec-row { padding: 14px 16px; }
  .sec-row-head { flex-wrap: wrap; }
  .sec-row-act { width: 100%; padding-left: 50px; padding-top: 6px; }
  .sec-row-body, .sec-notif-head, .sec-switches { margin-left: 0; }
  .sec-switch-row.is-sub { padding-left: 16px; }
  .sec-pin-fields { grid-template-columns: 1fr; }
}

/* ===== Редизайн страницы «Настройки»: компактный список пользователей + аккордеон ===== */
.set-page { max-width: 820px; margin: 0 auto; padding-bottom: 28px; }
.set-nav-row {
  display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit;
  transition: background .12s;
}
.set-nav-row:hover { background: var(--soft); }
.set-nav-chev, .set-chev { flex: none; color: var(--muted); transition: transform .18s ease, color .12s; }
.set-nav-row:hover .set-nav-chev { color: var(--accent); transform: translateX(2px); }
.set-chev.is-open { transform: rotate(180deg); color: var(--accent); }
.set-toggle-head { align-items: center; cursor: pointer; user-select: none; }
.set-toggle-head:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 10px; }

.set-bulk-box { margin-top: 0; }
.set-bulk-note { margin: 8px 0 0; font-size: .82rem; line-height: 1.4; }
.set-bulk-2fa {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line);
}
.set-bulk-2fa form { margin: 0; }
.set-bulk-label { font-size: .84rem; font-weight: 600; color: var(--muted); margin-right: 4px; }

.set-group-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 0 8px 6px;
}
.set-group-left { display: flex; align-items: center; gap: 8px; }
.set-group-head .sec-group-label { margin: 0; }
.set-group-head .fold-count { font-size: .74rem; }

.set-add-card { padding: 16px 20px; border-radius: 16px; margin-bottom: 12px; }
.set-add-stack { display: flex; flex-direction: column; gap: 12px; }

.set-user { transition: background .15s, box-shadow .15s; }
.set-user + .set-user { border-top: 1px solid var(--line); }
.set-user.is-off .set-user-main { opacity: .62; }
.set-user.is-open {
  background: rgba(7, 128, 191, .045);
  box-shadow: inset 3px 0 0 var(--brand);
}
html[data-theme="dark"] .set-user.is-open { background: rgba(56, 189, 248, .065); }
.set-user-head {
  display: flex; align-items: center; gap: 12px; padding: 13px 20px;
  transition: background .12s;
}
.set-user:not(.is-open) > .set-user-head:hover { background: var(--soft); }
.set-user-main {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 12px;
  cursor: pointer; user-select: none;
}
.set-user-main:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 10px; }
.set-user-ident { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.set-user-top { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.set-user-name { font-weight: 700; font-size: .95rem; color: var(--text); line-height: 1.25; }
.set-role { font-size: .78rem; font-weight: 600; color: var(--muted); }
.set-role.admin { color: var(--accent); }
.set-role.manager { color: var(--warn); }
.set-user-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.set-user-badges .st-badge { font-size: .72rem; padding: 1px 8px; }
.st-badge.tg { background: rgba(7, 128, 191, .12); color: var(--accent); }
.st-badge.warn { background: rgba(194, 101, 10, .14); color: var(--warn); }
.st-badge.off { background: rgba(220, 38, 38, .12); color: var(--danger); }
html[data-theme="dark"] .st-badge.tg { background: rgba(56, 189, 248, .18); color: #7dd3fc; }
html[data-theme="dark"] .st-badge.warn { background: rgba(251, 146, 60, .18); color: #fb923c; }
html[data-theme="dark"] .st-badge.off { background: rgba(248, 113, 113, .18); color: #f87171; }

.set-user-act { flex: none; display: flex; align-items: center; gap: 6px; }
.set-user-act form { margin: 0; }
.set-edit-btn { gap: 4px; }

.set-user-body { padding: 4px 20px 18px 66px; }
.set-user-panel { display: flex; flex-direction: column; gap: 14px; }
.set-edit-top { display: grid; grid-template-columns: 1.25fr 1fr; gap: 12px; }
.set-field { display: flex; flex-direction: column; gap: 5px; margin: 0; }
.set-field > span {
  font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); padding-left: 2px;
}
.set-field input, .set-field select { margin: 0; padding: 9px 12px; border-radius: 10px; font-size: .9rem; width: 100%; }

.set-inwrap { position: relative; display: flex; align-items: center; }
.set-inwrap svg {
  position: absolute; left: 11px; color: var(--muted); pointer-events: none;
  transition: color .14s;
}
.set-inwrap input { padding-left: 34px; }
.set-inwrap:focus-within svg { color: var(--accent); }

.set-role-field { margin-top: 12px; }
.set-seg {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px;
  padding: 3px; border-radius: 12px; background: var(--soft-2);
  border: 1px solid var(--line);
}
.set-seg-opt { position: relative; margin: 0; cursor: pointer; }
.set-seg-opt input { position: absolute; opacity: 0; width: 0; height: 0; margin: 0; }
.set-seg-opt span {
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 7px 10px; border-radius: 9px; font-size: .84rem; font-weight: 600;
  color: var(--muted); transition: background .15s, color .15s, box-shadow .15s;
}
.set-seg-opt:hover span { color: var(--text); }
.set-seg-opt input:checked + span {
  background: var(--input-bg); color: var(--text);
  box-shadow: 0 2px 6px rgba(15, 23, 42, .10), inset 0 1px 0 rgba(255, 255, 255, .75);
}
html[data-theme="dark"] .set-seg-opt input:checked + span {
  background: rgba(255, 255, 255, .12); color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .14);
}
.set-seg-opt input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 1px; }

.set-edit-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 14px;
}
.set-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.set-toggle-pill {
  display: inline-flex; align-items: center; gap: 10px; margin: 0;
  padding: 6px 10px 6px 12px; border-radius: 10px; cursor: pointer;
  background: var(--input-bg); border: 1px solid var(--line);
  font-size: .84rem; font-weight: 600; color: var(--text);
  transition: border-color .14s, background .14s;
}
.set-toggle-pill:hover { border-color: var(--line-strong); }
.sec-switch.is-sm { width: 34px; height: 20px; }
.sec-switch.is-sm .sec-switch-track::after { top: 3px; left: 3px; width: 14px; height: 14px; }
.sec-switch.is-sm input:checked + .sec-switch-track::after { transform: translateX(14px); }

.set-reset-bar { padding-top: 14px; border-top: 1px solid var(--line); }
.set-reset-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.set-reset-left, .set-reset-right { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.set-reset-bar form { margin: 0; }
.set-chip-btn, .set-chip-del {
  display: inline-flex; align-items: center; gap: 6px; margin: 0;
  padding: 6px 11px; border-radius: 9px; font-size: .82rem; font-weight: 600;
  cursor: pointer; transition: background .14s, border-color .14s, color .14s, transform .12s;
}
.set-chip-btn {
  background: var(--input-bg); color: var(--text); border: 1px solid var(--line);
}
.set-chip-btn svg { color: var(--accent); }
.set-chip-btn:hover, .set-chip-btn.is-active {
  border-color: var(--brand); color: var(--accent); background: rgba(7, 128, 191, .08);
}
html[data-theme="dark"] .set-chip-btn:hover,
html[data-theme="dark"] .set-chip-btn.is-active { background: rgba(56, 189, 248, .14); color: #7dd3fc; }
.set-chip-del {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
}
.set-chip-del.is-muted { opacity: .62; }
.set-chip-del:hover {
  opacity: 1; color: var(--danger); border-color: rgba(220, 38, 38, .35);
  background: rgba(220, 38, 38, .08);
}
html[data-theme="dark"] .set-chip-del:hover {
  color: #f87171; border-color: rgba(248, 113, 113, .38); background: rgba(248, 113, 113, .14);
}
.set-chip-btn:focus-visible, .set-chip-del:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.set-defpin-form {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 10px !important; padding: 10px 12px; border-radius: 10px;
  background: var(--soft); border: 1px dashed var(--line-strong);
}
.set-defpin-form input { width: 210px; flex: 0 1 210px; margin: 0; padding: 7px 10px; border-radius: 9px; font-size: .88rem; }

@media (max-width: 680px) {
  .set-edit-top { grid-template-columns: 1fr; }
  .set-user-head { flex-wrap: wrap; padding: 12px 14px; }
  .set-user-act { width: 100%; justify-content: flex-end; padding-top: 4px; }
  .set-user-body { padding: 4px 14px 16px; }
  .set-seg-opt span { padding: 7px 6px; font-size: .78rem; }
}

/* ===== Редизайн страницы «Резервные копии» ===== */
.bak-summary { padding: 14px 18px; border-radius: 16px; }
.bak-summary.is-strong .sec-sum-ico { background: rgba(47, 133, 90, .14); color: var(--ok); }
.bak-summary.is-basic .sec-sum-ico { background: rgba(194, 101, 10, .13); color: var(--warn); }
.bak-summary.is-err .sec-sum-ico { background: rgba(220, 38, 38, .13); color: var(--danger); }
html[data-theme="dark"] .bak-summary.is-strong .sec-sum-ico { background: rgba(34, 197, 94, .18); color: #4ade80; }
html[data-theme="dark"] .bak-summary.is-basic .sec-sum-ico { background: rgba(251, 146, 60, .18); color: #fb923c; }
html[data-theme="dark"] .bak-summary.is-err .sec-sum-ico { background: rgba(248, 113, 113, .18); color: #f87171; }
.bak-sum-head { display: flex; align-items: center; gap: 14px; }
.bak-sum-act { flex: none; }
.bak-warn-text { color: var(--warn); font-weight: 600; }
.bak-create-drawer { margin-top: 12px; }

.bak-upload-fields { display: grid; grid-template-columns: 1.2fr 1fr; gap: 10px; }
.bak-upload-fields input { margin: 0; border-radius: 10px; padding: 8px 11px; font-size: .9rem; }
.bak-upload-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 10px; font-size: .82rem;
}
.bak-upload-foot .muted { flex: 1 1 260px; line-height: 1.4; }
.bak-upload-btns { display: flex; gap: 8px; flex: none; }

.bak-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 18px;
  transition: background .12s;
}
.bak-item + .bak-item { border-top: 1px solid var(--line); }
.bak-item:hover { background: var(--soft); }
.bak-ico {
  flex: none; width: 34px; height: 34px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--soft); color: var(--muted);
}
.bak-ico.is-enc { background: rgba(7, 128, 191, .12); color: var(--accent); }
.bak-info { flex: 1 1 auto; min-width: 0; }
.bak-top { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.bak-date { font-weight: 700; font-size: .93rem; color: var(--text); font-variant-numeric: tabular-nums; }
.bak-top .st-badge { font-size: .72rem; padding: 1px 8px; }
.bak-size { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.bak-lock { font-size: .82rem; line-height: 1; }
.bak-name {
  margin-top: 2px; font-size: .78rem; color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bak-act { flex: none; display: flex; align-items: center; gap: 4px; }
.bak-act form { margin: 0; }
.bak-empty { padding: 20px 18px; font-size: .9rem; text-align: center; }

.bak-auto-form { margin-top: 0; }
.bak-auto-toggle { margin: -4px -10px 10px; }
.bak-auto-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px;
  transition: opacity .15s;
}
.bak-auto-grid.is-dim { opacity: .55; }
.bak-auto-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: .82rem;
}
.bak-auto-foot .muted { flex: 1 1 280px; line-height: 1.4; }

@media (max-width: 680px) {
  .bak-sum-head { flex-wrap: wrap; }
  .bak-sum-act { width: 100%; display: flex; justify-content: flex-end; }
  .bak-upload-fields { grid-template-columns: 1fr; }
  .bak-item { flex-wrap: wrap; padding: 12px 14px; }
  .bak-act { width: 100%; justify-content: flex-end; padding-top: 4px; }
  .bak-auto-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- журнал действий (/settings/log) ---------- */
.log-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 14px; }
.log-stat { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit; }
.log-stat + .log-stat { margin-top: 0; }
.log-stat b { font-size: 1.5rem; line-height: 1.1; font-weight: 800; }
.log-stat span { font-size: .82rem; color: var(--muted); }
.log-stat.is-warn b { color: var(--danger); }
a.log-stat:hover { border-color: var(--line-strong); }
.log-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 18px; }
.log-row + .log-row, .log-more { border-top: 1px solid var(--line); }
.log-row.is-fail { background: var(--attn-bg); }
.log-main { flex: 1 1 auto; min-width: 0; }
.log-text { font-size: .92rem; line-height: 1.4; }
.log-what { color: var(--text); }
.log-detail { margin-top: 2px; font-size: .82rem; color: var(--muted); line-height: 1.4; overflow-wrap: anywhere; }
.log-meta { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: .78rem; color: var(--muted); text-align: right; }
.log-meta time { font-weight: 600; color: var(--text); }
.log-unknown { background: var(--soft); color: var(--muted); }
.log-empty { padding: 22px 18px; text-align: center; font-size: .9rem; }
.log-more { padding: 12px 18px; text-align: center; }
.set-lastlogin { margin: 0 0 10px; font-size: .82rem; }
@media (max-width: 680px) {
  .log-stats { grid-template-columns: 1fr; }
  .log-row { flex-wrap: wrap; padding: 12px 14px; }
  .log-meta { width: 100%; flex-direction: row; justify-content: space-between; padding-left: 44px; }
}

/* ===== Отчёт за период и окно просмотра задачи (руководитель) ===== */
.rep-filters { position: relative; z-index: 5; }
.dept-table td a.t-link { font-weight: 500; color: var(--text); }
.dept-table td a.t-link:hover { color: var(--accent); }
.dept-table td.nowrap, .nowrap { white-space: nowrap; }
.late-badge {
  display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: .72rem; font-weight: 600; white-space: nowrap;
  color: var(--warn); background: rgba(234, 88, 12, .11);
}
html[data-theme="dark"] .late-badge { background: rgba(251, 146, 60, .16); }
.dept-table td.late-num { color: var(--warn); font-weight: 700; }
.rep-note { margin: 6px 2px 0; font-size: .82rem; }
.rep-now { margin-top: 22px; }
.rep-now > summary {
  cursor: pointer; padding: 10px 14px; border-radius: 10px; color: var(--muted); font-weight: 600;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
}
.rep-now > summary:hover { color: var(--text); }
.rep-now > p { margin: 10px 2px 0; font-size: .85rem; }

.emp-pick { position: relative; }
.emp-pick > summary { list-style: none; cursor: pointer; }
.emp-pick > summary::-webkit-details-marker { display: none; }
.emp-pick[open] > summary { border-color: var(--brand); }
.emp-pop {
  position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; min-width: 240px; padding: 8px;
  background: var(--solid); border: 1px solid var(--glass-border); border-radius: 14px; box-shadow: var(--menu-shadow);
}
.emp-opt { display: flex; align-items: center; gap: 8px; margin: 0; padding: 7px 8px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.emp-opt:hover { background: var(--soft-2); }
.emp-opt input { width: 16px; height: 16px; margin: 0; flex: none; }
.emp-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; padding: 8px 4px 0; border-top: 1px solid var(--line); }
.emp-actions .btn-link, .emp-actions .btn-soft { margin: 0; }

/* ===== Окна поверх страницы: стекло с тенью (просмотр задачи, подтверждение) ===== */
.tv-dialog, .cf-dialog {
  padding: 0; color: var(--text); border: 1px solid transparent; border-radius: 18px;
  background: var(--g-fill-dense) padding-box, var(--g-rim) border-box;
  -webkit-backdrop-filter: var(--g-blur); backdrop-filter: var(--g-blur);
  box-shadow: var(--g-depth), 0 30px 70px -20px rgba(15, 23, 42, .45);
}
.tv-dialog::backdrop, .cf-dialog::backdrop {
  background: rgba(15, 23, 42, .30); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
html[data-theme="dark"] .tv-dialog::backdrop, html[data-theme="dark"] .cf-dialog::backdrop { background: rgba(2, 6, 23, .55); }
.tv-dialog[open], .cf-dialog[open] { animation: dlg-in .16s ease-out; }
.tv-dialog[open]::backdrop, .cf-dialog[open]::backdrop { animation: dlg-fade .16s ease-out; }
.cf-dialog.is-closing { animation: dlg-out .14s ease-in forwards; }
.cf-dialog.is-closing::backdrop { animation: dlg-fade .14s ease-in reverse forwards; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(6px) scale(.96); } }
@keyframes dlg-out { to { opacity: 0; transform: translateY(4px) scale(.97); } }
@keyframes dlg-fade { from { opacity: 0; } }
@keyframes dlg-sheet-in { from { opacity: .4; transform: translateY(40px); } }
@keyframes dlg-sheet-out { to { opacity: 0; transform: translateY(40px); } }
@media (prefers-reduced-motion: reduce) {
  .tv-dialog[open], .cf-dialog[open], .cf-dialog.is-closing,
  .tv-dialog[open]::backdrop, .cf-dialog[open]::backdrop, .cf-dialog.is-closing::backdrop { animation: none; }
}
.tv-dialog { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }

.cf-dialog { width: min(420px, calc(100vw - 32px)); }
.cf-box { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; padding: 20px 20px 18px; }
.cf-icon {
  grid-row: span 2; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  background: rgba(7, 128, 191, .12); color: var(--accent);
}
.cf-dialog.is-danger .cf-icon { background: rgba(220, 38, 38, .12); color: var(--danger); }
.cf-title { margin: 2px 0 0; font-size: 1.05rem; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }
.cf-text { margin: 6px 0 0; color: var(--muted); font-size: .92rem; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.cf-text[hidden] { display: none; }
.cf-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.cf-actions button { min-width: 96px; }
.tv-body { padding: 18px 20px 22px; overflow-y: auto; max-height: calc(100vh - 50px); }
.tv-head { display: flex; align-items: flex-start; gap: 12px; }
.tv-title { flex: 1; min-width: 0; }
.tv-title h2 { margin: 0; font-size: 1.12rem; line-height: 1.35; overflow-wrap: anywhere; }
.tv-parent { font-size: .82rem; margin-bottom: 4px; }
.tv-parent a { color: var(--accent); }
.tv-close { flex: none; }
.tv-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 16px; margin: 16px 0 0; }
.tv-meta dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tv-meta dd { margin: 3px 0 0; font-size: .9rem; }
.tv-attn { display: flex; gap: 10px; margin-top: 16px; padding: 10px 12px; border-radius: 10px; background: rgba(234, 88, 12, .08); color: var(--text); }
.tv-attn svg { color: var(--warn); flex: none; margin-top: 2px; }
.tv-sect { margin: 18px 0 6px; font-size: .86rem; font-weight: 600; color: var(--muted); }
.tv-note { white-space: pre-wrap; overflow-wrap: anywhere; padding: 10px 12px; border-radius: 10px; background: var(--soft); font-size: .9rem; }
.tv-subs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.tv-subs li { display: flex; align-items: baseline; gap: 8px; padding: 5px 2px; border-bottom: 1px solid var(--line); font-size: .9rem; }
.tv-subs li:last-child { border-bottom: 0; }
.tv-subs li.is-done .tv-sub-title { color: var(--muted); text-decoration: line-through; }
.tv-check { flex: none; width: 16px; height: 16px; border: 1.5px solid var(--line-strong); border-radius: 4px; font-size: .7rem; line-height: 13px; text-align: center; color: #fff; }
.tv-subs li.is-done .tv-check { background: var(--brand); border-color: var(--brand); }
.tv-sub-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tv-sub-meta { display: inline-flex; gap: 6px; align-items: center; font-size: .8rem; white-space: nowrap; }
.tv-history { max-height: none; }
@media (max-width: 600px) {
  .tv-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; border: 0; background: var(--g-fill-dense); }
  .tv-dialog[open] { animation-name: dlg-sheet-in; animation-duration: .22s; }
  /* подтверждение на телефоне: лист снизу, крупные кнопки одна под другой, действие сверху */
  .cf-dialog {
    width: calc(100vw - 16px); max-width: none; margin: auto auto calc(8px + env(safe-area-inset-bottom));
    border-radius: 20px;
  }
  .cf-dialog[open] { animation-name: dlg-sheet-in; animation-duration: .22s; }
  .cf-dialog.is-closing { animation-name: dlg-sheet-out; }
  .cf-box { padding: 20px 16px 14px; }
  .cf-actions { flex-direction: column-reverse; gap: 8px; margin-top: 18px; }
  .cf-actions button { width: 100%; min-height: 48px; font-size: 1rem; border-radius: 12px; }
  @media (prefers-reduced-motion: reduce) { .tv-dialog[open], .cf-dialog[open], .cf-dialog.is-closing { animation: none; } }
  .tv-body { max-height: 100dvh; padding: calc(14px + env(safe-area-inset-top)) 16px calc(20px + env(safe-area-inset-bottom)); }
  .emp-pop { position: fixed; left: 8px; right: 8px; top: auto; bottom: calc(8px + env(safe-area-inset-bottom)); }
}
.sum-head { margin: 20px 0 8px; }
.sum-head .sect { margin: 0; }
.sum-period a { font-size: .82rem; }
.emp-opt { justify-content: flex-start; text-align: left; font-weight: 400; }
.emp-actions .emp-clear {
  margin: 0; padding: 6px 4px; border: 0; background: none; box-shadow: none; color: var(--accent); font-size: .85rem; font-weight: 500; cursor: pointer;
}
.emp-actions .emp-clear:hover { text-decoration: underline; background: none; }
/* сводка отчёта за прошлый период: 4 колонки не растягиваем на всю ширину */
.dept-table.summary.few { width: auto; min-width: min(100%, 620px); }
.dept-table.summary.few td:first-child { min-width: 200px; }
.table-wrap:has(> .dept-table.summary.few) { width: fit-content; max-width: 100%; }
@media (max-width: 600px) {
  .table-wrap:has(> .dept-table.summary.few) { width: auto; }
  .dept-table.summary.few { width: 100%; min-width: 0; }
  .dept-table.summary.few td:first-child { min-width: 0; }
}

/* ===== Страница сотрудника ===== */
.person-switch { display: flex; align-items: center; gap: 8px; margin: -4px 0 4px; }
.person-switch label { margin: 0; font-size: .85rem; }
.person-switch select { width: auto; margin: 0; padding: 7px 32px 7px 10px; border-radius: 10px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin: 0 0 6px; }
.kpi {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 12px;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
}
.kpi b { font-size: 1.5rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi span { font-size: .8rem; color: var(--muted); }
.kpi.is-bad b { color: var(--danger); }
.kpi.is-warn b { color: var(--warn); }
.person-period-head { margin-top: 28px; }
.person-label { font-size: .88rem; }

/* ===== Телефон: таблицы задач превращаются в карточки ===== */
@media (max-width: 600px) {
  .dept-table.cards { display: block; }
  .dept-table.cards thead { display: none; }
  .dept-table.cards tbody { display: block; }
  .dept-table.cards tr {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 11px 12px; border-bottom: 1px solid var(--line);
  }
  .dept-table.cards tbody tr:last-child { border-bottom: 0; }
  .dept-table.cards td { display: block; padding: 0; border: 0; font-size: .82rem; }
  .dept-table.cards td.t-title { order: -2; flex: 1 1 100%; min-width: 0; font-size: .93rem; line-height: 1.35; }
  .dept-table.cards td.c-owner { order: -3; flex: 1 1 100%; font-size: .76rem; color: var(--muted); }
  .dept-table.cards td.c-owner:empty { display: none; }
  .dept-table.cards td.c-date[data-label]::before { content: attr(data-label) " "; color: var(--muted); font-size: .74rem; }
  .dept-table.cards td.c-date:not([data-label]):empty { display: none; }
  .dept-table.cards td.c-extra { flex: 1 1 100%; font-size: .78rem; }
  .dept-table.cards td.c-extra:empty { display: none; }
  .dept-table.cards tr.subrow { padding-left: 26px; background: var(--soft); }
  .dept-table.cards tr.subrow td.t-title { font-size: .86rem; }
  .dept-table.cards tr.empty-row td { flex: 1 1 100%; }
  .dept-table.cards tbody tr:not(.total):hover td { background: transparent; }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 10px; }
  .kpi b { font-size: 1.25rem; }
  .kpi span { font-size: .72rem; }
}
/* короткие подписи колонок сводки для телефона */
.th-short { display: none; }
@media (max-width: 600px) {
  .dept-table.summary .th-long { display: none; }
  .dept-table.summary .th-short { display: inline; }
  .dept-table.summary th { letter-spacing: 0; text-transform: none; }
}
@media (max-width: 600px) {
  .dept-table.summary th:last-child, .dept-table.summary td:last-child { padding-right: 10px; }
}

/* ===== Сводка «Отдела»: строка сотрудника открывает его страницу ===== */
.dept-table tr.row-link { cursor: pointer; }
.dept-table tr.row-link:hover td { background: rgba(7, 128, 191, .09); }
.dept-table td.c-person .pc { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.dept-table td.c-person .av { flex: none; }
.dept-table td.c-person a { color: var(--text); font-weight: 600; }
.dept-table tr.row-link:hover td.c-person a { color: var(--accent); }
.dept-table .c-go { width: 1%; padding-left: 0; padding-right: 10px; color: var(--muted); text-align: right; }
.dept-table .c-go svg { display: block; margin-left: auto; transition: transform .15s; }
.dept-table tr.row-link:hover .c-go { color: var(--accent); }
.dept-table tr.row-link:hover .c-go svg { transform: translateX(2px); }
@media (max-width: 600px) {
  .dept-table.summary td.c-person { max-width: none; padding-left: 6px; padding-right: 2px; }
  .dept-table td.c-person .pc { gap: 5px; white-space: normal; }
  .dept-table td.c-person .av { width: 20px; height: 20px; font-size: .54rem; }
  .dept-table td.c-person a { font-size: .8rem; }
  .dept-table.summary .c-go { padding: 6px 4px 6px 0; }
  .dept-table.summary .c-go svg { width: 14px; height: 14px; }
}
.dept-table.summary td { vertical-align: middle; }
