/* =========================================================
   ИКТ HUP — адаптивная тема (light/dark), mobile-first
   ========================================================= */

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --text-soft: #334155;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --primary-text: #3730a3;

  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --info: #0284c7;
  --info-soft: #f0f9ff;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 14px 34px rgba(15, 23, 42, .07);

  --radius: 16px;
  --radius-sm: 10px;
  --sidebar-w: 264px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #0a0f1c;
  --surface: #111a2c;
  --surface-2: #0e1626;
  --text: #e8eefc;
  --text-soft: #c7d2e5;
  --muted: #8ea0bd;
  --border: #1e2a44;
  --border-strong: #2b3a5c;

  --primary: #7c8cff;
  --primary-hover: #93a0ff;
  --primary-soft: #1b2447;
  --primary-text: #c7d2fe;

  --success: #34d399;
  --success-soft: #0c2a22;
  --warning: #fbbf24;
  --warning-soft: #2a210c;
  --danger: #f87171;
  --danger-soft: #2c1216;
  --info: #38bdf8;
  --info-soft: #0b2533;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .45);
  --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 18px 44px rgba(0, 0, 0, .38);
}

html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input { font: inherit; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px;
}

[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  vertical-align: middle;
  flex: none;
}

/* ---------- Каркас ---------- */

.app { min-height: 100dvh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 18px 14px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  transition: transform .25s ease;
}

.content {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  margin-left: var(--sidebar-w);
  transition: margin-left .25s ease;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 28px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

@supports (backdrop-filter: blur(12px)) {
  .topbar {
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: blur(12px);
  }
}

.topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.page {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 26px 28px 44px;
}

/* ---------- Сайдбар ---------- */

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  color: var(--text);
  min-width: 0;
}
.brand:hover { text-decoration: none; }

.brand-mark {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(79, 70, 229, .35);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: 16px; }
.brand-text small { color: var(--muted); font-size: 11px; }

.side-nav { display: flex; flex-direction: column; gap: 2px; }

.nav-caption {
  margin: 14px 10px 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 8px 10px 8px 12px;
  border-radius: 10px;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
  transition: background-color .18s ease, color .18s ease, box-shadow .18s ease;
}
.nav-link > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-link .icon {
  width: 18px;
  height: 18px;
  color: var(--muted);
  transition: color .18s ease, transform .18s ease;
}
.nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}
.nav-link:hover .icon { color: var(--text-soft); transform: translateX(1px); }
.nav-link.is-active {
  background: linear-gradient(90deg, var(--primary-soft), transparent 92%);
  color: var(--primary-text);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 18%, transparent);
}
.nav-link.is-active::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 50%;
  width: 3px;
  height: 18px;
  border-radius: 999px;
  background: var(--primary);
  transform: translateY(-50%);
}
.nav-link.is-active .icon { color: var(--primary); }
.nav-link.is-disabled { opacity: .55; cursor: not-allowed; }

.soon {
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.side-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px; min-width: 0; }
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-meta strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta small { color: var(--muted); font-size: 11px; }

.avatar {
  width: 38px;
  height: 38px;
  flex: none;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--primary-soft);
  color: var(--primary-text);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}
.avatar-sm { width: 30px; height: 30px; font-size: 11px; }

/* ---------- Кнопки ---------- */

.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.icon-btn .icon { width: 19px; height: 19px; }

.menu-btn { display: none; }
.collapse-btn { display: none; }

.icon-sun { display: none; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn .icon { width: 17px; height: 17px; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 16px rgba(79, 70, 229, .25);
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-soft);
}
.btn-ghost:hover { background: var(--surface-2); }

.btn-block { width: 100%; }

.btn:disabled,
.btn.is-disabled {
  opacity: .5;
  cursor: not-allowed;
  box-shadow: none;
}

/* ---------- Заголовок страницы ---------- */

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

h1 {
  margin: 0 0 4px;
  font-size: clamp(22px, 2.4vw, 28px);
  line-height: 1.2;
  letter-spacing: -.02em;
}

h2 { font-size: 15px; margin: 0; }

.page-sub { margin: 0; color: var(--muted); font-size: 13px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Поиск и фильтры ---------- */

.toolbar { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }

.search { position: relative; width: 100%; max-width: 420px; }
.search input {
  width: 100%;
  padding: 10px 12px 10px 38px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--muted);
  pointer-events: none;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

/* Отступ между вкладками-категориями и списком уведомлений */
.chips + .notification-list,
.chips + .empty { margin-top: 16px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.chip:hover { border-color: var(--border-strong); text-decoration: none; }
.chip.is-active { background: var(--text); border-color: var(--text); color: var(--surface); }

.chip-count {
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}
.chip.is-active .chip-count { background: rgba(148, 163, 184, .25); color: inherit; }

/* ---------- Карточки дел ---------- */

.task-list { display: flex; flex-direction: column; gap: 10px; }

.task-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px 18px 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: inherit;
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.task-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--stripe, var(--border));
}
.task-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
  text-decoration: none;
}

