/* === Layout === */
.app {
  display: grid;
  grid-template-columns: var(--gh-sidebar-current, 230px) minmax(0, 1fr);
  min-height: calc(100vh / var(--ui-zoom, 1));
  --gh-sidebar-expanded: 230px;
  --gh-sidebar-collapsed: 72px;
  --gh-sidebar-current: var(--gh-sidebar-expanded);
  transition: grid-template-columns 0.34s cubic-bezier(0.4, 0, 0.2, 1);
}

.app.app--sidebar-collapsed {
  --gh-sidebar-current: var(--gh-sidebar-collapsed);
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: calc(100vh / var(--ui-zoom, 1));
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 0 12px 12px;
  overflow-x: hidden;
  overflow-y: auto;
  transition:
    padding 0.34s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.18s ease;
}

.sidebar__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 8px 16px 14px;
  margin: 0 -12px 8px;
  border-bottom: 1px solid var(--border);
  transition:
    gap 0.28s ease,
    padding 0.34s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  position: relative;
  padding: 0;
  margin: 0;
  border: none;
  transition: justify-content 0.28s ease;
}

.sidebar__brand img { flex-shrink: 0; }
.sidebar__logo { width: 100%; max-width: 168px; height: auto; display: block; }
.sidebar__logo-mark { display: none !important; width: 48px; height: 48px; object-fit: contain; }
.app.app--sidebar-collapsed .sidebar__logo { display: none !important; }
.app.app--sidebar-collapsed .sidebar__logo-mark { display: block !important; }
.sidebar__group {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-soft);
  font-weight: 600;
  padding: 14px 12px 6px;
  white-space: nowrap;
}
.app.app--sidebar-collapsed .sidebar__group { visibility: hidden; height: 12px; padding: 0; }
.sidebar__brand-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.24s ease, max-width 0.34s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 200px;
  opacity: 1;
}

.sidebar__brand-name span { color: var(--accent-700); }

.sidebar__rail-btn {
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    background 0.16s ease,
    color 0.16s ease,
    transform 0.14s ease;
}

.sidebar__rail-btn:hover {
  background: color-mix(in srgb, var(--surface-2) 88%, var(--accent-50));
  color: var(--accent-700);
}

.sidebar__rail-btn:active {
  transform: scale(0.94);
}

.sidebar__rail-btn:focus-visible {
  outline: none;
  background: color-mix(in srgb, var(--surface-2) 85%, var(--accent-50));
  box-shadow: 0 0 0 2px var(--accent-50), 0 0 0 1px var(--accent-200);
}

@supports not (color: color-mix(in lab, red, red)) {
  .sidebar__rail-btn:hover {
    background: var(--surface-2);
  }
  .sidebar__rail-btn:focus-visible {
    background: var(--surface-2);
  }
}

.sidebar__rail-chevron {
  display: inline-block;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.22em;
  margin-right: 0.06em;
  user-select: none;
}

.app.app--sidebar-collapsed .sidebar__top {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 2px 0 14px;
  margin-bottom: 12px;
}

.app.app--sidebar-collapsed .sidebar__brand {
  flex: none;
  width: 100%;
  justify-content: center;
  align-items: center;
  gap: 0;
}

.app.app--sidebar-collapsed .sidebar__brand-name {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
  max-width: none;
}

.app.app--sidebar-collapsed .sidebar__brand img {
  display: block;
  margin-inline: auto;
}

