/* Общий CSS портала: шрифт, токены, тема, каркас (сайдбар/топбар), базовые
   компоненты. Раньше жил инлайном в <style> templates/base.html и скачивался
   заново на каждой странице (~50 КБ); теперь кэшируется браузером (имя с хешем).
   Личный акцент ({{ accent_css }}) и стили страниц (extra_head_css) остаются
   инлайном в base.html — после этого файла. */
/* Geologica (Google Fonts, OFL), разбит по алфавитам: cyrillic-ext — казахские буквы, latin-ext — ₸. */
@font-face {
  font-family:'Geologica';
  src:url("../fonts/Geologica-cyrillic-ext.5fa4fad8ca3c.woff2") format('woff2');
  font-weight:100 900; font-style:normal; font-display:swap;
  unicode-range:U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family:'Geologica';
  src:url("../fonts/Geologica-cyrillic.2c8a4089a2fe.woff2") format('woff2');
  font-weight:100 900; font-style:normal; font-display:swap;
  unicode-range:U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family:'Geologica';
  src:url("../fonts/Geologica-latin-ext.289a4a0e97ea.woff2") format('woff2');
  font-weight:100 900; font-style:normal; font-display:swap;
  unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family:'Geologica';
  src:url("../fonts/Geologica-latin.e4c4c9b74c7e.woff2") format('woff2');
  font-weight:100 900; font-style:normal; font-display:swap;
  unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Светлая палитра (по умолчанию) */
:root {
  --bg:#f5f5f4;
  --surface:#ffffff;
  --surface-alt:#f1f1ef;
  --surface-hover:#e8e8e5;
  --border:#e7e6e2;
  --border-strong:#d9d8d3;
  --text:#18181b;
  --muted:#6b6b70;
  --surface-solid:#ffffff;
  --primary:#4F46E5;
  --primary-hover:#4338CA;
  --primary-soft:#EEF2FF;
  --primary-soft-hover:#E0E7FF;
  --primary-grad:#6366F1;
  --primary-shadow:55,48,163;
  --on-primary:#ffffff;
  --danger:#dc2626;
  --danger-soft:#fef2f2;
  --danger-border:#fecaca;
  /* Семантические «мягкие» бейджи (статусы, категории) */
  --info-bg:#dbeafe;   --info-fg:#1e3a8a;
  --warn-bg:#fef3c7;   --warn-fg:#92400e;
  --violet-bg:#ede9fe; --violet-fg:#5b21b6;
  --ok-bg:#d1fae5;     --ok-fg:#065f46;
  --amber:#d97706;
  --radius:14px;
  --radius-sm:10px;
  --radius-lg:20px;
  /* Многослойные тени — «шкала высоты», а не один плоский блик */
  --shadow-sm:0 1px 2px rgba(17,20,24,.05), 0 1px 3px rgba(17,20,24,.05);
  --shadow-md:0 3px 6px rgba(17,20,24,.045), 0 10px 24px rgba(17,20,24,.09);
  --shadow-lg:0 8px 16px rgba(17,20,24,.06), 0 24px 56px rgba(17,20,24,.16);
  --sidebar-w:250px;
  --sidebar-w-collapsed:68px;
  /* Движение — единые кривые и длительности (Emil Kowalski / animations.dev).
     Встроенные CSS-easing слишком вялые; эти — с «характером». */
  --ease-out:cubic-bezier(.23,1,.32,1);
  --ease-in-out:cubic-bezier(.77,0,.175,1);
  --ease-pop:cubic-bezier(.34,1.56,.64,1);
  /* мягкое начало: меню/панели видно, как открываются (animate-ui ease.soft) */
  --ease-soft:cubic-bezier(.215,.61,.355,1);
  /* уход: сразу и с ускорением — закрытый тост/окно (ease.away) */
  --ease-away:cubic-bezier(.33,.17,.67,.5);
  --dur-press:130ms;
  --dur-pop:160ms;
  --dur-panel:170ms;
  /* Пружины (animate-ui spring.*) — scripts/gen_springs.py. --spring-X =
     «длительность кривая» для transition; -dur/-ease — по отдельности
     (element.animate через portalEase() в static/js/motion.js). */
  /* нажатие: ~120 мс до цели (550/30) */
  --spring-press-dur:418ms;
  --spring-press-ease:linear(0, 0.009 1.3%, 0.031 2.6%, 0.069 4.1%, 0.122 5.6%, 0.174 6.9%, 0.236 8.4%, 0.504 14.1%, 0.62 16.7%, 0.73 19.5%, 0.82 22.1%, 0.892 24.6%, 0.953 27.3%, 0.999 29.9%, 1.034 32.8%, 1.052 34.9%, 1.064 37.2%, 1.071 39.6%, 1.072 42.3%, 1.062 47.6%, 1.017 62.1%, 1.002 70.1%, 0.995 81.0%, 1);
  --spring-press:var(--spring-press-dur) var(--spring-press-ease);
  /* поповеры, меню, выпадающие панели: ~175 мс, перелёт ~4% (400/29) */
  --spring-pop-dur:380ms;
  --spring-pop-ease:linear(0, 0.007 1.6%, 0.027 3.2%, 0.062 5.0%, 0.11 7.0%, 0.218 10.5%, 0.457 17.7%, 0.563 20.9%, 0.663 24.4%, 0.748 27.7%, 0.814 30.7%, 0.872 33.9%, 0.921 37.2%, 0.959 40.4%, 0.99 44.1%, 1.013 48.0%, 1.027 52.2%, 1.035 57.0%, 1.034 65.0%, 1.01 86.2%, 1);
  --spring-pop:var(--spring-pop-dur) var(--spring-pop-ease);
  /* модальные окна: спокойно, без перелёта, ~450 мс (150/25) */
  --spring-dialog-dur:733ms;
  --spring-dialog-ease:linear(0, 0.005 1.2%, 0.021 2.4%, 0.045 3.7%, 0.081 5.2%, 0.158 7.8%, 0.357 14.1%, 0.453 17.2%, 0.545 20.5%, 0.625 23.9%, 0.694 27.3%, 0.754 30.8%, 0.805 34.4%, 0.848 38.3%, 0.889 42.9%, 0.921 48.0%, 0.946 53.5%, 0.965 59.9%, 0.979 67.1%, 0.989 75.6%, 1);
  --spring-dialog:var(--spring-dialog-dur) var(--spring-dialog-ease);
  /* тосты: «приземляется» с небольшим перелётом (280/24) */
  --spring-toast-dur:447ms;
  --spring-toast-ease:linear(0, 0.007 1.6%, 0.027 3.2%, 0.063 5.2%, 0.112 7.2%, 0.219 10.8%, 0.462 18.0%, 0.569 21.4%, 0.669 24.9%, 0.751 28.1%, 0.82 31.2%, 0.877 34.4%, 0.923 37.5%, 0.962 40.9%, 0.993 44.6%, 1.016 48.5%, 1.031 52.7%, 1.038 57.6%, 1.036 65.5%, 1.011 86.6%, 1);
  --spring-toast:var(--spring-toast-dur) var(--spring-toast-ease);
  /* счётчик/бейдж/реакция подпрыгнули: живо, перелёт ~13% (500/24) */
  --spring-bump-dur:447ms;
  --spring-bump-ease:linear(0, 0.009 1.3%, 0.034 2.7%, 0.075 4.1%, 0.138 5.8%, 0.197 7.2%, 0.272 8.7%, 0.564 14.3%, 0.686 16.8%, 0.801 19.4%, 0.895 21.8%, 0.97 24.2%, 1.03 26.5%, 1.076 29.0%, 1.108 31.4%, 1.124 33.4%, 1.132 35.5%, 1.134 37.7%, 1.129 40.0%, 1.109 44.2%, 1.046 53.4%, 1.019 57.9%, 0.999 62.9%, 0.987 67.9%, 0.983 77.1%, 1);
  --spring-bump:var(--spring-bump-dur) var(--spring-bump-ease);
  /* соседи закрывают зазор / раздвигаются: быстро, без перелёта (500/40) */
  --spring-reflow-dur:271ms;
  --spring-reflow-ease:linear(0, 0.006 1.8%, 0.023 3.7%, 0.051 5.7%, 0.093 8.1%, 0.183 12.4%, 0.385 20.9%, 0.477 25.0%, 0.562 29.0%, 0.634 32.9%, 0.693 36.4%, 0.744 39.9%, 0.789 43.4%, 0.829 47.1%, 0.872 51.9%, 0.907 56.9%, 0.935 62.3%, 0.958 68.2%, 0.975 74.5%, 0.987 81.7%, 1);
  --spring-reflow:var(--spring-reflow-dur) var(--spring-reflow-ease);
  /* бейдж-счётчик вырос: упругий отскок (200/16) */
  --spring-bounce-dur:688ms;
  --spring-bounce-ease:linear(0, 0.008 1.3%, 0.033 2.8%, 0.075 4.3%, 0.132 5.9%, 0.189 7.3%, 0.259 8.8%, 0.55 14.7%, 0.669 17.2%, 0.779 19.8%, 0.872 22.4%, 0.947 24.9%, 1.006 27.3%, 1.052 29.8%, 1.085 32.4%, 1.102 34.5%, 1.112 36.7%, 1.115 39.0%, 1.112 41.6%, 1.095 46.1%, 1.041 55.7%, 1.019 60.5%, 1.001 65.6%, 0.991 70.9%, 0.987 80.4%, 1);
  --spring-bounce:var(--spring-bounce-dur) var(--spring-bounce-ease);
  /* Выпадающая панель/меню целиком: проявляется за 220 мс, растёт от
     триггера на пружине; display держится, пока идёт пружина. */
  --t-menu:opacity 220ms var(--ease-soft), transform var(--spring-pop), display var(--spring-pop-dur) allow-discrete;
  /* Масштабы (animate-ui scale.*) и сдвиги. Всё движение в CSS — только
     через них: «Меньше движения» ставит их в 1 и 0 (блок в конце <style>),
     и элементы перестают двигаться, но продолжают проявляться. */
  --scale-press:.97;    /* нажатая кнопка, пилюля, переключатель */
  --scale-choice:.985;  /* нажатая карточка, строка, плитка целиком: крупнее — легче */
  --scale-icon:.9;      /* маленькая кнопка-иконка (≤ 34px): на ней .97 не видно */
  --scale-menu:.9;      /* откуда растут меню и выпадающие панели */
  --scale-dialog:.96;   /* откуда появляется модальное окно */
  --scale-toast:.96;    /* откуда поднимается тост (вместе с размытием 4px) */
  --travel:1;           /* множитель сдвигов: translateY(calc(var(--travel) * 8px)) */
}
/* Тёмная палитра — по системной настройке (если тема не форсирована
   на светлую) и по ручному тумблеру. Оба блока держат один список. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:#0c0d12;
    --surface:#15171e;
    --surface-alt:#1c1e28;
    --surface-hover:#252834;
    --border:#2f3342;
    --border-strong:#3d4254;
    --text:#e7e8ec;
    --muted:#9a9ca8;
    --surface-solid:#15171e;
    --primary:#818CF8;
    --primary-hover:#A5B4FC;
    --primary-soft:#1C1A3F;
    --primary-soft-hover:#26235A;
    --primary-grad:#6366F1;
    --primary-shadow:0,0,0;
    --on-primary:#ffffff;
    --danger:#f87171;
    --danger-soft:#3a1f1f;
    --danger-border:#7f1d1d;
    --info-bg:#17293f;   --info-fg:#93c5fd;
    --warn-bg:#3a3016;   --warn-fg:#fcd34d;
    --violet-bg:#2a2140; --violet-fg:#c4b5fd;
    --ok-bg:#123321;     --ok-fg:#86efac;
    --amber:#fbbf24;
    --shadow-sm:0 1px 2px rgba(0,0,0,.45), 0 1px 3px rgba(0,0,0,.35);
    --shadow-md:0 4px 12px rgba(0,0,0,.5), 0 12px 32px rgba(0,0,0,.45);
    --shadow-lg:0 12px 28px rgba(0,0,0,.55), 0 32px 64px rgba(0,0,0,.5);
  }
}
:root[data-theme="dark"] {
  --bg:#0c0d12;
  --surface:#15171e;
  --surface-alt:#1c1e28;
  --surface-hover:#252834;
  --border:#2f3342;
  --border-strong:#3d4254;
  --text:#e7e8ec;
  --muted:#9a9ca8;
  --surface-solid:#15171e;
  --primary:#818CF8;
  --primary-hover:#A5B4FC;
  --primary-soft:#1C1A3F;
  --primary-soft-hover:#26235A;
  --primary-grad:#6366F1;
  --primary-shadow:0,0,0;
  --on-primary:#ffffff;
  --danger:#f87171;
  --danger-soft:#3a1f1f;
  --danger-border:#7f1d1d;
  --info-bg:#17293f;   --info-fg:#93c5fd;
  --warn-bg:#3a3016;   --warn-fg:#fcd34d;
  --violet-bg:#2a2140; --violet-fg:#c4b5fd;
  --ok-bg:#123321;     --ok-fg:#86efac;
  --shadow-sm:0 1px 2px rgba(0,0,0,.45), 0 1px 3px rgba(0,0,0,.35);
  --shadow-md:0 4px 12px rgba(0,0,0,.5), 0 12px 32px rgba(0,0,0,.45);
  --shadow-lg:0 12px 28px rgba(0,0,0,.55), 0 32px 64px rgba(0,0,0,.5);
}
* { box-sizing:border-box; }
html, body { height:100%; }
body {
  margin:0;
  font-family:'Geologica',-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  font-optical-sizing:auto;
  letter-spacing:-.011em;
  background:var(--bg);
  color:var(--text);
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}
a { color:inherit; }
:where(a,button,input,select,textarea,summary,[tabindex]):focus-visible {
  outline:2px solid var(--primary); outline-offset:2px; border-radius:5px;
}

/* Трекинг зависит от размера: крупное — плотнее, мелкое (10–11px) — чуть
   свободнее, иначе общий минус body слепляет буквы в подписях. */
h1 { letter-spacing:-.025em; }
h2 { letter-spacing:-.02em; }
h3 { letter-spacing:-.015em; }
small, .notif-time, .notif-badge, .side-user-role, .fmt-chip { letter-spacing:.01em; }

/* iOS/iPadOS увеличивает страницу при фокусе в поле со шрифтом меньше 16px.
   !important — у страниц свои правила для полей, они идут позже в <body>. */
@media (hover:none) and (pointer:coarse) {
  input:not([type=checkbox],[type=radio],[type=range],[type=file],[type=color],[type=button],[type=submit]),
  select, textarea { font-size:16px !important; }
}

/* ══ Каркас: боковая навигация + рабочая колонка ══ */
.shell { display:flex; min-height:100vh; }
.scrim {
  position:fixed; inset:0; z-index:55; background:rgba(8,10,14,.44);
  opacity:0; transition:opacity .2s var(--ease-out);
}
.scrim[hidden] { display:none; }
:root.nav-open .scrim { opacity:1; }

.sidebar {
  flex:0 0 var(--sidebar-w); width:var(--sidebar-w);
  position:sticky; top:0; align-self:flex-start; height:100vh;
  display:flex; flex-direction:column;
  background:var(--surface); border-right:1px solid var(--border);
  transition:width .2s var(--ease-out), transform .22s var(--ease-out);
  z-index:56;
}
:root[data-sidebar="collapsed"] .sidebar { flex-basis:var(--sidebar-w-collapsed); width:var(--sidebar-w-collapsed); }

.side-top {
  display:flex; align-items:center; gap:8px;
  padding:16px 16px 14px; height:61px;
}
.brand { display:flex; align-items:center; gap:10px; text-decoration:none; min-width:0; }
.brand-mark {
  width:32px; height:32px; border-radius:9px; flex-shrink:0;
  background:linear-gradient(150deg, var(--primary-grad), var(--primary));
  display:flex; align-items:center; justify-content:center;
  color:var(--on-primary); font-weight:800; font-size:15px;
  box-shadow:0 1px 2px rgba(var(--primary-shadow),.35), inset 0 1px 0 rgba(255,255,255,.25);
}
.brand-name {
  font-weight:650; font-size:14.5px; letter-spacing:-.02em; color:var(--text);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.side-collapse {
  margin-left:auto; flex-shrink:0; width:28px; height:28px; border-radius:8px;
  border:none; background:none; color:var(--muted); cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  transition:background .15s, color .15s, transform var(--spring-press);
}
@media (hover:hover) { .side-collapse:hover { background:var(--surface-alt); color:var(--text); } }
.side-collapse:active { transform:scale(var(--scale-icon)); }
:root[data-sidebar="collapsed"] .side-collapse svg { transform:rotate(180deg); }

.side-nav { flex:1; overflow-y:auto; overflow-x:hidden; padding:8px 12px 12px; display:flex; flex-direction:column; gap:2px; }
.nav-item {
  display:flex; align-items:center; gap:11px; padding:9px 11px; border-radius:10px;
  text-decoration:none; color:var(--muted); font-size:13.5px; font-weight:550;
  white-space:nowrap; position:relative;
  transition:background .15s, color .15s, transform var(--spring-press);
}
@media (hover:hover) { .nav-item:hover { background:var(--surface-alt); color:var(--text); } }
.nav-item:active { transform:scale(var(--scale-choice)); }
.nav-item.active { background:var(--primary-soft); color:var(--primary-hover); font-weight:650; }
.nav-item.active::before {
  content:""; position:absolute; left:-12px; top:9px; bottom:9px; width:3px;
  border-radius:0 3px 3px 0; background:var(--primary);
}
.nav-ic { flex-shrink:0; width:20px; height:20px; display:flex; align-items:center; justify-content:center; }
.nav-ic svg { width:19px; height:19px; }
.nav-label { overflow:hidden; text-overflow:ellipsis; }

.side-foot {
  border-top:1px solid var(--border); padding:10px 12px;
  display:flex; align-items:center; gap:8px;
}
.side-user {
  display:flex; align-items:center; gap:9px; text-decoration:none; color:var(--text);
  flex:1; min-width:0; padding:5px; border-radius:10px;
  transition:background .15s;
}
@media (hover:hover) { .side-user:hover { background:var(--surface-alt); } }
.side-user-tx { display:flex; flex-direction:column; min-width:0; line-height:1.25; }
.side-user-name { font-size:12.5px; font-weight:600; overflow-wrap:anywhere; }
.side-user-role { font-size:11px; color:var(--muted); overflow-wrap:anywhere; }
.side-logout button {
  width:34px; height:34px; border-radius:9px; border:1px solid var(--border);
  background:var(--surface-alt); color:var(--muted); cursor:pointer; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  transition:background .15s, color .15s, transform var(--spring-press);
}
@media (hover:hover) { .side-logout button:hover { background:var(--surface-hover); color:var(--danger); } }
.side-logout button:active { transform:scale(var(--scale-icon)); }

/* Свёрнутое состояние — только иконки */
:root[data-sidebar="collapsed"] .brand-name,
:root[data-sidebar="collapsed"] .nav-label,
:root[data-sidebar="collapsed"] .side-user-tx { display:none; }
:root[data-sidebar="collapsed"] .side-top { padding:16px 0 14px; justify-content:center; }
:root[data-sidebar="collapsed"] .side-collapse { position:absolute; top:18px; right:8px; margin:0; opacity:0; }
:root[data-sidebar="collapsed"] .sidebar:hover .side-collapse { opacity:1; }
:root[data-sidebar="collapsed"] .nav-item { justify-content:center; padding:9px; }
:root[data-sidebar="collapsed"] .nav-item.active::before { left:-12px; }
:root[data-sidebar="collapsed"] .side-foot { flex-direction:column; padding:10px 8px; }
:root[data-sidebar="collapsed"] .side-user { flex:none; }

/* ══ Рабочая колонка ══ */
.main-col { flex:1; min-width:0; display:flex; flex-direction:column; }
.topbar {
  position:sticky; top:0; z-index:40;
  display:flex; align-items:center; gap:12px;
  padding:0 24px; height:61px;
  border-bottom:1px solid var(--border);
  background:color-mix(in srgb, var(--surface) 82%, transparent);
  -webkit-backdrop-filter:blur(12px) saturate(1.6);
  backdrop-filter:blur(12px) saturate(1.6);
}
@supports not (backdrop-filter:blur(1px)) { .topbar { background:var(--surface); } }
.nav-toggle {
  display:none; width:34px; height:34px; border-radius:9px; flex-shrink:0;
  border:1px solid var(--border); background:var(--surface-alt); color:var(--text);
  align-items:center; justify-content:center; cursor:pointer;
  transition:background .15s, transform var(--spring-press);
}
@media (hover:hover) { .nav-toggle:hover { background:var(--surface-hover); } }
.nav-toggle:active { transform:scale(var(--scale-icon)); }
.topbar-title { font-size:14px; font-weight:650; letter-spacing:-.02em; color:var(--text); }
.topbar-right { margin-left:auto; display:flex; align-items:center; gap:12px; }

main { flex:1; padding:30px 24px 72px; max-width:1160px; width:100%; margin:0 auto; }

/* Незалогиненный вид (страница входа) */
.topbar--plain { justify-content:space-between; padding:0 22px; }
.main--plain { max-width:none; padding:0; }
/* Канбан и доски: колонкам нужна вся ширина экрана, не 1160px текстовых страниц */
.main--wide { max-width:none; }

/* ══ Компоненты ══ */
.btn {
  background:linear-gradient(180deg, color-mix(in srgb, var(--primary) 84%, #fff), var(--primary));
  color:var(--on-primary); padding:9px 16px; border-radius:var(--radius-sm);
  border:1px solid color-mix(in srgb, var(--primary) 70%, #000); cursor:pointer;
  font-weight:600; font-size:13.5px; font-family:inherit;
  text-decoration:none; display:inline-flex; align-items:center; gap:6px; line-height:1;
  box-shadow:0 1px 2px rgba(var(--primary-shadow),.22), inset 0 1px 0 rgba(255,255,255,.18);
  transition:filter .15s, box-shadow .15s, transform var(--spring-press);
}
@media (hover:hover) { .btn:hover { filter:brightness(1.05); box-shadow:0 2px 6px rgba(var(--primary-shadow),.28), inset 0 1px 0 rgba(255,255,255,.22); } }
.btn:active { transform:scale(var(--scale-press)); }
.btn-ghost {
  background:var(--surface); color:var(--text); border:1px solid var(--border-strong);
  padding:8px 15px; border-radius:var(--radius-sm); font-weight:600; font-size:13.5px; font-family:inherit;
  cursor:pointer; text-decoration:none; display:inline-flex; align-items:center; gap:6px;
  box-shadow:var(--shadow-sm);
  transition:background .15s, border-color .15s, transform var(--spring-press);
}
@media (hover:hover) { .btn-ghost:hover { background:var(--surface-alt); border-color:var(--muted); } }
.btn-ghost:active { transform:scale(var(--scale-press)); }

/* Нативный <input type=file> — переоформляем саму кнопку выбора файла
   под дизайн портала (иначе это стандартная серая OS-кнопка, которая
   нигде не сочетается с остальным UI). Работает во всех современных
   браузерах; текст "файл не выбран" остаётся системным — трогать его
   нельзя без полной замены виджета на кастомный. */
input[type=file] { font-size:13px; color:var(--muted); font-family:inherit; }
input[type=file]::file-selector-button {
  background:var(--surface); color:var(--text); border:1px solid var(--border-strong);
  padding:7px 13px; border-radius:var(--radius-sm); font-weight:600; font-size:12.5px; font-family:inherit;
  cursor:pointer; margin-right:10px;
  transition:background .15s, border-color .15s, transform var(--spring-press);
}
@media (hover:hover) { input[type=file]::file-selector-button:hover { background:var(--surface-alt); border-color:var(--muted); } }
input[type=file]::file-selector-button:active { transform:scale(var(--scale-press)); }

.card {
  background:var(--surface); border-radius:var(--radius); padding:22px;
  border:1px solid var(--border); box-shadow:var(--shadow-sm);
  transition:box-shadow .18s var(--ease-out), transform .18s var(--ease-out), border-color .18s var(--ease-out);
}
.grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(240px, 1fr)); gap:18px; }
.muted { color:var(--muted); }
.error {
  background:var(--danger-soft); border:1px solid var(--danger-border); color:var(--danger);
  padding:13px 16px; border-radius:10px; font-size:14px;
}
.messages { list-style:none; padding:0; margin:0 0 18px; }
.messages li {
  background:var(--primary-soft); color:var(--primary-hover); border:1px solid var(--primary-soft-hover);
  padding:10px 14px; border-radius:10px; font-size:13.5px; margin-bottom:8px;
}

/* --- Метка «через API» (api_badge); общая для всех разделов --- */
.via-api { display:inline-flex; align-items:center; gap:3px; font-size:11.5px; font-weight:500; color:var(--muted); background:var(--surface-alt); border:1px solid var(--border); border-radius:999px; padding:1px 8px; margin-left:6px; white-space:nowrap; vertical-align:middle; }
/* --- Колокольчик уведомлений --- */
.notif-root { position:relative; }
.notif-btn {
  position:relative; width:38px; height:38px; border-radius:50%;
  border:1px solid var(--border); background:var(--surface-alt);
  display:flex; align-items:center; justify-content:center; cursor:pointer;
  color:var(--text); transition:background .15s, transform var(--spring-press);
}
@media (hover:hover) { .notif-btn:hover { background:var(--surface-hover); } }
.notif-btn:active { transform:scale(var(--scale-icon)); }
a.notif-btn { text-decoration:none; }
.notif-badge {
  position:absolute; top:-4px; right:-4px; min-width:18px; height:18px;
  padding:0 4px; border-radius:999px; background:var(--danger); color:#fff;
  font-size:11px; font-weight:700; line-height:18px; text-align:center;
  box-shadow:0 0 0 2px var(--surface); font-variant-numeric:tabular-nums;
}
.notif-panel {
  position:absolute; right:0; top:46px; width:360px; max-width:calc(100vw - 32px);
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  box-shadow:var(--shadow-lg); z-index:50; overflow:hidden;
  transform-origin:top right; opacity:1; transform:none;
  transition:var(--t-menu);
}
.notif-panel[hidden] { display:none; opacity:0; transform:scale(var(--scale-menu)); pointer-events:none; }
@starting-style { .notif-panel:not([hidden]) { opacity:0; transform:scale(var(--scale-menu)); } }
.notif-panel-head {
  display:flex; justify-content:space-between; align-items:center;
  padding:12px 14px; border-bottom:1px solid var(--border);
}
.notif-panel-head strong { font-size:13.5px; }
.notif-panel-head button {
  background:none; border:none; color:var(--primary); font-weight:600;
  font-size:12.5px; cursor:pointer; padding:0;
}
.notif-list { max-height:420px; overflow-y:auto; }
.notif-item {
  display:flex; gap:10px; padding:11px 14px; text-decoration:none; color:var(--text);
  border-bottom:1px solid var(--surface-alt); transition:background .12s;
}
@media (hover:hover) { .notif-item:hover { background:var(--surface-alt); } }
.notif-item.unread { background:var(--primary-soft); }
@media (hover:hover) { .notif-item.unread:hover { background:var(--primary-soft-hover); } }
/* SVG-иконки интерфейса (core_dashboard/icons.py) — по строке текста */
.ui-ic { display:inline-block; vertical-align:-0.16em; flex-shrink:0; }
.notif-ic { display:inline-flex; padding-top:1px; color:var(--muted); flex-shrink:0; }
.notif-ic [data-icon="alert-circle"] { color:var(--danger); }
.notif-tx { display:flex; flex-direction:column; gap:2px; min-width:0; }
.notif-title { font-size:13px; font-weight:600; }
.notif-body { font-size:12.5px; color:var(--muted); overflow-wrap:anywhere; }
.notif-time { font-size:11px; color:var(--muted); }
.notif-empty { padding:28px 14px; text-align:center; color:var(--muted); font-size:13px; }
.notif-push-tip { display:flex; align-items:center; gap:8px; padding:9px 14px; border-top:1px solid var(--border); background:var(--info-bg); font-size:12.5px; color:var(--info-fg); }
.notif-push-tip[hidden] { display:none; }
.notif-push-tip span { flex:1; line-height:1.35; }
.notif-push-tip button { border:0; background:none; cursor:pointer; font:inherit; color:inherit; }
#notif-push-on { font-weight:700; text-decoration:underline; }
#notif-push-dismiss { font-size:16px; line-height:1; padding:0 2px; opacity:.7; }
.notif-panel-foot { padding:10px 14px; border-top:1px solid var(--border); text-align:center; }
.notif-panel-foot a { font-size:12.5px; color:var(--muted); text-decoration:none; }
@media (hover:hover) { .notif-panel-foot a:hover { color:var(--text); } }
@media (max-width:640px) { .notif-panel { position:fixed; right:8px; left:8px; width:auto; } }

/* --- Тумблер темы --- */
.theme-btn {
  width:34px; height:34px; border-radius:9px; flex-shrink:0;
  border:1px solid var(--border); background:var(--surface-alt);
  display:flex; align-items:center; justify-content:center; cursor:pointer;
  color:var(--text); transition:background .15s, transform var(--spring-press);
}
.side-foot .theme-btn { border-radius:9px; }
@media (hover:hover) { .theme-btn:hover { background:var(--surface-hover); } }
.theme-btn:active { transform:scale(var(--scale-icon)); }
.theme-btn .i-sun { display:none; }
.theme-btn .i-moon { display:block; }
:root[data-theme="dark"] .theme-btn .i-sun { display:block; }
:root[data-theme="dark"] .theme-btn .i-moon { display:none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .i-sun { display:block; }
  :root:not([data-theme="light"]) .theme-btn .i-moon { display:none; }
}

/* ══ Мобильный каркас ══ */
@media (max-width:900px) {
  .sidebar {
    position:fixed; left:0; top:0; bottom:0; height:100dvh;
    flex-basis:270px; width:270px; transform:translateX(-100%);
    box-shadow:var(--shadow-lg);
  }
  :root.nav-open .sidebar { transform:none; }
  /* Движение меню ведёт JS (пружина, свайп пальцем) — CSS-переход мешал бы
     ему; touch-action отдаёт горизонтальные жесты нам, вертикаль — прокрутке. */
  .sidebar { transition:none; touch-action:pan-y; }
  .scrim { transition:none; touch-action:none; }
  /* Продолжение панели за левым краем: при отскоке и «резине» не видно щели. */
  .sidebar::before { content:""; position:absolute; top:0; bottom:0; right:100%; width:60px; background:inherit; }
  :root[data-sidebar="collapsed"] .sidebar { flex-basis:270px; width:270px; }
  :root[data-sidebar="collapsed"] .brand-name,
  :root[data-sidebar="collapsed"] .nav-label,
  :root[data-sidebar="collapsed"] .side-user-tx { display:revert; }
  :root[data-sidebar="collapsed"] .nav-item { justify-content:flex-start; padding:9px 11px; }
  :root[data-sidebar="collapsed"] .side-foot { flex-direction:row; }
  .side-collapse { display:none; }
  .nav-toggle { display:flex; }
}
@media (max-width:640px) {
  .topbar { padding:0 14px; }
  main { padding:20px 14px 56px; }
}

/* --- Уважать «меньше движения» --- */
/* Это не «никакой анимации»: сдвиги и масштаб убираем (их и укачивает),
   а проявление, размытие и смена цвета остаются — панели, окна и тосты
   не выскакивают, а мягко проявляются (и уходят так же: display у них
   по-прежнему ждёт конца перехода). Делается токенами, а не запретом
   transition: масштабы становятся 1, сдвиги 0 — transform есть, но
   двигать нечего. Поэтому в CSS — никаких голых чисел в scale/translate,
   только токены (это проверяет verify_motion_tokens.py). Бесконечные
   циклы (дрейф фона, пульсация) каждый выключает у себя. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --scale-press:1; --scale-choice:1; --scale-icon:1;
    --scale-menu:1; --scale-dialog:1; --scale-toast:1; --travel:0;
  }
  *, *::before, *::after { scroll-behavior:auto !important; }
}

/* Поле поиска с крестиком «очистить» (static/js/clearable-search.js) */
.clearable { position:relative; display:inline-flex; align-items:center; }
.clearable > input { padding-right:32px !important; }
.clearable-btn {
  position:absolute; right:6px; top:50%; transform:translateY(-50%);
  width:22px; height:22px; border:none; border-radius:50%; padding:0; cursor:pointer;
  background:var(--surface-alt); color:var(--muted);
  display:none; align-items:center; justify-content:center;
  transition:background .15s, color .15s;
}
.clearable.has-value .clearable-btn { display:inline-flex; }
@media (hover:hover) { .clearable-btn:hover { background:var(--border); color:var(--text); } }
/* Плашки форматов работы (раздел «График», профиль, карточка сотрудника) */
.tone-office { --t-bg:var(--primary-soft); --t-fg:var(--primary-hover); }
.tone-place  { --t-bg:var(--info-bg);  --t-fg:var(--info-fg); }
.tone-remote { --t-bg:var(--ok-bg);    --t-fg:var(--ok-fg); }
.tone-trip   { --t-bg:var(--violet-bg); --t-fg:var(--violet-fg); }
.tone-event  { --t-bg:var(--warn-bg);  --t-fg:var(--warn-fg); }
.tone-off    { --t-bg:var(--danger-soft); --t-fg:var(--danger); }
.fmt-chip { display:inline-flex; align-items:center; gap:5px; padding:3px 10px; border-radius:20px; font-size:12.5px; font-weight:600;
background:var(--t-bg); color:var(--t-fg); white-space:nowrap; }
.fmt-chip.pending { background:transparent; outline:1.5px dashed var(--t-fg); outline-offset:-1.5px; }

/* Строка таблицы как ссылка (список задач, задачи проекта): настоящий <a class="row-open">
   растянут на всю строку. Правый клик в любом месте строки даёт «Открыть в новой вкладке»,
   работают средняя кнопка и Ctrl/Cmd+клик, ссылка доступна с клавиатуры. Кнопки, аватарки
   и срок внутри строки лежат выше ссылки и остаются кликабельными. */
/* transform — не для анимации: Safari (WebKit bug 240961) не считает <tr> с
   position:relative опорой для absolute-потомков, и растянутые ::after всех
   строк уезжали на всю страницу — любое нажатие открывало последнюю задачу.
   transform делает строку опорой и в WebKit; в остальных браузерах ничего не меняет. */
tr.row-link { position:relative; transform:translateZ(0); cursor:pointer; }
tr.row-link .row-open { color:inherit; text-decoration:none; }
tr.row-link .row-open::after { content:""; position:absolute; inset:0; z-index:1; }
tr.row-link :is(.user-chip, [data-deadline-trigger], .row-quick-done, a:not(.row-open)) { position:relative; z-index:2; }