.task-card--new { --stripe: var(--info); }
.task-card--in_progress { --stripe: var(--primary); }
.task-card--on_approval { --stripe: var(--warning); }
.task-card--blocked { --stripe: var(--danger); }
.task-card--waiting { --stripe: var(--muted); }
.task-card--done { --stripe: var(--success); }
.task-card--cancelled { --stripe: var(--border-strong); }
.task-card.is-overdue { border-color: color-mix(in srgb, var(--danger) 38%, var(--border)); }

.task-main { min-width: 0; }

.task-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.task-number {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.task-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.35;
  color: var(--text);
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--muted);
}

.meta-item { display: inline-flex; align-items: center; gap: 5px; }
.meta-item .icon { width: 14px; height: 14px; }
.meta-muted { opacity: .85; }

.task-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  text-align: right;
}

.task-due { display: flex; align-items: center; gap: 8px; color: var(--text-soft); }
.task-due .icon { width: 16px; height: 16px; color: var(--muted); }
.task-due-label {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.task-due strong { display: block; font-size: 13px; font-weight: 600; }
.task-due small { color: var(--muted); font-weight: 400; }
.task-due.is-danger, .task-due.is-danger .icon { color: var(--danger); }

/* ---------- Бейджи ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-status-new { background: var(--info-soft); color: var(--info); }
.badge-status-in_progress { background: var(--primary-soft); color: var(--primary-text); }
.badge-status-on_approval { background: var(--warning-soft); color: var(--warning); }
.badge-status-waiting { background: var(--surface-2); color: var(--text-soft); }
.badge-status-blocked { background: var(--danger-soft); color: var(--danger); }
.badge-status-done { background: var(--success-soft); color: var(--success); }
.badge-status-cancelled { background: var(--surface-2); color: var(--muted); }

.badge-priority-low { background: var(--surface-2); color: var(--muted); }
.badge-priority-normal { background: var(--info-soft); color: var(--info); }
.badge-priority-high { background: var(--danger-soft); color: var(--danger); }
.badge-priority-critical { background: var(--danger); color: #fff; }

.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-muted { background: var(--surface-2); color: var(--muted); }

/* ---------- Пагинация ---------- */

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}
.pager-info { color: var(--muted); font-size: 13px; }

/* ---------- Пустое состояние ---------- */

.empty {
  max-width: 560px;
  margin: 24px auto 0;
  padding: 64px 28px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.empty-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  border-radius: 20px;
  background: var(--primary-soft);
  color: var(--primary);
}
.empty-icon .icon { width: 28px; height: 28px; }
.empty h2 { margin-bottom: 8px; font-size: 19px; }
.empty p { margin: 0 auto; max-width: 420px; }
.empty .btn { margin-top: 18px; }

/* ---------- Карточка дела ---------- */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.back-link .icon { width: 16px; height: 16px; }

.detail-head { margin-bottom: 20px; }
.detail-head h1 { margin: 4px 0 10px; }

.badges { display: flex; gap: 8px; flex-wrap: wrap; }

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.card {
  margin-bottom: 16px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card h2 {
  margin: 0 0 12px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.card-head h2 { margin: 0; }
.card-head strong { font-size: 14px; }

.pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }

.props { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.props div { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.props dt { color: var(--muted); }
.props dd { margin: 0; text-align: right; font-weight: 500; }

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.checklist li:last-child { border-bottom: 0; }
.check-mark {
  width: 20px;
  height: 20px;
  flex: none;
  margin-top: 1px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--border-strong);
  border-radius: 6px;
  color: transparent;
}
.checklist li.is-done .check-mark { background: var(--success); border-color: var(--success); color: #fff; }
.checklist li.is-done > span:last-child { color: var(--muted); text-decoration: line-through; }
.check-mark .icon { width: 13px; height: 13px; }

.progress {
  height: 8px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.progress-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--success), #34d399);
  transition: width .3s ease;
}

.comment {
  display: flex;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.comment:last-child { border-bottom: 0; }
.comment-body { flex: 1; min-width: 0; }
.comment-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.comment-head strong { font-size: 13px; }
.comment p { margin: 0; }

.time-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.time-entry:last-child { border-bottom: 0; }

.approval { padding: 8px 0; border-bottom: 1px solid var(--border); }
.approval:last-child { border-bottom: 0; }
.approval p { margin: 6px 0 0; }

.links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }

/* ---------- Утилиты ---------- */

.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.danger { color: var(--danger); }

.messages { list-style: none; margin: 0 0 16px; padding: 0; }
.message {
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13px;
}
.message.success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.message.error { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: .92em;
}

/* ---------- Вход ---------- */

.auth-body {
  background:
    radial-gradient(900px 500px at 8% -10%, var(--primary-soft), transparent 62%),
    radial-gradient(700px 420px at 108% 108%, var(--info-soft), transparent 60%),
    var(--bg);
}

.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.auth-brand { padding: 0; margin-bottom: 20px; }
.auth-card h1 { font-size: 22px; margin-bottom: 2px; }
.auth-sub { margin: 0 0 18px; color: var(--muted); font-size: 13px; }

.auth-form { display: flex; flex-direction: column; gap: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-soft); }
.field input {
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--text);
  outline: none;
}
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.auth-hint { margin: 16px 0 0; text-align: center; color: var(--muted); font-size: 12px; }