.sidebar__nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar__link {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  gap: 11px;
  color: #334155;
  font-weight: 500;
  transition: background .15s, color .15s, padding .28s ease, gap .28s ease, justify-content .28s ease;
}
.sidebar__link:hover { background: #F1F5EC; color: var(--text); }
.sidebar__link--active {
  background: var(--accent-50);
  color: var(--accent-700);
  font-weight: 600;
}
.sidebar__link svg { width: 19px; height: 19px; flex-shrink: 0; opacity: .8; }
.sidebar__link--active svg { opacity: 1; }

.app.app--sidebar-collapsed .sidebar__link {
  justify-content: center;
  gap: 0;
  padding: 11px 8px;
}

.app.app--sidebar-collapsed .sidebar__link span {
  position: absolute;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  white-space: nowrap;
  border: 0;
}
.sidebar__footer { padding-top: 12px; border-top: 1px solid var(--border); }

.app.app--sidebar-collapsed .sidebar {
  padding: 16px 6px;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: calc(100vh / var(--ui-zoom, 1));
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.topbar__title { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.topbar__right { display: flex; align-items: center; gap: 16px; }
.topbar__bell {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: var(--radius);
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: background .15s, color .15s, border-color .15s;
}
.topbar__bell:hover { color: var(--text); background: var(--accent-50); }
.topbar__bell.is-active { color: var(--accent-700); background: var(--accent-50); }
.topbar__badge-slot { position: absolute; top: -2px; right: -2px; }
.topbar__badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  font-size: 11px; font-weight: 700;
  background: var(--danger);
  color: white;
  border-radius: 999px;
  border: 2px solid var(--bg-2);
}
.list-row--unread { border-left: 3px solid var(--accent); background: var(--accent-50); }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  gap: 9px;
  padding: 3px 12px 3px 3px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.user-chip:hover {
  border-color: var(--accent-200, var(--accent));
  background: var(--surface);
}
.user-chip:active { transform: translateY(1px); }
.user-chip:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-50);
}
.user-chip__avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
  overflow: hidden;
  flex-shrink: 0;
}
.user-chip__avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

/* ───── Профиль пользователя ───── */
.profile-form { max-width: 720px; display: flex; flex-direction: column; gap: 20px; }
.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.profile-card__head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.profile-avatar-pick {
  position: relative;
  display: block;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  cursor: pointer;
  margin: 0;
  outline: none;
}
.profile-avatar-pick:focus-visible .profile-avatar-pick__ring {
  box-shadow: 0 0 0 3px var(--accent-50);
}

.profile-avatar-pick__ring {
  position: relative;
  display: block;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--accent);
  color: #fff;
  border: 2px solid var(--border);
  box-sizing: border-box;
  flex-shrink: 0;
}

.profile-avatar-pick__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.profile-avatar-pick__img--hidden {
  display: none;
}

.profile-avatar-pick__initials {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 600;
}

.profile-avatar-pick__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.48);
  color: rgba(255, 255, 255, 0.95);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.profile-avatar-pick:hover .profile-avatar-pick__overlay,
.profile-avatar-pick:focus-within .profile-avatar-pick__overlay {
  opacity: 1;
}

.profile-avatar-pick .profile-avatar-pick__input {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  width: 72px;
  height: 72px;
  font-size: 0 !important;
  padding: 0;
  border: none;
}

.profile-card__name { font-size: 18px; font-weight: 600; color: var(--text); }
.profile-card__sub { font-size: 13px; margin-top: 2px; }
.profile-card__title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 14px 18px;
}
.profile-grid__full { grid-column: 1 / -1; }

.profile-actions { display: flex; justify-content: flex-end; }
.content {
  padding: 24px 28px;
}

/* Страницы с канбаном: нижняя зона до низа окна, скролл внутри колонок */
.content:has(.kanban) {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-bottom: 16px;
}
.content:has(.kanban) > .page-header,
.content:has(.kanban) > .filters {
  flex-shrink: 0;
}

/* Канбан сразу в .content (проекты, задачи …) */
.content:has(.kanban) > .kanban {
  flex: 1;
  min-height: 0;
}

/* CRM заявки: канбан внутри #leads-workspace-pane */
.content:has(.leads-pane-kanban) > #leads-workspace-pane.leads-pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.content:has(.leads-pane-kanban) .leads-pane-kanban {
  flex: 1;
  min-height: 0;
}

