/* EdVille Management Hub — дизайн-система по фирменному логотипу EdVille International School:
   тёмно-синий #23253F, зелёный #009444, светлый лимонно-кремовый #EBF8C8, белый. Mobile-first. */
:root {
  --navy: #23253F; --green: #009444; --cream: #EBF8C8;
  --black: #23253F; --anthracite: #23253F; --anthracite-2: #33365A; --graphite: #474B70;
  --accent: #009444; --accent-600: #007A37; --accent-50: #E6F5EC;
  --bg: #F4F6EF; --surface: #ffffff; --surface-2: #F9FAF5; --border: #E2E6DA; --border-strong: #CDD3C3;
  --text: #1d1f35; --text-2: #50546B; --text-3: #868A9E;
  --ok: #0B8A43; --ok-50: #e9f7ef; --warn: #c98a00; --warn-50: #fff7e0; --danger: #d63a2f; --danger-50: #fdecea; --info: #2f6fd6; --info-50: #ebf2fd;
  --radius: 14px; --radius-sm: 10px; --shadow: 0 1px 2px rgba(16,17,20,.04), 0 4px 16px rgba(16,17,20,.05);
  --shadow-lg: 0 20px 50px rgba(13,14,16,.18);
  --sidebar: 248px; --topbar: 60px; --bottomnav: 64px;
  --font: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.2,.7,.2,1);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