.alert { padding: 10px 12px; margin-bottom: 14px; border-radius: var(--radius-sm); font-size: 13px; }
.alert-danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- Мобильная навигация ---------- */

.bottom-nav { display: none; }

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(2, 6, 23, .55);
  backdrop-filter: blur(2px);
}

/* ---------- Адаптив ---------- */

@media (min-width: 1024px) {
  .collapse-btn { display: inline-grid; }

  html.sidebar-collapsed .sidebar { transform: translateX(-100%); }
  html.sidebar-collapsed .content { margin-left: 0; }
  html.sidebar-collapsed .collapse-btn {
    background: var(--primary-soft);
    border-color: transparent;
    color: var(--primary);
  }
}

@media (max-width: 1023px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--shadow);
  }
  body.menu-open .sidebar { transform: translateX(0); }
  body.menu-open { overflow: hidden; }

  .content { margin-left: 0; }
  .menu-btn { display: inline-grid; }
}

@media (max-width: 767px) {
  .page { padding: 18px 16px calc(88px + env(safe-area-inset-bottom)); }
  .topbar { padding: 10px 14px; }
  .topbar-title { font-size: 14px; }

  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 44;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--border);
  }
  @supports (backdrop-filter: blur(12px)) {
    .bottom-nav {
      background: color-mix(in srgb, var(--surface) 90%, transparent);
      backdrop-filter: blur(12px);
    }
  }

  .bottom-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 4px;
    border: 0;
    border-radius: 10px;
    background: none;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
  }
  .bottom-link .icon { width: 20px; height: 20px; }
  .bottom-link.is-active { color: var(--primary); background: var(--primary-soft); }
  .bottom-link.is-disabled { opacity: .5; cursor: not-allowed; }

  .page-head { margin-bottom: 14px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }

  .search { max-width: none; }

  .task-card {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px 14px 14px 16px;
  }
  .task-side {
    flex-direction: row-reverse;
    align-items: center;
    justify-content: space-between;
    text-align: left;
  }
  .task-title { font-size: 15px; }

  .detail-grid { grid-template-columns: 1fr; }
  .card { padding: 16px; }
}

@media (max-width: 420px) {
  .task-meta { gap: 8px; font-size: 12px; }
  .badge { font-size: 11px; padding: 2px 7px; }
  .task-line { gap: 6px; }
  .auth-card { padding: 22px; border-radius: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

/* Контраст в тёмной теме */
[data-theme="dark"] .btn-primary { color: #0b1220; }
[data-theme="dark"] .badge-priority-critical { color: #1a0a0a; }


/* =========================================================
   Обзор, Service Desk, Склад
   ========================================================= */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: inherit;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.stat-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
  text-decoration: none;
}
.stat-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.stat-value { font-size: 28px; font-weight: 750; letter-spacing: -.02em; line-height: 1.15; }
.stat-hint { font-size: 11.5px; color: var(--muted); }

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.dashboard-grid .card { margin-bottom: 16px; }

.section-link { font-size: 12.5px; font-weight: 600; }

.mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  color: inherit;
}
.mini-row:last-child { border-bottom: 0; }
.mini-row:hover { text-decoration: none; }
.mini-main { min-width: 0; }
.mini-title {
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-meta {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-list { display: flex; flex-direction: column; gap: 10px; }

.item-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px 18px 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.item-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--stripe, var(--border));
}
.item-card--new { --stripe: var(--info); }
.item-card--accepted,
.item-card--in_progress { --stripe: var(--primary); }
.item-card--on_approval { --stripe: var(--warning); }
.item-card--fulfilled,
.item-card--resolved { --stripe: var(--success); }
.item-card--rejected,
.item-card--cancelled { --stripe: var(--danger); }
.item-card--closed,
.item-card--waiting { --stripe: var(--muted); }

.item-main { min-width: 0; }
.item-title { margin: 0 0 6px; font-size: 15.5px; font-weight: 650; line-height: 1.35; }
.item-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  text-align: right;
}

.btn-sm { padding: 7px 11px; font-size: 13px; border-radius: 9px; }

.badge-status-accepted { background: var(--primary-soft); color: var(--primary-text); }
.badge-status-fulfilled { background: var(--success-soft); color: var(--success); }
.badge-status-rejected { background: var(--danger-soft); color: var(--danger); }
.badge-status-resolved { background: var(--success-soft); color: var(--success); }
.badge-status-closed { background: var(--surface-2); color: var(--muted); }

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th,
.table td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
.table th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.is-low td { background: var(--warning-soft); }

.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.select {
  min-width: 170px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}
.select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

@media (max-width: 1023px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-value { font-size: 24px; }

  .item-card { grid-template-columns: 1fr; gap: 10px; padding: 14px 14px 14px 16px; }
  .item-side {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    text-align: left;
  }

  .filter-row { flex-direction: column; align-items: stretch; }
  .select { width: 100%; }

  .table thead { display: none; }
  .table,
  .table tbody,
  .table tr,
  .table td { display: block; width: 100%; }
  .table tr { padding: 10px 14px; border-bottom: 1px solid var(--border); }
  .table tr:last-child { border-bottom: 0; }
  .table td {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 4px 0;
    border: 0;
    text-align: right;
  }
  .table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-align: left;
  }
  .table tr.is-low,
  .table tr.is-low td { background: var(--warning-soft); }

  .mini-title,
  .mini-meta { white-space: normal; }
}