/* === Buttons === */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
  text-decoration: none;
  background: transparent;
  color: var(--text);
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn--primary:hover { background: var(--accent-700); border-color: var(--accent-700); color: #fff; }
.btn--dark { background: var(--accent-700); border-color: var(--accent-700); color: #fff; }
.btn--dark:hover { background: #6E5F49; border-color: #6E5F49; color: #fff; }
.btn--ghost {
  border-color: var(--border);
  color: #334155;
  background: var(--bg-2);
}
.btn--ghost:hover { border-color: var(--accent-200); color: var(--text); background: var(--accent-50); }
.btn--danger {
  background: var(--danger); color: white; border-color: var(--danger);
}
.btn--danger:hover { background: #DC2626; }
.btn--sm { padding: 6px 12px; font-size: 12px; }
.btn--icon {
  padding: 6px;
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
}
.btn--icon:hover { background: var(--surface-2); color: var(--text); }
.btn svg { width: 16px; height: 16px; }

/* === Inputs === */
.gh-input, .gh-select, .gh-textarea {
  width: 100%;
  padding: 9px 13px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-2);
  font: inherit;
  font-size: 13px;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.gh-textarea { font-family: inherit; resize: vertical; min-height: 80px; }
.gh-input:focus, .gh-select:focus, .gh-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-50);
}
.gh-file {
  width: 100%; padding: 10px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  font: inherit;
}

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field__label { font-size: 11px; font-weight: 600; color: var(--text-soft); text-transform: uppercase; letter-spacing: .04em; }
.field__error { color: var(--danger); font-size: 12px; }
.row { display: grid; gap: 14px; }
.row--2 { grid-template-columns: 1fr 1fr; }
.row--3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 720px) { .row--2, .row--3 { grid-template-columns: 1fr; } }

/* === Cards === */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card__header {
  padding: 16px 20px 0;
  border-bottom: none;
  display: flex; align-items: center; justify-content: space-between;
}
.card__title { font-weight: 600; font-size: 15px; }
.card__body { padding: 16px 20px 18px; }
.card__body--tight { padding: 12px; }

.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
}
.metric__label { color: var(--text-soft); font-size: 11px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.metric__value { margin: 6px 0; font-size: 30px; font-weight: 800; color: var(--text); letter-spacing: -.02em; line-height: 1.15; }
.metric__hint { margin-top: 4px; font-size: 12px; color: var(--text-soft); }

/* === Badges === */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.badge--accent { background: var(--accent-50); color: var(--accent-700); border-color: var(--accent-100); }
.badge--source { background: var(--surface-2); }
.badge--source .dot { width: 8px; height: 8px; border-radius: 50%; }
.badge--stage { font-weight: 600; }

/* === Tables === */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table th, .table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.table th {
  background: var(--surface-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--text-muted);
  font-weight: 600;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }

/* === Tabs === */
.tabs {
  display: inline-flex; gap: 6px;
  max-width: 100%;
  overflow-x: auto;
  padding: 4px;
  margin-bottom: 18px;
  background: var(--surface-3);
  border-radius: var(--radius);
}
.tabs__item {
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  border-radius: var(--radius-pill);
  white-space: nowrap;
  transition: color .15s, background .15s, box-shadow .15s;
}
.tabs__item:hover { color: var(--text); }
.tabs__item--active {
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

/* === Page header === */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
}
.page-header h1 {
  font-size: 22px; font-weight: 600; margin: 0;
  letter-spacing: -.01em;
}
.page-header__actions { display: flex; gap: 8px; align-items: center; }

/* === Filters bar === */
.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-bottom: 18px;
  background: var(--surface);
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.filters .gh-input, .filters .gh-select { width: auto; min-width: 160px; }

/* === Login === */
.auth {
  min-height: calc(100vh / var(--ui-zoom, 1));
  display: grid; place-items: center;
  background:
    radial-gradient(1200px 600px at 80% -10%, var(--accent-50) 0%, transparent 60%),
    var(--bg);
  padding: 24px;
}
.auth__card {
  width: 100%; max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-lg);
}
.auth__brand {
  display: flex; align-items: center; gap: 12px; margin-bottom: 22px;
}
.auth__brand { justify-content: center; }
.auth__logo { width: 100%; max-width: 220px; height: auto; }
.auth__brand-name { font-size: 20px; font-weight: 700; }
.auth__brand-name span { color: var(--accent-700); }
.auth__title { font-size: 22px; font-weight: 700; margin: 0 0 4px; letter-spacing: -.01em; }
.auth__sub { color: var(--text-muted); margin: 0 0 20px; }
.auth__error {
  background: #FEF2F2; color: #B91C1C;
  border: 1px solid #FECACA; border-radius: var(--radius);
  padding: 10px 12px; margin-bottom: 14px; font-size: 13px;
}