body { overflow-x: hidden; min-height: 100vh; }
img, svg { max-width: 100%; }
/* Иконки по умолчанию — размером со строку текста; конкретные контексты ниже задают свой размер */
svg[aria-hidden="true"] { width: 1.1em; height: 1.1em; vertical-align: -0.18em; flex: none; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-600); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; overflow-wrap: anywhere; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
p { margin: 0 0 8px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--text-2); } .faint { color: var(--text-3); } .small { font-size: 13px; } .xs { font-size: 12px; }
.wrap { overflow-wrap: anywhere; word-break: break-word; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Загрузка ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-logo { width: 220px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.spinner { width: 22px; height: 22px; border: 2.5px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 32px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Каркас ---------- */
.shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--black); color: #e9e9ea; display: flex; flex-direction: column; z-index: 40; transform: translateX(-100%); transition: transform .25s var(--ease); }
.sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
.sidebar .brand { display: flex; align-items: center; justify-content: center; padding: 16px 18px; background: #fff; }
.sidebar .brand img { width: 132px; display: block; }
.sidebar .brand-sub { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #8d9098; padding: 14px 18px 8px; }
.nav { flex: 1; overflow-y: auto; padding: 4px 10px 16px; scrollbar-width: thin; scrollbar-color: #333 transparent; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; margin: 1px 0; border-radius: 10px; color: #C9CCDC; font-size: 14px; min-height: 40px; position: relative; }
.nav a:hover { background: #1b1d21; color: #fff; }
.nav a.active { background: var(--anthracite-2); color: var(--cream); }
.nav a.active::before { content: ""; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav svg { width: 19px; height: 19px; flex: none; opacity: .9; }
.nav .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav .count { background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 7px; }
.nav-sep { height: 1px; background: #23252a; margin: 10px 8px; }
.sidebar .me { padding: 12px 14px; border-top: 1px solid #23252a; display: flex; gap: 10px; align-items: center; }
.sidebar .me .who { flex: 1; min-width: 0; }
.sidebar .me .who b { display: block; font-size: 13px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .me .who span { display: block; font-size: 12px; color: #8d9098; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scrim { position: fixed; inset: 0; background: rgba(13,14,16,.45); z-index: 35; opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.show { opacity: 1; pointer-events: auto; }

.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar); background: #fff; backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; padding: 0 12px; padding-top: env(safe-area-inset-top); }
.topbar .title { flex: 1; min-width: 0; font-weight: 650; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .mobile-logo { height: 38px; width: auto; flex: none; display: block; }
.main { padding: 16px 16px calc(var(--bottomnav) + 24px + env(safe-area-inset-bottom)); max-width: 1480px; margin: 0 auto; }
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--bottomnav) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--black); display: grid; grid-template-columns: repeat(5, 1fr); }
.bottomnav a, .bottomnav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #9a9da4; font-size: 11px; background: none; border: 0; min-width: 0; position: relative; cursor: pointer; }
.bottomnav a.active { color: #fff; }
.bottomnav a.active svg { color: var(--accent); }
.bottomnav svg { width: 22px; height: 22px; }
.bottomnav .dot { position: absolute; top: 9px; left: calc(50% + 6px); min-width: 16px; height: 16px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }

@media (min-width: 768px) {
  .sidebar { transform: none; width: 76px; }
  .sidebar .brand img, .sidebar .brand-sub, .nav .label, .nav .count, .sidebar .me .who, .nav-sep { display: none; }
  .sidebar .brand { justify-content: center; padding: 16px 8px; }
  .sidebar .brand::after { content: ""; width: 36px; height: 36px; border-radius: 9px; background: var(--accent) url("/img/favicon.svg") center/cover; }
  .nav a { justify-content: center; padding: 10px; }
  .nav a .badge-dot { position: absolute; top: 6px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
  .sidebar .me { justify-content: center; }
  .sidebar.open { width: var(--sidebar); }
  .sidebar.open .brand img, .sidebar.open .brand-sub, .sidebar.open .nav .label, .sidebar.open .nav .count, .sidebar.open .me .who, .sidebar.open .nav-sep { display: block; }
  .sidebar.open .nav .label { display: block; }
  .sidebar.open .brand { justify-content: flex-start; padding: 18px 18px 14px; }
  .sidebar.open .brand::after { display: none; }
  .sidebar.open .nav a { justify-content: flex-start; padding: 9px 12px; }
  .sidebar.open .nav a .badge-dot { display: none; }
  .shell-body { margin-left: 76px; }
  .bottomnav, .topbar .mobile-logo { display: none; }
  .main { padding: 24px 24px 48px; }
  .topbar { padding: 0 24px; }
}
@media (min-width: 1200px) {
  .sidebar, .sidebar.open { width: var(--sidebar); box-shadow: none; }
  .sidebar .brand img, .sidebar .brand-sub, .nav .label, .nav .count, .sidebar .me .who, .nav-sep { display: block; }
  .sidebar .brand { justify-content: flex-start; padding: 18px 18px 14px; }
  .sidebar .brand::after, .nav a .badge-dot { display: none; }
  .nav a { justify-content: flex-start; padding: 9px 12px; }
  .sidebar .me { justify-content: flex-start; }
  .shell-body { margin-left: var(--sidebar); }
  .menu-btn { display: none !important; }
  .scrim { display: none; }
  .main { padding: 28px 32px 56px; }
}
@media (min-width: 1920px) { .main { max-width: 1640px; } }

/* ---------- Кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 9px 16px; border-radius: 11px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 560; font-size: 14px; cursor: pointer; transition: background .15s, border-color .15s, transform .05s, box-shadow .15s; white-space: nowrap; max-width: 100%; text-align: center; }
.btn > span { overflow: hidden; text-overflow: ellipsis; }
.btn:hover { border-color: var(--text-3); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-600); border-color: var(--accent-600); color: #fff; }
.btn.dark { background: var(--anthracite); border-color: var(--anthracite); color: #fff; }
.btn.dark:hover { background: var(--black); color: #fff; }
.btn.danger { color: var(--danger); border-color: #f1c3bf; }
.btn.danger:hover { background: var(--danger-50); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(0,0,0,.05); }
.btn.sm { min-height: 34px; padding: 5px 11px; font-size: 13px; border-radius: 9px; }
.btn.icon { padding: 0; width: 42px; min-width: 42px; }
.btn.icon.sm { width: 34px; min-width: 34px; }
.btn.block { width: 100%; }
.topbar .btn.icon { border: 0; background: transparent; position: relative; }
.topbar .btn.icon:hover { background: rgba(0,0,0,.06); }
.topbar .btn .dot { position: absolute; top: 6px; right: 5px; min-width: 17px; height: 17px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions.end { justify-content: flex-end; }
@media (max-width: 520px) {
  .actions.stack > .btn { flex: 1 1 100%; }
  .actions.stack-sm > .btn { flex: 1 1 calc(50% - 4px); }
}

/* ---------- Заголовок страницы ---------- */
.page-head { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; }
.page-head .h { min-width: 0; flex: 1 1 260px; }
.page-head .h p { margin: 4px 0 0; color: var(--text-2); }
.crumbs { font-size: 13px; color: var(--text-3); margin-bottom: 4px; display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--text-2); }

/* ---------- Карточки и сетки ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; min-width: 0; }
.card + .card { margin-top: 14px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-h h2, .card-h h3 { min-width: 0; }
.card.flat { box-shadow: none; }
.card.dark { background: var(--anthracite); color: #fff; border-color: var(--anthracite); }
.card.dark .muted { color: #b5b8bf; }
.card.accent { border-left: 3px solid var(--accent); }
.grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.grid > * { min-width: 0; }
.grid > .card + .card { margin-top: 0; }
@media (min-width: 600px) { .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) {
  .grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid.side { grid-template-columns: minmax(0, 1fr) 360px; }
  .grid.side-l { grid-template-columns: 320px minmax(0, 1fr); }
  .span2 { grid-column: span 2; }
}
@media (min-width: 1440px) { .grid.side { grid-template-columns: minmax(0, 1fr) 400px; } }
.stack > * + * { margin-top: 14px; }

/* KPI-плитки */
.kpi { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; min-width: 0; }
a.kpi:hover { border-color: var(--accent); color: inherit; transform: translateY(-1px); }
.kpi .k-label { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.kpi .k-value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; line-height: 1.1; }
.kpi .k-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.kpi.danger .k-value { color: var(--danger); }
.kpi.ok .k-value { color: var(--ok); }
.kpi.orange .k-value { color: var(--accent); }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 600px) { .kpis.k5 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); } }

/* ---------- Списки (вместо тяжёлых таблиц) ---------- */
.list { display: flex; flex-direction: column; }
.row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 4px; border-bottom: 1px solid var(--border); min-width: 0; }
.row:last-child { border-bottom: 0; }
a.row:hover { background: var(--surface-2); color: inherit; }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-weight: 560; overflow-wrap: anywhere; }
.row .meta { font-size: 13px; color: var(--text-2); display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 3px; }
.row .meta > * { min-width: 0; overflow-wrap: anywhere; }
.row .side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; max-width: 45%; text-align: right; }
@media (max-width: 520px) { .row { flex-wrap: wrap; } .row .side { max-width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; text-align: left; width: 100%; } }
.empty { text-align: center; color: var(--text-3); padding: 28px 12px; }
.empty svg { width: 36px; height: 36px; opacity: .4; display: block; margin: 0 auto 8px; }

/* Таблица с локальной прокруткой */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
table.t th, table.t td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table.t th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 600; background: var(--surface-2); position: sticky; top: 0; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Бейджи ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; background: #EEF1E7; color: var(--text-2); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.badge.ok { background: var(--ok-50); color: var(--ok); }
.badge.warn { background: var(--warn-50); color: var(--warn); }
.badge.danger { background: var(--danger-50); color: var(--danger); }
.badge.info { background: var(--info-50); color: var(--info); }
.badge.orange { background: var(--accent-50); color: var(--accent-600); }
.badge.dark { background: var(--anthracite); color: #fff; }
.prio { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; margin-top: 7px; }
.prio.low { background: #b9bcc2; } .prio.medium { background: var(--info); } .prio.high { background: var(--accent); } .prio.critical { background: var(--danger); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--anthracite-2); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; letter-spacing: .02em; }
.avatar.sm { width: 26px; height: 26px; font-size: 10px; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar.orange { background: var(--accent); }
.online-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); display: inline-block; }

/* ---------- Табы / сегменты ---------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 16px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button, .tabs a { background: none; border: 0; padding: 10px 12px; font-weight: 560; color: var(--text-2); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; min-height: 44px; font-size: 14px; }
.tabs .active { color: var(--text); border-bottom-color: var(--accent); }
.seg { display: inline-flex; background: #E9EDE1; border-radius: 11px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 560; color: var(--text-2); cursor: pointer; white-space: nowrap; min-height: 34px; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* ---------- Формы ---------- */
.form { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .form.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form .full { grid-column: 1 / -1; } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.req::after { content: " *"; color: var(--accent); }
.input, select.input, textarea.input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); font-size: 16px; transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none; }
select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%238a8d94' stroke-width='1.8'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
textarea.input { min-height: 96px; resize: vertical; line-height: 1.45; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,148,68,.15); outline: none; }
@media (min-width: 768px) { .input, select.input, textarea.input { font-size: 15px; } }
.check { display: flex; align-items: flex-start; gap: 10px; min-height: 32px; cursor: pointer; font-size: 14px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; margin-top: 1px; }
.search { position: relative; flex: 1 1 220px; min-width: 0; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 38px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.filters > select.input, .filters > .input { flex: 1 1 160px; width: auto; min-width: 0; }
@media (min-width: 900px) { .filters > select.input { flex: 0 1 200px; } }

/* Выбор участников */
.picker { border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); }
.picker .chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; min-height: 44px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--cream); border-radius: 20px; padding: 3px 4px 3px 10px; font-size: 13px; max-width: 100%; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button { border: 0; background: rgba(0,0,0,.08); width: 28px; height: 28px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; flex: none; padding: 0; }
.picker input { border: 0; outline: none; flex: 1 1 140px; min-width: 120px; min-height: 30px; font-size: 15px; background: transparent; }
.picker .opts { border-top: 1px solid var(--border); max-height: 220px; overflow-y: auto; }
.picker .opt { display: flex; gap: 10px; align-items: center; padding: 9px 12px; cursor: pointer; min-height: 44px; }
.picker .opt:hover, .picker .opt.hl { background: var(--surface-2); }
.picker .opt small { color: var(--text-3); display: block; }

/* Загрузка файлов */
.drop { display: block; line-height: 1.45; border: 1.5px dashed var(--border-strong); border-radius: 12px; padding: 16px; text-align: center; color: var(--text-2); cursor: pointer; transition: border-color .15s, background .15s; font-size: 14px; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-50); }
.files { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.file { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; min-width: 0; }
.file .fi { width: 32px; height: 32px; border-radius: 8px; background: var(--accent-50); color: var(--accent-600); display: grid; place-items: center; font-size: 10px; font-weight: 700; flex: none; text-transform: uppercase; }
.file .fn { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 14px; }
.file .fn small { display: block; color: var(--text-3); }

/* ---------- Модальные окна ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(13,14,16,.5); z-index: 60; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; padding: 0; }
.modal { background: var(--surface); width: 100%; max-height: calc(100dvh - 24px); border-radius: 18px 18px 0 0; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: up .22s var(--ease); max-width: 100vw; }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.modal-h h2 { flex: 1; min-width: 0; font-size: 17px; }
.modal-b { padding: 16px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.modal-f { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
@media (max-width: 520px) { .modal-f .btn { flex: 1 1 calc(50% - 4px); } }
@media (min-width: 640px) {
  .modal-back { align-items: center; padding: 24px; }
  .modal { border-radius: 18px; width: min(640px, 100%); max-height: calc(100dvh - 48px); }
  .modal.wide { width: min(920px, 100%); }
  .modal.narrow { width: min(440px, 100%); }
}
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }

/* ---------- Тосты ---------- */
#toast-root { position: fixed; z-index: 80; left: 12px; right: 12px; bottom: calc(var(--bottomnav) + 12px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
@media (min-width: 768px) { #toast-root { left: auto; right: 24px; bottom: 24px; align-items: flex-end; } }
.toast { background: var(--anthracite); color: #fff; padding: 11px 14px; border-radius: 12px; box-shadow: var(--shadow-lg); max-width: min(420px, 100%); font-size: 14px; animation: up .2s var(--ease); pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; overflow-wrap: anywhere; }
.toast.err { background: var(--danger); }
.toast.ok::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 7px; flex: none; }
.toast a { color: #fff; text-decoration: underline; }

/* ---------- Логин ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); background: var(--surface); }
.auth .art { display: none; background: var(--black); color: #fff; padding: 48px; position: relative; overflow: hidden; }
.auth .art::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; border: 60px solid var(--accent); opacity: .9; }
.auth .art img { display: none; }
.auth .art h2 { color: var(--cream); font-size: 34px; max-width: 520px; margin-top: 22vh; letter-spacing: -.02em; }
.auth .art p { color: #C9CCDC; max-width: 460px; font-size: 16px; margin-top: 14px; }
.auth .pane { display: flex; flex-direction: column; justify-content: center; padding: 32px 20px; max-width: 440px; width: 100%; margin: 0 auto; }
.auth .pane .logo { width: 180px; margin-bottom: 28px; display: block; }
.auth .pane h1 { font-size: 24px; margin-bottom: 6px; }
@media (min-width: 960px) { .auth { grid-template-columns: 1.1fr 1fr; } .auth .art { display: block; } }
.alert { padding: 10px 12px; border-radius: 10px; font-size: 14px; background: var(--info-50); color: var(--info); overflow-wrap: anywhere; }
.alert.err { background: var(--danger-50); color: var(--danger); }
.alert.warn { background: var(--warn-50); color: #8a5d00; }
.alert.ok { background: var(--ok-50); color: var(--ok); }

/* ---------- Диаграммы ---------- */
.chart { width: 100%; height: auto; max-height: 260px; display: block; }
.donut-wrap { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.donut-wrap svg { width: 132px; height: 132px; flex: none; }
.legend { display: flex; flex-direction: column; gap: 6px; font-size: 13px; min-width: 0; flex: 1 1 140px; }
.legend span { display: flex; align-items: center; gap: 8px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.bar { height: 8px; border-radius: 4px; background: #E9EDE1; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.bar.ok > i { background: var(--ok); }

/* ---------- Собрание: zoom-баннер ---------- */
.join { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; background: var(--anthracite); color: #fff; border-radius: var(--radius); padding: 14px 16px; }
.join .info { min-width: 0; flex: 1 1 240px; }
.join .info b { display: block; }
.join .info span { color: #b5b8bf; font-size: 13px; overflow-wrap: anywhere; }

/* Повестка (перетаскивание) */
.agenda-item { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); margin-bottom: 8px; min-width: 0; }
.agenda-item.dragging { opacity: .5; }
.agenda-item.drop-target { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(0,148,68,.2); }
.agenda-item .handle { cursor: grab; color: var(--text-3); padding: 4px; flex: none; touch-action: none; }
.agenda-item .num { width: 26px; height: 26px; border-radius: 8px; background: var(--anthracite); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }

/* Протокол */
.mitem { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 14px; overflow: hidden; }
.mitem-h { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.mitem-h .grow { flex: 1 1 200px; min-width: 0; }
.mitem-b { padding: 14px 16px; }
.decision { border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 10px; padding: 12px; margin-top: 10px; background: var(--surface); }
.decision .dn { font-weight: 700; color: var(--accent-600); margin-right: 6px; }
.steps { display: flex; gap: 0; margin: 4px 0 16px; overflow-x: auto; scrollbar-width: none; }
.steps::-webkit-scrollbar { display: none; }
.step { flex: 1 1 0; min-width: 120px; padding: 8px 10px 8px 0; position: relative; font-size: 12px; color: var(--text-3); }
.step::before { content: ""; display: block; height: 4px; border-radius: 2px; background: var(--border); margin-bottom: 8px; margin-right: 4px; }
.step.done { color: var(--text-2); } .step.done::before { background: var(--anthracite); }
.step.cur { color: var(--text); font-weight: 600; } .step.cur::before { background: var(--accent); }

/* Таймлайн/история */
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl { position: relative; padding: 0 0 14px; font-size: 14px; }
.tl::before { content: ""; position: absolute; left: -17px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--text-3); }
.tl.o::before { border-color: var(--accent); }
.tl small { display: block; color: var(--text-3); }

/* ---------- Чаты ---------- */
.chat-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; height: calc(100dvh - var(--topbar) - var(--bottomnav) - 48px); min-height: 420px; }
@media (min-width: 768px) { .chat-layout { grid-template-columns: 300px minmax(0, 1fr); height: calc(100dvh - var(--topbar) - 60px); } }
.chat-list { overflow-y: auto; padding: 6px; }
.chat-list a { display: flex; gap: 10px; padding: 10px; border-radius: 10px; align-items: center; min-width: 0; }
.chat-list a.active, .chat-list a:hover { background: var(--surface-2); color: inherit; }
.chat-list .cl { flex: 1; min-width: 0; }
.chat-list .cl b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-list .cl span { display: block; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-box { display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; }
.chat-box.embedded { height: 520px; max-height: 70vh; }
.chat-head { padding: 12px 14px; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: center; }
.chat-head b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); overscroll-behavior: contain; }
.msg { display: flex; gap: 8px; max-width: 88%; align-items: flex-end; }
.msg.me { margin-left: auto; flex-direction: row-reverse; }
.bubble { background: var(--surface); border: 1px solid var(--border); padding: 8px 11px; border-radius: 14px 14px 14px 4px; min-width: 0; font-size: 14px; position: relative; }
.msg.me .bubble { background: var(--anthracite); color: #fff; border-color: var(--anthracite); border-radius: 14px 14px 4px 14px; }
.bubble .who { font-size: 12px; font-weight: 650; color: var(--accent-600); margin-bottom: 2px; }
.msg.me .bubble .who { display: none; }
.bubble .txt { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble .txt .mention { color: var(--accent-600); font-weight: 600; }
.msg.me .bubble .txt .mention { color: #EBF8C8; }
.bubble .when { font-size: 11px; color: var(--text-3); margin-top: 3px; display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.msg.me .bubble .when { color: #9a9da4; }
.bubble .quote { border-left: 3px solid var(--accent); padding: 2px 8px; margin-bottom: 4px; font-size: 12px; opacity: .85; overflow-wrap: anywhere; }
.bubble .reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.bubble .reacts button { border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 0 6px; font-size: 12px; cursor: pointer; min-height: 24px; color: var(--text); }
.bubble .reacts button.mine { border-color: var(--accent); background: var(--accent-50); }
.msg-tools { display: flex; gap: 2px; opacity: 0; transition: opacity .15s; flex: none; }
.msg:hover .msg-tools, .msg:focus-within .msg-tools { opacity: 1; }
@media (hover: none) { .msg-tools { opacity: .7; } }
.msg-tools button { border: 0; background: none; cursor: pointer; padding: 4px; border-radius: 6px; color: var(--text-3); min-width: 28px; min-height: 28px; }
.composer { border-top: 1px solid var(--border); padding: 10px; display: flex; gap: 8px; align-items: flex-end; background: var(--surface); flex-wrap: wrap; }
.composer textarea { flex: 1 1 200px; min-height: 44px; max-height: 140px; resize: none; }
.composer .reply-to { flex: 1 1 100%; font-size: 12px; background: var(--surface-2); border-left: 3px solid var(--accent); padding: 4px 8px; border-radius: 4px; display: flex; gap: 8px; align-items: center; }
.composer .reply-to span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mention-pop { position: absolute; bottom: 100%; left: 10px; right: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 200px; overflow-y: auto; z-index: 5; }
.mention-pop div { padding: 9px 12px; cursor: pointer; } .mention-pop div:hover, .mention-pop div.hl { background: var(--surface-2); }
@media (max-width: 767px) { .chat-layout.has-chat .chat-side { display: none; } .chat-layout:not(.has-chat) .chat-main { display: none; } }

/* ---------- Календарь ---------- */
.cal-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.cal-toolbar .period { font-weight: 650; font-size: 16px; flex: 1 1 160px; min-width: 0; }
.cal-toolbar .period::first-letter, .cap::first-letter { text-transform: uppercase; }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--border); gap: 1px; }
.cal-month .dow { background: var(--surface-2); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 8px 6px; text-align: center; }
.cal-month .day { background: var(--surface); min-height: 104px; padding: 6px; min-width: 0; cursor: pointer; }
.cal-month .day.other { background: var(--surface-2); color: var(--text-3); }
.cal-month .day.today .dn { background: var(--accent); color: #fff; }
.cal-month .dn { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.cal-month .ev { display: block; font-size: 12px; padding: 2px 6px; border-radius: 6px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid; background: var(--surface-2); }
.cal-month .more { font-size: 11px; color: var(--text-2); padding-left: 4px; }
@media (max-width: 640px) {
  .cal-month .day { min-height: 54px; padding: 4px 2px; }
  .cal-month .ev { display: none; }
  .cal-month .dots { display: flex; gap: 2px; justify-content: center; flex-wrap: wrap; }
  .cal-month .dots i { width: 6px; height: 6px; border-radius: 50%; }
  .cal-month .dn { margin: 0 auto 2px; }
}
@media (min-width: 641px) { .cal-month .dots { display: none; } }
.cal-time { display: grid; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal-time-scroll { overflow: auto; max-height: 70vh; -webkit-overflow-scrolling: touch; }
.cal-grid { display: grid; position: relative; }
.cal-sticky { position: sticky; top: 0; z-index: 3; }
.cal-head { display: grid; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cal-head div { padding: 8px 4px; text-align: center; font-size: 12px; color: var(--text-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-head div.today { color: var(--accent-600); font-weight: 700; }
.cal-hours { border-right: 1px solid var(--border); }
.cal-hours div { height: 48px; font-size: 11px; color: var(--text-3); text-align: right; padding: 2px 6px 0 0; }
.cal-col { position: relative; border-right: 1px solid var(--border); min-width: 0; background-image: repeating-linear-gradient(to bottom, transparent 0 47px, var(--border) 47px 48px); }
.cal-col:last-child { border-right: 0; }
.cal-ev { position: absolute; border-radius: 7px; padding: 3px 6px; font-size: 12px; overflow: hidden; border-left: 3px solid; cursor: pointer; line-height: 1.3; min-height: 20px; background: var(--surface-2); }
.cal-ev b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.cal-ev span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.cal-ev.masked { background: repeating-linear-gradient(45deg, #f0f0ee, #f0f0ee 6px, #e8e8e5 6px, #e8e8e5 12px); border-left-color: #a8abb1; cursor: default; }
.allday { display: grid; border-bottom: 1px solid var(--border); background: var(--surface); }
.allday > div { padding: 3px; min-width: 0; border-right: 1px solid var(--border); }
.allday .ev { display: block; font-size: 11px; padding: 2px 5px; border-radius: 5px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--danger-50); color: var(--danger); cursor: pointer; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--accent); z-index: 2; }
.now-line::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.cat-management { border-left-color: #23253F !important; } .cat-contractor { border-left-color: #8a5d00 !important; } .cat-education { border-left-color: #7CB342 !important; }
.cat-work { border-left-color: #2f6fd6 !important; } .cat-personal { border-left-color: #8f56c9 !important; } .cat-online { border-left-color: #009444 !important; }
.cat-control { border-left-color: #d63a2f !important; } .cat-important { border-left-color: #c2185b !important; } .cat-report { border-left-color: #00838f !important; }
.cat-dot-management { background: #23253F; } .cat-dot-contractor { background: #8a5d00; } .cat-dot-education { background: #7CB342; } .cat-dot-work { background: #2f6fd6; }
.cat-dot-personal { background: #8f56c9; } .cat-dot-online { background: #009444; } .cat-dot-control { background: #d63a2f; } .cat-dot-important { background: #c2185b; } .cat-dot-report { background: #00838f; } .cat-dot-busy { background: #a8abb1; }
.legend-row { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-2); margin-top: 10px; }
.legend-row span { display: inline-flex; align-items: center; gap: 6px; }
.legend-row i { width: 10px; height: 10px; border-radius: 3px; }
/* Занятость сотрудников */
.people { display: flex; flex-direction: column; gap: 8px; }
.person { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
@media (min-width: 900px) { .person { grid-template-columns: 260px minmax(0, 1fr); align-items: center; } }
.person .pn { display: flex; gap: 10px; align-items: center; min-width: 0; }
.person .pn div { min-width: 0; }
.person .pn b { display: block; font-size: 14px; overflow-wrap: anywhere; }
.person .pn small { display: block; color: var(--text-3); font-size: 12px; overflow-wrap: anywhere; }
.track { position: relative; height: 30px; background: repeating-linear-gradient(to right, var(--surface-2) 0, var(--surface-2) calc(100% / 9 - 1px), var(--border) calc(100% / 9 - 1px), var(--border) calc(100% / 9)); border-radius: 8px; overflow: hidden; }
.track .blk { position: absolute; top: 3px; bottom: 3px; border-radius: 6px; background: var(--anthracite); color: #fff; font-size: 11px; padding: 0 6px; display: flex; align-items: center; overflow: hidden; white-space: nowrap; min-width: 4px; }
.track .blk.tentative { background: #9a9da4; } .track .blk.ooo, .track .blk.trip { background: var(--info); } .track .blk.vacation { background: var(--ok); }
.track-hours { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-3); padding: 0 2px; }
.person .blist { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.slot { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 6px; flex-wrap: wrap; }

/* ---------- Прочее ---------- */
.kv { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px 16px; font-size: 14px; }
.kv > div > span { display: block; font-size: 12px; color: var(--text-3); margin-bottom: 1px; }
.kv > div > b { font-weight: 560; overflow-wrap: anywhere; }
@media (min-width: 560px) { .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.notif { display: flex; gap: 12px; padding: 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.notif.unread { background: var(--accent-50); }
.notif .grow { flex: 1; min-width: 0; }
.notif .t { font-weight: 600; overflow-wrap: anywhere; }
.notif .b { font-size: 13px; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.hello { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.hello h1 { font-size: 24px; }
@media (min-width: 768px) { .hello h1 { font-size: 28px; } }
.clock { text-align: right; } .clock b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; } .clock span { color: var(--text-2); font-size: 13px; }
@media (max-width: 560px) { .clock { text-align: left; } }
.rank { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.rank:last-child { border-bottom: 0; }
.rank .pos { width: 26px; text-align: center; font-weight: 700; color: var(--text-3); flex: none; }
.rank .grow { flex: 1; min-width: 0; }
.rank .score { font-weight: 700; font-variant-numeric: tabular-nums; flex: none; }
.perm-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px 16px; }
@media (min-width: 720px) { .perm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.locked { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--ok-50); color: var(--ok); font-size: 14px; font-weight: 560; }
@media print {
  .sidebar, .topbar, .bottomnav, .no-print, .btn { display: none !important; }
  .shell-body { margin: 0 !important; } .main { padding: 0 !important; } .card { box-shadow: none; border: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