@media (max-width: 420px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* =========================================================
   Формы, действия, таймер
   ========================================================= */

.form-card {
  max-width: 840px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.field-full { grid-column: 1 / -1; }

.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-soft); }
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--text);
  outline: none;
}
.field textarea { min-height: 80px; resize: vertical; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.field small { display: block; margin-top: 4px; }

.errorlist {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  color: var(--danger);
  font-size: 12px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-soft);
}
.checkbox input { width: auto; }

.action-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.action-bar form { display: inline-flex; align-items: center; gap: 6px; margin: 0; }

.timer-form { display: inline-flex; align-items: center; gap: 8px; }

.action-drawer summary { list-style: none; cursor: pointer; }
.action-drawer summary::-webkit-details-marker { display: none; }

.drawer-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 280px;
  margin-top: 10px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.drawer-form .field { margin-bottom: 0; }

.approval-box {
  margin-bottom: 16px;
  padding: 16px;
  background: var(--warning-soft);
  border: 1px solid color-mix(in srgb, var(--warning) 35%, var(--border));
  border-radius: var(--radius);
}
.approval-box h2 {
  margin: 0 0 10px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--warning);
}

.check-form { display: flex; margin: 0; }
.check-mark {
  width: 22px;
  height: 22px;
  flex: none;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1.5px solid var(--border-strong);
  border-radius: 6px;
  background: transparent;
  color: transparent;
  cursor: pointer;
}
.check-mark:disabled { cursor: default; opacity: .7; }
.checklist li.is-done .check-mark { background: var(--success); border-color: var(--success); color: #fff; }

.comment-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.comment-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

@media (max-width: 767px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
  .drawer-form { min-width: 0; width: 100%; }
  .action-bar { align-items: stretch; }
  .action-bar form { flex: 1 1 auto; }
  .action-bar .btn { flex: 1; }
}

/* =========================================================
   Чат
   ========================================================= */

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 180px;
  max-height: 420px;
  padding: 4px 2px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.chat-message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.chat-bubble {
  min-width: 0;
  max-width: min(640px, 85%);
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.chat-bubble p { margin: 0; font-size: 14px; }

.chat-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 11.5px;
  color: var(--muted);
}
.chat-meta strong { font-size: 12.5px; color: var(--text-soft); }

.chat-voice { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.chat-voice audio { width: 240px; max-width: 100%; height: 36px; }

.chat-image {
  display: block;
  max-width: 260px;
  max-height: 200px;
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.chat-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 13px;
}

.chat-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
}
.chat-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}
.chat-status.is-online { color: var(--success); }
.chat-status.is-online::before { background: var(--success); }
.chat-status.is-offline { color: var(--warning); }
.chat-status.is-offline::before { background: var(--warning); }
.chat-status.is-denied { color: var(--danger); }
.chat-status.is-denied::before { background: var(--danger); }
.chat-status.is-upload { color: var(--info); }
.chat-status.is-upload::before { background: var(--info); }

.chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.chat-composer textarea {
  flex: 1;
  min-height: 42px;
  max-height: 120px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  outline: none;
  resize: none;
}
.chat-composer textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.chat-icon {
  width: 42px;
  height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
}
.chat-icon:hover { background: var(--surface-2); }
.chat-icon.is-recording {
  color: var(--danger);
  border-color: var(--danger);
  animation: chat-pulse 1.2s infinite;
}

.chat-send { height: 42px; }

.chat-recording {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  border-radius: 12px;
  color: var(--danger);
  font-size: 13px;
}
.chat-recording .btn:first-of-type { margin-left: auto; }

.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
  animation: chat-pulse 1.2s infinite;
}

.chat-error {
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--danger-soft);
  border-radius: 10px;
  color: var(--danger);
  font-size: 13px;
}