/* === Empty state === */
.empty {
  text-align: center;
  color: var(--text-soft);
  font-size: 13px;
  padding: 26px 16px;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}

/* === Lists === */
.list-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  margin-bottom: 8px;
}
.list-row__main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.list-row__main .icon { color: var(--text-soft); flex-shrink: 0; }
.list-row__name { font-weight: 500; color: var(--text); }
.list-row__meta { color: var(--text-soft); font-size: 12px; }

/* === Comments / messages === */
.comment {
  display: flex; gap: 12px; padding: 12px; border-radius: var(--radius); background: var(--surface-2);
  margin-bottom: 8px;
}
.comment__avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: white;
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
  flex-shrink: 0;
}
.comment__author { font-weight: 600; }
.comment__time { color: var(--text-soft); font-size: 12px; margin-left: 6px; }
.comment__text { color: var(--text); white-space: pre-wrap; word-wrap: break-word; }

/* === Util === */
.muted { color: var(--text-muted); }
.soft { color: var(--text-soft); }
.right { text-align: right; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-2--main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 900px) { .grid-2--main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 960px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .app.app--sidebar-collapsed {
    --gh-sidebar-current: var(--gh-sidebar-expanded);
  }
  .sidebar__rail-btn {
    display: none;
  }
  .app.app--sidebar-collapsed .sidebar {
    padding: 0 12px 12px;
  }
  .app.app--sidebar-collapsed .sidebar__logo { display: block !important; }
  .app.app--sidebar-collapsed .sidebar__logo-mark { display: none !important; }
  .app.app--sidebar-collapsed .sidebar__group { visibility: visible; height: auto; padding: 14px 12px 6px; }
  .app.app--sidebar-collapsed .sidebar__top {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 18px 8px 16px 14px;
    margin: 0 -12px 8px;
  }
  .app.app--sidebar-collapsed .sidebar__brand {
    justify-content: flex-start;
    flex: 1;
    width: auto;
    gap: 10px;
  }
  .app.app--sidebar-collapsed .sidebar__brand-name {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    overflow: visible;
    clip-path: none;
    white-space: nowrap;
    border: 0;
    opacity: 1;
    pointer-events: auto;
    max-width: 200px;
  }
  .app.app--sidebar-collapsed .sidebar__brand img {
    margin-inline: 0;
    display: inline-block;
  }
  .app.app--sidebar-collapsed .sidebar__link {
    justify-content: flex-start;
    gap: 10px;
    padding: 10px 12px;
  }
  .app.app--sidebar-collapsed .sidebar__link span {
    position: static;
    clip: auto;
    clip-path: none;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    white-space: normal;
  }
}