.chat-empty { padding: 24px 0; text-align: center; }

@keyframes chat-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

@media (max-width: 767px) {
  .chat-bubble { max-width: calc(100% - 42px); }
  .chat-send span { display: none; }
  .chat-send { width: 42px; padding: 0; }
  .chat-voice audio { width: 180px; }
}

/* =========================================================
   Пользователи и просмотр вложений
   ========================================================= */

.user-cell { display: flex; align-items: center; gap: 8px; }
.user-cell .avatar { text-transform: uppercase; }

.viewer-title { word-break: break-word; }

.viewer { padding: 18px; }

.viewer-image {
  display: block;
  max-width: 100%;
  max-height: 78vh;
  margin: 0 auto;
  border-radius: 12px;
}

.viewer-frame {
  width: 100%;
  height: 75vh;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.viewer-text {
  max-height: 70vh;
  margin: 0;
  padding: 14px;
  overflow: auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}

.viewer-media { display: grid; place-items: center; padding: 16px; }
.viewer-media audio,
.viewer-media video { max-width: 100%; }

.viewer-empty { padding: 40px 16px; text-align: center; }

.viewer-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.chat-file .icon { width: 14px; height: 14px; color: var(--muted); }

@media (max-width: 767px) {
  .viewer-frame { height: 62vh; }
  .viewer-actions .btn { width: 100%; }
}

.checkbox-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 11px;
}
.checkbox-list > div { display: flex; }
.checkbox-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
}
.checkbox-list input { width: auto; margin: 0; }

/* Выбор групп доступа карточками (чекбоксы скрыты) */

.group-field {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
.group-field > legend {
  padding: 0;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
}
.group-picker { display: flex; flex-direction: column; gap: 14px; }
.group-picker-section {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
.group-picker-section > legend {
  padding: 0;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.group-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 8px;
}
.group-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 34px 11px 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 11px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.group-card:hover { border-color: var(--border-strong); }
.group-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
.group-card-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.group-card-name { font-size: 13px; font-weight: 600; color: var(--text); }
.group-card-desc { font-size: 11.5px; line-height: 1.35; color: var(--muted); }
.group-card-mark {
  position: absolute;
  top: 9px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  opacity: 0;
  transform: scale(.6);
  transition: opacity .15s ease, transform .15s ease;
}
.group-card:has(input:checked),
.group-card.is-checked {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px var(--primary);
}
.group-card:has(input:checked) .group-card-mark,
.group-card.is-checked .group-card-mark { opacity: 1; transform: scale(1); }
.group-card:has(input:focus-visible) {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Модальный просмотрщик вложений */

body.viewer-open { overflow: hidden; }

.viewer-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
}
.viewer-modal[hidden] { display: none; }

.viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, .7);
  backdrop-filter: blur(3px);
}

.viewer-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1040px, 100%);
  max-height: 92vh;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.viewer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.viewer-head strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-body {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 200px;
  padding: 14px;
  overflow: auto;
  background: var(--surface-2);
}
.viewer-body img {
  max-width: 100%;
  max-height: 72vh;
  border-radius: 12px;
}
.viewer-body iframe {
  width: 100%;
  height: 72vh;
  border: 0;
  border-radius: 10px;
  background: #fff;
}
.viewer-body pre {
  width: 100%;
  max-height: 72vh;
  margin: 0;
  overflow: auto;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}
.viewer-body audio,
.viewer-body video { max-width: 100%; }

.viewer-foot {
  display: flex;
  justify-content: flex-end;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}

@media (max-width: 767px) {
  .viewer-modal { padding: 10px; }
  .viewer-body iframe { height: 64vh; }
  .viewer-foot .btn { width: 100%; }
}

.flag-badges { display: flex; flex-wrap: wrap; gap: 4px; }

.checkbox-list--single { grid-template-columns: 1fr; }
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.checkbox-row:last-child { border-bottom: 0; }
.checkbox-row input { width: auto; margin-top: 3px; }
.checkbox-row span { display: flex; flex-direction: column; gap: 2px; }
.checkbox-row strong { font-size: 13.5px; font-weight: 600; }
.checkbox-row small { line-height: 1.4; }

/* Уведомления */

.bell-btn { position: relative; }
.bell-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.notification-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  align-items: stretch;
  gap: 10px;
}

.notification {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: inherit;
  box-shadow: var(--shadow-sm);
}
.notification:hover { text-decoration: none; border-color: var(--border-strong); }
.notification.is-unread {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
}

.notification-dot {
  width: 8px;
  height: 8px;
  flex: none;
  margin-top: 7px;
  border-radius: 50%;
  background: transparent;
}
.notification.is-unread .notification-dot { background: var(--primary); }

.notification-main { min-width: 0; flex: 1; }
.notification-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.notification-title { font-size: 14px; font-weight: 600; }
.notification-body { margin-top: 2px; color: var(--text-soft); font-size: 13px; }
.notification-time {
  flex: none;
  margin-left: auto;
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

/* Стороны чата и ответы */

.chat-message.is-mine { flex-direction: row-reverse; }
.chat-message.is-mine .chat-bubble {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 28%, var(--border));
}
.chat-message.is-mine .chat-meta strong { color: var(--primary-text); }

.chat-reply-btn {
  margin-left: auto;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s ease;
}
.chat-message:hover .chat-reply-btn,
.chat-reply-btn:focus { opacity: 1; }

.chat-quote {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 100%;
  margin: 4px 0 6px;
  padding: 5px 8px;
  background: var(--surface);
  border-left: 2px solid var(--primary);
  border-radius: 6px;
  font-size: 12px;
  color: var(--muted);
}
.chat-quote strong { color: var(--text-soft); font-size: 11.5px; }
.chat-quote span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-reply-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
}
.chat-reply-info { display: flex; flex-direction: column; min-width: 0; }
.chat-reply-info strong { font-size: 12px; }
.chat-reply-info span {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 767px) {
  .chat-reply-btn { opacity: 1; }
}

/* Установка приложения (PWA) */

.install-app-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
}

.install-modal {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  place-items: center;
  padding: 20px;
}
.install-modal[hidden] { display: none; }

.install-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, .7);
  backdrop-filter: blur(3px);
}

.install-dialog {
  position: relative;
  width: min(460px, 100%);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.install-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.install-head h2 { margin: 0; font-size: 16px; }

.install-body { padding: 14px 16px; font-size: 14px; }
.install-body ol { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
.install-body p { margin: 0 0 8px; }

.install-actions {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

#delete-notification-modal .install-head .icon-btn {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: var(--muted);
}
#delete-notification-modal .install-head .icon-btn:hover {
  background: transparent;
  border: 0;
  color: var(--danger);
}

.offline-card { text-align: left; }

/* Галочки сообщений: ✓ отправлено, ✓✓ прочитано */

.chat-checks {
  margin-left: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  letter-spacing: -2px;
}
.chat-checks.is-read { color: #3b82f6; }

/* Системные уведомления */

.notify-settings {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.notify-settings strong { font-size: 13.5px; }
.notify-settings p { margin: 2px 0 0; }

@media (max-width: 560px) {
  .notify-settings { align-items: flex-start; flex-direction: column; }
  .notify-settings .btn { width: 100%; }
}

.notify-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.notify-error { margin: 4px 0 0; color: var(--danger); }

/* Время и галочки — правый нижний угол сообщения */

.chat-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}
.chat-time { font-size: 11px; }
.chat-foot .chat-checks { margin-left: 0; }

/* Красивые галочки */

.chat-check-icon {
  width: 15px;
  height: 15px;
  display: block;
}
.chat-checks { display: inline-flex; align-items: center; }

/* Всплывающие уведомления внутри сайта */

.toast-stack {
  position: fixed;
  top: 64px;
  right: 16px;
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100% - 32px));
  pointer-events: none;
}

.app-toast {
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 34px 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 12px;
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  animation: toast-in .18s ease;
}
.app-toast:hover { text-decoration: none; border-color: var(--border-strong); }

.app-toast-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.app-toast-close:hover { color: var(--danger); background: transparent; }

.app-toast-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 3px;
  background: var(--primary);
  transform-origin: left center;
  animation: toast-progress 8s linear forwards;
}
.app-toast:hover .app-toast-progress { animation-play-state: paused; }
@keyframes toast-progress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

.app-toast-group {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-right: 12px;
  border-left-color: var(--warning);
  font-size: 12.5px;
}
.app-toast-group strong { font-size: 12.5px; }
.app-toast-group span {
  display: inline;
  -webkit-line-clamp: unset;
  color: var(--muted);
}
.app-toast strong { font-size: 13px; }
.app-toast span {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 12px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 767px) {
  .toast-stack { top: 60px; left: 12px; right: 12px; width: auto; }
}

.app-toast-time {
  margin-top: 2px;
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

/* Профиль */

.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.profile-head strong { display: block; font-size: 16px; }

.avatar-lg {
  width: 52px;
  height: 52px;
  font-size: 18px;
  flex: none;
}

.profile-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 16px;
  align-items: start;
}
.profile-grid .form-card { margin: 0; }
.form-title { margin: 0 0 14px; font-size: 15px; }

@media (max-width: 900px) {
  .profile-grid { grid-template-columns: 1fr; }
}

/* Аватар и Wi-Fi токен */