/* === SMK: общие элементы из прототипа === */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; padding: 3px 9px;
  border-radius: 20px;
  background: var(--accent-50); color: var(--accent-700);
  font-weight: 600;
}
.note {
  background: #FFFBEB; border: 1px solid #FDE68A; color: #92400E;
  border-radius: 12px; padding: 12px 14px; font-size: 12.5px;
}
.flash {
  border-radius: 12px; padding: 11px 14px; margin-bottom: 14px; font-size: 13px;
  border: 1px solid var(--accent-200); background: var(--accent-50); color: var(--accent-700);
}
.flash--success { background: #F0FDF4; border-color: #BBF7D0; color: #166534; }
.flash--error { background: #FEF2F2; border-color: #FECACA; color: #B91C1C; }
.btn--xs { padding: 2px 6px; font-size: 11px; }
.topbar__crumb { color: var(--text-soft); font-weight: 500; }
.topbar__crumb:hover { color: var(--accent-700); }

/* Секция формы */
.form-section { margin: 8px 0 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.form-section__title { font-size: 15px; font-weight: 600; }
.form-section__hint { margin: 2px 0 14px; color: var(--text-soft); font-size: 12.5px; }
.form-cover-preview { width: 220px; height: 110px; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); }
/* Таблица «ключ — значение» внутри карточки */
.table--kv { border: none; box-shadow: none; border-radius: 0; }
.table--kv th { background: transparent; width: 40%; padding-left: 0; }
.table--kv td { padding-right: 0; }
.table--kv tbody tr:hover { background: transparent; }

/* ── Выпадающие списки (static/js/gh_select.js) ── */
.gsel { position: relative; display: inline-block; min-width: 0; vertical-align: middle; }
.gsel--block { display: block; width: 100%; }
.gsel__native {
  position: absolute !important; inset: 0; width: 100% !important; height: 100% !important;
  opacity: 0 !important; pointer-events: none !important; margin: 0 !important;
}
.gsel__btn {
  position: relative; width: 100%; min-height: 38px; display: flex; align-items: center; gap: 8px;
  padding: 0 12px 0 13px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-2); font: inherit; font-size: 13px; color: var(--text); text-align: left; cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.gsel__btn:hover { border-color: var(--border-strong); }
.gsel__btn:focus-visible, .gsel.is-open .gsel__btn { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-50); }
.gsel__btn:disabled { opacity: .6; cursor: not-allowed; }
.gsel__btn.is-placeholder .gsel__label { color: var(--text-soft); }
.gsel__label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gsel__chev { width: 15px; height: 15px; flex-shrink: 0; color: var(--text-soft); transition: transform .15s; }
.gsel.is-open .gsel__chev { transform: rotate(180deg); }
.gsel__dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.gsel__pop {
  position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; min-width: 100%; width: max-content; max-width: min(360px, 92vw);
  padding: 6px; background: #fff; border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 16px 40px -12px rgba(15, 23, 42, .25);
}
.gsel.is-up .gsel__pop { top: auto; bottom: calc(100% + 6px); }
.gsel__search { width: 100%; margin-bottom: 6px; padding: 8px 11px; border: 1px solid var(--border); border-radius: 10px; font: inherit; font-size: 13px; outline: none; }
.gsel__search:focus { border-color: var(--accent); }
.gsel__list { max-height: 280px; overflow-y: auto; }
.gsel__opt { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; font-size: 13.5px; color: var(--text); }
.gsel__opt span { flex: 1; }
.gsel__opt.is-active { background: var(--surface-2); }
.gsel__opt.is-selected { background: var(--accent-50); font-weight: 600; }
.gsel__opt.is-empty span { color: var(--text-soft); }
.gsel__opt.is-hidden { display: none; }
.gsel__opt.is-disabled { opacity: .45; cursor: not-allowed; }
.gsel__tick { width: 15px; height: 15px; color: var(--accent-700); opacity: 0; }
.gsel__opt.is-selected .gsel__tick { opacity: 1; }
/* В панелях фильтров — «таблетки» высотой как остальные контролы */
.filters .gsel__btn, .workspace-toolbar .gsel__btn { height: 40px; border-radius: 999px; padding: 0 14px 0 16px; min-width: 160px; background: var(--surface); }
.filters .gsel { flex: 0 1 auto; }

/* Заголовок страницы — только в верхней панели; здесь остаются кнопки, прижатые вправо. */
.page-header--actions { justify-content: flex-end; margin-bottom: 14px; }

/* Поле выбора файла: кнопка в стиле системы вместо системной «Выберите файл» */
input[type=file] { font: inherit; font-size: 13px; color: var(--text-muted); max-width: 100%; }
input[type=file]::file-selector-button {
  margin-right: 10px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s;
}
input[type=file]::file-selector-button:hover { background: var(--accent-50); border-color: var(--accent-200); }
.gh-file { padding: 6px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); width: 100%; }
.metric__value { white-space: nowrap; }

/* Широкая таблица листается сама, страница не уезжает вбок */
.table-scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-lg); }
.table-scroll > .table { min-width: 100%; }
.table-scroll > .table th { white-space: nowrap; }
@media (max-width: 720px) {
  .page-header { flex-wrap: wrap; }
  .page-header__actions { flex-wrap: wrap; }
}