.avatar { overflow: hidden; }
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wifi-card { margin-top: 16px; }
.wifi-card-head h2 { margin: 0 0 2px; font-size: 15px; }
.wifi-token-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.wifi-token-row code {
  flex: 1;
  overflow: hidden;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.empty-inline { padding: 12px 0 0; }
@media (max-width: 560px) {
  .wifi-token-row { align-items: stretch; flex-direction: column; }
  .wifi-token-row .btn { width: 100%; }
}

/* Красивый выбор фото */

.avatar-editor {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 14px;
}

.avatar-preview {
  width: 92px;
  height: 92px;
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-text);
  font-size: 30px;
  font-weight: 700;
}
.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.avatar-pick {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.avatar-pick input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}

.avatar-filename {
  min-height: 16px;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .avatar-editor { align-items: flex-start; }
  .avatar-controls { flex: 1; }
  .avatar-pick { width: 100%; }
  .avatar-filename { max-width: 100%; }
}

.profile-grid > * { min-width: 0; }
.profile-grid .form-card { width: 100%; min-width: 0; }
.wifi-token-row code { min-width: 0; }

.side-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.side-actions form { margin: 0; }

/* Сворачиваемые разделы сайдбара */

.nav-section { display: flex; flex-direction: column; gap: 2px; }

.nav-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin: 12px 0 4px;
  padding: 7px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .075em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease;
}
.nav-toggle:hover { background: var(--surface-2); color: var(--text); }
.nav-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.nav-toggle .nav-chevron {
  width: 20px;
  height: 20px;
  padding: 3px;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  transition: transform .28s cubic-bezier(.4, 0, .2, 1),
              background-color .18s ease, color .18s ease;
}
.nav-toggle:hover .nav-chevron { color: var(--text-soft); }
.nav-toggle[aria-expanded="true"] { color: var(--text-soft); }
.nav-toggle[aria-expanded="true"] .nav-chevron {
  background: var(--primary-soft);
  color: var(--primary);
}
.nav-toggle[aria-expanded="false"] .nav-chevron { transform: rotate(-90deg); }

/* Аккордеон: высота и прозрачность анимируются, скрытие — после перехода. */
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
  max-height: none;
  opacity: 1;
  transition: max-height .28s cubic-bezier(.4, 0, .2, 1), opacity .22s ease;
}
.nav-group[hidden] { display: none; }

/* Приёмная компании */

.reception-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.reception-card { display: flex; flex-direction: column; gap: 2px; }
.reception-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-bottom: 8px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
}
.reception-icon .icon { width: 18px; height: 18px; }
.reception-value { font-size: 15px; font-weight: 600; }
.reception-hint { color: var(--muted); font-size: 11.5px; }

.reception-columns {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.reception-person {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.reception-person:last-child { border-bottom: 0; }
.reception-person-info { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.reception-contacts { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: 13px; }

.reception-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

@media (max-width: 1100px) {
  .reception-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .reception-columns { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .reception-grid { grid-template-columns: 1fr; }
  .reception-actions .btn { width: 100%; }
}

/* =========================================================
   Глобальный чат с ИКТ — на всех страницах
   ========================================================= */

.support-chat {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 120;
}

.support-fab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 50px;
  padding: 0 18px 0 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background-color .18s ease, transform .18s ease;
}
.support-fab:hover { background: var(--primary-hover); transform: translateY(-1px); }
.support-fab-icon { width: 24px; height: 24px; display: grid; place-items: center; }
.support-fab .icon { width: 21px; height: 21px; }
.support-fab-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}
.support-chat.is-open .support-fab { display: none; }

.support-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(400px, calc(100vw - 24px));
  height: min(620px, calc(100dvh - 110px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  animation: support-in .18s ease;
}

@keyframes support-in {
  from { opacity: 0; transform: translateY(8px) scale(.99); }
  to { opacity: 1; transform: none; }
}

.support-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.support-head-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.support-head-main strong {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.support-head-sub {
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.support-back .icon { width: 18px; height: 18px; }
.support-close {
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
}

.support-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.support-list-view,
.support-chat-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.support-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px 9px;
  border-bottom: 1px solid var(--border);
}
.support-tabs { display: flex; gap: 6px; }
.support-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.support-tab.is-active {
  border-color: transparent;
  background: var(--primary-soft);
  color: var(--primary-text);
}
.support-tab-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
}
.support-tab.is-active .support-tab-count {
  background: var(--primary);
  color: #fff;
}

.support-search {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
.support-search .icon { width: 16px; height: 16px; color: var(--muted); }
.support-search input {
  flex: 1;
  min-width: 0;
  padding: 8px 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}
.support-search input::-webkit-search-cancel-button { cursor: pointer; }

.support-items {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.support-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.support-item:hover { background: var(--surface-2); }
.support-item.is-active { background: var(--primary-soft); }
.support-item .avatar { margin-top: 1px; }
.support-item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.support-item-top {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.support-item-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 600;
}
.support-online-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--muted);
}
.support-online-dot.is-online {
  background: var(--success);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 18%, transparent);
}
.support-item-online {
  flex: none;
  color: var(--success);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}
.support-item-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}
.support-item-viewers {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--success);
  font-size: 11px;
  font-weight: 600;
}
.support-item-side {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}
.support-item-time { color: var(--muted); font-size: 10.5px; }
.support-item-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
}
.support-empty {
  padding: 30px 18px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.support-presence {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
}
.support-presence-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.support-presence strong { color: var(--text-soft); font-weight: 600; }
.support-presence-viewers { color: var(--success); font-weight: 600; }
.support-presence-archive { color: var(--warning); }
.support-archive-btn {
  margin-left: auto;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.support-archive-btn:hover { border-color: var(--border-strong); }

.support-note {
  margin: 8px 12px 0;
  padding: 7px 10px;
  border-radius: 9px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 11.5px;
  line-height: 1.4;
}

.support-messages {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.support-messages .chat-message { gap: 8px; }
.support-messages .chat-bubble {
  max-width: calc(100% - 38px);
  padding: 7px 11px;
}
.support-messages .chat-bubble p { font-size: 13.5px; }
.support-messages .chat-image { max-width: 220px; max-height: 170px; }
.support-messages .chat-empty { padding: 22px 0; }

.support-composer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 9px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.support-composer textarea {
  flex: 1;
  min-height: 40px;
  max-height: 110px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--text);
  outline: none;
  resize: none;
  font-size: 13.5px;
}
.support-composer textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.support-composer .chat-icon { width: 40px; height: 40px; border-radius: 11px; }
.support-composer .chat-send { height: 40px; }
.support-error {
  margin: 0 12px 10px;
  padding: 7px 10px;
  border-radius: 9px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12px;
}

@media (max-width: 767px) {
  body.support-open { overflow: hidden; }
  .support-chat {
    right: 14px;
    bottom: calc(78px + env(safe-area-inset-bottom));
  }
  .support-fab { height: 48px; padding: 0 14px; }
  .support-fab-text { display: none; }
  .support-panel {
    position: fixed;
    inset: 0;
    width: auto;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }
  .support-head { padding-top: calc(10px + env(safe-area-inset-top)); }
  .support-composer .chat-send span { display: none; }
  .support-composer .chat-send { width: 40px; padding: 0; }
  .support-messages .chat-bubble { max-width: calc(100% - 34px); }
}

@media (max-width: 420px) {
  .support-panel { width: 100vw; }
  .support-presence { gap: 4px 8px; }
}

[data-theme="dark"] .support-fab,
[data-theme="dark"] .support-item-badge,
[data-theme="dark"] .support-tab.is-active .support-tab-count {
  color: #0b1220;
}

/* Уведомления: карточка с крестиком внутри (в правом верхнем углу) */
.notification-row {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}
.notification-row .notification {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  padding-right: 46px;
}
.notification-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: flex;
}
.notification-delete {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  opacity: .65;
  transition: opacity .15s ease, background .15s ease, color .15s ease;
}
.notification-delete svg { width: 14px; height: 14px; }
.notification-delete:hover {
  opacity: 1;
  color: var(--danger);
  background: transparent;
}
.notification-delete:focus-visible {
  opacity: 1;
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
/* Колокольчик: выпадающая панель с последними уведомлениями */
.bell-wrap { position: relative; }
.bell-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 60;
  width: min(340px, calc(100vw - 32px));
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.bell-panel[hidden] { display: none; }
.bell-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px 8px;
}
.bell-panel-count {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-text);
  font-size: 11px;
  font-weight: 600;
}
.bell-panel-list { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow: auto; }
.bell-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  border-radius: 8px;
  color: inherit;
}
.bell-item:hover { background: var(--surface-2); text-decoration: none; }
.bell-item.is-unread { background: var(--primary-soft); }
.bell-item-title { font-size: 13px; font-weight: 600; }
.bell-item-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}
.bell-item-body { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bell-panel-all {
  display: block;
  margin-top: 4px;
  padding: 8px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
}
.bell-panel-empty { padding: 12px 8px; color: var(--muted); font-size: 13px; }
/* Кнопка опасного действия (подтверждение удаления) */
.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: var(--danger); opacity: .9; color: #fff; }
/* Закрепление уведомления и исчезновение карточки */
.notification-pin {
  order: -1;
  flex: 0 0 auto;
  margin-top: 10px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  opacity: .55;
  transition: opacity .15s ease, color .15s ease;
}
.notification-pin svg { width: 14px; height: 14px; }
.notification-pin:hover { opacity: 1; color: var(--warning); }
.notification-pin.is-active { opacity: 1; color: var(--warning); }
.notification-row.is-pinned .notification { border-left: 3px solid var(--warning); }
.notification-row.is-removing {
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .18s ease, transform .18s ease;
}
/* Дата в нижнем правом углу карточки и перегородки */
.notification-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.notification-footer .notification-time { margin-left: 0; }
.notification-break {
  grid-column: 1 / -1;
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}