/* ── CRM на телефоне: шапка с бургером, меню-шторка, нижняя панель разделов ── */
.topbar__burger, .app-tabbar, .app__scrim { display: none; }
@media (max-width: 720px) {
  .app { display: block; }
  .app .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 70;
    width: min(290px, 84vw); height: calc(100vh / var(--ui-zoom, 1)); max-height: none;
    transform: translateX(-102%); transition: transform .22s ease;
    box-shadow: 12px 0 40px -18px rgba(15, 23, 42, .45); overflow-y: auto;
  }
  .app.app--menu-open .sidebar { transform: none; }
  .app .sidebar__rail-btn { display: none; }
  .app__scrim {
    display: block; position: fixed; inset: 0; z-index: 60; background: rgba(15, 23, 42, .35);
    opacity: 0; pointer-events: none; transition: opacity .2s ease;
  }
  .app.app--menu-open .app__scrim { opacity: 1; pointer-events: auto; }

  .app .topbar { position: sticky; top: 0; z-index: 40; gap: 10px; padding: 10px 14px; }
  .topbar__burger {
    display: grid; place-items: center; width: 38px; height: 38px; flex-shrink: 0;
    border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text); cursor: pointer;
  }
  .app .topbar__title { flex: 1; min-width: 0; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .app .user-chip > span { display: none; }

  .app-tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .94);
    -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
    border-top: 1px solid var(--border); box-shadow: 0 -6px 20px -12px rgba(15, 23, 42, .25);
  }
  .app-tabbar__i {
    display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 2px;
    border: 0; background: none; font: inherit; font-size: 10.5px; font-weight: 600; line-height: 1.1;
    color: var(--text-soft); text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .app-tabbar__i svg { width: 44px; height: 28px; padding: 3px 11px; box-sizing: border-box; border-radius: 10px; }
  .app-tabbar__i.is-on { color: var(--accent-700); }
  .app-tabbar__i.is-on svg { background: var(--accent-50); }

  .app .content { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
}

/* Доски, сводка и панель фильтров — на 15% компактнее остального интерфейса.
   Здесь, а не в kanban.css: иначе «Список»/«Архив» без kanban.css прыгают в масштабе. */
.kanban, .board-summary, .filters.workspace-toolbar { zoom: .85; }

/* ── Без анимаций интерфейса (SMK-M-1426): меню всегда раскрыто и не «пересобирается»,
   переключатели и карточки не прыгают ── */
@media (min-width: 721px) {
  .app, .app .sidebar, .app .sidebar * { transition: none !important; }
}
.sidebar__rail-btn { display: none !important; }
.view-mode-switch__btn { transition: none !important; }
.kanban-card { transition: none !important; }
.kanban-card:hover { transform: none !important; }
.kanban-card.sortable-chosen { transform: none !important; }
.leads-pane { transition: none !important; }
.leads-pane.leads-pane--busy { transform: none !important; filter: none !important; }
.leads-pane.leads-pane--reveal { animation: none !important; }

/* Синий системный крестик в полях поиска — убираем, очистка обычным Backspace */
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }

/* Зона выбора файлов: большая кнопка, открывает проводник, можно несколько файлов */
.up-drop {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 96px; margin-bottom: 12px; padding: 14px; border-radius: 14px; cursor: pointer; text-align: center;
  border: 2px dashed var(--border); background: var(--surface-2); color: var(--accent-700);
}
.up-drop:hover, .up-drop.is-filled { border-color: var(--accent); background: var(--accent-50); }
.up-drop__title { font-weight: 600; font-size: 14px; }
.up-drop small { color: var(--text-muted); font-size: 12px; }
.up-drop__input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }

/* ── Документы проекта: файловый менеджер (SMK-M-1432) ── */
.docs-fm { padding: 18px; }
.docs-fm__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.docs-fm__sub { font-size: 12.5px; margin-top: 2px; }
.docs-fm__upload { padding: 14px; margin-bottom: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.docs-fm__inbox { margin-bottom: 12px; padding: 10px 14px; border-radius: 12px; background: #FFF6EC; border: 1px solid #F6D9B8; font-size: 13px; }
.docs-fm__tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 12px; scrollbar-width: none; }
.docs-fm__tab {
  flex: 0 0 auto; padding: 9px 12px; border: 0; background: none; cursor: pointer; font: inherit; font-size: 13.5px;
  color: var(--text-soft); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.docs-fm__tab em { font-style: normal; font-size: 11.5px; color: var(--text-muted); margin-left: 3px; }
.docs-fm__tab:hover:not([disabled]) { color: var(--text); }
.docs-fm__tab.is-on { color: var(--accent-700); border-bottom-color: var(--accent-700); font-weight: 600; }
.docs-fm__tab[disabled] { opacity: .45; cursor: default; }
.docs-fm__tools { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.docs-fm__search {
  flex: 1; min-width: 220px; display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 40px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text-muted);
}
.docs-fm__search input { flex: 1; border: 0; outline: 0; background: none; font: inherit; font-size: 14px; color: var(--text); }
.docs-fm__sort { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-soft); }
.docs-fm__sort .gh-select { min-width: 170px; }
.docs-fm__table { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.docs-fm__row {
  display: grid; grid-template-columns: minmax(0, 2.6fr) minmax(0, 1fr) minmax(0, 1fr) 190px auto;
  gap: 12px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--border); font-size: 13.5px;
}
.docs-fm__row[hidden] { display: none; }
.docs-fm__row--head { border-top: 0; background: var(--surface-2); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); padding-block: 10px; }
.docs-fm__row:not(.docs-fm__row--head):hover { background: #FBFAF8; }
.docs-fm__doc { display: flex; align-items: center; gap: 12px; min-width: 0; }
.docs-fm__ic {
  flex-shrink: 0; width: 38px; height: 44px; border-radius: 8px; display: grid; place-items: center;
  font-size: 10px; font-weight: 800; letter-spacing: .02em; color: #fff; background: #94A3B8;
}
.docs-fm__ic--pdf { background: #DC2626; }
.docs-fm__ic--doc, .docs-fm__ic--docx { background: #2563EB; }
.docs-fm__ic--xls, .docs-fm__ic--xlsx, .docs-fm__ic--csv { background: #16A34A; }
.docs-fm__ic--jpg, .docs-fm__ic--jpeg, .docs-fm__ic--png, .docs-fm__ic--webp, .docs-fm__ic--heic { background: #9333EA; }
.docs-fm__ic--none { background: #CBD5E1; }
.docs-fm__name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.docs-fm__name a, .docs-fm__name b { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docs-fm__name a:hover { color: var(--accent-700); }
.docs-fm__name small { color: var(--text-muted); font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.docs-fm__signed { font-size: 12px; font-weight: 600; color: #15803D !important; white-space: normal !important; }
.docs-fm__kind { color: var(--text-soft); }
.docs-fm__acts { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.docs-fm__acts label { cursor: pointer; white-space: nowrap; }
.docs-fm__acts form { margin: 0; }
.docs-fm__empty { padding: 28px; text-align: center; color: var(--text-muted); }
.docs-fm .doc-status { width: 100%; }
@media (max-width: 900px) {
  .docs-fm__row { grid-template-columns: minmax(0, 1fr) auto; }
  .docs-fm__row--head { display: none; }
  .docs-fm__row > [role="cell"]:nth-child(2), .docs-fm__row > [role="cell"]:nth-child(3) { display: none; }
  .docs-fm__row > [role="cell"]:nth-child(4) { grid-column: 1 / -1; }
  .docs-fm__acts { grid-column: 1 / -1; justify-content: flex-start; }
}

/* Наведение на пункт выпадающего списка — заметная подсветка (SMK-M-1432) */
.gsel__opt:not(.is-disabled):hover, .gsel__opt.is-active { background: #EFEBE4; }
.gsel__opt.is-selected:hover { background: #E8E1D6; }
.msel__opt:hover { background: #EFEBE4; }

.notif-intro {
  display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; padding: 14px 16px;
  border-radius: 14px; background: var(--surface); border: 1px solid var(--border); font-size: 13.5px;
}
.notif-intro span { color: var(--text-soft); line-height: 1.5; }
